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 |
|---|---|---|---|---|---|---|
For Sauce Labs reporting. Returns the current session id.
|
def session_id
@driver.session_id
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def session_id\n Capybara.current_session.driver.browser.instance_variable_get(:@bridge).session_id\n end",
"def session_id\n @session_id || raise(Error::WebDriverError, 'no current session exists')\n end",
"def cracker_session_id\n @session_id ||= ::Rex::Text.rand_text_alphanumeric(8)\n end",
"def session_id\n @response.xpath('//SessionId').text\n end",
"def session_id\n @grpc.name.split(\"/\")[7]\n end",
"def session_id; end",
"def session_id; end",
"def session_id; end",
"def current_session_id(env)\n env[ENV_SESSION_OPTIONS_KEY][:id]\n end",
"def session_id\n @session_id ||= \"#{chip_api.redis_session_prefix}_#{token.claims_token.api_id}\"\n end",
"def grid_session_id\n @browser.driver.session_id\n end",
"def get_session_id\n @agent.get( @root_url + '/dwr/engine.js') do |page|\n @session_id = extract_session_id(page.body)\n end\n end",
"def session_id\n @options[:session_id]\n end",
"def session_id\n @session.nil? ? '' : @session.session_id\n end",
"def get_session_id\n check_lisitng_id\n calendar_frame = get_vrbo_calendar_page.iframes.first.src\n page = @agent.get calendar_frame\n link = page.links[3].href\n uri = Addressable::URI.parse(link)\n uri.query_values['sessionId']\n end",
"def id\n @id ||= scgi.session_id\n end",
"def id\n response_hash[:session_id]\n end",
"def session_id\n session.transport.algorithms.session_id\n end",
"def current_client_id\n @session[@session_key]\n end",
"def session_id\n request.session_options[:id]\n end",
"def get_session_id(name)\n sessions = parse_body get(\"#{admin_url}/sessions/summary\")\n current = sessions.find do |session|\n session[:name] == name\n end\n current&.dig(:id)\n end",
"def session_id\n @session_id ||= initiate_xmlrpc_session\n end",
"def session_id\n @session_id ||= begin\n response = authenticate\n response.body[:authenticate_response][:return]\n end\n end",
"def yii_session_id(sid)\n Digest::MD5.hexdigest(::YiiRedisStore.session_digest).first(5) +\n Digest::MD5.hexdigest(['yii\\redis\\Session', sid].to_json)\n end",
"def reference_number\n @session_id\n end",
"def get_session_id\n\t\t\tresponse = perform_request(MAGIC_BYTES + REQUEST_BYTE[:challenge] + CLIENT_ID)\n\t\t\t\n\t\t\t# the challenge token comes back as a series of bytes that represent the\n\t\t\t# integer we want, so we have to convert it to the actual 32bit int\n\t\t\t[response.slice(5..-2).to_i].pack(\"l>\").bytes.to_a\n\t\tend",
"def session_id\n leftbar_el =get_el doc.css(\"#navigator_bar\")\n return nil if leftbar_el.nil?\n leftbar = leftbar_el.content.to_s\n session_phrase = leftbar.match('Session id: \\d+').to_s\n sesh_id = session_phrase.match('\\d+').to_s.to_i\n sesh_id ||= -1\n return sesh_id\n end",
"def session_id_key\n @session_id_key\n end",
"def session_guid\n UUIDTools::UUID.random_create.to_s\n end",
"def id\n @values.fetch('ai.session.id') { \n @values['ai.session.id'] = nil\n }\n end",
"def session_id\n super\n end",
"def session_id\n super\n end",
"def session_report\n ts = Time.now\n now = ts.to_i\n session_info = Maglev::System.current_session_ids.map do |id|\n sess_desc = Maglev::System.description_of_session id\n sess_desc[0] = sess_desc[0].instance_variable_get(:@_st_userId) # UserProfile\n sess_desc[3] = '' if sess_desc[3] == 0 # Primitive?\n sess_desc[4] = format_secs(now - sess_desc[4]) # View Age\n sess_desc[6] = ['none', 'out', 'in'][sess_desc[6] + 1] # Transaction\n sess_desc[13] = format_secs(now - sess_desc[13]) # Quiet\n sess_desc[14] = format_secs(now - sess_desc[14]) # Age\n sess_desc\n # sess_cache_slot = Maglev::System.cache_slot_for_sessionid id\n end\n session_info\n end",
"def extract_session_id\n self.session_id = (@env[\"rack.session\"] ? @env[\"rack.session\"][\"session_id\"] : nil) || @request.ip\n end",
"def current_id\n session[:user_id]\n end",
"def get_sid(res)\r\n if res.nil?\r\n return '' if res.blank?\r\n end\r\n res.get_cookies.scan(/(JSESSIONID=\\w+);*/).flatten[0] || ''\r\n end",
"def to_param\n session_id\n end",
"def session_key\n @session_key\n end",
"def session_id\n @session_id ||= (bytes = [SecureRandom.uuid.gsub(DASH_REGEX, '')].pack(UUID_PACK)\n BSON::Document.new(id: BSON::Binary.new(bytes, :uuid)))\n end",
"def userid\n \treturn session[:userid]\n \tend",
"def current_user_unique_id\n return current_user.id unless current_user.nil?\n request.session_options[:id]\n end",
"def get_session_id\n p \"==>cookie: #{cookies.inspect}\"\n p \"===>session id=#{session[:sid]} session uid = #{session[:uid]}\"\n p \"cookies[:_wh_session] = #{cookies[:_wh_session] }\"\n\n if cookies[:_wh_session] \n session[:uid] = nil if session[:sid] != session[:sid]\n session[:sid] = cookies[:_wh_session] \n end\n # \n # after uesr first register, the _wh_session will be set in user's cookie\n # which will send by all afteraward quest\n #\n if (params[:sid])\n # reset_session\n\n # p request.host\n # p \"====>>>>dda29\"\n # set cookie first, because this is used to generate sid when write memcached\n if cookies[:_wh_session] == nil or cookies[:_wh_session] != params[:sid] # first time, or manually change session to other session\n\n cookies[:_wh_session] = {\n :value => params[:sid],\n :expires => 1.year.from_now,\n :domain => request.host\n }\n session[:uid] = nil\n end\n # p \"====>>>>dda69\"+params[:sid]\n # p \"====>>>>dda79\"+session[:sid]\n if (session[:sid] == nil || params[:sid] != session[:sid] )\n session[:sid] = params[:sid]\n session[:uid] = nil\n end\n\n # @sid = params[:sid]\n\n # cookies[:_wh_session] = params[:sid]\n # p \"====>>>>dda39\"\n else\n # p \"====>>>>dda19\"\n if !session[:sid]\n sid = cookies[:_wh_session]\n if sid ==nil\n sid = params[:sid] # for dev\n if !sid\n # error(\"session not exist, please restart app\")\n return nil\n end\n end \n session[:sid] = sid\n session[:uid] = nil\n end\n end\n # p \"====>>>>dda9\"\n return session[:sid]\n end",
"def ebayapi_get_session_id\n ebay= Ebay::Api.new\n begin\n response = ebay.get_session_id(:ru_name => EBAY_RU_NAME)\n if response.ack ==\"Success\"\n session_id = response.session_id\n end\n rescue Exception => e\n logger.info e.message\n end\n session_id\n end",
"def current_session\n @_rack_test_current_session ||= rack_test_session\n end",
"def lab_user_id\n plaintext_id = \"#{@view_options[:channel]}:#{user_or_session_id}\"\n Digest::SHA1.base64digest(storage_encrypt(plaintext_id)).tr('=', '')\n end",
"def id=(value)\n if value == @defaults['ai.session.id']\n @values.delete 'ai.session.id' if @values.key? 'ai.session.id'\n else\n @values['ai.session.id'] = value\n end\n end",
"def current_user_id\n session[:user_id]\n end",
"def hubssolib_current_session\n @hubssolib_current_session ||= hubssolib_get_session_data\n end",
"def get_info\n @info ||= @instance.client.getSessionInfo(sessionID: @id)\n end",
"def set_session\n session_id = SecureRandom.hex(4)\n @connections[:clients].each do |other_session, other_client|\n if session_id == other_session\n # session_id is not unique\n set_session\n end\n end\n session_id\n end",
"def current_registration_session_uuid\n candidates_registrations[current_urn]\n end",
"def session\n Thread.current['clients_manager'].client('Website').session\n end",
"def create_smite_api_session\n session_timestamp = Time.now.getutc.strftime(\"%Y%m%d%H%M%S\")\n session_string = \"#{ENV['SMITE_API_DEV_ID']}\" + 'createsession' + \"#{ENV['SMITE_API_AUTHKEY']}\" + session_timestamp\n session_signature = Digest::MD5.hexdigest(session_string)\n\n smite_session = RestClient.get(\"#{SMITE_PC_URL}/createsessionJson/#{ENV['SMITE_API_DEV_ID']}/#{session_signature}/#{session_timestamp}\")\n JSON.parse(smite_session)['session_id']\nend",
"def current_uid\n session[:uid] || (current_user && current_user.uid)\n end",
"def session\n return nil unless session_id\n QuoVadis::Session.find_by id: session_id\n end",
"def active_session\n\t\tdriver.active_session\n\tend",
"def client_id\n connection.id\n end",
"def current_user=(reporter)\n session[:uid] = reporter.uid\n session[:name] = reporter.name\n end",
"def setup_session\n @session_id ||= if @smug_user.email\n setup_session_with_username\n else \n setup_session_anonymously\n end\n end",
"def logged_in_user_id\n session[:user_id]\n end",
"def current_user_id\n @server.current_user_id\n end",
"def current_account_id\n @account_id ||= session[:account_id]\n end",
"def correlation_id\n ENV['MHV_SM_USER_ID']\n end",
"def tracking_identifier\n self.issuer\n end",
"def extract_session_id(env)\n request = Rack::Request.new(env)\n sid = request.cookies[@key]\n sid ||= request.params[@key] unless @cookie_only\n sid\n end",
"def session_get\n nessus_rest_get(\"session\")\n end",
"def session_token\n @session_token ||= `echo '#{@password}' | #{op_path} signin gitlab.1password.com #{@email} #{@secret} --output=raw --shorthand=gitlab_qa`\n end",
"def create_new_id\n require 'securerandom'\n begin\n # by OpenSSL, or system provided entropy pool\n session_id = SecureRandom.hex(16)\n rescue NotImplementedError\n # never happens on modern systems\n require 'digest'\n d = Digest('SHA512').new\n now = Time::now\n d.update(now.to_s)\n d.update(String(now.usec))\n d.update(String(rand(0)))\n d.update(String($$))\n d.update('foobar')\n session_id = d.hexdigest[0, 32]\n end\n session_id\n end",
"def log_source\n\t\t\"session_#{name.to_s}\"\n\tend",
"def set_session\n @session = BatchConnect::Session.find(params[:id])\n end",
"def current_user_id\n app_session.current_user_id\n end",
"def session_key\n \"#{bot.username}:#{chat['id']}:#{from['id']}\" if chat && from\n end",
"def session_get(id)\n sessions.select {|s| s.SessionId().to_s == id.to_s}\n end",
"def find_session(env, sid); end",
"def suuid; uuid; end",
"def session_generate_id(meta)\n return Digest::MD5.hexdigest(\"#{Time.now.to_f}_#{meta[\"HTTP_HOST\"]}_#{self.ip(:meta => meta)}_#{meta[\"HTTP_USER_AGENT\"]}\")\n end",
"def session_cookie_value\n cookies[_session_id_key]\n end",
"def session # :nodoc:\n sess = Mack::SessionStore.get($current_session_id, nil, nil, nil)\n if sess.nil?\n id = String.randomize(40).downcase\n set_cookie(configatron.mack.session_id, id)\n sess = Mack::Session.new(id)\n Mack::SessionStore.store.direct_set(id, sess)\n $current_session_id = id\n sess \n end\n sess\n end",
"def user_sid\n return @user_sid\n end",
"def get_session_key\n\t\tres = RestClient.get 'https://secure.techfortesco.com/groceryapi_b1/restservice.aspx', {:params => {:command => 'LOGIN', :email => 'bwhtmn@gmail.com', :password => 'stokfridge', :developerkey => 'OULdsDZaBmGE47M7SWK2', :applicationkey => '04291BA250D2B7D6A01D'}}\n\t\tres = JSON.parse(res)\n\t\tres['SessionKey']\n\tend",
"def session_key\n if self.new_record?\n @session_key\n else\n ActiveRecord::Base.session_keys[session_key_id]\n end\n end",
"def session_key\n MfaLog.get_mfa_session_key(self.admin_id, self.ip_address)\n end",
"def sid\n open['sid']\n end",
"def session(id)\n search_sessions(xml_doc, id).first\n end",
"def current_request_id\n RequestStore.store[:current_request_id] || \"NONE\"\n end",
"def current_user_id\n if cookies[:session_token]\n User.find_by_session_token(cookies[:session_token]).id\n else\n nil\n end\n end",
"def session(session_id)\n @session_id = session_id\n end",
"def generate_session_id money, currency, transaction_type, redirect_url,\n error_url\n\n xml = build_session_request money, currency, transaction_type, redirect_url, error_url\n\n return_xml = do_soap_request 'createSession', xml\n\n data = REXML::Document.new(return_xml)\n session_element = REXML::XPath.first( data, \"//sessionId\")\n if session_element.nil?\n fault_code = REXML::XPath.first( data, \"//faultcode\").text\n fault_msg = REXML::XPath.first( data, \"//faultstring\").text\n raise StandardError, 'unable to generate ipayment session id ' + fault_code + ' ' +fault_msg\n else\n session_element.text\n end\n end",
"def log_source\n\t\t\"session_#{name}\"\n\tend",
"def extract_session_id(response)\n # The Set-Cookie header looks like\n # \"set-cookie\"=>[\"JSESSIONID=16; Path=/; HttpOnly\", \"rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sat, 17-Aug-2013 23:39:37 GMT\"],\n session_cookie = response['set-cookie']\n unless session_cookie.nil?\n session_cookie.split(';').each do |chunk|\n chunk.strip!\n key, value = chunk.split('=')\n return value if key == 'JSESSIONID'\n end\n end\n nil\n end",
"def getSessionInfo(sessionID)\n call :getSessionInfo, :sessionID => sessionID\n end",
"def set_session_uuid\n if session[:session_uuid].blank?\n session[:session_uuid] = SecureRandom.uuid\n end\n end",
"def set_session_unit_id\n session[:unit_id] = @unit.id\n end",
"def extract_session_id!(url)\n url.gsub!(/#{::Rails.application.config.session_options[:key]}=([^&]+)&?/, '')\n url.chomp!('?')\n $1\n end",
"def get_session\n return Seasar::CGI::Session.get_session(@cgi)\n end",
"def unit_of_work_id\n Thread.current[:lumberjack_logger_unit_of_work_id] \n end",
"def current_user\n session[:usr_id]\n end",
"def getterminalid()\r\n return getvalue(SVTags::TERMINAL_ID)\r\n end",
"def getSavedSessionId(session_file, username)\n if ! File.readable?(session_file)\n return nil\n end\n begin\n File.open(session_file, \"r\") {\n |f|\n u = f.readline(\"\\n\").strip\n if u == username\n return f.readline().strip\n else\n return nil\n end\n }\n rescue Exception => e\n pp 'Error reading session file', e, e.message\n return nil\n end\n end",
"def session_token\n @session_token ||= begin\n result = request :post, \"/merchant/#{merchant_id}/session\"\n if result.success?\n result.response['session']['id']\n else\n raise SessionTokenException.new, result.explanation\n end\n end\n end"
] |
[
"0.71836567",
"0.6971308",
"0.69119895",
"0.6894225",
"0.68413085",
"0.68149835",
"0.68149835",
"0.68149835",
"0.68084663",
"0.6786192",
"0.67266154",
"0.66938823",
"0.6687863",
"0.66735524",
"0.6624103",
"0.65708494",
"0.6556778",
"0.65491825",
"0.6499064",
"0.64797896",
"0.6420559",
"0.634228",
"0.6287865",
"0.61922425",
"0.6133251",
"0.60972404",
"0.6096735",
"0.6073786",
"0.6029376",
"0.59716475",
"0.5959892",
"0.5959892",
"0.59289306",
"0.5884292",
"0.5817159",
"0.5736905",
"0.57287264",
"0.5683506",
"0.5681753",
"0.56664544",
"0.56399345",
"0.5630283",
"0.5608784",
"0.5605694",
"0.5595785",
"0.5575171",
"0.5566096",
"0.55561584",
"0.55461144",
"0.55360454",
"0.55298495",
"0.5517808",
"0.5513143",
"0.55027896",
"0.5465724",
"0.545779",
"0.5457588",
"0.54283136",
"0.5420087",
"0.5412714",
"0.54076743",
"0.5391829",
"0.5384877",
"0.53837824",
"0.5372364",
"0.5371251",
"0.53644156",
"0.53533125",
"0.5340601",
"0.53355527",
"0.5325294",
"0.5325179",
"0.5322076",
"0.5307861",
"0.5306946",
"0.530605",
"0.53008056",
"0.529864",
"0.5286774",
"0.5276881",
"0.527309",
"0.5272166",
"0.52699715",
"0.52642",
"0.52511674",
"0.52486616",
"0.52444446",
"0.5244313",
"0.52438974",
"0.52349925",
"0.5234695",
"0.52304137",
"0.5228436",
"0.52251077",
"0.52177656",
"0.5205605",
"0.51892656",
"0.51888573",
"0.5184914",
"0.51835275"
] |
0.7310923
|
0
|
Returns the first element that matches the provided xpath.
|
def xpath xpath_str
find_element :xpath, xpath_str
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_first(xpath, nslist = nil)\n find(xpath, nslist).first\n end",
"def at(xpath)\n self.find_first(xpath)\n end",
"def get_element_by_xpath(xpath)\n\t\t# restituisco l'elemento corrispondente - nota: a priori un xpath non è univoco, per questo\n\t\t# in realtà blocco[] è un array di risultati\n\t\t@doc.xpath(xpath)\n\tend",
"def find_first(*paths)\n xpath(*paths).first\n end",
"def xpath_first(doc, path, pnamespace = '')\n elements = xpath_all(doc, path, pnamespace)\n (elements != nil) ? elements.first : nil\n end",
"def element_by_xpath(xpath)\r\n temp = Element.new(nil, self)\r\n element_name = temp.element_by_xpath(self, xpath)\r\n return element_factory(element_name)\r\n end",
"def xpath_first(doc, path, pnamespace = '')\n elements = xpath_all(doc, path, pnamespace)\n (elements != nil) ? elements[0] : nil\n end",
"def at_xpath(*paths)\n result = nil\n\n paths.each {|path|\n if result = xpath(path).first\n break\n end\n }\n\n result\n end",
"def extract_first_node(xpath, node = xml, namespaces = DEFAULT_NAMESPACES) \n _extract_nodes(:first, xpath, node, namespaces)\n end",
"def get_element(path)\n elements = get_elements(path)\n elements[0] if elements\n end",
"def xpath_first(from_root_node, path)\n REXML::XPath.first(from_root_node, path)\n end",
"def xpath(xpath)\n @doc.xpath(xpath)\n end",
"def at(path_or_selector)\n xpath(path_or_selector).first || css(path_or_selector).first\n end",
"def xpath_first(outer_set, path_name)\n outer_set.xpath(path_name).first\n end",
"def xpath(pdoc, path, namespace = '')\n el = xpath_first(pdoc, path, namespace)\n return unless el\n return el.content\n end",
"def value(context, xpath)\n values(context, xpath).first\n end",
"def find(xpath)\n\t\t\t@document.xpath(xpath)\n\t\tend",
"def search(xpath)\n return self.each_element( xpath ){}\n end",
"def value_of(xpath)\n found_elem = @document.at(value_of_prefix + xpath)\n return nil unless found_elem\n found_elem.inner_html\n end",
"def search(path)\n self.find_by_xpath(path)\n end",
"def first_ele tag_name\n # XPath index starts at 1\n find_element :xpath, \"//#{tag_name}[1]\"\n end",
"def find_first_kml(doc, xpath)\n doc.find_first xpath, \"kml:http://www.opengis.net/kml/2.2\"\nend",
"def search(xpath)\n context = current_context\n begin\n if namespaces.default && !xpath.include?(':') \n find(namespaced(xpath),\n in_default_namespace(namespaces.default.href))\n else \n #find(xpath)\n context.find(xpath) \n end\n rescue Exception => ex\n raise ex, xpath\n end\n end",
"def find_xpath path\n wait { find_element(:xpath, path) }\nend",
"def at(xpath)\n @doc.at(xpath)\n end",
"def xpath(pdoc, path, namespace = '')\n el = xpath_first(pdoc, path, namespace)\n (el != nil) ? el.text : nil\n end",
"def node(path)\n current_nodes = root_nodes\n matching_node = nil\n path.each_with_index do |target_node, index|\n case current_nodes\n when Array\n matching_node = current_nodes.find {|node| node.name == target_node} #TODO: make this work with regexes as well as strings...\n raise Bewildr::ElementDoesntExist if matching_node.nil?\n when Bewildr::Element\n if current_nodes.name == target_node #TODO: make this work with regexes as well as strings...\n matching_node = current_nodes\n else\n raise Bewildr::ElementDoesntExist\n end\n end\n raise Bewildr::ElementDoesntExist if matching_node.nil?\n if path.size != index + 1\n matching_node.expand\n load_all_items_hack\n current_nodes = matching_node.child_nodes\n end\n end\n return matching_node\n end",
"def search(xpath)\n xpath = \".#{xpath}\" if !self.is_a?(REXML::Document) and xpath =~ /^\\//\n ret = REXML::XPath.match(self,xpath).map{|elm|\n elm.extend(ElementHelper)\n elm\n block_given? ? (yield elm) : elm\n }\n end",
"def elements_by_xpath(value)\n find_by_xpath(value)\n end",
"def node\n datasource.document.xpath(xpath).first\n end",
"def find_first(selector, data)\n data = @data unless data\n results = (data/selector)\n if results and results.first\n results.first.inner_html.strip\n else\n nil\n end\n end",
"def xpaths xpath_str\n find_elements :xpath, xpath_str\n end",
"def xpath(expression)\n document.xpath expression\n end",
"def first_textfield\n xpath 'textfield'\n end",
"def first_ele(class_name)\n ele_index class_name, 1\n end",
"def find_node(xpath, select_result_value=false)\n if self.feed_data_type != :xml\n raise \"The feed data type is not xml.\"\n end\n return FeedTools::XmlHelper.try_xpaths(self.channel_node, [xpath],\n :select_result_value => select_result_value)\n end",
"def xpath_first_text(from_root_node, path)\n element_text(xpath_first(from_root_node, path))\n end",
"def elements_by_xpath(xpath)\r\n element = Element.new(nil, self)\r\n elem_names = element.elements_by_xpath(self, xpath)\r\n a = elem_names.inject([]) {|elements,name| elements << element_factory(name)}\r\n end",
"def xpath(path)\n raise NotImplementedError, 'query by XPath unsupported'\n end",
"def find_ele_by_predicate(class_name: '*', value:)\n elements = find_eles_by_predicate(class_name: class_name, value: value)\n raise _no_such_element if elements.empty?\n\n elements.first\n end",
"def get_element(xpath_statement)\n begin\n @wresult.xpath(xpath_statement,\n 't'=>'http://schemas.xmlsoap.org/ws/2005/02/trust',\n 'wsu'=>'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd',\n 'wsp'=>'http://schemas.xmlsoap.org/ws/2004/09/policy',\n 'wsse'=>'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd',\n 'addr'=>'http://www.w3.org/2005/08/addressing')[0].content\n rescue\n nil\n end\n end",
"def parse_value xpath\n node = parser_xml.xpath(xpath)\n return nil if node.empty?\n node.text.strip\n end",
"def first( path_stack, node )\n return nil if path.size == 0\n\n case path[0]\n when :document\n # do nothing\n return first( path[1..-1], node )\n when :child\n for c in node.children\n r = first( path[1..-1], c )\n return r if r\n end\n when :qname\n name = path[2]\n if node.name == name\n return node if path.size == 3\n return first( path[3..-1], node )\n else\n return nil\n end\n when :descendant_or_self\n r = first( path[1..-1], node )\n return r if r\n for c in node.children\n r = first( path, c )\n return r if r\n end\n when :node\n return first( path[1..-1], node )\n when :any\n return first( path[1..-1], node )\n end\n return nil\n end",
"def get_elements(xpath); end",
"def get_mobile_element(xpath)\r\n\r\n xpath = xpath.to_s.force_encoding(Encoding::UTF_8)\r\n stdout, _stderr, _status = uiautomator_dump\r\n set = Nokogiri::XML(stdout).xpath(xpath)\r\n\r\n if set.size > 1\r\n raise \"Ambiguous match, found #{set.size} elements matching to XPATH Mobile Element => '#{xpath}'\"\r\n end\r\n\r\n return set\r\n\r\nend",
"def find(selector)\n DOM::Element.from_node `#{@el}.querySelector(#{selector}) || Opal.nil`\n end",
"def get(path=\"\")\n Element.get(@element, path)\n end",
"def detect_xpath(selector)\n selector.gsub(/^\\./,'')[0] == '/' ? [:xpath, selector] : selector\n end",
"def xpath; end",
"def xpath; end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def find_innermost_element(locator = self.locator, search_node = xml)\n debug(\"DescriptorInitialization:find_innermost_element using #{locator} in #{search_node.inspect}\")\n until node = extract_first_node(locator, search_node)\n # clip off the left most [*] predicate or /* path\n md = %r{\n \\[[^\\]]+\\]$ |\n /[^/\\[]*$\n }x.match(locator)\n break if md.nil? || md.pre_match == '/'\n locator = md.pre_match\n end\n node ||= search_node \n node = node.element if node.kind_of?(REXML::Attribute)\n node = node.parent if node.kind_of?(REXML::Text)\n return node\n end",
"def xpath_of(node)\n node.xpath.to_s\n end",
"def find(selector)\n value = `#{@el}.querySelector(#{selector}) || false`\n value ? DOM::Element.fromNode(value) : nil\n end",
"def at_xpath_text(noko, xpath)\n node = noko.at_xpath(xpath)\n \n if node.nil?\n return node\n else\n return node.text\n end\n end",
"def getElement_xpath(key,d=nil)\n if(d==nil)\n xpath = Keys_CONFIG[key]\n begin\n @driver.find_element(:xpath,xpath)\n rescue\n puts \"Element : \"+xpath+\" not found\"\n end \n elsif(d!=nil)\n @driver.find_element(:xpath,key)\n end\nend",
"def text_at_xpath(xml, xpath)\n node = xml.at_xpath(xpath)\n return nil if node.nil?\n text = node.text\n return nil if node.blank?\n return text\n end",
"def matching_xpath(xpath)\n @type = :matchesXPath\n @value = xpath\n @request_builder\n end",
"def xpath(*paths)\n paths[0] = paths[0].to_s\n\n if paths.size > 1 && (namespaces = paths.pop).is_a?(Hash)\n paths << namespaces.inject({}) { |h,v| h[v[0].to_s] = v[1]; h }\n end\n\n nokogiri_xpath *paths\n end",
"def xpath\n options[:xpath] || xpath_by_tag_type\n end",
"def find_custom_element(xpath, timeout = WAITING_TIMEOUT)\n wait = Selenium::WebDriver::Wait.new(:timeout => timeout, :message => \"\\n\\nERROR! Element with xpath: '#{xpath}' was not found after #{timeout} seconds of waiting!\\n\\n\")\n custom_element = HomePage::Elements\n wait.until {\n custom_element = find_element(:xpath, xpath)\n custom_element.displayed?\n }\n custom_element\n end",
"def search(xpath, &proc)\n @doc.search(xpath, &proc)\n end",
"def first_element_child\n n = self.first_child\n while n do\n if n.node_type == ELEMENT_NODE then\n break\n end\n n = n.next_sibling\n end\n return n\n end",
"def getFirstMatch page\n list = page.search('.findList')\n return nil if list.empty?\n return list.search('.findResult')[0].search('.result_text').children[1].attr('href')\nend",
"def at_xpath(selector, within: nil)\n expr = <<~JS\n function(selector, within) {\n within ||= document\n let xpath = document.evaluate(selector, within, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\n return xpath.snapshotItem(0);\n }\n JS\n evaluate_func(expr, selector, within)\n end",
"def first\n @elements.empty? ? nil : @elements[0]\n end",
"def find_ele_by_predicate_include(class_name: '*', value:)\n elements = find_eles_by_predicate_include(class_name: class_name, value: value)\n raise _no_such_element if elements.empty?\n\n elements.first\n end",
"def get(path='.')\n Element.get(@element, path)\n end",
"def find_single(scope)\n path = element_path(scope)\n self.new(connection.get(path))\n end",
"def at_xpath(*args); end",
"def at_xpath(*args); end",
"def [](what)\n %x{\n var result = #@native.getElementById(what);\n\n if (result) {\n return #{DOM(`result`)};\n }\n }\n\n css(what).first || xpath(what).first\n end",
"def find(xpath, nslist = nil)\n if not self.doc\n raise(TypeError, \"A node must belong to a document before \" +\n \"it can be searched with XPath.\")\n end\n \n context = XPath::Context.new(self)\n context.node = self \n context.register_namespaces_from_node(self)\n context.register_namespaces_from_node(self.doc.root)\n context.register_namespaces(nslist) if nslist\n\n context.find(xpath)\n end",
"def extract_first_text(xhtml)\n texts = extract_text_from_elements(xhtml)\n texts.empty? ? '' : texts[0]\n end",
"def first( path, hash )\n scrape(path, hash, :%) do |storage, selector, element|\n @result[storage] = select(element, selector)\n end\n end",
"def css_search_first(path)\n\t\tself.cs(path).first\n\tend",
"def element(selector)\n @doc.at(selector)\n end",
"def get_first_contained_element phemaObj\n @id_element_map.find { |key, val| val[\"id\"] == phemaObj[\"containedElements\"][0][\"id\"] } if phemaObj[\"containedElements\"] && phemaObj[\"containedElements\"].length > 0\n end",
"def get_value(key)\n Element.new(\"#{@locator}//*[text()='#{key}']\")\n end",
"def h1\n Praline::browser.find_element(:xpath, \"//h1\")\n end",
"def get_first_element(arr)\n return arr.first()\nend",
"def elements_by_type(type)\n\t\treturn xpath('//' + type)\n\tend",
"def xpath(query)\n\t\treturn is_valid ? @doc.xpath(query) : nil\n\tend",
"def search(xpath)\n results = self.find(xpath).to_a\n if block_given?\n results.each do |result|\n yield result\n end\n end\n return results\n end",
"def locate(type, locator)\n el = root_element.first(type, locator)\n el.highlight if el\n el\n end",
"def element_xml(xpath)\n if NOKOGIRI\n @xml.xpath(xpath).to_s\n else\n @xml.elements[xpath].to_s\n end\n end",
"def ele_index tag_name, index\n # XPath index starts at 1.\n raise \"#{index} is not a valid xpath index. Must be >= 1\" if index <= 0\n find_element :xpath, \"//#{tag_name}[#{index}]\"\n end",
"def get_first_element(arr)\n arr.first\nend",
"def find_from_config(xpath, config, options = {})\n name_node = REXML::XPath.match(config, xpath)\n return nil if name_node.empty?\n\n properties = Util.xml_to_hash(name_node[0].parent, \"search\")\n from_hash(properties, options)\n end",
"def search_and_convert(path)\n elements = self./(path)\n return unless elements\n elements = elements.map{|element| Element.new(element)}\n return elements.first if elements.size == 1\n elements\n end",
"def click_xpath path\n wait { find_element(:xpath, path).click }\nend",
"def xpath_for(selector, options = T.unsafe(nil)); end",
"def get_element(locator, base_element = nil)\n (base_element ? base_element : @browser).find_element(locator)\n end",
"def element(css_query, output = process_output)\n output[css_query].first\n end",
"def find_element(locator)\n return locator if locator.is_a?(Selenium::WebDriver::Element)\n\n element = nil\n how, what = parse_locator(locator)\n\n if how == :css\n new_what, nth = what.scan(/(.*):eq\\((\\d+)\\)/).flatten\n element = find_elements(\"#{how}=#{new_what}\")[nth.to_i] if nth\n end\n\n element ||= driver.find_element(how, what)\n\n raise Selenium::WebDriver::Error::NoSuchElementError, \"Failed to find element: #{locator}\" unless element\n\n wait_for { element.displayed? }\n\n element\n end",
"def first\n @ordered_elements.first\n end",
"def xpath(*args); end",
"def xpath(*args); end",
"def at(expr, &blk)\n search(expr, &blk).first\n end"
] |
[
"0.80378413",
"0.78829056",
"0.7852283",
"0.77787846",
"0.7372876",
"0.7305197",
"0.73033327",
"0.72525275",
"0.70989764",
"0.69839895",
"0.6973274",
"0.68902415",
"0.6749206",
"0.6738103",
"0.67280716",
"0.6648252",
"0.65136373",
"0.650805",
"0.6507062",
"0.6436845",
"0.6435302",
"0.6381307",
"0.63186646",
"0.62822986",
"0.6237782",
"0.6225925",
"0.6195612",
"0.61620283",
"0.61540663",
"0.6153671",
"0.6150873",
"0.6101037",
"0.6053245",
"0.60443753",
"0.6013174",
"0.5987649",
"0.59752584",
"0.59371394",
"0.58942777",
"0.5884862",
"0.58624625",
"0.57573557",
"0.57493156",
"0.5739529",
"0.5664892",
"0.56364065",
"0.5629216",
"0.5624201",
"0.56197125",
"0.56197125",
"0.5616632",
"0.5616632",
"0.55948555",
"0.5587654",
"0.55577713",
"0.55564475",
"0.5538208",
"0.55294245",
"0.55171245",
"0.5501041",
"0.5500021",
"0.5495543",
"0.5494444",
"0.54468876",
"0.544414",
"0.54232764",
"0.5414036",
"0.5407321",
"0.53959584",
"0.5386254",
"0.53849787",
"0.53849787",
"0.5371091",
"0.534137",
"0.5333889",
"0.5332125",
"0.5331767",
"0.5316805",
"0.5313716",
"0.5306612",
"0.53029084",
"0.5288059",
"0.52544403",
"0.5252836",
"0.5248314",
"0.52473617",
"0.5245081",
"0.524406",
"0.5243659",
"0.5233257",
"0.5230851",
"0.5230138",
"0.52239585",
"0.52213585",
"0.52145594",
"0.52106917",
"0.51997226",
"0.51835006",
"0.51835006",
"0.51825345"
] |
0.6973612
|
10
|
Returns all elements that match the provided xpath.
|
def xpaths xpath_str
find_elements :xpath, xpath_str
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_elements(xpath); end",
"def elements_by_xpath(xpath)\r\n element = Element.new(nil, self)\r\n elem_names = element.elements_by_xpath(self, xpath)\r\n a = elem_names.inject([]) {|elements,name| elements << element_factory(name)}\r\n end",
"def elements_by_xpath(value)\n find_by_xpath(value)\n end",
"def search(xpath)\n xpath = \".#{xpath}\" if !self.is_a?(REXML::Document) and xpath =~ /^\\//\n ret = REXML::XPath.match(self,xpath).map{|elm|\n elm.extend(ElementHelper)\n elm\n block_given? ? (yield elm) : elm\n }\n end",
"def search(xpath)\n return self.each_element( xpath ){}\n end",
"def search(xpath)\n results = self.find(xpath).to_a\n if block_given?\n results.each do |result|\n yield result\n end\n end\n return results\n end",
"def xpathall(path,xml)\n r=[]\n XPath.each(xml,path){|x|r<<x}\n r\nend\n",
"def retrieve_xmlelements(xpath_str)\n collection = []\n if NOKOGIRI\n @xml.xpath(xpath_str).each { |pelem|\n collection << XMLElement.new(pelem)\n }\n else\n @xml.elements.each(xpath_str) { |pelem|\n collection << XMLElement.new(pelem)\n }\n end\n collection\n end",
"def search(xpath)\n results = self.find(xpath).to_a\n if block_given?\n results.each do |result|\n yield result\n end\n end\n return results\n end",
"def search(xpath)\n results = self.find(xpath).to_a\n if block_given?\n results.each do |result|\n yield result\n end\n end\n return results\n end",
"def find_all_nodes(xpath, select_result_value=false)\n if self.feed_data_type != :xml\n raise \"The feed data type is not xml.\"\n end\n return FeedTools::XmlHelper.try_xpaths_all(self.channel_node, [xpath],\n :select_result_value => select_result_value)\n end",
"def get_element_by_xpath(xpath)\n\t\t# restituisco l'elemento corrispondente - nota: a priori un xpath non è univoco, per questo\n\t\t# in realtà blocco[] è un array di risultati\n\t\t@doc.xpath(xpath)\n\tend",
"def xpath_all(pdoc, path, namespace = '')\n begin\n if namespace != \"\"\n return pdoc.find(path, namespace) if pdoc.find(path, namespace)\n else\n return pdoc.find(path) if pdoc.find(path)\n end\n rescue\n return []\n end\n end",
"def at_xpath(*paths)\n result = nil\n\n paths.each {|path|\n if result = xpath(path).first\n break\n end\n }\n\n result\n end",
"def page_all_xpath(xpath, timeout=nil, recurse=true)\r\n begin\r\n return page.all(:xpath, xpath)\r\n rescue\r\n # I only want to sleep if the initial check doesn't work, because it slows down the tests\r\n if (recurse)\r\n timeout = normalize_timeout(timeout)\r\n sleep(timeout)\r\n page_all_xpath(xpath, timeout, false)\r\n else\r\n raise \"Failed to find element with xpath: [\" + xpath + \"]\"\r\n end\r\n end\r\n end",
"def xpath_all(pdoc, path, namespace = '')\n if namespace!=\"\"\n return REXML::XPath.match(pdoc, path, namespace)\n else\n return REXML::XPath.match(pdoc, path);\n end\n return []\n end",
"def get_all_xpath(values)\n\t\tif values.nil? then\n\t\t\treturn []\n\t\tend\n\t\treturn xpath('//' + values.join(XPATH_JOIN))\n\tend",
"def xpath(xpath)\n @doc.xpath(xpath)\n end",
"def elements(selector)\n @doc.search(selector)\n end",
"def elements_by_type(type)\n\t\treturn xpath('//' + type)\n\tend",
"def extract_all_nodes(xpath, node = xml, namespaces = DEFAULT_NAMESPACES)\n _extract_nodes(:match, xpath, node, namespaces)\n end",
"def xpath(selector, within: nil)\n expr = <<~JS\n function(selector, within) {\n let results = [];\n within ||= document\n\n let xpath = document.evaluate(selector, within, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\n for (let i = 0; i < xpath.snapshotLength; i++) {\n results.push(xpath.snapshotItem(i));\n }\n\n return results;\n }\n JS\n\n evaluate_func(expr, selector, within)\n end",
"def search(path)\n self.find_by_xpath(path)\n end",
"def find_elements(element_name, response)\n response.body.xpath(\".//x:#{element_name}\", 'x' => response.body.namespace.href)\n end",
"def all_xpaths(parsed_doc)\n xpaths = parsed_doc.xpath('//*').map do |node|\n node.path.gsub(/\\[\\d*\\]/, \"[]\")\n end.uniq\nend",
"def each_element (xpath=\"*\", &block)\n self.find_match(xpath).each{ |n| yield n }\n end",
"def xpath xpath_str\n find_element :xpath, xpath_str\n end",
"def search(*selectors)\n NodeSet.new selectors.map {|selector|\n xpath(selector).to_a.concat(css(selector).to_a)\n }.flatten.uniq\n end",
"def /(*paths)\n NodeSet[paths.map { |path| xpath(path) }]\n end",
"def get_elements(path)\n elements = self./(path)\n return nil unless elements\n elements = elements.map{|element| Element.new(element)}\n end",
"def search(xpath)\n context = current_context\n begin\n if namespaces.default && !xpath.include?(':') \n find(namespaced(xpath),\n in_default_namespace(namespaces.default.href))\n else \n #find(xpath)\n context.find(xpath) \n end\n rescue Exception => ex\n raise ex, xpath\n end\n end",
"def find(xpath)\n\t\t\t@document.xpath(xpath)\n\t\tend",
"def elements\n if @frame.nil?\n $driver.switch_to.default_content\n else\n $driver.switch_to.frame(@frame.element)\n end\n for locator in @locators\n by, value = locator.first\n if not @root == nil and @root.instance_variable_defined?(\"@locators\") and not @root.locators.nil?\n if $highlight\n @root.highlight(-1,\"green\")\n end\n @elements = @root.find_elements(by,value,self.name)\n else\n @elements = $driver.find_elements(by,value,self.name)\n end\n if @elements.count > 0\n @elements = filter_elements(@elements)\n end\n if @elements.count > 0\n @element = @elements.first\n return @elements\n end\n end\n @element = @elements.first\n @elements\n end",
"def get_elements(path)\n elements = self./(path)\n return unless elements\n elements = elements.map{|element| Element.new(element)}\n end",
"def retrieve_elements(filter)\n elements_array = Array.new\n\n if NOKOGIRI\n @xml.xpath(filter.to_s).each { |pelem|\n elements_array << pelem.text if pelem.text\n }\n else\n @xml.elements.each(filter.to_s) { |pelem|\n elements_array << pelem.text if pelem.text\n }\n end\n\n if elements_array.size == 0\n return nil\n else\n return elements_array\n end\n\n end",
"def find_elements(locator)\n driver.find_elements(locator)\n end",
"def xpath(*paths)\n if paths.last.is_a? Hash\n super(*paths) || []\n else\n super(*paths, ns_decl) || []\n end\n end",
"def find_all(*args)\n element.all(*args)\n end",
"def elements(element_classes:)\n # This join is important to OR together all the xpaths in order to determine\n # the matched element's order inside the page. Xpath does this for us.\n match_all_elements = element_classes.map(&:matcher).join(' | ')\n\n working_element_index = []\n\n # Match on all the elements. Create Element objects with the matching xpath node.\n content_dom.xpath(match_all_elements).each do | xpath_element |\n element_class = element_classes.detect do | elem_class |\n elem_class.matches?(xpath_element)\n end\n\n element = element_class.new(node: xpath_element)\n working_element_index << element if element\n end\n\n working_element_index\n end",
"def find_all(selector)\n DOM::NodeList.new `Array.prototype.slice.call(#{@el}.querySelectorAll(#{selector}))`\n end",
"def xpath(path)\n raise NotImplementedError, 'query by XPath unsupported'\n end",
"def parse_page(url, xpaths)\n doc = get_page(url)\n return xpaths.map { |xp|\n doc.xpath(xp)\n }\n end",
"def find_xpath path\n wait { find_element(:xpath, path) }\nend",
"def xpath(expression)\n document.xpath expression\n end",
"def delete_all(xpath); end",
"def find_elements(*args)\n how, what = extract_args(args)\n by = _set_by_from_finders(how)\n begin\n bridge.find_elements_by by, what.to_s, ref\n rescue Selenium::WebDriver::Error::TimeoutError\n []\n end\n end",
"def search(xpath, &proc)\n @doc.search(xpath, &proc)\n end",
"def xpath; end",
"def xpath; end",
"def elements\n find_by_tag('*')\n end",
"def xpath(*args); end",
"def xpath(*args); end",
"def xpath_each(from_root_node, path)\n REXML::XPath.each(from_root_node, path, &Proc.new)\n end",
"def findAll(selector)\n DOM::NodeList.new `Array.prototype.slice.call(#{@el}.querySelectorAll(#{selector}))`\n end",
"def list_elements(path)\n return @element_list\n end",
"def folders\n xpath './folder'\n end",
"def search *paths\n ns = paths.last.is_a?(Hash) ? paths.pop : {}\n xpath(*(paths.map { |path|\n path =~ /^(\\.\\/|\\/)/ ? path : CSS.xpath_for(path, :prefix => \".//\")\n }.flatten.uniq) + [ns])\n end",
"def contents(context, xpath)\n enum = context.find(xpath) if context\n (enum || []).map { |node| node.content }\n end",
"def find_elements(by, locator)\n element.find_elements(by, locator)\n end",
"def get_elements(locator, base_element = nil)\n (base_element ? base_element : @browser).find_elements(locator)\n end",
"def xpath(*paths)\n paths[0] = paths[0].to_s\n\n if paths.size > 1 && (namespaces = paths.pop).is_a?(Hash)\n paths << namespaces.inject({}) { |h,v| h[v[0].to_s] = v[1]; h }\n end\n\n nokogiri_xpath *paths\n end",
"def list_from_config(xpath, config, options = {})\n REXML::XPath.match(config, xpath).map do |r|\n hash = Util.xml_to_hash(r, \"search\")\n from_hash(hash, options)\n end\n end",
"def element_by_xpath(xpath)\r\n temp = Element.new(nil, self)\r\n element_name = temp.element_by_xpath(self, xpath)\r\n return element_factory(element_name)\r\n end",
"def at_xpath(*args); end",
"def at_xpath(*args); end",
"def els(element_name)\n element_reader = get_locator(element_name)\n begin\n if element_reader.length > 0\n element_reader.each do |k,v|\n if(k=='class' || k=='css' || k=='id' || k=='xpath' || k=='partial_link_text' || k=='tag_name')\n begin\n $elems = $driver.find_elements(k.to_sym,v.to_s)\n $LOG.info \"Elements found \\n #{element_name} : #{k} => #{v}\"\n rescue Exception => e\n $LOG.error \"Element not found \"\n $LOG.error \"#{element_name} : #{k} => #{v}\"\n $LOG.error \"Error message :: \" + e.message\n raise \"Element not found \\n #{element_name} : #{k} => #{v} \\n Error Message :: \" + e.message\n end\n $elems\n end\n end\n else\n $LOG.error \"Element not present in object repository\"\n raise \"Element not present in object repository\"\n end\n $elems\n rescue Exception => e\n $LOG.error \"Error in finding the element :: \" + e.message\n raise \"Error in finding the element :: \" + e.message\n end\n end",
"def get_content_array(xpath_query)\n scraped_array = Array.new\n pos = 0\n @current_page.search(xpath_query).each do |var|\n scraped_array[pos] = var.content.strip\n pos += 1\n end\n scraped_array\n end",
"def find(xpath, nslist = nil)\n if not self.doc\n raise(TypeError, \"A node must belong to a document before \" +\n \"it can be searched with XPath.\")\n end\n \n context = XPath::Context.new(self)\n context.node = self \n context.register_namespaces_from_node(self)\n context.register_namespaces_from_node(self.doc.root)\n context.register_namespaces(nslist) if nslist\n\n context.find(xpath)\n end",
"def matching_xpath(xpath)\n @type = :matchesXPath\n @value = xpath\n @request_builder\n end",
"def filter_elements(elements)\n for locator in locators\n by, value = locator.first\n case by\n when :text\n elements = elements.select{ |element| element.text.include? value}\n when :index\n elements = elements[value]\n when :displayed\n elements = elements.select{ |element| element.displayed? == value}\n when :value\n elements = elements.select{ |element| element.value == value}\n end\n end\n return elements\n end",
"def ls(xpath = nil)\n root = NodeHandler::ROOT_EL\n if xpath.nil?\n res = NodeHandler::ROOT_EL.children\n else\n res = REXML::XPath.match(root, xpath)\n end\n\n res.each do |e|\n attrs = e.attributes\n as = \"\"\n if attrs.size > 0\n res = []\n attrs.each_attribute do |a|\n res << \"#{a.name}=#{a.value}\"\n end\n as = \" (#{res.join(' ')}) \"\n end\n puts \"#{e.name}#{as} #{e.text}\"\n end\n nil # supress additional output from IRB\n end",
"def value_of(xpath)\n found_elem = @document.at(value_of_prefix + xpath)\n return nil unless found_elem\n found_elem.inner_html\n end",
"def locate_elements(how, what, _scope = @query_scope.wd)\n return super unless (@nokogiri || @regex) && @query_scope.is_a?(Watir::Browser)\n\n @query_scope.browser.doc.send(how, what).map do |el|\n Watigiri::Element.new element: el, selector: {how => what}\n end\n end",
"def searches(ast)\n return [] unless ast.respond_to?(:xpath)\n ast.xpath(\"//fcall/ident[@value = 'search']\")\n end",
"def at_xpath(selector, within: nil)\n expr = <<~JS\n function(selector, within) {\n within ||= document\n let xpath = document.evaluate(selector, within, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\n return xpath.snapshotItem(0);\n }\n JS\n evaluate_func(expr, selector, within)\n end",
"def element_check(xpath)\n\t\t\tcount = 0\n\t\t\tcheck = false\n\t\t\twhile check == false\n\t\t\t\tbegin\n\t\t\t\t\tselect = @session.find(:xpath, xpath)\n\t\t\t\t\tif (select != nil)\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend\n\t\t\t\trescue Capybara::ElementNotFound => e\n\t\t\t\t\tif count >= @timeout\n\t\t\t\t\t\traise TooManyChecks.new(\"too many checks for xpath: #{xpath}\")\n\t\t\t\t\telse\n\t\t\t\t\t\tcount += 1\n\t\t\t\t\t\tnext\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn check\n\t\tend",
"def each(xpath_str,&block)\n if NOKOGIRI\n @xml.xpath(xpath_str).each { |pelem|\n block.call XMLElement.new(pelem)\n }\n else\n @xml.elements.each(xpath_str) { |pelem|\n block.call XMLElement.new(pelem)\n }\n end\n end",
"def all_elements_by_name(name, options = {})\n default_options = {\n :count => :all,\n :from_page => :all,\n :language => session[:language]\n }\n options = default_options.merge(options)\n if options[:from_page] == :all\n elements = Element.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n elsif options[:from_page].class == String\n page = Page.find_by_page_layout_and_language(options[:from_page], options[:language])\n return [] if page.blank?\n elements = page.elements.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n else\n elements = options[:from_page].elements.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n end\n end",
"def find_elements(by, locator)\n elements = element.find_elements(by, locator)\n elements.map {|_| Element.new(\"Child of #{@name}\", by, locator, parent: @element)}\n end",
"def /(path)\n elements = @element/path\n return nil if elements.size == 0\n elements\n end",
"def /(path)\n elements = @element/path\n return nil if elements.size == 0\n elements\n end",
"def /(path)\n elements = @element/path\n return nil if elements.size == 0\n elements\n end",
"def at(xpath)\n @doc.at(xpath)\n end",
"def xpath_for(selector, options = T.unsafe(nil)); end",
"def find_elements(locator)\n how, what = parse_locator(locator)\n elements = driver.find_elements(how, what)\n\n raise Selenium::WebDriver::Error::NoSuchElementError, \"Failed to find elements: #{locator}\" if elements.empty?\n\n elements\n end",
"def getOffers(root, xp=\"//xmlns:offer\", debug=true)\r\n\toffers = root.xpath(xp)\r\n\tif debug\r\n\t\tputs offers.count().to_s + \" nodes found\" \r\n\tend\r\n\treturn offers\r\nend",
"def get_mobile_element(xpath)\r\n\r\n xpath = xpath.to_s.force_encoding(Encoding::UTF_8)\r\n stdout, _stderr, _status = uiautomator_dump\r\n set = Nokogiri::XML(stdout).xpath(xpath)\r\n\r\n if set.size > 1\r\n raise \"Ambiguous match, found #{set.size} elements matching to XPATH Mobile Element => '#{xpath}'\"\r\n end\r\n\r\n return set\r\n\r\nend",
"def find(selector)\n nodes = current_frame.getByXPath(selector).map { |node| Node.new(node) }\n @nodes << nodes\n nodes\n end",
"def find_all_paths\n found_paths = []\n \n explore(found_paths, nil, @start_node)\n \n found_paths\n end",
"def xpath_search\n \"descendant-or-self::a[contains(@href,'metrics_dashboard') and \\\n contains(@href,'prometheus/alerts') and \\\n starts-with(@href, '#{gitlab_domain}')]\"\n end",
"def values(context, xpath)\n enum = context.find(xpath) if context\n (enum || []).map { |node| node.value }\n end",
"def generate_xpath_queries!\n self.xpath = OM::XML::TermXpathGenerator.generate_absolute_xpath(self)\n self.xpath_constrained = OM::XML::TermXpathGenerator.generate_constrained_xpath(self)\n self.xpath_relative = OM::XML::TermXpathGenerator.generate_relative_xpath(self)\n self.children.each_value {|child| child.generate_xpath_queries! }\n return self\n end",
"def query_selector_all(selector)\n document.query_selector_all selector\n end",
"def find(selector)\n nodes = @_node.getByXPath(selector).map { |node| Node.new(node) }\n @nodes << nodes\n nodes\n end",
"def find_elements(*args)\r\n how, what = extract_args(args)\r\n\r\n if how == :jquery && ref.nil?\r\n bridge.executeScript(\"return jQuery(arguments[0]).get();\", what)\r\n elsif how == :jquery && !ref.nil?\r\n bridge.executeScript(\"return jQuery(arguments[0]).find(arguments[1]).get();\",self, what)\r\n else\r\n unless by = FINDERS[how.to_sym]\r\n raise ArgumentError, \"cannot find elements by #{how.inspect}\"\r\n end\r\n\r\n bridge.find_elements_by by, what.to_s, ref\r\n end\r\n end",
"def generate_xpath_queries!\n self.xpath = OM::XML::TermXpathGenerator.generate_absolute_xpath(self)\n self.xpath_constrained = OM::XML::TermXpathGenerator.generate_constrained_xpath(self)\n self.xpath_relative = OM::XML::TermXpathGenerator.generate_relative_xpath(self)\n self.children.each_value {|child| child.generate_xpath_queries! }\n return self\n end",
"def get_all_lines(page)\n return page.xpath('//tr[@class=\"cmc-table-row\"]')\nend",
"def get_elements_temp_ios_fix\n selector_params = self.get_selector_params(self.configuration)\n #Get rid of any shit at the end, //blah/element[1] becomes //blah/element only for numeric indexes, going to add a numeric index\n\n elements_array = Array.new\n\n index = 1\n find_element_failure = false\n until find_element_failure\n selector_params[:selector] = selector_params[:selector].gsub(/\\[\\d+\\]$/, '')\n selector_params[:selector] = selector_params[:selector] + \"[#{index}]\"\n\n begin\n if self.driver_object.exists?(selector_params[:selector_method], selector_params[:selector])\n elements_array.push(self.driver_object.find_element(selector_params[:selector_method], selector_params[:selector]))\n else\n find_element_failure = true\n break\n end\n rescue\n find_element_failure = true\n break\n end\n\n index += 1\n end\n\n return elements_array\n end",
"def process(from)\n @component_xpaths = []\n walk(from)\n @component_xpaths.reject! { |xpath| emptied?(xpath) }\n end",
"def each_node(safe_path, xpath, &block)\n return enum_for(:each_node, safe_path, xpath) unless block\n\n require 'nokogiri'\n\n with_encoding_check(safe_path) do |stream, encoding|\n stream_xml_nodes(stream, xpath, encoding, &block)\n end\n end"
] |
[
"0.8026308",
"0.79066217",
"0.7849657",
"0.7764967",
"0.76488084",
"0.7128325",
"0.6960413",
"0.6940631",
"0.69363225",
"0.69363225",
"0.68294674",
"0.6809298",
"0.67731315",
"0.67249256",
"0.6685712",
"0.66830206",
"0.662625",
"0.6622509",
"0.6568911",
"0.6520585",
"0.63564914",
"0.6323364",
"0.62990564",
"0.62326485",
"0.62287724",
"0.6195188",
"0.61642224",
"0.6132664",
"0.61325294",
"0.60889655",
"0.6083011",
"0.6077663",
"0.60488176",
"0.6042168",
"0.6040612",
"0.5988785",
"0.59771556",
"0.59387493",
"0.59171045",
"0.59004813",
"0.5882889",
"0.5865136",
"0.585879",
"0.58521503",
"0.58517677",
"0.58415735",
"0.58177966",
"0.58079916",
"0.58079916",
"0.580687",
"0.58062404",
"0.58062404",
"0.5785998",
"0.57835793",
"0.5780885",
"0.57755107",
"0.57540596",
"0.5730382",
"0.5700861",
"0.5695245",
"0.56528455",
"0.5649802",
"0.5644513",
"0.56399184",
"0.56399184",
"0.55748683",
"0.5568004",
"0.5545785",
"0.55363774",
"0.54365015",
"0.54347616",
"0.5410655",
"0.5404794",
"0.5399732",
"0.53830665",
"0.5376642",
"0.53674227",
"0.5340502",
"0.53354096",
"0.53201854",
"0.53201854",
"0.53201854",
"0.5314187",
"0.5276609",
"0.5264593",
"0.52564245",
"0.52520007",
"0.52514213",
"0.5245701",
"0.52316433",
"0.52315784",
"0.52279305",
"0.52237976",
"0.52107936",
"0.520618",
"0.5184275",
"0.51722586",
"0.51695824",
"0.51635265",
"0.51510185"
] |
0.739641
|
5
|
Get the element of type tag_name at matching index.
|
def ele_index tag_name, index
# XPath index starts at 1.
raise "#{index} is not a valid xpath index. Must be >= 1" if index <= 0
find_element :xpath, "//#{tag_name}[#{index}]"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ele_index(class_name, index)\n raise 'Index must be >= 1' unless index == 'last()' || (index.is_a?(Integer) && index >= 1)\n\n elements = tags(class_name)\n\n if index == 'last()'\n result = elements.last\n else\n # elements array is 0 indexed\n index -= 1\n result = elements[index]\n end\n\n raise _no_such_element if result.nil?\n\n result\n end",
"def [](index)\n get_node(index).element\n end",
"def [](index)\n return @elements[index] if index.kind_of? Numeric\n return @element_map[index] if @element_map[index] \n return @element_map[index.to_s] \n end",
"def element(name)\n elements.find { |el| el.name == name.to_s }\n end",
"def ele_index(class_name, index)\n results = tags(class_name)\n if index == 'last()'\n index = results.length\n index -= 1 if index >= 0\n else\n raise 'Index must be >= 1' unless index >= 1\n\n index -= 1 if index >= 1\n end\n\n # uiautomator has issues with index/instance so calculate the index\n # client side.\n results[index]\n end",
"def [](name)\n @elements[name]\n end",
"def [](name)\n @elements[name]\n end",
"def tag tag_name\n find_element :tag_name, tag_name\n end",
"def element_named(name)\n @elements.find{|e| e.name.to_s == name.to_s}\n end",
"def tag()\n return @driver.get_sc_core_query_element_tag(@handle, @index)\n end",
"def get_ordered_element(index)\n result = @ordered_elements[index]\n raise RuntimeError if result.nil?\n result\n end",
"def [](name)\n name = name.to_sym\n raise ArgumentError, \"no such element #{name}\" unless @named_elements.key?(name)\n\n @named_elements[name]\n end",
"def [](idx)\r\n to_a[idx] || element_class.new(@parent, :index => idx)\r\n end",
"def [](indx)\n elements[indx]\n end",
"def first_ele tag_name\n # XPath index starts at 1\n find_element :xpath, \"//#{tag_name}[1]\"\n end",
"def index(element); end",
"def get(element, name)\n lookup(key(element.to_s, name.to_s))\n end",
"def get(element, name)\n lookup(key(element.to_s, name.to_s))\n end",
"def element\n @collection[index]\n end",
"def at(index)\n self[index]\n end",
"def get_index(index)\n return self.at(index)\n end",
"def find_tag(tag_name)\n r = scan(/\\<#{tag_name}\\>(.*?)\\<\\/#{tag_name}\\>/im)\n r.map{|e|e.first}\n end",
"def [](name)\n @index[name]\n end",
"def first_ele(class_name)\n ele_index class_name, 1\n end",
"def at(index)\n each.with_index { |v, i| return v if i == index }\n return nil\n end",
"def [](index)\n cast get(index)\n end",
"def index_at(element)\n find_element(element, :index)\n end",
"def retrieve_element_from_index(array, index_number)\n array[index_number]\nend",
"def retrieve_element_from_index(array, index_number)\n array[index_number]\nend",
"def find_eles tag_name\n @driver.find_elements :tag_name, tag_name\n end",
"def retrieve_element_from_index(array, index_number)\n return array[index_number]\nend",
"def tag_list_next_at(index)\n @tags ||= []\n\n if index < @tags.size\n return @tags[index]\n elsif @next_tag_uri == nil\n # We're at the end of the list and there's nothing left to fetc\n return nil\n else\n tag_list_fetch_next\n\n # Try again\n return tag_list_next_at(index)\n end\n end",
"def [](e)\n return @elements[e]\n end",
"def element_at(arr, index)\n # return the element of the Array variable `arr` at the position `index`\n # arr.at(index) # or\n # arr[index]\n arr[index] \n end",
"def element(selector)\n @doc.at(selector)\n end",
"def get_item(index)\r\n @list[index]\r\n end",
"def element_at(arr, index)\n arr[index]\nend",
"def tag(index=-1, tag=nil)\n (tok = @tokens[index]) && (tag ? tok[0] = tag : tok[0])\n end",
"def at(index)\n return GameStopProductListItem.new(@tag.at(index), @spec)\n end",
"def element_at(arr, index)\n arr[index]\n # or arr.at(index)\nend",
"def node_by_index(index)\n subject.to_xml.to_a[index]\nend",
"def [](i)\n @elem[i]\n end",
"def [](index)\n lookup(index.to_sym)\n end",
"def [](i)\n @elements[i]\n end",
"def tags tag_name\n find_elements :tag_name, tag_name\n end",
"def get_tag_name(element)\n element.tag_name\n end",
"def by_index(index)\n @arr[index]\n end",
"def [](i)\n\t\t\t@elements[i]\n\t\tend",
"def get_element_index(element_collection, element_name, raise_error = true, type = 'text')\n all_e = \"\"\n element_collection.each_with_index do |e, index|\n type == 'text' ? e = e.text : e = e.value\n all_e += e\n all_e += \", \" if element_collection.size > index+1\n if e == element_name\n return index\n end\n end\n\n raise \"#{element_name} not found in your element collection: #{all_e}\" if raise_error\n end",
"def get_element_in_ordering(index, ordering)\n\t\tif index >= ordering.length\n\t\t\treturn nil\n\t\tend\n\n\t\tif ordering[index].model == \"Node\"\n\t\t\tcurr_el = Node.find(ordering[index].id)\n\t\telsif ordering[index].model == \"Note\"\n\t\t\tcurr_el = Note.find(ordering[index].id)\n\t\telsif ordering[index].model == \"LinkCollection\"\n\t\t\tcurr_el = LinkCollection.find(ordering[index].id)\n\t\telsif ordering[index].model == \"PlaceHolder\"\n\t\t\tcurr_el = PlaceHolder.find(ordering[index].id)\n\t\telse\n\t\t\tcurr_el = nil\n\t\tend\n\t\treturn curr_el\n\tend",
"def find_name name\n find_element :name, name\n end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def [](index)\n ret = get_node_at_index(index)\n return ret.value if ret != nil\n return ret\n end",
"def [](name_or_index)\n if name_or_index.kind_of? Integer\n temp = @fields[name_or_index]\n temp = temp.value unless temp.nil?\n else\n name = Field.name_canonicalize(name_or_index)\n result = detect { |n, v|\n if n.downcase == name then true else false end\n }\n if result.nil? then nil else result[1] end\n end\n end",
"def get_tag_by_name(name)\n @aws_instance_data.tags.each do |tag_data|\n return tag_data.value if tag_data.key == name\n end\n nil\n end",
"def at(index)\n # User supplied indices start at 0 and increment by 1.\n return GameStopProductDetailRecommendationListItem.new(@tag.at(index), @spec)\n end",
"def [](index)\n get(index)\n end",
"def lookup(name, *tags)\n xpath(tags.map{ |tag| \"./xs:#{tag}[@name='#{name}']\" }.join('|'))[0]\n end",
"def at(index)\n return GameStopOrderedItemPanel.new(@tag.at(index), @browser)\n end",
"def element_name() @stag.element_name end",
"def [](tag)\n find { |f| f.tag == tag }\n end",
"def get_element(path)\n elements = get_elements(path)\n elements[0] if elements\n end",
"def item(index)\n attributes.values.each_with_index { |item, ix| return item if index == ix } && nil\n end",
"def [](index)\n return get(index)\n end",
"def get_at_index(index)\n return nil if index > length\n return get_at_index_helper(index, 0, @head)\n end",
"def get(index)\n raise(StandardError, 'IndexError') if invalid_index?(index)\n\n find_node_by_index(index).data\n end",
"def at_index(index)\n find_by_index(index)\n current\n end",
"def element_at(arr, index)\n # return the element of the Array variable `arr` at the position `index`\n # arr.at(index) # or\n # arr[index]\n arr[index]\nend",
"def get_at_index(index)\n raise NotImplementedError, \"Please implement get_at_index\"\n end",
"def getNamedItem(name)\n node.getAttributeNode(name)\n end",
"def [](name)\n # Check for attributes first. Why? It works for the LT xml (for now).\n if @node.attributes.has_key?(name)\n return @node.attributes[name].value\n end\n\n # Find child elements with that name\n children = @node.xpath(\"./lt:#{name}\")\n if children.size == 1\n child = children.first\n if self.text_element?(child)\n return child.children.first.content\n elsif child.name =~ /^[\\w]*List$/\n # LT-specific hack to simplify access to lists. Ill-advised?\n return wrap_children(child.children)\n else\n return NodeWrapper.new(child)\n end\n elsif children.size > 1\n return wrap_children(children)\n else\n return nil\n end\n end",
"def elem(i)\r\n @elemek[i]\r\n end",
"def item(index)\n each_with_index { |item, ix| return item if index == ix } && nil\n end",
"def at(index)\n return nil if @head.nil? \n return @head if index == 1\n return nil if index > self.size\n self.each_with_index do |current, ind|\n return current if ind == index\n end\n\n end",
"def element_at(arr, index)\n # return the element of the Array variable `arr` at the position `index`\n # arr.at(index) # or\n # arr[index]\n return arr[index]\nend",
"def [](name)\n @meta_tags[name]\n end",
"def tag(name)\n tags[name.to_s] if tags\n end",
"def by_name(name)\n elt = self[name]\n return elt unless elt.nil?\n\n @elements.each_key do |subelt_name|\n if self[subelt_name].is_a?(Model)\n elt = self[subelt_name][name]\n return elt unless elt.nil?\n end\n end\n\n nil\n end",
"def item(index = self.index)\n @data[index]\n end",
"def get_item(index)\n # TODO\n end",
"def [](index)\n @tree[index]\n end",
"def [](index)\n node = find_node(index)\n if node != nil then return node.value else return nil end\n end",
"def item_at(index)\n\t\t\telement = self.head\n\t\t\tcount = 0\n\t\t\twhile count < index\n\t\t\t\treturn nil if element.nil?\n\t\t\t\telement = element.next\n\t\t\t\tcount += 1\n\t\t\tend\n\t\t\telement\n\t\tend",
"def at(index); end",
"def item(index = self.index)\n return @data[index]\n end",
"def first_ele(class_name)\n tag(class_name)\n end",
"def [](index)\n case index\n when Integer\n values[index]\n when self\n values[index.index]\n else\n name = index.to_s\n case name\n when /\\A(\\d+)\\Z/\n return values[$1.to_i]\n when /\\A[a-z]/\n name = name.to_str.gsub(/(?:\\A|_)(.)/) { $1.upcase }\n end\n with_name(name)\n end\n end",
"def lookup_tag(name, parent_path)\n\t\t\tif @tags.key? name\n\t\t\t\treturn @tags[name]\n\t\t\tend\n\t\t\t\n\t\t\treturn fetch_tag(name, parent_path)\n\t\tend",
"def at(index)\n # User supplied indices start at 0 and increment by 1.\n # The same tag used for the data is used for the header row so we need to\n # shift by 1 to ignore that row.\n return GameStopCartListItem.new(@tag.at(index), @spec)\n end",
"def at(index)\n self.traverse_list_with_count do |node, count|\n if count == index\n return node\n elsif count > self.size\n print \"A node at the given index doesn't exist\"\n end\n end\n end",
"def [](index)\n @index[index]\n end",
"def at(index)\n $tracer.trace(format_method(__method__))\n return GameStopProductContainerItem.new(@tag[index])\n end",
"def at(index)\n idx = 0;\n node = list\n while (node != nil)\n return node if idx == index\n idx += 1\n node = node.nextNode\n end\n nil\n end",
"def []( index )\n reg = to_reg()\n reg[index]\n end",
"def [](index)\n children[index]\n end",
"def []( name )\n\n\t\t# Query root\n\t\tresult = @root.find_name name\n\n\t\tif result.empty?\n\t\t\tnil\n\t\telsif result.size == 1 # Only one match found\n\t\t\tresult.last.value\n\t\telse\n\t\t\tresult\n\t\tend\n\tend",
"def tag_name(locator)\n find_element(locator).tag_name\n end",
"def [](index)\n elements.fetch(index, :left)\n end",
"def [](tag)\n to_h[tag.to_sym]\n end"
] |
[
"0.7250674",
"0.6847777",
"0.67204165",
"0.6672337",
"0.6620418",
"0.66030836",
"0.66030836",
"0.6524591",
"0.65202546",
"0.64483976",
"0.6407453",
"0.6354577",
"0.63328665",
"0.6294993",
"0.6254961",
"0.6175408",
"0.61718357",
"0.61718357",
"0.61328965",
"0.611434",
"0.6101556",
"0.60836357",
"0.6079209",
"0.6055509",
"0.60510653",
"0.60476387",
"0.6044063",
"0.60006607",
"0.60006607",
"0.59760046",
"0.5959302",
"0.5929412",
"0.5919121",
"0.5908753",
"0.59055924",
"0.58811647",
"0.58725065",
"0.58635837",
"0.58415216",
"0.58399564",
"0.583739",
"0.5832987",
"0.58236074",
"0.5822868",
"0.58162683",
"0.5797221",
"0.57293665",
"0.5723943",
"0.57064515",
"0.57045865",
"0.57040876",
"0.5701483",
"0.5701483",
"0.56978494",
"0.5689281",
"0.56815624",
"0.56779283",
"0.5672991",
"0.5672769",
"0.56720465",
"0.56494856",
"0.56307995",
"0.5611977",
"0.56055886",
"0.5600784",
"0.559076",
"0.5590708",
"0.55876297",
"0.5586445",
"0.55850685",
"0.55834764",
"0.55805093",
"0.557663",
"0.5573055",
"0.55676377",
"0.5563239",
"0.55602896",
"0.5554873",
"0.5553709",
"0.55480206",
"0.55461156",
"0.5538753",
"0.55377775",
"0.5537322",
"0.5533574",
"0.5533185",
"0.5528237",
"0.55248",
"0.5517166",
"0.551422",
"0.55117697",
"0.55070204",
"0.5504452",
"0.54763854",
"0.5462445",
"0.5457727",
"0.54550636",
"0.5451406",
"0.5447955",
"0.54425085"
] |
0.747865
|
0
|
Get all elements exactly matching tag name
|
def find_eles tag_name
@driver.find_elements :tag_name, tag_name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tags tag_name\n find_elements :tag_name, tag_name\n end",
"def elements\n find_by_tag('*')\n end",
"def find_names name\n find_elements :name, name\n end",
"def element_named(name)\n @elements.find{|e| e.name.to_s == name.to_s}\n end",
"def find_tag(tag_name)\n r = scan(/\\<#{tag_name}\\>(.*?)\\<\\/#{tag_name}\\>/im)\n r.map{|e|e.first}\n end",
"def find_elements(element_name, response)\n response.body.xpath(\".//x:#{element_name}\", 'x' => response.body.namespace.href)\n end",
"def els(element_name)\n element_reader = get_locator(element_name)\n begin\n if element_reader.length > 0\n element_reader.each do |k,v|\n if(k=='class' || k=='css' || k=='id' || k=='xpath' || k=='partial_link_text' || k=='tag_name')\n begin\n $elems = $driver.find_elements(k.to_sym,v.to_s)\n $LOG.info \"Elements found \\n #{element_name} : #{k} => #{v}\"\n rescue Exception => e\n $LOG.error \"Element not found \"\n $LOG.error \"#{element_name} : #{k} => #{v}\"\n $LOG.error \"Error message :: \" + e.message\n raise \"Element not found \\n #{element_name} : #{k} => #{v} \\n Error Message :: \" + e.message\n end\n $elems\n end\n end\n else\n $LOG.error \"Element not present in object repository\"\n raise \"Element not present in object repository\"\n end\n $elems\n rescue Exception => e\n $LOG.error \"Error in finding the element :: \" + e.message\n raise \"Error in finding the element :: \" + e.message\n end\n end",
"def elements_with_all_tags(tags)\n return InfoNode.elements_with_all_tags(session['domain'],tags)\n end",
"def retrieve_all_tags(element, tag = :content)\n result = []\n if(element.respond_to? tag)\n result << element.send(tag)\n end\n if element.respond_to? :children\n element.children.each do |child|\n result += retrieve_all_tags(child, tag)\n end \n end \n return result \nend",
"def elements(selector)\n @doc.search(selector)\n end",
"def content_tags(name)\n array = []\n name_li(name).div(:class=>/(mylibrary_item_|searchcontent_result_)tags/).lis.each do |li|\n array << li.span(:class=>\"s3d-search-result-tag\").text\n end\n return array\n end",
"def all_elements_by_name(name, options = {})\n default_options = {\n :count => :all,\n :from_page => :all,\n :language => session[:language]\n }\n options = default_options.merge(options)\n if options[:from_page] == :all\n elements = Element.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n elsif options[:from_page].class == String\n page = Page.find_by_page_layout_and_language(options[:from_page], options[:language])\n return [] if page.blank?\n elements = page.elements.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n else\n elements = options[:from_page].elements.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n end\n end",
"def tag tag_name\n find_element :tag_name, tag_name\n end",
"def get_elements(xpath); end",
"def match_element_name(element_name)\n match(element, element_name)\n end",
"def tags(class_name)\n find_elements :class, class_name\n end",
"def getElementsByTagName(tagname)\n ret = NodeList.new\n @children.each do |node|\n if node.nodeType == ELEMENT_NODE\n if tagname == '*' || node.nodeName == tagname\n ret << node\n end\n ret << node.getElementsByTagName(tagname)\n end\n end if @children\n ret\n end",
"def getElementsByTagName(tagname)\n ret = NodeList.new\n @children.each do |node|\n if node.nodeType == ELEMENT_NODE\n if tagname == '*' || node.nodeName == tagname\n ret << node\n end\n ret << node.getElementsByTagName(tagname)\n end\n end if @children\n ret\n end",
"def tags(selector)\n e = elements(selector)\n e.map {|x| x.inner_html}\n end",
"def tags(selector)\n\t\te = elements(selector)\n\t\te.map {|x| x.inner_html}\n\tend",
"def retrieve_elements(filter)\n elements_array = Array.new\n\n if NOKOGIRI\n @xml.xpath(filter.to_s).each { |pelem|\n elements_array << pelem.text if pelem.text\n }\n else\n @xml.elements.each(filter.to_s) { |pelem|\n elements_array << pelem.text if pelem.text\n }\n end\n\n if elements_array.size == 0\n return nil\n else\n return elements_array\n end\n\n end",
"def tags(name = nil)\n list = @tags + convert_ref_tags\n return list unless name\n list.select {|tag| tag.tag_name.to_s == name.to_s }\n end",
"def cell_elements_by_name(name)\n if cell = cells.find_by_name(name)\n cell.elements\n else\n Alchemy::Logger.warn(\"Cell with name `#{name}` could not be found!\", caller.first)\n Element.none\n end\n end",
"def elements_present\n elements_to_check.select { |name| there?(name) }\n end",
"def elements(name, *find_args)\n build_elements(name, *find_args) do\n define_method(name) do |*runtime_args, &block|\n raise_if_block(self, name, !block.nil?, :elements)\n _all(*merge_args(find_args, runtime_args))\n end\n\n create_get_element_params(name, find_args)\n end\n end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def find_name name\n find_element :name, name\n end",
"def element_match(tree, exp, bindings); end",
"def element(name)\n elements.find { |el| el.name == name.to_s }\n end",
"def element_definitions_by_name(names)\n return [] if names.blank?\n\n if names.to_s == \"all\"\n Element.definitions\n else\n Element.definitions.select { |e| names.include? e['name'] }\n end\n end",
"def all_tag_elements\n applied_tag_elements + @tag_elements\n end",
"def lookup(name, *tags)\n xpath(tags.map{ |tag| \"./xs:#{tag}[@name='#{name}']\" }.join('|'))[0]\n end",
"def find_all(*args)\n element.all(*args)\n end",
"def applied_tag_elements\n @parent_element.respond_to?(:all_tag_elements) ? @parent_element.all_tag_elements : []\n end",
"def e(name)\n for c in @children\n return c if c.is_a?(MiniXmlElement) && c.name==name\n end\n return nil\n end",
"def check_html_element(name, doc)\r\n elements = doc.css(name)\r\n process_tag(name, elements, \"text\")\r\n end",
"def filter_elements(elements)\n for locator in locators\n by, value = locator.first\n case by\n when :text\n elements = elements.select{ |element| element.text.include? value}\n when :index\n elements = elements[value]\n when :displayed\n elements = elements.select{ |element| element.displayed? == value}\n when :value\n elements = elements.select{ |element| element.value == value}\n end\n end\n return elements\n end",
"def getTags node\n array = [] #array to hold working collection\n \n node.children.each do |child|\n array << Hash[child.name,child.inner_text] unless child.name == 'text' #text \n end\n \n return array\n end",
"def collect_elements element\n # capture first element name\n elements = []\n # iterate text until next headline\n while true do\n elements << element\n element = element.next\n break if element.nil? || element.to_html.include?(\"class=\\\"mw-headline\\\"\")\n end\n elements\n end",
"def extract(node_name)\n lambda do |node|\n results = []\n results << node.send(node_name) if node.respond_to?(node_name)\n\n results.push *node.elements.select { |elem| elem.respond_to?(node_name) }.map { |elem| elem.send(node_name) }\n\n results\n end\n end",
"def fetch_element(key)\n return @completed_elements.detect do |el|\n el.first.html_attribute_name == key || el.first.name == key\n end\n end",
"def attributes_by_name(name)\n\t\treturn xpath('//@' + name)\n\tend",
"def search(xpath)\n xpath = \".#{xpath}\" if !self.is_a?(REXML::Document) and xpath =~ /^\\//\n ret = REXML::XPath.match(self,xpath).map{|elm|\n elm.extend(ElementHelper)\n elm\n block_given? ? (yield elm) : elm\n }\n end",
"def elements_for_layout(layout)\n elements = []\n layout_elements = PageLayout.get(layout)[\"elements\"]\n return Element.descriptions if layout_elements == \"all\"\n Element.descriptions.each do |element|\n if layout_elements.include?(element[\"name\"])\n elements << element\n end\n end\n elements\n end",
"def nodes_tagged(tag, options={})\n found_nodes = []\n @elements.each do |e|\n if node_included?(e, options) && !node_excluded?(e, options)\n found_nodes << e if e.tag == tag\n unless options[:exclude_match] || node_descent_excluded?(e, options)\n found_nodes += e.nodes_tagged(tag, options)\n end\n end\n end\n found_nodes\n end",
"def nodes_tagged(tag, options={})\n found_nodes = []\n @elements.each do |e|\n if node_included?(e, options) && !node_excluded?(e, options)\n found_nodes << e if e.tag == tag\n unless options[:exclude_match] || node_descent_excluded?(e, options)\n found_nodes += e.nodes_tagged(tag, options)\n end\n end\n end\n found_nodes\n end",
"def match_tag_name(name)\n\n name.sub!(/^c:/, '')\n\n matches = []\n\n Conf.curation_types.each do |type|\n matches.push type if type.starts_with?(name)\n end\n\n return matches[0] if matches.length == 1\n end",
"def get_unique_tags(document)\n unique_tags = []\n tag_data = document.scan(/<([!|\\w]+)[^>]*>/i)\n tag_data.each do |i|\n unique_tags << i[0] unless unique_tags.include?(i)\n end\n unique_tags\n end",
"def get_child_element_names(mods_node)\n return [] if mods_node == nil\n child_element_names = mods_node.children.map {|x| x.name}.uniq.reject {|y| y == 'text'}.compact\n end",
"def first_ele tag_name\n # XPath index starts at 1\n find_element :xpath, \"//#{tag_name}[1]\"\n end",
"def elements_for_select(elements)\n return [] if elements.nil?\n elements.collect do |e|\n [\n Element.display_name_for(e['name']),\n e['name']\n ]\n end\n end",
"def search(xpath)\n return self.each_element( xpath ){}\n end",
"def create_get_all_elements(element_name, *find_args)\n method_name = \"get_all_#{element_name}\"\n create_helper_method(method_name, *find_args) do\n define_method(method_name) do |*runtime_args|\n args = merge_args(find_args, runtime_args)\n wait_until_get_not_empty(*args)\n end\n end\n end",
"def elements\n @elements ||= context\n .private_methods\n .grep(/\\A(?!wait_)\\w+_element\\z/)\n .map { |el| Meta::Element.new(el.to_s.gsub('_element', ''), context) }\n end",
"def get_tag_name(element)\n element.tag_name\n end",
"def scan_tags\n self.content.scan(/#\\w+/).uniq\n end",
"def elements_for_select(elements)\n return [] if elements.nil?\n\n elements.collect do |e|\n [\n Element.display_name_for(e[\"name\"]),\n e[\"name\"]\n ]\n end\n end",
"def multi_element_attr_match( elements )\n elements.each do |element|\n print \".\"\n wait_for_element(element[0].to_sym, element[1])\n check_attribute_match(element[0].to_sym, element[1], element[2], element[3])\n end\n end",
"def element_name() @stag.element_name end",
"def returnable_elements(aggregations = [])\n if aggregations.blank?\n return nodes + attribute_constraints\n else\n return aggregations.collect{|agg| agg.pattern_element}\n end\n end",
"def elements( element_names, &block )\n while true\n break if element(element_names, true, &block).is_a? Sentinel\n end\n\n return nil\n end",
"def find_tags_by_name(tag)\n ActsAsTaggableOn::Tag.includes(:taggings).where(\"taggings.context = 'tags'\").order(\"name ASC\").named_like(tag).limit(10) unless tag.blank?\n end",
"def filter_tags(document)\n # Filter down and get the tags.\n @tags = document.css(TAG_CSS).map(&:children).map(&:text)\n end",
"def find_eles_by_attr_include tag, attr, value\n @driver.find_elements :xpath, %Q(#{tag}[contains(@#{attr}, '#{value}')])\n end",
"def find_eles_by_text tag, text\n @driver.find_elements :xpath, %Q(#{tag}[@text='#{text}'])\n end",
"def find_attributes(name)\n\t\t\tr=[]\n\t\t\tp=self\n\t\t\twhile(p)\n\t\t\t\tif(p.respond_to?(name))\n\t\t\t\t\tv=p.send(name)\n\t\t\t\t\tr << v if(v)\n\t\t\t\tend\n\t\t\t\tbreak if(!p.respond_to?(\"container\"))\n\t\t\t\tp=p.container\n\t\t\tend\n\t\t\tr\n\t\tend",
"def elements_by_xpath(xpath)\r\n element = Element.new(nil, self)\r\n elem_names = element.elements_by_xpath(self, xpath)\r\n a = elem_names.inject([]) {|elements,name| elements << element_factory(name)}\r\n end",
"def get_element_with_attributes name=nil\n get_element(name,nil,true)\n end",
"def elements\n elements_with_treetop.find_all { |node| node.is_a?(Brainfucktt::Node) } rescue []\n end",
"def elements_by_type(type)\n\t\treturn xpath('//' + type)\n\tend",
"def elements_by_xpath(value)\n find_by_xpath(value)\n end",
"def search_tag(tag)\n search_text(tag.name)\n end",
"def elements_missing\n elements_to_check.reject { |name| there?(name) }\n end",
"def has_tag?(name); end",
"def parse_names(elem)\n nameList = elem.following_siblings()[0] #data_section.at(\"ul\")\n names = nameList.search(\"li\")\n @names = []\n names.each { |name|\n name = name.inner_html\n name.gsub! /\\s{2,}/, \" \"\n @names << name \n } \n end",
"def find_all(selector)\n DOM::NodeList.new `Array.prototype.slice.call(#{@el}.querySelectorAll(#{selector}))`\n end",
"def multiple(name, limit=nil)\n all = @root.xpath(\"meta/#{name}[@meta='yes']\").map { |el| el.text }\n return limit ? all.slice(0, limit) : all\n end",
"def find_all_tagged_with(*args)\n find_tagged_with(*args)\n end",
"def element_names\n @element_names ||= { }\n end",
"def available_element_names\n @_available_element_names ||= available_element_definitions.map { |e| e['name'] }\n end",
"def return_all_tags\n @tags.uniq.each { |tag| puts tag }\n end",
"def return_names_array(doc)\n names = doc.css(\".search-content .teaser-item__title a span\")\n recipe_names = []\n names.each do |element|\n recipe_names << element.text\n end\n return recipe_names\n end",
"def tags\n node.css(\"category\").map(&:text)\n end",
"def find_ele_by_text_include tag, text\n find_ele_by_attr_include tag, :text, text\n end",
"def find_free_xml(name)\n # checking\n name\n end",
"def fetch_tags(url, tags)\n doc = Nokogiri::HTML(open(url))\n aux = []\n doc.xpath(tags).each do |f|\n aux << f.text\n end\n return aux\n end",
"def parse_html(data,tag)\n return data.scan(%r{<#{tag}\\s*.*?>(.*?)</#{tag}>}im).flatten\nend",
"def get_from_tags(resource, tag_name)\n tag_name = tag_name.to_s.downcase\n tags = resource['tags'].to_a.concat(resource['tag_set'].to_a)\n Array.wrap(tags).detect { |tag, _| tag['key'].downcase == tag_name }.try(:[], 'value').presence\n end",
"def find_values(tag)\n results =[]\n dictionary.each do |key, values|\n next if values.nil?\n matched_keys = values.select { |k,v| v.to_s =~ /@#{tag}( |$)/i }.keys.each do |k|\n results << k\n end\n end\n results\n end",
"def select( tag = nil )\n tag = Tag.new( tag, Tag.WILDCARD_NS ) unless tag.nil? || tag.is_a?( Tag )\n if block_given?\n children.select do |c|\n c.element? && ( tag.nil? || c.tag == tag ) && yield( c )\n end\n else\n children.select do |c|\n c.element? && ( c.tag == tag )\n end\n end\n end",
"def find_name_tag(tags)\n name_tag = tags.find { |tag| tag[:key] == \"Name\" }\n name_tag ? name_tag[:value] : nil\n end",
"def matches(element_name, attrs = {})\n match_element_name(element_name) && match_attributes(attrs)\n end",
"def tag_names #helper method\n # gets tag names in an array\n self.tags.map { |tag| tag.name }\n end",
"def find_tag_like(tag, matcher = nil, opts = {}, &block)\n if matcher.is_a?(Hash) && matcher.values.all? {|v| v.is_a?(String) }\n find_exactly(tag, matcher)\n else\n wait_method = respond_to?(:synchronize) ? :synchronize : :wait_until\n\n results = []\n __send__(wait_method) do\n results = all(tag).select do |element|\n if matcher.is_a?(Hash)\n hash_from_element = matcher.keys.each_with_object({}) {|key, h| h[key] = element[key] }\n WildcardMatchers.wildcard_match?(hash_from_element, matcher)\n else\n WildcardMatchers.wildcard_match?(element, block || matcher)\n end\n end\n\n raise Capybara::ElementNotFound, \"no <#{tag}> to match #{matcher}\" if results.empty?\n end\n\n # not compatible for capybara 2.0\n results.first\n end\n end",
"def applied_tags\n @parent_element.respond_to?(:all_tags) ? @parent_element.all_tags : []\n end",
"def htmlGetTagContents(html, tagName)\n html.split(\"<#{tagName}>\")[1].split(\"</#{tagName}>\")[0]\nend",
"def check_meta_element(name, doc)\r\n elements = doc.css(\"meta[@name='#{name}']\") \r\n process_tag(name, elements, [\"[]\", \"content\"])\r\n end",
"def get_elements(path)\n elements = self./(path)\n return nil unless elements\n elements = elements.map{|element| Element.new(element)}\n end",
"def available_values\n result = []\n for i in (0 .. @tag.length - 1)\n result << @tag[i].parent(\"p\").span.innerText.strip if @tag[i].parent(\"p\").span.exists\n end\n return result\n end"
] |
[
"0.74248403",
"0.72330594",
"0.6930145",
"0.6638875",
"0.6634128",
"0.6606429",
"0.652169",
"0.6507143",
"0.6420594",
"0.63818467",
"0.63674474",
"0.6315953",
"0.6300778",
"0.62992346",
"0.62921494",
"0.62465906",
"0.61173344",
"0.61173344",
"0.60858923",
"0.60636365",
"0.60231036",
"0.6019853",
"0.60137385",
"0.59647954",
"0.5931305",
"0.5908135",
"0.5908135",
"0.5896572",
"0.58662707",
"0.5811724",
"0.58031315",
"0.5741897",
"0.57159674",
"0.57097864",
"0.567118",
"0.5634365",
"0.5629858",
"0.5612075",
"0.56048584",
"0.5576286",
"0.55494225",
"0.55326337",
"0.55237114",
"0.5516248",
"0.5514612",
"0.550282",
"0.550282",
"0.550073",
"0.549066",
"0.54879427",
"0.5469636",
"0.54543436",
"0.5446837",
"0.5445309",
"0.5439733",
"0.5434733",
"0.5430052",
"0.5429865",
"0.5414149",
"0.5413862",
"0.54123825",
"0.54121196",
"0.5401637",
"0.54005575",
"0.5398769",
"0.5392552",
"0.5384797",
"0.5383523",
"0.5382741",
"0.53822476",
"0.53809386",
"0.53611356",
"0.53609633",
"0.5357573",
"0.5356581",
"0.5351069",
"0.5349035",
"0.5348842",
"0.53437304",
"0.5334663",
"0.5333193",
"0.53229576",
"0.5317384",
"0.53108233",
"0.5300674",
"0.5296758",
"0.5295665",
"0.5283197",
"0.5279029",
"0.5272647",
"0.52684253",
"0.52575284",
"0.52453905",
"0.52432096",
"0.52380353",
"0.52377445",
"0.52218854",
"0.5210267",
"0.5208141",
"0.52062124"
] |
0.69878024
|
2
|
Get the first tag that exactly matches tag and text.
|
def find_ele_by_text tag, text
@driver.find_element :xpath, %Q(#{tag}[@text='#{text}'])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_tag(t)\n r = nil\n if @tag == t\n r = self\n elsif\n begin\n each do |it|\n r = it.find_tag(t)\n break if r\n end\n rescue\n end\n end\n return r\n end",
"def find_with_tag(phrase, opts={})\n phrase = phrase.downcase unless opts[:case_sensitive] == true\n first(:tag_words => phrase)\n end",
"def first_with_tag(phrase, opts={})\n lo = opts.clone\n case_sensitive = lo.delete :case_sensitive\n phrase = phrase.downcase unless case_sensitive\n first(lo.merge(:tag_words => phrase))\n end",
"def find_ele_by_text_include tag, text\n find_ele_by_attr_include tag, :text, text\n end",
"def search_tag(tag)\n search_text(tag.name)\n end",
"def matching_tag(tag)\n chars = tag.chars\n chars.delete_at(1)\n chars.join('')\n end",
"def find_by_tag(tag, single = true, &block)\n find_matching(:tag, tag, single, block)\n end",
"def first_matching_tag\n r = Registry.get\n return unless r\n\n RegistryEvent.all.find_each do |event|\n data = JSON.parse(event.data)\n _, _, tag_name = r.get_namespace_from_event(data)\n return event.dup if tag_name == @tag\n end\n\n nil\n end",
"def find_tag(tag_name)\n r = scan(/\\<#{tag_name}\\>(.*?)\\<\\/#{tag_name}\\>/im)\n r.map{|e|e.first}\n end",
"def find text\n preorder_traverse @fragment do |node|\n if node.text? then\n if not node.text.index(text).nil? then\n return node\n end\n end\n end\n end",
"def primary_tag\n tag = @primary_tag || my_tag_list.first\n\n if tag == NO_PRIMARY_TAG\n nil\n else\n tag\n end\n end",
"def getTag(tagString)\n retval = \"other\"\n tags = [\"programming\",\"travel\",\"other\"]\n tags.each do |tag|\n if tagString.downcase.match(/#{tag.downcase}/)\n retval = tag\n end\n end\n retval\n end",
"def parse_tag_with_name(tag_name, text); end",
"def tag_text()\n return self.tag(true)\n end",
"def see_tag(text); end",
"def tagged (phrase, tags, ignore = [], insensitive = true, exact = true)\n\t# make sure insensitive\n\tif insensitive\n\t\tignore = ignore.map(&:downcase)\n\tend\n\t# p.o.s. are always upcase, just to make sure\n\ttags = correct_tags(tags) #what was the ruby way to call a functioin in place? !\n\tphrase.each_entity do |sub|\n\t\tif tags.include? sub.tag\n\t\t\tif insensitive\n\t\t\t\tif !in_arr?(ignore, sub.to_s.downcase, exact)\n\t\t\t\t\treturn sub\n\t\t\t\tend\n\t\t\telsif !in_arr?(ignore, sub, exact)\n\t\t\t\t\treturn sub\n\t\t\tend\n\t\tend\n\tend\n\treturn nil\nend",
"def single_tag\n @single_tag_regex ||= tag_regexp\n end",
"def link_text(tag)\n $2 if tag =~ link_regex\n end",
"def parse_tag_with_types_and_title(tag_name, text); end",
"def return_tag(text); end",
"def find_eles_by_text_include tag, text\n find_eles_by_attr_include tag, :text, text\n end",
"def find( tag = nil )\n tag = Tag.new( tag, Tag.WILDCARD_NS ) unless tag.nil? || tag.is_a?( Tag )\n if block_given?\n children.find do |c|\n c.element? && ( tag.nil? || c.tag == tag ) && yield( c )\n end\n else\n first_element( tag )\n end\n end",
"def htmlGetTagContents(html, tagName)\n html.split(\"<#{tagName}>\")[1].split(\"</#{tagName}>\")[0]\nend",
"def first_value(tag)\n tag_summary(tag).first[1].first\n end",
"def find_first(selector, data)\n data = @data unless data\n results = (data/selector)\n if results and results.first\n results.first.inner_html.strip\n else\n nil\n end\n end",
"def find_tag_like(tag, matcher = nil, opts = {}, &block)\n if matcher.is_a?(Hash) && matcher.values.all? {|v| v.is_a?(String) }\n find_exactly(tag, matcher)\n else\n wait_method = respond_to?(:synchronize) ? :synchronize : :wait_until\n\n results = []\n __send__(wait_method) do\n results = all(tag).select do |element|\n if matcher.is_a?(Hash)\n hash_from_element = matcher.keys.each_with_object({}) {|key, h| h[key] = element[key] }\n WildcardMatchers.wildcard_match?(hash_from_element, matcher)\n else\n WildcardMatchers.wildcard_match?(element, block || matcher)\n end\n end\n\n raise Capybara::ElementNotFound, \"no <#{tag}> to match #{matcher}\" if results.empty?\n end\n\n # not compatible for capybara 2.0\n results.first\n end\n end",
"def search1(doc)\n doc.search('.subtext > span:first-child').map { |span| span.inner_text}\n end",
"def parse_tag_with_types_and_name(tag_name, text); end",
"def extract_tag_name(tag)\n match = /\\A<\\/?(#{@@name})/.match(tag)\n return match[1] if match\n raise \"Cannot find tag name in tag: #{tag}\"\n end",
"def my_node_tagged(tag, options={})\n my_nodes_tagged(tag, options)[0]\n end",
"def my_node_tagged(tag, options={})\n my_nodes_tagged(tag, options)[0]\n end",
"def text text\n # Return the first element matching selector.\n # s.textContains(value)\n mobile :find, [ [ [3, text] ] ]\n end",
"def first_ele(class_name)\n tag(class_name)\n end",
"def tag\n @tag ||= page.tags(true).detect{|t| t.is_cms_block? && t.identifier == identifier}\n end",
"def tag_value(type)\n pattern = reserved_patterns[type]\n tag = tags.detect { |t| t.match?(pattern) }\n return unless tag\n\n tag.match(pattern)[type]\n end",
"def tag_with tag_or_string, tagger_id, options={}\n if tag_or_string.is_a? String\n tags = Tag.strmatch tag_or_string, matchall: true, tagtype: options[:type], assert: true, userid: tagger_id\n tag = tags.first\n else\n tag = tag_or_string\n end\n @taggable_entity.tag_with tag, tagger_id\n end",
"def get_tag(tag_class); end",
"def first(name=nil)\n name.nil? ? matches.first : find(name, false).first\n end",
"def node_tagged(tag, options={})\n nodes_tagged(tag, options)[0]\n end",
"def node_tagged(tag, options={})\n nodes_tagged(tag, options)[0]\n end",
"def find_eles_by_text tag, text\n @driver.find_elements :xpath, %Q(#{tag}[@text='#{text}'])\n end",
"def extract_first_text(xhtml)\n texts = extract_text_from_elements(xhtml)\n texts.empty? ? '' : texts[0]\n end",
"def tag(tag); end",
"def tag(tag); end",
"def tag_from(str)\n letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\n numbers = '0123456789'\n if str.length < 2\n nil\n else\n if (str[0]=='<') && (str[-1]=='>')\n text = str.gsub('<','').gsub('>','').gsub('/','')\n if (text.length == 0) || !letters.include?(text[0])\n nil\n else\n text.split(\" \").first.downcase\n end\n else\n nil\n end\n end\nend",
"def first\n matches.first\n end",
"def match_tag_name(name)\n\n name.sub!(/^c:/, '')\n\n matches = []\n\n Conf.curation_types.each do |type|\n matches.push type if type.starts_with?(name)\n end\n\n return matches[0] if matches.length == 1\n end",
"def has_tag?(name); end",
"def find_within(tags, span, pointer); end",
"def find_within(tags, span, pointer); end",
"def first_ele tag_name\n # XPath index starts at 1\n find_element :xpath, \"//#{tag_name}[1]\"\n end",
"def find_r( tag = nil, &block )\n tag = Tag.new( tag, Tag.WILDCARD_NS ) unless tag.nil? || tag.is_a?( Tag )\n _find_r( tag, block || TRUTH )\n end",
"def tag\n return @tag\n end",
"def first_text\n first_ele static_text_class\n end",
"def parse_tag_with_types_and_name(tag_name, text)\n name, types, text = *extract_types_from_text(text)\n name, text = *extract_name_from_text(text) if name.nil?\n Tag.new(tag_name, text, types, name)\n end",
"def valid_tag(tag)\n parser = REXML::Parsers::UltraLightParser.new( tag)\n parser.parse[0]\n end",
"def find_first_json_in(text)\n find_all_json_in(text).first\n end",
"def text\n @tag_data[:text]\n end",
"def just_text\r\n return $1 if text =~ /^<p>(.*)<\\/p>$/\r\n text\r\n end",
"def parse_tag_with_types(tag_name, text); end",
"def substring_up_to_match\n @matches.nil? ? nil : @buffer.match(expr_substring_to_match)[0]\n end",
"def abstract_tag(text); end",
"def find_tag_struct(t)\n p = find_tag(t)\n if(p)\n return p.parent_struct\n else\n return nil\n end\n end",
"def matches?(name, tag, value)\n get_text_content(name, tag, @klass) == value\n end",
"def tag(t)\n tag = get url: \"tags/#{generate_slug(t)}\", filter: @everything_filter\n tag.tag if tag\n end",
"def find(name)\n m = match(name)\n m.count == 1 ? m[0] : nil\n end",
"def parseHtml(html)\n\t\t\tregex = /<(#{tag}(.*?)>(.*?)<\\/#{tag}>)/\n\t\t\tresults = html.scan(regex)\n\t\t\treturn results.empty? ? '' : results[0][-1]\n\t\tend",
"def text_range\n body = get.gsub!(/\\s*/,'')\n pattern = /#{@before_element}.*#{@after_element}/\n results = pattern.match(body)\n return results[0] if results\n end",
"def tag\n if @tag.is_a? String\n @tag\n end\n end",
"def has_tag?(t)\n tags.include?(t)\n end",
"def assert_tag(tag, string)\n complete_tag = \"<#{tag}>\"\n partial_tag = \"<#{tag}(\"\n (string.include? complete_tag) || (string.include? partial_tag)\n end",
"def getFirstMatch page\n list = page.search('.findList')\n return nil if list.empty?\n return list.search('.findResult')[0].search('.result_text').children[1].attr('href')\nend",
"def parse_tag(aText)\n # Recognize the first character\n if aText =~ /^[\\?\\/]/\n matching = DisallowedSigns.match(aText[1..-1])\n else\n # Disallow punctuation and delimiter signs in tags.\n matching = DisallowedSigns.match(aText)\n end\n fail(InvalidCharError.new(aText, matching[0])) if matching\n \n result = Placeholder.new(aText)\n\n return result\n end",
"def tag(string); end",
"def since_tag(text); end",
"def exact_match_string\n @matches.nil? ? nil : @matches[0]\n end",
"def tag tag_name\n find_element :tag_name, tag_name\n end",
"def tagged_by(keyword)\n self.tags.collect { |t| t.keyword }.include?(keyword)\n end",
"def find_by_name(name, field = :name)\n Tag.find_by_name(name.strip) || (fail BadRequestError.resource_not_found(field), \"Tag not found.\")\n end",
"def find_name_tag(tags)\n name_tag = tags.find { |tag| tag[:key] == \"Name\" }\n name_tag ? name_tag[:value] : nil\n end",
"def first(text, filters: %i[correctness completion pending size])\n parse(text, filters: filters, n: 1).first\n end",
"def first_subfield_value(tag)\n sf = @field.subfields.select { |sf| sf.code == tag}\n return '' if sf.empty?\n sf.first.value\n end",
"def tag_text text_view, tag_type\n s, e = text_view.buffer.selection_bounds\n text_view.buffer.apply_tag(tag_type.tag, s, e)\n end",
"def find_tags_by_name(tag)\n ActsAsTaggableOn::Tag.includes(:taggings).where(\"taggings.context = 'tags'\").order(\"name ASC\").named_like(tag).limit(10) unless tag.blank?\n end",
"def initialize(text, also_tagged_with=[], start_with=nil)\n chars = text.chars.to_a # Convert text into char\n\n if also_tagged_with.nil? || also_tagged_with.empty?\n # Populate the tag_set for the first char\n tag_set = Letter.where(:char => chars.shift).all_tags\n\n # Intersect tags_set with the remaining chars\n text.chars.each { |char|\n tag_set = tag_set & Letter.where(:char => char).all_tags\n }\n else\n # Populate the tag_set for the first char\n tag_set = Letter.where(:char => chars.shift).with_all_tags(also_tagged_with).all_tags\n\n # Intersect tags_set with the remaining chars\n text.chars.each { |char|\n tag_set = tag_set & Letter.where(:char => char).with_all_tags(also_tagged_with).all_tags\n }\n\n # Finally, filter any tags returned that are already in also_tagged_with\n tag_set.delete_if {|tag| also_tagged_with.include?(tag)}\n end\n\n # # Filter by start_with, if required\n if !start_with.nil? && !start_with.empty?\n tag_set.keep_if {|tag| tag.start_with?(start_with) }\n end\n\n @tags = tag_set\n end",
"def [](tag)\n find { |f| f.tag == tag }\n end",
"def match_template template, node\n puts \" match #{template} at #{node}\"\n begin\n t = template.children.first\n # try adjusting node if it can be required\n # note that if t.content.empty? we don't want to skip it...\n # TODO template limitation per node...\n t = t.next_sibling if node.class != Nokogiri::XML::Text and t.content.empty?\n while t != nil and node != nil\n set_context t, node\n match_node t, node\n t = t.next_sibling\n node = node.next_sibling\n end\n assert (t == nil or node != nil), \"unexpected end of document #{t.class}, #{node.class}\"\n node\n rescue NotokeParserError => ex\n puts \"match fails #{ex}\"\n false\n end\n end",
"def get_from_tags(resource, item)\n (resource['tags'] || []).detect { |tag, _| tag['key'].downcase == item.to_s.downcase }.try(:[], 'value')\n end",
"def get(name,tag)\n get_text_content(name, tag, @klass)\n end",
"def get_tag_from_label(tag_label, reload = false)\n tag_label = DomainEnumerated.standardize_tag(tag_label)\n tag_id, tag = get_hash_tags(reload).detect { |id, tag| tag.label == tag_label }\n tag\n end",
"def get_document_tag(tagname, from: nil)\n from ||= @prepared_doc\n from.match(%r{<#{tagname}>(.*)</#{tagname}>})[1]\n end",
"def tag\n Tag.find(tag_id)\n end",
"def lookup_liquid_tag(content, cursor)\n return unless cursor_is_on_liquid_tag_lookup_position(content, cursor)\n\n markup = parseable_markup(content, cursor)\n return empty_lookup if markup == :empty_lookup_markup\n\n template = Liquid::Template.parse(markup)\n current_tag = template.root.nodelist[0]\n\n case current_tag.tag_name\n when \"if\", \"unless\"\n variable_lookup_for_if_tag(current_tag)\n when \"case\"\n variable_lookup_for_case_tag(current_tag)\n when \"cycle\"\n variable_lookup_for_cycle_tag(current_tag)\n when \"for\"\n variable_lookup_for_for_tag(current_tag)\n when \"tablerow\"\n variable_lookup_for_tablerow_tag(current_tag)\n when \"render\"\n variable_lookup_for_render_tag(current_tag)\n when \"assign\"\n variable_lookup_for_assign_tag(current_tag)\n when \"echo\"\n variable_lookup_for_echo_tag(current_tag)\n end\n\n # rubocop:disable Style/RedundantReturn\n rescue Liquid::SyntaxError\n # We don't complete variable for liquid syntax errors\n return\n end",
"def tagline\n document.search(\"h5[text()='Tagline:'] ~ div\").first.innerHTML.gsub(/<.+>.+<\\/.+>/, '').strip.imdb_unescape_html rescue nil\n end",
"def tag(index=-1, tag=nil)\n (tok = @tokens[index]) && (tag ? tok[0] = tag : tok[0])\n end",
"def template_tag\n if @tag\n @tag\n else\n TEMPLATE_TAG\n end\n end",
"def find(match)\n hits = search(match)\n raise(MissingTemplate, \"No matching templates.\") if hits.size == 0\n if hits.size > 1\n message = \"More than one match:\\n \" + hits.map{|name, dir| name}.join(\"\\n \")\n raise(DuplicateTemplate, message)\n end\n hits.first\n end",
"def first_part text\n found = false\n preorder_traverse @fragment do |node|\n if found then\n node.remove\n elsif node.text? then\n if not node.text.index(text).nil? then\n found = true\n update_content node, text, :keep_left\n end\n end\n end\n end",
"def example_tag(text); end",
"def tag\n try_opt(:tag)\n end"
] |
[
"0.6744437",
"0.66811275",
"0.6511489",
"0.64343023",
"0.63833266",
"0.61991805",
"0.61058146",
"0.6062507",
"0.6032106",
"0.59776616",
"0.5930785",
"0.59261745",
"0.59043604",
"0.57742965",
"0.57216215",
"0.57214665",
"0.57209814",
"0.57197744",
"0.56756485",
"0.55984247",
"0.55472225",
"0.5484646",
"0.54818857",
"0.5477816",
"0.54582715",
"0.54348767",
"0.54284275",
"0.5365967",
"0.5356459",
"0.52948123",
"0.52948123",
"0.5286981",
"0.5269407",
"0.52625936",
"0.5257055",
"0.52437955",
"0.52297664",
"0.5222535",
"0.5221822",
"0.5221822",
"0.52156556",
"0.5210032",
"0.5203082",
"0.5203082",
"0.5180207",
"0.5172902",
"0.51642925",
"0.51594716",
"0.51587266",
"0.51587266",
"0.51566166",
"0.5142952",
"0.51372194",
"0.5127115",
"0.50824046",
"0.5075957",
"0.5071027",
"0.5066365",
"0.506382",
"0.50592947",
"0.50490206",
"0.5047382",
"0.5042756",
"0.5038034",
"0.5035941",
"0.50283325",
"0.5024874",
"0.5024212",
"0.502117",
"0.5004263",
"0.500384",
"0.50015247",
"0.49820524",
"0.49814585",
"0.4976586",
"0.49748105",
"0.4969306",
"0.4964618",
"0.49601167",
"0.49555176",
"0.49513277",
"0.4926586",
"0.49260414",
"0.49245167",
"0.49144495",
"0.49125963",
"0.49078602",
"0.49011484",
"0.48977748",
"0.48896492",
"0.48857388",
"0.4883665",
"0.48817408",
"0.4880048",
"0.48767686",
"0.487604",
"0.4875111",
"0.48676237",
"0.48661596",
"0.48567137"
] |
0.5528779
|
21
|
Get all tags that exactly match tag and text.
|
def find_eles_by_text tag, text
@driver.find_elements :xpath, %Q(#{tag}[@text='#{text}'])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_eles_by_text_include tag, text\n find_eles_by_attr_include tag, :text, text\n end",
"def find_all_tagged_with(*args)\n find_tagged_with(*args)\n end",
"def search_tag(tag)\n search_text(tag.name)\n end",
"def tagged_with(_tags)\n _tags = convert_string_tags_to_array(_tags) if _tags.is_a? String\n criteria.all_in(tags_field => _tags)\n end",
"def find_ele_by_text_include tag, text\n find_ele_by_attr_include tag, :text, text\n end",
"def match(*strings)\n result = []\n @tags.each do |tag|\n strings.each do |string|\n if string.downcase =~ /#{tag.downcase}/\n strings.delete string\n result << tag\n break\n end\n end\n end\n return result\n end",
"def tagged (phrase, tags, ignore = [], insensitive = true, exact = true)\n\t# make sure insensitive\n\tif insensitive\n\t\tignore = ignore.map(&:downcase)\n\tend\n\t# p.o.s. are always upcase, just to make sure\n\ttags = correct_tags(tags) #what was the ruby way to call a functioin in place? !\n\tphrase.each_entity do |sub|\n\t\tif tags.include? sub.tag\n\t\t\tif insensitive\n\t\t\t\tif !in_arr?(ignore, sub.to_s.downcase, exact)\n\t\t\t\t\treturn sub\n\t\t\t\tend\n\t\t\telsif !in_arr?(ignore, sub, exact)\n\t\t\t\t\treturn sub\n\t\t\tend\n\t\tend\n\tend\n\treturn nil\nend",
"def find_tagged_with(*args)\n options = find_options_for_find_tagged_with(*args)\n options.blank? ? [] : find(:all, options)\n end",
"def find_tagged_with(*args)\n options = find_options_for_find_tagged_with(*args)\n options.blank? ? [] : find(:all, options)\n end",
"def filter_all(text)\n state = :copying\n result = []\n tagged_lines = []\n tag = args = nil\n text.split(/\\n/).each do |line|\n case state\n when :copying\n if line =~ inline_tag\n tag = $1\n args = $2.strip\n state = :inside_tag\n elsif line =~ single_tag\n tag = $1\n args = $2.strip\n result << @filters[tag.to_sym].filter_single(args)\n else\n result << line\n end\n when :inside_tag\n # :endinlinewhatever, :endwhatever or just plain :end\n if line =~ /^:end(inline#{tag}|#{tag})?(\\s.*)?$/\n result << @filters[tag.to_sym].filter_inline(tagged_lines.join(\"\\n\"),args)\n tagged_lines = []\n state = :copying\n else\n tagged_lines << line\n end\n end\n end\n\n result.join(\"\\n\")\n end",
"def initialize(text, also_tagged_with=[], start_with=nil)\n chars = text.chars.to_a # Convert text into char\n\n if also_tagged_with.nil? || also_tagged_with.empty?\n # Populate the tag_set for the first char\n tag_set = Letter.where(:char => chars.shift).all_tags\n\n # Intersect tags_set with the remaining chars\n text.chars.each { |char|\n tag_set = tag_set & Letter.where(:char => char).all_tags\n }\n else\n # Populate the tag_set for the first char\n tag_set = Letter.where(:char => chars.shift).with_all_tags(also_tagged_with).all_tags\n\n # Intersect tags_set with the remaining chars\n text.chars.each { |char|\n tag_set = tag_set & Letter.where(:char => char).with_all_tags(also_tagged_with).all_tags\n }\n\n # Finally, filter any tags returned that are already in also_tagged_with\n tag_set.delete_if {|tag| also_tagged_with.include?(tag)}\n end\n\n # # Filter by start_with, if required\n if !start_with.nil? && !start_with.empty?\n tag_set.keep_if {|tag| tag.start_with?(start_with) }\n end\n\n @tags = tag_set\n end",
"def find_tagged_objs_with(phrase)\n tag = Tag.find_by(name: phrase)\n return if tag.nil?\n\n Tagging.where(tagger: self, tag: tag).map{|tagging| tagging.tagged_obj}\n end",
"def find_tags_by_name(tag)\n ActsAsTaggableOn::Tag.includes(:taggings).where(\"taggings.context = 'tags'\").order(\"name ASC\").named_like(tag).limit(10) unless tag.blank?\n end",
"def tags(name = nil)\n list = @tags + convert_ref_tags\n return list unless name\n list.select {|tag| tag.tag_name.to_s == name.to_s }\n end",
"def tags\n match = /(.*?)[\\s\\u00A0]+\\[(?<tags>.*)\\]/.match(@node.inner_text)\n (match ? match[:tags] : '').split(' ')\n end",
"def scan_tags(&block)\n scan_all(tags_criteria, &block)\n end",
"def filter_tags(document)\n # Filter down and get the tags.\n @tags = document.css(TAG_CSS).map(&:children).map(&:text)\n end",
"def quick_text_tags(text, ii, font_change)\n ret = text_tags(text, ii, font_change)\n [ret[0], ret[1], ret[2]]\n end",
"def items_with_tag(tag, items=nil)\n items = sorted_articles if items.nil?\n items.select { |item| has_tag?( item, tag ) }\n end",
"def find_with_tags(*tags)\n options = tags.extract_options!\n self.all(options.merge(:tags => tags))\n end",
"def section_tags(section, cat = nil)\n\n taglist = section.articles.map{|article| article.tags}.flatten.uniq.sort\n \n if cat != nil\n re = Regexp.new(cat)\n returnlist = []\n taglist.each do |tag|\n if tag =~ re\n returnlist << tag\n end\n end\n else\n returnlist = taglist\n end\n returnlist\n end",
"def find_tags\n @find_tags = true\n end",
"def scan_tags\n self.content.scan(/#\\w+/).uniq\n end",
"def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end",
"def tags_above_threshold\n TextValue.all_tags.select { |tag| tag.tag_count >= Seek::Config.tag_threshold }\n end",
"def find_tagged_with_by_user(tags, user, options = {})\n options.assert_valid_keys([:match])\n find_tagged_with(tags, {:match => options[:match], :user => user})\n end",
"def find_tagged_with_by_user(tags, user, options = {})\n options.assert_valid_keys([:match])\n find_tagged_with(tags, {:match => options[:match], :user => user})\n end",
"def define_match_any_of\n klass.send(:define_method, :match_any_of) do |tags|\n if tags.empty?\n str(\"\")\n else\n tags.map { |tag| str(tag) }.inject do |tag_chain, tag|\n tag_chain.send :|, tag\n end\n end\n end\n end",
"def tagged_by(keyword)\n self.tags.collect { |t| t.keyword }.include?(keyword)\n end",
"def tags\n records.each do |record|\n KEYWORDS_TAGGER.each do |name, keywords|\n record[name] = keywords.find {|keyword| record[:text].include?(keyword) }\n end\n end\n end",
"def matching_text_element_lines(regex, exclude_nested = T.unsafe(nil)); end",
"def search_text(query, text)\n text = pattern(text)\n query.where { title.ilike(text) | description.ilike(text) }\n end",
"def find_tags(url)\n\t\t\tputs \"Search and return tags within the url payload: #{url}\" if @verbose\n\t\t\ttag_list = []\n doc = open_page(url)\n doc.text.each_line do |line|\n my_line = line.downcase\n @tag_signatures.keys.map do |tag|\n tag_list.push(tag) if my_line.include?(tag)\n end\n end\n return tag_list\n rescue => ee\n puts \"Exception on method #{__method__}: #{ee}\" if @verbose\n return []\n end",
"def match(tags)\n messages = self.logs.find_all do |log|\n tags.detect { |tag| log.tagged?(tag) }\n end\n\n if messages.empty?\n Puppet.info \"No messages match tags #{tags}\"\n next\n end\n messages \n end",
"def extract_tags\n extract_hashtags(content) do |tag|\n extracted_tag = Tag.find_or_create_by(name: tag.downcase)\n self.tags << extracted_tag unless tags.include? extracted_tag\n end\n end",
"def getTags node\n array = [] #array to hold working collection\n \n node.children.each do |child|\n array << Hash[child.name,child.inner_text] unless child.name == 'text' #text \n end\n \n return array\n end",
"def find_tagged_with(*args)\n options = find_options_for_find_tagged_with(*args)\n if options.blank?\n []\n else\n select(options[:select]).joins(options[:joins]).where(options[:conditions])\n end\n end",
"def relevant_tags\n\t\tTag.declare_get_relevance\n\t\tTag.intersects_geometry(self.shape).sort_by_relevance(self.shape).to_a.reject{ |x| \n\t\t\tx.id == self.id\n\t\t}\n\tend",
"def find_with_tag(phrase, opts={})\n phrase = phrase.downcase unless opts[:case_sensitive] == true\n first(:tag_words => phrase)\n end",
"def tags1\n return projects_tags.where(\"tags_id in (select id from tags where type_tag=?)\",1)\n end",
"def search_text(text)\n sets = @schemes.map do |scheme|\n scheme.find_all(text).uniq\n end\n sets.flatten.uniq\n end",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def all_by_tag(*tags)\n find(:all).by_tag(*tags)\n end",
"def all_by_tag(*tags)\n find(:all).by_tag(*tags)\n end",
"def tags\n caption.to_s.scan(/#(\\w+)/).flatten\n end",
"def filtering_by_tags?\n selected_tags\n end",
"def filtering_by_tags?\n selected_tags\n end",
"def test_should_find_by_tags\n # One tag.\n assert_same_elements items(:uranium_portion, :holy_grenade, :lightsaber, :towel), Product.find_by_tags([tags(:weapons).id])\n # One tag and one subtag.\n assert_equal [items(:uranium_portion)], Product.find_by_tags([tags(:weapons).id,tags(:mass_destruction).id])\n # One subtag.\n assert_equal [items(:uranium_portion)], Product.find_by_tags([tags(:mass_destruction).id])\n # One tag and one empty tag.\n assert_equal [], Product.find_by_tags([tags(:weapons).id,tags(:books).id])\n end",
"def fetch_tags (arg, regex=/\\A[v]\\d+[.]\\d+\\z/)\n clean_tags = []\n tag(arg).split(\"\\n\").each { |vtag|\n clean_tags.push(vtag) if vtag.match(regex) }\n # contains tags that conform to format : discuss\n return clean_tags unless clean_tags.length < 1\n raise ImqsGitError, \"no tags were found that matches the regex : #{regex.to_s}\"\n end",
"def textmatch(text, terms)\n terms.all? { |term| text =~ /#{term}/i }\nend",
"def collect_tags_indeed(text_to_scan, offer_object)\n puts \"Mining tags from posting\"\n tags = Tag.all.map(&:name)\n tags.each do |tag|\n offer_object[:tags] << tag if text_to_scan.include?(tag)\n end\n end",
"def tags\n return false if params[:q] and params[:q].size < 3\n @tags = ActsAsTaggableOn::Tag.where(\"tags.name LIKE ?\", \"%#{params[:q]}%\") \n respond_to do |format|\n format.json { render :json => @tags.map{|t| {:id => t.name, :name => t.name }}}\n end\n end",
"def tagged_with(context, tags)\n tags = convert_string_to_array(tags, get_tag_separator_for(context)) if tags.is_a? String\n array_field = tag_options_for(context)[:array_field]\n all_in(array_field => tags)\n end",
"def see_tag(text); end",
"def find_by_tags(tags)\n load_pets.select do |pet|\n tags.all? do |tag|\n pet.tagged_with?(tag)\n end\n end\n end",
"def filter(filter)\n tl = AlienTagList.new\n\n self.each do |ele|\n if ele.tag =~ filter\n tl.add_tag(ele)\n end\n end\n\n return tl\n end",
"def tagged(tags, bool: :and)\n WWID.new.filter_items(self, opt: { tag: tags, bool: bool })\n end",
"def find_from(tags)\n result = []\n\n # Create a tag list from the parameter. If the parameter already contains\n # tag objects, sort them out.\n case tags\n when Array\n result, not_tags = tags.partition { |t| t.is_a?(Tag) and not t.new_record? }\n not_tags.map!(&:to_s)\n tags = TagList.from(not_tags)\n when Tag\n return [ tags ]\n else\n tags = TagList.from(tags)\n end\n\n return result if tags.empty?\n\n tags_result = find(:all, :conditions => tags_condition(tags))\n return result + tags_result\n end",
"def nodes_tagged(tag, options={})\n found_nodes = []\n @elements.each do |e|\n if node_included?(e, options) && !node_excluded?(e, options)\n found_nodes << e if e.tag == tag\n unless options[:exclude_match] || node_descent_excluded?(e, options)\n found_nodes += e.nodes_tagged(tag, options)\n end\n end\n end\n found_nodes\n end",
"def nodes_tagged(tag, options={})\n found_nodes = []\n @elements.each do |e|\n if node_included?(e, options) && !node_excluded?(e, options)\n found_nodes << e if e.tag == tag\n unless options[:exclude_match] || node_descent_excluded?(e, options)\n found_nodes += e.nodes_tagged(tag, options)\n end\n end\n end\n found_nodes\n end",
"def tags tag_name\n find_elements :tag_name, tag_name\n end",
"def all_tags context = :tags\n ActsAsTaggableOn::Tagging.where(context: context).select(:tag_id).distinct.includes(:tag).map(&:tag)\n end",
"def tags\n klass = Object.const_get(\"Concepts\").const_get(params[:tag_class])\n results = klass.search_for_label_starting_with(params[:term]).map(&:label)\n render :json => results.uniq.sort\n end",
"def with_text(matcher)\n filter do |item|\n case matcher\n when Regexp then item.text =~ matcher\n when String then item.text.include?(matcher)\n else item.text.include?(matcher.to_s)\n end\n end\n end",
"def tags\n query = params[:q]\n if query[-1,1] == \" \"\n query = query.gsub(\" \", \"\")\n Tag.find_or_create_by_name(query)\n end\n\n #Do the search in memory for better performance\n\n @tags = ActsAsTaggableOn::Tag.all\n @tags = @tags.select { |v| v.name =~ /#{query}/i }\n respond_to do |format|\n format.json{ render :json => @tags.map(&:attributes) }\n end\n end",
"def return_all_tags\n @tags.uniq.each { |tag| puts tag }\n end",
"def find_all( search_text = '.*', with_passwords: false )\n show( search_text, with_passwords: with_passwords, regex: true ) || []\n end",
"def tags_from_params\n search_filter_params[:tagged_with].to_s.split(\",\")\n end",
"def filter_by_tags(collection)\n return collection if tag_list.empty?\n\n ids = []\n type = collection.first.class.to_s\n Tag.any_in(name: tag_list.push('global')).each do |tag|\n tag.taggable_references.where(taggable_type: type).each do |ref|\n ids.push ref.taggable_id\n end\n end\n collection.any_in(_id: ids)\n end",
"def tag_on(model, text)\n return if (text.length == 0)\n words = text.split(' ')\n taggings = []\n\n words.each do |word|\n tag = Tag.find_or_create_by(name: word)\n\n if Tagging.where(tagger: self, taggable: model, tag: tag).first \n return\n end\n\n tagging = self.taggings.create(tag: tag, taggable: model)\n if tagging\n tag.inc(:taggings_count, 1)\n else\n return\n end\n\n # taggings << tagging\n\n model_tag = model.model_tags.find_or_create_by(name: word)\n model_tag.user_ids << self.id unless model_tag.user_ids.include?(self.id)\n model_tag.inc(:taggings_count, 1)\n model_tag.save \n model.reload\n end\n\n # taggings\n\n # return if (text.length == 0)\n\n # tag = Tag.find_or_create_by(name: text)\n\n # if Tagging.where(tagger: self, taggable: model, tag: tag).first \n # return\n # end\n\n # if tagging = self.taggings.create(tag: tag, taggable: model)\n # tag.inc(:taggings_count, 1)\n # end\n\n # model_tag = model.model_tags.find_or_create_by(name: text)\n # model_tag.user_ids << self.id unless model_tag.user_ids.include?(self.id)\n # model_tag.inc(:taggings_count, 1)\n # model_tag.save \n # model.reload\n # tagging\n end",
"def filter_by_tag(tag)\n get_venues_for_filtering if @venues_to_filter.empty?\n @venues_by_tag = []\n @venues_to_filter.each do |venue|\n venue[\"tags\"].each do |venue_tag|\n if venue_tag.downcase == tag.downcase\n @venues_by_tag << venue[\"name\"]\n end\n end\n end\n @venues_by_tag\n end",
"def matching_tag(tag)\n chars = tag.chars\n chars.delete_at(1)\n chars.join('')\n end",
"def content_tags(name)\n array = []\n name_li(name).div(:class=>/(mylibrary_item_|searchcontent_result_)tags/).lis.each do |li|\n array << li.span(:class=>\"s3d-search-result-tag\").text\n end\n return array\n end",
"def elements_with_all_tags(tags)\n return InfoNode.elements_with_all_tags(session['domain'],tags)\n end",
"def tags\n usertags = []\n proposals.each do |proposal|\n usertags << proposal.tags.map(&:name) unless usertags.include?(proposal.tags.map(&:name))\n end\n remove_duplicates(usertags.flatten)\n end",
"def find_values(tag)\n results =[]\n dictionary.each do |key, values|\n next if values.nil?\n matched_keys = values.select { |k,v| v.to_s =~ /@#{tag}( |$)/i }.keys.each do |k|\n results << k\n end\n end\n results\n end",
"def get_unique_tags(document)\n unique_tags = []\n tag_data = document.scan(/<([!|\\w]+)[^>]*>/i)\n tag_data.each do |i|\n unique_tags << i[0] unless unique_tags.include?(i)\n end\n unique_tags\n end",
"def search_tags\n\t\t# Searching for patients as per user entered term\n\t\tquestion_tags = Question.all_tags.select{|p| p=~/^#{params[:term]}/i }.uniq\n\t\tif question_tags.present?\n\t \trender :json=> {success: true, \"Tags\" => question_tags.as_json }\n\t # render json: { success: true, response: @questions.map{ |f| QuestionSerializer.new(f).as_json( root: false ) } }\n\t else\n\t render :json=> { success: false, message: \"Tags are not present\" },:status=> 203\n\t end\n\tend",
"def test_tags_include_all_filter_tags?(test_tags)\n (@filter_tags - test_tags).empty?\n end",
"def find_tag_like(tag, matcher = nil, opts = {}, &block)\n if matcher.is_a?(Hash) && matcher.values.all? {|v| v.is_a?(String) }\n find_exactly(tag, matcher)\n else\n wait_method = respond_to?(:synchronize) ? :synchronize : :wait_until\n\n results = []\n __send__(wait_method) do\n results = all(tag).select do |element|\n if matcher.is_a?(Hash)\n hash_from_element = matcher.keys.each_with_object({}) {|key, h| h[key] = element[key] }\n WildcardMatchers.wildcard_match?(hash_from_element, matcher)\n else\n WildcardMatchers.wildcard_match?(element, block || matcher)\n end\n end\n\n raise Capybara::ElementNotFound, \"no <#{tag}> to match #{matcher}\" if results.empty?\n end\n\n # not compatible for capybara 2.0\n results.first\n end\n end",
"def add_tags_to_verses(document, text)\n html = text.to_str\n html.gsub!(/data-srcid\\s?=\\s?['\"](.*?)['\"]/) do |match|\n tagid = DmKnowledge::Document.tagcontext_from_srcid($1)\n tag_list = document.tag_list_on(tagid)\n unless tag_list.empty?\n \"#{match} data-tags='#{tag_list.to_json}' data-tagid='#{tagid}'\"\n else\n match\n end\n end\n html.html_safe\n end",
"def nonstrict_match(tokens)\n matchset = MatchSet.new()\n index = 0;\n tokens.each do |token|\n break unless pattern[index]\n tagger_name = pattern[index].to_s\n klass = constantize(tagger_name)\n match = token.has_tag?(klass) \n if match\n matchset << token.get_tag(klass);\n index += 1; \n next; \n else\n next\n end\n end\n\n return false if matchset.size != pattern.size\n return matchset\n end",
"def find_tagged_scenarios(filter_tags)\n scenario_names = Set.new\n puts \"Finding scenarios for tags: #{filter_tags.to_a.join(',')}\" if @options.verbose\n # Tags are only found on scenarios, not on scenario snapshots.\n @xml.css(@@scenario_css).each { |scenario|\n scenario_name = scenario.css('> name').first.text\n puts \"Scenario: #{scenario_name}\" if @options.verbose\n scenario_tags = Set.new scenario.css('> tags > tag > key').to_ary.map { |element| element.text }\n scenario_tags.each { |tag|\n puts \" tag: #{tag}\"\n } if @options.verbose\n # Save the scenario if has any of the desired tags.\n if filter_tags.intersect?(scenario_tags)\n puts \"Saving!\" if @options.verbose\n scenario_names.add(scenario_name)\n end\n }\n return scenario_names\n end",
"def where(options = {})\n _, _, root = @client.get(\"/tags\", options)\n\n root[:items].map{ |item| Tag.new(item[:data]) }\n end",
"def available_tags\n available_tags = []\n Tag.all.each do |t|\n available_tags << t.name\n end\n\n tags = []\n self.tags.each do |t|\n tags << t.name\n end\n\n available_tags - tags\n end",
"def tags\n ['any'] + @tags\n end",
"def tags\n ['any'] + @tags\n end",
"def tags\n taxonomies.all :conditions => { :classification => :tag }\n end",
"def find_within(tags, span, pointer); end",
"def find_within(tags, span, pointer); end",
"def tags_with_weight\n index_tags_now! if need_to_index_tags and @do_tags_index\n tags_index_collection.find.sort(_id: 1).to_a.map{ |r| [r[\"_id\"], r[\"matches\"]] }\n end",
"def tag_text()\n return self.tag(true)\n end",
"def tags\n @attributes.select { |k, _| tag_names.include?(k.to_s) }\n end",
"def matches? string\n tag_string = string[%r|<key>Tags</key>\\s+<array>(.*?)</array>|m,1]\n\n # Edge case: no tags\n return true if @include.empty? && tag_string.nil?\n\n return (tag_string &&\n @include.all?{ |s| tag_string.include?(s) } &&\n @exclude.all?{ |s| !tag_string.include?(s) }\n )\n end",
"def tags(include_private=false)\n Tag.find_all_by_user(self, include_private)\n end"
] |
[
"0.6266885",
"0.62010944",
"0.6119152",
"0.6067555",
"0.5957864",
"0.59182805",
"0.5871871",
"0.58593357",
"0.58072025",
"0.57537794",
"0.5740311",
"0.5739751",
"0.5702388",
"0.5700148",
"0.5626286",
"0.56000686",
"0.5578781",
"0.55428416",
"0.55252373",
"0.55178005",
"0.5515048",
"0.5504702",
"0.5496767",
"0.54891425",
"0.5477476",
"0.5453986",
"0.5453986",
"0.54475003",
"0.5447279",
"0.5422935",
"0.5422642",
"0.5413297",
"0.5407603",
"0.53915316",
"0.53910935",
"0.5365066",
"0.53572977",
"0.53541",
"0.5350081",
"0.53447646",
"0.5319678",
"0.5318287",
"0.5318287",
"0.5318287",
"0.5318287",
"0.5318287",
"0.5318287",
"0.5313835",
"0.5313835",
"0.53013015",
"0.5294767",
"0.5294767",
"0.5294338",
"0.52813214",
"0.5278257",
"0.52551967",
"0.5239158",
"0.52344286",
"0.5221257",
"0.52077407",
"0.5204777",
"0.51980686",
"0.51889366",
"0.5180403",
"0.5180403",
"0.51706386",
"0.5167863",
"0.5154692",
"0.5150606",
"0.51500547",
"0.51479137",
"0.5134767",
"0.5129281",
"0.5118015",
"0.51173466",
"0.51167023",
"0.5116035",
"0.51093245",
"0.5098009",
"0.50956064",
"0.50834644",
"0.50787485",
"0.50703526",
"0.50555915",
"0.5049779",
"0.5038404",
"0.5033831",
"0.5022943",
"0.50141436",
"0.5011853",
"0.49921882",
"0.49921882",
"0.4991805",
"0.49909544",
"0.49909544",
"0.49891114",
"0.49883366",
"0.4986082",
"0.49826077",
"0.49824625"
] |
0.54013413
|
33
|
Get the first tag by attribute that exactly matches value.
|
def find_ele_by_attr_include tag, attr, value
@driver.find_element :xpath, %Q(#{tag}[contains(@#{attr}, '#{value}')])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def unique_attr?(h, a, v)\n v = v.value if v.instance_of? Nokogiri::XML::Attr\n h.search(\"[#{a}='#{v}']\").one?\n end",
"def find_attribute(name, singleton)\n name = $1 if name =~ /^(.*)=$/\n @attributes.find { |a| a.name == name && a.singleton == singleton }\n end",
"def first_matching(key)\n @attributes.find do |a|\n a[0].downcase == key.downcase\n end\n end",
"def find_ele_by_attr(class_name, attr, value)\n @driver.find_element :xpath, string_attr_exact(class_name, attr, value)\n end",
"def find_eles_by_attr_include tag, attr, value\n @driver.find_elements :xpath, %Q(#{tag}[contains(@#{attr}, '#{value}')])\n end",
"def find_exact(value)\n ele_by_json_visible_exact '*', value\n end",
"def getElementByAttribute(elementFindBy,elementIdentity,attributeName,attributeValue)\n puts \"in getElementByAttribute\"\n elements = @driver.find_elements(elementFindBy, elementIdentity)\n elements.each do |element|\n if element.attribute(attributeName) != nil then\n if element.attribute(attributeName).include? attributeValue then\n return element\n break\n end\n end\n end\n end",
"def find_by(attribute, value)\n row = connection.get_first_row <<-SQL\n SELECT #{columns.join \",\"} FROM #{table}\n WHERE #{attribute} = #{BlocRecord::Utility.sql_strings(value)};\n SQL\n\n # converts a row into an object\n init_object_from_row(row)\n end",
"def attribute_with_param(attr_name, param_name)\n attributes = self.attributes[attr_name.downcase]\n found_attributes = attributes.select { |attribute| attribute.params[param_name.downcase] }\n found_attributes.first\n end",
"def get_value(attribute,xml)\n xml.xpath(\".//#{attribute}\").first.content\n end",
"def find_attribute_named(name)\n @attributes.find { |m| m.name == name }\n end",
"def tag_value(type)\n pattern = reserved_patterns[type]\n tag = tags.detect { |t| t.match?(pattern) }\n return unless tag\n\n tag.match(pattern)[type]\n end",
"def find_attribute_value(xml, component, attribute, search_comments=false)\n attr_node = xml.at_xpath(\"//Component[@FQDD='#{component}']//Attribute[@Name='#{attribute}']\")\n if attr_node.nil? && search_comments\n xml.xpath(\"//Component[@FQDD='#{component}']/comment()\").each do |comment|\n if comment.content.include?(attribute)\n node = Nokogiri::XML(comment.content)\n if node.at_xpath(\"/Attribute\")['Name'] == attribute\n attr_node = node.at_xpath(\"/Attribute\")\n break\n end\n end\n end\n end\n attr_node.nil? ? nil : attr_node.content\n end",
"def search_attribute(attrib)\n unless attrib.blank?\n attrib = attrib.to_s.strip\n search_attributes.insert(0, attrib) unless search_attributes.include?(attrib)\n end\n end",
"def find_ele_by_attr_include(class_name, attr, value)\n @driver.find_element :xpath, string_attr_include(class_name, attr, value)\n end",
"def attribute(name)\n attributes.each { |a| return a if a.property.id == name }\n nil\n end",
"def find_eles_by_attr(class_name, attr, value)\n @driver.find_elements :xpath, string_attr_exact(class_name, attr, value)\n end",
"def singleAttr(elName, attrName, default=nil)\n els = @root.xpath(\"meta/#{elName}[@meta='yes']\")\n els.length <= 1 or puts(\"Warning: multiple #{elName.inspect} elements found.\")\n return els[0] ? (els[0][attrName] || default) : default\n end",
"def scope(attribute, value)\n attribute.eq(value)\n end",
"def find_ele_by_predicate(class_name: '*', value:)\n elements = find_eles_by_predicate(class_name: class_name, value: value)\n raise _no_such_element if elements.empty?\n\n elements.first\n end",
"def find_element_by_value(locator, value)\n @browser.find_elements(locator).select { |el| el.attribute('value') == value }.first\n end",
"def find_by(attribute, value)\n if @@project_cache.has_key?(value)\n project = @@project_cache[value]\n else\n project_id = lookup_id_for(attribute, value)\n project = get_project(project_id)\n end\n return project\n end",
"def find_item value\n self.find { |item| item.value == value }\n end",
"def find_by attribute, value\n\n all.detect { |continent| continent.send(attribute) == value }\n\n end",
"def first(field)\n @attributes[field]\n end",
"def find_by_value(value)\n by_value[value]\n end",
"def find_by_value(value)\n by_value[value]\n end",
"def getValue page, attribute\n if attribute == 'rating'\n return page.search('.ratingValue').children[1].text\n end\nend",
"def fetch_element(key)\n return @completed_elements.detect do |el|\n el.first.html_attribute_name == key || el.first.name == key\n end\n end",
"def find_by_value_str(value_str)\n value_str = value_str.to_s\n by_value.each do |value, instance|\n return instance if value_str == value.to_s\n end\n nil\n end",
"def find_value(value)\n return find() do |item| # find is an enumerable that takes a block - passes each entry in enum to block\n item.data == value # and returns the first for which block is NOT false. So here we say return what we\n end # the first item of which the data matches the value\n end",
"def get_attribute_or_element_value(xml, attr, default = nil, &f)\n val = default\n begin\n snip = xml.elements[attr]\n if snip.elements.size > 0\n if snip.elements.size == 1 && snip.elements['object']\n # must be an otml reference to a different OTObject\n # return the refid\n val = snip.elements['object'].attributes['refid'].to_s\n else\n # otherwise just return the whole snippet\n val = snip.to_s\n end\n else\n val = snip.get_text.to_s\n end\n rescue\n begin\n val = xml.attributes[attr].to_s\n rescue\n # logger.warn(\"Couldn't find attribute or element: #{attr}\")\n end\n end\n begin\n if f\n val = yield(val)\n end\n rescue\n val = default\n end\n return val\n end",
"def find_value(value) \n find { |item| item.data == value }\n end",
"def find_tag(t)\n r = nil\n if @tag == t\n r = self\n elsif\n begin\n each do |it|\n r = it.find_tag(t)\n break if r\n end\n rescue\n end\n end\n return r\n end",
"def with_value(value)\n where(:value => value).first\n end",
"def find_attribute_named(name)\n case name\n when /\\A#/ then\n find_attribute name[1..-1], false\n when /\\A::/ then\n find_attribute name[2..-1], true\n else\n @attributes.find { |a| a.name == name }\n end\n end",
"def get(value)\n if value.kind_of? Details::Attribute\n raise \"Invalid attribute! Must be an attribute named #{self.name}\" if value.name != self.name\n value = value.value\n end\n value.strip! if value.kind_of? String\n @values.find { |v| v.value == value }\n end",
"def get_attribute(name)\n return @attrs[name] if attrs.key?(name)\n end",
"def first_matching_tag\n r = Registry.get\n return unless r\n\n RegistryEvent.all.find_each do |event|\n data = JSON.parse(event.data)\n _, _, tag_name = r.get_namespace_from_event(data)\n return event.dup if tag_name == @tag\n end\n\n nil\n end",
"def attribute(locator, attribute)\n find_element(locator).attribute(attribute)\n end",
"def get(attribute)\n @attributes[attribute.to_s]\n end",
"def get(match, expr, value, attr)\n retval = false\n match.each do |m|\n if attr and attr.length > 0\n retval = evaluate_expression(m.attributes[attr], expr, value)\n else\n retval = evaluate_expression(m.text, expr, value)\n end\n break if retval\n end\n return retval\n end",
"def scrape_attribute_value(element, attribute)\n scrape element if !element.not_nil?\n return @result[attribute]\n end",
"def get_from_tags(resource, item)\n (resource['tags'] || []).detect { |tag, _| tag['key'].downcase == item.to_s.downcase }.try(:[], 'value')\n end",
"def [](attr)\n return nil unless instance_variable_defined?(:@attributes) and @attributes.is_a?(Hash)\n @attributes[attr] or (attr.is_a?(String) ? @attributes[attr.to_sym] : @attributes[attr.to_s])\n end",
"def find_by_tag(tag, single = true, &block)\n find_matching(:tag, tag, single, block)\n end",
"def searchForAttribute(xml, nodeName, attributeName)\n\n if( xml[\"nodeName\"] == nodeName )\n\n attribs = xml[\"nodeAttributes\"]\n if(attribs[attributeName] == nil)\n return @NOT_FOUND\n end\n return attribs[attributeName]\n end\n\n size = xml[\"childCount\"].to_i\n for j in 0..size\n\n values = xml[j]\n if(values[\"nodeName\"] == nodeName)\n\n hmValue = values[\"nodeAttributes\"]\n if(hmValue[attributeName] != nil)\n \t return hmValue[attributeName]\n end\n else\n\n value = searchForAttribute(values,nodeName,attributeName)\n if(value != \"\" && value != @NOT_FOUND)\n \t return value\n end\n end\n end\n return @NOT_FOUND\n end",
"def find(value)\n self.each {|node| return node if node.value == value}\n end",
"def get(attribute_name)\n # label, attribute = attribute_name.split('_')\n # self.send(\"#{attribute}s\").first_for(label)\n attributes[attribute_name.to_sym] ||= get_field(attribute_map[attribute_name])\n end",
"def [](val)\n @attributes[val]\n end",
"def find_first(value,start,stop)\n return start if time_at(start) > value\n find(:first,value,start,stop)\n end",
"def [](attrib)\n attributes[attrib]\n end",
"def check_attribute(name, value)\n result = false\n negate = false\n \n # Negation\n # i.e. <plain os=\"!SunOS\"></plain>\n if value =~ /^\\!/\n negate = true\n value.sub!(/^\\!/, '') # Strip off the bang\n end\n \n comparables(name).each do |comp|\n # Numerical comparisons\n # i.e. <plain os=\"SunOS\" osversion=\">=5.8\"></plain>\n # Note that the standard for XML requires that the < character be\n # escaped in attribute values, so you have to use <\n # That's been decoded by the XML parser before it gets to us\n # here so we don't have to handle it specially\n if value =~ %r{^(<|<=|>=|>)\\s*([\\d\\.]+)$}\n operator = $1\n valueversion = Version.new($2)\n compversion = Version.new(comp)\n if compversion.send(operator.to_sym, valueversion)\n result = true\n end\n # Regular expressions\n # i.e. <plain group=\"/dns-.*-server/\"></plain>\n # or <plain os=\"/Red Hat/\"></plain>\n elsif value =~ %r{^/(.*)/$}\n regexp = Regexp.new($1)\n if comp =~ regexp\n result = true\n end\n else\n if comp == value\n result = true\n end\n end\n end\n \n if negate\n return !result\n else\n return result\n end\n end",
"def find_by_name(name, field = :name)\n Tag.find_by_name(name.strip) || (fail BadRequestError.resource_not_found(field), \"Tag not found.\")\n end",
"def with(name)\r\n @attributes.find { |attr| attr.name == name }\r\n end",
"def find_attributes_starting_with(name)\n @attributes.select { |key| key.to_s.start_with?(name) }\n end",
"def have_attribute(attribute)\n match(/(?<=\\A|\\s)#{Regexp.escape(attribute)}(?=\\z|\\s)/)\n end",
"def find_matches(array, selector, attribute)\n if attribute.kind_of? String or attribute.kind_of? Symbol\n @doc.css(selector).each do |tag|\n begin\n array << Addressable::URI.parse(tag[attribute]).to_s\n rescue\n end\n end\n elsif attribute.instance_of? Regexp\n @doc.css(selector).each do |tag|\n begin\n tag.content.scan(attribute) {|match| array << Addressable::URI.parse(match[0]).to_s}\n rescue\n end\n end\n elsif attribute.instance_of? Proc\n @doc.css(selector).each do |tag|\n begin\n attribute.call(array, tag)\n rescue\n end\n end\n end\n end",
"def find( tag = nil )\n tag = Tag.new( tag, Tag.WILDCARD_NS ) unless tag.nil? || tag.is_a?( Tag )\n if block_given?\n children.find do |c|\n c.element? && ( tag.nil? || c.tag == tag ) && yield( c )\n end\n else\n first_element( tag )\n end\n end",
"def fetch_xml_attr(path, xml, attribute = \"id\") # :doc:\n XML::Parser.parse(xml.body, \"/pairwise/#{path}\", attribute)\n end",
"def [](attr_name)\n if attr_name.class == Fixnum\n cells.joins(:row).where(rows: {position: attr_name}).first\n else\n read_attribute(attr_name) { |n| missing_attribute(n, caller) }\n end\n end",
"def complex_find_exact(class_name, value)\n find_element :uiautomator, string_visible_exact(class_name, value)\n end",
"def item(index)\n attributes.values.each_with_index { |item, ix| return item if index == ix } && nil\n end",
"def find(value)\n key = \\\n if value.to_s =~ /^[0-9\\.]*$/\n default_search_param + \"id\"\n else\n default_search_param\n end\n\n where(key => value).first\n end",
"def get_attrib(attrib)\n Attrib.get(attrib, self) rescue nil\n end",
"def get_attribute(attribute)\n\t\t@attributes[attribute.intern]\n\tend",
"def get_attribute_value(attribute)\n data[attribute]\n end",
"def primary\n self.find do |attribute|\n begin\n attribute.primary?\n rescue NoMethodError => e\n false\n end\n end\n end",
"def get_attribute(name)\n str = name.to_s\n \n # try fetching an instance variable first\n value = instance_variable_get(\"@#{str}\")\n return value unless value.nil?\n \n # not an instance variable -- try fetching from @metadata\n load_metadata unless @metadata_loaded\n value = @metadata[str]\n return value unless value.nil?\n \n # not in metadata under that name -- is there another variant?\n alternate_name = nil\n self.class.md_key_map.each do |md_name, var_name|\n if str == md_name.to_s\n alternate_name = var_name.to_s\n break\n end\n end\n \n # if we couldn't find anything, return nil\n return nil if alternate_name.nil?\n \n # otherwise, try looking in metadata using the alternate name\n # if this doesn't work, we'll just let the method return nil\n @metadata[alternate_name]\n end",
"def [](tag)\n find { |f| f.tag == tag }\n end",
"def first_value(tag)\n tag_summary(tag).first[1].first\n end",
"def find_bios_attribute(xml_base, attr_name)\n uncommented = xml_base.at_xpath(\"//Attribute[@Name='#{attr_name}']\")\n unless uncommented.nil?\n return uncommented.content\n else\n xml_base.xpath(\"//Component[@FQDD='BIOS.Setup.1-1']/comment()\").each do |comment|\n if comment.content.include?(attr_name)\n node = Nokogiri::XML(comment.content)\n if node.at_xpath(\"/Attribute\")['Name'] == attr_name\n return node.at_xpath(\"/Attribute\").content\n end\n end\n end\n end\n nil\n end",
"def primary_tag\n tag = @primary_tag || my_tag_list.first\n\n if tag == NO_PRIMARY_TAG\n nil\n else\n tag\n end\n end",
"def where(attribute, value, options = {})\n valid_comparisons = %i[== != > >= < <= match]\n options[:comparison] ||= value.is_a?(Regexp) ? :match : '=='\n unless valid_comparisons.include?(options[:comparison].to_sym)\n raise Exceptions::InvalidWhereQuery\n end\n\n self.class.new(\n @list.collect do |item|\n if item.send(attribute).nil?\n nil\n elsif item.send(attribute).send(options[:comparison].to_sym, value)\n item\n end\n end.compact,\n type: @type,\n api_client: @api_client\n )\n end",
"def find_by_param(param)\n with_param(param).first\n end",
"def wait_for_attribute_to_include(locator, attribute, value)\n how, what = parse_locator(locator)\n\n wait_for do\n begin\n driver.find_element(how, what)&.attribute(attribute)&.downcase&.include?(value.downcase)\n rescue Selenium::WebDriver::Error::StaleElementReferenceError\n false\n end\n end\n end",
"def find_attribute_of_model_in_hash(hash, model_name, attribute_name)\n\n if model_hash = hash[\"models\"] && hash[\"models\"][model_name]\n\n result = (model_hash[\"attributes\"] || []).find { |name, type| name.reject{ |key, _| key == \"options\"}.to_a.flatten.first == attribute_name } # TODO this will change because the attribute list will become an hash again\n return result.reject{ |key, _| key == \"options\"}.to_a.flatten if result # Remove the options part of the attribute, this will be unnecessary when the yaml structure is changed\n \n elsif namespaces = hash[\"namespaces\"]\n namespaces.each do |namespace, namespace_hash|\n result = find_attribute_of_model_in_hash(namespace_hash, model_name, attribute_name)\n return result unless result.nil?\n end\n end\n \n # Nothing found\n nil\n end",
"def get attribute\n attributes[attribute]\n end",
"def lookup_id_for(attribute, value)\n return value if attribute == 'id'\n project_list = get(\"/rest/api/2/project\")\n project_list.each do |project|\n return project['id'] if project[attribute] == value\n end\n end",
"def searchForAttributeStartingAt(xml, toStartAt, nodeName, attributeName, index)\n\n count = 0\n size = xml[\"childCount\"].to_i\n for j in 0..size\n\n values = xml[j]\n if(values[\"nodeName\"] == toStartAt)\n return searchForAttributeAtPos(values,nodeName, attributeName,index)\n else\n countVals = values[\"childCount\"].to_i\n for k in 0..countVals\n value = searchForAttributeStartingAt(values[k],nodeName,toStartAt, attributeName,index)\n if(value != \"\")\n return value\n end\n end\n end\n end\n return \"\"\n end",
"def find_attribute(qualified_name, namespace, name)\n if qname = @qualified_attributes[qualified_name]\n return qname\n end\n names = []\n plural = collection?(qualified_name)\n if plural\n if namespace\n names << \"#{ namespace }_#{ name.pluralize }\"\n end\n names << name.pluralize\n end\n if namespace\n names << \"#{ namespace }_#{ name }\"\n end\n names << name\n names.map { |n| n.underscore }.find do |n|\n @attributes.include? n.underscore\n end\n end",
"def tag_value tags, key\n tags.to_ary.each do |i|\n return i[:value] if i[:key] == key\n end\n return nil\nend",
"def [](id)\n smart_attributes.detect { |attribute| attribute == id }\n end",
"def first(attribute=nil)\n return self.pluck(attribute).first if attribute\n @legs.first || {}\n end",
"def depth_first(value_to_find)\r\n @children.each do |child|\r\n found_node = child.depth_first(value_to_find)\r\n if found_node != nil\r\n return found_node\r\n end\r\n end\r\n\r\n if payload == value_to_find\r\n return self\r\n else\r\n return nil\r\n end\r\n end",
"def get_value(key)\n Element.new(\"#{@locator}//*[text()='#{key}']\")\n end",
"def [](key)\n if key.to_s[0] == ?@\n tag = key.to_s[1..-1].to_sym\n c = child(tag)\n if c\n c.text\n else\n nil\n end\n else\n @attrs[key]\n end\n end",
"def find_eles_by_attr_include(class_name, attr, value)\n @driver.find_elements :xpath, string_attr_include(class_name, attr, value)\n end",
"def [](attr_name)\n @attributes.fetch_value(attr_name.to_s)\n end",
"def ele_by_json_visible_exact(element, value)\n ele_by_json string_visible_exact element, value\n end",
"def find_ele_by_text_include tag, text\n find_ele_by_attr_include tag, :text, text\n end",
"def find_by(field, value)\n find_event = nil\n @events.each do |event|\n find_event = event if event.send(field) == value\n end\n\n find_event\n end",
"def find_with_tag(phrase, opts={})\n phrase = phrase.downcase unless opts[:case_sensitive] == true\n first(:tag_words => phrase)\n end",
"def find_node(value)\n current = @anchor.next_node\n while current != @anchor\n return current if current.value == value\n current = current.next_node\n end\n end",
"def findAttribute(attribName)\n if @xmlElement.attributes[attribName] != nil\n return(@xmlElement.attributes[attribName])\n else\n if @parentElem != nil\n return(@parentElem.findAttribute(attribName))\n end\n end\n\n return nil\n end",
"def get_attribute(attr_name)\n return nil unless @attributes.key? attr_name\n\n @attributes[attr_name]\n end",
"def perform(attribute)\n ScraperExpression.where(key: attribute).find_each do |record|\n base = safe_call do\n @html_doc.instance_eval(record.expression)\n end\n\n return base if base.present?\n end\n\n nil\n end",
"def get_attribute(attribute_name)\n theme_attributes.find_by_attribute_name(attribute_name) ||\n populate_attribute(attribute_name)\n end",
"def get_attribute(name); end",
"def get_attribute(name); end"
] |
[
"0.6239441",
"0.6161766",
"0.6061215",
"0.58910185",
"0.5761221",
"0.57191736",
"0.564737",
"0.5631698",
"0.5562108",
"0.55587065",
"0.5415724",
"0.5402241",
"0.53687876",
"0.5368071",
"0.5367492",
"0.53665096",
"0.536548",
"0.53468764",
"0.53362095",
"0.5306197",
"0.52835983",
"0.5283482",
"0.52432793",
"0.5226536",
"0.51956695",
"0.519294",
"0.519294",
"0.5178395",
"0.5177832",
"0.51737314",
"0.51353693",
"0.51071537",
"0.5098214",
"0.5086712",
"0.50824684",
"0.507494",
"0.507484",
"0.50688356",
"0.50685805",
"0.50644004",
"0.50461745",
"0.50228155",
"0.5009644",
"0.50086236",
"0.49920562",
"0.49783322",
"0.49751857",
"0.49688363",
"0.49633923",
"0.49581683",
"0.49483564",
"0.49470508",
"0.4929544",
"0.49188605",
"0.491472",
"0.490127",
"0.48921853",
"0.48856336",
"0.48847014",
"0.48829058",
"0.4879891",
"0.48797536",
"0.48780584",
"0.4876426",
"0.48755345",
"0.4874636",
"0.486871",
"0.48651972",
"0.48562324",
"0.4848493",
"0.4847625",
"0.4839069",
"0.4835624",
"0.48281172",
"0.48246214",
"0.48237193",
"0.48210347",
"0.48200136",
"0.48182216",
"0.4817109",
"0.481411",
"0.4813544",
"0.47956565",
"0.47892648",
"0.47775233",
"0.47680327",
"0.47462997",
"0.47437698",
"0.47427997",
"0.47398466",
"0.47371948",
"0.47230935",
"0.47214782",
"0.47182527",
"0.47158256",
"0.4713889",
"0.47103786",
"0.47093654",
"0.4706014",
"0.4706014"
] |
0.62143034
|
1
|
Get tags by attribute that include value.
|
def find_eles_by_attr_include tag, attr, value
@driver.find_elements :xpath, %Q(#{tag}[contains(@#{attr}, '#{value}')])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_ele_by_attr_include tag, attr, value\n @driver.find_element :xpath, %Q(#{tag}[contains(@#{attr}, '#{value}')])\n end",
"def find_eles_by_attr_include(class_name, attr, value)\n @driver.find_elements :xpath, string_attr_include(class_name, attr, value)\n end",
"def tags\n attributes.fetch(:tags)\n end",
"def tags\n attributes.fetch(:tags)\n end",
"def tags\n @attributes.select { |k, _| tag_names.include?(k.to_s) }\n end",
"def tags\n attributes[:tags] || []\n end",
"def find_ele_by_attr_include(class_name, attr, value)\n @driver.find_element :xpath, string_attr_include(class_name, attr, value)\n end",
"def annotations_with_attribute(attrib, include_values = false)\n return [] if attrib.blank?\n\n obj_type = self.class.base_class.name\n\n options = {\n joins: :annotation_attribute,\n conditions: { annotatable_type: obj_type,\n annotatable_id: id,\n annotation_attributes: { name: attrib.strip.downcase } },\n order: 'updated_at DESC'\n }\n\n options[:include] = [:value] if include_values\n\n fetch_annotations(options)\n end",
"def find_by attribute, value\n\n all.detect { |continent| continent.send(attribute) == value }\n\n end",
"def for_tag(arr, tag)\n arr.select { |item| (item[:tags] || []).include?(tag) }\nend",
"def tags_include(class_names:, value: nil)\n return unless class_names.is_a? Array\n\n class_names.flat_map do |class_name|\n value ? eles_by_json_visible_contains(class_name, value) : tags(class_name)\n end\n end",
"def tagged_with(_tags)\n _tags = convert_string_tags_to_array(_tags) if _tags.is_a? String\n criteria.all_in(tags_field => _tags)\n end",
"def get_from_tags(resource, tag_name)\n tag_name = tag_name.to_s.downcase\n tags = resource['tags'].to_a.concat(resource['tag_set'].to_a)\n Array.wrap(tags).detect { |tag, _| tag['key'].downcase == tag_name }.try(:[], 'value').presence\n end",
"def attribute_tagged_with?(field, tag)\n metafeta_store.has_key?(tag) && metafeta_store[tag].include?(field)\n end",
"def articles_with_attribute(key, attrib, posts=articles)\n posts.select do |post|\n case post[key]\n when String\n post[key] == attrib\n when Array\n post[key].map{ |e| e }.include? (attrib)\n end\n end\n end",
"def get_from_tags(resource, item)\n (resource['tags'] || []).detect { |tag, _| tag['key'].downcase == item.to_s.downcase }.try(:[], 'value')\n end",
"def find_ele_by_text_include tag, text\n find_ele_by_attr_include tag, :text, text\n end",
"def tag_value tags, key\n tags.to_ary.each do |i|\n return i[:value] if i[:key] == key\n end\n return nil\nend",
"def tags\n taxonomies.all :conditions => { :classification => :tag }\n end",
"def find_eles_by_text_include tag, text\n find_eles_by_attr_include tag, :text, text\n end",
"def tag_attribute(attribute_name, namespace)\n plural_attribute_name = \"has_#{attribute_name.to_s.pluralize}\"\n\n virtual_attribute plural_attribute_name, :boolean, :uses => :tags, :arel => (lambda do |t|\n ta = Tag.arel_table\n tnga = Tagging.arel_table\n t.grouping(\n Arel.sql(\n Tagging.joins(:tag).select('true')\n .where(ta[:name].matches(\"#{namespace}/%\", nil, true))\n .where(tnga[:taggable_type].eq(base_class.name).and(tnga[:taggable_id].eq(arel_table[:id])))\n .limit(1).to_sql\n )\n )\n end)\n\n define_method(\"#{attribute_name}_tags\") do\n Tag.filter_ns(tags, namespace)\n end\n\n define_method(plural_attribute_name) do\n if has_attribute?(plural_attribute_name)\n read_attribute(plural_attribute_name) || false\n else\n Tag.filter_ns(tags, namespace).any?\n end\n end\n\n alias_method \"#{plural_attribute_name}?\", plural_attribute_name\n end",
"def getElementByAttribute(elementFindBy,elementIdentity,attributeName,attributeValue)\n puts \"in getElementByAttribute\"\n elements = @driver.find_elements(elementFindBy, elementIdentity)\n elements.each do |element|\n if element.attribute(attributeName) != nil then\n if element.attribute(attributeName).include? attributeValue then\n return element\n break\n end\n end\n end\n end",
"def tagged_by(keyword)\n self.tags.collect { |t| t.keyword }.include?(keyword)\n end",
"def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end",
"def retrieve(attribute)\n attributes = []\n @files.each do |file|\n attributes.push(file[attribute.to_s]) if file[attribute.to_s].present?\n end\n attributes\n end",
"def find_entries_by(name, value)\n values = [*value]\n (self.entries || []).find_all do |entry|\n raw_value = entry.send(:localized_dynamic_attribute_value, name)\n values.include?(raw_value)\n end\n end",
"def annotations_with_attribute_and_by_source(attrib, source, include_values = false)\n return [] if attrib.blank? || source.nil?\n\n obj_type = self.class.base_class.name\n\n options = {\n joins: :annotation_attribute,\n conditions: { annotatable_type: obj_type,\n annotatable_id: id,\n source_type: source.class.name,\n source_id: source.id,\n annotation_attributes: { name: attrib.strip.downcase } },\n order: 'updated_at DESC'\n }\n\n options[:include] = [:value] if include_values\n\n fetch_annotations(options)\n end",
"def filter_by attributes\n\n all.select { |item| matches? item, attributes }\n\n end",
"def by_tag\n Gist.tagged_with(tag_name).includes(:profile)\n end",
"def tags tag_name\n find_elements :tag_name, tag_name\n end",
"def wait_for_attribute_to_include(locator, attribute, value)\n how, what = parse_locator(locator)\n\n wait_for do\n begin\n driver.find_element(how, what)&.attribute(attribute)&.downcase&.include?(value.downcase)\n rescue Selenium::WebDriver::Error::StaleElementReferenceError\n false\n end\n end\n end",
"def tag(value)\n merge(letag: value.to_s)\n end",
"def scope(attribute, value)\n attribute.eq(value)\n end",
"def has_tag?(value)\r\n @tags.include?(value)\r\n end",
"def tagged_with(context, tags)\n tags = convert_string_to_array(tags, get_tag_separator_for(context)) if tags.is_a? String\n array_field = tag_options_for(context)[:array_field]\n all_in(array_field => tags)\n end",
"def tags(name = nil)\n list = @tags + convert_ref_tags\n return list unless name\n list.select {|tag| tag.tag_name.to_s == name.to_s }\n end",
"def search_data\n attributes.merge(tags: tags)\n end",
"def items(tag = nil)\n if tag.nil?\n @items\n else\n @items.select { |item| item['tags'].include? tag }\n end\n end",
"def extract_inclusion_values(klass, attribute)\n values = nil\n\n klass.validators_on(attribute).each do |validator|\n case validator\n when ActiveModel::Validations::InclusionValidator\n values = validator.options[:in]\n end\n end\n\n values\n end",
"def tags\n\t\tt = read_attribute(:tags)\n\t\tt.nil? ? \"\" : t.join(', ')\n\tend",
"def get_tags(feature)\n tags = []\n feature.custom_fields.each { |field| tags = field.value if field.name = 'Tag' }\n tags\n end",
"def where(options = {})\n _, _, root = @client.get(\"/tags\", options)\n\n root[:items].map{ |item| Tag.new(item[:data]) }\n end",
"def tag_with(tags, attr = 'tag', owner = User.current_user, owned_tags_only = false)\n tags = Array(tags)\n # FIXME: yuck! - this is required so that self has an id and can be assigned to an Annotation.annotatable\n return if new_record? && !save\n\n current = annotations_with_attribute(attr)\n original = current\n current = current.select { |c| c.source == owner } if owned_tags_only\n for_removal = []\n current.each do |cur|\n for_removal << cur unless tags.include?(cur.value.text)\n end\n\n tags.each do |tag|\n exists = TextValue.where('lower(text) = ?', tag.downcase)\n # text_value exists for this attr\n if !exists.empty?\n\n # isn't already used as an annotation for this entity\n if owned_tags_only\n matching = Annotation.for_annotatable(self.class.name, id).with_attribute_name(attr).by_source(owner.class.name, owner.id).select { |a| a.value.text.casecmp(tag.downcase).zero? }\n else\n matching = Annotation.for_annotatable(self.class.name, id).with_attribute_name(attr).select { |a| a.value.text.casecmp(tag.downcase).zero? }\n end\n\n if matching.empty?\n annotation = Annotation.new(source: owner,\n annotatable: self,\n attribute_name: attr,\n value: exists.first)\n annotation.save!\n end\n else\n annotation = Annotation.new(source: owner,\n annotatable: self,\n attribute_name: attr,\n value: tag)\n annotation.save!\n end\n end\n for_removal.each(&:destroy)\n # return if the annotations have changed. just use the text to avoid issues with ID's changing\n original = original.collect { |a| a.value.text }.sort\n new = annotations_with_attribute(attr).collect { |a| a.value.text }.sort\n original != new\n end",
"def tags()\n\t\t\treturn @metadata.attributes[:tags].to_a\n\t\tend",
"def tags=(value)\n if value.kind_of?(String)\n @tags = value.split(\",\").uniq.map(&:strip)\n elsif value.kind_of?(Array)\n @tags = value.uniq.map(&:strip)\n end\n end",
"def tags\n @tags ||= tags_from_collection.merge(tags_from_item).values.select(&:release)\n end",
"def tagsFor(user)\n if user.nil?\n []\n else\n tags.select{|x| x.user_id == user.id}\n end\n end",
"def kwattr_values(attribute_name)\n keywordify(get_attribute(attribute_name) || [])\n end",
"def tags\n @tags ||= tag_class.in_challenge(collection).group(:id)\n end",
"def tags\n get('tags')\n end",
"def find_eles_by_attr(class_name, attr, value)\n @driver.find_elements :xpath, string_attr_exact(class_name, attr, value)\n end",
"def tags_from_params\n search_filter_params[:tagged_with].to_s.split(\",\")\n end",
"def find_matches(array, selector, attribute)\n if attribute.kind_of? String or attribute.kind_of? Symbol\n @doc.css(selector).each do |tag|\n begin\n array << Addressable::URI.parse(tag[attribute]).to_s\n rescue\n end\n end\n elsif attribute.instance_of? Regexp\n @doc.css(selector).each do |tag|\n begin\n tag.content.scan(attribute) {|match| array << Addressable::URI.parse(match[0]).to_s}\n rescue\n end\n end\n elsif attribute.instance_of? Proc\n @doc.css(selector).each do |tag|\n begin\n attribute.call(array, tag)\n rescue\n end\n end\n end\n end",
"def find_relationship_by(attribute, value); end",
"def tag(*tags)\n attribute 'tags' do |existing_tags|\n existing_tags ||= []\n tags.each do |tag|\n if !existing_tags.include?(tag.to_s)\n existing_tags << tag.to_s\n end\n end\n existing_tags\n end\n end",
"def available_values\n result = []\n for i in (0 .. @tag.length - 1)\n result << @tag[i].value\n end\n return result\n end",
"def available_values\n result = []\n for i in (0 .. @tag.length - 1)\n result << @tag[i].value\n end\n return result\n end",
"def tagged\n taggings.collect(&:taggable)\n end",
"def get_tags() tag_ids.inject([]) { |l, tag_id| l << get_tag_from_id(tag_id) } end",
"def images_for_attribute(attribute)\n cache_image_attributes\n\n # return the pared-down list\n @images.select do |img|\n # this covers nil == nil and attribute == attribute\n next true if img.attribute == attribute\n\n # if there is no attribute for this image, it should be pulled in\n # ... unless there's an exact match elsewhere in the set.\n next true if img.attribute.nil? && !(@attributes_by_id[img.id.to_s].include? attribute)\n\n false\n end\n end",
"def filter_by(players, target, attribute)\n selected = []\n players.each do |player|\n if player[attribute] == target\n selected << player\n end\n end\n selected\nend",
"def tags\n @values.keys.map {|tag| Values.tag_map[tag]}\n end",
"def tagged(tags, bool: :and)\n WWID.new.filter_items(self, opt: { tag: tags, bool: bool })\n end",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def get_tag_matches(option_tags, aws_tags)\n matches = []\n\n option_tags.each do | option_tag |\n # If tag value is a string, do string comparison (with wildcard support)\n if option_tag[:value].is_a? String\n option_value = option_tag[:value].sub('*','.*')\n\n aws_tags.each do | aws_tag | \n if @options[:case_insensitive]\n value_pattern = /^#{option_value}$/i\n matches.push(aws_tag) if option_tag[:key].downcase == aws_tag[:key].downcase and aws_tag[:value].match(value_pattern)\n else\n value_pattern = /^#{option_value}$/\n matches.push(aws_tag) if option_tag[:key] == aws_tag[:key] and aws_tag[:value].match(value_pattern)\n end \n end\n\n # if tag value is an array, check if value is in the array\n else\n if @options[:case_insensitive]\n option_values = option_tag[:value].map(&:downcase)\n else\n option_values = option_tag[:value]\n end\n\n aws_tags.each do | aws_tag |\n if @options[:case_insensitive]\n matches.push(aws_tag) if (option_tag[:key].downcase == aws_tag[:key].downcase && (option_values.include?(aws_tag[:value].downcase)))\n else\n matches.push(aws_tag) if (option_tag[:key] == aws_tag[:key] && (option_values.include?(aws_tag[:value])))\n end\n end\n end\n end\n\n return matches\nend",
"def tags1\n return projects_tags.where(\"tags_id in (select id from tags where type_tag=?)\",1)\n end",
"def filter_by_tag(tag)\n get_venues_for_filtering if @venues_to_filter.empty?\n @venues_by_tag = []\n @venues_to_filter.each do |venue|\n venue[\"tags\"].each do |venue_tag|\n if venue_tag.downcase == tag.downcase\n @venues_by_tag << venue[\"name\"]\n end\n end\n end\n @venues_by_tag\n end",
"def related\n @related ||= begin\n response = Fleakr::Api::MethodRequest.with_response!('tags.getRelated', :tag => value)\n (response.body/'rsp/tags/tag').map {|e| Tag.new(e) }\n end\n end",
"def tags\n @data['tags']\n end",
"def find_identities_by_attribute_name(operation_name)\n# o = Attribute.find_by_content(operation_name)\n# o = Attribute.where(:content => operation_name)\n ret = []\n# unless o.nil?\n ret = self.identities.reject {|i| not i.attributes.include? i.attributes.find_by_content(operation_name)}\n# end\n return ret\n end",
"def search_attribute(attrib)\n unless attrib.blank?\n attrib = attrib.to_s.strip\n search_attributes.insert(0, attrib) unless search_attributes.include?(attrib)\n end\n end",
"def arel_predicate_for(attribute, value, parent)\n if ActiveRecord::Relation === value && value.select_values.empty?\n value = visit(value.select(value.klass.arel_table[value.klass.primary_key]), parent)\n else\n value = can_visit?(value) ? visit(value, parent) : value\n value = quote_for_attribute(value, attribute)\n end\n\n case value\n when Array\n attribute_in_array(attribute, value)\n when Range, Arel::SelectManager\n attribute.in(value)\n else\n attribute.eq(value)\n end\n end",
"def tags(include_private=false)\n Tag.find_all_by_user(self, include_private)\n end",
"def tags\n object.tags.map {|tag| tag.id}\n end",
"def tags\n @obj['tags']\n end",
"def include_attribute?(attribute, val)\n attribute = attribute.to_sym\n # explicitly included\n return true if self.included_attributes.include?(attribute)\n # explicitly excluded\n return false if self.excluded_keys.include?(attribute)\n # make sure it's public\n return false unless self.public_attributes.include?(attribute)\n # make sure it's not already accounted for in the URL\n if self.is_prefix_field?(attribute)\n return false\n end\n # check to make sure the value is something we want to send\n return false unless self.check_blank_value(attribute, val)\n\n # default to true\n true\n end",
"def tags\n get.tagGuids\n end",
"def filtering_by_tags?\n selected_tags\n end",
"def filtering_by_tags?\n selected_tags\n end",
"def find_attributes_starting_with(name)\n @attributes.select { |key| key.to_s.start_with?(name) }\n end",
"def where(attribute, value, options = {})\n valid_comparisons = %i[== != > >= < <= match]\n options[:comparison] ||= value.is_a?(Regexp) ? :match : '=='\n unless valid_comparisons.include?(options[:comparison].to_sym)\n raise Exceptions::InvalidWhereQuery\n end\n\n self.class.new(\n @list.collect do |item|\n if item.send(attribute).nil?\n nil\n elsif item.send(attribute).send(options[:comparison].to_sym, value)\n item\n end\n end.compact,\n type: @type,\n api_client: @api_client\n )\n end",
"def tags\n object.tags.each do |tag|\n tag.name\n end\n end",
"def tags\n ['any'] + @tags\n end",
"def tags\n ['any'] + @tags\n end",
"def find_2_eles_attr tag_name_1, tag_name_2, attribute\n # Use au.lookup(tag_name) instead of $(tag_name)\n # See https://github.com/appium/appium/issues/214\n js = %Q(\n var eles = au.lookup('#{tag_name_1}');\n eles = $(eles.concat(au.lookup('#{tag_name_2}')));\n var result = [];\n for (var a = 0, length = eles.length; a < length; a++) {\n result.push(eles[a].#{attribute}());\n }\n result\n )\n\n @driver.execute_script js\n end",
"def tags(includeHidden=true, includeArchived=true)\n\t\t\n\t\t#Get all the activities ids for the classroom and put them into an array\n\t\tactivities = Activity.activities_with_pairings(self.id, nil, nil, includeHidden, includeArchived)\n\t \tactivity_id_array = Array.new\n\t \tactivities.each do |a| activity_id_array.push(a[\"id\"].to_i) end\n\n\t\t#get all the tag id's from the pairings\n\t\ttag_id_array = ActivityTagPairing.where({activity_id: activity_id_array}).pluck(:activity_tag_id)\n\n\t\t#query for the activity tags corresponding to the tag id's, and put them into a hash to make them unique\n\t\tactivity_tags = ActivityTag.where(id: tag_id_array).order(\"name ASC\").distinct\n\n\t\treturn activity_tags\n\t\t\n\tend",
"def include?(value)\n element.include? value\n end",
"def get_tag_value tag_key_name\n tag = self.tags.joins(:tag_key).where('tagging_tag_keys.name = ?', tag_key_name).includes(:tag_value).first\n tag.try(:tag_value).try(:value)\n end",
"def tag(value)\n merge(uctag: value.to_s)\n end",
"def find_values(tag)\n results =[]\n dictionary.each do |key, values|\n next if values.nil?\n matched_keys = values.select { |k,v| v.to_s =~ /@#{tag}( |$)/i }.keys.each do |k|\n results << k\n end\n end\n results\n end",
"def parse_meta_tags ( field_key )\n value = self[field_key]\n tags = parse_tags value\n return tags\n end",
"def get_tags_for_select() tag_ids.inject([]) { |l, tag_id| l << [get_tag_from_id(tag_id).label, tag_id] } end",
"def find_eles_by_predicate_include(class_name: '*', value:)\n predicate = if class_name == '*'\n %(name contains[c] \"#{value}\" || label contains[c] \"#{value}\" || value contains[c] \"#{value}\")\n else\n %(type == \"#{class_name}\" && ) +\n %((name contains[c] \"#{value}\" || label contains[c] \"#{value}\" || value contains[c] \"#{value}\"))\n end\n @driver.find_elements :predicate, predicate\n end",
"def tag(value)\n merge(rvtag: value.to_s)\n end",
"def find_tagged_with(*args)\n options = find_options_for_find_tagged_with(*args)\n options.blank? ? [] : find(:all, options)\n end",
"def [](attribute)\n get(attribute.to_sym) || set(attribute.to_sym, [])\n end"
] |
[
"0.6183723",
"0.60624206",
"0.58803207",
"0.58803207",
"0.5748873",
"0.563602",
"0.56323403",
"0.5598353",
"0.5580782",
"0.5517507",
"0.54761076",
"0.544825",
"0.5442762",
"0.54358375",
"0.54084975",
"0.5379608",
"0.5345656",
"0.5336335",
"0.5329006",
"0.531109",
"0.5296",
"0.5242717",
"0.52254534",
"0.51457065",
"0.511191",
"0.51004523",
"0.5058663",
"0.5054618",
"0.5051169",
"0.50508285",
"0.5012455",
"0.5005958",
"0.49936306",
"0.49918967",
"0.49868304",
"0.49811327",
"0.49526733",
"0.49301544",
"0.4929539",
"0.49166247",
"0.49156415",
"0.49087417",
"0.48953786",
"0.48862052",
"0.48656127",
"0.48599917",
"0.4851853",
"0.48498577",
"0.4831502",
"0.48225993",
"0.48207185",
"0.48187363",
"0.4813674",
"0.48124945",
"0.48096144",
"0.48068538",
"0.48068538",
"0.48066172",
"0.47818613",
"0.4765764",
"0.47556588",
"0.4754162",
"0.47497827",
"0.47439852",
"0.47439852",
"0.47439852",
"0.47439852",
"0.47439852",
"0.47439852",
"0.47335538",
"0.47323656",
"0.47282112",
"0.472723",
"0.47142664",
"0.471181",
"0.4683848",
"0.46834394",
"0.46797764",
"0.4664717",
"0.46610832",
"0.46560574",
"0.4651898",
"0.4651898",
"0.46517992",
"0.46474233",
"0.46466106",
"0.46458334",
"0.46458334",
"0.4644561",
"0.46427473",
"0.4640677",
"0.4636983",
"0.4635986",
"0.4635716",
"0.46342263",
"0.46326426",
"0.46305388",
"0.46283802",
"0.4626338",
"0.4625024"
] |
0.6645752
|
0
|
Get the first tag that includes text.
|
def find_ele_by_text_include tag, text
find_ele_by_attr_include tag, :text, text
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def extract_first_text(xhtml)\n texts = extract_text_from_elements(xhtml)\n texts.empty? ? '' : texts[0]\n end",
"def first_text\n first_ele static_text_class\n end",
"def tag_text()\n return self.tag(true)\n end",
"def first_ele(class_name)\n tag(class_name)\n end",
"def first_text\n first_ele UIAStaticText\n end",
"def first_text\n first_ele TEXT_VIEW\n end",
"def first_with_tag(phrase, opts={})\n lo = opts.clone\n case_sensitive = lo.delete :case_sensitive\n phrase = phrase.downcase unless case_sensitive\n first(lo.merge(:tag_words => phrase))\n end",
"def just_text\r\n return $1 if text =~ /^<p>(.*)<\\/p>$/\r\n text\r\n end",
"def find_first(selector, data)\n data = @data unless data\n results = (data/selector)\n if results and results.first\n results.first.inner_html.strip\n else\n nil\n end\n end",
"def primary_tag\n tag = @primary_tag || my_tag_list.first\n\n if tag == NO_PRIMARY_TAG\n nil\n else\n tag\n end\n end",
"def first_part\n self.parsed_page ||= @connect.page self.name\n self.parsed_page.search(\"p\").first.children.first\n end",
"def first_node_text(set)\n return set[0].respond_to?(:text) ? set[0].text : ''\n end",
"def text\n @tag_data[:text]\n end",
"def htmlGetTagContents(html, tagName)\n html.split(\"<#{tagName}>\")[1].split(\"</#{tagName}>\")[0]\nend",
"def search1(doc)\n doc.search('.subtext > span:first-child').map { |span| span.inner_text}\n end",
"def first_ele tag_name\n # XPath index starts at 1\n find_element :xpath, \"//#{tag_name}[1]\"\n end",
"def find text\n preorder_traverse @fragment do |node|\n if node.text? then\n if not node.text.index(text).nil? then\n return node\n end\n end\n end\n end",
"def first_value(tag)\n tag_summary(tag).first[1].first\n end",
"def return_tag(text); end",
"def xpath_first_text(from_root_node, path)\n element_text(xpath_first(from_root_node, path))\n end",
"def text\n self.children.each do |node|\n if node.node_type == TEXT_NODE\n if node.content && node.content.rstrip.length > 0\n return node.content\n end\n end\n end\n\n return nil\n end",
"def find_with_tag(phrase, opts={})\n phrase = phrase.downcase unless opts[:case_sensitive] == true\n first(:tag_words => phrase)\n end",
"def first_ele(class_name)\n ele_index class_name, 1\n end",
"def first_subfield_value(tag)\n sf = @field.subfields.select { |sf| sf.code == tag}\n return '' if sf.empty?\n sf.first.value\n end",
"def tag_content\n return @tag_content\n end",
"def first_part text\n found = false\n preorder_traverse @fragment do |node|\n if found then\n node.remove\n elsif node.text? then\n if not node.text.index(text).nil? then\n found = true\n update_content node, text, :keep_left\n end\n end\n end\n end",
"def single_tag\n @single_tag_regex ||= tag_regexp\n end",
"def short_content\n if self.content.include?(PAGEBREAK)\n # Also look for pagebreaks wrapped in paragraph tags\n if self.content.include?(\"<p>#{PAGEBREAK}</p>\")\n pagebreak_pos = self.content.index(\"<p>#{PAGEBREAK}</p>\")\n else\n pagebreak_pos = self.content.index(PAGEBREAK)\n end\n c = close_tags(self.content[0, pagebreak_pos])\n end\n return c || self.content\n end",
"def find_tag(t)\n r = nil\n if @tag == t\n r = self\n elsif\n begin\n each do |it|\n r = it.find_tag(t)\n break if r\n end\n rescue\n end\n end\n return r\n end",
"def text text\n # Return the first element matching selector.\n # s.textContains(value)\n mobile :find, [ [ [3, text] ] ]\n end",
"def first\n contents[0]\n end",
"def tagline\n document.search(\"h5[text()='Tagline:'] ~ div\").first.innerHTML.gsub(/<.+>.+<\\/.+>/, '').strip.imdb_unescape_html rescue nil\n end",
"def text\n html.gsub(REGEX_TAGS, \"\")\n end",
"def elements_with_content(element)\n if element.present?\n element.select { |elem| elem.content.present? }.join(&:text)\n else\n element\n end\n end",
"def single(name)\n els = @root.xpath(\"meta/#{name}[@meta='yes']\")\n els.length <= 1 or puts(\"Warning: multiple #{name.inspect} elements found.\")\n return els[0] ? els[0].content : nil\n end",
"def find_tag(tag_name)\n r = scan(/\\<#{tag_name}\\>(.*?)\\<\\/#{tag_name}\\>/im)\n r.map{|e|e.first}\n end",
"def my_node_tagged(tag, options={})\n my_nodes_tagged(tag, options)[0]\n end",
"def my_node_tagged(tag, options={})\n my_nodes_tagged(tag, options)[0]\n end",
"def type\n return :opening_tag if element_is_opening_tag?\n return :text if element_is_text?\n return :closing_tag if element_is_closing_tag?\n end",
"def type\n return :opening_tag if element_is_opening_tag?\n return :text if element_is_text?\n return :closing_tag if element_is_closing_tag?\n end",
"def parseHtml(html)\n\t\t\tregex = /<(#{tag}(.*?)>(.*?)<\\/#{tag}>)/\n\t\t\tresults = html.scan(regex)\n\t\t\treturn results.empty? ? '' : results[0][-1]\n\t\tend",
"def parse_tag_with_types_and_title(tag_name, text); end",
"def get(name,tag)\n get_text_content(name, tag, @klass)\n end",
"def tag\n return @tag\n end",
"def tag\n @tag ||= page.tags(true).detect{|t| t.is_cms_block? && t.identifier == identifier}\n end",
"def see_tag(text); end",
"def tag\n if @tag.is_a? String\n @tag\n end\n end",
"def get_inside_text( text )\n \"<hello>#{ text }</hello>\"\n end",
"def matching_tag(tag)\n chars = tag.chars\n chars.delete_at(1)\n chars.join('')\n end",
"def first\n\t\t@first.content\n\tend",
"def first_matching_tag\n r = Registry.get\n return unless r\n\n RegistryEvent.all.find_each do |event|\n data = JSON.parse(event.data)\n _, _, tag_name = r.get_namespace_from_event(data)\n return event.dup if tag_name == @tag\n end\n\n nil\n end",
"def find_first_json_in(text)\n find_all_json_in(text).first\n end",
"def get_tag(tag_class); end",
"def markup\n self.text.sub(/^(.*)$/,'<b>\\1</b>')\n end",
"def get_tag\n puts profile_parser(options.pattern, 0).last\n end",
"def first\n matches.first\n end",
"def since_tag(text); end",
"def elt_text(xml,s) #:nodoc:\r\n if elt = xml.elements[s]\r\n return elt.text\r\n end\r\n return nil\r\n end",
"def parse_tag_with_name(tag_name, text); end",
"def text_range\n body = get.gsub!(/\\s*/,'')\n pattern = /#{@before_element}.*#{@after_element}/\n results = pattern.match(body)\n return results[0] if results\n end",
"def tag()\n return @driver.get_sc_core_query_element_tag(@handle, @index)\n end",
"def get_text(element)\n element.text\n end",
"def text\n return @text if @text\n\n @text = @node.inner_text\n\n # If there is no text, try to find an image and use it's alt text\n if (@text.nil? or @text.empty?) and imgs = @node.search('img') then\n @text = imgs.map do |e|\n e['alt']\n end.join\n end\n\n @text\n end",
"def start_tag\n if element.attributes.empty?\n \"<#{element.tag}>\"\n else\n \"<#{element.tag} #{element.attributes.to_html}>\"\n end\n end",
"def inn\n raw = @html.split('<strong>ИНН организации:</strong>')[1].split('<br>')[0]\n end",
"def extract_text_from_elements(xhtml)\n return '' if xhtml.empty?\n begin\n doc = Nokogiri.XML(xhtml)\n text_contents = doc.search(\"//text()\").collect { |text_node| text_node.text }\n rescue ArgumentError\n end\n text_contents\n end",
"def first(text, filters: %i[correctness completion pending size])\n parse(text, filters: filters, n: 1).first\n end",
"def extract_title(doc)\n the_title_tag = title_tag(doc)\n return the_title_tag unless the_title_tag.respond_to? :inner_html\n strip_tags(the_title_tag.inner_html)\n end",
"def peel_off_outer_tag(record)\n rg = /(<\\w+\\s+.*?>)(.*)(<\\/\\w+>)/\n m_a = rg.match(record.parent.frgtxt).to_a\n # I want the meat in the middle of the sandwich.\n return m_a[2]\n end",
"def parent_tag\n return nil unless within_open_tag?\n\n @tags_list.last\n end",
"def no_tags label\n return label.gsub(/\\<.+\\/?\\>/,'')\n end",
"def first_wa(elements)\n elements.any? do |i|\n if i.class == String \n if i.start_with?\"wa\"\n return i\n end\n end\n end\nend",
"def get_text\n `#{@element}.textContent`\n end",
"def just_first\n first.split(' ')[0]\n end",
"def node_tagged(tag, options={})\n nodes_tagged(tag, options)[0]\n end",
"def node_tagged(tag, options={})\n nodes_tagged(tag, options)[0]\n end",
"def first *a; self.child(*a) + ':first-child' end",
"def text\n element.text\n end",
"def single_line_tag?(name) \n SINGLE_LINE_TAGS.include?(name.to_s)\n end",
"def first_element_child\n n = self.first_child\n while n do\n if n.node_type == ELEMENT_NODE then\n break\n end\n n = n.next_sibling\n end\n return n\n end",
"def text\n # .dup is required because the String is frozen.\n mark(@doc.text.first.dup)\n end",
"def first_title\n title.first\n end",
"def get_text_only(doc)\n text = StringIO.new\n if doc.kind_of?(Hpricot::Text)\n text.printf(\"%s\\n\", doc.to_s.strip) unless doc.to_s.strip.empty?\n else\n if doc.respond_to?(:children)\n doc.children.each do |child|\n text.printf(\" %s\", get_text_only(child))\n end\n end\n end\n text.string.strip\n end",
"def first_word\r\n text =~ /^.*?\\S.*?/\r\n $&\r\n end",
"def plain_text\n text ? text.gsub(/<[^>]+>/,' ').squeeze(' ').strip : nil\n end",
"def text?; mediatype == 'text' || child_of?('text/plain'); end",
"def abstract_tag(text); end",
"def last_text\n last_ele UIAStaticText\n end",
"def text\n @text ||= nokoxmlelement.inner_html\n end",
"def text\n text = @tag_data[:text]\n # convert_newlines_to_br\n text.gsub!(\"\\r\\n\", \"\\n\")\n text.gsub!(\"\\n\", \"\\n\")\n text\n end",
"def first_title\n max_level = 6 # any title with a higher level kicks the current one out\n title = false\n @blocks.each do |block|\n if block.is_a?(Prismic::Fragments::StructuredText::Block::Heading)\n if block.level < max_level\n title = block.text\n max_level = block.level # new maximum\n end\n end\n end\n title\n end",
"def search_tag(tag)\n search_text(tag.name)\n end",
"def link_text(tag)\n $2 if tag =~ link_regex\n end",
"def tag(selector)\n e = element(selector)\n e && e.inner_html\n end",
"def mainEntry\n tag_range(\"100\", \"1XX\").first\n end",
"def xpath_get_text(doc)\n if (doc and doc.has_text? == true)\n return doc.text\n else\n return \"\"\n end\n end",
"def extract_exceptional_element_text(file, name)\n DOMParserHelper.skip_ignore_chars(file)\n file.getc # drop >\n string = ''\n while (c = file.getc)\n if c == '<'\n cur_pos = file.pos\n if file.getc == '/' && name == DOMParserHelper.extract_string(file)\n DOMParserHelper.skip_ignore_chars(file)\n file.getc # drop >\n break\n end\n file.pos = cur_pos\n end\n string += c\n end\n return Text.new(string) unless string.empty?\n nil\n end",
"def full_text\n return self.text[:full_text]\n end",
"def get_text\n return self.text\n end",
"def tag(selector)\n\t\te = element(selector)\n\t\te && e.inner_html\n\tend"
] |
[
"0.72211885",
"0.71445173",
"0.6932663",
"0.6825029",
"0.6687706",
"0.65747035",
"0.65155643",
"0.64259815",
"0.6397045",
"0.63311565",
"0.62765795",
"0.6225",
"0.61543924",
"0.6124014",
"0.60766304",
"0.60634404",
"0.59838337",
"0.59777766",
"0.59717375",
"0.5862769",
"0.5854892",
"0.5822578",
"0.57928383",
"0.5762581",
"0.57487434",
"0.57347405",
"0.56725216",
"0.5630772",
"0.5603655",
"0.56023836",
"0.5586424",
"0.5585221",
"0.5580653",
"0.55607164",
"0.5517862",
"0.55112916",
"0.55004704",
"0.55004704",
"0.549939",
"0.549939",
"0.5470402",
"0.54433054",
"0.54427695",
"0.54354113",
"0.5429217",
"0.5428383",
"0.542252",
"0.5410275",
"0.54008985",
"0.53893286",
"0.5368843",
"0.5344229",
"0.53306836",
"0.532433",
"0.52979326",
"0.5297722",
"0.52953",
"0.5293468",
"0.5288066",
"0.52767396",
"0.5267455",
"0.52564985",
"0.52411574",
"0.5236903",
"0.5222087",
"0.52215135",
"0.5214689",
"0.5210252",
"0.5209134",
"0.52037686",
"0.5202434",
"0.520238",
"0.5201371",
"0.51975775",
"0.5196502",
"0.5196502",
"0.51912254",
"0.51866955",
"0.5186688",
"0.5186621",
"0.51861674",
"0.5164521",
"0.51604694",
"0.5155555",
"0.51545537",
"0.51416117",
"0.513331",
"0.5126783",
"0.51093936",
"0.5106713",
"0.5106382",
"0.5105785",
"0.5104908",
"0.5099864",
"0.50971824",
"0.5092336",
"0.5080489",
"0.50784814",
"0.5078111",
"0.5076055"
] |
0.5918439
|
19
|
Get the tags that include text.
|
def find_eles_by_text_include tag, text
find_eles_by_attr_include tag, :text, text
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def tags\n match = /(.*?)[\\s\\u00A0]+\\[(?<tags>.*)\\]/.match(@node.inner_text)\n (match ? match[:tags] : '').split(' ')\n end",
"def tags_text\n\t\tself.tags.join(', ') #convertir el arreglo en una cadena de texto separado por ,\n\tend",
"def tag_text()\n return self.tag(true)\n end",
"def getTags node\n array = [] #array to hold working collection\n \n node.children.each do |child|\n array << Hash[child.name,child.inner_text] unless child.name == 'text' #text \n end\n \n return array\n end",
"def tags\n caption.to_s.scan(/#(\\w+)/).flatten\n end",
"def tags\n ['any'] + @tags\n end",
"def tags\n ['any'] + @tags\n end",
"def find_ele_by_text_include tag, text\n find_ele_by_attr_include tag, :text, text\n end",
"def tags_with_html_content\n [:description, :recommendation]\n end",
"def extract_tags\n extract_hashtags(content) do |tag|\n extracted_tag = Tag.find_or_create_by(name: tag.downcase)\n self.tags << extracted_tag unless tags.include? extracted_tag\n end\n end",
"def get_tags\n\t\t\ttaglist = read_command_output( 'hg', 'tags' )\n\t\t\treturn taglist.split( /\\n/ ).collect {|tag| tag[/^\\S+/] }\n\t\tend",
"def tags\n match = /(.*?)[\\s\\u00A0]+\\[(?<tags>.*)\\]/\n .match(@type_node.inner_text)\n return [] unless match\n match[:tags].split(' ')\n end",
"def available_values\n result = []\n for i in (0 .. @tag.length - 1)\n result << @tag[i].parent(\"p\").span.innerText.strip if @tag[i].parent(\"p\").span.exists\n end\n return result\n end",
"def quick_text_tags(text, ii, font_change)\n ret = text_tags(text, ii, font_change)\n [ret[0], ret[1], ret[2]]\n end",
"def text_tracks\n tracks.select { |t| t.text? }\n end",
"def text_tracks\n tracks.select { |t| t.text? }\n end",
"def existing_tags\n Notion.where(locale: @lecture.locale || I18n.default_locale)\n .pluck('title') & @content_descriptions\n end",
"def initialize(text, also_tagged_with=[], start_with=nil)\n chars = text.chars.to_a # Convert text into char\n\n if also_tagged_with.nil? || also_tagged_with.empty?\n # Populate the tag_set for the first char\n tag_set = Letter.where(:char => chars.shift).all_tags\n\n # Intersect tags_set with the remaining chars\n text.chars.each { |char|\n tag_set = tag_set & Letter.where(:char => char).all_tags\n }\n else\n # Populate the tag_set for the first char\n tag_set = Letter.where(:char => chars.shift).with_all_tags(also_tagged_with).all_tags\n\n # Intersect tags_set with the remaining chars\n text.chars.each { |char|\n tag_set = tag_set & Letter.where(:char => char).with_all_tags(also_tagged_with).all_tags\n }\n\n # Finally, filter any tags returned that are already in also_tagged_with\n tag_set.delete_if {|tag| also_tagged_with.include?(tag)}\n end\n\n # # Filter by start_with, if required\n if !start_with.nil? && !start_with.empty?\n tag_set.keep_if {|tag| tag.start_with?(start_with) }\n end\n\n @tags = tag_set\n end",
"def tags(name = nil)\n list = @tags + convert_ref_tags\n return list unless name\n list.select {|tag| tag.tag_name.to_s == name.to_s }\n end",
"def tags_above_threshold\n TextValue.all_tags.select { |tag| tag.tag_count >= Seek::Config.tag_threshold }\n end",
"def content_tags(name)\n array = []\n name_li(name).div(:class=>/(mylibrary_item_|searchcontent_result_)tags/).lis.each do |li|\n array << li.span(:class=>\"s3d-search-result-tag\").text\n end\n return array\n end",
"def tags_with_html_content\n [:details, :description, :detailed_information, :impact]\n end",
"def tags_with_html_content\n [:details, :description, :detailed_information, :impact]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n data[:tags]\n end",
"def tags\n return @tags\n end",
"def tags\n return @tags\n end",
"def tags\n return @tags\n end",
"def scan_tags\n self.content.scan(/#\\w+/).uniq\n end",
"def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end",
"def tags\n self.lib.tags.map { |r| tag(r) }\n end",
"def tagged\n taggings.collect(&:taggable)\n end",
"def texts(value = false)\n return tags static_text_class unless value\n\n if automation_name_is_xcuitest?\n visible_elements = tags static_text_class\n elements_include visible_elements, value\n else\n eles_by_json_visible_contains static_text_class, value\n end\n end",
"def filter_all(text)\n state = :copying\n result = []\n tagged_lines = []\n tag = args = nil\n text.split(/\\n/).each do |line|\n case state\n when :copying\n if line =~ inline_tag\n tag = $1\n args = $2.strip\n state = :inside_tag\n elsif line =~ single_tag\n tag = $1\n args = $2.strip\n result << @filters[tag.to_sym].filter_single(args)\n else\n result << line\n end\n when :inside_tag\n # :endinlinewhatever, :endwhatever or just plain :end\n if line =~ /^:end(inline#{tag}|#{tag})?(\\s.*)?$/\n result << @filters[tag.to_sym].filter_inline(tagged_lines.join(\"\\n\"),args)\n tagged_lines = []\n state = :copying\n else\n tagged_lines << line\n end\n end\n end\n\n result.join(\"\\n\")\n end",
"def texts(value = false)\n return tags TEXT_VIEW unless value\n\n complex_finds_contains TEXT_VIEW, value\n end",
"def available_tags\n available_tags = []\n Tag.all.each do |t|\n available_tags << t.name\n end\n\n tags = []\n self.tags.each do |t|\n tags << t.name\n end\n\n available_tags - tags\n end",
"def find_tagged_objs_with(phrase)\n tag = Tag.find_by(name: phrase)\n return if tag.nil?\n\n Tagging.where(tagger: self, tag: tag).map{|tagging| tagging.tagged_obj}\n end",
"def tags\n result = (@added_tags || Set.new)\n if description\n result |= description.tags.to_set\n end\n result\n end",
"def tags\n @note.tagNames\n end",
"def additional_tags\n return @additional_tags\n end",
"def tags\n @data['tags']\n end",
"def filter_tags(document)\n # Filter down and get the tags.\n @tags = document.css(TAG_CSS).map(&:children).map(&:text)\n end",
"def tags\n article_tags = data.tags || data.tag\n \n if article_tags.is_a? String\n article_tags.split(',').map(&:strip)\n else\n Array(article_tags).map(&:to_s)\n end \n end",
"def tags\n usertags = []\n proposals.each do |proposal|\n usertags << proposal.tags.map(&:name) unless usertags.include?(proposal.tags.map(&:name))\n end\n remove_duplicates(usertags.flatten)\n end",
"def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"def all_tags\n self.tags.map(&:name).join(\", \")\n end",
"def tags\r\n return @tags if @tags\r\n\r\n if @options.has_key? :only\r\n @tags = convert_methods(@options[:only])\r\n elsif @options.has_key? :except\r\n @tags = @@tag_titles.keys - convert_methods(@options[:except])\r\n else\r\n @tags = @@tag_titles.keys\r\n end\r\n\r\n @tags\r\n end",
"def collect_tags_indeed(text_to_scan, offer_object)\n puts \"Mining tags from posting\"\n tags = Tag.all.map(&:name)\n tags.each do |tag|\n offer_object[:tags] << tag if text_to_scan.include?(tag)\n end\n end",
"def tags_raw\n self.tags.join(\"\\n\") unless self.tags.nil?\n end",
"def tags\n node.css(\"category\").map(&:text)\n end",
"def tags\n @tags ||= tags_from_collection.merge(tags_from_item).values.select(&:release)\n end",
"def find_all_tagged_with(*args)\n find_tagged_with(*args)\n end",
"def tags\n css_selectors = [\n '.watch-info-tag-list a', # YouTube\n '.entry .tags a', # Livejournal\n 'a[rel~=tag]', # Wordpress and many others\n 'a.tag', # Tumblr\n '.tags a',\n '.labels a',\n '.categories a',\n '.topics a'\n ]\n\n tags = []\n\n # grab the first one we get results from\n css_selectors.each do |css_selector|\n tags += @doc.css(css_selector)\n break if tags.any?\n end\n\n # convert from Nokogiri Element objects to strings\n tags.map!(&:inner_text)\n\n # remove \"#\" from hashtag-like tags\n tags.map! { |t| t.gsub(/^#/, '') }\n\n tags\n end",
"def find_tags(url)\n\t\t\tputs \"Search and return tags within the url payload: #{url}\" if @verbose\n\t\t\ttag_list = []\n doc = open_page(url)\n doc.text.each_line do |line|\n my_line = line.downcase\n @tag_signatures.keys.map do |tag|\n tag_list.push(tag) if my_line.include?(tag)\n end\n end\n return tag_list\n rescue => ee\n puts \"Exception on method #{__method__}: #{ee}\" if @verbose\n return []\n end",
"def extractTags()\n line = @lines[@currentLine]\n re = /\\[([^\\[]+)\\]/m\n while line =~ re\n @currentBlock.addTag($~[1])\n line = line.sub(re, '')\n end\n end",
"def tags\n records.each do |record|\n KEYWORDS_TAGGER.each do |name, keywords|\n record[name] = keywords.find {|keyword| record[:text].include?(keyword) }\n end\n end\n end",
"def show_tags\n tag_list = \"\"\n self.tags.each do |t|\n tag_list << \"#{t.name} \"\n end\n tag_list\n end",
"def tags\n @fields.tag_list\n end",
"def find_tagged_with(*args)\n options = find_options_for_find_tagged_with(*args)\n options.blank? ? [] : find(:all, options)\n end",
"def tags\n @obj['tags']\n end",
"def list_of_tags\n tag_list\n end",
"def all_tags\n tags.map(&:title).join(\", \")\n end",
"def text\n @filtered_text\n end",
"def return_all_tags\n @tags.uniq.each { |tag| puts tag }\n end",
"def included_tag_names\n parsed_included_tags[:missing]\n end",
"def tags_raw\n tags.join(\"\\n\") unless tags.nil?\n end",
"def retrieve_tags\n # noop\n end",
"def tagged_with(_tags)\n _tags = convert_string_tags_to_array(_tags) if _tags.is_a? String\n criteria.all_in(tags_field => _tags)\n end",
"def tags\n attributes[:tags] || []\n end",
"def getTags\r\n\t\t\t\t\treturn @tags\r\n\t\t\t\tend",
"def tagged (phrase, tags, ignore = [], insensitive = true, exact = true)\n\t# make sure insensitive\n\tif insensitive\n\t\tignore = ignore.map(&:downcase)\n\tend\n\t# p.o.s. are always upcase, just to make sure\n\ttags = correct_tags(tags) #what was the ruby way to call a functioin in place? !\n\tphrase.each_entity do |sub|\n\t\tif tags.include? sub.tag\n\t\t\tif insensitive\n\t\t\t\tif !in_arr?(ignore, sub.to_s.downcase, exact)\n\t\t\t\t\treturn sub\n\t\t\t\tend\n\t\t\telsif !in_arr?(ignore, sub, exact)\n\t\t\t\t\treturn sub\n\t\t\tend\n\t\tend\n\tend\n\treturn nil\nend",
"def local_tags\n @local.tags\n end",
"def tags\n response[\"tags\"]\n end",
"def tag_list\n tags.map{ |tag| tag.name }.reject(&:empty?).join(\" \")\n end",
"def tags\n object.tags.each do |tag|\n tag.name\n end\n end",
"def tags() ; info[:tags] ; end",
"def tags() ; info[:tags] ; end",
"def all_tags\n applied_tags + @tags\n end",
"def all_tags\n applied_tags + @tags\n end",
"def tagged_by(keyword)\n self.tags.collect { |t| t.keyword }.include?(keyword)\n end",
"def section_tags(section, cat = nil)\n\n taglist = section.articles.map{|article| article.tags}.flatten.uniq.sort\n \n if cat != nil\n re = Regexp.new(cat)\n returnlist = []\n taglist.each do |tag|\n if tag =~ re\n returnlist << tag\n end\n end\n else\n returnlist = taglist\n end\n returnlist\n end",
"def get_tags(feature)\n tags = []\n feature.custom_fields.each { |field| tags = field.value if field.name = 'Tag' }\n tags\n end",
"def all_tags\n each_with_object([]) do |entry, tags|\n tags.concat(entry.tags).sort!.uniq!\n end\n end",
"def tagsFor(user)\n if user.nil?\n []\n else\n tags.select{|x| x.user_id == user.id}\n end\n end",
"def all_tags\n all_tags = []\n meanings.each do |meaning_hash|\n if meaning_hash.tags.size > 0\n all_tags << meaning_hash.tags\n end\n end\n return all_tags.flatten\n end",
"def text\n @tag_data[:text]\n end",
"def tags\n\t\tt = read_attribute(:tags)\n\t\tt.nil? ? \"\" : t.join(', ')\n\tend",
"def tags\n tags = nil\n\n # Jekyll v3 has it in data, while v2 have it at the root\n if @file.data.key?('tags')\n tags = @file.data['tags']\n elsif @file.respond_to? :tags\n tags = @file.tags\n end\n\n return tags if tags.nil?\n\n # Anyway, we force cast it to string as some plugins will extend the tags to\n # full featured objects\n tags.map(&:to_s)\n end",
"def parsed_included_tags\n @parsed_included_tags ||= parse_named_tags(\n %i[fandom_names character_names relationship_names freeform_names\n other_tag_names]\n )\n end",
"def all_tags(test_case)\n test_case.tags + test_case.feature.tags\n end",
"def find_tagged_with(*args)\n options = find_options_for_find_tagged_with(*args)\n options.blank? ? [] : find(:all, options)\n end",
"def texts(value = false)\n return tags UIAStaticText unless value\n eles_by_json_visible_contains UIAStaticText, value\n end",
"def find_tagged_with(*args)\n options = find_options_for_find_tagged_with(*args)\n if options.blank?\n []\n else\n select(options[:select]).joins(options[:joins]).where(options[:conditions])\n end\n end",
"def tags1\n return projects_tags.where(\"tags_id in (select id from tags where type_tag=?)\",1)\n end",
"def tags() []; end",
"def tag_names\n self.tags.map{ |t| t.name }.join(\", \")\n end"
] |
[
"0.657787",
"0.65037596",
"0.6485775",
"0.64538753",
"0.63499254",
"0.6272897",
"0.6272897",
"0.62509525",
"0.6248749",
"0.6226198",
"0.61261743",
"0.6117033",
"0.6094158",
"0.6089709",
"0.60851574",
"0.60851574",
"0.60767037",
"0.6075089",
"0.60611975",
"0.60126996",
"0.6000038",
"0.59975636",
"0.59975636",
"0.5984185",
"0.5984185",
"0.5984185",
"0.5984185",
"0.5984185",
"0.59734493",
"0.59734493",
"0.59734493",
"0.5965827",
"0.5960303",
"0.59288263",
"0.5907009",
"0.58692694",
"0.5868906",
"0.58516943",
"0.58506984",
"0.58491564",
"0.58371425",
"0.5830272",
"0.58236516",
"0.58143765",
"0.58137596",
"0.57856774",
"0.57528335",
"0.5750434",
"0.5750434",
"0.5750434",
"0.57479316",
"0.57453907",
"0.5744821",
"0.5744777",
"0.5738993",
"0.5727036",
"0.57230884",
"0.57207716",
"0.5713921",
"0.5708474",
"0.56999505",
"0.5686348",
"0.5685787",
"0.56826603",
"0.5682291",
"0.56798553",
"0.56789595",
"0.56765866",
"0.5674078",
"0.5672254",
"0.56688845",
"0.5666322",
"0.56580484",
"0.5648231",
"0.5646591",
"0.5642026",
"0.56323224",
"0.5630408",
"0.5629665",
"0.56222165",
"0.56222165",
"0.56084096",
"0.56084096",
"0.5603484",
"0.5600371",
"0.5596269",
"0.5592457",
"0.5587833",
"0.5586028",
"0.5584184",
"0.5582008",
"0.55767787",
"0.5576407",
"0.5570337",
"0.5567666",
"0.55450374",
"0.5542546",
"0.55375034",
"0.5536636",
"0.5535187"
] |
0.6543037
|
1
|
Get the first tag that matches tag_name
|
def first_ele tag_name
# XPath index starts at 1
find_element :xpath, "//#{tag_name}[1]"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_tag(tag_name)\n r = scan(/\\<#{tag_name}\\>(.*?)\\<\\/#{tag_name}\\>/im)\n r.map{|e|e.first}\n end",
"def first_matching_tag\n r = Registry.get\n return unless r\n\n RegistryEvent.all.find_each do |event|\n data = JSON.parse(event.data)\n _, _, tag_name = r.get_namespace_from_event(data)\n return event.dup if tag_name == @tag\n end\n\n nil\n end",
"def tag tag_name\n find_element :tag_name, tag_name\n end",
"def extract_tag_name(tag)\n match = /\\A<\\/?(#{@@name})/.match(tag)\n return match[1] if match\n raise \"Cannot find tag name in tag: #{tag}\"\n end",
"def find_name_tag(tags)\n name_tag = tags.find { |tag| tag[:key] == \"Name\" }\n name_tag ? name_tag[:value] : nil\n end",
"def get_tag_by_name(name)\n @aws_instance_data.tags.each do |tag_data|\n return tag_data.value if tag_data.key == name\n end\n nil\n end",
"def lookup_tag(name, parent_path)\n\t\t\tif @tags.key? name\n\t\t\t\treturn @tags[name]\n\t\t\tend\n\t\t\t\n\t\t\treturn fetch_tag(name, parent_path)\n\t\tend",
"def find_tag(t)\n r = nil\n if @tag == t\n r = self\n elsif\n begin\n each do |it|\n r = it.find_tag(t)\n break if r\n end\n rescue\n end\n end\n return r\n end",
"def primary_tag\n tag = @primary_tag || my_tag_list.first\n\n if tag == NO_PRIMARY_TAG\n nil\n else\n tag\n end\n end",
"def first_ele(class_name)\n tag(class_name)\n end",
"def find(name)\n m = match(name)\n m.count == 1 ? m[0] : nil\n end",
"def get_tag tag_key_name\n self.tags.joins(:tag_key).where('tagging_tag_keys.name = ?', tag_key_name).first\n end",
"def getName(tags)\n name_tag = tags.find { |tag| tag.key == \"Name\" }\n name_tag ? name_tag.value : nil\nend",
"def tags tag_name\n find_elements :tag_name, tag_name\n end",
"def tag(name)\n tags[name.to_s] if tags\n end",
"def first(name=nil)\n name.nil? ? matches.first : find(name, false).first\n end",
"def parse_tag_name( tag )\n match_name = /[^=]*/\n m = tag.match(match_name)\n return m[0]\n end",
"def match_tag_name(name)\n\n name.sub!(/^c:/, '')\n\n matches = []\n\n Conf.curation_types.each do |type|\n matches.push type if type.starts_with?(name)\n end\n\n return matches[0] if matches.length == 1\n end",
"def parse_tag_with_name(tag_name, text); end",
"def tag_name\n @tag_name ||= name && name.to_s.split(\"::\")[-1].downcase\n end",
"def extract_name_tag(tags)\n # Find the 'Name' key in the tags object and extract it. If the key isn't found, we get nil instead.\n name_tag = tags.find { |tag| tag.key == 'Name' }\n # If extracting the key/value was successful...\n if name_tag\n # ...extract the value (if there is one), or return <no name>\n !name_tag[:value].empty? ? name_tag[:value] : '<no name>'\n else\n # Otherwise, there's not a Name key, and thus the object has no name.\n '<no name>'\n end\n end",
"def find_by_name(name, field = :name)\n Tag.find_by_name(name.strip) || (fail BadRequestError.resource_not_found(field), \"Tag not found.\")\n end",
"def first_value(tag)\n tag_summary(tag).first[1].first\n end",
"def lookup(name, *tags)\n xpath(tags.map{ |tag| \"./xs:#{tag}[@name='#{name}']\" }.join('|'))[0]\n end",
"def getTag(tagString)\n retval = \"other\"\n tags = [\"programming\",\"travel\",\"other\"]\n tags.each do |tag|\n if tagString.downcase.match(/#{tag.downcase}/)\n retval = tag\n end\n end\n retval\n end",
"def find_first(name)\n find_all(name).first\n end",
"def find_by_tag(tag, single = true, &block)\n find_matching(:tag, tag, single, block)\n end",
"def tag_name\n self.class.name.downcase.match(/[^:]+$/)[0]\n end",
"def tag_name\n return @tag_name\n end",
"def get_from_tags(resource, tag_name)\n tag_name = tag_name.to_s.downcase\n tags = resource['tags'].to_a.concat(resource['tag_set'].to_a)\n Array.wrap(tags).detect { |tag, _| tag['key'].downcase == tag_name }.try(:[], 'value').presence\n end",
"def get_tag_name(element)\n element.tag_name\n end",
"def find_or_add\n if name\n n = name.strip.downcase\n tag = Tag.find_by(name: n) || Tag.create(name: n)\n end\n end",
"def htmlGetTagContents(html, tagName)\n html.split(\"<#{tagName}>\")[1].split(\"</#{tagName}>\")[0]\nend",
"def get_tag(tag_name)\n tag = USER_TAGS[tag_name: tag_name]\n return nil if tag == nil\n\n # create tag\n return UserTag.new(tag)\n end",
"def name\n tag.name\n end",
"def [](tag)\n find { |f| f.tag == tag }\n end",
"def first_with_tag(phrase, opts={})\n lo = opts.clone\n case_sensitive = lo.delete :case_sensitive\n phrase = phrase.downcase unless case_sensitive\n first(lo.merge(:tag_words => phrase))\n end",
"def first_ele(class_name)\n ele_index class_name, 1\n end",
"def tag\n return @tag\n end",
"def tag\n Tag.find(tag_id)\n end",
"def to_obj(tag_name)\n @tags.each do |tag|\n if tag_name == tag.name\n Log4r::Logger.log_internal { \"Get tag: #{tag_name}\" }\n return tag\n end\n end\n nil\n end",
"def get_tag(tag_class); end",
"def search_tag(tag)\n search_text(tag.name)\n end",
"def my_node_tagged(tag, options={})\n my_nodes_tagged(tag, options)[0]\n end",
"def my_node_tagged(tag, options={})\n my_nodes_tagged(tag, options)[0]\n end",
"def find( tag = nil )\n tag = Tag.new( tag, Tag.WILDCARD_NS ) unless tag.nil? || tag.is_a?( Tag )\n if block_given?\n children.find do |c|\n c.element? && ( tag.nil? || c.tag == tag ) && yield( c )\n end\n else\n first_element( tag )\n end\n end",
"def tag(name); end",
"def select_tag_info(tag_id)\n return get_db_as_hash().execute(\"SELECT tag_name FROM tags WHERE tag_id = ?\", tag_id).first\n end",
"def get_tag_from_label(tag_label, reload = false)\n tag_label = DomainEnumerated.standardize_tag(tag_label)\n tag_id, tag = get_hash_tags(reload).detect { |id, tag| tag.label == tag_label }\n tag\n end",
"def tagname\n @tagname.id2name\n end",
"def tag\n @model.tag.name if @model.tag\n end",
"def node_tagged(tag, options={})\n nodes_tagged(tag, options)[0]\n end",
"def node_tagged(tag, options={})\n nodes_tagged(tag, options)[0]\n end",
"def find_tags_by_name(tag)\n ActsAsTaggableOn::Tag.includes(:taggings).where(\"taggings.context = 'tags'\").order(\"name ASC\").named_like(tag).limit(10) unless tag.blank?\n end",
"def find_with_tag(phrase, opts={})\n phrase = phrase.downcase unless opts[:case_sensitive] == true\n first(:tag_words => phrase)\n end",
"def get_tag_value tag_key_name\n tag = self.tags.joins(:tag_key).where('tagging_tag_keys.name = ?', tag_key_name).includes(:tag_value).first\n tag.try(:tag_value).try(:value)\n end",
"def _tag_name\n @tag_name\n end",
"def has_tag?(name); end",
"def get_document_tag(tagname, from: nil)\n from ||= @prepared_doc\n from.match(%r{<#{tagname}>(.*)</#{tagname}>})[1]\n end",
"def first_subfield_value(tag)\n sf = @field.subfields.select { |sf| sf.code == tag}\n return '' if sf.empty?\n sf.first.value\n end",
"def tag\n `#{@el}.tagName`.downcase\n end",
"def tag\n `#{@el}.tagName`.downcase\n end",
"def element_named(name)\n @elements.find{|e| e.name.to_s == name.to_s}\n end",
"def find_name name\n find_element :name, name\n end",
"def single(name)\n els = @root.xpath(\"meta/#{name}[@meta='yes']\")\n els.length <= 1 or puts(\"Warning: multiple #{name.inspect} elements found.\")\n return els[0] ? els[0].content : nil\n end",
"def tag\n @tag ||= page.tags(true).detect{|t| t.is_cms_block? && t.identifier == identifier}\n end",
"def seek_to_tag(xml, tag_name)\n ret = true\n while ret==true && !is_a(xml, tag_name)\n ret = xml.read\n end\n ret\nend",
"def tag\n try_opt(:tag)\n end",
"def tag(tag); end",
"def tag(tag); end",
"def find_first(selector, data)\n data = @data unless data\n results = (data/selector)\n if results and results.first\n results.first.inner_html.strip\n else\n nil\n end\n end",
"def gettag()\n omnifocus.tags.get.each do |tagg|\n\t tagg.tags.get.each do |t|\n\t\t\t if t.name.get == \"Today\" \n\t\t\t\t return t\n\t\t\t end\n\t\t end \n\n end\n\n end",
"def name\n _name = nil\n self.tags.each do |x|\n if x.tkey == \"name\"\n _name = x.tvalue\n end\n end\n _name\n end",
"def tag_name; end",
"def tag_name; end",
"def tag_name; end",
"def name\n tag['name'].gsub(/\\[\\]$/, '')\n end",
"def get_tagvalue(object, tagkey)\n value = \"\"\n if object[:tag_set]\n object[:tag_set].each do |tag|\n if tag[:key] == tagkey\n value = tag[:value]\n break\n end\n end\n end\n \n value\n end",
"def tag()\n return @driver.get_sc_core_query_element_tag(@handle, @index)\n end",
"def find_tag_struct(t)\n p = find_tag(t)\n if(p)\n return p.parent_struct\n else\n return nil\n end\n end",
"def tag\n if @tag.is_a? String\n @tag\n end\n end",
"def matching_tag(tag)\n chars = tag.chars\n chars.delete_at(1)\n chars.join('')\n end",
"def tagname\n @node[0].gsub(/[^a-zA-Z]/, \"\")\n end",
"def tag_for_token token\n if (grammar_hash = @grammar[token.to_sym]).is_a?(Hash) &&\n (selector = grammar_hash[:in_css_match])\n selector.split('.').first.if_present\n end || Parser.tag_for_token(token)\n end",
"def tag(index=-1, tag=nil)\n (tok = @tokens[index]) && (tag ? tok[0] = tag : tok[0])\n end",
"def tag tag = nil\n @tag = tag if tag\n @tag\n end",
"def getTag\n\t\treturn @tag\n\tend",
"def get_token(tag, tokens)\n tokens.each do |key, value|\n if tag.index(key) != nil then\n return value\n end\n end\n\n return nil\n end",
"def element(name)\n elements.find { |el| el.name == name.to_s }\n end",
"def has_tag?(name)\n tags.any? {|tag| tag.tag_name.to_s == name.to_s }\n end",
"def element_name() @stag.element_name end",
"def tag(name)\n name.strip!\n tag = Tag.find_or_create_by(name: name)\n self.taggings.find_or_create_by(tag_id: tag.id)\n end",
"def tag_append_one(name)\n tag = Tag.find_or_create_by_name(name)\n tag.on(self) unless tags.include? tag\n end",
"def tag\n @tag\n end",
"def get_from_tags(resource, item)\n (resource['tags'] || []).detect { |tag, _| tag['key'].downcase == item.to_s.downcase }.try(:[], 'value')\n end",
"def get_node_by_name(str)\n self.each_node do |node|\n if get_node_name(node) == str\n return node\n end\n end\n nil\n end",
"def get_tag_value(key)\n get_tag(key).try(:tag_value).try(:value)\n end",
"def resolve_tag\n version = extract_version\n tag = Release.tag_name || version\n tag = tag.call(version) if Proc === tag\n tag\n end",
"def resolve_tag\n version = extract_version\n tag = Release.tag_name || version\n tag = tag.call(version) if Proc === tag\n tag\n end",
"def find_eles tag_name\n @driver.find_elements :tag_name, tag_name\n end"
] |
[
"0.7768406",
"0.71977824",
"0.70994776",
"0.7052776",
"0.69995296",
"0.6925509",
"0.67837703",
"0.67432266",
"0.67380065",
"0.6656003",
"0.6625299",
"0.66107965",
"0.6591622",
"0.6525326",
"0.6502466",
"0.6499222",
"0.64722955",
"0.6426107",
"0.6353026",
"0.6323054",
"0.63221335",
"0.63213956",
"0.63116354",
"0.6288403",
"0.628253",
"0.62684417",
"0.6202557",
"0.6194025",
"0.6154884",
"0.61468774",
"0.61450917",
"0.613381",
"0.6112114",
"0.60694665",
"0.6061816",
"0.60151887",
"0.60124326",
"0.59963745",
"0.5995897",
"0.59952456",
"0.59785944",
"0.5971277",
"0.59672403",
"0.5957735",
"0.5957735",
"0.59496623",
"0.59447473",
"0.5939264",
"0.5918717",
"0.59166133",
"0.5896535",
"0.5891194",
"0.5891194",
"0.5890724",
"0.5876179",
"0.5874147",
"0.586806",
"0.58528847",
"0.5837045",
"0.5816997",
"0.5812504",
"0.5812504",
"0.5800919",
"0.57946235",
"0.57928896",
"0.5779298",
"0.5734217",
"0.57334226",
"0.5725784",
"0.5725784",
"0.57248116",
"0.5719475",
"0.56881887",
"0.5685202",
"0.5685202",
"0.5685202",
"0.5636804",
"0.56310356",
"0.5619715",
"0.5609674",
"0.55970144",
"0.55938005",
"0.5588639",
"0.5586212",
"0.557423",
"0.557388",
"0.5571126",
"0.55701673",
"0.55582345",
"0.55534405",
"0.5549211",
"0.5546312",
"0.5544605",
"0.55400413",
"0.5528423",
"0.55173177",
"0.5504743",
"0.5498558",
"0.5498558",
"0.54886425"
] |
0.7253185
|
1
|
Get the last tag that matches tag_name
|
def last_ele tag_name
xpath "//#{tag_name}[last()]"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def extract_tag_name(tag)\n match = /\\A<\\/?(#{@@name})/.match(tag)\n return match[1] if match\n raise \"Cannot find tag name in tag: #{tag}\"\n end",
"def latest_tag\n\t\t# Index 0 is HEAD\n\t\t# Index 1 is most recent tag or first commit\n\t\t@list[1]\n\tend",
"def find_tag(tag_name)\n r = scan(/\\<#{tag_name}\\>(.*?)\\<\\/#{tag_name}\\>/im)\n r.map{|e|e.first}\n end",
"def tag tag_name\n find_element :tag_name, tag_name\n end",
"def first_matching_tag\n r = Registry.get\n return unless r\n\n RegistryEvent.all.find_each do |event|\n data = JSON.parse(event.data)\n _, _, tag_name = r.get_namespace_from_event(data)\n return event.dup if tag_name == @tag\n end\n\n nil\n end",
"def find_name_tag(tags)\n name_tag = tags.find { |tag| tag[:key] == \"Name\" }\n name_tag ? name_tag[:value] : nil\n end",
"def find_tag(t)\n r = nil\n if @tag == t\n r = self\n elsif\n begin\n each do |it|\n r = it.find_tag(t)\n break if r\n end\n rescue\n end\n end\n return r\n end",
"def get_tag_by_name(name)\n @aws_instance_data.tags.each do |tag_data|\n return tag_data.value if tag_data.key == name\n end\n nil\n end",
"def tag_name\n @tag_name ||= name && name.to_s.split(\"::\")[-1].downcase\n end",
"def tags tag_name\n find_elements :tag_name, tag_name\n end",
"def last_ele(class_name)\n ele_index class_name, 'last()'\n end",
"def last_ele(class_name)\n ele_index class_name, 'last()'\n end",
"def tag_data\n\t\treturn @tag_data.last\n\tend",
"def tag_end name\n end",
"def getName(tags)\n name_tag = tags.find { |tag| tag.key == \"Name\" }\n name_tag ? name_tag.value : nil\nend",
"def tag_end(name)\r\n #puts \"</#{name}>\"\r\n # Do nothing unless we're currently working on a <packet> element or one of its children\r\n return unless @element_stack.length > 0\r\n\r\n # This should match the element on the top of the stack\r\n elem = @element_stack.pop\r\n\r\n if elem.name != name\r\n raise ArgumentError, \"End tag #{name} doesn't match most recent element, #{elem.name}\"\r\n end\r\n\r\n if name == \"packet\"\r\n # A packet is done\r\n changed(true)\r\n notify_observers(elem)\r\n @element_stack = []\r\n end\r\n end",
"def lookup_tag(name, parent_path)\n\t\t\tif @tags.key? name\n\t\t\t\treturn @tags[name]\n\t\t\tend\n\t\t\t\n\t\t\treturn fetch_tag(name, parent_path)\n\t\tend",
"def tag_name\n return @tag_name\n end",
"def get_tag tag_key_name\n self.tags.joins(:tag_key).where('tagging_tag_keys.name = ?', tag_key_name).first\n end",
"def node_pop( name )\n return name.split(\".\")[1]\n end",
"def handle_close_tag(tag, open_tags)\n if open_tags.last == tag\n open_tags.pop\n else\n puts \"Error: closing tag #{open_tags.first} expected but found #{tag}\"\n exit 1\n end\n return open_tags\n end",
"def extract_name_tag(tags)\n # Find the 'Name' key in the tags object and extract it. If the key isn't found, we get nil instead.\n name_tag = tags.find { |tag| tag.key == 'Name' }\n # If extracting the key/value was successful...\n if name_tag\n # ...extract the value (if there is one), or return <no name>\n !name_tag[:value].empty? ? name_tag[:value] : '<no name>'\n else\n # Otherwise, there's not a Name key, and thus the object has no name.\n '<no name>'\n end\n end",
"def parent_tag\n return nil unless within_open_tag?\n\n @tags_list.last\n end",
"def tag_end(name)\n name.\n sub!(/^bel:/, '').\n gsub!(/([A-Z])/) { |match| \"_#{match.downcase}\" }\n\n end_method = \"end_#{name}\"\n if self.respond_to? end_method\n self.send end_method\n end\n end",
"def tag_end(name)\n name.\n sub!(/^bel:/, '').\n gsub!(/([A-Z])/) { |match| \"_#{match.downcase}\" }\n\n end_method = \"end_#{name}\"\n if self.respond_to? end_method\n self.send end_method\n end\n end",
"def getTag(tagString)\n retval = \"other\"\n tags = [\"programming\",\"travel\",\"other\"]\n tags.each do |tag|\n if tagString.downcase.match(/#{tag.downcase}/)\n retval = tag\n end\n end\n retval\n end",
"def latest_tag\n unless (fact_from_file = fetch_fact_from_file(__method__)).nil?\n return fact_from_file\n end\n\n `git -c versionsort.prereleaseSuffix=rc tag -l '#{Info.tag_match_pattern}' --sort=-v:refname | head -1`.chomp\n end",
"def tag_name\n self.class.name.downcase.match(/[^:]+$/)[0]\n end",
"def getLatestTag\n tagged_commits = @gop.tags\n harray = Array.new(tagged_commits)\n all_array = []\n harray.each do |item|\n all_array = all_array.push(@gop.describe(item, :abbrev => 0, :tags => true).slice!(1..-1))\n end\n\n all_array = all_array.sort_by(&Gem::Version.method(:new))\n\n return \"v#{all_array[-1]}\"\n end",
"def get_tag_name(element)\n element.tag_name\n end",
"def matching_tag(tag)\n chars = tag.chars\n chars.delete_at(1)\n chars.join('')\n end",
"def parse_tag_name( tag )\n match_name = /[^=]*/\n m = tag.match(match_name)\n return m[0]\n end",
"def get_latest_release_tag\n\trooturl = get_svn_repo_root()\n\treleaseurl = rooturl + \"/#{SVN_RELEASES_DIR}\"\n\t\n\ttags = svn_ls( releaseurl ).grep( RELEASE_VERSION_PATTERN ).sort_by do |tag|\n\t\ttag[RELEASE_VERSION_PATTERN].split('.').collect {|i| Integer(i) }\n\tend\n\treturn nil if tags.empty?\n\n\treturn releaseurl + '/' + tags.last\nend",
"def latest_tag_pipeline(proj, pipelines)\n begin\n tags = g.tags(proj.id)\n latest_tag = tags.first.name\n pipelines.select {|p| p.ref == latest_tag}.first\n rescue\n nil\n end\nend",
"def get_last_release\n r = api_get(\"/releases\")\n\n return r[0]['tag_name']\nend",
"def tag_append_one(name)\n tag = Tag.find_or_create_by_name(name)\n tag.on(self) unless tags.include? tag\n end",
"def tag\n return @tag\n end",
"def close_tag(name)\n \"</#{name}>\"\n end",
"def gettag()\n omnifocus.tags.get.each do |tagg|\n\t tagg.tags.get.each do |t|\n\t\t\t if t.name.get == \"Today\" \n\t\t\t\t return t\n\t\t\t end\n\t\t end \n\n end\n\n end",
"def name\n tag.name\n end",
"def name\n tag['name'].gsub(/\\[\\]$/, '')\n end",
"def tag_end(name)\n case name\n when \"key\"\n @last_key = @text\n when \"string\"\n @cur_snippet[@last_key] = @text\n end\n end",
"def close_tag(name)\n \"</#{name}>\"\n end",
"def _close_tag(name)\n @opened_tags.pop\n @level -= 1\n _indent\n _end_tag(name)\n _newline\n end",
"def tag_list_next_at(index)\n @tags ||= []\n\n if index < @tags.size\n return @tags[index]\n elsif @next_tag_uri == nil\n # We're at the end of the list and there's nothing left to fetc\n return nil\n else\n tag_list_fetch_next\n\n # Try again\n return tag_list_next_at(index)\n end\n end",
"def tag(name)\n tags[name.to_s] if tags\n end",
"def tagname\n @tagname.id2name\n end",
"def to_obj(tag_name)\n @tags.each do |tag|\n if tag_name == tag.name\n Log4r::Logger.log_internal { \"Get tag: #{tag_name}\" }\n return tag\n end\n end\n nil\n end",
"def _tag_name\n @tag_name\n end",
"def name\n _name = nil\n self.tags.each do |x|\n if x.tkey == \"name\"\n _name = x.tvalue\n end\n end\n _name\n end",
"def htmlGetTagContents(html, tagName)\n html.split(\"<#{tagName}>\")[1].split(\"</#{tagName}>\")[0]\nend",
"def tag_end name\n case name\n when 'person'\n @persons << @current_person\n @current_person = nil\n end\n end",
"def latest_stable_tag\n tags = `git tag`.strip.split(\"\\n\").map do |v|\n begin\n Semantic::Version.new(v)\n rescue ArgumentError\n nil\n end\n end.compact.sort.reverse\n (tags.find {|t| !t.pre} || tags.first).to_s\n end",
"def fetch_latest_tag(version_prefix = 'v')\n version_array = fetch_tags(\"-l \\\"#{version_prefix}*\\\" --sort=-#{version_prefix}:refname\")\n return version_array[0] unless version_array.length < 1\n # raise error if empty\n raise ImqsGitError, \"No tags were found for prefix#{version_prefix}\"\n end",
"def parse_tag_with_name(tag_name, text); end",
"def close_tag(tag_name)\n @indentation -= SPACES_PER_INDENT\n indent()\n\n output.concat(\"</#{tag_name}>\")\n\n if newliney(tag_name)\n _newline\n end\n end",
"def tag_name; end",
"def tag_name; end",
"def tag_name; end",
"def get_tag\n puts profile_parser(options.pattern, 0).last\n end",
"def latest_tag\n releases_url = 'https://github.com/david942j/one_gadget/releases/latest'\n @latest_tag ||= url_request(releases_url).split('/').last\n end",
"def get_latest_svn_timestamp_tag\n\trooturl = get_svn_repo_root()\n\ttagsurl = rooturl + \"/#{SVN_TAGS_DIR}\"\n\t\n\ttags = svn_ls( tagsurl ).grep( TAG_TIMESTAMP_PATTERN ).sort\n\treturn nil if tags.nil? || tags.empty?\n\treturn tagsurl + '/' + tags.last\nend",
"def get_tag(tag_class); end",
"def find_tag_struct(t)\n p = find_tag(t)\n if(p)\n return p.parent_struct\n else\n return nil\n end\n end",
"def match_tag_name(name)\n\n name.sub!(/^c:/, '')\n\n matches = []\n\n Conf.curation_types.each do |type|\n matches.push type if type.starts_with?(name)\n end\n\n return matches[0] if matches.length == 1\n end",
"def find_tags_by_name(tag)\n ActsAsTaggableOn::Tag.includes(:taggings).where(\"taggings.context = 'tags'\").order(\"name ASC\").named_like(tag).limit(10) unless tag.blank?\n end",
"def find_or_add\n if name\n n = name.strip.downcase\n tag = Tag.find_by(name: n) || Tag.create(name: n)\n end\n end",
"def getPastGitTag(back = 1)\n remote = getMainGitRemote\n tags = sh(\"git ls-remote --tags --quiet #{remote} | cut -d '/' -f3\", log: false).split\n semver_tags = tags.grep(/^[0-9]+.[0-9]+.[0-9]+$/) # only keep semver tags\n sorted_semver_tags = semver_tags.sort_by { |tag| Gem::Version.new(tag) }.reverse # sort by semver\n return sorted_semver_tags[back - 1]\nend",
"def get_tag_from_label(tag_label, reload = false)\n tag_label = DomainEnumerated.standardize_tag(tag_label)\n tag_id, tag = get_hash_tags(reload).detect { |id, tag| tag.label == tag_label }\n tag\n end",
"def tag_with_highest_count\n Tag.order(count: :desc).first\n end",
"def next_branch_tag\n @last_branch_tag.succ!\n end",
"def tag(name); end",
"def tag\n @model.tag.name if @model.tag\n end",
"def last_term\n entry = entries.last\n entry ? entry.term : nil\n end",
"def tag\n tags.to_s.split(/\\s*,\\s*/).uniq\n end",
"def last *a; self.child(*a) + ':last-child' end",
"def find(name)\n m = match(name)\n m.count == 1 ? m[0] : nil\n end",
"def tag_name_for_complete(tag, stag)\n tag.sub(/(#{Regexp.escape(stag)})/i, '<strong>\\1</strong>')\n end",
"def tagname\n @node[0].gsub(/[^a-zA-Z]/, \"\")\n end",
"def tag_end(name)\n if name == 'Bucket'\n @entries << @curr_bucket\n elsif name == 'Name'\n @curr_bucket.name = @curr_text\n elsif name == 'CreationDate'\n @curr_bucket.creation_date = @curr_text\n end\n @curr_text = ''\n end",
"def previous_snapshot(snapname)\n prev = nil\n tags.each do |tag|\n if tag == snapname\n return prev\n else\n prev = tag\n end\n end\n raise 'Snapshot not found'\n end",
"def tag_for_token token\n if (grammar_hash = @grammar[token.to_sym]).is_a?(Hash) &&\n (selector = grammar_hash[:in_css_match])\n selector.split('.').first.if_present\n end || Parser.tag_for_token(token)\n end",
"def last_textfield\n xpath 'textfield[last()]'\n end",
"def get_token(tag, tokens)\n tokens.each do |key, value|\n if tag.index(key) != nil then\n return value\n end\n end\n\n return nil\n end",
"def handle_close_tag(tag, values, open_tags)\n if open_tags.last == tag\n open_tags.pop\n values = handle_add_to_top_open_tag(get_tag(tag), open_tags, values)\n else\n puts \"Error: closing tag #{open_tags.first} expected but found #{tag}\"\n exit 1\n end\n return values, open_tags\n end",
"def last_element_child\n n = self.last_child\n while n do\n if n.node_type == ELEMENT_NODE then\n break\n end\n n = n.previous_sibling\n end\n return n\n end",
"def find_latest_gem(gem_name)\n the_gem = Dir.glob(\"#{Gem.dir}/gems/#{gem_name}-*\")\n\n the_gem.empty? ? nil : the_gem.sort.last\n end",
"def get_by_tag(tag)\n get_data(\"tag/#{tag}/new\")\n end",
"def tag_list_name\n self.tag_list if tag_list\n end",
"def get_tag_value tag_key_name\n tag = self.tags.joins(:tag_key).where('tagging_tag_keys.name = ?', tag_key_name).includes(:tag_value).first\n tag.try(:tag_value).try(:value)\n end",
"def find_previous(xml, leaf_name, order)\n order.reduce(nil) do |res, curr_name|\n break res if curr_name == leaf_name\n xml.at(curr_name.include?(':') ? \"./#{curr_name}\" : \"./xmlns:#{curr_name}\") || res\n end\n end",
"def tag\n old_word.tag\n end",
"def closing tag\n \"</#{tag}>\"\n end",
"def getTag\n\t\treturn @tag\n\tend",
"def first_ele tag_name\n # XPath index starts at 1\n find_element :xpath, \"//#{tag_name}[1]\"\n end",
"def remove_tag(name)\n name = info.tag_name(name) if name.is_a?(Symbol)\n\n info.rawtags.each_key do |tag|\n info.raw.comment_del(tag.to_s) if tag.casecmp(name.to_s).zero?\n end\n end",
"def tag_name\n ''\n end",
"def get_tagvalue(object, tagkey)\n value = \"\"\n if object[:tag_set]\n object[:tag_set].each do |tag|\n if tag[:key] == tagkey\n value = tag[:value]\n break\n end\n end\n end\n \n value\n end",
"def end(name)\n stack(name).pop\n end",
"def other_type_tag_name\n other_type_tag.nil? ? '' : other_type_tag.name\n end"
] |
[
"0.6639427",
"0.6415569",
"0.63674664",
"0.6169347",
"0.6125255",
"0.61207145",
"0.6052338",
"0.60280836",
"0.5984895",
"0.59689665",
"0.5957652",
"0.5957652",
"0.59520495",
"0.59480745",
"0.58957404",
"0.5882721",
"0.58379525",
"0.57934237",
"0.57886165",
"0.5781734",
"0.577487",
"0.576226",
"0.5736615",
"0.5734089",
"0.5734089",
"0.5727342",
"0.57145804",
"0.57091635",
"0.56669426",
"0.56479317",
"0.563516",
"0.5582929",
"0.55786586",
"0.5578525",
"0.55685836",
"0.5564982",
"0.5560689",
"0.5560183",
"0.55405986",
"0.55361086",
"0.55357504",
"0.5534891",
"0.55261797",
"0.5524462",
"0.5505193",
"0.5504693",
"0.5504494",
"0.54914784",
"0.54791784",
"0.5474931",
"0.54593784",
"0.54408574",
"0.54331774",
"0.5413086",
"0.5397074",
"0.5377846",
"0.5374069",
"0.5374069",
"0.5374069",
"0.53691566",
"0.5366514",
"0.53345174",
"0.53325886",
"0.52973104",
"0.5296502",
"0.5291628",
"0.52913886",
"0.5282704",
"0.52789533",
"0.52756155",
"0.526813",
"0.5256571",
"0.5245644",
"0.5243968",
"0.5241826",
"0.5241272",
"0.5233368",
"0.522416",
"0.5222312",
"0.51996267",
"0.5187329",
"0.51856494",
"0.518245",
"0.51764506",
"0.51754004",
"0.5161277",
"0.5152647",
"0.51364106",
"0.5128739",
"0.5127979",
"0.51265955",
"0.5123241",
"0.51179343",
"0.5117933",
"0.511596",
"0.5096",
"0.508724",
"0.5082831",
"0.5081686",
"0.5075121"
] |
0.72623575
|
0
|
Prints a JSON view of the current page
|
def source
ap get_source
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n render json: @page\n end",
"def pretty_print_page\n pp @page\n end",
"def show_json\n end",
"def get_page\n render_page_sections_json\n end",
"def show\n @page = Page.find(params[:id])\n @version = @page.versions.last\n @author = User.all\n page = {\n :version => @version.changeset,\n :body => @page.body,\n :author => @author\n }\n respond_to do |format|\n format.html\n format.json { render json: page.to_json }\n end\n end",
"def print_json_obj\n \n end",
"def print_json(json)\n say JSON.pretty_generate(json) \n end",
"def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end",
"def display_pretty_json(data)\n puts JSON.pretty_generate(data)\nend",
"def show\n json_response(@browser)\n end",
"def index\n @pages = Page.all\n render json: @pages\n end",
"def json_get\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n write_json @note if @note\n render :nothing => true\n end",
"def processJSON(json)\n # \"Pretty Print\" the JSON response\n pp json\nend",
"def view\n \t@parent = params[:parent]\n\n @pages = Page.where(\"digital_edition_id = ?\", @parent).order(\"page_page ASC\").page( params[:page]).per(20)\n\n respond_to do |format|\n format.html # view.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def json_reflect\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n h = {}\n params.each do |x,y|\n h[x]=y\n end\n write_json h\n end",
"def show\n #Benchmark.bm( 20 ) do |bm|\n # bm.report( \"Access JSON:\" ) do\n # end\n #end\n #binding.pry\n respond_to do |format|\n format.html do\n render :show,\n locals: { memory: @memory.jsonize(externals: { events: @events.jsonize }),\n cloud: @calendary_cloud.jsonize }\n end\n format.json { render json: @memory.jsonize(externals: { events: @events.jsonize }) }\n end\n end",
"def show\n @nested_page = Nested::Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nested_page }\n end\n end",
"def show\n render json: @paper\n end",
"def index\n page = params[:page] || 1\n\n @global_jsons = CfTemplate.global\n\n respond_to do |format|\n format.json { @global_jsons = @global_jsons }\n format.html { @global_jsons = @global_jsons.page(page) }\n end\n end",
"def show\n @Page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @Page }\n end\n end",
"def show\n render json: @printer.map_to_custom_printer\n end",
"def list\n response = connect(base_url, :get)\n pagination_links(response)\n self.current_page = JSON.load(response.body)\n end",
"def print_json(profile, options = {})\n @output.puts JSON.pretty_generate(as_json(profile, options))\n end",
"def show\n respond_to do |format|\n format.json { render :json => @page }\n format.xml { render :xml => @page }\n end\n end",
"def get_json\n html = Nokogiri::HTML(@page)\n text = open(\"https://theintercept.com/api/requestSIDDocuments/?orderBy=publishedTime&orderDirection=desc&perPage=2000\").read\n documents = JSON.parse(text)[\"documents\"][\"edges\"].map{|d| d[\"node\"]}\n \n documents.each do |doc|\n @output.push(parse_json(doc))\n end\n\n return JSON.pretty_generate(@output)\n end",
"def index\n @pages = current_site.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def full_response\n puts JSON.pretty_generate(@google_object)\n end",
"def index\n @pages = Page.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Page.roots.map{|r| r.node}}\n end\n end",
"def show\n @mypage = Mypage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mypage }\n end\n end",
"def pager_json(partial, count)\n html = render_to_string(\n partial,\n layout: false,\n formats: [:html]\n )\n\n render json: {\n html: html,\n count: count\n }\n end",
"def overview\n data = {\n all_page_traffic: all_page_traffic,\n all_views: all_views,\n page_count: current_user.product_pages.count,\n link_count: current_user.link_items.count,\n link_view_count: current_user.link_item_data.count,\n page_views: {\n weekly_page_views: current_user.product_page_data.group_by_day(:created_at, last: 7, format: '%b %d').count,\n monthly_page_views: current_user.product_page_data.group_by_month(:created_at, last: 12, format: '%b %Y').count,\n views_by_week: current_user.product_page_data.group_by_week(:created_at, last: 10).count\n },\n daily_views: current_user.product_page_data.group_by_day(:created_at, last: 365).count\n }\n\n render json: data\n end",
"def show\n render json: @todo\n end",
"def show\n render json: @todo\n end",
"def show\n @title = @page.title\n @pages = @page.find_related_tags\n @case_studies = CaseStudy.tagged_with(@page.tag_list, :any => true)\n @locked = REDIS.exists(\"locks:pages:#{@page.id}\")\n if params[:mercury_frame] == 'true' && !@locked\n REDIS.setex(\"locks:pages:#{@page.id}\", 300, @page.canonical_title)\n elsif params[:mercury_frame] == 'true'\n render(text: \"<html><body><script type='text/javascript' charset='utf-8'>window.parent.document.location.href = '#{page_path(@page)}';</script></body></html>\", content_type: :html) and return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @complete_quiz = serve_complete_quiz_sorted(@quiz)\n @section = @quiz.section\n @course = @quiz.section.course\n @next_checkpoint = get_next_checkpoint(@quiz)\n puts @next_checkpoint.to_json\n end",
"def page\n obj\n end",
"def display_results_json\n puts @filehash \n end",
"def show\n @page = Page.find(params[:id])\n respond_to do |format|\n @color = @page.section.color\n format.html # show.html.erb\n #format.json { render json: @page }\n format.js\n end\n end",
"def show\n render :json => @node\n end",
"def index\n terminals = scope.page(page).per(per)\n json_response(PageDecorator.decorate(terminals), :ok)\n end",
"def print_data(layout = :print_layout)\n PrintData.new(sections(layout)).to_json\n end",
"def render\n Oj.dump(to_json)\n end",
"def show\n render json: @content\n end",
"def pretty_output\n JSON.pretty_generate(output)\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def show\n #Page data isn't updated very frequently so a longer cache time is acceptable\n @page = data_cache(\"page-#{@page.id}\", 1.hour) do\n Page.find(params[:id])\n end\n respond_to do |format|\n format.json { render action: 'show', status: :ok, location: api_page_url(@page) }\n format.xml { render xml: @page, location: api_page_url(@page) }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.json {render json: @page} \n format.xml {render xml: @page}\n end\n end",
"def index\n render json: Visitor.paginate(:page => params[:page], :per_page => 300)\n end",
"def write_epilogue\n puts @json.to_json\n super\n end",
"def render_paginated(resource, opts = {})\n render json: resource, root: 'items', meta: {}\n end",
"def show\n json_response(@terminal.decorate, :ok)\n end",
"def show\n render json: @pug\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @page }\n format.xml { render xml: @page }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def page_body\n JSON.parse(page.body, symbolize_names: true)\n end",
"def show\n render json: @app\n end",
"def index\n\t\t@pages = Page.order('created_at DESC').all\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.json { render json: @pages }\n\t\tend\n\tend",
"def render\n Oj.dump(to_json)\n end",
"def json_print_linked(json, reset = true)\n json_print_tl_linked(json, reset)\n json_print_tl_links(json, reset)\n end",
"def show\n @web_page = WebPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @web_page.to_api_hash }\n end\n end",
"def show\n @page = Page.friendly.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def show\n # turn ruby database into json\n # route to the project 3 page with this json\n # id = 1\n end",
"def dump\n str = if @page\n \"page=#{@page}\"\n else\n s = \"by=#{@by}\"\n s += \",from=#{@from}\" if @from\n s\n end\n str += \",items=#{items}\" if @items\n str += ',total_count=true' if @total_count\n str\n end",
"def show\n render json: @pub\n end",
"def show\n render 'show.json'\n end",
"def show\n render 'show.json'\n end",
"def show_json_debug(section, data)\n Puppet.debug \"in debug #{section}\"\n Puppet.debug JSON.pretty_generate(data).to_s\n end",
"def page\n # We need duplicated JSON parse since standart\n # chromedriver giving an error here if the page is too large\n page = execute_script(File.read(\"#{HOME}/scripts/page.js\"))\n JSON.parse(page, max_nesting: false)['result']\n end",
"def show_json\n if session[:callshop] and session[:callshop][:booths] and session[:callshop][:booths].size > 0\n booths = status_for_ajax(session[:callshop][:booths])\n json_hash = {\n # :free_booths => booths.collect{|b| b[:state] if b[:state] == \"free\"}.compact.size,\n # :active_calls => booths.collect{|b| b[:state] if b[:state] == \"occupied\"}.compact.size,\n :booths => booths}\n render :json => json_hash.to_json\n else\n render :text => \"{}\"\n end\n end",
"def show\n @oasis_page = OasisPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oasis_page }\n end\n end",
"def show\n render json: @history\n end",
"def display()\n\t\tputs \"method: #{@method}\"\n\t\tputs \"identifier: #{@identifier}\"\n\t\tputs \"query: #{@query}\"\n\t\tputs \"version: #{@version}\"\n\t\tputs \"---------------- headers ----------------\"\n\t\tputs @headers\n\t\tputs \"---------------- body -------------------\"\n\t\tputs @body\n\tend",
"def show\n render json: @diet, status: 200, root: true\n end",
"def render_pretty_json(params)\n render json: JSON.pretty_generate(params.as_json)\n end",
"def index\n render json: { \"Exercice Technique\" => \"Transporter Organizations Colisweb backend developer exercise\", \"Poste visé\" => \"Développeur Back Ruby, Alternance\", \"Candidat\" => \"Gressier Jimmy\"}\n end",
"def get_page_contents()\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => BAN_PAGE,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end",
"def show\n @info_page = InfoPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @info_page }\n end\n end",
"def pretty_generate\n JSON.pretty_generate( self.to_h )\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 render json: @story, root: false\n end",
"def show\n render json: @capture\n end",
"def show\n\t\trender json: @url, status: 200\n\tend",
"def show\n render json: @lob\n end",
"def show\n render_json :entry => @set and return\n end",
"def show\n render_json :entry => @set and return\n end",
"def render_json\n end",
"def show\n render json: @disponible\n end"
] |
[
"0.7077802",
"0.67606837",
"0.66862035",
"0.6647434",
"0.6570376",
"0.65508354",
"0.6508218",
"0.64921397",
"0.6373055",
"0.6324023",
"0.6319101",
"0.6262443",
"0.62582093",
"0.6225372",
"0.6145214",
"0.6145214",
"0.6145214",
"0.6145214",
"0.6145214",
"0.6145214",
"0.6145214",
"0.6137112",
"0.61075276",
"0.60820323",
"0.6075228",
"0.607458",
"0.6060828",
"0.6049251",
"0.6021485",
"0.6014826",
"0.60106057",
"0.60019904",
"0.5999771",
"0.59936535",
"0.59890145",
"0.5985116",
"0.59811044",
"0.59805965",
"0.59792405",
"0.59792405",
"0.597388",
"0.596237",
"0.5948241",
"0.5919005",
"0.59189284",
"0.5916769",
"0.59107226",
"0.5896919",
"0.5888277",
"0.58812165",
"0.5869089",
"0.5860499",
"0.5860499",
"0.5860499",
"0.5860499",
"0.5860499",
"0.5860499",
"0.5860499",
"0.585943",
"0.58579355",
"0.58554065",
"0.58481467",
"0.5843815",
"0.5834457",
"0.5830072",
"0.58254504",
"0.5821145",
"0.58204514",
"0.58148575",
"0.58088183",
"0.5801837",
"0.58001626",
"0.5792883",
"0.57868683",
"0.5781941",
"0.5774457",
"0.5772689",
"0.57676744",
"0.5762867",
"0.5762867",
"0.57622594",
"0.57532704",
"0.5751309",
"0.57508725",
"0.5745057",
"0.5740157",
"0.5735316",
"0.5732241",
"0.57279676",
"0.5724886",
"0.57212734",
"0.5720601",
"0.5719898",
"0.57195616",
"0.57123274",
"0.5710214",
"0.5709702",
"0.5708866",
"0.5708866",
"0.57056415",
"0.57002103"
] |
0.0
|
-1
|
Gets a JSON view of the current page
|
def get_source
# must set max nesting. default limit of 20 is too low for selendroid
JSON.parse @driver.page_source, max_nesting: 9999
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n render json: @page\n end",
"def get_page\n render_page_sections_json\n end",
"def index\n @pages = Page.all\n render json: @pages\n end",
"def show\n @page = Page.find(params[:id])\n @version = @page.versions.last\n @author = User.all\n page = {\n :version => @version.changeset,\n :body => @page.body,\n :author => @author\n }\n respond_to do |format|\n format.html\n format.json { render json: page.to_json }\n end\n end",
"def index\n @pages = current_site.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n page = params[:page] || 1\n\n @global_jsons = CfTemplate.global\n\n respond_to do |format|\n format.json { @global_jsons = @global_jsons }\n format.html { @global_jsons = @global_jsons.page(page) }\n end\n end",
"def view\n \t@parent = params[:parent]\n\n @pages = Page.where(\"digital_edition_id = ?\", @parent).order(\"page_page ASC\").page( params[:page]).per(20)\n\n respond_to do |format|\n format.html # view.html.erb\n format.json { render json: @page }\n end\n end",
"def page\n obj\n end",
"def show\n #Page data isn't updated very frequently so a longer cache time is acceptable\n @page = data_cache(\"page-#{@page.id}\", 1.hour) do\n Page.find(params[:id])\n end\n respond_to do |format|\n format.json { render action: 'show', status: :ok, location: api_page_url(@page) }\n format.xml { render xml: @page, location: api_page_url(@page) }\n end\n end",
"def json_get\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n write_json @note if @note\n render :nothing => true\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n render json: @app\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def show\n render json: @history\n end",
"def get_json\n params = {}\n params['access_token'] = EXPA.client.get_updated_token\n uri = URI(url_current_person)\n uri.query = URI.encode_www_form(params)\n force_get_response(uri)\n end",
"def show\n @Page = Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @Page }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end",
"def show\n render json: @content\n end",
"def index\n\t\t@pages = Page.order('created_at DESC').all\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.json { render json: @pages }\n\t\tend\n\tend",
"def overview\n data = {\n all_page_traffic: all_page_traffic,\n all_views: all_views,\n page_count: current_user.product_pages.count,\n link_count: current_user.link_items.count,\n link_view_count: current_user.link_item_data.count,\n page_views: {\n weekly_page_views: current_user.product_page_data.group_by_day(:created_at, last: 7, format: '%b %d').count,\n monthly_page_views: current_user.product_page_data.group_by_month(:created_at, last: 12, format: '%b %Y').count,\n views_by_week: current_user.product_page_data.group_by_week(:created_at, last: 10).count\n },\n daily_views: current_user.product_page_data.group_by_day(:created_at, last: 365).count\n }\n\n render json: data\n end",
"def json_view\n ApplicationController.renderer.render(partial: \"posts/post.json.jbuilder\", locals: {post: self})\n end",
"def show\n # TODO: this is a placeholder for logic using Sentence\n render :json => { :index => params[:id],\n :contents => \"SERVER: this would be the contents of page \" + params[:id]\n }\n end",
"def show_json\n end",
"def show\n @web_page = WebPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @web_page.to_api_hash }\n end\n end",
"def show\n respond_to do |format|\n format.json { render :json => @page }\n format.xml { render :xml => @page }\n end\n end",
"def show\n json_response(@browser)\n end",
"def page\n # We need duplicated JSON parse since standart\n # chromedriver giving an error here if the page is too large\n page = execute_script(File.read(\"#{HOME}/scripts/page.js\"))\n JSON.parse(page, max_nesting: false)['result']\n end",
"def current_page\n response[\"current_page\"]\n end",
"def index\n render json: Visitor.paginate(:page => params[:page], :per_page => 300)\n end",
"def index\n @pages = Page.paginate(page: params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Page.roots.map{|r| r.node}}\n end\n end",
"def show\n @mypage = Mypage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mypage }\n end\n end",
"def show\n @nested_page = Nested::Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nested_page }\n end\n end",
"def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page, :only => [:title, :content] }\n end\n end",
"def list\n response = connect(base_url, :get)\n pagination_links(response)\n self.current_page = JSON.load(response.body)\n end",
"def show\n @title = @page.title\n @pages = @page.find_related_tags\n @case_studies = CaseStudy.tagged_with(@page.tag_list, :any => true)\n @locked = REDIS.exists(\"locks:pages:#{@page.id}\")\n if params[:mercury_frame] == 'true' && !@locked\n REDIS.setex(\"locks:pages:#{@page.id}\", 300, @page.canonical_title)\n elsif params[:mercury_frame] == 'true'\n render(text: \"<html><body><script type='text/javascript' charset='utf-8'>window.parent.document.location.href = '#{page_path(@page)}';</script></body></html>\", content_type: :html) and return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def json\n\t\t\tsession.resource_url do\n\t\t\t\t# Get the request info\n\t\t\t\tcontent = @session.context.response.body\n\t\t\t\t\n\t\t\t\t# Create new JSON lexer\n\t\t\t\tjsonobj = {}.from_json(JSON::Lexer.new(content))\n\t\t\t\t# Decode request\n\t\t\t\tr = nil\n\t\t\t\terror = nil\n\t\t\t\t# Verify that it is for an allowed method\n\t\t\t\t# Call Method\n\t\t\t\tparams = jsonobj[Cparams] ? jsonobj[Cparams] : []\n\t\t\t\t\n\t\t\t\tbegin\n\t\t\t\t\tif json_methods.include?(jsonobj[Cmethod].to_sym)\n\t\t\t\t\t\tr = params.size < 1 ?\n\t\t\t\t\t\t\tself.__send__(jsonobj[Cmethod]) :\n\t\t\t\t\t\t\tself.__send__(jsonobj[Cmethod], *jsonobj[Cparams])\n\t\t\t\t\tend\n\t\t\t\trescue Exception => e\n\t\t\t\t\terror = e.to_s\n\t\t\t\tend\n\t\t\t\t# Return Resource\n\t\t\t\tIowa::Resource.new(format_repsonse( r, error, jsonobj[Cid] || Cdefault ),Ctext_javascript)\n\t\t\tend\n\t\tend",
"def show\n render json: @todo\n end",
"def show\n render json: @todo\n end",
"def get_page_contents()\n JSON.parse( \n @client.api.get(\"#{@client.base_uri.path}/api.php?#{URI.encode_www_form({\n :action => 'query',\n :prop => 'info|revisions',\n :titles => BAN_PAGE,\n :rvprop => 'content',\n :intoken => 'edit',\n :indexpageids => 1,\n :format => 'json',\n :cb => rand(1000000)\n })}\", @headers).body,\n :symbolize_names => true\n )[:query]\n end",
"def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end",
"def showJSON\n\n\t\trender json: UrlDataModel.find(params[:id])\n\n\tend",
"def show\n @page_template = PageTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_template }\n end\n end",
"def current\n render json: current_user\n end",
"def show\n render json: @story, root: false\n end",
"def show\n render json: @user_page_setting\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @page }\n format.xml { render xml: @page }\n end\n end",
"def get_json\n response = conn.get(@current_location)\n parsed = JSON.parse(response.body, symbolize_names: true)\n\n end",
"def index\n @contents = Content.all\n render json: @contents\n end",
"def show\n render json: @lob\n end",
"def index\n @page = Page.find(params[:page_id])\n @revisions = @page.revisions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @revisions }\n end\n end",
"def show\n @page = Page.find(params[:id])\n\n respond_to do |format|\n format.json {render json: @page} \n format.xml {render xml: @page}\n end\n end",
"def getJson\n render json: getData()\n end",
"def show\n @page = Page.friendly.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n render json: @paper\n end",
"def show\n @page = Page.find(params[:id])\n respond_to do |format|\n @color = @page.section.color\n format.html # show.html.erb\n #format.json { render json: @page }\n format.js\n end\n end",
"def home\n @json_all_activities = Activity.all.to_json\n @json_featured_activities = Activity.find_all_by_featured(true).to_json\n @json_all_zones = Zone.find(:all, :order => \"name\").to_json\n @json_featured_zones = Zone.find_all_by_featured(true, :order => \"name\").to_json\n end",
"def render\n Oj.dump(to_json)\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @main_nav }\n end\n end",
"def show\n @wikipage = Wikipage.find(params[:id])\n @history = Activity.where(\n :action_object_id => @wikipage.id,\n :action_object_type => \"Wikipage\"\n ).order(\"updated_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wikipage }\n format.js\n end\n end",
"def show\n json = self.as_json(only: [:created_at, :version])\n json['url'] = doi_url\n json\n end",
"def show\n render_to_page_object\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @page_object }\n format.tson { render :json => @page_object }\n end\n end",
"def show\n render json: @collection\n end",
"def show\n #Benchmark.bm( 20 ) do |bm|\n # bm.report( \"Access JSON:\" ) do\n # end\n #end\n #binding.pry\n respond_to do |format|\n format.html do\n render :show,\n locals: { memory: @memory.jsonize(externals: { events: @events.jsonize }),\n cloud: @calendary_cloud.jsonize }\n end\n format.json { render json: @memory.jsonize(externals: { events: @events.jsonize }) }\n end\n end",
"def json_reflect\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n h = {}\n params.each do |x,y|\n h[x]=y\n end\n write_json h\n end",
"def show\n render json: @visit\n end",
"def index\n qualities_viewed = QualityHistory.where(:user_id => current_user.id, :action_type => 'view').group(:quality_id)\n @quality_histories = qualities_viewed.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quality_histories }\n format.js\n end\n end",
"def new\n @title = 'New Page'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def index\n @sites = current_user.sites.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def show\n render json: @application\n end",
"def show\n render json: @url\n end",
"def index\n @pages = Page.all\n \n respond_to do |format|\n format.json { render :json => @pages }\n format.xml { render :xml => @pages }\n end\n end",
"def show\n render 'show.json'\n end",
"def show\n render 'show.json'\n end",
"def index\n @ideas = current_user.ideas.page(params[\"page\"])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ideas }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.json { render json: @pages }\n format.xml { render xml: @pages }\n end\n end",
"def show\n @structure_page = Structure::Page.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @structure_page }\n end\n end",
"def show\n\t\trender json: @url, status: 200\n\tend",
"def show\n render json: @activity\n end",
"def show\n render json: @pub\n end",
"def index\n @bookmark_stats = BookmarkStat.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bookmark_stats }\n end\n end",
"def index\n @current_page = \"PROJECTS\"\n @projects = Project.all\n @projects_for_review = Project.pending_review if current_user\n @new_nav = true;\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projects }\n end\n end",
"def show\n render json: @project\n end",
"def show\n render json: @parsed_site\n end",
"def index\n @about_pages = AboutPage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @about_pages }\n end\n end",
"def show\n @oasis_page = OasisPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oasis_page }\n end\n end",
"def show\n render json: @service_history\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def get_view_data(page=1, arguments=\"\")\n\n session_data = {}\n session_data.store(:me, context.user.username) if not context.nil? and not context.user.nil?\n if not context.nil? and context.instance_variable_defined?(\"@current_profile\")\n session_data.store(:current_profile, context.instance_variable_get(\"@current_profile\"))\n end\n if not context.nil? and context.instance_variable_defined?(\"@current_content\")\n session_data.store(:current_content, context.instance_variable_get(\"@current_content\")) \n end \n\n data = view.get_data(page, arguments, session_data)\n\n return data\n\n end"
] |
[
"0.7623492",
"0.7428901",
"0.68959826",
"0.6860339",
"0.6842646",
"0.6653308",
"0.6650702",
"0.6482096",
"0.6471876",
"0.64305514",
"0.64063644",
"0.64063644",
"0.64063644",
"0.64063644",
"0.64063644",
"0.64063644",
"0.64063644",
"0.637942",
"0.63757366",
"0.63757366",
"0.63757366",
"0.63757366",
"0.63757366",
"0.63757366",
"0.63757366",
"0.63735753",
"0.63722074",
"0.63705754",
"0.63608694",
"0.63607824",
"0.6352114",
"0.6348684",
"0.632783",
"0.6323771",
"0.63163763",
"0.6300255",
"0.6284271",
"0.6275924",
"0.62700474",
"0.62654054",
"0.6264701",
"0.6263722",
"0.622338",
"0.6221194",
"0.6219389",
"0.62149537",
"0.62076145",
"0.6194993",
"0.61837816",
"0.61836845",
"0.61836845",
"0.6178747",
"0.6148723",
"0.61451316",
"0.61381614",
"0.6131497",
"0.61129653",
"0.6101464",
"0.6095407",
"0.60848737",
"0.6079116",
"0.6067323",
"0.6063825",
"0.6055058",
"0.6050079",
"0.6050042",
"0.6049566",
"0.60473585",
"0.6044253",
"0.60440004",
"0.6039595",
"0.6039472",
"0.6037514",
"0.6035193",
"0.60346705",
"0.6027952",
"0.60270035",
"0.60269356",
"0.6025352",
"0.60251987",
"0.6022404",
"0.6018504",
"0.60158396",
"0.60140157",
"0.6011775",
"0.6011775",
"0.6010754",
"0.6010431",
"0.59982955",
"0.5997606",
"0.59837705",
"0.5978794",
"0.59781563",
"0.5973383",
"0.5971692",
"0.59693813",
"0.5968346",
"0.5967556",
"0.596305",
"0.5960945",
"0.5960901"
] |
0.0
|
-1
|
Returns the first element that exactly matches name
|
def find_name name
find_element :name, name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find(name)\n m = match(name)\n m.count == 1 ? m[0] : nil\n end",
"def first(name=nil)\n name.nil? ? matches.first : find(name, false).first\n end",
"def element_named(name)\n @elements.find{|e| e.name.to_s == name.to_s}\n end",
"def find_first(name)\n find_all(name).first\n end",
"def element(name)\n elements.find { |el| el.name == name.to_s }\n end",
"def find_by_name(name)\n for item in self.collection\n return item if item.name == name\n end\n\n # didn't find item in collection, return nil\n return nil\n end",
"def find_by_name(name)\n return nil unless name.present?\n names.select {|e| e == name}\n end",
"def find_first(name)\n object = build(name)\n object.retrieve\n end",
"def find_by_name(name)\n # this works because of `def item.=='\n item = @set.find { |c| c == name }\n item\n end",
"def first_ele(class_name)\n ele_index class_name, 1\n end",
"def by_name(name)\n elt = self[name]\n return elt unless elt.nil?\n\n @elements.each_key do |subelt_name|\n if self[subelt_name].is_a?(Model)\n elt = self[subelt_name][name]\n return elt unless elt.nil?\n end\n end\n\n nil\n end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def find_item(name)\n items.find do |item|\n item.name == name ||\n item.short_name.gsub('…','') == name.gsub('…','')\n end\n end",
"def part_by_name(name)\n mbr.part.select { |i| i.name == name }.first\n end",
"def first_ele tag_name\n # XPath index starts at 1\n find_element :xpath, \"//#{tag_name}[1]\"\n end",
"def find(name); end",
"def []( name )\n\n\t\t# Query root\n\t\tresult = @root.find_name name\n\n\t\tif result.empty?\n\t\t\tnil\n\t\telsif result.size == 1 # Only one match found\n\t\t\tresult.last.value\n\t\telse\n\t\t\tresult\n\t\tend\n\tend",
"def find(name)\n list[name]\n end",
"def child_with_exact_name(name)\n normal_children.find{|n| n.name == name}\n end",
"def get(name)\n self._list.detect { |entry| entry.name == name.to_sym }\n end",
"def get_item name\n if (@listOfItem)\n @listOfItem.select do |item|\n item.product.name == name\n end.first\n else\n puts \"@listOfItem is null, so can't get an item from this\"\n end\n end",
"def player_by_name name\n @players.select {|p| p.name == name}.first\n end",
"def find_item_by_name_in_collection(name, collection)\n index = 0 \n while index < collection.length do\n if collection[index][:item] == name\n return collection[index]\n end\n index += 1\n end\n nil\nend",
"def first_matching(key)\n @attributes.find do |a|\n a[0].downcase == key.downcase\n end\n end",
"def name_exact name\n # exact description\n result = mobile :find, [ [ [5, name] ] ]\n\n return result if result.kind_of? Selenium::WebDriver::Element\n\n if result.length > 0\n result.first\n else\n Appium::Common.raise_no_element_error\n end\n end",
"def find_by_name(name)\n end",
"def find_ele_by_predicate(class_name: '*', value:)\n elements = find_eles_by_predicate(class_name: class_name, value: value)\n raise _no_such_element if elements.empty?\n\n elements.first\n end",
"def match_element_name(element_name)\n match(element, element_name)\n end",
"def find_by_name(name)\n find_by('name', name)\n end",
"def name; @names.first; end",
"def get(element, name)\n lookup(key(element.to_s, name.to_s))\n end",
"def get(element, name)\n lookup(key(element.to_s, name.to_s))\n end",
"def find_item_by_name_in_collection(name, collection)\n count = 0 \n while count < collection.length\n if collection[count][:item] == name\n return collection[count]\n end\n count += 1 \n end\n nil\nend",
"def structure(name)\n structures.select { |s| s.name == name }.first\n end",
"def fetch_element(key)\n return @completed_elements.detect do |el|\n el.first.html_attribute_name == key || el.first.name == key\n end\n end",
"def find(name)\n @boxes.each do |box|\n return box if box.name == name\n end\n\n nil\n end",
"def find(name)\n @boxes.each do |box|\n return box if box.name == name\n end\n\n nil\n end",
"def e(name)\n for c in @children\n return c if c.is_a?(MiniXmlElement) && c.name==name\n end\n return nil\n end",
"def first_wa(elements)\n elements.find do |element|\n element.to_s.start_with?(\"wa\")\n end\nend",
"def single(name)\n els = @root.xpath(\"meta/#{name}[@meta='yes']\")\n els.length <= 1 or puts(\"Warning: multiple #{name.inspect} elements found.\")\n return els[0] ? els[0].content : nil\n end",
"def find_by_name(planet)\n @planets.each do |item|\n if item.name.downcase == planet.downcase\n return item\n end\n end\n return false\n end",
"def [](name)\n name = name.to_sym\n raise ArgumentError, \"no such element #{name}\" unless @named_elements.key?(name)\n\n @named_elements[name]\n end",
"def find_item_by_name_in_collection(name, collection)\n collection.each{|items|\n if items[:item] === name\n return items \n end}\n nil\nend",
"def find_obj_for_name(name)\n idx = @field_names.index(name)\n if idx\n instantiate_obj(idx)\n @field_objs[idx].obj\n else\n nil\n end\n end",
"def find_by_starts_with(name)\n return nil unless name.present?\n names.select {|e| e.starts_with?(name)}\n end",
"def first_wa(elements)\n elements.any? do |i|\n if i.class == String \n if i.start_with?\"wa\"\n return i\n end\n end\n end\nend",
"def find_matching(collection, name)\n item = collection.find do |single|\n single.id == name ||\n single.name == name ||\n (name.is_a?(Regexp) && name =~ single.name)\n end\n\n # If it is not present in collection, it might be a non-standard image/flavor\n if item.nil? && !name.is_a?(Regexp)\n item = collection.get escape_name_if_necessary(name)\n end\n\n item\n end",
"def search_firstname(input)\n \n search_name = input.downcase\n lower = 0\n upper = entries.length - 1\n \n while lower<= upper\n mid = (upper+lower)/2\n mid_name_array = entries[mid].name.split(' ').map! { |el| el.downcase }\n \n if search_name == mid_name_array[0]\n return entries[mid]\n elsif search_name < mid_name_array[0]\n upper = mid - 1\n elsif search_name > mid_name_array[0]\n lower = mid + 1\n end\n end\n return nil\n end",
"def find_by_name(name = nil, &block)\n all.find { |p| p.name == name.to_s }\n end",
"def xpath_first(outer_set, path_name)\n outer_set.xpath(path_name).first\n end",
"def find(name)\n all.find { |pattern| pattern.name.to_s.downcase == name.to_s.downcase }\n end",
"def find_by_name( name )\n\t\t\tnamed_message = nil\n\t\t\t@messages.values.each do |message|\n\t\t\t\tif message.descriptor.name == name\n\t\t\t\t\tnamed_message = message\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn named_message\n\t\tend",
"def find(name)\n instances.find { |instance| instance.name == (name) }\n end",
"def find(name)\n vertices.each do |vertex|\n return vertex if vertex.name == name\n end\n nil\n end",
"def child_get(name)\n child = @children.select{ |elem| name.eql?(elem.name) }\n return nil unless child\n child\n end",
"def [](name)\n name = name.to_sym\n @values[name] && @values[name].first\n end",
"def find_names name\n find_elements :name, name\n end",
"def get_field_by_name(fields_list, name)\n fields_array = arrayize(fields_list)\n index = fields_array.find_index {|field| field[:name].eql?(name)}\n return (index.nil?) ? nil : fields_array.at(index)\n end",
"def find_item_by_name_in_collection(name, collection)\n i = 0\n while i < collection.length do\n item_hash = collection[i]\n item_hash[:item] == name ? (return item_hash) : nil\n i += 1\n end\nend",
"def find name\n object = objects.find { |o| o.name == name.to_s }\n end",
"def find_by_name(name)\n all.find { |device| name == device.name }\n end",
"def get_instance_by_name(group, name)\n get_instances(group).each {|instance|\n return instance if (instance.tags['name_s'] || \"\").casecmp(name) == 0\n return instance if (instance.tags['Name'] || \"\").casecmp(name) == 0\n }\n raise \"unknown instance: #{name} in group #{group} \"\n end",
"def find_item (name)\n\tnamespace = self\n\twhile namespace\n\t break if namespace.has_key? name\n\t namespace = namespace.parent\n\tend\n\tnamespace\n end",
"def first_wa(collections)\n collections.find{|element| element.to_s.start_with?(\"wa\")}\nend",
"def asset(name:)\n self[:assets].select { |asset| asset[:name] =~ /#{name}/ }.first\n end",
"def linear_search(input)\n \n search_name = input.downcase.split(' ')\n search_name.each do |name_el|\n \n entries.each do |entry|\n \n name_array = entry.name.downcase.split(' ')\n \n if name_array.include?(name_el)\n return entry\n end\n end\n end\n return nil\n end",
"def find_name(arr, name)\n arr.each { |p| return p if (p.to_s == name) }\n puts \"Error: find_name cannot find #{name}\"\n $stdout.flush\nend",
"def iterative_search(name)\n # Create an index and start at 0\n #index = 0\n @entries.each do |entry|\n if name == entry.name\n return entry\n #index += 1\n else\n return nil\n end\n end\n end",
"def get_element(path)\n elements = get_elements(path)\n elements[0] if elements\n end",
"def name\n\t\treturn self.names.first\n\tend",
"def iterative_search(name)\n lower = 0\n upper = entries.length - 1\n \n while lower <= upper\n array_name = entries[lower].name\n \n if name == array_name\n return entries[lower]\n else lower += 1\n end\n end\n \n return nil\n end",
"def find_matching(collection, name, primary_key = :id)\n # Handle identity - so you can pass object, object_name\n return name if collection.include? name\n collection.each do |single|\n # It's usually id, but are other possibilities like device\n if single.respond_to? primary_key\n return single if single.send(primary_key) == name\n end\n if single.respond_to? :name\n return single if single.name == name\n return single if name.is_a?(Regexp) && name =~ single.name\n end\n end\n\n nil\n end",
"def element_present?(name)\n collection.include?(name)\n end",
"def part(name)\n if new_record? or parts.to_a.any?(&:new_record?)\n parts.to_a.find {|p| p.name == name.to_s }\n else\n parts.where(:name => name.to_s).first\n end\n end",
"def name\n names.first\n end",
"def queue_by_name(name)\n matched = nil\n queues.each_value { |queue| matched = queue if queue.name == name }\n matched\n end",
"def [](name)\n return super(name) if name.is_a?(Fixnum)\n\n if name == 'children'\n fail 'Starting sabre/vobject 4.0 the children property is now protected. You should use the children method instead'\n end\n\n matches = select(name)\n\n if matches.empty?\n return nil\n else\n first_match = matches.first\n # @return [first_match] Property\n first_match.iterator = ElementList.new(matches.to_a)\n return first_match\n end\n end",
"def find_matching(collection, name)\n collection.each do |single|\n return single if single.id == name\n return single if single.name == name\n return single if name.is_a?(Regexp) && name =~ single.name\n end\n @logger.error \"Flavor '#{name}' not found\"\n nil\n end",
"def best_match(name)\n matches = Name.with_correct_spelling.where(search_name: name)\n return matches.first if matches.any?\n\n matches = Name.with_correct_spelling.where(text_name: name)\n accepted = matches.reject(&:deprecated)\n matches = accepted if accepted.any?\n nonsensu = matches.reject { |match| match.author.start_with?(\"sensu \") }\n matches = nonsensu if nonsensu.any?\n matches.first\n end",
"def find_subject(name)\n self.subjects.each { |subject|\n if subject.name == name\n return subject\n end\n }\n return nil\n end",
"def find_object(name); end",
"def name\n @elements[:name]\n end",
"def [](name)\n @elements[name]\n end",
"def [](name)\n @elements[name]\n end",
"def get_node_by_name(str)\n self.each_node do |node|\n if get_node_name(node) == str\n return node\n end\n end\n nil\n end",
"def find_pet_by_name(section, name)\n for pet in section[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def find_in_scope scope, element\n scope.select do |struct|\n struct.keys.include?(element.to_sym)\n end.first\n end",
"def name_matches(name)\n where(\"lower(name) = ?\", normalize_name(name)).limit(1)\n end",
"def pick_existing_name(*names)\n names.flatten.find do |name|\n primitive_exists? name\n end\n end",
"def first_matching_tag\n r = Registry.get\n return unless r\n\n RegistryEvent.all.find_each do |event|\n data = JSON.parse(event.data)\n _, _, tag_name = r.get_namespace_from_event(data)\n return event.dup if tag_name == @tag\n end\n\n nil\n end",
"def has_item(name)\n @items.each_with_index do |item, index|\n if (item.name.casecmp(name) == 0)\n return index\n end\n end\n return -1\n end",
"def first(search_order = MDS::PREFERRED_INTERFACE_ORDER)\r\n c = search_order.map do |name|\r\n begin\r\n name.split('::').inject(Kernel) do |scope, const_name| \r\n scope.const_get(const_name)\r\n end\r\n rescue NameError\r\n nil\r\n end\r\n end.compact!\r\n \r\n (!c || c.length == 0) ? @available.first : c.first\r\n end",
"def find_planet_by_name(name_used)\n @planets.each do |planet|\n if (name_used).upcase == (planet.name).upcase\n return planet\n end\n end\n end",
"def getNamedItem(name)\n node.getAttributeNode(name)\n end",
"def find(name = nil, type = nil)\n if name.nil?\n result = @entries\n else\n result = @entries.select {|entry| entry.name == name}\n end\n\n if type.nil?\n return result\n else\n return @entries.select {|entry| entry.type == type}\n end\n end",
"def first_event(name)\n cls = MAPPINGS[name]\n if cls.nil?\n raise ArgumentError, \"Bogus event name #{name}\"\n end\n matching = events.find do |event|\n cls === event\n end\n events.delete(matching)\n matching\n end",
"def find_account(name)\n return (accounts.select { |a| a[:name] == name }).first\n end",
"def node(node_name)\n nodes(node_name).first\nend",
"def find_by_name(arrHash,strang)\nret = nil\n\tarrHash.each_with_index do |chack,index|\n\t\tif chack[:name]==strang\n\t\t\tret=chack\n\t\t\tbreak\n\t\tend\n\tend\n\tret\nend"
] |
[
"0.7612365",
"0.74789006",
"0.74676776",
"0.74570316",
"0.7410159",
"0.71146005",
"0.7097981",
"0.6937381",
"0.6862355",
"0.67928755",
"0.6738946",
"0.67318225",
"0.67318225",
"0.66656816",
"0.6592674",
"0.6563946",
"0.6512656",
"0.6490407",
"0.64891005",
"0.6485149",
"0.646859",
"0.64228004",
"0.6351545",
"0.6326105",
"0.6304689",
"0.62912995",
"0.6285288",
"0.62659925",
"0.6263569",
"0.62421125",
"0.6206132",
"0.6200259",
"0.6200259",
"0.6186957",
"0.61837184",
"0.61813444",
"0.61637014",
"0.61637014",
"0.6124214",
"0.61135036",
"0.61022264",
"0.60997576",
"0.60992956",
"0.60930943",
"0.6080887",
"0.6074957",
"0.6059501",
"0.6044285",
"0.60184807",
"0.60162604",
"0.6014999",
"0.60090387",
"0.59981054",
"0.59911567",
"0.5979494",
"0.5973689",
"0.59682584",
"0.5965977",
"0.5958625",
"0.5952698",
"0.5942621",
"0.59399307",
"0.5937041",
"0.5934139",
"0.5919162",
"0.59168583",
"0.5914258",
"0.5912508",
"0.5907818",
"0.58964425",
"0.58909756",
"0.58895504",
"0.5886324",
"0.58779407",
"0.5874441",
"0.5872212",
"0.5862033",
"0.58614814",
"0.58528876",
"0.58289415",
"0.58289236",
"0.58257157",
"0.5825491",
"0.5820013",
"0.5820013",
"0.58186024",
"0.5817506",
"0.5815027",
"0.58109295",
"0.5809719",
"0.58055764",
"0.5786962",
"0.5785076",
"0.5780367",
"0.5780162",
"0.5774102",
"0.57677025",
"0.5764464",
"0.57596993",
"0.5755737"
] |
0.72028893
|
5
|
Returns all elements that exactly match name
|
def find_names name
find_elements :name, name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def element_named(name)\n @elements.find{|e| e.name.to_s == name.to_s}\n end",
"def match_element_name(element_name)\n match(element, element_name)\n end",
"def elements_present\n elements_to_check.select { |name| there?(name) }\n end",
"def find_elements(element_name, response)\n response.body.xpath(\".//x:#{element_name}\", 'x' => response.body.namespace.href)\n end",
"def matching_keys(name)\n matched_keys = []\n @all_se.each_key do |k|\n if /#{name}/.match(k)\n matched_keys << k\n end\n end\n matched_keys\n end",
"def find_name name\n find_element :name, name\n end",
"def element(name)\n elements.find { |el| el.name == name.to_s }\n end",
"def all_elements_by_name(name, options = {})\n default_options = {\n :count => :all,\n :from_page => :all,\n :language => session[:language]\n }\n options = default_options.merge(options)\n if options[:from_page] == :all\n elements = Element.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n elsif options[:from_page].class == String\n page = Page.find_by_page_layout_and_language(options[:from_page], options[:language])\n return [] if page.blank?\n elements = page.elements.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n else\n elements = options[:from_page].elements.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n end\n end",
"def els(element_name)\n element_reader = get_locator(element_name)\n begin\n if element_reader.length > 0\n element_reader.each do |k,v|\n if(k=='class' || k=='css' || k=='id' || k=='xpath' || k=='partial_link_text' || k=='tag_name')\n begin\n $elems = $driver.find_elements(k.to_sym,v.to_s)\n $LOG.info \"Elements found \\n #{element_name} : #{k} => #{v}\"\n rescue Exception => e\n $LOG.error \"Element not found \"\n $LOG.error \"#{element_name} : #{k} => #{v}\"\n $LOG.error \"Error message :: \" + e.message\n raise \"Element not found \\n #{element_name} : #{k} => #{v} \\n Error Message :: \" + e.message\n end\n $elems\n end\n end\n else\n $LOG.error \"Element not present in object repository\"\n raise \"Element not present in object repository\"\n end\n $elems\n rescue Exception => e\n $LOG.error \"Error in finding the element :: \" + e.message\n raise \"Error in finding the element :: \" + e.message\n end\n end",
"def cell_elements_by_name(name)\n if cell = cells.find_by_name(name)\n cell.elements\n else\n Alchemy::Logger.warn(\"Cell with name `#{name}` could not be found!\", caller.first)\n Element.none\n end\n end",
"def find_by_starts_with(name)\n return nil unless name.present?\n names.select {|e| e.starts_with?(name)}\n end",
"def find_by_name(name)\n #@@artist.detect{|a| a.name == name}\n all.detect{|a| a.name == name}\n end",
"def find_by_name(entry)\n names = []\n self.all.each do |item|\n if item.name.downcase.include? entry\n names << item \n end\n end\n names\n end",
"def find_by_name(name)\n return nil unless name.present?\n names.select {|e| e == name}\n end",
"def get(name)\n return {} if name.blank?\n\n all.detect { |a| a[\"name\"].casecmp(name).zero? }\n end",
"def get(name)\n return {} if name.blank?\n\n all.detect { |a| a[\"name\"].casecmp(name).zero? }\n end",
"def find_by_names(*names)\n @set.find_all { |item| names.include? item }\n end",
"def element_definitions_by_name(names)\n return [] if names.blank?\n\n if names.to_s == \"all\"\n Element.definitions\n else\n Element.definitions.select { |e| names.include? e['name'] }\n end\n end",
"def find(name)\n all.find { |pattern| pattern.name.to_s.downcase == name.to_s.downcase }\n end",
"def specs_with_name(name)\n matching_specs = @specs.select do |spec|\n spec[0].name == name\n end\n\n name_tuples = []\n matching_specs.each do |(name_tuple, _)|\n name_tuples << name_tuple\n end\n\n name_tuples\n end",
"def find_attributes_starting_with(name)\n @attributes.select { |key| key.to_s.start_with?(name) }\n end",
"def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def elements_missing\n elements_to_check.reject { |name| there?(name) }\n end",
"def e(name)\n for c in @children\n return c if c.is_a?(MiniXmlElement) && c.name==name\n end\n return nil\n end",
"def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end",
"def search_by_name(name)\n name = name.capitalize\n result_name = []\n @name_list.each_value do |element|\n if element.include? name\n result_name.push(element)\n end\n end\n if result_name.empty?\n puts \"Nobody has name is #{name}\"\n else\n puts \"\\nList member of #{name} keyword\"\n result_name.each do |element|\n index = @name_list.values.index(element)\n show_profile(index, @name_list, @dob_list)\n end\n puts \"\\n\"\n end\n end",
"def recipe_grep name='.'\n @recipe.select{ |r| r.name === name }\n end",
"def names name = \"\"\n find_all_by_name( name ).map(&:name)\n end",
"def elements(name, *find_args)\n build_elements(name, *find_args) do\n define_method(name) do |*runtime_args, &block|\n raise_if_block(self, name, !block.nil?, :elements)\n _all(*merge_args(find_args, runtime_args))\n end\n\n create_get_element_params(name, find_args)\n end\n end",
"def find(name, deep=true)\n sym = name.to_sym\n ms = matches.select {|m| m.has_name?(sym) }\n ms.concat(matches.map {|m| m.find(name, deep) }.flatten) if deep\n ms\n end",
"def find_attributes(name)\n\t\t\tr=[]\n\t\t\tp=self\n\t\t\twhile(p)\n\t\t\t\tif(p.respond_to?(name))\n\t\t\t\t\tv=p.send(name)\n\t\t\t\t\tr << v if(v)\n\t\t\t\tend\n\t\t\t\tbreak if(!p.respond_to?(\"container\"))\n\t\t\t\tp=p.container\n\t\t\tend\n\t\t\tr\n\t\tend",
"def contents_by_name(name)\n contents.select { |content| content.name == name.to_s }\n end",
"def select(name)\n group = nil\n name = name.upcase\n\n (group, name) = name.split('.', 2) if name.index('.')\n\n name = nil if name.blank?\n\n if name\n result = @children.key?(name) ? @children[name] : []\n\n if group.nil?\n return result\n else\n # If we have a group filter as well, we need to narrow it down\n # more.\n return result.select do |child|\n child.is_a?(Property) && (child.group || '').upcase == group\n end\n end\n end\n\n # If we got to this point, it means there was no 'name' specified for\n # searching, implying that this is a group-only search.\n result = []\n @children.each do |_, child_group|\n child_group.each do |child|\n if child.is_a?(Property) && (child.group || '').upcase == group\n result << child\n end\n end\n end\n\n result\n end",
"def named_books\n # I didn't have the creativity needed to find a good ruby only check here\n books.select(&:name)\n end",
"def element_present?(name)\n collection.include?(name)\n end",
"def select(*names)\n result = []\n names.each { |name|\n name = Field.name_canonicalize(name)\n result.concat(find_all { |n, v|\n n.downcase == name\n })\n }\n result\n end",
"def matches(element_name, attrs = {})\n match_element_name(element_name) && match_attributes(attrs)\n end",
"def find_free_xml(name)\n # checking\n name\n end",
"def child_with_exact_name(name)\n normal_children.find{|n| n.name == name}\n end",
"def find_item(name)\n items.find do |item|\n item.name == name ||\n item.short_name.gsub('…','') == name.gsub('…','')\n end\n end",
"def filter_elements(elements)\n for locator in locators\n by, value = locator.first\n case by\n when :text\n elements = elements.select{ |element| element.text.include? value}\n when :index\n elements = elements[value]\n when :displayed\n elements = elements.select{ |element| element.displayed? == value}\n when :value\n elements = elements.select{ |element| element.value == value}\n end\n end\n return elements\n end",
"def search(name)\n\t\tresult = []\n\t\tpeople.each do |person|\n\t\t \tif person.name.include?(name)\n\t\t \tputs \"tel: #{person.phone}\"\n\t\t \tresult << person\n\t\t\tend\n\t\tend\n\t\tresult\n\tend",
"def find_by_name (people, name)\n result = []\n people.each do |hash|\n if hash[:name] == name\n result << hash\n break\n end \n end \n result \nend",
"def match( gname, attr={}, hidden = false )\r\n\t\t\tresult = []\r\n\t\t\teach do |gobject|\r\n\t\t\t\tif gobject.seen == true\r\n\t\t\t\t\tif gobject.name == gname\r\n\t\t\t\t\t\tif attr.size > 0\r\n\t\t\t\t\t\t\tattrs = attr.size\r\n\t\t\t\t\t\t\tattrr = 0\r\n\t\t\t\t\t\t\tattr.each_pair do |key,value|\r\n\t\t\t\t\t\t\t\tif value == nil\r\n\t\t\t\t\t\t\t\t\tattrr += 1 if gobject.has_attr?( key )\r\n\t\t\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\t\t\tattrr += 1 if gobject.get_attr( key ) == value\r\n\t\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\t\tresult << gobject if attrs == attrr\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\tresult << gobject\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn result[0] if result.size == 1\r\n\t\t\treturn result\r\n\t\tend",
"def fetch_ror_matches(name:)\n return [] unless name.present?\n\n OrgSelection::SearchService.search_externally(search_term: name).select do |hash|\n # If the natural language processing score is <= 25 OR the\n # weight is less than 1 (starts with or includes the search term)\n hash.fetch(:score, 0) <= 25 && hash.fetch(:weight, 1) < 2\n end\n end",
"def find(name); end",
"def get(name)\n return {} if name.blank?\n\n all.detect { |a| a[\"name\"] == name }\n end",
"def by_name(name)\n elt = self[name]\n return elt unless elt.nil?\n\n @elements.each_key do |subelt_name|\n if self[subelt_name].is_a?(Model)\n elt = self[subelt_name][name]\n return elt unless elt.nil?\n end\n end\n\n nil\n end",
"def objects_of_class(name)\n find_all { |r| name === r['class'] }\n end",
"def tags tag_name\n find_elements :tag_name, tag_name\n end",
"def elements(selector)\n @doc.search(selector)\n end",
"def duplicate_names\n array = all.pluck(:name)\n array.select{|element| array.count(element) > 1 }.uniq\n end",
"def duplicate_names\n array = all.pluck(:name)\n array.select{|element| array.count(element) > 1 }.uniq\n end",
"def find_by_name(name)\n for item in self.collection\n return item if item.name == name\n end\n\n # didn't find item in collection, return nil\n return nil\n end",
"def objects_of_type(name)\n find_all { |r| name === r['type'] }\n end",
"def find_by_name(name)\n all.find { |device| name == device.name }\n end",
"def find_eles tag_name\n @driver.find_elements :tag_name, tag_name\n end",
"def find_item_by_name_in_collection(name, collection)\n collection.each{|items|\n if items[:item] === name\n return items \n end}\n nil\nend",
"def find_by_name(name)\n # this works because of `def item.=='\n item = @set.find { |c| c == name }\n item\n end",
"def contain_a(elements)\n elements.select do |element|\n element.include? \"a\"\n end\nend",
"def find(name)\n list[name]\n end",
"def get(name)\n self._list.detect { |entry| entry.name == name.to_sym }\n end",
"def multi_element_attr_match( elements )\n elements.each do |element|\n print \".\"\n wait_for_element(element[0].to_sym, element[1])\n check_attribute_match(element[0].to_sym, element[1], element[2], element[3])\n end\n end",
"def any(name)\n return @root.xpath(\"meta/#{name}[@meta='yes']\").length > 0\n end",
"def [](name)\n name = name.to_sym\n @nodes.detect { |node| node.name == name }\n end",
"def find_collection_elements_with(*key_vals)\n self.collection.select do |elem|\n key_vals.all? do |kv|\n k, v = kv.first\n return unless elem.respond_to?(k.to_sym)\n elem.send(k.to_sym) == v\n end\n end\n end",
"def linear_search(input)\n \n search_name = input.downcase.split(' ')\n search_name.each do |name_el|\n \n entries.each do |entry|\n \n name_array = entry.name.downcase.split(' ')\n \n if name_array.include?(name_el)\n return entry\n end\n end\n end\n return nil\n end",
"def fetch_element(key)\n return @completed_elements.detect do |el|\n el.first.html_attribute_name == key || el.first.name == key\n end\n end",
"def names name=''\n if name.nil? || name.empty?\n args = 'all', [ [7, ''], [100] ]\n mobile :find, args\n else\n args = 'all',\n [ [7, name] ]\n mobile :find, args\n end\n end",
"def element_match(tree, exp, bindings); end",
"def find_matching(collection, name)\n collection.each do |single|\n return single if single.id == name\n return single if single.name == name\n return single if name.is_a?(Regexp) && name =~ single.name\n end\n @logger.error \"Flavor '#{name}' not found\"\n nil\n end",
"def find_matches method_name\n matches = xpath method_name.as_xpath \n matches.any? ? matches : nil\n end",
"def find_cartridges(name)\n logger.debug \"Finding cartridge #{name}\" if @mydebug\n regex = nil\n if name.is_a?(Hash)\n name = name[:name] if name[:name]\n regex = name[:regex] if name[:regex]\n end\n\n filtered = Array.new\n cartridges.each do |cart|\n if regex\n filtered.push(cart) if cart.name.match(regex)\n else\n filtered.push(cart) if cart.name == name\n end\n end\n return filtered\n end",
"def remove_element(name)\n @element_list.delete_if{|e|\n e.name == name\n }\n end",
"def create_get_all_elements(element_name, *find_args)\n method_name = \"get_all_#{element_name}\"\n create_helper_method(method_name, *find_args) do\n define_method(method_name) do |*runtime_args|\n args = merge_args(find_args, runtime_args)\n wait_until_get_not_empty(*args)\n end\n end\n end",
"def valids(name = nil, type = nil)\n entries = self.find(name, type)\n return entries.select {|entry| entry.valid? }\n end",
"def find_by_name(name = nil, &block)\n all.find { |p| p.name == name.to_s }\n end",
"def test_nameItem\n f = ItemFilter.new(\"name\", \"Potion\")\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 1\n end",
"def named_t\n array = [\"Taylor\", \"Francis\", \"Bella\", \"Tori\", \"Jay\"]\n array.select do |name|\n name.start_with?(\"T\")\n end\nend",
"def name\n @elements[:name]\n end",
"def find_order(name)\n page.find(:xpath, \"//a/span/p[contains(text(), '#{name}')]\")\nend",
"def extract(node_name)\n lambda do |node|\n results = []\n results << node.send(node_name) if node.respond_to?(node_name)\n\n results.push *node.elements.select { |elem| elem.respond_to?(node_name) }.map { |elem| elem.send(node_name) }\n\n results\n end\n end",
"def key?(name)\n matches = select(name)\n matches.any?\n end",
"def elements\n find_by_tag('*')\n end",
"def findClassesThatMatch(name)\n fname = name.tr(':', '_')\n return ClassIndex.findClasses(fname)\n end",
"def filter_methods found, name\n regexp = name_regexp name\n filtered = found.find_all do |store, methods|\n methods.any? { |method| method.full_name =~ regexp }\n end\n return filtered unless filtered.empty?\n found\n end",
"def find_cool(collections)\n collections.find_all {|element| element if element.has_value?(\"cool\")}\nend",
"def find_all(name, prefix = T.unsafe(nil), partial = T.unsafe(nil), details = T.unsafe(nil), key = T.unsafe(nil), locals = T.unsafe(nil)); end",
"def name_exact name\n # exact description\n result = mobile :find, [ [ [5, name] ] ]\n\n return result if result.kind_of? Selenium::WebDriver::Element\n\n if result.length > 0\n result.first\n else\n Appium::Common.raise_no_element_error\n end\n end",
"def name_matches?(xml_node, name)\n return false unless xml_node.respond_to?(:name)\n\n return xml_node.name == name || name == '*'\n end",
"def all_items(item)\r\n result = false\r\n\r\n if(self.items.size > 0)\r\n self.items.each {|val|\r\n if (val.get_name == item.get_name )\r\n return true\r\n else\r\n result = false\r\n end\r\n }\r\n else\r\n result = false\r\n end\r\n\r\n return result\r\n end",
"def select_accounts_from_names(names)\n names.uniq!\n\n found_accounts = config.accounts.select do |account|\n names.include?(account[:name])\n end\n\n missing_accounts(names, found_accounts) unless names.length == found_accounts.length\n\n found_accounts\n end",
"def filter_methods found, name\n regexp = name_regexp name\n\n filtered = found.find_all do |store, methods|\n methods.any? { |method| method.full_name =~ regexp }\n end\n\n return filtered unless filtered.empty?\n\n found\n end",
"def multi_element_attr_check( elements )\n wanted = Array.new\n found = Array.new\n elements.each do |element|\n print \".\"\n e = $driver.find_element(element[0].to_sym, element[1])\n wanted << [ element[1], element[2], element[3] ]\n found << [ element[1], element[2], e.attribute(element[2]) ]\n end\n\n found.should == wanted\n end",
"def elements_for_select(elements)\n return [] if elements.nil?\n elements.collect do |e|\n [\n Element.display_name_for(e['name']),\n e['name']\n ]\n end\n end",
"def find_by_name(name)\n raise TypeError, 'name must respond to #to_sym' unless name.respond_to?(:to_sym)\n name = name.to_sym\n \n all.find { |event_class| event_class.name == name }\n end",
"def complex_finds_exact(class_name, value)\n find_elements :uiautomator, string_visible_exact(class_name, value)\n end",
"def [](name)\n name = name.to_sym\n raise ArgumentError, \"no such element #{name}\" unless @named_elements.key?(name)\n\n @named_elements[name]\n end"
] |
[
"0.7094345",
"0.6709751",
"0.64784753",
"0.6439569",
"0.6405609",
"0.6392193",
"0.63236105",
"0.6314487",
"0.6222358",
"0.6199703",
"0.6143943",
"0.6119726",
"0.6106085",
"0.6063704",
"0.605531",
"0.605531",
"0.6045532",
"0.6034813",
"0.602514",
"0.59543884",
"0.5943961",
"0.58680296",
"0.58524007",
"0.58524007",
"0.5844892",
"0.5842634",
"0.5819197",
"0.5805997",
"0.5781552",
"0.57678133",
"0.5755276",
"0.5725604",
"0.57223433",
"0.571686",
"0.56964153",
"0.56667405",
"0.56434053",
"0.5622223",
"0.5603908",
"0.55813706",
"0.5579287",
"0.5575639",
"0.55627805",
"0.5553382",
"0.5542515",
"0.55377346",
"0.55335176",
"0.5523767",
"0.55230016",
"0.5519473",
"0.55169326",
"0.5515718",
"0.55057997",
"0.55050296",
"0.5504545",
"0.54793686",
"0.5479045",
"0.5478444",
"0.5474324",
"0.5472083",
"0.545579",
"0.5450482",
"0.5440643",
"0.5438541",
"0.54382414",
"0.54322743",
"0.5427632",
"0.5420103",
"0.5417769",
"0.5401481",
"0.5370039",
"0.5345393",
"0.5344996",
"0.5344607",
"0.5342679",
"0.5341803",
"0.53310233",
"0.5318106",
"0.530158",
"0.52947015",
"0.52946496",
"0.5288446",
"0.5282507",
"0.5281918",
"0.5274281",
"0.52697337",
"0.5260717",
"0.52597886",
"0.5255615",
"0.5250962",
"0.5245428",
"0.5243781",
"0.5239823",
"0.522253",
"0.5222524",
"0.52167773",
"0.5211231",
"0.52087945",
"0.5206239",
"0.520543"
] |
0.7539248
|
0
|
Returns the first element matching tag_name
|
def tag tag_name
find_element :tag_name, tag_name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def first_ele tag_name\n # XPath index starts at 1\n find_element :xpath, \"//#{tag_name}[1]\"\n end",
"def find_tag(tag_name)\n r = scan(/\\<#{tag_name}\\>(.*?)\\<\\/#{tag_name}\\>/im)\n r.map{|e|e.first}\n end",
"def first_ele(class_name)\n tag(class_name)\n end",
"def first_matching_tag\n r = Registry.get\n return unless r\n\n RegistryEvent.all.find_each do |event|\n data = JSON.parse(event.data)\n _, _, tag_name = r.get_namespace_from_event(data)\n return event.dup if tag_name == @tag\n end\n\n nil\n end",
"def first_ele(class_name)\n ele_index class_name, 1\n end",
"def find_name_tag(tags)\n name_tag = tags.find { |tag| tag[:key] == \"Name\" }\n name_tag ? name_tag[:value] : nil\n end",
"def first(name=nil)\n name.nil? ? matches.first : find(name, false).first\n end",
"def find(name)\n m = match(name)\n m.count == 1 ? m[0] : nil\n end",
"def get_tag_by_name(name)\n @aws_instance_data.tags.each do |tag_data|\n return tag_data.value if tag_data.key == name\n end\n nil\n end",
"def extract_tag_name(tag)\n match = /\\A<\\/?(#{@@name})/.match(tag)\n return match[1] if match\n raise \"Cannot find tag name in tag: #{tag}\"\n end",
"def element_named(name)\n @elements.find{|e| e.name.to_s == name.to_s}\n end",
"def element(name)\n elements.find { |el| el.name == name.to_s }\n end",
"def first_value(tag)\n tag_summary(tag).first[1].first\n end",
"def find_first(name)\n find_all(name).first\n end",
"def tags tag_name\n find_elements :tag_name, tag_name\n end",
"def primary_tag\n tag = @primary_tag || my_tag_list.first\n\n if tag == NO_PRIMARY_TAG\n nil\n else\n tag\n end\n end",
"def getName(tags)\n name_tag = tags.find { |tag| tag.key == \"Name\" }\n name_tag ? name_tag.value : nil\nend",
"def extract_name_tag(tags)\n # Find the 'Name' key in the tags object and extract it. If the key isn't found, we get nil instead.\n name_tag = tags.find { |tag| tag.key == 'Name' }\n # If extracting the key/value was successful...\n if name_tag\n # ...extract the value (if there is one), or return <no name>\n !name_tag[:value].empty? ? name_tag[:value] : '<no name>'\n else\n # Otherwise, there's not a Name key, and thus the object has no name.\n '<no name>'\n end\n end",
"def single(name)\n els = @root.xpath(\"meta/#{name}[@meta='yes']\")\n els.length <= 1 or puts(\"Warning: multiple #{name.inspect} elements found.\")\n return els[0] ? els[0].content : nil\n end",
"def find_tag(t)\n r = nil\n if @tag == t\n r = self\n elsif\n begin\n each do |it|\n r = it.find_tag(t)\n break if r\n end\n rescue\n end\n end\n return r\n end",
"def find_name name\n find_element :name, name\n end",
"def lookup(name, *tags)\n xpath(tags.map{ |tag| \"./xs:#{tag}[@name='#{name}']\" }.join('|'))[0]\n end",
"def get_tag tag_key_name\n self.tags.joins(:tag_key).where('tagging_tag_keys.name = ?', tag_key_name).first\n end",
"def find( tag = nil )\n tag = Tag.new( tag, Tag.WILDCARD_NS ) unless tag.nil? || tag.is_a?( Tag )\n if block_given?\n children.find do |c|\n c.element? && ( tag.nil? || c.tag == tag ) && yield( c )\n end\n else\n first_element( tag )\n end\n end",
"def parse_tag_name( tag )\n match_name = /[^=]*/\n m = tag.match(match_name)\n return m[0]\n end",
"def [](tag)\n find { |f| f.tag == tag }\n end",
"def lookup_tag(name, parent_path)\n\t\t\tif @tags.key? name\n\t\t\t\treturn @tags[name]\n\t\t\tend\n\t\t\t\n\t\t\treturn fetch_tag(name, parent_path)\n\t\tend",
"def get_tag_name(element)\n element.tag_name\n end",
"def get_element(path)\n elements = get_elements(path)\n elements[0] if elements\n end",
"def find_first(selector, data)\n data = @data unless data\n results = (data/selector)\n if results and results.first\n results.first.inner_html.strip\n else\n nil\n end\n end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def find_eles tag_name\n @driver.find_elements :tag_name, tag_name\n end",
"def element_name() @stag.element_name end",
"def get_from_tags(resource, tag_name)\n tag_name = tag_name.to_s.downcase\n tags = resource['tags'].to_a.concat(resource['tag_set'].to_a)\n Array.wrap(tags).detect { |tag, _| tag['key'].downcase == tag_name }.try(:[], 'value').presence\n end",
"def first_subfield_value(tag)\n sf = @field.subfields.select { |sf| sf.code == tag}\n return '' if sf.empty?\n sf.first.value\n end",
"def find_first(xpath, nslist = nil)\n find(xpath, nslist).first\n end",
"def find_by_tag(tag, single = true, &block)\n find_matching(:tag, tag, single, block)\n end",
"def fetch_element(key)\n return @completed_elements.detect do |el|\n el.first.html_attribute_name == key || el.first.name == key\n end\n end",
"def find_by_name(name, field = :name)\n Tag.find_by_name(name.strip) || (fail BadRequestError.resource_not_found(field), \"Tag not found.\")\n end",
"def getNamedItem(name)\n node.getAttributeNode(name)\n end",
"def tag(name)\n tags[name.to_s] if tags\n end",
"def []( name )\n\n\t\t# Query root\n\t\tresult = @root.find_name name\n\n\t\tif result.empty?\n\t\t\tnil\n\t\telsif result.size == 1 # Only one match found\n\t\t\tresult.last.value\n\t\telse\n\t\t\tresult\n\t\tend\n\tend",
"def match_tag_name(name)\n\n name.sub!(/^c:/, '')\n\n matches = []\n\n Conf.curation_types.each do |type|\n matches.push type if type.starts_with?(name)\n end\n\n return matches[0] if matches.length == 1\n end",
"def tag()\n return @driver.get_sc_core_query_element_tag(@handle, @index)\n end",
"def my_node_tagged(tag, options={})\n my_nodes_tagged(tag, options)[0]\n end",
"def my_node_tagged(tag, options={})\n my_nodes_tagged(tag, options)[0]\n end",
"def e(name)\n for c in @children\n return c if c.is_a?(MiniXmlElement) && c.name==name\n end\n return nil\n end",
"def seek_to_tag(xml, tag_name)\n ret = true\n while ret==true && !is_a(xml, tag_name)\n ret = xml.read\n end\n ret\nend",
"def get_tag_value tag_key_name\n tag = self.tags.joins(:tag_key).where('tagging_tag_keys.name = ?', tag_key_name).includes(:tag_value).first\n tag.try(:tag_value).try(:value)\n end",
"def find_by_name(name)\n for item in self.collection\n return item if item.name == name\n end\n\n # didn't find item in collection, return nil\n return nil\n end",
"def parse_tag_with_name(tag_name, text); end",
"def get(element, name)\n lookup(key(element.to_s, name.to_s))\n end",
"def get(element, name)\n lookup(key(element.to_s, name.to_s))\n end",
"def xpath_first(outer_set, path_name)\n outer_set.xpath(path_name).first\n end",
"def value_of_node(node_name)\n value_of_nodes(node_name).first\nend",
"def to_obj(tag_name)\n @tags.each do |tag|\n if tag_name == tag.name\n Log4r::Logger.log_internal { \"Get tag: #{tag_name}\" }\n return tag\n end\n end\n nil\n end",
"def first\n @elements.empty? ? nil : @elements[0]\n end",
"def node_tagged(tag, options={})\n nodes_tagged(tag, options)[0]\n end",
"def node_tagged(tag, options={})\n nodes_tagged(tag, options)[0]\n end",
"def htmlGetTagContents(html, tagName)\n html.split(\"<#{tagName}>\")[1].split(\"</#{tagName}>\")[0]\nend",
"def select_tag_info(tag_id)\n return get_db_as_hash().execute(\"SELECT tag_name FROM tags WHERE tag_id = ?\", tag_id).first\n end",
"def search_tag(tag)\n search_text(tag.name)\n end",
"def tag_name\n return @tag_name\n end",
"def tag_name\n @tag_name ||= name && name.to_s.split(\"::\")[-1].downcase\n end",
"def [](name)\n name = name.to_sym\n raise ArgumentError, \"no such element #{name}\" unless @named_elements.key?(name)\n\n @named_elements[name]\n end",
"def getTag(tagString)\n retval = \"other\"\n tags = [\"programming\",\"travel\",\"other\"]\n tags.each do |tag|\n if tagString.downcase.match(/#{tag.downcase}/)\n retval = tag\n end\n end\n retval\n end",
"def tag_name\n self.class.name.downcase.match(/[^:]+$/)[0]\n end",
"def tag\n `#{@el}.tagName`.downcase\n end",
"def tag\n `#{@el}.tagName`.downcase\n end",
"def find_first(name)\n object = build(name)\n object.retrieve\n end",
"def node(node_name)\n nodes(node_name).first\nend",
"def first_with_tag(phrase, opts={})\n lo = opts.clone\n case_sensitive = lo.delete :case_sensitive\n phrase = phrase.downcase unless case_sensitive\n first(lo.merge(:tag_words => phrase))\n end",
"def [](name)\n # Check for attributes first. Why? It works for the LT xml (for now).\n if @node.attributes.has_key?(name)\n return @node.attributes[name].value\n end\n\n # Find child elements with that name\n children = @node.xpath(\"./lt:#{name}\")\n if children.size == 1\n child = children.first\n if self.text_element?(child)\n return child.children.first.content\n elsif child.name =~ /^[\\w]*List$/\n # LT-specific hack to simplify access to lists. Ill-advised?\n return wrap_children(child.children)\n else\n return NodeWrapper.new(child)\n end\n elsif children.size > 1\n return wrap_children(children)\n else\n return nil\n end\n end",
"def extract_single_valued_element(element_name)\n path = '//foxml:datastream[@ID=\"DC\"]/foxml:datastreamVersion'\\\n \"[@ID='#{@current_dc_version}']/foxml:xmlContent/\"\\\n 'oai_dc:dc/dc:' + element_name + '/text()'\n element = @doc.xpath(path, @ns).to_s\n element = '' if element.empty?\n @key_metadata[element_name.to_sym] = element\n end",
"def name\n tag.name\n end",
"def first( path_stack, node )\n return nil if path.size == 0\n\n case path[0]\n when :document\n # do nothing\n return first( path[1..-1], node )\n when :child\n for c in node.children\n r = first( path[1..-1], c )\n return r if r\n end\n when :qname\n name = path[2]\n if node.name == name\n return node if path.size == 3\n return first( path[3..-1], node )\n else\n return nil\n end\n when :descendant_or_self\n r = first( path[1..-1], node )\n return r if r\n for c in node.children\n r = first( path, c )\n return r if r\n end\n when :node\n return first( path[1..-1], node )\n when :any\n return first( path[1..-1], node )\n end\n return nil\n end",
"def first\n @ordered_elements.first\n end",
"def first\n matches.first\n end",
"def find_name(response, selector)\n return nil unless response.css(\"#{selector} > p.mb-0\")[0]\n\n response.css(\"#{selector} > p.mb-0\")[0].text\nend",
"def name\n tag['name'].gsub(/\\[\\]$/, '')\n end",
"def get_tag_value(key)\n get_tag(key).try(:tag_value).try(:value)\n end",
"def getFirstMatch page\n list = page.search('.findList')\n return nil if list.empty?\n return list.search('.findResult')[0].search('.result_text').children[1].attr('href')\nend",
"def dom_class_first(object, array)\n if (object == array.first)\n return \"first\"\n end\n nil\n end",
"def find_or_add\n if name\n n = name.strip.downcase\n tag = Tag.find_by(name: n) || Tag.create(name: n)\n end\n end",
"def find_first(*paths)\n xpath(*paths).first\n end",
"def by_name(name)\n elt = self[name]\n return elt unless elt.nil?\n\n @elements.each_key do |subelt_name|\n if self[subelt_name].is_a?(Model)\n elt = self[subelt_name][name]\n return elt unless elt.nil?\n end\n end\n\n nil\n end",
"def tag\n return @tag\n end",
"def name\n @elements[:name]\n end",
"def ele_index tag_name, index\n # XPath index starts at 1.\n raise \"#{index} is not a valid xpath index. Must be >= 1\" if index <= 0\n find_element :xpath, \"//#{tag_name}[#{index}]\"\n end",
"def get_token(tag, tokens)\n tokens.each do |key, value|\n if tag.index(key) != nil then\n return value\n end\n end\n\n return nil\n end",
"def match_element_name(element_name)\n match(element, element_name)\n end",
"def get_tagvalue(object, tagkey)\n value = \"\"\n if object[:tag_set]\n object[:tag_set].each do |tag|\n if tag[:key] == tagkey\n value = tag[:value]\n break\n end\n end\n end\n \n value\n end",
"def first_matching(key)\n @attributes.find do |a|\n a[0].downcase == key.downcase\n end\n end",
"def name\n _name = nil\n self.tags.each do |x|\n if x.tkey == \"name\"\n _name = x.tvalue\n end\n end\n _name\n end",
"def first_wa(elements)\n elements.find do |element|\n element.to_s.start_with?(\"wa\")\n end\nend",
"def at(xpath)\n self.find_first(xpath)\n end",
"def get_tag(tag_name)\n tag = USER_TAGS[tag_name: tag_name]\n return nil if tag == nil\n\n # create tag\n return UserTag.new(tag)\n end",
"def find_pet_by_name(section, name)\n for pet in section[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def xpath_first(doc, path, pnamespace = '')\n elements = xpath_all(doc, path, pnamespace)\n (elements != nil) ? elements.first : nil\n end"
] |
[
"0.78427315",
"0.7539798",
"0.7000159",
"0.6976029",
"0.67870736",
"0.6770968",
"0.67693603",
"0.66739005",
"0.66687083",
"0.66429824",
"0.6640506",
"0.66028047",
"0.65569204",
"0.65496385",
"0.6487704",
"0.64416623",
"0.6368279",
"0.6334703",
"0.6310857",
"0.62873346",
"0.6286377",
"0.6264413",
"0.61966515",
"0.6178684",
"0.6167209",
"0.6166199",
"0.6149341",
"0.6139031",
"0.61072266",
"0.6096716",
"0.6068959",
"0.6068959",
"0.60507774",
"0.5960829",
"0.59115845",
"0.5905061",
"0.58996505",
"0.58980584",
"0.5895101",
"0.5890226",
"0.58829874",
"0.5877848",
"0.5876617",
"0.5872354",
"0.58719546",
"0.58266276",
"0.58266276",
"0.58165324",
"0.5776179",
"0.57747215",
"0.575562",
"0.5751757",
"0.5740979",
"0.5740979",
"0.57377034",
"0.5726453",
"0.5725269",
"0.57153964",
"0.5711646",
"0.5711646",
"0.57014436",
"0.56997",
"0.56976974",
"0.56964606",
"0.56917495",
"0.56810486",
"0.56702566",
"0.56657845",
"0.5653262",
"0.5653262",
"0.56521845",
"0.56517714",
"0.5647796",
"0.5645249",
"0.5637099",
"0.56260455",
"0.56168926",
"0.56055367",
"0.5600914",
"0.55773544",
"0.55702466",
"0.5565149",
"0.5563747",
"0.5561828",
"0.5549136",
"0.553864",
"0.5537161",
"0.55347306",
"0.5522502",
"0.5522453",
"0.55217606",
"0.55177385",
"0.55100954",
"0.5502776",
"0.5491008",
"0.5483133",
"0.5483002",
"0.547911",
"0.54745156",
"0.54682034"
] |
0.70563114
|
2
|
Returns all elements matching tag_name
|
def tags tag_name
find_elements :tag_name, tag_name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_tag(tag_name)\n r = scan(/\\<#{tag_name}\\>(.*?)\\<\\/#{tag_name}\\>/im)\n r.map{|e|e.first}\n end",
"def retrieve_all_tags(element, tag = :content)\n result = []\n if(element.respond_to? tag)\n result << element.send(tag)\n end\n if element.respond_to? :children\n element.children.each do |child|\n result += retrieve_all_tags(child, tag)\n end \n end \n return result \nend",
"def find_eles tag_name\n @driver.find_elements :tag_name, tag_name\n end",
"def elements\n find_by_tag('*')\n end",
"def content_tags(name)\n array = []\n name_li(name).div(:class=>/(mylibrary_item_|searchcontent_result_)tags/).lis.each do |li|\n array << li.span(:class=>\"s3d-search-result-tag\").text\n end\n return array\n end",
"def elements_with_all_tags(tags)\n return InfoNode.elements_with_all_tags(session['domain'],tags)\n end",
"def find_names name\n find_elements :name, name\n end",
"def getElementsByTagName(tagname)\n ret = NodeList.new\n @children.each do |node|\n if node.nodeType == ELEMENT_NODE\n if tagname == '*' || node.nodeName == tagname\n ret << node\n end\n ret << node.getElementsByTagName(tagname)\n end\n end if @children\n ret\n end",
"def getElementsByTagName(tagname)\n ret = NodeList.new\n @children.each do |node|\n if node.nodeType == ELEMENT_NODE\n if tagname == '*' || node.nodeName == tagname\n ret << node\n end\n ret << node.getElementsByTagName(tagname)\n end\n end if @children\n ret\n end",
"def tags(name = nil)\n list = @tags + convert_ref_tags\n return list unless name\n list.select {|tag| tag.tag_name.to_s == name.to_s }\n end",
"def tag tag_name\n find_element :tag_name, tag_name\n end",
"def find_elements(element_name, response)\n response.body.xpath(\".//x:#{element_name}\", 'x' => response.body.namespace.href)\n end",
"def tags(class_name)\n find_elements :class, class_name\n end",
"def els(element_name)\n element_reader = get_locator(element_name)\n begin\n if element_reader.length > 0\n element_reader.each do |k,v|\n if(k=='class' || k=='css' || k=='id' || k=='xpath' || k=='partial_link_text' || k=='tag_name')\n begin\n $elems = $driver.find_elements(k.to_sym,v.to_s)\n $LOG.info \"Elements found \\n #{element_name} : #{k} => #{v}\"\n rescue Exception => e\n $LOG.error \"Element not found \"\n $LOG.error \"#{element_name} : #{k} => #{v}\"\n $LOG.error \"Error message :: \" + e.message\n raise \"Element not found \\n #{element_name} : #{k} => #{v} \\n Error Message :: \" + e.message\n end\n $elems\n end\n end\n else\n $LOG.error \"Element not present in object repository\"\n raise \"Element not present in object repository\"\n end\n $elems\n rescue Exception => e\n $LOG.error \"Error in finding the element :: \" + e.message\n raise \"Error in finding the element :: \" + e.message\n end\n end",
"def elements(selector)\n @doc.search(selector)\n end",
"def all_elements_by_name(name, options = {})\n default_options = {\n :count => :all,\n :from_page => :all,\n :language => session[:language]\n }\n options = default_options.merge(options)\n if options[:from_page] == :all\n elements = Element.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n elsif options[:from_page].class == String\n page = Page.find_by_page_layout_and_language(options[:from_page], options[:language])\n return [] if page.blank?\n elements = page.elements.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n else\n elements = options[:from_page].elements.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])\n end\n end",
"def element_named(name)\n @elements.find{|e| e.name.to_s == name.to_s}\n end",
"def tags(selector)\n e = elements(selector)\n e.map {|x| x.inner_html}\n end",
"def tags(selector)\n\t\te = elements(selector)\n\t\te.map {|x| x.inner_html}\n\tend",
"def find_tags_by_name(tag)\n ActsAsTaggableOn::Tag.includes(:taggings).where(\"taggings.context = 'tags'\").order(\"name ASC\").named_like(tag).limit(10) unless tag.blank?\n end",
"def getTags node\n array = [] #array to hold working collection\n \n node.children.each do |child|\n array << Hash[child.name,child.inner_text] unless child.name == 'text' #text \n end\n \n return array\n end",
"def cell_elements_by_name(name)\n if cell = cells.find_by_name(name)\n cell.elements\n else\n Alchemy::Logger.warn(\"Cell with name `#{name}` could not be found!\", caller.first)\n Element.none\n end\n end",
"def search_tag(tag)\n search_text(tag.name)\n end",
"def retrieve_elements(filter)\n elements_array = Array.new\n\n if NOKOGIRI\n @xml.xpath(filter.to_s).each { |pelem|\n elements_array << pelem.text if pelem.text\n }\n else\n @xml.elements.each(filter.to_s) { |pelem|\n elements_array << pelem.text if pelem.text\n }\n end\n\n if elements_array.size == 0\n return nil\n else\n return elements_array\n end\n\n end",
"def fetch_tags(url, tags)\n doc = Nokogiri::HTML(open(url))\n aux = []\n doc.xpath(tags).each do |f|\n aux << f.text\n end\n return aux\n end",
"def find_all_tagged_with(*args)\n find_tagged_with(*args)\n end",
"def all_by_tag(*tags)\n find(:all).by_tag(*tags)\n end",
"def all_by_tag(*tags)\n find(:all).by_tag(*tags)\n end",
"def elements(name, *find_args)\n build_elements(name, *find_args) do\n define_method(name) do |*runtime_args, &block|\n raise_if_block(self, name, !block.nil?, :elements)\n _all(*merge_args(find_args, runtime_args))\n end\n\n create_get_element_params(name, find_args)\n end\n end",
"def get_elements(xpath); end",
"def all_tag_elements\n applied_tag_elements + @tag_elements\n end",
"def get_tag_by_name(name)\n @aws_instance_data.tags.each do |tag_data|\n return tag_data.value if tag_data.key == name\n end\n nil\n end",
"def tag_names #helper method\n # gets tag names in an array\n self.tags.map { |tag| tag.name }\n end",
"def get_nodes_by_tag(tag, includeme=true, options={})\n options = {\n :search_string => tag,\n :include_me => includeme,\n :order => [:tag],\n :safe_deref => nil,\n :current_node => nil,\n :one_or_all => :all\n }.merge(options)\n opsit_search(options)\n end",
"def extract(node_name)\n lambda do |node|\n results = []\n results << node.send(node_name) if node.respond_to?(node_name)\n\n results.push *node.elements.select { |elem| elem.respond_to?(node_name) }.map { |elem| elem.send(node_name) }\n\n results\n end\n end",
"def get_from_tags(resource, tag_name)\n tag_name = tag_name.to_s.downcase\n tags = resource['tags'].to_a.concat(resource['tag_set'].to_a)\n Array.wrap(tags).detect { |tag, _| tag['key'].downcase == tag_name }.try(:[], 'value').presence\n end",
"def match_element_name(element_name)\n match(element, element_name)\n end",
"def nodes_tagged(tag, options={})\n found_nodes = []\n @elements.each do |e|\n if node_included?(e, options) && !node_excluded?(e, options)\n found_nodes << e if e.tag == tag\n unless options[:exclude_match] || node_descent_excluded?(e, options)\n found_nodes += e.nodes_tagged(tag, options)\n end\n end\n end\n found_nodes\n end",
"def nodes_tagged(tag, options={})\n found_nodes = []\n @elements.each do |e|\n if node_included?(e, options) && !node_excluded?(e, options)\n found_nodes << e if e.tag == tag\n unless options[:exclude_match] || node_descent_excluded?(e, options)\n found_nodes += e.nodes_tagged(tag, options)\n end\n end\n end\n found_nodes\n end",
"def for_tag(arr, tag)\n arr.select { |item| (item[:tags] || []).include?(tag) }\nend",
"def lookup(name, *tags)\n xpath(tags.map{ |tag| \"./xs:#{tag}[@name='#{name}']\" }.join('|'))[0]\n end",
"def my_tag_list\n self.taggings.order('id ASC').map(&:tag).map(&:name)\n end",
"def taglist\n\tself.tags.map {|t| t.name}\n end",
"def tag_names\n # only return the name from the associated tag object\n object.tags.map(&:name)\n end",
"def tags\n node.css(\"category\").map(&:text)\n end",
"def element(name)\n elements.find { |el| el.name == name.to_s }\n end",
"def select( tag = nil )\n tag = Tag.new( tag, Tag.WILDCARD_NS ) unless tag.nil? || tag.is_a?( Tag )\n if block_given?\n children.select do |c|\n c.element? && ( tag.nil? || c.tag == tag ) && yield( c )\n end\n else\n children.select do |c|\n c.element? && ( c.tag == tag )\n end\n end\n end",
"def parse_tag_with_name(tag_name, text); end",
"def e(name)\n for c in @children\n return c if c.is_a?(MiniXmlElement) && c.name==name\n end\n return nil\n end",
"def find_name name\n find_element :name, name\n end",
"def items(tag = nil)\n if tag.nil?\n @items\n else\n @items.select { |item| item['tags'].include? tag }\n end\n end",
"def applied_tag_elements\n @parent_element.respond_to?(:all_tag_elements) ? @parent_element.all_tag_elements : []\n end",
"def find_tagged_with(*args)\n options = find_options_for_find_tagged_with(*args)\n options.blank? ? [] : find(:all, options)\n end",
"def find_tags(url)\n\t\t\tputs \"Search and return tags within the url payload: #{url}\" if @verbose\n\t\t\ttag_list = []\n doc = open_page(url)\n doc.text.each_line do |line|\n my_line = line.downcase\n @tag_signatures.keys.map do |tag|\n tag_list.push(tag) if my_line.include?(tag)\n end\n end\n return tag_list\n rescue => ee\n puts \"Exception on method #{__method__}: #{ee}\" if @verbose\n return []\n end",
"def find_all(*args)\n element.all(*args)\n end",
"def return_all_tags\n @tags.uniq.each { |tag| puts tag }\n end",
"def find_values(tag)\n results =[]\n dictionary.each do |key, values|\n next if values.nil?\n matched_keys = values.select { |k,v| v.to_s =~ /@#{tag}( |$)/i }.keys.each do |k|\n results << k\n end\n end\n results\n end",
"def filter_tags(document)\n # Filter down and get the tags.\n @tags = document.css(TAG_CSS).map(&:children).map(&:text)\n end",
"def tagging_tags\n filtered_tags(:tagtype_x => [11, :Collection, :List])\n end",
"def tag(name); end",
"def find_name_tag(tags)\n name_tag = tags.find { |tag| tag[:key] == \"Name\" }\n name_tag ? name_tag[:value] : nil\n end",
"def list_of_tags\n tag_list\n end",
"def has_tag?(name); end",
"def parse_html(data,tag)\n return data.scan(%r{<#{tag}\\s*.*?>(.*?)</#{tag}>}im).flatten\nend",
"def tag_names\n self.tags.map(&:name).join(\", \")\n #The & symbol is used to tell Ruby that the following argument\n #should be given as a block to the method. So the line:\n #self.tags.map(&.:name).join(\", \") is equal to\n #self.tags.map { |t| t.name.join(\", \")}\n #So the above will iterate over tyhe collection of elf.tags\n #and build an array with the resukts of the name method\n #called on every item\n end",
"def [](tag)\n find { |f| f.tag == tag }\n end",
"def all\n Tag.all.map{|t| \"#{t.tag} \"}\n end",
"def tags\n @attributes.select { |k, _| tag_names.include?(k.to_s) }\n end",
"def tags\n object.tags.each do |tag|\n tag.name\n end\n end",
"def get_list_content(name, tag, container)\n eval(SELECTOR_MAPPING[container][name][tag][ELEMENT])\n end",
"def find_from(tags)\n result = []\n\n # Create a tag list from the parameter. If the parameter already contains\n # tag objects, sort them out.\n case tags\n when Array\n result, not_tags = tags.partition { |t| t.is_a?(Tag) and not t.new_record? }\n not_tags.map!(&:to_s)\n tags = TagList.from(not_tags)\n when Tag\n return [ tags ]\n else\n tags = TagList.from(tags)\n end\n\n return result if tags.empty?\n\n tags_result = find(:all, :conditions => tags_condition(tags))\n return result + tags_result\n end",
"def tags\n css_selectors = [\n '.watch-info-tag-list a', # YouTube\n '.entry .tags a', # Livejournal\n 'a[rel~=tag]', # Wordpress and many others\n 'a.tag', # Tumblr\n '.tags a',\n '.labels a',\n '.categories a',\n '.topics a'\n ]\n\n tags = []\n\n # grab the first one we get results from\n css_selectors.each do |css_selector|\n tags += @doc.css(css_selector)\n break if tags.any?\n end\n\n # convert from Nokogiri Element objects to strings\n tags.map!(&:inner_text)\n\n # remove \"#\" from hashtag-like tags\n tags.map! { |t| t.gsub(/^#/, '') }\n\n tags\n end",
"def all_tags context = :tags\n ActsAsTaggableOn::Tagging.where(context: context).select(:tag_id).distinct.includes(:tag).map(&:tag)\n end",
"def create_get_all_elements(element_name, *find_args)\n method_name = \"get_all_#{element_name}\"\n create_helper_method(method_name, *find_args) do\n define_method(method_name) do |*runtime_args|\n args = merge_args(find_args, runtime_args)\n wait_until_get_not_empty(*args)\n end\n end\n end",
"def find_attributes(name)\n\t\t\tr=[]\n\t\t\tp=self\n\t\t\twhile(p)\n\t\t\t\tif(p.respond_to?(name))\n\t\t\t\t\tv=p.send(name)\n\t\t\t\t\tr << v if(v)\n\t\t\t\tend\n\t\t\t\tbreak if(!p.respond_to?(\"container\"))\n\t\t\t\tp=p.container\n\t\t\tend\n\t\t\tr\n\t\tend",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def find_element(*names)\n traverse_element(*names) {|e| return e }\n nil\n end",
"def get_list_text_content(name, tag, container)\n eval(SELECTOR_MAPPING[container][name][tag][ELEMENT]).map{|elem| elem.text}\n end",
"def get_tag_name(element)\n element.tag_name\n end",
"def tag(name)\n tags[name.to_s] if tags\n end",
"def has_tag?(name)\n tags.any? {|tag| tag.tag_name.to_s == name.to_s }\n end",
"def tags\n match = /(.*?)[\\s\\u00A0]+\\[(?<tags>.*)\\]/.match(@node.inner_text)\n (match ? match[:tags] : '').split(' ')\n end",
"def all\n response= handle_errors{ self.class.get('/get')}\n response[\"tags\"][\"tag\"].collect do |tag| \n t= Rubycious::Tag.new(tag)\n end\n end",
"def find_tagged_with(*args)\n options = find_options_for_find_tagged_with(*args)\n options.blank? ? [] : find(:all, options)\n end",
"def tags(class_name)\n eles_by_json(typeArray: [class_name], onlyVisible: true)\n end",
"def find( tag = nil )\n tag = Tag.new( tag, Tag.WILDCARD_NS ) unless tag.nil? || tag.is_a?( Tag )\n if block_given?\n children.find do |c|\n c.element? && ( tag.nil? || c.tag == tag ) && yield( c )\n end\n else\n first_element( tag )\n end\n end",
"def search(xpath)\n return self.each_element( xpath ){}\n end",
"def tag_names\n @tag_names ||= tags.map(&:name).join(' ')\n end",
"def getName(tags)\n name_tag = tags.find { |tag| tag.key == \"Name\" }\n name_tag ? name_tag.value : nil\nend",
"def add_tag_name_query\n return if options[:tag_names].blank?\n body.must(\n :multi_match,\n field: tag_name_fields,\n query: options[:tag_names].join(\" \")\n )\n end",
"def collect_elements element\n # capture first element name\n elements = []\n # iterate text until next headline\n while true do\n elements << element\n element = element.next\n break if element.nil? || element.to_html.include?(\"class=\\\"mw-headline\\\"\")\n end\n elements\n end",
"def filter_by_tag(tag)\n get_venues_for_filtering if @venues_to_filter.empty?\n @venues_by_tag = []\n @venues_to_filter.each do |venue|\n venue[\"tags\"].each do |venue_tag|\n if venue_tag.downcase == tag.downcase\n @venues_by_tag << venue[\"name\"]\n end\n end\n end\n @venues_by_tag\n end",
"def scan_tags(&block)\n scan_all(tags_criteria, &block)\n end",
"def find_with_tags(*tags)\n options = tags.extract_options!\n self.all(options.merge(:tags => tags))\n end",
"def attributes_by_name(name)\n\t\treturn xpath('//@' + name)\n\tend",
"def get_tags() tag_ids.inject([]) { |l, tag_id| l << get_tag_from_id(tag_id) } end",
"def tags1\n return projects_tags.where(\"tags_id in (select id from tags where type_tag=?)\",1)\n end",
"def tag_names\n self.entity_tags.map(&:tag).map(&:name)\n end",
"def tag_names\n self.tags.map(&:name).join(\", \")\n end",
"def gettag()\n omnifocus.tags.get.each do |tagg|\n\t tagg.tags.get.each do |t|\n\t\t\t if t.name.get == \"Today\" \n\t\t\t\t return t\n\t\t\t end\n\t\t end \n\n end\n\n end"
] |
[
"0.70586866",
"0.6989633",
"0.6987415",
"0.6901312",
"0.6846613",
"0.6784727",
"0.67800355",
"0.67412317",
"0.67412317",
"0.660534",
"0.65162534",
"0.6489715",
"0.6460763",
"0.63751674",
"0.6366966",
"0.6337809",
"0.63238597",
"0.6221604",
"0.6213733",
"0.6167514",
"0.60797906",
"0.6047342",
"0.60148764",
"0.6011018",
"0.600686",
"0.5973247",
"0.59490395",
"0.59490395",
"0.593137",
"0.5923702",
"0.58984494",
"0.58818763",
"0.5877929",
"0.5807791",
"0.58032423",
"0.57994175",
"0.5760362",
"0.5752669",
"0.5752669",
"0.5745035",
"0.57319826",
"0.57243824",
"0.5720115",
"0.5703003",
"0.5632082",
"0.56239516",
"0.56181765",
"0.56146646",
"0.56059927",
"0.5603111",
"0.5580216",
"0.5579572",
"0.55760396",
"0.5567336",
"0.5565627",
"0.5562414",
"0.55568224",
"0.5544116",
"0.55250317",
"0.55162925",
"0.5505291",
"0.5501429",
"0.55012465",
"0.54947263",
"0.5489843",
"0.5481938",
"0.547403",
"0.5469654",
"0.54666686",
"0.54644835",
"0.5455278",
"0.54547113",
"0.54544735",
"0.5450578",
"0.5448006",
"0.54472864",
"0.54472864",
"0.54439926",
"0.54423076",
"0.5439028",
"0.5427812",
"0.5422843",
"0.54140544",
"0.5410265",
"0.5403412",
"0.5385778",
"0.5385706",
"0.5358919",
"0.53536564",
"0.5350372",
"0.53486246",
"0.5345831",
"0.5335528",
"0.5335303",
"0.5334208",
"0.53238577",
"0.5317709",
"0.5316704",
"0.5316196",
"0.53109026"
] |
0.79535556
|
0
|
Converts pixel values to window relative values ```ruby px_to_window_rel x: 50, y: 150 ```
|
def px_to_window_rel opts={}
w = $driver.window_size
x = opts.fetch :x, 0
y = opts.fetch :y, 0
OpenStruct.new( x: "#{x.to_f} / #{w.width.to_f}",
y: "#{y.to_f} / #{w.height.to_f}" )
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def screen_position_relative_to(px,py,xi,yi,sextx,sexty)\n tx = @wrapped_surface.tile_x\n ty = @wrapped_surface.tile_y\n xoff = offset_from_screen(xi*tx, px, sextx)\n yoff = offset_from_screen(yi*ty, py, sexty)\n [xoff,yoff]\n end",
"def rel_x\n return x - Graphics.width/2\n end",
"def rel_x\n return x - Graphics.width/2\n end",
"def relative_position(x, y)\n Castaway::Point.new(x, y) * production.resolution\n end",
"def window_size()\n\t@browser.window.resize_to(x, y)\nend",
"def screen_to_relative(*args)\n s = screen_position\n vec2 = Vector2[*args]\n vec2.x -= s.x\n vec2.y -= s.y\n vec2\n end",
"def relative(xr, yr)\n Position.new(x + xr, y + yr)\n end",
"def position\n @browser.command(\"Browser.getWindowBounds\", windowId: window_id).fetch(\"bounds\").values_at(\"left\", \"top\")\n end",
"def do_window_adjust(bytes); end",
"def set_window_xy(chara)\n char_x = chara.screen_x\n char_y = chara.screen_y\n self.x = char_x - ($nms.msg_w / 2)\n self.y = ((char_y - 32 - $nms.msg_h) >= 0) ? (char_y - 32 - $nms.msg_h) : (char_y + 32)\n end",
"def window_rect\n buffer = [0,0,0,0].pack('l4')\n GetWindowRect.(handle, buffer)\n return Rect.new(*buffer.unpack('l4'))\n end",
"def pbBottomRight(window)\n window.x=Graphics.width-window.width\n window.y=Graphics.height-window.height\nend",
"def PointsToPixelsX(arg0)\n ret = _invoke(1610744113, [arg0], [VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def rel_y\n return y - Graphics.height/2\n end",
"def rel_y\n return y - Graphics.height/2\n end",
"def rel_y\n return y - Graphics.height/2\n end",
"def window_rect\n manage.window.rect\n end",
"def window_rect\n manage.window.rect\n end",
"def window_rect\n manage.window.rect\n end",
"def window_width\n Graphics.width / 2\n end",
"def relative(x); x.to_f/@game.height; end",
"def get_offset\n platform = ChromedriverScreenshot::Platforms.platform\n offset_x = @x - platform.window_x\n offset_y = @y - platform.window_y\n [offset_x, offset_y]\n end",
"def local_window_size; end",
"def transform \n \n @pixel_location = get_pixel_points \n puts \"px loc : #{@pixel_location}\"\n \n while @pixel_location.size != 0 \n transform_pixel_points(@pixel_location)\n @pixel_location.shift\n @pixel_location.shift\n end\n end",
"def window_width() Graphics.width - 128 end",
"def screen_x\r\n ret = ((@real_x - self.map.display_x) / Game_Map::X_SUBPIXELS).round\r\n ret += @width * Game_Map::TILE_WIDTH / 2\r\n return ret\r\n end",
"def convert(m)\n return auto(m) if @style[m] == :auto\n return @style[m] unless @style[m].percent?\n parent = self.parent || Viewport.new\n return (@style[m] * parent.inner.width / 100.0).round if [:x, :width].include?(m)\n return (@style[m] * parent.inner.height / 100.0).round\n end",
"def update_local_window_size(size); end",
"def draw_relative(camera_x=-@camera_x, camera_y=-@camera_y, &block)\n Gamework::App.window.translate(camera_x, camera_y) { yield }\n end",
"def screen_y\n return y\n end",
"def screen_x1; @point1.screen_x; end",
"def windowed_page_numbers\n inner_window, outer_window = @options[:inner_window].to_i, @options[:outer_window].to_i\n\n # override inner window -VS\n # we want to always display all the pages\n inner_window = total_pages.to_i\n\n window_from = current_page - inner_window\n window_to = current_page + inner_window\n\n # adjust lower or upper limit if other is out of bounds\n if window_to > total_pages\n window_from -= window_to - total_pages\n window_to = total_pages\n end\n if window_from < 1\n window_to += 1 - window_from\n window_from = 1\n window_to = total_pages if window_to > total_pages\n end\n\n # these are always visible\n middle = window_from..window_to\n\n # left window\n if outer_window + 3 < middle.first # there's a gap\n left = (1..(outer_window + 1)).to_a\n left << :gap\n else # runs into visible pages\n left = 1...middle.first\n end\n\n # right window\n if total_pages - outer_window - 2 > middle.last # again, gap\n right = ((total_pages - outer_window)..total_pages).to_a\n right.unshift :gap\n else # runs into visible pages\n right = (middle.last + 1)..total_pages\n end\n\n left.to_a + middle.to_a + right.to_a\n end",
"def location(x, y, w, h)\n return x - w/2, y + 20\n end",
"def get_client_window_margin width, height, size\n width_size = width * size\n height_size = height * size\n info_size = 100\n\n margin_x = (WINDOW_WIDTH - width_size) / 2\n margin_y = (WINDOW_HEIGHT - height_size - info_size) / 2 + info_size # margin for informations display above the board\n\n { :x => margin_x, :y => margin_y }\nend",
"def windows_width\n Graphics.width / 2 + 10 # + 64\n end",
"def relative_coords(from, move)\n [from[0] + move[0], from[1] + move[1]]\n end",
"def screen_x; @screen_x; end",
"def screen_origin_x\n @cr[0] & 0x7f\n end",
"def get_position(id)\n (`xwininfo -id #{id}`).scan(/Absolute.*:\\s*(\\d*)/).flatten.map{|n| n.to_i}\nend",
"def adjust_to_relative_pos(tx,ty)\n x = tx - (self.x - @positions[:current][:x])\n y = ty - (self.y - @positions[:current][:y])\n return x,y\n end",
"def relative_to_screen(*args)\n s = screen_position\n vec2 = Vector2[*args]\n vec2.x += s.x\n vec2.y += s.y\n vec2\n end",
"def coord2pos(x, y)\n (y % h)*w+(x % w)\n end",
"def screen_x(x)\n ((x.to_f / @scene_width) * $window.width).to_i\n end",
"def reposition_window\n config = MARW_CONFIGURATION\n self.x = config[:window_x] == -1 ? (Graphics.width - window_width) / 2 : config[:window_x]\n self.y = 0\n end",
"def screen_y\n return 464\n end",
"def screen_x\n x = ((@real_x - $game_map.display_x + 3) / 4)+16\n return x\n end",
"def window_width\n end",
"def screen_x\n x = (@real_x - $game_map.display_x + 3) / 4\n return x\n end",
"def move_window_to(point_x, point_y)\n driver.manage.window.move_to(point_x, point_y)\n end",
"def windowed_page_numbers\n inner_window, outer_window = @options[:inner_window].to_i, @options[:outer_window].to_i\n window_from = current_page - inner_window\n window_to = current_page + inner_window\n \n # adjust lower or upper limit if other is out of bounds\n if window_to > total_pages\n window_from -= window_to - total_pages\n window_to = total_pages\n end\n if window_from < 1\n window_to += 1 - window_from\n window_from = 1\n window_to = total_pages if window_to > total_pages\n end\n \n visible = (1..total_pages).to_a\n left_gap = (2 + outer_window)...window_from\n right_gap = (window_to + 1)...(total_pages - outer_window)\n \n # replace page numbers that shouldn't be visible with `:gap`\n [right_gap, left_gap].each do |gap|\n if (gap.last - gap.first) > 1\n visible -= gap.to_a\n visible.insert(gap.first - 1, :gap)\n end\n end\n \n visible\n end",
"def i2p(inches)\n (inches * @target_dpi).to_i\n end",
"def PointsToPixelsY(arg0)\n ret = _invoke(1610744114, [arg0], [VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def window_height\n fitting_height(11)\n end",
"def window_height\n fitting_height(11)\n end",
"def window_height\n fitting_height(11)\n end",
"def screen_x\n return x\n end",
"def window_width\n return WINDOW_WIDTH\n end",
"def window_width\n return WINDOW_WIDTH\n end",
"def window_width\n return WINDOW_WIDTH\n end",
"def window_width\n return WINDOW_WIDTH\n end",
"def window_width\n return WINDOW_WIDTH\n end",
"def convert_coords(screen, x, y, z)\n\t\txd = x * $persp / (z + $space_size) + screen.width / 2\n\t\tyd = y * $persp / (z + $space_size) + screen.height / 2\n\t\treturn xd, yd\n\tend",
"def screen_x\n x = ((@real_x - $game_map.display_x + 3) / 4)\n return x\n end",
"def screen_x\n x = ((@real_x - $game_map.display_x + 3) / 4)\n return x\n end",
"def pid_to_hwnd\n @pid_to_hwnd = create_pid_to_hwnd_dic unless @pid_to_hwnd\n @pid_to_hwnd\n end",
"def get_doc_scale w, h\n page_w, page_h = @current_page.size\n\n scale_x = w / page_w \n scale_y = h / page_h\n\n if scale_x > scale_y\n scale_y\n else\n scale_x\n end\n end",
"def position_to_x_y(position)\n x = (position * 1.0 / @layout.ny).floor\n y = position % @layout.ny\n get_x_y(x, y)\n end",
"def location\n x_pointer = FFI::MemoryPointer.new :int, 1\n y_pointer = FFI::MemoryPointer.new :int, 1\n XDo::FFILib.xdo_get_window_location @_xdo_pointer, @_window, x_pointer,\n y_pointer, nil\n [x_pointer.read_int, y_pointer.read_int]\n end",
"def remote_window_size; end",
"def screen_y\n y = (@real_y - $game_map.display_y + 3) / 4 \n return y \n end",
"def dpi\n {:x=>dpi_x,:y=>dpi_y}\n end",
"def draw_clues_windows(clues)\n heightpx = @board.height*@scale\n widthpx = @board.width*@scale\n windows = {}\n windows[:rows] = TkCanvas.new(@root, bg: \"#aaaaaa\") { grid(:row => 1, :column => 0) }\n windows[:rows].height = heightpx\n windows[:rows].width = (@scale*clues[:rows].map { |row| row.length }.max)\n windows[:columns] = TkCanvas.new(@root, bg: \"#aaaaaa\") { grid(:row => 0, :column => 1) }\n windows[:columns].height = (@scale*clues[:columns].map { |column| column.length }.max)\n windows[:columns].width = widthpx\n windows\n end",
"def mousemove_relative(x, y)\n @logger.info(\"mousemove not supported\")\n end",
"def mvwin(y, x)\n Ncurses.mvwin(pointer, y, x)\n end",
"def screen_y\n y = ((@real_y - $game_map.display_y + 3) / 4 )+16\n return y \n end",
"def click_on_perc(id, x_p, y_p)\n # Get the size of the window\n size = get_geometry(id)\n # Scale the input percentage coordinates to absolute values, and click\n click_on(id, size[0]*x_p/100, size[1]*y_p/100)\nend",
"def relativize_points points, rel_points\n m_begin \"relativize_points\"\n raise \"invalid argument\" unless points.class == Array && rel_points.class == Array\n lastx, lasty = 0, 0\n points.each do\n |x, y|\n rel_points << [x-lastx, y-lasty]\n lastx = x\n lasty = y\n end\n m_end \"relativize_points\"\n end",
"def row_to_px row_number\n\n # Row 0 starts 5 units below the top of the grid.\n # Each row afterward is 20 units lower.\n grid.top.shift_down(5).shift_down(20 * row_number)\n end",
"def py2x(p, y)\n\t\tsx = 0\n\t\t@model.glyphs(y).each_with_index do |glyph, i|\n\t\t\treturn sx if i >= p or glyph == 10\n\t\t\tsx += measure_width(sx, glyph)\n\t\tend\n\t\tsx\n\tend",
"def screen_y\n y = ((@real_y - $game_map.display_y + 3) / 4 ) \n return y \n end",
"def screen_y\n y = ((@real_y - $game_map.display_y + 3) / 4 ) \n return y \n end",
"def maximize_ish(x = 64, y = 64, w = -128, h = -128)\n if is_headless\n x = 0; y = 0; w = -2; h = -2\n end\n width = w\n height = h\n width = \"window.screen.availWidth - #{-w}\" if w <= 0\n height = \"window.screen.availHeight - #{-h}\" if h <= 0\n if is_headless\n @driver.manage.window.position= Selenium::WebDriver::Point.new(0,0)\n max_width, max_height = @driver.execute_script(\"return [window.screen.availWidth, window.screen.availHeight];\")\n @driver.manage.window.resize_to(max_width, max_height)\n else\n @driver.manage.window.position= Selenium::WebDriver::Point.new(40,30)\n max_width, max_height = @driver.execute_script(\"return [window.screen.availWidth, window.screen.availHeight];\")\n @driver.manage.window.resize_to(max_width-90, max_height-100)\n end\n @driver.execute_script %[\n if (window.screen) {\n window.moveTo(#{x}, #{y});\n window.resizeTo(#{width}, #{height});\n };\n ]\n end",
"def adjust_x(x)\n if loop_horizontal? and x < @display_x - @margin_x\n return x - @display_x + @map.width * 256\n else\n return x - @display_x\n end\n end",
"def width\n return @window_width # outer width\nend",
"def setWindowPosition ( position )\n @ie.top = position.myTop\n @ie.left = position.myLeft\n @ie.height = position.myHeight\n @ie.width = position.myWidth\n end",
"def pixel_x; @x / PIXEL_WIDTH; end",
"def pixel_x; @x / PIXEL_WIDTH; end",
"def screen_y\n @page ? super + @page.adjusted_xy[1] : super\n end",
"def window_size\n manage.window.size\n end",
"def window_size\n manage.window.size\n end",
"def window_size\n manage.window.size\n end",
"def widget_at_relative(x, y)\n x_index = x / @tile_size\n y_index = y / @tile_size\n if x_index > @grid_width\n error(\"Asking for relative widget beyond width: #{x}\")\n return nil \n end\n if y_index > @grid_height\n error(\"Asking for relative widget beyond height: #{y}\")\n return nil \n end\n @tiles[x_index][y_index]\n end",
"def refresh_window_alignment\n self.x = case @@alignment\n when 0 then 0\n when 1 then Graphics.width/2-(width/2)\n when 2 then Graphics.width-width\n end\n end",
"def get_window_area()\n get_children_area(\"WINDOW\")\n end",
"def screen_size\n coords = execute_applescript(%Q`\n tell application \"Finder\"\n get bounds of window of desktop\n end tell\n `)\n coords = coords.split(\", \").collect {|c| c.to_i}\n to(*coords)\n end",
"def get_window; @window; end",
"def calculate_window_range(row_index, index, invader)\n row_range = (row_index..(invader.height + row_index - 1))\n column_range = (index..(invader.width + index - 1))\n\n return row_range, column_range\n end",
"def p2i(pixels)\n case pixels\n when Fixnum\n return (pixels * @target_dpi)\n when BPoint\n return BPoint.new(pixels.x * @target_dpi, pixels.y * @target_dpi)\n else \n raise \"p2i argument error\"\n end\n end",
"def screen_x\n @page ? super + @page.adjusted_xy[0] : super\n end",
"def window_parameters\n [2, 2, 316, 64]\n end"
] |
[
"0.5687661",
"0.5668153",
"0.5668153",
"0.55100274",
"0.54327255",
"0.53369206",
"0.5249425",
"0.523294",
"0.5221263",
"0.5177791",
"0.5175339",
"0.5171482",
"0.51557696",
"0.5134394",
"0.5134394",
"0.5134394",
"0.50939333",
"0.50939333",
"0.50939333",
"0.50924444",
"0.5090102",
"0.5053474",
"0.50318956",
"0.5030643",
"0.502142",
"0.49933282",
"0.49904153",
"0.49827293",
"0.49755758",
"0.49668312",
"0.49667495",
"0.49626625",
"0.49586517",
"0.4936801",
"0.4934051",
"0.49164563",
"0.48978677",
"0.48939058",
"0.48866677",
"0.4869145",
"0.48661882",
"0.4865674",
"0.48564786",
"0.4847932",
"0.48431724",
"0.47995874",
"0.47710425",
"0.47686166",
"0.47670135",
"0.4766677",
"0.4758892",
"0.47313017",
"0.47296053",
"0.47296053",
"0.47296053",
"0.47169825",
"0.47127575",
"0.47127575",
"0.47127575",
"0.47127575",
"0.47127575",
"0.47109982",
"0.4710829",
"0.4710829",
"0.47076386",
"0.47046867",
"0.4697805",
"0.4695017",
"0.46813282",
"0.4678211",
"0.46778017",
"0.46660092",
"0.46605018",
"0.46542546",
"0.46498862",
"0.4646537",
"0.46337882",
"0.46236917",
"0.46186763",
"0.46061623",
"0.46061623",
"0.46028915",
"0.45760062",
"0.45673922",
"0.45441708",
"0.45403245",
"0.45403245",
"0.4531651",
"0.4521227",
"0.4521227",
"0.4521227",
"0.45196682",
"0.4513926",
"0.45133454",
"0.45069888",
"0.4501862",
"0.44996834",
"0.44931793",
"0.44923297",
"0.44817302"
] |
0.8150688
|
0
|
Search strings.xml's values for target.
|
def xml_keys target
lazy_load_strings
@strings_xml.select { |key, value| key.downcase.include? target.downcase }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def xml_values target\n lazy_load_strings\n @strings_xml.select { |key, value| value.downcase.include? target.downcase }\n end",
"def search(target)\n end",
"def string_visible_contains_xpath(class_name, value)\n r_id = resource_id(value, \" or @resource-id='#{value}'\")\n\n if class_name == '*'\n return \"//*[contains(translate(@text,'#{value.upcase}', '#{value}'), '#{value}') \" \\\n \"or contains(translate(@content-desc,'#{value.upcase}', '#{value}'), '#{value}')\" + r_id + ']'\n end\n\n \"//#{class_name}[contains(translate(@text,'#{value.upcase}', '#{value}'), '#{value}') \" \\\n \"or contains(translate(@content-desc,'#{value.upcase}', '#{value}'), '#{value}')\" + r_id + ']'\n end",
"def only_contains_source(value)\n eles = get_sources\n\n if eles.nil? || eles.length == 0\n fail(ArgumentError.new('no results were found'))\n else\n eles.each do |source|\n unless source.text.include? value\n fail(ArgumentError.new(\"Expected source to contain '\" + value + \"' but found '\" + source.text + \"'\"))\n end\n end\n end\n end",
"def extract_shared_strings\n extract ExtractSharedStrings, 'sharedStrings.xml', 'Shared strings'\n end",
"def contains_text(target)\r\n #puts \"Text to match is : #{match_text}\"\r\n #puts \"Html is : #{self.text}\"\r\n if target.kind_of? Regexp\r\n self.text.match(target)\r\n elsif target.kind_of? String\r\n self.text.index(target)\r\n else\r\n raise ArgumentError, \"Argument #{target} should be a string or regexp.\"\r\n end\r\n end",
"def target *args\n return if @setting_path.empty?\n\n @lookup_chain.lookup @setting_path, *args\n end",
"def lookup_text\n\t\t$app.data_controller.search_matching_links_to @search_text\n\tend",
"def search_in(label, string)\n if !LABELS.include? label.to_sym\n raise ArgumentError, \"Unknown key: #{label}\"\n end\n\n find_all do |entry|\n text = entry.send(label).str\n text.match(/#{string}/i)\n end\n end",
"def find_targets(key)\n case key\n when STDOUT, STDERR\n @targets.select { |t| t.instance_variable_get(:@logdev).dev == key}\n when String\n @targets.select { |t| t.instance_variable_get(:@logdev).filename == key }\n when Regexp\n @targets.select { |t| t.instance_variable_get(:@logdev).filename =~ key }\n end\n end",
"def matching_indexes(str, target)\n (0..str.length-1).select { |i| str[i] == target}\n end",
"def run(source, target)\n # Current words include your starting word\n @current_words = [source]\n # Create hash with source as key/value pair\n @all_seen_words = Hash[[[source,source]]]\n until @all_seen_words.include?(target)\n new_current_words = []\n # Iterate through the current words you have\n @current_words.each do |current_word|\n # p current_word\n # Filter current words that have not been seen\n explore_current_words(current_word,new_current_words)\n end\n # update @current_words\n @current_words = new_current_words\n end\n # Record all the words that you have seen\n @last_word = @all_seen_words\n build_path(source, target)\n end",
"def string_visible_contains(class_name, value)\n value = %(\"#{value}\")\n if class_name == '*'\n return (resource_id(value, \"new UiSelector().resourceId(#{value});\") +\n \"new UiSelector().descriptionContains(#{value});\" \\\n \"new UiSelector().textContains(#{value});\")\n end\n\n class_name = %(\"#{class_name}\")\n resource_id(value, \"new UiSelector().className(#{class_name}).resourceId(#{value});\") +\n \"new UiSelector().className(#{class_name}).descriptionContains(#{value});\" \\\n \"new UiSelector().className(#{class_name}).textContains(#{value});\"\n end",
"def run(source_word, target_word)\n @current_words = [source_word]\n @all_seen_words = {source_word => nil}\n\n until @current_words.empty?\n explore_current_words(@current_words)\n break if @all_seen_words.has_key?(target_word)\n end\n \n build_path(target_word).include?(source_word) ? @path : nil\n \n end",
"def search_str(to, po)\n # final value\n s_val = []\n\n # convert into array\n t_arr = to.split('')\n p_arr = po.split('')\n\n # get the count of lookup array\n t_len = t_arr.count - 1\n p_len = p_arr.count - 1\n nxt_ctr = 0 # counter\n\n # loop at t array\n t_arr.each_with_index do |_v, i|\n # break if the counter reached the last element\n break if p_len == t_len\n\n # Compare the set of values in an array with the p array\n s_val << i if t_arr[nxt_ctr..p_len] == p_arr\n\n # Increment the next counter set\n nxt_ctr += 1\n p_len += 1\n end\n s_val\nend",
"def complex_finds_contains(class_name, value)\n find_elements :uiautomator, string_visible_contains(class_name, value)\n end",
"def findWord(query, array_of_strings)\n\t#array_of_strings.select {|str| str.match(query) }\n #array_of_strings.any? {|i| i[query] }\n array_of_strings.reject {|x| x.match (/#{query}/) }\nend",
"def shared_strings\n @shared_strings ||= Nokogiri::XML( zipfile.read(\"xl/sharedStrings.xml\") ).css('si>t').collect(&:text)\n end",
"def match(*strings)\n result = []\n @tags.each do |tag|\n strings.each do |string|\n if string.downcase =~ /#{tag.downcase}/\n strings.delete string\n result << tag\n break\n end\n end\n end\n return result\n end",
"def resolve_name(target)\n if (group = @group_lookup[target])\n group.all_targets\n else\n # Try to wildcard match targets in inventory\n # Ignore case because hostnames are generally case-insensitive\n regexp = Regexp.new(\"^#{Regexp.escape(target).gsub('\\*', '.*?')}$\", Regexp::IGNORECASE)\n\n targets = @groups.all_targets.select { |targ| targ =~ regexp }\n targets += @groups.target_aliases.select { |target_alias, _target| target_alias =~ regexp }.values\n\n if targets.empty?\n raise(WildcardError, target) if target.include?('*')\n [target]\n else\n targets\n end\n end\n end",
"def is_known\n TargetsXML.has_target(@name)\n end",
"def xpath_contains(node, selector, value)\n node.xpath(\"#{selector}//text()[contains(translate(., \\\"#{value.upcase}\\\", \\\"#{value}\\\"), \\\"#{value}\\\")]\")\n end",
"def set_SearchString(value)\n set_input(\"SearchString\", value)\n end",
"def set_SearchString(value)\n set_input(\"SearchString\", value)\n end",
"def find_entry!(string)\n string = string.upcase\n [ string, words.get(string) ] if words.has_key?(string)\n end",
"def word_finder (arr, str)\n arr.select do |value|\n value.include? str\n end\nend",
"def resolve_id id\n lazy_load_strings\n @strings_xml[id]\n end",
"def complex_find_contains(class_name, value)\n find_element :uiautomator, string_visible_contains(class_name, value)\n end",
"def texts(value = false)\n return tags TEXT_VIEW unless value\n\n complex_finds_contains TEXT_VIEW, value\n end",
"def search\n Dir.glob(@config.target_file_pattern, File::FNM_CASEFOLD).each do |file_path|\n next if FileTest.directory?(file_path)\n\n extension = get_extension(file_path)\n tokens = get_tokens(file_path, extension)\n search_romaji(extension, tokens, file_path)\n end\n\n nil\n end",
"def find_eles_by_attr_include tag, attr, value\n @driver.find_elements :xpath, %Q(#{tag}[contains(@#{attr}, '#{value}')])\n end",
"def targets\n target.split(NAMESPACE_PATTERN)\n end",
"def targets\n target.split(NAMESPACE_PATTERN)\n end",
"def target_ids\n @target_ids ||= node.xpath('span/target')\n .map { |target| target.attr('id') }\n end",
"def texts_exact(value)\n if automation_name_is_xcuitest?\n visible_elements = tags static_text_class\n elements_exact visible_elements, value\n else\n eles_by_json_visible_exact static_text_class, value\n end\n end",
"def targets\n ['Barn 0 - 14', 'Ung 15 - 24', 'Voksen 25 - 65', 'Eldre 65 +']\n end",
"def target_set\n return @children['target-set'][:value]\n end",
"def literal_searches(ast)\n ast.xpath(\"//method_add_arg[fcall/ident/@value = 'search' and count(descendant::string_embexpr) = 0]/descendant::tstring_content\")\n end",
"def literal_searches(ast)\n ast.xpath(\"//method_add_arg[fcall/ident/@value = 'search' and count(descendant::string_embexpr) = 0]/descendant::tstring_content\")\n end",
"def search_project_paths(word)\n\t\n\t# Collect all .as and .mxml files with a filename that contains the search\n\t# term. When used outside a project this step is skipped.\n\tTextMate.each_text_file do |file|\n\t\t\n\t\tif file =~ /\\b#{word}\\w*\\.(as|mxml)$/\n\t\t\t\n\t\t\tpath = file.sub( $project, \"\" );\n\t\t\t\n\t\t\tcommon_src_dirs.each do |remove|\n\t\t\t\tpath = path.gsub( /^.*\\b#{remove}\\b\\//, '' );\n\t\t\tend\n\n\t\t\tpath = path.gsub(/\\.(as|mxml)$/,'').gsub( \"/\", \".\").sub(/^\\./,'')\n\n\t\t\tif path =~ /\\.#{word}$/\n\t\t\t\t$best_paths << path\n\t\t\telse\n\t\t\t\t$package_paths << path\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\tend\n\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend",
"def environment_variable_contains(name, text)\n name, text = name.to_s, text.to_s\n if ENV['os'] =~ /win/i\n # use set | findstr to avoid shell substitution, which does not appear to work reliably with Kernel.system\n command = \"set #{name} | findstr /c:\\\"#{text}\\\"\"\n command << ' > NUL 2>&1' unless logger.debug?\n else\n command = \"echo $#{name} | grep '#{text}'\"\n end\n @commands << command\n end",
"def scan_target\n target = inspec_config.final_options[\"target\"]\n URI.parse(target)&.host\n end",
"def lookup target, *arg\n\t\t\toutput = arg[0] ? arg[0] : Array.new\n\t\t\tnode = @root\n\n\t\t\t# If this is a string process each character\n\t\t\tif String(target) == target\n\t\t\t\ttarget.each_char do |char|\n\t\t\t\t\t# Follow the failures until a goto transition is found\n\t\t\t\t\t# or we return to the root node.\n\t\t\t\t\twhile(!node.goto(char) and !node.eql? @root)\n\t\t\t\t\t\tnode = node.failure\n\t\t\t\t\tend\n\n\t\t\t\t\t# If there is a goto transition follow it; otherwise, \n\t\t\t\t\t# we can assume we are at the root node.\n\t\t\t\t\tif node.goto(char)\n\t\t\t\t\t\tnode = node.goto(char)\n\n\t\t\t\t\t\tif node.output\t\t\n\t\t\t\t\t\t\tif block_given?\n\t\t\t\t\t\t\t\toutput = yield output, node.output\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\toutput = output + node.output\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # Otherwise, target should support \"each\" method.\n\t\t\t\tfor item in target\n\t\t\t\t\t# Follow the failures until a goto transition is found\n\t\t\t\t\t# or we return to the root node.\n\t\t\t\t\twhile(!node.goto(item) and !node.eql? @root)\n\t\t\t\t\t\tnode = node.failure\n\t\t\t\t\tend\n\n\t\t\t\t\t# If there is a goto transition follow it; otherwise, \n\t\t\t\t\t# we can assume we are at the root node.\n\t\t\t\t\tif node.goto(item)\n\t\t\t\t\t\tnode = node.goto(item)\n\n\t\t\t\t\t\tif node.output\t\t\n\t\t\t\t\t\t\tif block_given?\n\t\t\t\t\t\t\t\toutput = yield output, node.output\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\toutput = output + node.output\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn output\n\t\tend",
"def test_find_words_multiple\n words = ['apple','candy','bat']\n dict = Set['apple','bat','candy','cat']\n assert_equal Set[\"apple\",\"candy\"], @grapher.find_words(words, dict)\n end",
"def search(term)\n all.select do |unit|\n unit.aliases.any? { |str| Regexp.new(term).match(str) }\n end\n end",
"def my_array_finding_method(source, thing_to_find)\n result = [] # result is the output array\n source.each do |word|\n word_array = word.to_s.split(//) # This creates an array of charaters of 'word'\n if word_array.include?(thing_to_find)\n result.push(word)\n end\n end\n return result\nend",
"def search(word)\n \n end",
"def lookup_specific(words)\n words = @delimiter_handler.split_path(words.first) if words.size == 1\n load_for_prefix(words)\n tool = @mutex.synchronize { get_tool_data(words, false)&.cur_definition }\n finish_definitions_in_tree(words) if tool\n tool\n end",
"def known(words)\n return words.find_all {true } #find all words for which condition is true,\n #you need to figure out this condition\n \n end",
"def complex_finds_exact(class_name, value)\n find_elements :uiautomator, string_visible_exact(class_name, value)\n end",
"def texts(value = false)\n return tags static_text_class unless value\n\n if automation_name_is_xcuitest?\n visible_elements = tags static_text_class\n elements_include visible_elements, value\n else\n eles_by_json_visible_contains static_text_class, value\n end\n end",
"def find_by_value_str(value_str)\n value_str = value_str.to_s\n by_value_str[value_str]\n end",
"def get_matching_strings(prefix)\n puts \"Matching for #{prefix}\"\n ptr = @root\n for i in 0..prefix.size-1\n ptr = ptr.children[prefix[i]]\n return nil unless ptr\n end\n arr = []\n arr << prefix if ptr.is_leaf\n arr << get_strings(ptr, prefix)\n arr\n end",
"def texts_exact(value)\n complex_finds_exact TEXT_VIEW, value\n end",
"def search_for_a_node( nokogiri_nodeset, text_key_word )\n matches_found = 0\n\n # Convert node content to text lines and scan them all:\n nokogiri_nodeset.text.split(\"\\n\").each do |line|\n# DEBUG\n# puts line\n matches_found += 1 if !( line =~ /#{ text_key_word }/ui ).nil?\n end\n matches_found\n end",
"def shstrings\n strings = Sharedstrings.new()\n File.open(@destination + '/xl/sharedStrings.xml', 'r') do |f|\n Ox.sax_parse(strings, f)\n end\n @sharedstrings=strings.stringarray\n end",
"def known(words)\n #find all words for which condition is true,you need to figure out this condition\n known_words = words.find_all {|w| @dictionary.has_key?(w)} \n return known_words\n end",
"def texts text\n @driver.find_elements :xpath, \"//*[contains(@text, '#{text}')]\"\n end",
"def search(*targets)\n @socket ||= new_socket\n\n if targets.empty? then\n send_search 'ssdp:all'\n else\n targets.each do |target|\n if target == :root then\n send_search 'upnp:rootdevice'\n elsif Array === target and target.first == :device then\n target = [DEVICE_SCHEMA_PREFIX, target.last]\n send_search target.join(':')\n elsif Array === target and target.first == :service then\n target = [SERVICE_SCHEMA_PREFIX, target.last]\n send_search target.join(':')\n elsif String === target and target =~ /\\A(urn|uuid|ssdp):/ then\n send_search target\n end\n end\n end\n\n listen\n sleep @timeout\n\n responses = []\n responses << @queue.pop until @queue.empty?\n responses\n ensure\n stop_listening\n @socket.close if @socket and not @socket.closed?\n @socket = nil\n end",
"def test_find_words_valid\n words = ['apple','bat','cat']\n dict = Set['apple','bat','cat']\n assert_equal Set[\"apple\"], @grapher.find_words(words, dict)\n end",
"def read_xml(filename=$g_language_strings)\n filename = $g_lang_strings_file\n all_strings_hash={}\n\n config = XmlSimple.xml_in(filename, {'KeyAttr' => 'resources/String'})\n config['string'].each do |var|\n all_strings_hash[var[\"name\"]]=var[\"content\"]\n end\n\n return all_strings_hash\n end",
"def text_search(target_string)\n\t\t# NOTE: always search all entities, not just the ones that are on screen\n\t\t# (not sure how you should let the user know that there are entities that have been found, but which are not currently on the screen)\n\t\ttext_objects = @space.entities.select{|x| x.is_a? ThoughtTrace::Text }\n\t\t\n\t\thighlight_mapping = \n\t\t\ttext_objects.map do |text|\n\t\t\t\ti = text.string.index target_string\n\t\t\t\t\n\t\t\t\t[text, i, i+target_string.size] if i\n\t\t\tend\n\t\thighlight_mapping.compact!\n\t\t\n\t\t\n\t\t\n\t\t# highlight the portions of the string the match the search query\n\t\tcolor = Gosu::Color.argb(0x99FF0000)\n\t\t\n\t\thighlight_mapping.each do |text, start_i, end_i|\n\t\t\t# NOTE: width_of_first may break for i=1, because it handles conversion weird. need to totally overhaul that\n\t\t\tax = text.width_of_first(start_i)\n\t\t\tbx = text.width_of_first(end_i)\n\t\t\t\n\t\t\theight = text[:physics].shape.height\n\t\t\toffset = height / 2\n\t\t\t\n\t\t\tp = text[:physics].body.p\n\t\t\ta = CP::Vec2.new(ax, offset) + p\n\t\t\tb = CP::Vec2.new(bx, offset) + p\n\t\t\t\n\t\t\tThoughtTrace::Drawing.draw_line(\n\t\t\t\t$window, a,b, \n\t\t\t\tcolor:color, thickness:height, line_offset:0.5, z_index:0\n\t\t\t)\n\t\tend\n\tend",
"def text target, *words\n\t\t\twords = [words].flatten\n\t\t\ttxt = [@data['text'][target]].flatten.sample\n\t\t\treturn nil if (txt.nil?)\n\t\t\treturn Input.substitute txt, words unless (words.empty?)\n\t\t\treturn txt\n\t\tend",
"def extract_localisedstrings(elem)\n elem.xpath(\"./string\").each do |s|\n s.name = elem.name\n end\n elem.replace(elem.children)\n end",
"def find_eles_by_text_include tag, text\n find_eles_by_attr_include tag, :text, text\n end",
"def my_array_finding_method(source, thing_to_find)\n source.select { |word| word.to_s.include? thing_to_find}\nend",
"def exact_match(user_word)\n @loader.arr.each do |word|\n return word if word == user_word\n end\n end",
"def my_array_finding_method(source, thing_to_find)\n source.select { |word| word.to_s.include? thing_to_find }\nend",
"def my_array_finding_method(source, thing_to_find)\n match_words = []\n source.each do |word| \n for i in 0...word.to_s.length\n if thing_to_find === word[i]\n match_words.push(word)\n break\n end\n end\n end\n return match_words\nend",
"def command_matched(val, target)\n _, cmd_data = commands.commands.find do |name, data|\n prefix = convert_to_regex(Pry.config.command_prefix)\n prefix = \"(?:#{prefix})?\" unless data.options[:use_prefix]\n\n command_regex = /^#{prefix}#{convert_to_regex(name)}(?!\\S)/\n\n if command_regex =~ val\n if data.options[:interpolate]\n val.replace(interpolate_string(val, target))\n command_regex =~ val # re-match with the interpolated string\n end\n true\n end\n end\n\n [cmd_data, (Regexp.last_match ? Regexp.last_match.captures : nil), (Regexp.last_match ? Regexp.last_match.end(0) : nil)]\n end",
"def matched_words\n _matched_words\n end",
"def multi_source_text_check(texts)\n texts.each do |text|\n page_text = $driver.page_source\n page_text.gsub!(/<[^>]*>/, '')\n page_text.gsub!(/\\s+/, ' ')\n page_text.should include( text )\n print \".\"\n end\n end",
"def my_array_finding_method(source, thing_to_find)\n result = source.select{ |word| word.to_s.include? (thing_to_find) }\n result\nend",
"def search_words\n begin\n regex = Regexp.new(@pattern)\n rescue RegexpError => msg\n error_msg(msg)\n rescue NameError => msg\n error_msg(msg)\n end\n @results = DICT.select do |word|\n regex =~ word\n end\n @num_results = @results.length\n format_results\n display_results\n end",
"def target_names\n targets ? targets.map(&:to_sym) : nil\n end",
"def search(word, list)\n\tlist.each do |item|\n\t\tif item == word\n\t\t\tp \" '#{item}' was found\" \n\t\tend\n\tend\nend",
"def match_text text\n @lookups.each do |rx_curr|\n return true if text =~ rx_curr\n end\n false\n end",
"def contains str, settings\n return false unless settings.instance_of? String\n return false if settings.empty?\n settings.split('|').inject(false) { |r, t| true if str == t }\n end",
"def processValues(keyword, values) #:doc:\n new_values = []\n if keyword == \"type\" or keyword == \"search\" or keyword == \"filename\" or keyword == \"path\"\n values.each do |value|\n new_values.push(\"%\" + value + \"%\")\n end\n return new_values\n end\n return values\n end",
"def parse_value_rexml(value, ns_strs, language)\n # Fixme\n end",
"def wordInStrings(word, strings)\n for string in strings do\n\n if string.include? word\n return true\n end\n end\n\n return false\nend",
"def search_string\n @search_string\n end",
"def textfields(value = false)\n return tags EditText unless value\n complex_finds_contains EditText, value\n end",
"def literal_searches(ast)\n return [] unless ast.respond_to?(:xpath)\n ast.xpath(\"//method_add_arg[fcall/ident/@value = 'search' and\n count(descendant::string_embexpr) = 0]/descendant::tstring_content\")\n end",
"def texts_exact(value)\n eles_by_json_visible_exact UIAStaticText, value\n end",
"def find_entries_by(name, value)\n values = [*value]\n (self.entries || []).find_all do |entry|\n raw_value = entry.send(:localized_dynamic_attribute_value, name)\n values.include?(raw_value)\n end\n end",
"def find_extracted_text(file_set:)\n find_exactly_one_file_by_use(\n file_set: file_set,\n use: Hyrax::FileMetadata::Use::EXTRACTED_TEXT\n )\n end",
"def lookup text\r\n result = self.class.get '/lookup', { query:{ key:@@api_key, lang:@@lang, text:text } }\r\n check_result result \r\n end",
"def find_replacement_translations(locale, variant_words, translations)\n pp \"Processing #{locale} strings\"\n unchanged = []\n to_be_replaced = []\n variant_words.each do |dict|\n current = dict[:source]\n origin = dict[:origin]\n replacement = dict[:target]\n # keeping a tally of how many will not change due to both current\n # and replacement being the same\n if current == replacement\n unchanged << { current: current, replacement: replacement }\n next\n end\n if current == '--'\n t = translations.where('copy LIKE ?', \"%#{origin}%\")\n puts \"#{t.count} strings found in #{locale} for #{origin}\"\n else\n t = translations.where('copy LIKE ?', \"%#{current}%\")\n puts \"#{t.count} strings found in #{locale} for #{current}\"\n end\n # t = translations.where(source_copy: source)\n # count = t.count\n # t = t.concat(fuzzy_match)\n unless (t.nil? or t.empty?) && current[0] != replacement[0]\n # pp \"#{current[0]} matched #{replacement[0]}\"\n t.each do |row|\n # exact match with word boundaries around the word\n # this will prevent words being part of ids/classes\n # and it will also prevent words like \"Unenroll\"\n # it's looking for \"enroll\"\n unless row.copy.match(/#{current}\\b/)\n next\n end\n if current[0] == replacement[0]\n pp \"#{current} will be replaced with #{replacement}\"\n end\n rep = {\n locale: locale,\n source: row.source_copy,\n current: row.copy,\n replacement: row.copy && row.copy.gsub(current, replacement),\n id: row.id,\n word: replacement,\n }\n if rep[:current] != rep[:replacement]\n puts \"Current and replacmeent match: #{rep[:current]} == #{rep[:replacement]}\"\n begin\n if rep[:replacement].strip_html_tags == rep[:replacement]\n to_be_replaced << rep\n else\n pp \"Stripped #{rep[:replacement]} and didn't add to list\"\n end\n end\n end\n end\n end\n end\n puts \"Ignoring: #{unchanged.size} strings\"\n puts \"Changing: #{to_be_replaced.size} strings\"\n to_be_replaced\nend",
"def lookup_replacement(source)\n source.provides.map {|tag| replacement_map[tag] }.compact[0]\n end",
"def my_array_finding_method(source, thing_to_find)\n make_string = source.map { |e| e.to_s }\n make_string.select { |e| e.include?(thing_to_find) }\nend",
"def search_values_in_quotes\n search_string.scan(REGEX_WORD_IN_QUOTES)\n end",
"def extract_items_xml_android(xml_content)\n xml = Nokogiri::XML.parse(xml_content)\n strings = xml.xpath('//string')\n items = Hash.new\n strings.each do |string|\n name = string.attributes['name'].value\n value = string.children.text.gsub(/\\\\'/) {|s| \"'\"}\n items[name] = value\n end\n items\n end",
"def texts(value = false)\n return tags UIAStaticText unless value\n eles_by_json_visible_contains UIAStaticText, value\n end",
"def search(word)\r\n \r\n end",
"def values(xpath_string, key)\n if !@values.has_key?(key)\n @values[key] = REXML::XPath.match(@xml, xpath_string).map {|node|\n # handle empty nodes like <value xsi:nil=\"true\" />\n if node.has_text?\n if block_given?\n # format the String with the supplied block\n yield(node.text)\n else\n # default: return a String\n node.text\n end\n else\n nil\n end\n }\n end\n @values[key]\n end",
"def find_by_value_str(value_str)\n value_str = value_str.to_s\n by_value.each do |value, instance|\n return instance if value_str == value.to_s\n end\n nil\n end",
"def complex_find_exact(class_name, value)\n find_element :uiautomator, string_visible_exact(class_name, value)\n end",
"def find_text_page file_name\n @text_files_hash.each_value.find do |file|\n file.full_name == file_name\n end\n end",
"def string_value?(value)\n string = value.to_s\n [NonWordMatcher, KeywordMatcher].any? { |matcher|\n matcher.match string\n }\n end"
] |
[
"0.8225673",
"0.5321005",
"0.5236756",
"0.5168079",
"0.49839833",
"0.49510354",
"0.49488974",
"0.49461907",
"0.4926971",
"0.49149278",
"0.48948312",
"0.48937523",
"0.48863024",
"0.48487574",
"0.48290277",
"0.47890753",
"0.47845688",
"0.47787997",
"0.47732252",
"0.47699475",
"0.47647074",
"0.4755875",
"0.47358364",
"0.47353894",
"0.4733057",
"0.47301957",
"0.4720917",
"0.4718414",
"0.469726",
"0.46942285",
"0.46731928",
"0.4667948",
"0.4667948",
"0.46632212",
"0.46588695",
"0.46476224",
"0.46300995",
"0.46287128",
"0.46287128",
"0.46280313",
"0.461075",
"0.4609378",
"0.4606221",
"0.45976338",
"0.45934466",
"0.4589095",
"0.45880595",
"0.45848954",
"0.45739266",
"0.45726424",
"0.45640486",
"0.4551654",
"0.45493376",
"0.4543119",
"0.4538684",
"0.45373034",
"0.45353746",
"0.45211786",
"0.45171204",
"0.4515771",
"0.4513964",
"0.4511954",
"0.4504158",
"0.4502094",
"0.44965267",
"0.4492855",
"0.44838876",
"0.44761232",
"0.44758537",
"0.44731936",
"0.44706112",
"0.446405",
"0.4463007",
"0.44617203",
"0.44590372",
"0.44447768",
"0.44377917",
"0.44337818",
"0.44294038",
"0.4428841",
"0.4427821",
"0.4424257",
"0.4403448",
"0.44000557",
"0.43959007",
"0.438629",
"0.43752763",
"0.43729275",
"0.43715647",
"0.43714282",
"0.43617424",
"0.43479154",
"0.43459207",
"0.43457365",
"0.43433577",
"0.43402207",
"0.43399382",
"0.43389097",
"0.4335367",
"0.43353656"
] |
0.71313924
|
1
|
Search strings.xml's keys for target.
|
def xml_values target
lazy_load_strings
@strings_xml.select { |key, value| value.downcase.include? target.downcase }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def xml_keys target\n lazy_load_strings\n @strings_xml.select { |key, value| key.downcase.include? target.downcase }\n end",
"def search(target)\n end",
"def search_in(label, string)\n if !LABELS.include? label.to_sym\n raise ArgumentError, \"Unknown key: #{label}\"\n end\n\n find_all do |entry|\n text = entry.send(label).str\n text.match(/#{string}/i)\n end\n end",
"def run(source, target)\n # Current words include your starting word\n @current_words = [source]\n # Create hash with source as key/value pair\n @all_seen_words = Hash[[[source,source]]]\n until @all_seen_words.include?(target)\n new_current_words = []\n # Iterate through the current words you have\n @current_words.each do |current_word|\n # p current_word\n # Filter current words that have not been seen\n explore_current_words(current_word,new_current_words)\n end\n # update @current_words\n @current_words = new_current_words\n end\n # Record all the words that you have seen\n @last_word = @all_seen_words\n build_path(source, target)\n end",
"def find_source_keys\n @source_keys ||= begin\n if (grep_out = run_grep)\n grep_out.split(\"\\n\").map { |r|\n key = r.match(/['\"](.*?)['\"]/)[1]\n if key.start_with? '.'\n absolutize_key key, r.split(':')[0]\n else\n key\n end\n }.uniq.reject { |k| k !~ /^[\\w.\\#{}]+$/ }\n else\n []\n end\n end\n end",
"def find_targets(key)\n case key\n when STDOUT, STDERR\n @targets.select { |t| t.instance_variable_get(:@logdev).dev == key}\n when String\n @targets.select { |t| t.instance_variable_get(:@logdev).filename == key }\n when Regexp\n @targets.select { |t| t.instance_variable_get(:@logdev).filename =~ key }\n end\n end",
"def run(source_word, target_word)\n @current_words = [source_word]\n @all_seen_words = {source_word => nil}\n\n until @current_words.empty?\n explore_current_words(@current_words)\n break if @all_seen_words.has_key?(target_word)\n end\n \n build_path(target_word).include?(source_word) ? @path : nil\n \n end",
"def find(keys)\n ::I18n::Commands::Keys.new.find(keys, normalize(options))\n end",
"def search(key)\n results = structs.keys.grep(/#{key}/)\n shortened_names = results.map { |result| result.gsub(\"#{key}.\", '') }\n shortened_names.zip(structs.values_at(*results)).to_h.merge(global)\n end",
"def test_find_words_multiple\n words = ['apple','candy','bat']\n dict = Set['apple','bat','candy','cat']\n assert_equal Set[\"apple\",\"candy\"], @grapher.find_words(words, dict)\n end",
"def test_find_words_valid\n words = ['apple','bat','cat']\n dict = Set['apple','bat','cat']\n assert_equal Set[\"apple\"], @grapher.find_words(words, dict)\n end",
"def search_project_paths(word)\n\t\n\t# Collect all .as and .mxml files with a filename that contains the search\n\t# term. When used outside a project this step is skipped.\n\tTextMate.each_text_file do |file|\n\t\t\n\t\tif file =~ /\\b#{word}\\w*\\.(as|mxml)$/\n\t\t\t\n\t\t\tpath = file.sub( $project, \"\" );\n\t\t\t\n\t\t\tcommon_src_dirs.each do |remove|\n\t\t\t\tpath = path.gsub( /^.*\\b#{remove}\\b\\//, '' );\n\t\t\tend\n\n\t\t\tpath = path.gsub(/\\.(as|mxml)$/,'').gsub( \"/\", \".\").sub(/^\\./,'')\n\n\t\t\tif path =~ /\\.#{word}$/\n\t\t\t\t$best_paths << path\n\t\t\telse\n\t\t\t\t$package_paths << path\n\t\t\tend\n\t\t\t\n\t\tend\n\t\t\n\tend\n\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend",
"def search_for_a_node( nokogiri_nodeset, text_key_word )\n matches_found = 0\n\n # Convert node content to text lines and scan them all:\n nokogiri_nodeset.text.split(\"\\n\").each do |line|\n# DEBUG\n# puts line\n matches_found += 1 if !( line =~ /#{ text_key_word }/ui ).nil?\n end\n matches_found\n end",
"def find_entry!(string)\n string = string.upcase\n [ string, words.get(string) ] if words.has_key?(string)\n end",
"def search_for_a_node_after_another( nokogiri_nodeset, first_key_word, last_key_word )\n matches_found = 0\n start_copy = false\n\n # Convert node content to text lines and scan them all:\n nokogiri_nodeset.text.split(\"\\n\").each do |line|\n\n # Search for a terminator key only if we have begun:\n if start_copy\n start_copy = false if !( line =~ /#{ last_key_word }/ui ).nil?\n # Increase sequences found on end copy:\n matches_found += 1 if !start_copy\n# DEBUG\n puts line if start_copy\n\n # Search for a start only if we haven't already found one:\n else\n start_copy = !( line =~ /#{ first_key_word }/ui ).nil?\n end\n end\n matches_found\n end",
"def get_matching_strings(prefix)\n puts \"Matching for #{prefix}\"\n ptr = @root\n for i in 0..prefix.size-1\n ptr = ptr.children[prefix[i]]\n return nil unless ptr\n end\n arr = []\n arr << prefix if ptr.is_leaf\n arr << get_strings(ptr, prefix)\n arr\n end",
"def extract_shared_strings\n extract ExtractSharedStrings, 'sharedStrings.xml', 'Shared strings'\n end",
"def known(words)\n #find all words for which condition is true,you need to figure out this condition\n known_words = words.find_all {|w| @dictionary.has_key?(w)} \n return known_words\n end",
"def search_all_paths(word)\n\n\tsearch_project_paths(word)\n\tsearch_bundle_paths(word)\n\t\n\t$best_paths.uniq!\n\t$package_paths.uniq!\n\t\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend",
"def semantic_search_keys \n semantic_search_map.keys\n end",
"def string_include_key?(string, key)\n \nend",
"def string_include_key?(string, key)\n \nend",
"def string_include_key?(string, key)\n \nend",
"def matching_keys(name)\n matched_keys = []\n @all_se.each_key do |k|\n if /#{name}/.match(k)\n matched_keys << k\n end\n end\n matched_keys\n end",
"def find(prefix)\n\t\tfound_entries = entries.select do |key, value|\n\t\t\tkey[0...prefix.length] == prefix\n\t\tend\n\tend",
"def lookup_text\n\t\t$app.data_controller.search_matching_links_to @search_text\n\tend",
"def my_include?(dict, query)\n dict.each do |valid_word|\n if valid_word == query\n return true\n end\n end\n return false\nend",
"def checking_dictionary_for_word_match\n valid_word?(@prefix)\n end",
"def urls\n keys.map{ |k| k[/^#{prefix}(.*)/, 1] }\n end",
"def find_match(key, value, key_str, search_str)\n \tif value.kind_of?(Array)\n \t\tvalue.each do |element_value|\n \t\t\t#puts \"key: \" + key + \", element_value: \" + element_value\n \t\t\tif (find_match(key, element_value, key_str, search_str))\n \t\t\t\treturn true\n \t\t\tend\n \t\tend\n\telsif value.kind_of?(Hash)\n\t\tvalue.each do |element_key, element_value|\n\t\t\tif (find_match(element_key, element_value, key_str, search_str))\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\telse\n\t\tif (key == key_str && value.to_s == search_str)\n\t\t\treturn true\n\t\tend\n\tend\n\treturn false\n end",
"def with_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*namespaces, *targets, *keys].join('_').upcase\n end",
"def with_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*namespaces, *targets, *keys].join('_').upcase\n end",
"def search_keys(query)\n @storage.search_keys(query)\n end",
"def search(keywords)\n\n # Create key pool\n @tmp = keywords.split(\" \")\n\n # Check if data pool contain any key of key pool\n @tmp.each do |k|\n\n # Create data pool\n @tmp_data = \"#{self.id} #{self.name} #{self.link} #{self.description}\"\n\n # If contained then return true\n if(@tmp_data.include? k)\n return true\n end\n end\n\n # If not contained then return false\n return false\n end",
"def search_in(files, host, options = {})\n files.flat_map { |file| KnownHosts.new(file).keys_for(host, options) }\n end",
"def search\n Dir.glob(@config.target_file_pattern, File::FNM_CASEFOLD).each do |file_path|\n next if FileTest.directory?(file_path)\n\n extension = get_extension(file_path)\n tokens = get_tokens(file_path, extension)\n search_romaji(extension, tokens, file_path)\n end\n\n nil\n end",
"def target *args\n return if @setting_path.empty?\n\n @lookup_chain.lookup @setting_path, *args\n end",
"def search_bundle_paths(word)\n\t\n\t# Open Help dictionary and find matching lines\n\ttoc = ::IO.readlines($help_toc)\n\ttoc.each do |line|\n\t\tif line =~ /href='([a-zA-Z0-9\\/]*\\b#{word}\\w*)\\.html'/\n\t\t\t\n\t\t\tpath = $1.gsub( \"/\", \".\")\n\t\t\t\n\t\t\tif path =~ /\\.#{word}$/\n\t\t\t\t$best_paths << path\n\t\t\telse\n\t\t\t\t$package_paths << path\n\t\t\tend\n\t\t\t\n\t\tend\n\tend\n\t\n\t{ :exact_matches => $best_paths, :partial_matches => $package_paths }\n\t\nend",
"def search(*targets)\n @socket ||= new_socket\n\n if targets.empty? then\n send_search 'ssdp:all'\n else\n targets.each do |target|\n if target == :root then\n send_search 'upnp:rootdevice'\n elsif Array === target and target.first == :device then\n target = [DEVICE_SCHEMA_PREFIX, target.last]\n send_search target.join(':')\n elsif Array === target and target.first == :service then\n target = [SERVICE_SCHEMA_PREFIX, target.last]\n send_search target.join(':')\n elsif String === target and target =~ /\\A(urn|uuid|ssdp):/ then\n send_search target\n end\n end\n end\n\n listen\n sleep @timeout\n\n responses = []\n responses << @queue.pop until @queue.empty?\n responses\n ensure\n stop_listening\n @socket.close if @socket and not @socket.closed?\n @socket = nil\n end",
"def matching_indexes(str, target)\n (0..str.length-1).select { |i| str[i] == target}\n end",
"def match_fetched(sources, targets)\n # match source => target based on the key\n matches = super\n # match residual targets, if any, on a relaxed criterion\n if matches.size != targets.size and not sources.empty? then\n match_fetched_residual(sources, targets, matches)\n end\n matches\n end",
"def match(source_filename)\n matched = elements.detect do |element|\n if element.kind_of?(::Hash)\n element.each do |key, value|\n return value if source_filename_match?(source_filename, key)\n\n return key if source_filename_match?(source_filename, value)\n end\n false\n else\n source_filename_match? source_filename, element\n end\n end\n\n matched.kind_of?(::String) ? Inflection.to_constant_name(matched) : matched\n end",
"def grep_cmd\n sprintf 'grep -Fq \"%s\" %s', key_set_string, @file\n end",
"def search pattern\n\t\tresults = all.map {|key|\n\t\t\tkey if key.to_s =~ /#{pattern}/i\n\t\t}\n\t\tresults.delete nil\n\t\tresults\n\tend",
"def findBy(key, value = nil)\n args = key.respond_to?('keys') ? key :{key => value}\n words = MinWords::DB[:words].where(args).all\n words.map { |e| e.merge(definitions: definitions(e)) }[0]\n end",
"def lookup_specific(words)\n words = @delimiter_handler.split_path(words.first) if words.size == 1\n load_for_prefix(words)\n tool = @mutex.synchronize { get_tool_data(words, false)&.cur_definition }\n finish_definitions_in_tree(words) if tool\n tool\n end",
"def optional_target_names\n optional_targets.keys.select { |key| key.to_s.start_with?(\"subscribing_to_\") }.map { |key| key.slice(15..-1) }\n end",
"def checking_dictionary_for_word_match\n @prefix = @str[@i_last_real_word...@i]\n \n if valid_word?(@prefix)\n if @skip_counter > 0\n @skip_counter -= 1\n else\n @words[i] = @prefix\n @i_last_real_word = @i\n end\n end\n end",
"def keywords_neighbors target = :all\n\t\t\t\tcase target\n\t\t\t\twhen :all\n\t\t\t\t\treturn @data['keywords_neighbors']\n\t\t\t\telse\n\t\t\t\t\treturn nil unless (@data['keywords_neighbors'].keys.include? target)\n\t\t\t\t\treturn @data['keywords_neighbors'][target]\n\t\t\t\tend\n\t\t\tend",
"def prefix_match(prefix)\n val = []\n database.each do |k, v|\n if k.downcase.start_with?(prefix)\n val.push(v)\n end\n end\n if val.size == 0\n val = ['Key Not Found!']\n end\n val\n end",
"def search(word)\n \n end",
"def resolve_name(target)\n if (group = @group_lookup[target])\n group.all_targets\n else\n # Try to wildcard match targets in inventory\n # Ignore case because hostnames are generally case-insensitive\n regexp = Regexp.new(\"^#{Regexp.escape(target).gsub('\\*', '.*?')}$\", Regexp::IGNORECASE)\n\n targets = @groups.all_targets.select { |targ| targ =~ regexp }\n targets += @groups.target_aliases.select { |target_alias, _target| target_alias =~ regexp }.values\n\n if targets.empty?\n raise(WildcardError, target) if target.include?('*')\n [target]\n else\n targets\n end\n end\n end",
"def search_words\n begin\n regex = Regexp.new(@pattern)\n rescue RegexpError => msg\n error_msg(msg)\n rescue NameError => msg\n error_msg(msg)\n end\n @results = DICT.select do |word|\n regex =~ word\n end\n @num_results = @results.length\n format_results\n display_results\n end",
"def with_prefixes_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *targets, *keys].join('_').upcase\n end",
"def with_prefixes_namespaces_targets_key_for(keys = EMPTY_ARRAY)\n [*prefixes, *namespaces, *targets, *keys].join('_').upcase\n end",
"def find_by_reference_keys(*array_of_keys)\n find_current :all, :conditions => [\"(#{array_of_keys.collect { |r| \"#{connection.quote_column_name('references')} LIKE ?\" } * ' OR '})\", *array_of_keys.collect { |r| \"%[#{[r.last, r.first] * ':'}]%\" }]\n end",
"def string_visible_contains_xpath(class_name, value)\n r_id = resource_id(value, \" or @resource-id='#{value}'\")\n\n if class_name == '*'\n return \"//*[contains(translate(@text,'#{value.upcase}', '#{value}'), '#{value}') \" \\\n \"or contains(translate(@content-desc,'#{value.upcase}', '#{value}'), '#{value}')\" + r_id + ']'\n end\n\n \"//#{class_name}[contains(translate(@text,'#{value.upcase}', '#{value}'), '#{value}') \" \\\n \"or contains(translate(@content-desc,'#{value.upcase}', '#{value}'), '#{value}')\" + r_id + ']'\n end",
"def find_values(tag)\n results =[]\n dictionary.each do |key, values|\n next if values.nil?\n matched_keys = values.select { |k,v| v.to_s =~ /@#{tag}( |$)/i }.keys.each do |k|\n results << k\n end\n end\n results\n end",
"def remove_unused_keys_and_write_to_file(target=nil, search_pattern=nil)\n save_to = target.nil? ? file_path : target\n keys_to_write = remove_unused_keys(save_to, search_pattern)\n Translate::File.new(save_to).write(keys_to_write)\n end",
"def find_all *keys\n ensure_service!\n lookup_res = service.lookup(*Array(keys).flatten.map(&:to_grpc),\n transaction: @id)\n LookupResults.from_grpc lookup_res, service, nil, @id\n end",
"def find_text_page file_name\n @text_files_hash.each_value.find do |file|\n file.full_name == file_name\n end\n end",
"def match(*strings)\n result = []\n @tags.each do |tag|\n strings.each do |string|\n if string.downcase =~ /#{tag.downcase}/\n strings.delete string\n result << tag\n break\n end\n end\n end\n return result\n end",
"def searching\n prepare_phrases.each do |phrase|\n searching_single(phrase)\n end\n end",
"def search(start_key, end_key, limit, offset, reverse, with_keys)\n offset ||= 0\n \n start_node = find_by_prefix(start_key, reverse)\n !start_node and return []\n \n start_node = skip_nodes(start_node, offset, reverse)\n !start_node and return []\n \n collect_values(start_node, end_key, limit, reverse, with_keys)\n end",
"def search_prefixes(data)\n _search_prefixes(data, SEARCHABLE)\n end",
"def string_include_key?(string, key)\n return false if string.length < key.length\n key.each_char do |ele|\n return true if string.include?(ele)\n end\n\n \nend",
"def dns_find(key)\n \n end",
"def get_keyword\n Dir.glob(\"#{@suite.suite_root}/tests/**/*_test.rb\") {|f|\n file_contents = File.read(f)\n return /^#.*@keywords(.*$)/.match(file_contents)[0].gsub(/^#.*@keywords/, '').strip if /#{self.class.name}/.match(file_contents)\n }\n end",
"def find_keys(attribute, match, value)\n search = search_with_store(self.store, attribute, match, value)\n error_ptr = Pointer.new(:id)\n searchResults = search.searchObjectsWithReturnType(NSFReturnKeys, error:error_ptr)\n raise NanoStoreError, error_ptr[0].description if error_ptr[0]\n searchResults\n end",
"def my_array_finding_method(source, thing_to_find)\n match_words = []\n source.each do |word| \n for i in 0...word.to_s.length\n if thing_to_find === word[i]\n match_words.push(word)\n break\n end\n end\n end\n return match_words\nend",
"def lookups; end",
"def find(prefix)\n # Iterate over BasicFoods for prefix\n @basic_foods.keys.each do |name|\n if name.downcase.start_with? prefix.downcase # convert both to downcase as case insensitive\n print(name)\n end\n end\n # Iterate over Recipes for prefix\n @recipes.keys.each do |name|\n if name.downcase.start_with? prefix.downcase # convert both to downcase as case insensitive\n print(name)\n end\n end\n end",
"def match_string( tree, string )\n # puts \"Checking for `#{string}` in tree (#{tree}).\"\n\n if tree.empty?\n # puts \"Tree is empty, returning empty\"\n return [ ]\n\n elsif string.empty?\n # puts \"No search string, returning empty\"\n return [ ]\n\n else\n matches = [ ]\n\n tree.each do |key,val|\n # puts \"Checking for `#{string}` in `#{key}` branch.\"\n\n simdex = string.simdex(key)\n\n if 0 < simdex\n if string == key\n # puts \"Matched full word! #{string} is #{key}\"\n # matches = collect_keys(val, key).unshift(key)\n return collect_keys(val, key).unshift(key)\n # puts \"Got matches: #{matches}\"\n\n else\n leaf = string.leaf(simdex)\n # puts \"Got leaf #{leaf}\"\n\n check = match_string(val, leaf)\n # puts \"Got check: #{check}\"\n\n if !check.empty?\n # matches = (check.map { |m| key + m })\n return check.map { |m| key + m }\n # puts \"New matches: #{matches}\"\n end\n end\n\n # break\n\n else\n check = match_string(val, string)\n\n if !check.empty?\n matches += check\n end\n end\n end\n\n # if matches.empty?\n # # puts \"No matches (#{string})\"\n # else\n # # puts \"Returning matches (#{string}): #{matches}\"\n # end\n\n return matches\n end\n end",
"def findWord(query, array_of_strings)\n\t#array_of_strings.select {|str| str.match(query) }\n #array_of_strings.any? {|i| i[query] }\n array_of_strings.reject {|x| x.match (/#{query}/) }\nend",
"def search(term)\n all.select do |unit|\n unit.aliases.any? { |str| Regexp.new(term).match(str) }\n end\n end",
"def generate_paths(dict, string, paths = [])\n dict.each do |word|\n next if string.index(word).nil?\n paths.push(word) if string.index(word).zero?\n end\nend",
"def text_search(target_string)\n\t\t# NOTE: always search all entities, not just the ones that are on screen\n\t\t# (not sure how you should let the user know that there are entities that have been found, but which are not currently on the screen)\n\t\ttext_objects = @space.entities.select{|x| x.is_a? ThoughtTrace::Text }\n\t\t\n\t\thighlight_mapping = \n\t\t\ttext_objects.map do |text|\n\t\t\t\ti = text.string.index target_string\n\t\t\t\t\n\t\t\t\t[text, i, i+target_string.size] if i\n\t\t\tend\n\t\thighlight_mapping.compact!\n\t\t\n\t\t\n\t\t\n\t\t# highlight the portions of the string the match the search query\n\t\tcolor = Gosu::Color.argb(0x99FF0000)\n\t\t\n\t\thighlight_mapping.each do |text, start_i, end_i|\n\t\t\t# NOTE: width_of_first may break for i=1, because it handles conversion weird. need to totally overhaul that\n\t\t\tax = text.width_of_first(start_i)\n\t\t\tbx = text.width_of_first(end_i)\n\t\t\t\n\t\t\theight = text[:physics].shape.height\n\t\t\toffset = height / 2\n\t\t\t\n\t\t\tp = text[:physics].body.p\n\t\t\ta = CP::Vec2.new(ax, offset) + p\n\t\t\tb = CP::Vec2.new(bx, offset) + p\n\t\t\t\n\t\t\tThoughtTrace::Drawing.draw_line(\n\t\t\t\t$window, a,b, \n\t\t\t\tcolor:color, thickness:height, line_offset:0.5, z_index:0\n\t\t\t)\n\t\tend\n\tend",
"def source_locations(key)\n locations[key]\n end",
"def lookup(source_or_key)\n case source_or_key\n when nil\n nil\n when String\n lookup(Tag[source_or_key])\n when Tag\n provides_map[source_or_key]\n when SourceFile\n source_or_key\n else\n raise \"Illegal lookup query. Expected String, Tag or SourceFile, \" <<\n \"given #{source_or_key.inspect}, an instance of #{source_or_key.class.name}.\"\n end\n end",
"def keys_for(key = EMPTY_STRING)\n key.split(NAMESPACE_PATTERN)\n end",
"def keys_for(key = EMPTY_STRING)\n key.split(NAMESPACE_PATTERN)\n end",
"def by_target\n targets.\n map { |t| [t.object, @matches[t].map { |m| m.candidate.object }] }.\n to_h.\n freeze\n end",
"def my_array_finding_method(source, thing_to_find)\n result = [] # result is the output array\n source.each do |word|\n word_array = word.to_s.split(//) # This creates an array of charaters of 'word'\n if word_array.include?(thing_to_find)\n result.push(word)\n end\n end\n return result\nend",
"def search_prefixes(str, pos= 0, len= -1)\n end",
"def read_xml(filename=$g_language_strings)\n filename = $g_lang_strings_file\n all_strings_hash={}\n\n config = XmlSimple.xml_in(filename, {'KeyAttr' => 'resources/String'})\n config['string'].each do |var|\n all_strings_hash[var[\"name\"]]=var[\"content\"]\n end\n\n return all_strings_hash\n end",
"def found_match(str)\n\tif dictionary.include?(str) # returns true if found in the dictionary\n\t\treturn str # don't stop the recursion, but return the word ?\n\tend\n\tfalse\nend",
"def icl_find( args )\n prefix = args.downcase\n @foodDB.foodbase.each_key do | item |\n check = item.downcase\n if (check.index(prefix) == 0)\n icl_print( @foodDB.get(item) )\n end\n end\n end",
"def find_songs_for_key_value(a_key, a_value)\n \n songs_for_key_value = self.lib.songs.find_all do |song|\n #skip song if it has a nil value. Otherwise string methods downcase and include would fail\n if (song.metadata[a_key] != nil)\n song.metadata[a_key].downcase.include?(a_value.downcase)\n end\n end\n songs_for_key_value\n end",
"def only_contains_source(value)\n eles = get_sources\n\n if eles.nil? || eles.length == 0\n fail(ArgumentError.new('no results were found'))\n else\n eles.each do |source|\n unless source.text.include? value\n fail(ArgumentError.new(\"Expected source to contain '\" + value + \"' but found '\" + source.text + \"'\"))\n end\n end\n end\n end",
"def search_str(to, po)\n # final value\n s_val = []\n\n # convert into array\n t_arr = to.split('')\n p_arr = po.split('')\n\n # get the count of lookup array\n t_len = t_arr.count - 1\n p_len = p_arr.count - 1\n nxt_ctr = 0 # counter\n\n # loop at t array\n t_arr.each_with_index do |_v, i|\n # break if the counter reached the last element\n break if p_len == t_len\n\n # Compare the set of values in an array with the p array\n s_val << i if t_arr[nxt_ctr..p_len] == p_arr\n\n # Increment the next counter set\n nxt_ctr += 1\n p_len += 1\n end\n s_val\nend",
"def search_key\n \"#{location}_search\".to_sym\n end",
"def method_missing(m)\n if @options[:tags].keys.include?(m)\n links = []\n @options[:tags][m].each do |selector, attribute|\n find_matches(links, selector, attribute)\n end\n links.uniq\n else\n puts \"Warning: There was no configuration on how to find #{m} links\"\n []\n end\n end",
"def searchFor\n %w{*.lua */*.lua}\n end",
"def lookup_key(translations, key)\n translations[key]\n end",
"def probe_words(index, str, r)\n key = str[0..index+1]\n if index < str.size\n if find?(key)\n index = 0; str.slice!(key); next_char = str[0]\n if !next_char.nil? && find?(nkey = key + next_char)\n r << nkey; str.slice!(0)\n else\n r << key\n end\n end\n probe_words(index+1, str, r)\n end\n end",
"def search_in(files, host, options = T.unsafe(nil)); end",
"def iterate_nodes(string_key)\n returned_values = []\n pos = self.get_node_pos(string_key)\n @_sorted_keys[pos, @_sorted_keys.length].each do |ring_index|\n key = @ring[ring_index]\n next if returned_values.include?(key)\n returned_values.push(key)\n end\n \n @_sorted_keys.each_index do |i|\n break if i >= pos\n\n key = @ring[@_sorted_keys[i]]\n next if returned_values.include?(key)\n returned_values.push(key) \n end\n\n returned_values\n end",
"def extract_target_entries\n extract_host_entries\n extract_event_entries\n extract_service_entries\n extract_note_entries\n extract_vuln_entries\n extract_web_entries\n end",
"def lookup target, *arg\n\t\t\toutput = arg[0] ? arg[0] : Array.new\n\t\t\tnode = @root\n\n\t\t\t# If this is a string process each character\n\t\t\tif String(target) == target\n\t\t\t\ttarget.each_char do |char|\n\t\t\t\t\t# Follow the failures until a goto transition is found\n\t\t\t\t\t# or we return to the root node.\n\t\t\t\t\twhile(!node.goto(char) and !node.eql? @root)\n\t\t\t\t\t\tnode = node.failure\n\t\t\t\t\tend\n\n\t\t\t\t\t# If there is a goto transition follow it; otherwise, \n\t\t\t\t\t# we can assume we are at the root node.\n\t\t\t\t\tif node.goto(char)\n\t\t\t\t\t\tnode = node.goto(char)\n\n\t\t\t\t\t\tif node.output\t\t\n\t\t\t\t\t\t\tif block_given?\n\t\t\t\t\t\t\t\toutput = yield output, node.output\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\toutput = output + node.output\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse # Otherwise, target should support \"each\" method.\n\t\t\t\tfor item in target\n\t\t\t\t\t# Follow the failures until a goto transition is found\n\t\t\t\t\t# or we return to the root node.\n\t\t\t\t\twhile(!node.goto(item) and !node.eql? @root)\n\t\t\t\t\t\tnode = node.failure\n\t\t\t\t\tend\n\n\t\t\t\t\t# If there is a goto transition follow it; otherwise, \n\t\t\t\t\t# we can assume we are at the root node.\n\t\t\t\t\tif node.goto(item)\n\t\t\t\t\t\tnode = node.goto(item)\n\n\t\t\t\t\t\tif node.output\t\t\n\t\t\t\t\t\t\tif block_given?\n\t\t\t\t\t\t\t\toutput = yield output, node.output\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\toutput = output + node.output\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn output\n\t\tend",
"def search(word, list)\n\tlist.each do |item|\n\t\tif item == word\n\t\t\tp \" '#{item}' was found\" \n\t\tend\n\tend\nend"
] |
[
"0.8241746",
"0.55252695",
"0.54091",
"0.5388197",
"0.53785586",
"0.5298476",
"0.52643234",
"0.5139001",
"0.5093662",
"0.50899166",
"0.50600827",
"0.50233185",
"0.50185484",
"0.500125",
"0.49780494",
"0.4973376",
"0.49718812",
"0.4944831",
"0.49233717",
"0.49118966",
"0.48931244",
"0.48931244",
"0.48931244",
"0.48924342",
"0.48830944",
"0.48710254",
"0.48570085",
"0.4836509",
"0.48063555",
"0.4799964",
"0.47987983",
"0.47987983",
"0.4789027",
"0.47796866",
"0.47681907",
"0.47650754",
"0.47465947",
"0.47419944",
"0.4740605",
"0.47381583",
"0.4722731",
"0.471732",
"0.4712971",
"0.4705963",
"0.47051072",
"0.47037444",
"0.47035292",
"0.4680934",
"0.46699396",
"0.46645674",
"0.46581998",
"0.4645431",
"0.46431246",
"0.464232",
"0.464232",
"0.46417892",
"0.46394894",
"0.46356547",
"0.4635178",
"0.46350247",
"0.4632511",
"0.46307442",
"0.4624819",
"0.4618759",
"0.46176174",
"0.46142337",
"0.46110928",
"0.46057403",
"0.46002558",
"0.45939463",
"0.45926362",
"0.4589762",
"0.45803025",
"0.45759654",
"0.45710775",
"0.45692992",
"0.45567834",
"0.45539153",
"0.45513394",
"0.45510128",
"0.45510128",
"0.4544445",
"0.45396832",
"0.45360658",
"0.4533552",
"0.45293936",
"0.45285872",
"0.45279834",
"0.4518894",
"0.4518564",
"0.45172164",
"0.45151722",
"0.45094788",
"0.45089015",
"0.45055544",
"0.450217",
"0.45009172",
"0.4500901",
"0.44963703",
"0.44957763"
] |
0.753793
|
1
|
Resolve id in strings.xml and return the value.
|
def resolve_id id
lazy_load_strings
@strings_xml[id]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def id(id)\n # Android auto resolves strings.xml ids\n find_element :id, id\n end",
"def get_localized_string(id)\n $g_localized_strings||=read_xml($g_lang_strings_file)\n if $g_localized_strings[id]==nil\n puts(\"id #{id} string not found\")\n fail(\"id #{id} string not found\")\n end\n return $g_localized_strings[id]\n end",
"def element_id(str)\n find_element(:id, str)\n end",
"def getIdString\r\n\t\t\t\t\r\n\t\t\t\t\treturn @idString\r\n\t\t\t\t\t\r\n\t\t\t\tend",
"def getIdString\r\n\t\t\t\t\r\n\t\t\t\t\treturn @idString\r\n\t\t\t\t\t\r\n\t\t\t\tend",
"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 resolve(id)\n case id\n when SHA, nil then id\n else rev_parse(id).first\n end\n end",
"def lookup(id)\n id_num = id\n settings.data[id_num]\n end",
"def ids(id)\n # Android auto resolves strings.xml ids\n find_elements :id, id\n end",
"def get_id(id)\n native_id = Integer(id.split(\":\")[-1])\n end",
"def lookup_id(arg)\n all_by_id[arg]\n end",
"def text_id\n \"#{name} (##{id})\"\n end",
"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 name\n return text_get(0, id)\n end",
"def id\n attr_val('cda:act/cda:id/@root')\n end",
"def id(string)\n return if string.blank?\n\n URI(string)\n .path\n .split(\"/\")\n .last\n .to_i\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 get_resource_value(res_id)\n if res_id.is_a? String\n res_id = res_id.hex\n end\n\n # R.id integers are a concatenation of package_id, type_id, and entry index\n res_package = (res_id >> 24) & 0xFF\n res_type = (res_id >> 16) & 0xFF\n res_index = res_id & 0xFFFF\n\n package_element = @packages[res_package]\n if package_element == nil\n # This is not a resource we can parse\n return nil\n end\n\n res_spec = package_element.type_data[res_type-1]\n if res_spec == nil\n puts \"Could not find ResTypeSpec for #{res_package} #{res_type}\" if DEBUG\n return nil\n end\n\n entries = res_spec.types.entries[res_index]\n if entries == nil\n puts \"Could not find #{res_spec.types.id} ResType chunk\" if DEBUG\n return nil\n end\n\n return entries\n end",
"def get id\n @map[id] || (raise \"#{id} not registered\")\n end",
"def id\n value[0]\n end",
"def i18n_id\n name.split(\"::\").map{|c| c.underscore}.join(\".\")\n end",
"def getIdFromString(option)\n str = option.split(\" \")\n str[1].to_i\nend",
"def id\n get_val(:id)\n end",
"def actual_id\n args = params[:id].split('-')\n args[0]\n end",
"def id\n read_attr :id, :to_sym\n end",
"def from_id(id, type=DEFAULT_ID_TYPE)\n case type\n when :inchikey\n url = \"http://www.chemspider.com/InChI.asmx/InChIKeyToInChI?inchi_key=\" + URI::encode(id)\n doc_string = retrieve_info_from_url(url)\n doc = REXML::Document.new( doc_string )\n inchi_string = doc.root.children.first.to_s\n raise(ArgumentError, \"did not retrieve a valid inchi string\") unless inchi_string[/^InChI=/]\n from_string(inchi_string, :inchi)\n when :lmid # lipidmaps id\n url = \"http://www.lipidmaps.org/data/LMSDRecord.php?OutputType=SDF&Mode=File&LMID=\" + id\n doc_string = retrieve_info_from_url(url)\n from_string(doc_string, :sdf)\n end\n end",
"def get_element id\n @elements[id.to_s]\n end",
"def get_id\n default_id = self.class.to_s.split('::').last\n default_id[0] = default_id[0].downcase\n return default_id\n end",
"def resolve_ShellVariable(id)\n if /\\$/ =~ id # use ShellVariable\n /\\$(\\w+)/ =~ id # $1 = ShellVariable \n shell = $1\n set = @SDC_DB.set\n if set[\"#{shell}\"] == nil\n $WARNING_CNT += 1\n printf(\"@W: Shell Variable\\(%s\\) is not defined. So,\\\"%s\\\" attribute is skipped\\n\",shell, id) if $VERBOSE\n return nil\n else\n original = (\"$\" + \"#{shell}\").to_s\n original_s = (\"\\\\$\" + \"#{shell}\").to_s\n modified = @SDC_DB.set[\"#{shell}\"].to_s\n id = id.gsub(\"#{original}\",\"#{modified}\")\n if ((/#{original_s}/ =~ id ) != nil)\n printf(\"@W: Shell Variable\\(%s\\) found same line. So,\\\"%s\\\" attribute is skipped\\n\",shell, id) if $VERBOSE\n return nil\n end\n end\n else\n end\n return id\n end",
"def parse_msg_id(str, opt={})\n msg_id_list(str, opt)[0]\n end",
"def convert_string_id_to_integer(string_id)\n string_id.bytes.join.to_i\nend",
"def result\n Valkyrie::ID.new(value.sub(/^id-/, ''))\n end",
"def parse_id(fhir_formulary)\n\t\treturn fhir_formulary.id\n\tend",
"def id\n @entry.at_xpath('cda:act/cda:id/@root').value\n end",
"def id\n name.gsub(':', '-')\n end",
"def mission_id_to_locale_id(id)\n \"m_#{id}\"\nend",
"def read_element_text_byid(id)\n if element_id(id).text != nil\n return element_id(id).text\n else\n return nil\n end\n end",
"def lookup_id_for(attribute, value)\n return value if attribute == 'id'\n project_list = get(\"/rest/api/2/project\")\n project_list.each do |project|\n return project['id'] if project[attribute] == value\n end\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 get_string\n get_item ? get_item.alert.id : ''\n end",
"def id_for_token(str)\n fstr = str.dup.freeze\n id = @translations_to_ids[fstr]\n\n # Nonexistent? Create a new one\n if id.nil? then\n id = (@ids_to_translations.keys.max || -1) + 1\n @ids_to_translations[id] = fstr\n @translations_to_ids[fstr] = id\n end\n\n return id\n end",
"def _id=(value)\n @id = value.to_s\n end",
"def get_resource_key(res_id, xml_format=false)\n if res_id.is_a? String\n res_id = res_id.hex\n end\n\n # R.id integers are a concatenation of package_id, type_id, and entry index\n res_package = (res_id >> 24) & 0xFF\n res_type = (res_id >> 16) & 0xFF\n res_index = res_id & 0xFFFF\n\n package_element = @packages[res_package]\n if package_element == nil\n # This is not a resource we can parse\n return nil\n end\n\n res_spec = package_element.type_data[res_type-1]\n if res_spec == nil\n puts \"Could not find ResTypeSpec for #{res_package} #{res_type}\" if DEBUG\n return nil\n end\n\n entry = res_spec.types.entries[res_index]\n if entry == nil\n # There is no entry in our table for this resource\n puts \"Could not find #{res_spec.types.id} ResType chunk\" if DEBUG\n return nil\n end\n\n if xml_format\n return \"@#{res_spec.id}/#{entry.values[0].key}\"\n else\n return \"R.#{res_spec.id}.#{entry.values[0].key}\"\n end\n end",
"def string(string_id, skip_ampersand = true)\n string = driver.getString(string_id, skip_ampersand)\n end",
"def extract_id(object)\n extract_string object, :id\n end",
"def generate_id(str); end",
"def return_id\n\t\treturn @idStr\n\tend",
"def title_by_id(value)\n query = 'id:\"' + value + '\"'\n result = Blacklight.solr.select(params: { q: query })\n doc = result['response']['docs'].first\n name = doc.blank? ? value : Array(doc['title_tesim']).first\n rescue\n value\n end",
"def title_by_id(value)\n query = 'id:\"' + value + '\"'\n result = Blacklight.solr.select(params: { q: query })\n doc = result['response']['docs'].first\n name = doc.blank? ? value : Array(doc['title_tesim']).first\n rescue\n value\n end",
"def extract_id(tag)\n tag =~ /id=\"([^\"]+)\"/\n $1\n end",
"def lookup_url\n @config.lookup_opts[:url].sub('$:id$', @params[:id].to_s)\n end",
"def target_id\n attr_val('./*/cda:id/@root')\n end",
"def embed_id\n match = @node.inner_text.strip.match(self.class.url_regexp)\n match[:id] if match\n end",
"def res_hex_id(readable_id)\n first_pkg.res_hex_id(readable_id)\n end",
"def urn_id; :id end",
"def urn_id; :id end",
"def body_id(id_str)\n content_for_wrapper(:body_id, id_str)\n end",
"def secondary_id=(v)\n @secondary_id = alma_string v\n end",
"def id\n @attributes[\"#{self.class.to_s.split('::').last.underscore.downcase}_id\".to_sym]\n end",
"def select_cdm_identifier(record, _context)\n uri = record.xpath(ID_XPATH, NS).map(&:text).reject(&:blank?)\n uri.first if uri.any?\n end",
"def id_string(record)\n record && record['001'] && record['001'].value.to_s\n end",
"def resolve_canonical_id(xri)\n return xri if AtLinksafe::Iname.is_inumber?(xri)\n AtLinksafe::Resolver::Resolve.new(xri).canonical_id\n end",
"def get(string)\n @strings[string]\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def label_with_id\n text_and_id( :label )\n end",
"def id\n @values[:id]\n end",
"def field_id(str)\n cleaned = if @view.present?\n \"#{clean_str(@view)}-#{clean_str(str)}\"\n else\n clean_str(str)\n end\n cleaned.tr('_', '-')\n end",
"def id\n if @id.nil?\n @id = FeedTools::XmlHelper.select_not_blank([\n FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"atom10:id/text()\",\n \"atom03:id/text()\",\n \"atom:id/text()\",\n \"id/text()\",\n \"guid/text()\"\n ], :select_result_value => true),\n FeedTools::XmlHelper.try_xpaths(self.root_node, [\n \"atom10:id/text()\",\n \"atom03:id/text()\",\n \"atom:id/text()\",\n \"id/text()\",\n \"guid/text()\"\n ], :select_result_value => true)\n ])\n end\n return @id\n end",
"def id\n (read_property 'Id') || name\n end",
"def id\n solr_document.fetch('id').sub(/^id-/, '')\n end",
"def getString(id, msgtbls)\n return msgtbls unless msgtbls.kind_of?(Hash)\n msgtbls[id]\n end",
"def get_id(user_name)\n return get_value_of(user_name, :id)\n end",
"def resource_id(res)\n if res.is_a?(String)\n return res.split(/\\//).last.to_i\n else\n return res.href.split(/\\//).last.to_i\n end\n end",
"def decode_id(key)\n unless key.is_a? String\n raise \"Expected a string for an obfuscated param! Got #{key.inspect}\"\n end\n\n return self.decode(self.debase(key))\n end",
"def find_trackable(trackable_str, trackable_id)\n trackable_str.constantize.find(trackable_id)\n end",
"def id\n source.split('/')[-1].split('_')[0]\n end",
"def lookup_field_id_string(field_identifier, options={})\n if options[:find_by] == :code\n return model.map_field_codes_to_id_strings[field_identifier]\n elsif options[:find_by]\n field = model.fields.where(options[:find_by] => field_identifier).select(:id).first\n return field.id.to_s unless field.nil?\n else\n return field_identifier.to_s\n end\n end",
"def str2id(s)\n s.id.delete('/hostedzone/')\nend",
"def extract_id(str)\n str.to_s.scan(/\\d+/)\n end",
"def id_value(item, **opt)\n if valid_id?(item)\n item.to_s\n elsif valid_id?((item = get_value(item, (opt[:id_key] || id_column))))\n item.to_s\n end\n end",
"def id\n @id || self.class.name.underscore.split('/').last #gsub('/', '_')\n end",
"def normalize_friendly_id(string)\n name\n end",
"def lookup_string_attribute (attname, workitem, options={})\n\n result = lookup_attribute(attname, workitem, options)\n result = result.to_s if result\n result\n end",
"def get_id_value(artifact)\n return get_value(artifact,'id')\n end",
"def id_text\n sprintf(\"%03d\", $pokedex.national? ? @id : primary_data.id_bis)\n end",
"def id_for_string( table_sym, string )\r\n @db[table_sym][(table_sym.to_s[0..-2].to_sym)=>string][:id]\r\n rescue\r\n @db[table_sym].insert((table_sym.to_s[0..-2].to_sym)=>string)\r\n end",
"def get_typename_from_id(id)\n case id.chars[0]\n when 'T'\n 'trackId'\n when 'A'\n 'artistId'\n when 'B'\n 'albumId'\n when 'L'\n 'curatedStationId'\n else\n 'stationId'\n end\n end",
"def id\n @values[:id]\n end",
"def id\n @values[:id]\n end",
"def label_with_id(label_id)\n label(:id, label_id.to_s).text\n end",
"def find_id(uri)\n Addressable::URI.parse(uri).basename\n end",
"def text_id\n \"#{title} (#{color})\"\n end",
"def parse_id(id)\n id.split('/')\n end",
"def url_value\n \"guid'#{value}'\"\n end",
"def identifier_value\n @value.map do |id|\n if /^https?\\:\\/\\//.match?(id)\n \"<a href='#{id}' alt='#{label}'>#{id}</a>\"\n else\n id\n end\n end\n end",
"def id\n name.gsub /-/, '_'\n end",
"def name\n text_get(6, @id)\n end",
"def id_and_name_from(string)\n string =~ /[^0-9a-f]/i ? [nil, string] : [string, nil]\n end",
"def get_word_id\n word = @text.downcase.singularize\n @word_id = EnglishWords.find_by(english_meaning: word)\n return @word_id\n end"
] |
[
"0.75345665",
"0.7078667",
"0.62465656",
"0.6110954",
"0.6110954",
"0.606956",
"0.6004073",
"0.5861186",
"0.58279586",
"0.58125645",
"0.5811148",
"0.57958114",
"0.5711793",
"0.5645883",
"0.5628218",
"0.5607832",
"0.5601439",
"0.55797255",
"0.5561076",
"0.55555314",
"0.5552106",
"0.55269",
"0.5508365",
"0.5500699",
"0.5484368",
"0.54841715",
"0.54825026",
"0.5454126",
"0.54365015",
"0.5410239",
"0.54014343",
"0.53998935",
"0.53936094",
"0.53870696",
"0.5386348",
"0.5373689",
"0.5372237",
"0.5368731",
"0.5365585",
"0.5360579",
"0.5342684",
"0.53263974",
"0.5305841",
"0.5276636",
"0.5272479",
"0.5271359",
"0.5264283",
"0.52621734",
"0.52621734",
"0.525988",
"0.5257793",
"0.5252096",
"0.5239461",
"0.52315766",
"0.5224234",
"0.5224234",
"0.52229035",
"0.52199",
"0.5218177",
"0.5211979",
"0.52117884",
"0.5211671",
"0.5208904",
"0.52057076",
"0.52057076",
"0.52057076",
"0.51963377",
"0.51841",
"0.51821005",
"0.5175735",
"0.5168442",
"0.51561785",
"0.5154203",
"0.5148846",
"0.51453865",
"0.51387984",
"0.51313764",
"0.512994",
"0.512985",
"0.5122592",
"0.51150066",
"0.5111602",
"0.51089144",
"0.51057",
"0.51045734",
"0.5099878",
"0.509757",
"0.50975275",
"0.5089382",
"0.5089382",
"0.50884825",
"0.5088394",
"0.50880784",
"0.50855064",
"0.5080132",
"0.5076924",
"0.50767684",
"0.5073635",
"0.5070676",
"0.50662845"
] |
0.87252325
|
0
|
Used to error when finding a single element fails.
|
def raise_no_element_error
raise Selenium::WebDriver::Error::NoSuchElementError, 'An element could not be located on the page using the given search parameters.'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_with_rpc_failed\n rpc_failed('Find failed')\n end",
"def source_find_by_id_fail(source, id, timeout=nil)\r\n timeout = normalize_timeout(timeout)\r\n\r\n for i in 1..timeout\r\n begin\r\n source.find_by_id(id)\r\n rescue\r\n return\r\n end\r\n\r\n sleep(1)\r\n end\r\n\r\n raise \"Found element \\\"\" + id + \"\\\" which was not supposed to exist\"\r\n end",
"def error; state == 'failed' ? @doc['error'] : nil; end",
"def not_found(message = t('messages.generics.errors.find'))\n error(message, 404)\n end",
"def error(el)\n att = el.attributes\n fe = XMLRPC::FaultException.new(att['code'].to_i, att['msg'])\n $stderr.puts \"ERR: #{fe.faultString} (#{fe.faultCode})\"\n raise fe\n end",
"def tolerate_not_found\n begin\n yield\n rescue Capybara::ElementNotFound\n nil\n end\n end",
"def error\n nil\n end",
"def find\n fail NotImplementedError\n end",
"def raise_if_no_exists_in_one\n raise 'OpenNebula device does not exist at the moment' unless one?\n end",
"def error\n nil\n end",
"def not_found; end",
"def handle_not_found(exception)\n raise exception\n end",
"def check_error(xml) #:nodoc\n end",
"def check_error(xml) #:nodoc\n end",
"def check_error(xml) #:nodoc\n end",
"def check_error(xml) #:nodoc\n end",
"def error?()\n #This is a stub, used for indexing\n end",
"def we_are_back_on_the_service_app\n expect { find(\"a\", text: \"Defence request service\") }.to_not raise_error\nend",
"def error(exception) nil ; end",
"def raise_unfound\n raise(Au3Error, \"Unable to find a window with title '#{@title}' and text '#{@text}'!\", caller)\n end",
"def error(nvae)\n end",
"def find_or_initialize_with_error_by(attribute, value, error = T.unsafe(nil)); end",
"def raise_if_error_present_in(response)\n response_xml = response.parsed_response\n if response_xml && !response_xml.css('error').empty?\n error_id = response_xml.css('error').first['id']\n error_message = response_xml.css('error message').first.text\n\n # Rozpoznajemy ten kod bledu i mozemy rzucic okreslona klasa wyjatku:\n if exception_class = EXCEPTION_CLASSES[error_id.to_s]\n raise exception_class, error_message\n else\n # Jakis nieznany blad - rzucamy chociaz stringiem\n raise Exceptions::UnknownError, \"ELIBRI_API ERROR #{error_id}: #{error_message}\"\n end\n end\n end",
"def find(id) \n unless id.is_a? Integer \n raise StringIntoIntegerError, \"you must type a number, not a word\"\n end\n\n candidate[:id] == id \n\n rescue StringIntoIntegerError => my_exception\n puts \"An error of type #{my_exception.class} occurred.\"\n puts \"Message is: #{my_exception.message}.\"\n puts \"The issue comes from #{my_exception.backtrace.inspect}.\"\n\nend",
"def find_element(*args)\n sleep 0.1\n how, what, timeout = extract_args(args)\n by = Selenium::WebDriver::SearchContext::FINDERS[how.to_sym]\n wait = Object::Selenium::WebDriver::Wait.new({:timeout => timeout, :message => \"element not found\"})\n wait.until {\n bridge.find_element_by by, what.to_s, ref\n }\n rescue Selenium::WebDriver::Error::TimeOutError => e\n return nil\n #raise Selenium::WebDriver::Error::NoSuchElementError\n end",
"def check_error(xml)\n raise NotImplementedError\n end",
"def error\n errors.first\n end",
"def error\n errors.first\n end",
"def source_find_by_id_and_class_fail(source, id, css, timeout=nil)\r\n timeout = normalize_timeout(timeout)\r\n\r\n for i in 1..timeout\r\n begin\r\n element = source.find_by_id(id)\r\n if !element[:class].split(\" \").include? css\r\n return\r\n end\r\n rescue\r\n return\r\n end\r\n\r\n sleep(1)\r\n end\r\n\r\n raise \"Found element \\\"\" + id + \"\\\" with CSS class \\\"\" + css + \"\\\" which was not supposed to exist\"\r\n end",
"def find(key)\n FlyError::raise_superclass_error\n end",
"def not_found_exception(guid, find_model)\n CloudController::Errors::NotFound.new_from_details(not_found_exception_name(find_model), guid)\n end",
"def error\n doc['error']\n end",
"def check_error(xml) #:nodoc:\n err = xml.elements['Error']\n raise Error, err.elements['Message'].text if err\n end",
"def error?; end",
"def error?; end",
"def error?; end",
"def search_error()\n error = TTY::Box.warn(\"Sorry no record found. Try another log.\")\n puts error\nend",
"def error\n errors.first\n end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def record_not_found\n raise ActiveRecord::RecordNotFound\n end",
"def not_found(&block)\n error 404, &block\n end",
"def identify_error\n begin\n yield\n rescue => ex\n ex.message.insert(0, \"#{@id} error: \")\n raise\n end\n end",
"def one\n if size == 0\n raise \"Could not find any records\"\n elsif size > 1\n raise \"Search returned multiple records when only one was expected\"\n else\n first\n end\n end",
"def trap_error(&block)\n time_secs = 0\n begin\n fail \"\\nERROR: #{e}\\n\" if time_secs > 5.0\n yield\n rescue Capybara::ElementNotFound => e\n fail \"\\nCapybara::ElementNotFound => #{e}\\n\"\n rescue Selenium::WebDriver::Error::StaleElementReferenceError => e\n puts \"\\nError locating element: #{e} : retrying\"\n sleep 0.5\n time_secs += 0.5\n retry\n rescue Selenium::WebDriver::Error::ObsoleteElementError => e\n puts \"\\nError locating element: #{e} : retrying\"\n sleep 0.5\n time_secs += 0.5\n retry\n end\n end",
"def what_are_you_looking_for?\n raise Exceptions::NotFound.new(404, 'Not Found; You did not find what you were expecting because it is not here. What are you looking for?')\n end",
"def error\n return unless id.nil?\n @error ||= @response['message']\n end",
"def find_element(*args)\n sleep 0.4\n how, what, timeout = extract_args(args)\n by = Selenium::WebDriver::SearchContext::FINDERS[how.to_sym]\n wait = Object::Selenium::WebDriver::Wait.new(timeout: timeout, message: 'element not found')\n wait.until do\n begin\n bridge.find_element_by(by, what.to_s, ref)\n rescue\n false\n end\n end\n rescue Selenium::WebDriver::Error::TimeOutError\n puts \"element not found #{how} #{what}\" if timeout > 3\n nil\n end",
"def error\n failure\n end",
"def error(description, result)\n raise \"Implement this in a sub-class\"\n end",
"def fail_not_found_if_nil(promise)\n promise.then do |val|\n if val\n val\n else\n raise RecordNotFoundException.new\n end\n end\n end",
"def something_is_missing_error(expected)\n \"#{expected.name || 'top level'} Node/Object/Element is missing\"\n end",
"def first!\n fail_not_found_if_nil(first)\n end",
"def not_found(options={}, &b)\n error NotFound, options, &b\n end",
"def fail\n # no-op\n end",
"def check_error(xml) #:nodoc:\n if error = Error.parse(xml, :single => true)\n raise Graticule::Error, error.message\n end\n end",
"def sole\n found, undesired = first(2)\n\n if found.nil?\n raise_record_not_found_exception!\n elsif undesired.present?\n raise ActiveRecord::SoleRecordExceeded.new(self)\n else\n found\n end\n end",
"def wait_for(element, msg = \"Error waiting for element #{element}\")\n wait = Selenium::WebDriver::Wait.new(:timeout => WAIT_TIME)\n wait.until {\n begin\n send(element)\n true\n rescue Selenium::WebDriver::Error::NoSuchElementError, NoMethodError => e\n puts msg\n false\n end\n }\n end",
"def not_found\n super(t('messages.list_item.errors.find'))\n end",
"def error(msg)\n raise ::RDoc::Error, msg\n end",
"def error(msg)\n raise ::RDoc::Error, msg\n end",
"def error\n end",
"def error\r\n\t\t\t`#{BITS::BITSADMIN} /geterror {#{@id}}`\r\n\t\tend",
"def test_nonexistence\n record_not_found = false\n begin\n not_there = User.find(999999999)\n rescue ActiveRecord::RecordNotFound\n record_not_found = true\n end\n assert record_not_found\n end",
"def assert_not_found(clazz, id)\n message = \"#{clazz} with ID #{id} is still here!\"\n assert_raise ActiveRecord::RecordNotFound, message do\n clazz.find(id)\n end\n end",
"def find_solr_error(response)\n return nil unless response && response.body && response.content_type&.start_with?(\"application/json\")\n\n parsed = JSON.parse(response.body)\n\n parsed && parsed.dig(\"error\", \"msg\")\n rescue JSON::ParserError\n return nil\n end",
"def error!\n throw :return, -1\n end",
"def find(_index_value)\n raise \"Implement in subclass\"\n end",
"def test_cant_find_single_item\n\n result=find_single_item(@warehouse_data, :zz)\n assert_equal(nil,result)\n \nend",
"def error(msg)\n raise RDocError.new(msg)\n end",
"def find_one\n return super if params[klass.primary_key].present?\n @find_one ||= klass.new_collection_from_result(limit(1).fetch).first\n rescue ::Spyke::ConnectionError => error\n fallback_or_reraise(error, default: nil)\n end",
"def find! css_selector\n res = find(css_selector)\n raise \"Selector(#{css_selector}) returned no results!\" unless res\n res\n end",
"def find_element(input_1, input_2)\n if input_1.find_index(input_2) == nil\n return -1\n end\n input_1.find_index(input_2)\nend",
"def not_found(x, title:\"Not Found\", message:nil)\n begin\n if message.nil? and @runs[:website] and @runs[:website][:page]\n return @runs[:website][:page][:get].call(x, *(x.args))\n end\n rescue => e\n message = e.to_s\n end\n error(x, status: 404, type: \"request\", title: title, message: message)\n end",
"def find\n raise \"Method not implemented\"\n end",
"def get_xml_error(xobj)\n\t\t\tbegin\n\t\t\t\txobj.at_xpath('//ann/warning').content\n\t\t\trescue NoMethodError\n\t\t\t\t\"unrecognized response body\"\n\t\t\tend\n\t\tend",
"def error\n\t\t\traise 'Test'\n\t\tend",
"def error\n end",
"def not_found\n\n render_error( :not_found )\n\n end",
"def find_by_id_and_class_fail(id, css, timeout=nil)\r\n source_find_by_id_and_class_fail(page, id, css, timeout)\r\n end",
"def result_contains_element(index, field)\n eles = get_entries\n\n if eles.nil? || eles.length == 0\n fail(ArgumentError.new('no results were found'))\n else\n # elements exist, get the correct locator\n case field.downcase\n when 'lead'\n @loc = input_elements[:result_lead]\n when 'negative'\n @loc = input_elements[:result_negative]\n when 'neutral'\n @loc = input_elements[:result_neutral]\n when 'positive'\n @loc = input_elements[:result_positive]\n else fail(ArgumentError.new(field + ' is not a valid field'))\n end\n results = get_entries\n result = results[index]\n unless result.has_css? @loc\n fail(ArgumentError.new('record does not contain the field ' + field))\n end\n end\n end",
"def store_failure_on_next message\r\n raise 'Not supported in Selenium Core at the moment'\r\n end",
"def test_find_by_integer_not_found\n # Person.find(1) - returns the object for ID = 1\n assert !IndestructiblePost.exists?(9999)\n assert_raises(ActiveRecord::RecordNotFound) {\n IndestructiblePost.find(9999)\n }\n end",
"def raise_unfound\n raise(Au3Error, \"The control '#{@c_id}' was not found in the window '#{@title}' (or the window was not found)!\", caller)\n end",
"def record_not_found_error\n if Rails.env == 'development'\n render # will give us the stack trace\n else\n flash[:notice] = I18n.t('blacklight.search.errors.invalid_solr_id')\n params.delete(:id)\n index\n render 'index', :status => 404\n end\n end",
"def handle_not_found_error!\n raise Common::Exceptions::UnprocessableEntity.new(detail: 'Person Not Found')\n end",
"def api_error\n dm_data.first.first == \"errors\"\n end",
"def error(msg)\n raise RDoc::Error, msg\n end",
"def status_not_found\n @status = 404\n @e.error 'The requested page does not exist.', 404\n throw :exit\n end",
"def error(string); end",
"def error(string); end",
"def error\n errors.full_messages.first\n end",
"def not_found(body = nil)\n error(404, body)\n end",
"def handle_get_error(err, selector)\n puts \"Error #{err.class}: #{err}\"\n puts err.backtrace if MNV[:debug]\n\n MNV[selector].empty?\n ensure\n MNV[selector] = \"\"\n end",
"def mobile_element_exists(xpath)\r\n\r\n result = true\r\n\r\n begin\r\n mobile_element = get_mobile_element xpath\r\n\r\n if mobile_element.nil? or mobile_element.to_s.empty?\r\n result = false\r\n end\r\n\r\n rescue Exception => e\r\n puts \"mobile_element_exists => Exception => #{e.message}\"\r\n result = false\r\n\r\n end\r\n\r\n return result\r\n\r\nend"
] |
[
"0.61695534",
"0.60751194",
"0.59798014",
"0.5973216",
"0.5951531",
"0.59398663",
"0.5922384",
"0.59161043",
"0.5862185",
"0.58310926",
"0.5810718",
"0.58033216",
"0.57920426",
"0.57920426",
"0.57920426",
"0.57920426",
"0.5778521",
"0.5764",
"0.5743967",
"0.56888705",
"0.5683427",
"0.5669047",
"0.56668574",
"0.56629646",
"0.56569356",
"0.5654172",
"0.5649526",
"0.5649526",
"0.564551",
"0.56424516",
"0.5615381",
"0.56145287",
"0.5614426",
"0.5606275",
"0.5606275",
"0.5606275",
"0.5606114",
"0.5590444",
"0.558832",
"0.558832",
"0.558832",
"0.558832",
"0.558832",
"0.558832",
"0.558832",
"0.5575405",
"0.5570116",
"0.55677974",
"0.5546228",
"0.5542293",
"0.5527624",
"0.55250645",
"0.5524652",
"0.5518991",
"0.5495713",
"0.54896885",
"0.54682416",
"0.5458578",
"0.54543173",
"0.54485494",
"0.5434904",
"0.5430455",
"0.54230696",
"0.541148",
"0.54090685",
"0.54090685",
"0.5408225",
"0.54042923",
"0.5395861",
"0.5387446",
"0.53821385",
"0.5377742",
"0.53722537",
"0.5369478",
"0.53504604",
"0.53486276",
"0.53375894",
"0.5326131",
"0.5316778",
"0.53123885",
"0.5307677",
"0.53048444",
"0.5304519",
"0.5296848",
"0.52935094",
"0.52881825",
"0.52807534",
"0.5269674",
"0.52598715",
"0.5253172",
"0.5246526",
"0.524576",
"0.52456874",
"0.5244129",
"0.5240445",
"0.5240445",
"0.5240389",
"0.52384025",
"0.52307224",
"0.522836"
] |
0.6482858
|
0
|
GET /themes or /themes.json def index
|
def edit
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @themes = Theme.all\n json_response(@themes)\n end",
"def index\n @themes = Theme.all\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @themes }\n end\n end",
"def index\n @themes = TemplateTheme.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @themes }\n end\n end",
"def index\n\n conditions = {:_id => {:$ne => current_group.current_theme_id}}\n @themes = current_group.themes.where(conditions).page(params[\"page\"])\n\n if params[:tab] == \"all\"\n conditions[:$or] = [{:community => true}, {:group_id => current_group.id}]\n\n @themes = Theme.where(conditions).page(params[\"page\"])\n end\n\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render :json => @themes }\n end\n end",
"def index\n @user_themes = Theme.where(\"user_id = ?\", current_user.id).order(\"created_at\")\n \n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @user_themes }\n end\n end",
"def index\n @subthemes = Subtheme.all\n\n render json: @subthemes\n end",
"def get_theme\n respond theme, 200, {'Content-Type' => 'text/plain'}\n end",
"def show\n @theme = Theme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render :json => @theme }\n end\n end",
"def show\n @theme = Theme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @theme }\n end\n end",
"def show\n @theme = Theme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @theme }\n end\n end",
"def show\n @theme = Theme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @theme }\n end\n end",
"def index\n @cms_themes = current_portal.themes\n end",
"def index\n @themes = Theme.all\n @themes = Theme.includes(:translations).with_locales(I18n.locale).order('theme_translations.name')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @themes }\n end\n end",
"def index\n set_page_title_for 'home'\n @page = (request.params[:page] || 1).to_i\n\n offset = (@page - 1) * PAGE_SIZE\n\n @count = Theme.perfect.count\n\n @previous = if @page == 2\n themes_path\n else\n themes_path(page: @page - 1)\n end\n\n @next = if offset + PAGE_SIZE >= @count\n nil\n else\n themes_path(page: @page + 1)\n end\n\n @themes = Theme\n .perfect\n .offset(offset)\n .limit(PAGE_SIZE)\n .order(version: :desc)\n end",
"def index\n @settings = self.current_user.setting\n @themes = Theme.by_weight\n rescue => ex\n handle_exception(ex)\n ensure\n end",
"def index\n @theme1s = Theme1.all\n end",
"def fetch_themes(options={})\n url = build_url options\n themes = Nokogiri::XML(open(url)).search('//item').map do |item|\n Kuler::Theme.new item.at('./kuler:themeItem')\n end\n themes\n end",
"def index\n @node_has_themes = NodeHasTheme.all\n end",
"def index\n @organization_themes = if current_manager\n current_manager.organization.organization_theme\n else\n OrganizationTheme.newest_first.per_page(params[:page])\n end\n end",
"def new\n @theme = Theme.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render :json => @theme }\n end\n end",
"def theme\n @theme ||= Theme.unscoped.find(params[:id])\n halt 404 unless @theme\n @theme\n end",
"def index\n @themes = Theme.where(site_id: @site.id).order('name asc')\n end",
"def show\n @wtheme = Wtheme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wtheme }\n end\n end",
"def new\n @theme = Theme.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @theme }\n end\n end",
"def new\n @theme = Theme.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @theme }\n end\n end",
"def new\n @theme = Theme.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @theme }\n end\n end",
"def index\n @programmes = Programme.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programmes }\n end\n end",
"def index\n @theme_names = ThemeName.all\n end",
"def index\n @games = @theme.games.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @games.to_xml }\n end\n end",
"def json_index_tutorials_by_limit_and_offset\n\n @themes = Theme.order(:id).\n limit(params[:limit]).\n offset(params[:offset])\n\n respond_to do |format|\n format.json { render json: @themes }\n end\n end",
"def new\n @theme = Theme.new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @theme }\n end\n end",
"def show\n @jquery_theme = JqueryTheme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @jquery_theme }\n end\n end",
"def index\n set_page_title_for 'home'\n @page = (request.params[:page] || 1).to_i\n\n redirect_to root_path, notice: t('errors.negative_offset') if @page < 1\n\n offset = (@page - 1) * PAGE_SIZE\n\n @count = Theme.perfect.count\n\n # this logic hurts\n if @page > 1\n @previous = if @page == 2\n themes_path\n else\n themes_path(page: @page - 1)\n end\n end\n\n @next = themes_path(page: @page + 1) unless offset + PAGE_SIZE >= @count\n\n @themes = Theme\n .perfect\n .offset(offset)\n .limit(PAGE_SIZE)\n .order(version: :desc)\n end",
"def new\n logger.debug(\"HIIIIIIIIII\")\n @theme = Theme.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @theme }\n \n end\n end",
"def index\n respond_to do |format|\n format.html {index_html}\n format.json {index_json}\n end\n end",
"def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end",
"def index\n respond_to do |format|\n format.html { render layout: 'full_screen' }\n format.json\n end\n end",
"def index\n @stylists = Stylist.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stylists }\n end\n end",
"def index\n @fundamental_guilds = Fundamental::Guild.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_guilds }\n end\n end",
"def index\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json { render json: StatType::ALL }\n end\n end",
"def index\n require 'rest-client'\n response = RestClient::Request.execute(method: :get, url: 'localhost:3001/colores',\n headers: {page: params[:page], items: 9})\n if response.code == 200\n body = JSON.parse(response.body)\n @colors = body[\"data\"]\n @page = body[\"page\"]\n end\n end",
"def index\n @tailors = Tailor.all\n respond_to do |format|\n format.html\n format.json { render json: @tailors}\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @chores = Chore.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @chores }\n end\n end",
"def index\n @funs = Fun.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @funs }\n end\n end",
"def index\n @style_sheets = @site.style_sheets.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @style_sheets }\n end\n end",
"def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end",
"def index\n @theme_groups = ThemeGroup.all\n end",
"def index\n @theme_groups = ThemeGroup.all\n end",
"def index\n\t\t@assets = Asset.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html #index.html.erb\n\t\t\tformat.json { render json: @assets }\n\t\tend\n\tend",
"def get_themes\n themes_dir = File.join(File.dirname(__FILE__), '/public/themes')\n\n themes = []\n Dir.entries(themes_dir).sort.each do |dir|\n themes.push dir if ((dir != 'fonts') and (dir[0] != '.'))\n end\n themes\n end",
"def index\n @tools = Tool.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tools }\n end\n end",
"def index\n @hikiyamas = @omatsuri.hikiyamas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hikiyamas }\n format.json { render :json => @hikiyamas }\n end\n end",
"def index\n get('')\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @funerals }\n end\n end",
"def index\n\t\trespond_to do |format|\n\t\t\tformat.html {html_index}\n\t\t\tformat.json {json_index}\n\t\tend\n\tend",
"def index\n @taux_tvas = current_user.parametres_cabinet.taux_tvas.all\n\n respond_to do |format|\n format.html {render :layout => \"light\"} # index.html.erb\n format.xml { render :xml => @taux_tvas }\n format.json {render :json => {\"success\"=>true,\"data\"=>@taux_tvas}}\n \n end\n end",
"def index\n # binding.pry\n respond_to do |format|\n format.html do\n render :index,\n locals: {\n memoes: @memoes.jsonize(context),\n total: @memoes.total_size,\n cloud: @calendary_cloud.jsonize\n }\n end\n format.json do\n render plain: {\n list: @memoes.jsonize(context),\n page: @page,\n total: @memoes.total_size\n }.to_json(context)\n end\n end\n end",
"def index\n weathers = Weather.all\n render json: weathers, status: 200\n end",
"def index\n @you_owe_mes = YouOweMe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @you_owe_mes }\n end\n end",
"def index\n \tlogger.debug \"presets/index called\"\n @presets = Preset.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @presets }\n end\n end",
"def index\n get\n end",
"def index\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def index\n @japan_styles = JapanStyle.order('created_at DESC').all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @japan_styles }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def show\n @theme = TemplateTheme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @theme }\n end\n end",
"def index\n @environments = Environment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @environments }\n end\n end",
"def index\n @manifestations = Manifestation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @manifestations }\n end\n end",
"def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end",
"def index\n @widgets = Widget.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @widgets }\n end\n end",
"def index\n @homes = Home.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @homes }\n end\n end",
"def index\n @pages = Page.all\n\n respond_to do |format|\n format.html {render :layout => \"layout_1\"}\n format.json { render json: @pages }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json\n end \n end",
"def index\n @kraje = Kraj.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @kraje }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json\n end \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 index\n @projetos = Projeto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projetos }\n end\n end",
"def index\n @attris = Attri.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attris }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_pricing_schemes }\n end\n end",
"def index\n respond_with @layouts\n end",
"def index\n @fretes = Frete.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fretes }\n end\n end",
"def index\n @languages = Language.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @languages }\n end\n end",
"def index\n @schemas = Schema.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @schemas }\n end\n end",
"def index\n @mesasredondas = Mesasredonda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mesasredondas }\n end\n end",
"def index\n render json: { message: 'Welcome!' }\n end",
"def index\n set_user\n @sites = Site.all\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @sites.to_json }\n end\n end",
"def index\n respond_to do |format|\n format.html { redirect_to(root_path) }\n format.json { render :index, status: :unprocessable_entity }\n end\n end",
"def index\n @applications = Application.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @applications }\n end\n end",
"def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end",
"def index\n @beverages = Beverage.all.to_a\n respond_to do |format|\n format.html { STDERR.puts \"INDEX....\"; render :index }\n format.json { STDERR.puts \"JSON....\"; render json: @beverages }\n end\n end",
"def index\n @resources = []\n\t\tDir.glob(\"#{params[:path]}/*\").each do |f|\n\t\tunless File.directory?(f)\n\t\t\t@resources.push(File.basename(f))\n\t\tend\n\tend\n\n\trender json: @resources\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @devans }\n end\n end",
"def index\n @dark_features = DarkFeature.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dark_features }\n end\n end",
"def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end",
"def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end",
"def index\n @majors = majors\n respond_to do |format|\n format.json{\n return render json: ret\n }\n end\n end",
"def index\n @categories = Categorie.find(:all, :conditions => {:parametres_cabinet_id => current_user.parametres_cabinet_id})\n\n respond_to do |format|\n format.html {render :layout => \"light\"} # index.html.erb\n format.xml { render :xml => @categories }\n format.json {render :json => {\"success\"=>true,\"data\"=>@categories}}\n \n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @atoms }\n end\n end"
] |
[
"0.8407449",
"0.7707325",
"0.7674515",
"0.76456285",
"0.7311576",
"0.72925186",
"0.727758",
"0.7160831",
"0.7026856",
"0.70230657",
"0.7011665",
"0.7011665",
"0.6967266",
"0.68615",
"0.66917175",
"0.66674376",
"0.66038984",
"0.65290767",
"0.6514228",
"0.65027976",
"0.6481354",
"0.6457936",
"0.64397097",
"0.6414671",
"0.6399121",
"0.63962364",
"0.63962364",
"0.639372",
"0.6391835",
"0.6389022",
"0.637615",
"0.631221",
"0.63061607",
"0.62747717",
"0.62456",
"0.62118286",
"0.6202123",
"0.619413",
"0.6186104",
"0.6159988",
"0.61517274",
"0.61475426",
"0.6140845",
"0.61338454",
"0.61338454",
"0.6130733",
"0.612334",
"0.6119781",
"0.6117307",
"0.6117307",
"0.6115382",
"0.6114945",
"0.61079305",
"0.610102",
"0.6100774",
"0.6093411",
"0.6090421",
"0.6082125",
"0.6076878",
"0.6070049",
"0.60688925",
"0.6057176",
"0.6057146",
"0.60569286",
"0.605625",
"0.6055814",
"0.6055814",
"0.6052789",
"0.60514593",
"0.60478747",
"0.60460895",
"0.6042516",
"0.6038952",
"0.60286444",
"0.60251415",
"0.60210687",
"0.6020205",
"0.60192764",
"0.60166836",
"0.6008587",
"0.6005043",
"0.60036665",
"0.60003495",
"0.59994227",
"0.59938383",
"0.5992843",
"0.5988961",
"0.5985133",
"0.59825814",
"0.597811",
"0.5976376",
"0.5969044",
"0.5967624",
"0.59664696",
"0.59556925",
"0.5955152",
"0.595485",
"0.5954187",
"0.595366",
"0.5953342",
"0.5950064"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_theme
# @theme = Theme.find(params[:id])
@theme = Theme.current_theme
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 theme_params
params.require(:theme).permit(Theme::DEFAULTS.keys + [:logo, :hero_image, :favicon_image])
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
|
Restrict theme access to admins
|
def ensure_admin!
authorize! :read, :admin_dashboard
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_access_required\n access_denied unless admin?\n end",
"def admin_user\n render_forbidden unless current_user.admin?\n end",
"def admin_only\n deny_access(\"You must be signed in as an admin to access this page.\") unless signed_in_as_admin?\n end",
"def restrict_to_admin\n unless is_admin\n flash[:danger] = \"You are not an administrator.\"\n redirect_to root_url\n end\n end",
"def require_admin\n deny_wrong_user if !admin?\n end",
"def admin_only\n logged_in_as_admin? || admin_only_access_denied\n end",
"def admin_only\n if !Volt.current_user.admin\n redirect_to '/login'\n end\n end",
"def admin_only\n return if admin_user?\n\n add_message 'Insufficient permission to view page'\n redirect_to '/'\n end",
"def admin_only\n false\n end",
"def must_be_admin!\n access_denied! unless current_admin?\n end",
"def only_authorize_admin!\n authorize!(is?(:admin))\n end",
"def admins_only\n if current_user.nil? or !current_user.is_admin?\n # Silently redirect, no need to tell anyone why. If they're\n # not an admin, they have no business here\n redirect_to root_path\n end\n end",
"def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end",
"def admin_only\n @user = current_user\n if @user.role != \"admin\"\n redirect_to root_path\n end\n end",
"def authorize_access\n redirect_to admin_sites_url unless @site || current_user.admin?\n end",
"def admin_required\n current_user.is_admin? || access_denied\n end",
"def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end",
"def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end",
"def permission_required \n render_403 unless admin? || @user == current_user\n end",
"def admin_only\n unless current_user.admin\n redirect_to home_path, notice: \n \"You must be an admin to perform that function!\"\n end\n end",
"def require_admin_privileges\n\t\tredirect_to root_path unless is_global_admin?\n\tend",
"def check_admin_only\n\t\t# Check permissions\n\t\tif (not @current_user.is_administrator?)\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\tend",
"def restrict_access\n redirect_to root_path if is_superuser_or_admin? == false\n end",
"def admin_in!\n access_denied! unless current_user.admin?\n end",
"def admin_only!\n\tif !current_user || !current_user.administrator\n\t\tredirect \"/\"\n\tend\nend",
"def admin_required\n self.current_user != :false && \n self.current_user.is_admin? ? true : access_denied\n end",
"def require_admin\n #byebug\n redirect_to user_path(current_user) unless current_user.role === \"Admin\"\n end",
"def restrict_user_by_role\n unless current_user and current_user.admin?\n redirect_to root_path # change this to your 404 page if needed\n end\n end",
"def admin_authorize\n unless admin?\n unauthorized_access\n end\n end",
"def admin_only_view\n if !current_user.is_a? Admin and current_user.type != \"AdminAssistant\"\n flash[:error] = \"You are not authorized to view this page.\"\n redirect_to :root\n # Explictly tell the caller that this check failed\n return false\n else\n # Explictly tell the caller that this check was successful\n return true\n end\n end",
"def admin_required\n current_user.respond_to?('is_admin') && current_user.send('is_admin') || access_denied\n end",
"def require_admin\n grant_access?(\"index\", \"users\")\n #position?('admin')\n end",
"def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end",
"def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end",
"def only_for_admins\n raise ActiveRecord::RecordNotFound unless current_user.has_role? :admin\n end",
"def require_admin\n redirect_to(root_path) unless current_user.admin?\n end",
"def require_admin\n unless admin?\n flash[:warning] = \"Sorry, only administrators can do that.\"\n redirect_to Warnings_url\n end\n end",
"def must_be_admin\n if current_user.is? \"EA\"\n return true\n else\n redirect_to root_path,:notice =>\"Access Denied...\"\n end\n end",
"def require_admin\n unless !current_user.nil? && current_user.admin?\n render file: 'public/401.html', status: :unauthorized\n end\n end",
"def admin_only\n\t\t\tif logged_in?\n\t\t\t\tif User.find_by(id: current_user.id.to_i).admin != true\n\t\t\t\t\tredirect_to root_path, :alert => \"Odmowa dostępu musisz być adminem\"\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n current_user.permission.manage_quests ||\n current_user.permission.manage_skills ||\n current_user.permission.manage_achievements ||\n current_user.permission.manage_items ||\n current_user.permission.manage_titles\n end",
"def require_admin\n if !logged_in? or !current_user.admin?\n redirect_to login_path, :alert => \"Access denied.\"\n end\n end",
"def authorize_only_for_admin\n unless authorized?(Admin)\n render :file => \"#{RAILS_ROOT}/public/404.html\", \n :status => 404\n end\n end",
"def restrict_user_by_role\n unless current_user.has_role_in_roles_list?(ADMINISTRATION_ROLES)\n flash[:error] = 'You do not have permission to view this page'\n redirect_to root_path\n end\n end",
"def require_admin\n if logged_in? and !current_user\n flash[:danger] = \"Only admin users can perform that action.\"\n redirect_to root_path\n end\n end",
"def admin_only(&block)\n role_only(\"admin\", &block)\n end",
"def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def require_admin\n not_authorized(\"Invalid credentials.\") unless is_admin?\n end",
"def adminprotected!\n if authorized? == true and isuseradmin? == true\n return\n else redirect '/denied'\n end\n end",
"def authorize_admin\n redirect_to root_path, notice: \"You don't have access to admin pages.\" if !current_user.admin?\n end",
"def require_admin\n if logged_in? and !current_user.admin?\n #flash[:danger] = 'Only admin users can perform that action'\n redirect_to root_path\n end\n end",
"def authorize_admin\n return unless !current_admin\n redirect_to root_path, alert: 'Admins only!'\n end",
"def require_admin\n unless view_context.admin?\n redirect_to root_url\n end\n end",
"def authorize_admin\n redirect_to '/librarians/denied' unless current_user && current_user.admin?\n end",
"def check_admin\n\t\tif current_user && current_user.role == 2\n\t\telsif current_user && current_user.role != 2\n\t\t\tredirect_to buildings_url, notice: 'You are not authorized'\n\t\telse\n\t\t\tredirect_to buildings_url, notice: 'You are not logged in'\n\t\tend\n\tend",
"def require_admin\n redirect_to root_path unless @current_user.admin?\n end",
"def authorize_admin\n return unless current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end",
"def only_admin\n if user_role == 'admin'\n else\n redirect_to clients_path, notice: \"У вас нет прав для просмотра даного раздела, или редактирования информации\"\n end\n end",
"def require_admin\n\t\tif !logged_in? || (logged_in? && !current_user.admin?)\n\t\t\tflash[:danger] = \"Only Admins can perform that action\"\n\t\t\tredirect_to root_path\n\t\tend\n\tend",
"def require_admin\n unless env['warden'].user.advisor? || env['warden'].user.resident?\n flash.error = \"You are not authorized to access that page.\"\n redirect '/'\n end\n end",
"def authorize_admin!\n redirect_to home_path unless current_user&.admin\n end",
"def require_admin_roles\r\n if logged_in? and not current_user.has_admin_roles?\r\n not_authorized\r\n end\r\n end",
"def require_admin\n if user_signed_in?\n unless current_user.is_admin?\n redirect_to root_path\n end\n end\n end",
"def admin_access?\n admin?\n end",
"def authorize_admin_path_only\n @show_to_admin_only = false\n if request.path =~ /admin/\n authorize\n @show_to_admin_only = true\n end\n end",
"def access_whitelist\n current_user.try(:admin?) || current_user.try(:editor?) || current_user.try(:door_super?)\n end",
"def require_admin\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin || current_user.super_admin?# || top_layer_administrator\n end",
"def require_admin\n redirect_to root_path unless admin_logged_in?\n end",
"def require_admin!\n authenticate_user!\n\n if current_user && !current_user.admin?\n redirect_to root_path\n end\n end",
"def require_admin!\n authenticate_user!\n\n if current_user && !current_user.admin?\n redirect_to root_path\n end\n end",
"def require_admin!\n authenticate_user!\n\n if current_user && !current_user.admin?\n redirect_to root_path\n end\n end",
"def check_Admin\n\t\tif current_user.role != \"admin\"\n\t\t\tredirect_to('/')\n\t\tend\n\tend",
"def require_admin!\n authenticate_user!\n\n if current_user && !current_user.admin?\n redirect_to root_path\n end\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin? || current_user.super_admin?\n end",
"def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend",
"def authorize_admin\n redirect_to root_path unless current.user.immortal?\n end",
"def is_admin\n render status: :unauthorized unless current_user.admin\n end",
"def authorize_admin\n return if current_customer.admin?\n redirect_to root_path, alert: 'Admins only!' unless current_customer and current_customer.admin?\n end",
"def check_admin\n redirect_to :root unless current_user.admin?\n end",
"def admin_user \n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to edit menu.'\n \n redirect_to(root_url)\n end\n end",
"def require_admin_permission\n redirect_to tables_path, notice: 'Necesita permisos de administrador para visualizar la configuracion' unless current_user_admin?\n end",
"def check_admin\n redirect_to root_path unless current_user.has_role? :admin\n end",
"def limit_to_staff\n authenticate_user!\n unless current_user.admin?\n raise ActionController::RoutingError.new('Not Found')\n end\n end",
"def admin?\n self.site_role == 'admin'\n end",
"def authorize_admin!\n redirect_to login_path unless current_user\n end",
"def authorize_admin!\n unless admin?\n flash[:alert] = 'Unauthorized access'\n redirect_to home_path\n false\n end\n end",
"def authorizeAdmin\n redirect_to '/adminlogin' unless admin_user\n end",
"def require_admin\n if Rails.env.production? && is_market? && Rails.configuration.admin_hostname != request.host\n render plain: \"ADMIN_HOSTNAME setting does not match your host header.\"\n else\n unless is_admin?\n flash[:alert] = \"Access not authorized. Need to be logged in first.\"\n redirect_to admin_new_session_path\n end\n end\n end",
"def restrictToAdmin! ; redirect to('/login'),303 unless admin? ; end",
"def require_admin\n unless admin?\n flash[:notice] = \"Sorry, only administrators can do that.\"\n redirect_to :controller => 'typus', :action => 'dashboard'\n end\n end",
"def authorize_admin\n redirect_to(:controller => 'main', :action => 'index') and return false unless @logged_in_user.is_admin?\n end",
"def require_admin \n\t \tif current_user && current_user.admin\n\t \telse\n\t \t\tredirect_to root_path\n\t\t\tflash.notice = \"You are not the admin!\"\n\t\tend\n\tend",
"def ensure_admin_user!\n redirect_to(news_path, :alert => \"You may not perform this action on News!\") and return unless user_signed_in? && current_user.admin?\n end",
"def ensure_author_is_admin\n unless current_author_is_admin?\n redirect_to :root\n end \n end"
] |
[
"0.7951221",
"0.7790804",
"0.7790804",
"0.7790804",
"0.7678672",
"0.76469594",
"0.7607186",
"0.75529754",
"0.7526073",
"0.7519597",
"0.7501832",
"0.7499353",
"0.74862844",
"0.7432273",
"0.7419374",
"0.7417087",
"0.7401012",
"0.7400061",
"0.7380491",
"0.7340216",
"0.7334123",
"0.73338443",
"0.7314276",
"0.72997046",
"0.72949326",
"0.72889465",
"0.72830224",
"0.7279184",
"0.72712284",
"0.72686243",
"0.7242402",
"0.72302383",
"0.7225692",
"0.7220378",
"0.7216854",
"0.7216194",
"0.7216194",
"0.72069085",
"0.7204284",
"0.71861315",
"0.7175102",
"0.71656215",
"0.7157355",
"0.71470064",
"0.7144988",
"0.71395165",
"0.7134743",
"0.71338",
"0.71079546",
"0.70937145",
"0.70937145",
"0.7089527",
"0.7086825",
"0.7084884",
"0.7080506",
"0.7079502",
"0.7070654",
"0.7070504",
"0.70627177",
"0.70587885",
"0.7058532",
"0.70560807",
"0.70503366",
"0.701645",
"0.7011918",
"0.70105773",
"0.7008038",
"0.7007498",
"0.6996288",
"0.6988851",
"0.69859725",
"0.6982776",
"0.69797367",
"0.6978513",
"0.697791",
"0.697791",
"0.6977802",
"0.6977574",
"0.697173",
"0.69658494",
"0.69582677",
"0.695232",
"0.6945438",
"0.6943355",
"0.6934812",
"0.6930995",
"0.6925109",
"0.6921227",
"0.6919228",
"0.69151884",
"0.6914261",
"0.69087064",
"0.68974954",
"0.6893755",
"0.6891992",
"0.68873197",
"0.6885198",
"0.6883871",
"0.6881532"
] |
0.69950503
|
70
|
I worked on this challenge [by myself!]. Your Solution Below
|
def array_concat(array_1, array_2)
array_2.each do |a2_element|
array_1.push(a2_element)
end
return array_1
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def solution4(input)\n end",
"def challenge; end",
"def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx].to_i\r\nend\r\n\r\n(secondhalfstart..secondhalfend).each do |idx|\r\n half2 << n_string[idx].to_i\r\nend\r\n\r\nreturn true if half1.inject(:+) == half2.inject(:+)\r\nreturn false\r\nend",
"def is_happy(n)\n i = 0\n r = false\n destination = []\n while r == false\n n.to_s.split(\"\").each do |x|\n destination << ((x.to_i * x.to_i))\n end\n i = i + 1\n n = destination.inject(&:+)\n r = true if n == 1\n destination = []\n break if i == 1000\n end\n if r == true\n p r\n else\n p false\n end\nend",
"def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend",
"def solution(number)\nn = 0..number\na = []\nfor i in n\n if i % 3 == 0 || i % 5 == 0\n a = a.push(i)\n end\n end\ns = 0\n# a.pop\na.each {|x| s += x}\ns\nend",
"def isLucky(n)\n new_array = n.to_s.split(\"\")\n new_length = new_array.length\n\n a, b = [], []\n\n (0...new_length / 2).each { |x| a.push(new_array[x].to_i) }\n (new_length / 2...new_length).each { |y| b.push(new_array[y].to_i) }\n\n if a.inject(:+) == b.inject(:+)\n return true\n else\n false\n end\n\nend",
"def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\nend",
"def isLucky(n)\n sum, sum2 = 0, 0\n arr = n.to_s.split(\"\")\n \n first_half = arr.take(arr.size / 2) \n second_half = arr.drop((arr.size / 2))\n first_half.each { |x| sum += x.to_i }\n second_half.each {|x| sum2 += x.to_i}\n \n sum == sum2\nend",
"def input_string\n result = \"73167176531330624919225119674426574742355349194934\"\n result += \"96983520312774506326239578318016984801869478851843\"\n result += \"85861560789112949495459501737958331952853208805511\"\n result += \"12540698747158523863050715693290963295227443043557\"\n result += \"66896648950445244523161731856403098711121722383113\"\n result += \"62229893423380308135336276614282806444486645238749\"\n result += \"30358907296290491560440772390713810515859307960866\"\n result += \"70172427121883998797908792274921901699720888093776\"\n result += \"65727333001053367881220235421809751254540594752243\"\n result += \"52584907711670556013604839586446706324415722155397\"\n result += \"53697817977846174064955149290862569321978468622482\"\n result += \"83972241375657056057490261407972968652414535100474\"\n result += \"82166370484403199890008895243450658541227588666881\"\n result += \"16427171479924442928230863465674813919123162824586\"\n result += \"17866458359124566529476545682848912883142607690042\"\n result += \"24219022671055626321111109370544217506941658960408\"\n result += \"07198403850962455444362981230987879927244284909188\"\n result += \"84580156166097919133875499200524063689912560717606\"\n result += \"05886116467109405077541002256983155200055935729725\"\n result += \"71636269561882670428252483600823257530420752963450\"\n\n result\nend",
"def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend",
"def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend",
"def solution(a, b)\n if a.length > b.length\n return (b + a + b).to_s\n else\n return (a + b + a).to_s\n end\nend",
"def solution(number)\n sum = 0\n Array(1..number-1).each do |i|\n if i % 3 == 0 || i % 5 == 0\n sum += i\n end\n end\n sum\nend",
"def solutions(a)\r\n\r\n ary = a.sort\r\n ary.each_with_index do |num, index|\r\n if ary[index+1] != num + 1 && index != ary.length-1\r\n return num + 1\r\n end\r\n end\r\n\r\nend",
"def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend",
"def solution\n (2..(9**5 * 6)).select do |n|\n n.to_s.split(//).map do |d|\n d.to_i ** 5\n end.reduce(:+) == n\n end.reduce(:+)\nend",
"def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend",
"def solution(a)\r\n a.each do |num|\r\n if (a.count(num) % 2) != 0\r\n return num\r\n end\r\n end\r\nend",
"def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend",
"def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend",
"def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend",
"def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend",
"def solution(a)\n number = a.to_s.chars\n first_arrays = []\n (number.length/2).times do\n first_arrays << number.shift\n first_arrays << number.rotate(number.length-1).shift\n number.pop\n end\n ( first_arrays + number ).join(\"\").to_i\nend",
"def isLucky(n)\n a = n.to_s.split(\"\")\n full = a.count - 1\n half = a.count/2 - 1\n \n total_1 = 0\n total_2 = 0\n \n for i in 0..full\n if i > half\n total_2 += a[i].to_i\n else\n total_1 += a[i].to_i\n end\n end\n \n if total_1 == total_2\n true\n else\n false\n end\nend",
"def solution(n)\n n.to_s.split(//).inject(1) { |a,d| a + d.to_i }\nend",
"def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r\n arr = Array.new(q.count)\r\n \r\n \r\n\r\n \r\n arr.each_with_index{|el, i|\r\n \r\n ss = s[p[i]..q[i]]\r\n \r\n if ss.index('A') \r\n n = 1\r\n elsif ss.index('C')\r\n n=2\r\n elsif ss.index('G')\r\n n=3\r\n else \r\n n=4\r\n end\r\n \r\n arr[i] = n\r\n \r\n }\r\n \r\n \r\n \r\n arr\r\n \r\nend",
"def solution(n)\n # write your code in Ruby 2.2\n a = n.to_s(2)\n arr = []\n if a[-1] == '1'\n arr = a.split('1')\n else\n arr = a.split('1')\n arr.pop\n end\n if arr.max.nil?\n 0\n else\n arr.max.length\n end\nend",
"def decent_number(n)\n\tleft = 0\n\tright = 0\n\t(n+1).times do |i|\n\t\tleft = n - i \n\t\tright = n - left\n\t#\tputs \"#{left}%3 = #{left%3} | #{right}%5 = #{right%5}\"\n\t\tbreak if left % 3 == 0 && right % 5 == 0\n\tend\n\t#puts \"**l = #{left} r = #{right}\"\n\n\tif left % 3 == 0 && right % 5 == 0\n\t\tfives = \"5\"*left\n\t\tthrees = \"3\"*right\n\t\tputs fives+threes\n\telse\n\t\tputs -1\n\tend\nend",
"def alg; end",
"def solution(a)\n # write your code in Ruby 2.2\n permutation = Array(1..a.size)\n # puts permutation\n return 1 if permutation - a == []\n 0\nend",
"def problem18(r) \n h = r.length\n sum = 0\n for i in 0..h-1 \n \n end\nend",
"def solution1(seeds)\n turn_map = {}\n seeds.each_with_index { |n, turn| turn_map[n] = [1, turn + 1, turn + 1] }\n last_number = seeds.last\n\n ((seeds.length+1)..2020).each do |turn|\n last_stats = turn_map[last_number]\n if last_stats[TIMES_SPOKEN] == 1\n zero = turn_map[0] || [0, turn, turn]\n zero[TIMES_SPOKEN] += 1\n zero[FIRST_SPOKEN] = zero[LAST_SPOKEN]\n zero[LAST_SPOKEN] = turn\n \n turn_map[0] = zero\n last_number = 0\n else\n age = last_stats[LAST_SPOKEN] - last_stats[FIRST_SPOKEN]\n\n num = turn_map[age] || [0, turn, turn]\n num[TIMES_SPOKEN] += 1\n num[FIRST_SPOKEN] = num[LAST_SPOKEN]\n num[LAST_SPOKEN] = turn\n \n turn_map[age] = num\n last_number = age\n end\n end\n\n last_number\nend",
"def solution(n)\n # write your code in Ruby 2.2\n a = Math.sqrt(n).floor\n a -= 1 while n % a != 0\n b = n / a\n (a + b) * 2\nend",
"def recursive_solution\n\n end",
"def solution(n)\n n.to_s(2).reverse.to_i.to_s.split('1').map(&:length).max || 0\nend",
"def solution(a)\n ans = 0\n for i in 1 .. (a.length - 1)\n ans += a[i]\n end \n ans\nend",
"def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend",
"def captcha(input)\n sum = 0\n 0.upto(input.length - 1) do |i|\n sum += input[i].to_i if input[i] == input[(i+1) % input.length]\n end\n sum\nend",
"def formingMagicSquare(s)\r\n out = 100\r\n for i in 0...8 do\r\n cost = 0\r\n for j in 0...3 do\r\n for k in 0...3 do\r\n cost += ($magic_square[i][j][k] - s[j][k]).abs\r\n end\r\n end\r\n puts cost\r\n out = [out, cost].min\r\n end \r\n out\r\nend",
"def correct(element)\n result = nil\n element.downto(0).each do |j|\n i = element - j\n if j == element && j % 3 == 0\n result = Array.new(j, 5)\n elsif i % 5 == 0 && j % 3 == 0\n result = Array.new(j, 5) + Array.new(i, 3)\n elsif i == element && i % 5 == 0\n result = Array.new(i, 3)\n end\n\n break if result\n end\n\n if result.nil?\n puts -1\n else\n puts result.join()\n end\nend",
"def pzoe\n sum = 0\n (0..9).each do |a|\n (0..9).each do |b|\n (0..9).each do |c|\n (0..9).each do |e|\n (0..9).each do |f|\n (0..9).each do |g|\n sum += a * 100000 + b * 10000 + c * 1000 + e * 100 + f * 10 + g if a * 100000 + b * 10000 + c * 1000 + e * 100 + f * 10 + g == a ** 5 + b ** 5 + c ** 5 + e ** 5 + f ** 5 + g ** 5\n end\n end\n end\n end\n end\n end\n sum - 1\nend",
"def decodeHalfway(input)\n sum = 0\n\n # Only have to loop through half the array since the numbers are being compared halfway around\n # Multiply each matching character by 2 to compensate for not looping through its pair\n input.chars[0..input.length/2 - 1].each_with_index do |char, i|\n sum += 2*char.to_i if char == input[i + input.length/2]\n end\n sum\nend",
"def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend",
"def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend",
"def main\n max = 10 ** 9 + 7\n all = 1\n zero = 1\n nine = 1\n zn = 1\n N.times.each do\n all = all * 10 % max\n zero = zero * 9 % max\n nine = nine * 9 % max\n zn = zn * 8 % max\n end\n return (all - zero - nine + zn) % max\nend",
"def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend",
"def theLoveLetterMystery(s)\n chars = s.chars\n size = chars.length\n sum = 0\n ((size+1)/2..(size -1)).each do |i|\n num = chars[i].ord\n target_num = chars[size-1-i].ord\n sum += (num - target_num).abs\n end\n sum\nend",
"def is_happy(n)\n return false if n < 10 && n % 2 == 0\n return false if n < 1 \n return true if n == 1\n \n sum = 0\n\n nsplit = n.to_s.split(\"\")\n nsplit.each do |i|\n sum += (i.to_i * i.to_i)\n end\n\n return is_happy(sum)\n \nend",
"def solution(a)\n return 0 if a.length < 3\n a.sort!\n\n for i in 0..(a.length - 3)\n return 1 if a[i] + a[i + 1] > a[i + 2]\n end\n return 0\nend",
"def dominant_octopus(fish)\n #sorted = []\n return fish if fish.length < 2\n pivot = fish.first\n left = fish[1..-1].select { |feesh| feesh.length <= pivot.length }\n #p left\n right = fish[1..-1].select { |feesh| feesh.length > pivot.length }\n\n dominant_octopus(left) + [pivot] + dominant_octopus(right)\n \n\n\nend",
"def solution(a)\n return 1 if a.count == 0\n \n real_sum = a.inject(:+)\n expected_sum = (a.count + 1) * (a.count + 2) / 2.0\n (expected_sum - real_sum).to_i\nend",
"def solution_one\n x = 0\n (1..999).each do |i|\n if (i % 5) == 0 || (i % 3) == 0\n x = x + i\n end\n end\n x\nend",
"def featured(n)\n n += 1\n n += 1 until n % 7 == 0 && n.odd?\n loop do\n break if n.to_s.chars.uniq.join == n.to_s\n n += 14\n if n > 9876543210\n puts \"There is no possible number that fulfills those requirements\"\n return nil\n end\n end\n n\nend",
"def solution(a)\n # write your code in Ruby 2.2\n\n # sort a\n a = a.sort\n odd = 0\n\n # loop over the array\n (0..(a.length-1)).step(2) do |i|\n if((i+1 >= a.length) || ((i+1 < a.length) && (a[i] != a[i+1])))\n odd = a[i]\n break\n end\n end\n\n odd\nend",
"def solution(n)\n x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend",
"def solution(a)\n # write your code in Ruby 2.2\n numbers = Array(1..(a.size + 1))\n res = numbers - a\n res[0]\nend",
"def strong_num(n)\n array = n.to_s.chars.map(&:to_i)\n sumarray = []\n array.each do |number|\n sum = (1..number).inject(:*) || 1\n sumarray << sum\n end\n sumarray.sum == n ? \"STRONG!!!!\" : \"Not Strong !!\"\nend",
"def solution\n 971 * (-61)\nend",
"def isLucky(n)\n n = n.to_s.split('').map(&:to_i)\n n.shift(n.size/2).reduce(:+) == n.reduce(:+)\nend",
"def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend",
"def solution(n)\n sum = 0\n (1...n).each do |elem|\n sum += elem if elem % 3 == 0 or elem % 5 == 0\n end\n sum\nend",
"def hard(input)\n to = input / 10\n houses = Array.new(to, 0)\n (1..to).each do |n|\n count = 0\n n.step(by: n, to: to - 1) do |i|\n houses[i] += 11 * n\n count += 1\n break if count == 50\n end\n end\n houses.index { |count| count >= input }\nend",
"def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend",
"def solution(number)\n sum = 0\n for i in 1..number - 1\n if (i % 3 == 0 or i % 5 == 0)\n sum += i\n end\n i += i\n end\n return sum\nend",
"def solution(s)\n if s.length.odd?\n center = s.length / 2\n if s[0...center] == s[center + 1..s.length].reverse\n return center \n end\n end\n -1\nend",
"def featured(number)\n sum = 7\n loop do \n return \"There is no possible number that fulfills those requirements\" if number >= 9_876_543_210\n if sum <= number\n sum += 7\n elsif sum.even?\n sum += 7\n elsif sum.digits.uniq != sum.digits\n sum += 7\n else\n break\n end\n end\n sum\nend",
"def sample\n\n\tfor num in 1..100\n\t\tsum = 0\n\n\t\tfor j in 1..num-1\n\n\t\t\tif( num % j == 0 ) \n\t\t\t\tsum = sum + j\n\t\t\tend\n\n\t\tend\n\t\t\n\t\tif( sum == num ) \n\t\t\tputs \"perfect number : #{num}\"\n\t\tend\n\n\tend\n\nend",
"def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend",
"def problem3 n\n 2.step(n,1).each do |x|\n return x-1 if n == 1\n n /= x if x.prime? && (n % x == 0)\n end\nend",
"def solution(a)\n # write your code in Ruby 2.2\n counts = {}\n missing = -1\n\n a.each do |a_i|\n counts[a_i] = counts[a_i].to_i + 1\n end\n\n (1..a.length).each do |i|\n if(counts[i].nil?)\n missing = i\n break\n end\n end\n\n if(missing == -1)\n missing = a.length + 1\n end\n\n missing\nend",
"def solution(n)\n\t(1..n).map(&:to_s).map(&:chars).join.chars.map(&:to_i).reduce(:+)\nend",
"def solution(arr)\n zeros = 0\n pass_cars = 0\n\n (0...arr.size).each do |idx|\n arr[idx] == 0 ? zeros += 1 : pass_cars += zeros\n\n return -1 if pass_cars > 1000000000\n end\n\n pass_cars\nend",
"def solve(nums)\n count = 0\n nums.each do |num|\n if num.to_s.length % 2 != 0\n count += 1\n end\n end\n return count\nend",
"def is_armstrong(n)\n n_str=n.to_s()\n char_list=n_str.split(//)\n int_list=char_list.map {|x| (x.to_i())**(n_str.length()) }\n mysum = int_list.reduce(0) { |sum, num| sum + num }\n return (mysum==n)\nend",
"def day_2_part_2\n noun = 0\n verb = 0\n\n while noun < 100\n while verb < 100\n if compute(noun, verb) == 19690720\n return (100 * noun) + verb\n end\n verb += 1\n end\n noun += 1\n verb = 0\n end\nend",
"def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend",
"def solution(a)\n a.sort!\n a.each_with_index do |element, index|\n return 0 if element != index + 1\n end\n 1\nend",
"def solveProblem lst\n big = -1\n numbers = {}\n half = lst.length / 2\n lst.each do |i|\n if numbers.has_key?(i) then\n numbers[i] += 1\n else\n numbers[i] = 1\n end\n if numbers[i] > half then return i end\n end\n return big\nend",
"def problem_two\n\tfirst_num = 1 #Let first number be 1\n\tsecond_num = 1 #we need this to make 2nd num\n\tsum = 0\n\twhile sum < 4000000\n\t\tfirst_num, second_num = second_num, first_num + second_num\n\t\tif first_num.even?\t\n\t\t\tsum += first_num\t\n\t\tend\n\tend\n\tsum\nend",
"def part2(program)\n special = 19690720\n (0..99).to_a.repeated_permutation(2).each do |noun, verb|\n input = program.dup\n input[1] = noun\n input[2] = verb\n\n output = run(input)\n puts \"noun = #{noun}, verb = #{verb}, output = #{output[0]}\"\n if output[0] == special\n return [noun, verb]\n end\n end\n puts \"fuck\"\n return [-1, -1]\nend",
"def solution(a, b, k)\n # write your code in Ruby 2.2\n e = b / k\n s = (a-1) / k\n\n e - s\nend",
"def solution(num)\n sum_of_squares = 0\n\n (1..num).each do |number|\n sum_of_squares += number**2\n end\n\n square_of_sums = (1..num).inject(:+) ** 2\n\n p (square_of_sums - sum_of_squares).abs\nend",
"def getMoneySpent(keyboards, drives, budget)\n #\n # Write your code here.\n #\n highest_combination = -1\n keyboards.each do |keyboard|\n drives.each do |drive|\n sum = keyboard + drive\n highest_combination = sum if sum <= budget && sum > highest_combination\n end\n end\n highest_combination;\nend",
"def solution(a)\n\traise ArgumentError.new(\"a has to be non empty array of max size #{MAX_LEN}\") if !a.is_a? Array or a.empty? or a.length > MAX_LEN\n\tret = 0\n\t#puts a.inspect\n\tmy_h = Hash.new\n\ta.each do |e|\n\t\tif my_h.include? e\n\t\t\tmy_h[e] += 1\n\t\telse\n\t\t\tmy_h[e] = 1\n\t\tend\n\tend\n\n\tmy_h_sort = my_h.sort_by {|k, v| -v}\n\t# -> my_h_sort[value][occurances]\n\treturn 0 if my_h_sort.first[1] < a.size/2\n\tleader_val = my_h_sort.first[0]\n\n\tocc_array = Array.new\n\toccurances = 0\n\ta.each do |e|\n\t\toccurances += 1 if e == leader_val\n\t\tocc_array.push(occurances)\n\tend\n\t#puts occ_array.inspect\n\n\tfor idx in (0...a.length-1) do\n\t\tsum1 = occ_array[idx]\n\t\tsum2 = occ_array.last - occ_array[idx]\n\n\t\t# puts \"#{idx}+1 < #{sum1*2}\"\n\t\t# puts \"#{(a.length - idx -1)} < #{(sum2*2 )} \"\n\n\t\tif (idx+1) < sum1 * 2 && (a.length - idx - 1 ) < sum2 * 2\n\t\t\t## we have a leader\n\t\t\t#puts \"YEAH #{idx}\"\n\t\t\tret += 1\n\t\tend\n\t\t\t#puts \"-------- ret: #{ret}\"\n\tend\n\treturn ret\nend",
"def solution(a)\n # write your code in Ruby 2.2\n num_of_elements=a.length\n num_of_zeros=0\n tot_num_car_pairs=0\n a.each do |element|\n if element == 0\n num_of_zeros+=1\n else\n tot_num_car_pairs+=num_of_zeros\n end\n end\n return tot_num_car_pairs>1_000_000_000?-1:tot_num_car_pairs\nend",
"def solution(a)\n cars_going_east = [0]\n\n a.each do |direction|\n next_counter = direction.zero? ? cars_going_east.last + 1 : cars_going_east.last\n cars_going_east << next_counter\n end\n\n passings = 0\n a.each_with_index do |direction, index|\n passings += cars_going_east[index] if direction == 1\n end\n\n return -1 if passings > 1000000000\n passings\nend",
"def solution(n)\n\tval = 0.0\n\tval += 1.0 unless n[0].zero?\n\tval += 2.0 unless n[1].zero?\n\tval += 4.0 unless n[2].zero?\n\tval += 8.0 unless n[3].zero?\n val\n\t\nend",
"def minimumBribes(q)\n bribes = 0\n q.reverse.each_with_index do |n, i|\n if q[i] - (i + 1) > 2\n bribes = \"Too chaotic\"\n break\n end\n j = [0, q[i] - 2].max\n while j < i\n if q[j] > q[i]\n bribes += 1\n end\n j += 1\n end\n end\n puts bribes\nend",
"def solve\n 1.upto(100).inject(:*).to_s.split('').map{|x| x.to_i}.inject(:+)\nend",
"def solve(n, s, d, m)\n # Complete this function\n records = s;\n\n (1...n).each do |i|\n records[i] += records[i-1]\n end\n\n numberOfWays = (m <= n && records[m - 1] == d) ? 1 : 0;\n\n (m...n).each do |i|\n if records[i] - records[i - m] == d\n numberOfWays += 1\n end\n end\n\n numberOfWays\n\nend",
"def solution(digits)\n\tstop = digits.length - 4\n\tgo = 0\n\tlargest_number = 0\n\tindex = 0\n\n\twhile go < stop\n\t\ttest = \"\"\n\t\textra_index = index\n\t\t5.times do \n\t\t\ttest += digits[extra_index].to_s\n\t\t\textra_index += 1 \n\t\tend\n\t\tif test.to_i > largest_number\n\t\t\tlargest_number = test.to_i\n\t\tend \n\t\tindex += 1\n\t\tgo += 1 \n\tend \n\tlargest_number\nend",
"def solution(digits)\n result = 0\n digits.size.times do |n|\n new_number = digits[n...(n + 5)].to_i\n result = new_number if new_number > result\n end\n result\nend",
"def isHappy? n\n acc = {}\n acc[n] = true\n begin\n sum = 0\n n.to_s.split(\"\").map {|i| sum += i.to_i**2}\n\n if sum == 1 then return true\n elsif acc.has_key?(sum) then return false\n else acc[sum] = true end\n\n n = sum\n end while sum != 1\nend",
"def solution(a)\n # write your code in Ruby 2.2\n a.sort!\n min =1\n a.each{|x|\n if (x==min)\n min = min+1\n end\n }\n return min\nend",
"def solution(roman)\n split = roman.split(\"\")\n last_value = 0\n split.reduce(0) do |final, char|\n current = CONVERSION[char.upcase]\n binding.pry\n if current >= last_value\n final += current\n else\n final -= current\n end\n binding.pry\n last_value = current\n final\n end\nend",
"def solution(n)\n (1..n).to_a.join.chars.map(&:to_i).sum\nend",
"def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend",
"def answer\n composition = 1\n array = ['2,3,4,5']\n puts array\n array.split(',')\n #@inputArray = array\n #array.map!{|x| x.to_i}\n puts array\n #lastEvenIndex = last_even(array)\n #array.each_index {|x| composition*=array[x] if (array[x]%7).zero?}\n #array[lastEvenIndex] = composition\n #@modifiedArray = array\nend",
"def solution(n)\n sum = 0\n (1...n).each { |num| num % 3 == 0 || num % 5 == 0 ? sum += num : false }\n sum\nend"
] |
[
"0.63846064",
"0.6255908",
"0.6084379",
"0.5993604",
"0.5934277",
"0.59197694",
"0.5915114",
"0.5862419",
"0.58391076",
"0.5819009",
"0.58101237",
"0.5791203",
"0.57860905",
"0.5777768",
"0.5764495",
"0.57605153",
"0.57548004",
"0.5754786",
"0.575139",
"0.5749838",
"0.5749597",
"0.5748518",
"0.57479674",
"0.5747099",
"0.57405275",
"0.5729541",
"0.5729416",
"0.5720496",
"0.571676",
"0.56996644",
"0.5694308",
"0.56863827",
"0.5684911",
"0.56824696",
"0.56788516",
"0.5678042",
"0.5676602",
"0.5676433",
"0.56691086",
"0.56671965",
"0.56647974",
"0.5663638",
"0.56635684",
"0.56619513",
"0.56533766",
"0.5641956",
"0.5620463",
"0.5619751",
"0.5614267",
"0.5606623",
"0.56052303",
"0.56040096",
"0.5601736",
"0.56011844",
"0.559975",
"0.5598856",
"0.5596772",
"0.5593527",
"0.55916685",
"0.5586568",
"0.55745727",
"0.5563164",
"0.5563109",
"0.5560366",
"0.5557389",
"0.55465597",
"0.55433005",
"0.5542042",
"0.5535374",
"0.55308884",
"0.5526753",
"0.55263036",
"0.5525763",
"0.55217284",
"0.5516612",
"0.551242",
"0.5511799",
"0.55116165",
"0.550808",
"0.5507493",
"0.5506874",
"0.5503911",
"0.5503819",
"0.550296",
"0.5502203",
"0.54979414",
"0.54972374",
"0.54944676",
"0.54920846",
"0.5490922",
"0.548613",
"0.5484212",
"0.5482274",
"0.54808515",
"0.54781157",
"0.5473595",
"0.54723924",
"0.54696023",
"0.546845",
"0.5463521",
"0.54599303"
] |
0.0
|
-1
|
make a request to national rail like: train("INV", "ABD", "211113")
|
def train(origin, destination, date)
url = "http://ojp.nationalrail.co.uk/service/timesandfares/#{origin}/#{destination}/#{date}/0900/dep"
xml = Nokogiri::HTML(open(url).read)
#get prices
price_string = xml.css('.opsingle').inner_html
price_string.gsub!(/\s+/, "")
prices = price_string.scan(/£\d*.\d*/)
#get durations
duration_string = xml.css('.dur').inner_html
duration_string.gsub!(/\s+/, "")
duration_string.gsub!(/<abbrtitle="hours">h<\/abbr>/, ":")
duration_string.gsub!(/<abbrtitle="minutes">m<\/abbr>/, ",")
duration_string.gsub!(/^.*>/, "")
duration_string = duration_string.split(',')
durations = Array.new
duration_string.each do |d|
hours = d[0, d.index(':')]
mins = d[d.index(':')+1, d.length]
if mins[0,1] == "0"
mins = mins[1,1]
end
durations.push(Integer(hours)*60 + Integer(mins))
end
results = Array.new
prices.count().times do |count|
pair = [prices[count][1,prices[count].length], durations[count]] #rather messy way of taking out the £ at the last minute!
results.push(pair)
end
return results, url
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def train(query:)\n Trainer.train(query: query)\n end",
"def train_params\n params.require(:train).permit(:train_line, :route_name, :run_number, :operator_id)\n end",
"def make_request\n url = 'https://www.googleapis.com/qpxExpress/v1/trips/search?key=' + @api_key\n request = compose_request\n response = RestClient.post url, request, content_type: :json, accept: :json\n response.body\n end",
"def train_params\n\t\t\t#params = {\n\t\t\t#train: {name: \"the name\", origin: \"ORI\", admin: true} if you have admin param - its important to protect that, security\n\t\t\t#id: 3\n\t\t\t# utf8: \"J\"\n\t\t#}\n\n\t\t#if u want to permit to access everything - u can write: (params)permit!\n\t\t\tparams.require(:train).permit(:name, :origin, :destination, :capacity, :time)\n\n\t\tend",
"def create_train_selection\n puts 'Provide new train number in format NNN-NN or NNNNN (N - number or letter): '\n train_number = gets.chomp\n puts 'Select cargo (1) or passenger(2) train: '\n type = gets.chomp.to_i\n create_train(type, train_number)\n end",
"def set_train\n @train = Train.find(params[:id])\n end",
"def create_train(title = '[CREATE] Please choose Train type:')\n train_type = ask_choose_train_type(title)\n\n user_input_number = ask_enter('Train number')\n\n train = train_type.new(user_input_number)\n @trains << train\n puts \"\\n[SUCCESS] #{train} created!\"\n rescue StandardError => e\n show_error_message(e)\n retry\n end",
"def set_training\n data = CareerAdvisorWebServices.new(\"admin\",\"nagashri1\").get_code_for_title(params[:id])\n @key = data.present? ? data[0][\"onetsoc_code\"] : '00.000.00'\n end",
"def train_for(user)\n dataset = Predictors::StopRequestDataset.for(user)\n train(dataset)\n end",
"def train\n training = @prediction.trainedmodels.insert.request_schema.new\n training.id = 'emotion_prediction_id'\n training.storage_data_location = DATA_OBJECT\n result = @client.execute(\n :api_method => @prediction.trainedmodels.insert,\n :headers => {'Content-Type' => 'application/json'},\n :body_object => training\n )\n\n assemble_json_body(result)\n end",
"def make_request(url)\n res = Typhoeus::Request.new(\n url,\n method: :get,\n headers: {\n \"Accept-Charset\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n \"Accept-Language\" => \"en-US,en;q=0.9,pt;q=0.8\",\n \"X-Riot-Token\" => @api_key.to_s,\n \"User-Agent\": \"https://github.com/drish/rioter\"\n }\n ).run\n parse!(res)\n end",
"def train_api(mapid)\n url_safe_mapid = URI.encode(mapid)\n apiKey = \"73b6a68e9e4f450792ba730b84d8c506\"\n apiLink = \"http://lapi.transitchicago.com/api/1.0/ttarrivals.aspx?key=#{apiKey}&mapid=#{url_safe_mapid}\"\n apiResults = open(apiLink).read\n return Hash.from_xml(apiResults)\n end",
"def approve_train_selection(number)\n if @trains[number.to_sym]\n { success: true }\n else\n { success: false, 'errors': 'No such train number.' }\n end\n end",
"def create\n @train = Train.new(train_params)\n\n respond_to do |format|\n if @train.save\n format.html { redirect_to @train, notice: 'Train was successfully created.' }\n format.json { render action: 'show', status: :created, location: @train }\n else\n format.html { render action: 'new' }\n format.json { render json: @train.errors, status: :unprocessable_entity }\n end\n end\n end",
"def build_request_url(params)\n \"http://api.nytimes.com/svc/search/v2/articlesearch.json?\"+params\n end",
"def train_data\n ::RubyFann::TrainData.new(\n :inputs => inputs, \n :desired_outputs=> desired_outputs)\n end",
"def train_route_params\n params.require(:train_route).permit(:departure_station_id, :arrival_station_id, :train)\n end",
"def make_telly_request(url)\n # Uses Unirest to make the request\n\n # Create a new http object with the settings from the url(uri) object\n http = Net::HTTP.new(url.host, url.port)\n\n # use ssl for the request\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # Create a new request with the uri object\n request = Net::HTTP::Get.new(url)\n\n # set the right headers for RapidAPI\n # Rapid API key from environment variable\n request['x-rapidapi-host'] =\n 'utelly-tv-shows-and-movies-availability-v1.p.rapidapi.com'\n request['x-rapidapi-key'] = ENV['UTELLY_API_KEY']\n # '9d6d64d48dmsh56a7cd3df5b315ap180b67jsn5f6aa34f0119'\n\n # Make the actual request using the http object\n response = http.request(request)\n\n # Parse the json response into a hash and return it\n return JSON.parse(response.read_body)\n end",
"def train_flow request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_train_flow_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def request(url)\n # Allow the user to specify the full URL.\n remainder = url[0, base.length] == base ? url.sub(base, '') : url\n\n request = nil\n delim = remainder.include?('?') ? '&' : '?'\n @limiter.times 1 do\n request = NYTResponse.new(\"#{base}#{remainder}#{delim}api-key=#{key}\")\n end\n request\n end",
"def configure_training_request\n available_ledgers :training_request\n set_training_request\n end",
"def train(combos, rewards)\n RubyFann::TrainData.new(\n inputs: combos,\n desired_outputs: rewards\n )\n end",
"def request_trending\n base_uri = 'http://localhost:8888/developers'\n response = RestClient.get( base_uri, { params: { language: cleaned_query_param } } )\n @data = JSON.parse(response) \n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def make_request\n query = {'income': @income, 'zipcode': @zipcode, 'age': @age}\n begin\n response = HTTParty.get(BASE_URL, query: query)\n # I know I can do better than this\n rescue Exception => e\n raise RequestException\n else\n response\n end\n end",
"def add_train(train)\n trains << train\n end",
"def train_locomotive_params\n params.require(:train_locomotive).permit(:operator_id, :locomotive_class_name, :locomotive_class_number, :make_id, :locomotive_type_id, :box_number, :owner_id, :price, :decoder_id, :decoder_address, :picture, :delete_image)\n end",
"def request( params={} )\n if Biomart.proxy or ENV['http_proxy']\n proxy_uri = Biomart.proxy\n proxy_uri ||= ENV['http_proxy']\n proxy = URI.parse( proxy_uri )\n @@client = Net::HTTP::Proxy( proxy.host, proxy.port )\n end\n \n params[:url] = URI.escape(params[:url])\n \n if params[:method] === 'post'\n res = @@client.post_form( URI.parse(params[:url]), { \"query\" => params[:query] } )\n else\n res = @@client.get_response( URI.parse(params[:url]) )\n end\n \n # Process the response code/body to catch errors.\n if res.code != \"200\"\n raise HTTPError.new(res.code), \"HTTP error #{res.code}, please check your biomart server and URL settings.\"\n else\n if res.body =~ /ERROR/\n if res.body =~ /Filter (.+) NOT FOUND/\n raise FilterError.new(res.body), \"Biomart error. Filter #{$1} not found.\"\n elsif res.body =~ /Attribute (.+) NOT FOUND/\n raise AttributeError.new(res.body), \"Biomart error. Attribute #{$1} not found.\"\n elsif res.body =~ /Dataset (.+) NOT FOUND/\n raise DatasetError.new(res.body), \"Biomart error. Dataset #{$1} not found.\"\n else\n raise BiomartError.new(res.body), \"Biomart error.\"\n end\n end\n end\n \n return res.body\n end",
"def create_train(train_type)\n Train.new(\n @train_types.find do |type|\n type.to_s.eql? \"#{train_type.fetch('type')}T\"\n end\n )\n end",
"def train\n puts '>>> 1'\n train = RubyFann::TrainData.new(filename: './train.data')\n\n puts '>>> 2'\n @fann = RubyFann::Standard.new(num_inputs: @number_of_inputs, hidden_neurons: [@number_of_inputs/20, @number_of_inputs/40], num_outputs: @number_of_outputs)\n\n puts '>>> 3'\n @fann.train_on_data(train, 1000, 10, 0.1) # 1000 max_epochs, 10 errors between reports and 0.1 desired MSE (mean-squared-error)\n @fann.save('./headlines.net')\n\n puts '>>> 4'\n test\n end",
"def assign_route_to_train\n if @routes.empty? || @trains.empty?\n routes_or_trains_void\n else\n request = [\"Enter route name [#{@routes.keys.join(', ')}]: \"]\n route = getting(request, :approve_route_selection, :select_route)\n request = [\"Enter train number [#{@trains.keys.join(', ')}]: \"]\n train = getting(request, :approve_train_for_assign, :select_train)\n train.assign_route(route)\n end\n end",
"def train\r\n return @train\r\n end",
"def make_request(type, params)\n params[:key] = apiKey\n\n uri = URI.parse \"https://api.hypixel.net/#{type}\"\n uri.query = URI.encode_www_form params\n\n JSON.parse uri.open.read\n end",
"def create\n @trainbot = Trainbot.new(trainbot_params)\n @org = UttranceService.new\n @org.post_uttrance(trainbot_params[:message],trainbot_params[:intent],trainbot_params[:entity],trainbot_params[:start],trainbot_params[:end],trainbot_params[:body]\n )\n respond_to do |format|\n if @trainbot.save\n format.html { redirect_to @trainbot, notice: 'Trainbot was successfully created.' }\n format.json { render :show, status: :created, location: @trainbot }\n else\n format.html { render :new }\n format.json { render json: @trainbot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def train\n raise NotImplementedError\n end",
"def set_train_route\n @train_route = TrainRoute.find(params[:id])\n end",
"def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend",
"def link_to_station\n if @trains.empty? || @stations.empty?\n staions_or_trains_void\n else\n request = [\"Enter train number [#{@trains.keys.join(', ')}]: \"]\n train = getting(request, :approve_train_selection, :select_train)\n request = request_station\n station = getting(request, :approve_station_selection, :select_station)\n train_placed if station.arrive(train)\n end\n end",
"def trainrun_params\n params.require(:trainrun).permit(:status, :date, :trainnum)\n end",
"def index\n @init_url = \"https://crest-tq.eveonline.com/market/\" +\n \"10000002\" +\n \"/orders/\"+ \"sell\" + \"/?type=https://crest-tq.eveonline.com/types/\" +\n \"34\" +\n \"/\"\n end",
"def add_train(train)\n @trains << train\n end",
"def next_train(station, destinations, opts = {})\n ldbws.next_departures_with_details(station, destinations, opts)\n end",
"def train_query(word_ids, url_ids, selected_url)\n # generate a hidden node if necessary\n generate_hidden_node(word_ids, url_ids)\n \n setup_network(word_ids, url_ids)\n feed_forward\n targets = url_ids.map { |e| 0.0 }\n targets[url_ids.index(selected_url)] = 1.0\n error = back_propogate(targets)\n update_database\n end",
"def updateTrain()\n doc = Nokogiri::HTML(open(@site_info_main))\n doc.xpath(XPathMatchInfo.XPATH_STATUS).each do |x|\n @status = StringUtils.remove_newlines_tabs_and_spaces(x)\n end\n doc.xpath(XPathMatchInfo.XPATH_TRAIN_NAME).each do |x|\n @trainName = x.content\n end\n if @status =~ RegExpMatchInfo.REGEXP_STATE_NOT_STARTED\n @train.state = TrainState.NOT_STARTED\n elsif @status =~ RegExpMatchInfo.REGEXP_STATE_RUNNING or \\\n RegExpMatchInfo.REGEXP_STATE_FINISHED\n if @status =~ RegExpMatchInfo.REGEXP_NODELAY_STR\n @train.delay = 0\n else \n @train.delay = @status.match(RegExpMatchInfo.REGEXP_DELAY_STR)[1].to_i\n if @status.match(RegExpMatchInfo.REGEXP_DELAY_STR)[2] \\\n != RegExpMatchInfo.STR_DELAY_STR\n # train is ahead of time, delay is negative\n @train.delay *= -1\n end\n end\n if @status =~ RegExpMatchInfo.REGEXP_STATE_RUNNING\n @train.state = TrainState.RUNNING\n @train.lastUpdate = @status.match(\n RegExpMatchInfo.REGEXP_STATE_RUNNING)[3].strip\n @status = @status.match(RegExpMatchInfo.REGEXP_STATE_RUNNING)[1].rstrip\n else\n @train.state = TrainState.FINISHED\n end\n end\n\n @train.status = @status\n @train.trainName = @trainName\n end",
"def request(state)\n case state\n\n when :start\n puts 'got to request, case \"start\"'\n jdata = JSON.generate({sprinkle_agent_id: @sprinkle_agent_id, state: 1, key: @key})\n puts \"jdata --> #{jdata}\"\n RestClient.put \"http://#{@host_with_port}/sprinkles/1\", jdata, {:content_type => :json}\n\n when :stop\n jdata = JSON.generate({sprinkle_id: @sprinkle_id, state: 'stop', key: @key})\n puts \"jdata --> #{jdata}\"\n # RestClient.put \"http://#{@host_with_port}/sprinkle_agents/1\", jdata, {:content_type => :json}\n end\n end",
"def set_train(train)\r\n @train = train\r\n end",
"def train_route_params\n params.require(:train_route).permit(:route_id, :route_name, :train_stop_id)\n end",
"def set_trainmodel\n @trainmodel = Trainmodel.find(params[:id])\n end",
"def edit_train_wagons\n cases = { 1 => :add_wagon_to_train, 2 => :remove_wagon_from_train }\n if @trains.empty?\n puts 'There are no trains yet.'\n return\n end\n puts 'Select action with train: add wagon(1), remove wagon(2)'\n action = gets.chomp.to_i\n send(cases[action.to_s]) || incorrect_input\n end",
"def build_request origin, service, mode=\"TRANSIT,WALK\"\n\n if service.latlng.nil? \n return nil\n end\n\n {\n from: [\n origin[0],\n origin[1]\n ],\n to: [\n service.lat.to_s,\n service.lng.to_s\n ],\n trip_time: Time.now,\n arrive_by: true,\n label: \"#{service.id}_#{mode}\",\n options: {\n mode: mode,\n num_itineraries: 1\n }\n }\n end",
"def create\n @trainmodel = Trainmodel.new(trainmodel_params)\n\n respond_to do |format|\n if @trainmodel.save\n format.html { redirect_to @trainmodel, notice: 'Trainmodel was successfully created.' }\n format.json { render :show, status: :created, location: @trainmodel }\n else\n format.html { render :new }\n format.json { render json: @trainmodel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_train_route\n @train_route = TrainRoute.find(params[:id])\n end",
"def make_request_get_response_trend_availible\n @path_trend_availible = '/1.1/trends/available.json'\n @address_trend_availible = URI(\"#{@baseurl}#{@path_trend_availible}\")\n # Set up HTTP. Need ssL to make the connection\n @request_trend_availible = Net::HTTP::Get.new @address_trend_availible.request_uri\n @http = Net::HTTP.new @address_trend_availible.host, @address_trend_availible.port\n @http.use_ssl = true\n @http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n # Issue the request.\n @request_trend_availible.oauth! @http, @consumer_key_country, @access_token_country\n @http.start\n @response_trend_availible = @http.request @request_trend_availible\n @response_trend_availible\n end",
"def create_service_request\n # Geocode the address\n lat, long = Geocoder.coordinates(\"#{self.restaurant_address} , Chicago, IL\") \n\n HTTParty.post('http://311api.cityofchicago.org/open311/v2/requests.json', :body => { \n :api_key => SETTINGS[\"OPEN_311_KEY\"],\n :service_code => '4fd6e4ece750840569000019',\n :attribute => {\n :PLEASESE => 'FOODPOIS',\n :WHATISTH => self.restaurant_name,\n :ONWHATDA => self.date\n },\n :address_string => self.restaurant_address,\n :description => self.description,\n :lat => lat, \n :long => long, \n :first_name => self.first_name,\n :last_name => self.last_name,\n :email => self.email,\n :phone => self.phone\n })\n end",
"def create_train\n puts 'What type of train do you want to create: 1 - passenger or 2 - cargo:'\n type = gets.chomp.to_i\n puts 'Enter the number of train: '\n number = gets.chomp\n\n case type\n when 1\n self.trains << PassengerTrain.new(number)\n puts \"Passenger train was created with number: #{number}\"\n when 2\n self.trains << CargoTrain.new(number)\n puts \"Cargo train was created with number: #{number}\"\n else\n puts 'Something goes wrong..'\n end\n end",
"def download_tide_data(type='predict', view='text', language='english')\n res = Net::HTTP.post_form(\n URI.parse(POST_URL),\n {\n 'station' => @station,\n 'year' => @date.year,\n 'month' => @date.month,\n 'day' => @date.day,\n 'TZ' => @timezone, # TODO use supplied date for timezone\n 'queryType' => type,\n 'view' => view,\n 'language' => language\n }\n )\n # TODO rescue request errors\n res.body\n end",
"def approve_train_for_assign(number)\n if @trains[number.to_sym]\n { success: true }\n else\n { success: false, 'errors': 'There is no train or input is empty!' }\n end\n end",
"def initialize(ip, secret)\n @ip = ip\n @secret = secret\n \n @conn = SOAP::RPC::Driver.new(\"https://#{@ip}:17443\")\n @conn.add_method(\"neptune_start_job\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_put_input\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_get_output\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_get_acl\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_set_acl\", \"job_data\", \"secret\")\n @conn.add_method(\"neptune_compile_code\", \"job_data\", \"secret\")\n end",
"def training_params\n params.fetch(:training, {})\n end",
"def training_params\n params.fetch(:training, {})\n end",
"def index_info(params={})\n params[:numTerms]||=0\n send_request @opts[:luke_path], params\n end",
"def set_trainbot\n @trainbot = Trainbot.find(params[:id])\n end",
"def initialize\n @url_s = 'https://deezerdevs-deezer.p.rapidapi.com/search?q='\n\n end",
"def set_train_locomotive\n @train_locomotive = TrainLocomotive.find(params[:id])\n end",
"def new\n @trip = Trip.new\n @trains = Train.all.map { |train| [train.name, train.id] }\n end",
"def request\n url1 = url\n return false unless valid?\n http_response = HTTParty.post(url, :format => :plain,\n :query => @params.merge({ :cmd => @cmd }),\n :headers => {\n 'ZooZ-Unique-ID' => @unique_id,\n 'ZooZ-App-Key' => @app_key,\n 'ZooZ-Response-Type' => @response_type,\n }) if @response_type.eql?('NVP')\n\n\n\n http_response = HTTParty.post(url, :format => :json,\n :body => @params.merge({ :cmd => @cmd }),\n :headers => {\n 'ZooZDeveloperId' => @developer_id,\n 'ZooZServerAPIKey' => CGI::escape(@app_key)\n }) if @response_type.eql?('JSON')\n\n response = Response.new\n response.request = self\n response.http_response = http_response\n unless response.success?\n @errors = response.errors\n return false\n end\n response\n end",
"def connect_to_nylas(data)\n code = nylas_code(data)\n data = {\n :client_id => NYLAS_CLIENT_ID,\n :client_secret => NYLAS_CLIENT_SECRET,\n :code => code\n }\n nylas_access_token = nylas_token(data)\n session[:nylas_access_token] = nylas_access_token\nend",
"def set_trainrun\n @trainrun = Trainrun.find(params[:id])\n end",
"def typhoeus_request # rubocop:disable Metrics/MethodLength\n request = Typhoeus::Request.new(\n @url,\n method: @method,\n headers: {\n 'aftership-api-key' => @api_key,\n 'Content-Type' => 'application/json'\n }\n )\n\n request.options[:body] = MultiJson.dump(@body) if @body\n make_verbose(request) if AfterShip.debug\n\n request\n end",
"def request_translation(params = {})\n response = Unirest.post(\"#{Unbabel::Client::ENDPOINT}/translation/\",\n parameters: params.to_json)\n response.body\n end",
"def make_request\n { RequestParameters: {}, SearchParameters: { 'ins1:Postcode' => postcode.upcase },\n SelectionOptions: { 'ins1:MaximumNumberOfRows' => 200, 'ins1:IncludeNonGeographicAddresses' => false,\n 'ins1:IncludeBFPOAddresses' => false, 'ins1:IncludeMultiResidenceAddresses' => false,\n 'ins1:IncludeNIAddresses' => true } }\n end",
"def set_training_request\n @training_request = TrainingRequest.find(params[:training_request_id])\n end",
"def spe_training\n\tend",
"def train\n \n # Current state of the action\n success = false\n \n message = \"\"\n \n # Check all the parameters are available, and add face\n if !params[:face].nil? && !params[:ref].nil? && @user.add_face(params[:ref],params[:face])\n \n # Action was a success\n success = true\n \n # Notice message\n message = \"Face was successfully added to your set\"\n \n else\n \n # Notice message\n message = \"Face could not be added to your set\"\n \n end\n \n flash[:notice] = message\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { render :json => { :success => success, :message => message } }\n end\n \n end",
"def initialize(number)\n super(number, :cargo) #recieves all the train methods as a subclass\n end",
"def list_of_train_direction(direction,trains)\n train_list = []\n trains.each do |train|\n if direction == train[:direction]\n train_list << train[:train]\n end\n end\n return train_list\nend",
"def make_request_get_response_trend_place(woeid, country)\n #EX: #https://api.twitter.com/1.1/trends/place.json?id=woeid\n @path_trend_place = \"/1.1/trends/place.json?id=\"\n @country = @country\n #woeid is the where in the world yahoo place id \n @woeid = woeid\n @address_trend_place = URI(\"#{@baseurl}#{@path_trend_place}#{@woeid}\")\n @request_trend_place = Net::HTTP::Get.new @address_trend_place.request_uri\n @http = Net::HTTP.new @address_trend_place.host, @address_trend_place.port\n @http.use_ssl = true\n @http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n # Issue the request.\n if @country == 'cntry'\n @request_trend_place.oauth! @http, @consumer_key_country, @access_token_country\n @http.start\n @response_trend_place = @http.request @request_trend_place\n @response_trend_place\n\n elsif @country != 'cntry'\n @request_trend_place.oauth! @http, @consumer_key_places, @access_token_places\n @http.start\n @response_trend_place = @http.request @request_trend_place\n @response_trend_place\n end\n @response_trend_place\n end",
"def find(key)\n url = url_for(\"organizers\", credentials.organizer_key, \"trainings\", key)\n response = http_client.get(url)\n\n if response.ok?\n training = Resource::Training.new Resource::Training.deserialize(response.data)\n end\n\n [response, training]\n end",
"def iod_request (api, params)\r\n uri = URI(\"http://api.idolondemand.com/1/api/async/#{api}/v1\")\r\n uri.query = URI.encode_www_form(params)\r\n res = Net::HTTP.get_response(uri, p_addr = $proxy_host, p_port = $proxy_port)\r\n jobid = JSON.parse(res.body)['jobID']\r\n puts \"Post request jobid [#{jobid}]\"\r\n return job_results(jobid)\r\nend",
"def set_training_request\n @training_request = TrainingRequest.includes(:assigned_to_user, :requested_by_user, :general_ledgers).find(params[:id])\n end",
"def create_itineraries(params)\n\n transit_response = nil\n Rails.logger.info \"CREATE: \" + params[:modes].collect {|m| m.code}.join(\",\")\n # remove_existing_itineraries\n itins = []\n \n params[:modes].each do |mode|\n\n Rails.logger.info('CREATING ITINERARIES FOR TRIP PART ' + self.id.to_s)\n Rails.logger.info(mode)\n case mode\n # start with the non-OTP modes\n when Mode.taxi\n timed \"taxi\" do\n taxi_itineraries = TaxiItinerary.get_taxi_itineraries(self, [from_trip_place.location.first, from_trip_place.location.last],[to_trip_place.location.first, to_trip_place.location.last], trip_time, trip.user)\n itins << taxi_itineraries if taxi_itineraries.length > 0\n itins.flatten!\n end\n when Mode.paratransit\n timed \"paratransit\" do\n itins += ParatransitItinerary.get_itineraries(self)\n end\n when Mode.rideshare\n timed \"rideshare\" do\n itins += create_rideshare_itineraries\n end\n when Mode.ride_hailing \n timed \"ride_hailing\" do\n itins += RideHailingItinerary.get_itineraries(self)\n end\n else\n # OTP modes\n if (!mode.otp_mode.blank?)\n # Transit modes + Bike, Drive,\n timed \"fixed\" do\n start = Time.now\n new_itins, response = create_fixed_route_itineraries({otp_mode: mode.otp_mode, mode: mode.code, walk_mph: params[:walk_speed], max_walk_miles: params[:max_walk_miles], max_walk_seconds: params[:max_walk_seconds], optimize: params[:optimize], num_itineraries: params[:num_itineraries], min_transfer_time: params[:min_transfer_time], max_transfer_time: params[:max_transfer_time], banned_routes: params[:banned_routes], preferred_routes: params[:preferred_routes]})\n\n if mode.code == \"mode_transit\"\n transit_response = response\n end\n\n puts 'CREATE FIXED_ ROUTE ITINERARIES ###'\n puts Time.now - start\n non_duplicate_itins = []\n start = Time.now\n new_itins.each do |itin|\n unless self.check_for_duplicates(itin, self.itineraries + itins)\n non_duplicate_itins << itin\n end\n end\n puts 'Check for Duplicates ###'\n puts Time.now - start\n\n itins += non_duplicate_itins\n end\n end\n end\n end\n #self.itineraries << itins\n return itins, transit_response\n end",
"def request(*args); end",
"def show_wagons_by_train\n if @trains.empty?\n trains_or_wagons_void\n else\n request = [\"Enter the train number: [#{@trains.keys.join(', ')}]: \"]\n getting(request, :approve_train_for_wagons_show, :show_wagon)\n end\n end",
"def search_directions\n @query = 1\n @error = 0\n @departure_address = params[:departure_address]\n @arrival_address = params[:arrival_address]\n bus_transit = params[:bus_transit]\n train_transit = params[:train_transit]\n metra_transit = params[:metra_transit]\n @preferred = params[:preferred]\n apikey = \"AIzaSyCDeWWmT-KYmsgSz9d2vCy0KcOmJe114y4\"\n\n if @departure_address != \"\" && @arrival_address != \"\"\n url_safe_dep = URI.encode(@departure_address)\n url_safe_arr = URI.encode(@arrival_address)\n @type_transport = ''\n\n if !bus_transit.nil?\n @type_transport = bus_transit\n end\n\n if !train_transit.nil?\n @type_transport += \"|\" + train_transit\n end\n\n if !metra_transit.nil?\n @type_transport += \"|\" + metra_transit\n end\n\n if !@type_transport != '' && !@preferred.nil? && @preferred != \"\"\n url_safe_typ = URI.encode(@type_transport)\n url_safe_pref = URI.encode(@preferred)\n apiLink = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{url_safe_dep}&destination=#{url_safe_arr}&mode=transit&alternatives=true&transit_mode=#{@url_safe_typ}&transit_routing_preference=#{url_safe_pref}&key=#{apikey}\"\n\n elsif !@type_transport != ''\n url_safe_typ = URI.encode(@type_transport)\n apiLink = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{url_safe_dep}&destination=#{url_safe_arr}&mode=transit&alternatives=true&transit_mode=#{url_safe_typ}&key=#{apikey}\"\n\n elsif !@preferred.nil? && @preferred != \"\"\n url_safe_pref = URI.encode(@preferred)\n apiLink = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{url_safe_dep}&destination=#{url_safe_arr}&mode=transit&alternatives=true&transit_routing_preference=#{url_safe_pref}&key=#{apikey}\"\n else\n apiLink = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{url_safe_dep}&destination=#{url_safe_arr}&mode=transit&alternatives=true\"\n end\n\n @directions = JSON.parse(open(apiLink).read, object_class: OpenStruct)\n\n if @directions.status == \"OK\"\n @routes = @directions.routes\n @error = 0\n else\n @message = \"No station found, try again\"\n @error = 1\n end\n else\n @message = \"Please enter a value for departure and arrival address\"\n @error = 1\n end\n\n #render :json => @routes\n render 'directions'\n end",
"def create\n @trainrun = Trainrun.new(trainrun_params)\n\n respond_to do |format|\n if @trainrun.save\n format.html { redirect_to @trainrun, notice: 'Trainrun was successfully created.' }\n format.json { render :show, status: :created, location: @trainrun }\n else\n format.html { render :new }\n format.json { render json: @trainrun.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trainclass_params\n params.require(:trainclass).permit(:name, :train_id, :totalseats, :fare)\n end",
"def create(params)\n http.post(\"/nfse\", { body: params }) do |response|\n respond_with_entity(response)\n end\n end",
"def training_params\n params.require(:training).permit(:trainable_id, :trainable_type, :facility_id, :date, :description, :on_spikes)\n end",
"def show_train(name)\n selected_station = select_station(name)\n selected_station.each_train do |train|\n puts \"Train number: #{train.number}\"\n puts \"Train type: #{train.type}\"\n puts \"Train speed: #{train.speed}\"\n puts \"Wagons list: #{train.wagons.size}\"\n end\n end",
"def build_request\n client.request request_name\n end",
"def set_weight_trainning\n @weight_trainning = WeightTrainning.find(params[:id])\n end",
"def set_training_method\n @training_method = TrainingMethod.find(params[:id])\n end",
"def fetchTriples(dataDir, minConfidence)\n return NellELoad.allTriples(dataDir, minConfidence, NellE::STRICT_TRAINING_REL_FILENAMES)\nend",
"def trainer_params\n params.require(:trainer).permit(:siren, :sigle, :effectif, :adresse, :nom_dirigeant, :email_dirigeant, :crawled_for_email)\n end",
"def request(method, params)\n response = PARSER.xml_in(http_get(request_url(method, params)), { 'keeproot' => false,\n 'forcearray' => %w[List Campaign Subscriber Client SubscriberOpen SubscriberUnsubscribe SubscriberClick SubscriberBounce],\n 'noattr' => true })\n response.delete('d1p1:type')\n response\n end",
"def trainbot_params\n params.require(:trainbot).permit(:message, :intent, :entity, :start, :end, :body)\n end",
"def training_params\n params.require(:training).permit(:kms, :time, :date, :runner_id, :shoe_id, :description, :comments, :hours, :minutes, :seconds)\n end",
"def test\n rows = Util.get_rows(:file => 'data/vehicles.csv', :n => 3000, :pre_process => true)\n classes = rows.transpose.last\n rows = rows.transpose[0..-2].transpose\n train(rows.first(2000), classes.first(2000))\n \"#{classes.last} classified as #{classify(rows.last)}\"\n end",
"def create\n @spltrain = Spltrain.new(spltrain_params)\n\n respond_to do |format|\n if @spltrain.save\n format.html { redirect_to @spltrain, notice: 'Spltrain was successfully created.' }\n format.json { render :show, status: :created, location: @spltrain }\n else\n format.html { render :new }\n format.json { render json: @spltrain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def training_params\n params.require(:training).permit(:name, :number, :notice).tap do |whitelisted|\n whitelisted[:exercise_param] = params[:training][:exercise_param]\n whitelisted[:exercise_param_f] = params[:training][:exercise_param_f]\n whitelisted[:exercise_param_s] = params[:training][:exercise_param_s]\n whitelisted[:exercise_param_t] = params[:training][:exercise_param_t]\n whitelisted[:exercise_param_fr] = params[:training][:exercise_param_fr]\n whitelisted[:exercise_param_fv] = params[:training][:exercise_param_fv]\n whitelisted[:exercise_param_sx] = params[:training][:exercise_param_sx]\n whitelisted[:exercise_param_sv] = params[:training][:exercise_param_sv]\n whitelisted[:exercise_param_cardio] = params[:training][:exercise_param_cardio]\n \n end\n end",
"def cert_num\n \t# training_id = params[:training_id]\n \tdb = Mdb.open(\"/Users/corrinasthename/Desktop/cs169/BCGC.mdb\")\n trainings = db[:tblTraining]\n end"
] |
[
"0.6190405",
"0.5961827",
"0.58726203",
"0.5859995",
"0.57776934",
"0.5648438",
"0.5646053",
"0.56196856",
"0.5581352",
"0.55779755",
"0.5525539",
"0.55188817",
"0.5481776",
"0.54337704",
"0.54244375",
"0.53712434",
"0.53677875",
"0.53632045",
"0.53405464",
"0.5299907",
"0.527832",
"0.52713555",
"0.52238667",
"0.52112335",
"0.5207683",
"0.5192635",
"0.51900154",
"0.51759094",
"0.5173314",
"0.51465654",
"0.5143417",
"0.51384664",
"0.51361334",
"0.513537",
"0.51340365",
"0.51297486",
"0.51290464",
"0.5126421",
"0.51141465",
"0.51084095",
"0.50999427",
"0.50907445",
"0.50889784",
"0.5088431",
"0.5088113",
"0.50817597",
"0.5081294",
"0.5063833",
"0.50610554",
"0.50506586",
"0.5049257",
"0.5045807",
"0.50398964",
"0.5038977",
"0.50294924",
"0.50253004",
"0.5013488",
"0.49992925",
"0.49881646",
"0.49881646",
"0.49790883",
"0.49784908",
"0.497103",
"0.4967347",
"0.49617192",
"0.4959802",
"0.49586558",
"0.49535087",
"0.49517542",
"0.49422443",
"0.49334982",
"0.49307194",
"0.49241033",
"0.49174774",
"0.49152365",
"0.48983273",
"0.48937178",
"0.48889464",
"0.48875383",
"0.48744556",
"0.48738515",
"0.48668617",
"0.48649544",
"0.48642325",
"0.48625267",
"0.48588333",
"0.48573032",
"0.48532787",
"0.48484278",
"0.48461744",
"0.48460874",
"0.48448",
"0.48442057",
"0.48435596",
"0.4840345",
"0.4838161",
"0.48361918",
"0.48309684",
"0.4827544",
"0.48220155",
"0.48209113"
] |
0.0
|
-1
|
make a request to megabus like: bus("49", "56", "211113")
|
def bus(origin, destination, date)
param_date = date[0,2] + "%2f" + date[2,2] + "%2f20" + date[4,2] #megabus uses odd date formats
url = "https://uk.megabus.com/JourneyResults.aspx?originCode=#{origin}&destinationCode=#{destination}&outboundDepartureDate=#{param_date}&passengerCount=1&transportType=-1"
xml = Nokogiri::HTML(open(url).read)
#get prices
price_string = xml.css('ul.standard>li.five>p').to_s
price_string.gsub!(/\s+/, "")
price_string.gsub!(/[<p>\/]/, '')
prices = price_string.split('£')
prices.delete_at(0)
#get durations
dur_string = xml.css('ul.standard>li.three>p').to_s
dur_string.gsub!(/\s+/, "")
dur_string.gsub!(/></, ',')
dur_string.gsub!(/[<p>\/]/, '')
dur_string.gsub!('hrs', ':')
dur_string.gsub!('mins', '')
duration_string = dur_string.split(',')
durations = Array.new
duration_string.each do |d|
hours = d[0, d.index(':')]
mins = d[d.index(':')+1, d.length]
if mins[0,1] == "0"
mins = mins[1,1]
end
durations.push(Integer(hours)*60 + Integer(mins))
end
#prepare results
results = Array.new
prices.count().times do |count|
pair = [prices[count], durations[count]]
results.push(pair)
end
return results, url
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def request(params=Hash.new, &result_cbk)\n\n cmd = params.delete :cmd\n prefix = params.delete :prefix\n cont = params.delete :cont\n offset = params.delete :offset\n len = params.delete :len\n\n if cont.is_a? String\n cont=request_string(cont)\n elsif cont.is_a? Integer\n cont=request_int(cont)\n end\n raise ArgumentError, \":cont should be an Enumerable\" if !cont.nil? and !cont.is_a? Enumerable\n if len.nil?\n len=(cont.nil?) ? 0 : cont.length\n end\n\n offset||=0\n\n\n if (!cont.nil?)\n raise \":cont shouldn't contain anything but Fixnum\" if cont.any? {|v| !v.is_a? Fixnum}\n if (offset>=cont.length)\n cont=nil;len=0\n elsif (len>cont.length-offset)\n len=cont.length-offset\n end\n end\n offset=0 if offset<0\n len=0 if len<0\n contlen=(cont.nil?) ? 0 : len\n contlen+=prefix.length if (!prefix.nil? and prefix.length>0)\n\n hdr=Array.new(16)\n set_int(cmd,hdr,0)\n set_int(contlen,hdr,4);\n 8.upto(15) {|i| hdr[i]=0}\n if (cmd!=-1)\n io.write(hdr.pack(\"C*\"))\n if (!prefix.nil? && prefix.length>0)\n io.write(prefix.pack(\"C*\"))\n debug \"SEND PREFIX #{prefix}\"\n end\n if (!cont.nil? and cont.length>0)\n debug \"SEND CONTENT #{cont.slice(offset, len)} (#{offset},#{len})\"\n io.write(cont.slice(offset, len).pack(\"C*\"))\n end\n end\n\n io.on_recv(16) do |chunk|\n #\"Expecting 16 bytes...\" if $DEBUG\n ih = chunk.unpack(\"C*\")\n if (ih.length != 16)\n debug \"Received #{ih.length} of expected 16.\"\n result_cbk.call(nil)\n return\n end\n debug \"Answer: #{ih.to_s}\"\n\n rep=get_int(ih, 0);\n rl =get_int(ih,4);\n\n debug \"rep: #{rep} #{rep.class} #{rep & 0x00FFFFFF}\"\n debug \"rl: #{rl} #{rl.class}\"\n\n if (rl>0)\n ct=Array.new();\n io.on_recv(rl) do |chunk|\n ct = chunk.unpack(\"C*\")\n debug \"ct: #{ct.size}\"\n result_cbk.call(Rserve::Packet.new(rep, ct))\n end\n else\n result_cbk.call(Rserve::Packet.new(rep, nil))\n end\n end\n end",
"def send_request_to_bibs_microservice\n 20.times do |x|\n stub_request(:get, \"#{ENV.fetch('BIBS_MICROSERVICE_URL_V01', nil)}?standardNumber=#{ 9781896580601 + x }\").\n with(\n headers: {\n 'Authorization' => 'Bearer testoken',\n 'Content-Type' => 'application/json'\n }).to_return(status: 200, body: MODIFIED_BOOK_JSON_FOR_ISBN_9782917623268, headers: {})\n end\n stub_request(:get, \"#{ENV.fetch('BIBS_MICROSERVICE_URL_V01', nil)}?standardNumber=123456789\").\n with(\n headers: {\n 'Authorization' => 'Bearer testoken',\n 'Content-Type' => 'application/json'\n }).to_return(status: 200, body: JSON_FOR_BOOK_WITH_ISBN_AND_TITLE_TOO_LONG, headers: {})\n end",
"def mock_send_request_to_items_microservice\n items_query_params = \"?bibId=998&limit=25&offset=0\"\n stub_request(:get, \"#{ENV.fetch('ITEMS_MICROSERVICE_URL_V01', nil)}\" + items_query_params).\n with(\n headers: {\n 'Authorization' => 'Bearer testoken',\n 'Content-Type' => 'application/json'\n }).to_return(status: 200, body: ITEM_JSON_REQUEST_BODY, headers: {})\n\n items_query_params = \"?bibId=999&limit=25&offset=0\"\n stub_request(:get, \"#{ENV.fetch('ITEMS_MICROSERVICE_URL_V01', nil)}\" + items_query_params).\n with(\n headers: {\n 'Authorization' => 'Bearer testoken',\n 'Content-Type' => 'application/json'\n }).to_return(status: 200, body: ITEM_JSON_REQUEST_BODY, headers: {})\n end",
"def bookdevice(token, duration = 5 , id)\n\nuri = URI.parse(\"https://device.pcloudy.com/api/book_device\")\n@toSend = {\n \"token\" => token ,\"duration\"=>duration, \"id\"=>id\n}.to_json\n\nhttps = Net::HTTP.new(uri.host,uri.port)\nhttps.use_ssl = true\n\nreq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})\n\nreq.body = \"#{@toSend}\"\nres = https.request(req)\nputs \"Response #{res.code} #{res.message}: #{res.body}\"\nbookingdetails = JSON.parse(res.body)\n\nrid = bookingdetails[\"result\"][\"rid\"]\nreturn rid\nend",
"def send_request method, params, &block\n message = {\n jsonrpc: \"2.0\",\n method: method,\n params: params,\n id: @next_request_id\n }\n json = message.to_json\n requests[@next_request_id] = Request.new(@next_request_id, &block)\n envelope = \"Content-Length: #{json.bytesize}\\r\\n\\r\\n#{json}\"\n queue envelope\n @next_request_id += 1\n end",
"def send_request_to_items_microservice(bibid,offset=nil,response=nil,items_hash={})\n limit = 25\n offset = offset.nil? ? 0 : offset += 1\n request_offset = limit.to_i * offset.to_i\n items_found = response && (response.code == 200 || items_hash['data'].present?)\n\n if response && (response.code != 200 || (items_hash['data'].present? && response['data'].size.to_i < limit))\n return items_hash, items_found\n else\n items_query_params = \"?bibId=#{bibid}&limit=#{limit}&offset=#{request_offset}\"\n response = HTTParty.get(ENV.fetch('ITEMS_MICROSERVICE_URL_V01', nil) + items_query_params, headers: { \n 'authorization' => \"Bearer #{Oauth.get_oauth_token}\", 'Content-Type' => 'application/json' }, timeout: 10)\n \n if response.code == 200 || items_hash['data'].present?\n resp = (ENV['RAILS_ENV'] == 'test')? JSON.parse(response) : response\n items_hash['data'] ||= []\n items_hash['data'] << resp['data'] if resp['data'].present?\n items_hash['data'].flatten!\n LogWrapper.log('DEBUG', {\n 'message' => \"Response from item services api\",\n 'method' => 'send_request_to_items_microservice',\n 'status' => response.code,\n 'responseData' => response.message\n })\n elsif response.code == 404\n items_hash = response\n LogWrapper.log('DEBUG', {\n 'message' => \"The items service could not find the Items with bibid=#{bibid}\",\n 'method' => 'send_request_to_items_microservice',\n 'status' => response.code\n })\n else\n LogWrapper.log('ERROR', {\n 'message' => \"An error has occured when sending a request to the bibs service bibid=#{bibid}\",\n 'method' => 'send_request_to_items_microservice',\n 'status' => response.code\n })\n end\n end\n\n #Recursive call\n send(__method__, bibid, offset, response, items_hash)\n end",
"def request cmd, params = nil, &block\n id = @i += 1\n @requests[id] = block if block\n log.debug { \"request: #{cmd} #{args.inspect}\" }\n register_monitor_callbacks(params) if cmd.to_sym == :monitor\n request = { id: id, method: cmd }\n request[:params] = params if params\n send_data(request.to_json + \"\\x00\")\n end",
"def request(function_name, *para)\n id_count = id\n para = {'method' => function_name, 'params' => para, 'id' => id_count}\n .to_json\n send_request(para)\n result = get_response\n if result.empty? or result == nil\n raise(RpcError.new(\"empty respons\"))\n end\n response = JSON.load(result)\n if response[\"error\"] != nil\n raise(RpcError.new(response[\"error\"]))\n elsif response[\"id\"] != id_count\n raise(RpcError.new(\"server send wrong data.\"))\n end\n response[\"result\"]\n end",
"def one_bus_away(method, id=nil, params={})\n\t\t# optional id parameter. omit it and it will be ignored\n\t\tif id.class() == Hash \n\t\t\tparams = id\n\t\t\tid = nil\n\t\tend\n\n\t\t# prepare the query parameter string\n\t\t# params['includeReferences'] = false\n\t\t[:format, :controller, :action, :method, :id].each {|key| params.delete key }\n\t\t@query = params.map {|key, value| \"#{key}=#{value}\"}.join('&')\n\t\t\n\t\t# encode ID in URL if it exists\n\t\tmethod += \"/\" + ERB::Util.url_encode(id) unless id.nil?\n\n\t\tputs \"method: #{method}, query: #{@query}\"\n\t\tresult = get_json(\"http://api.onebusaway.org/api/where/#{method}.json?key=TEST&#{@query}\")['data']\n\t\t(result.is_a?(Hash) and result.has_key?('entry')) ? result['entry'] : result\n\tend",
"def make_request(new_request) \n puts \"[Controller:make_request] request '#{new_request.id}' will be submitted to arduino\"\n return error_msg(:arduino_address) unless address_valid?(new_request.address)\n \t\treturn Interface::ArduinoClient.register_request(new_request)\n rescue Exception => error; return error_msg(:timeout, error)\n end",
"def generate_smb_request_and_check(ip, port = 445, _debug = false)\n # do the request (store as string and funky format bc of usage in core.. and json conversions)\n response_hash = grab_response_smb(ip, port)\n details = {\n 'details' => response_hash\n }\n results = []\n\n # generate the checks\n checks = []\n unless Intrigue::Ident::Smb::CheckFactory.checks.nil?\n checks = Intrigue::Ident::Smb::CheckFactory.checks.map do |x|\n x.new.generate_checks\n end.compact.flatten\n end\n # and run them against our result\n checks.each do |check|\n results << match_smb_response_hash(check, details)\n end\n { 'fingerprint' => results.uniq.compact, 'response' => response_hash, 'content' => [] }\n end",
"def microservice_i(id)\r\n my_port = 8082\r\n store_message = \"/store/#{id}/#{$light}/#{$suit}/#{$wealth}/#{$sword}/#{$amulet}/#{$axe}/#{$food}/#{0}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{store_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n\r\n $light = my_json['light']\r\n $suit = my_json['suit']\r\n $wealth = my_json['wealth']\r\n $sword = my_json['sword']\r\n $amulet = my_json['amulet']\r\n $axe = my_json['axe']\r\n $food = my_json['food']\r\n puts(\"#{my_json['text']}\\n\")\r\n\r\n if id == 4\r\n food_units = gets.strip.to_i\r\n buy_food(7,food_units)\r\n end\r\nend",
"def request(type, path)\n response = connection.send(type) do |req|\n req.url path\n req.params[\"maxResult\"] = 1_000\n req.headers.merge! headers\n yield req if block_given?\n end\n\n raise KontaktIo::Error.classify(response.status) unless response.success?\n\n response\n end",
"def notifyViaSMS(number, message, api, user, password)\n result = nil\n message = CGI.escape message\n request = \"/http/sendmsg?api_id=#{api}&user=#{user}&password=#{password}&to=#{number}&text=#{message}&from=RIVR\" \n Net::HTTP.start( 'api.clickatell.com', 80 ) { |http| result = http.get(request).body } \n return result \n end",
"def request(user_id, chunk_id)\n \n end",
"def request(*args, &block); end",
"def billing\n user_agent = request.env['HTTP_USER_AGENT']\n #parameter = Parameter.first\n transaction_id = DateTime.now.to_i\n\n request = Typhoeus::Request.new(\"http://37.0.73.3:3778\", followlocation: true, params: {transaction_id: transaction_id, msisdn: @account.msisdn, price: \"50\"})\n\n#=begin\n request.on_complete do |response|\n if response.success?\n result = response.body\n elsif response.timed_out?\n result = Error.timeout(@screen_id)\n elsif response.code == 0\n result = Error.no_http_response(@screen_id)\n else\n result = Error.non_successful_http_response(@screen_id)\n end\n end\n\n request.run\n#=end\n return ((result.strip rescue nil) == \"1\" ? true : false)\n end",
"def getblocknumber\n request :getblocknumber\n end",
"def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend",
"def getToolsProcess_phone( number)\n params = Hash.new\n params['number'] = number\n return doCurl(\"get\",\"/tools/process_phone\",params)\n end",
"def buy_food(id,food_units)\r\n my_port = 8082\r\n store_message = \"/store/#{id}/#{$light}/#{$suit}/#{$wealth}/#{$sword}/#{$amulet}/#{$axe}/#{$food}/#{food_units}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{store_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n\r\n $light = my_json['light']\r\n $suit = my_json['suit']\r\n $wealth = my_json['wealth']\r\n $sword = my_json['sword']\r\n $amulet = my_json['amulet']\r\n $axe = my_json['axe']\r\n $food = my_json['food']\r\n puts(\"#{my_json['text']}\\n\")\r\nend",
"def send_request; end",
"def send_request(method, params, &block); end",
"def request(*args); end",
"def do_request(action,parameters)\n request_parameters = { :action => action, :login => @username}.merge(parameters)\n signature = Digest::MD5.hexdigest( to_signature( request_parameters.merge({:password => @password}) ) )\n request_parameters[\"signature\"] = signature\n result = JSON.parse(http_get(\"www.smsforall.ru\",@api,request_parameters.merge(parameters) ))\n end",
"def request\n http_segments = @segments.clone\n @params.each do |key,value|\n http_segments[key] = value\n end\n \n # avoid using URI.encode\n query = ''\n http_segments.each do |key, value|\n query += \"&#{key}=#{value}\"\n end\n query = query[1..-1]\n \n uri = URI::HTTP.build(\n :host => HOST,\n :path => @action_path,\n :query => query\n ).to_s\n result = JSON.parse(HTTParty.get(uri).parsed_response)\n Baidumap::Response.new(result,self)\n end",
"def request(*args)\n end",
"def bus_api(stpid, route)\n url_safe_stpid = URI.encode(stpid)\n url_safe_route = URI.encode(route)\n apiKey = \"UPGw2J5PBxNnF967CAMyHygeB\"\n apiLink = \"http://www.ctabustracker.com/bustime/api/v1/getpredictions?key=#{apiKey}&stpid=#{url_safe_stpid}&rt=#{url_safe_route}\"\n apiResults = open(apiLink).read\n return Hash.from_xml(apiResults)\n end",
"def check_carrier \n\n @check_carrier = RestClient.post \"http://api.ezsms.biz/vK2FIDJSrp4Tt5gBuLhdRZXsqf7NUezi/hlrdb/query/\", { :mobilenumber => params[:mobilenumber], :password => params[:password]}, :content_type => 'application/json'\n\n respond_to do |format|\n format.html { render :html => @check_carrier }\n format.text { render :text => @check_carrier }\n format.json { render :json => @check_carrier }\n end\n end",
"def send_command( command )\n cmd = \"MESSAGET #{command.size}\\n#{command}\\n\"\n logger.debug( \">>> Sending cmd #{cmd.gsub( /\\n/, ' ' )}\" )\n \n out_socket.send( cmd , 0 )\n result = out_socket.recv(100)\n logger.debug( \"<<< Result ==> #{result}\" )\n result\n end",
"def cGetGas(userid, bot)\n bot.api.send_message(chat_id: userid, text: \"Fast transaction price: #{getApi('fast')} GWEI\\nSafe Low: #{getApi('safeLow')} GWEI\")\nend",
"def make_call(call_count, to_number, from_number)\n call_count.times do \n Adhearsion::OutboundCall.originate(\"SIP/#{to_number}@SIPSERVICEHERE\", :from => \"#{from_number}\", :controller => FooController)\n end\n end",
"def getblocknumber\n @api.request 'getblocknumber'\n end",
"def buy_number(business, number)\n phone_request = {\n :phone_number => number,\n :sms_method => 'GET',\n :voice_method => 'GET',\n :sms_url => \"#{ENV['PROTOCOL'].downcase}://#{ENV['HOST']}/twilio/sms\",\n :voice_url => \"#{ENV['PROTOCOL'].downcase}://#{ENV['HOST']}/twilio/voice\"\n }\n response = sub_account(business).incoming_phone_numbers.create(phone_request)\n Rails.logger.info \"Skej::Twilio#buy_number(#{business}, #{number})\"\n\n response\n end",
"def generate_request\r\n end",
"def next_available_number\n request :get_next_available_number\n end",
"def next_available_number\n request :get_next_available_number\n end",
"def request(endpoint, request, &block); end",
"def query_911(did)\n raise ArgumentError unless did.is_a?(String)\n self.arguments = {did: did}\n self.action = :query911\n self.response = VoipApi.account.request(self.action, self.klass, self.arguments)\n self\n end",
"def send_request(req); end",
"def make_request_and_respond(request, client)\n socket = TCPSocket.open(request.host, request.port)\n\n socket.print(request.request_string)\n response = \"\"\n \n while next_kilobyte = socket.read(1000) do\n unless next_kilobyte.nil?\n response << next_kilobyte\n client.print(next_kilobyte)\n end\n end\n socket.close()\n return response\nend",
"def slowapi(number)\n if correct_number?(number)\n times = number.to_i\n puts \"Starting request to slowapi\"\n begin\n do_request_and_write_response(times)\n rescue => e\n puts 'Some problem occurred when connecting to Slowapi, try later'\n return false\n end\n else\n puts \"Some parameter is missing or not valid, you need to run it, like this:\" \\\n 'development_challenge slowapi --test -n 300'\n return false\n end\n end",
"def make_request(pickup_location, options, notes = '')\n resp = request_item_request(pickup_location, options, notes)\n\n return extract_request_number(resp)\n end",
"def tell(command, params = {})\n msg_id = Random.new.rand(2**16)\n @connection.write({ method: command, params: params, id: msg_id }.to_json)\n end",
"def send_sms(params)\n self.current_params = params\n response = send_request(params)\n smart_response(response.parsed_response)\n end",
"def create\n @number = Number.new(number_params)\n\n if !@number.business_number.blank?\n @number.business_number = \"+1\"+Phony.normalize(@number.business_number) \n end\n\n begin \n\n numbers = Bandwidth::AvailableNumber.search_local({:area_code => @number.area_code[1..3]})\n \n if numbers.count > 0\n # buy the phone number\n number = Bandwidth::PhoneNumber.create({:number => numbers[0][:number], :applicationId => ENV[\"BANDWIDTH_APP_ID\"]})\n\n # assign the phone number to your app id\n @number.tracking_number = number.number\n @number.bw_id = number.id\n \n end\n\n rescue StandardError => e\n puts \"ERROR: \"+e.message\n raise \"There was a problem setting up your number. Try again.\" \n end \n\n respond_to do |format|\n if @number.save\n format.html { redirect_to numbers_url, notice: 'Number was successfully created.' }\n format.json { render :show, status: :created, location: @number }\n else\n format.html { render :new }\n format.json { render json: @number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def unboundRequest(params)\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n\n resources = []\n\n h1 = Hash.new\n h2 = Hash.new\n\n # puts Time.zone.now\n\n if params[:start_date] != \"\"\n valid_from = params[:start_date] + \":00 \"\n valid_from = Time.zone.parse(valid_from)\n else\n time_now = Time.zone.now.to_s.split(\" \")[1][0...-3]\n time_from = roundTimeUp(time_now)\n valid_from = Time.zone.now.to_s.split(\" \")[0] + \" \" +time_from+ \":00 \"\n valid_from = Time.zone.parse(valid_from)\n end\n\n #For nodes\n if params[:number_of_nodes] != \"\"\n if params[:duration_t1] != \"\"\n if params[:domain1] != \"\"\n h1 = { type: \"Node\", exclusive: true, duration: params[:duration_t1].to_i, valid_from: valid_from, domain: params[:domain1]}\n else\n h1 = { type: \"Node\", exclusive: true, duration: params[:duration_t1].to_i, valid_from: valid_from}\n end\n else\n if params[:domain1] != \"\"\n h1 = { type: \"Node\", exclusive: true, valid_from: valid_from, domain: params[:domain1]}\n else\n h1 = { type: \"Node\", exclusive: true, valid_from: valid_from}\n end\n end \n\n params[:number_of_nodes].to_i.times {resources << h1}\n\n end\n\n #For channels\n if params[:number_of_channels] != \"\"\n if params[:duration_t1] != \"\"\n if params[:domain1] != \"\"\n h1 = { type: \"Channel\", exclusive: true, duration: params[:duration_t1].to_i, valid_from: valid_from, domain: params[:domain1]}\n else\n h1 = { type: \"Channel\", exclusive: true, duration: params[:duration_t1].to_i, valid_from: valid_from}\n end\n else\n if params[:domain1] != \"\"\n h1 = { type: \"Channel\", exclusive: true, valid_from: valid_from, domain: params[:domain1]}\n else\n h1 = { type: \"Channel\", exclusive: true, valid_from: valid_from}\n end\n end \n\n params[:number_of_channels].to_i.times {resources << h1}\n\n end\n\n options = {body: {\n resources: resources\n }.to_json, :headers => { 'Content-Type' => 'application/json' } , :verify => false}\n response = HTTParty.get(broker_url+\"/resources\", options)\n\n puts options\n\n if response.header.code != '200'\n puts \"Something went wrong\"\n puts response\n flash[:danger] = response\n else \n puts response\n response[\"resource_response\"][\"resources\"].each do |element|\n element[\"valid_from\"] = Time.zone.parse(element[\"valid_from\"]).to_s\n element[\"valid_until\"] = Time.zone.parse(element[\"valid_until\"]).to_s\n end\n\n return response\n end\n 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 getrawmempool\n @api.request 'getrawmempool'\n end",
"def request(type, payload = '', opts = {}, &blk)\n raise \"Mapper proxy not initialized\" unless identity && options\n request = Request.new(type, payload, opts)\n request.from = identity\n request.token = Identity.generate\n request.persistent = opts.key?(:persistent) ? opts[:persistent] : options[:persistent]\n pending_requests[request.token] = \n { :intermediate_handler => opts[:intermediate_handler], :result_handler => blk }\n amqp.fanout('request', :no_declare => options[:secure]).publish(serializer.dump(request))\n end",
"def mobileMoneyReq(customer_number, amount, callback_url, client_id, nw, trans_type,v_num,u_code,ref,client_key,secret_key)\n \n\n \n url = 'https://orchard-api.anmgw.com'\n url_endpoint = '/sendRequest'\n conn = Faraday.new(url: url, headers: REQHDR, ssl: { verify: false }) do |f|\n f.response :logger\n f.adapter Faraday.default_adapter\n end\n \n \n ts=Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n puts\n puts \"Hello world... with the network #{nw}\"\n puts\n payload={\n :customer_number => customer_number,\n :reference => ref,\n :amount => amount,\n :exttrid => u_code,\n :nw => nw,\n :trans_type => trans_type,\n :callback_url => callback_url,\n :ts => ts,\n :service_id => client_id,\n :voucher_code=> v_num\n }\n puts\n puts \"Hello world Two...\"\n puts\n json_payload=JSON.generate(payload)\n msg_endpoint=\"#{json_payload}\"\n puts\n puts \"JSON payload: #{json_payload}\"\n puts\n def computeSignature(secret, data)\n digest=OpenSSL::Digest.new('sha256')\n signature = OpenSSL::HMAC.hexdigest(digest, secret.to_s, data)\n return signature\n end\n signature=computeSignature(secret_key, json_payload)\n begin\n resp = conn.post do |req|\n req.url url_endpoint\n req.options.timeout = 30 # open/read timeout in seconds\n req.options.open_timeout = 30 # connection open timeout in seconds\n req['Authorization'] = \"#{client_key}:#{signature}\"\n req.body = json_payload\n end\n \n bidy = resp.body\n \n puts bidy.inspect\n puts resp \n puts resp.body \n puts \"Result from AMFP: #{resp.body}\"\n puts\n phone_numbers = validatePhoneNumber(customer_number)\n logger.info sendmsg(phone_numbers,\"Kindly Authorize payment from your momo wallet\")\n \n resp.body\n rescue\n puts \"errorrrrrrrrrrrrr\"\n end\n \n end",
"def request_chunks(id)\n @gateway.send_request_members(id, '', 0)\n end",
"def search(term, location)\n url = \"#{API_HOST}#{SEARCH_PATH}\"\n params = {\n term: term,\n location: location,\n limit: SEARCH_LIMIT\n }\n#this takes info from params hash\n response = HTTP.auth(bearer_token).get(url, params: params)\n response.parse[\"businesses\"]\nend",
"def send_digits(params)\n path = @version + '/Call/SendDigits/'\n method = 'POST'\n return request(path, method, params)\n end",
"def billing\n user_agent = request.env['HTTP_USER_AGENT']\n billing_request_body = Billing.request_body(@session)\n parameter = Parameter.first\n\n request = Typhoeus::Request.new(parameter.billing_url, followlocation: true, body: billing_request_body, headers: {Accept: \"text/xml\", :'Content-length' => billing_request_body.bytesize, Authorization: \"Basic base64_encode('NGSER-MR2014:NGSER-MR2014')\", :'User-Agent' => user_agent})\n\n#=begin\n request.on_complete do |response|\n if response.success?\n result = response.body\n elsif response.timed_out?\n result = Error.timeout(@screen_id)\n elsif response.code == 0\n result = Error.no_http_response(@screen_id)\n else\n result = Error.non_successful_http_response(@screen_id)\n end\n end\n\n request.run\n#=end\n #response_body\n #@xml = Nokogiri.XML(Billing.response_body).xpath('//methodResponse//params//param//value//struct//member')\n @xml = Nokogiri.XML(result).xpath('//methodResponse//params//param//value//struct//member') rescue nil\n #render text: Billing.response_body.bytesize\n end",
"def drugbank_get(route, params)\n url = $drugbank_api + route\n res = HTTParty.get(url, :query => params, :headers => $drugbank_headers)\n return res\nend",
"def test_get_multiple\n urls = []\n 10.times{ |i| urls << URI.join(@url, \"/echo/#{i}\") }\n ret = Bixby::APIPool.get(urls, \"test\")\n\n assert ret\n assert_kind_of Array, ret\n assert_equal 10, ret.size\n\n 10.times do |i|\n assert_equal \"echo #{i}\", ret[i].body\n end\n end",
"def create_bus(id, bus_stops, from, to, raw_slots)\n bus = Bus.new(id, bus_stops, from, to)\n\n raw_slots.each_with_index do |line, index|\n line.each_with_index do |minute, hour|\n next if minute.nil?\n case index\n when (0..9)\n bus.source_target.add(:weekdays, hour + 5, minute)\n when (10..14)\n bus.source_target.add(:saturday, hour + 5, minute)\n when (15..19)\n bus.source_target.add(:sunday, hour + 5, minute)\n when (20..29)\n bus.target_source.add(:weekdays, hour + 5, minute)\n when (30..34)\n bus.target_source.add(:saturday, hour + 5, minute)\n when (35..39)\n bus.target_source.add(:sunday, hour + 5, minute)\n end\n end\n end\n\n bus\nend",
"def request(word, path, params, repeat=1)\n if BeaconClient.config.debug?\n BeaconClient.logger.debug(\"Path: #{path.inspect}\")\n BeaconClient.logger.debug(\"Params: #{params.inspect}\")\n end\n response = connection.send(word, path, params: params)\n if BeaconClient.config.debug?\n BeaconClient.logger.debug(\"Params: #{response.inspect}\")\n end\n response\n rescue OAuth2::Error => error\n BeaconClient.logger.error(error.message)\n error.response\n rescue\n refresh!\n repeat-=1\n retry if repeat >= 0\n end",
"def set_bus\n @bus = Bus.find(params[:bus_id])\n end",
"def set_at_room(roomneu,pos, newone)\r\n my_port = 8083\r\n room_map_message = \"/setmaps/#{roomneu}/#{pos}/#{newone}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n if my_json[\"ok\"] != \"everything is cool and good\"\r\n raise\"rooms not updated\"\r\n end\r\nend",
"def bus_page(id)\n url = URI.parse('http://www.smtuc.pt')\n results = Net::HTTP.start(url.host, url.port) do |http|\n http.get(\"/horario.php?id_linha=#{id}\").body\n end\nend",
"def bing(m, query)\n return if Config.ignore? m.user\n\n query = String(query).superstrip.downcase\n uri = Addressable::URI.parse 'https://www.bing.com/search'\n uri.query = uri.class.form_encode q: query if query.present?\n\n m.reply uri\n end",
"def request(state)\n case state\n\n when :start\n puts 'got to request, case \"start\"'\n jdata = JSON.generate({sprinkle_agent_id: @sprinkle_agent_id, state: 1, key: @key})\n puts \"jdata --> #{jdata}\"\n RestClient.put \"http://#{@host_with_port}/sprinkles/1\", jdata, {:content_type => :json}\n\n when :stop\n jdata = JSON.generate({sprinkle_id: @sprinkle_id, state: 'stop', key: @key})\n puts \"jdata --> #{jdata}\"\n # RestClient.put \"http://#{@host_with_port}/sprinkle_agents/1\", jdata, {:content_type => :json}\n end\n end",
"def api_request(data)\n params = {'id' => next_sequence_number!}\n params['sid'] = sid if sid\n json_data = [data].to_json\n\n response_body = get_api_response(params,json_data)\n parse_json_response(response_body)\n end",
"def getblockbycount(height)\n request :getblockbycount, height\n end",
"def transaction_request(transaction,total=nil)\n transaction_request = Cielo::TransactionRequest.new\n resul = send_request(transaction_request.serialize(transaction))\n end",
"def read(idx=1)\n\n cmd('CMGR=' + idx.to_s) do |r| \n begin\n parse_msg r \n rescue SmsSerialError => e\n puts 'Invalid message no.'.warning\n nil\n end\n end\n\n end",
"def request( params={} )\n if Biomart.proxy or ENV['http_proxy']\n proxy_uri = Biomart.proxy\n proxy_uri ||= ENV['http_proxy']\n proxy = URI.parse( proxy_uri )\n @@client = Net::HTTP::Proxy( proxy.host, proxy.port )\n end\n \n params[:url] = URI.escape(params[:url])\n \n if params[:method] === 'post'\n res = @@client.post_form( URI.parse(params[:url]), { \"query\" => params[:query] } )\n else\n res = @@client.get_response( URI.parse(params[:url]) )\n end\n \n # Process the response code/body to catch errors.\n if res.code != \"200\"\n raise HTTPError.new(res.code), \"HTTP error #{res.code}, please check your biomart server and URL settings.\"\n else\n if res.body =~ /ERROR/\n if res.body =~ /Filter (.+) NOT FOUND/\n raise FilterError.new(res.body), \"Biomart error. Filter #{$1} not found.\"\n elsif res.body =~ /Attribute (.+) NOT FOUND/\n raise AttributeError.new(res.body), \"Biomart error. Attribute #{$1} not found.\"\n elsif res.body =~ /Dataset (.+) NOT FOUND/\n raise DatasetError.new(res.body), \"Biomart error. Dataset #{$1} not found.\"\n else\n raise BiomartError.new(res.body), \"Biomart error.\"\n end\n end\n end\n \n return res.body\n end",
"def request_block(check_in:, check_out:, number_of_rooms:, discount:, name:)\n # raises an ArgumentError if invalid amount of rooms are entered for a block\n if number_of_rooms > 5 || number_of_rooms < 2\n raise ArgumentError, \"A block cannot have more than 5 rooms\"\n end\n\n # raises an argument error if there aren't enough available rooms\n if available_rooms(check_in, check_out).length < number_of_rooms\n raise ArgumentError, \"Not enough available rooms for block\"\n end\n\n number_of_rooms.times do\n block_reservation = request_reservation(check_in,\n check_out,\n block_name: name,\n booking_name: nil,\n discount: discount)\n end\n end",
"def generate_url\n api_key = WavecellOtpAndSms.configuration.api_key\n sub_account = WavecellOtpAndSms.configuration.sub_account\n puts `curl -X POST https://api.wavecell.com/sms/v1/#{sub_account}/single -H \"Authorization: Bearer #{api_key}\" -H \"Content-Type: application/json\" -d $'{ \"source\": \"#{source}\", \"destination\": \"+63#{destination}\", \"text\": \"#{text}\", \"encoding\": \"#{encoding}\" }'`\n end",
"def generate_request(query)\n validate(query)\n URI(API_URL + '?' + query + \"&hashkey=\" + hashkey_calculation(query))\n end",
"def chargeUser(msisdn,amount,userToken)\n \tcontent = open('https://devapi.globelabs.com.ph/payments/2307').read\n\tjson = JSON.parse(content)\n\tincrement = json['result'].first['reference_code'].to_i+1\n\turi = URI.parse(\"https://devapi.globelabs.com.ph/payment/v1/transactions/amount/\")\n uri.query = \"access_token=#{userToken}\"\n response = HTTParty.post(uri,\n\t:body => {:description => 'desc', :endUserId => msisdn, :amount => amount, :referenceCode => 91131000001,\n\t:transactionOperationStatus => 'charged'})\n output(response)\n response.code.eql?(201) ? (Transaction.successful(msisdn,amount) ; sendSms(msisdn,amount,userToken)) : (Transaction.failed(msisdn,amount))\n end",
"def buses\n @buses = Bus.search(params[:source_search], params[:destination_search])\n end",
"def set_bus\n @bus = Bus.find(params[:id])\n end",
"def set_bus\n @bus = Bus.find(params[:id])\n end",
"def makeRequest2AMFPOKF(customer_number, amount, callback_url, client_id, nw, trans_type,v_num,u_code,ref,client_key,secret_key)\n puts\n puts \"*******************************************\"\n puts\n puts nw\n \n if nw == 'MTN' # MTN\n \n puts \"============================MTN=============================\"\n #Thread.new do\n @@amfp_resp = mobileMoneyReq(customer_number, amount, callback_url, client_id, nw, trans_type,v_num,u_code,ref,client_key,secret_key)\n #end \n elsif nw == 'VOD' # VODA\n #Thread.new do\n @@amfp_resp = mobileMoneyReq(customer_number, amount, callback_url, client_id, nw, trans_type,v_num,u_code,ref,client_key,secret_key)\n #end\n elsif nw == 'TIG' # TIG\n #Thread.new do\n @@amfp_resp =mobileMoneyReq(customer_number, amount, callback_url, client_id, nw, trans_type,v_num,u_code,ref,client_key,secret_key)\n #end\n elsif nw == 'AIR' # AIR\n #Thread.new do\n @@amfp_resp = mobileMoneyReq(customer_number, amount, callback_url, client_id, nw, trans_type,v_num,u_code,ref,client_key,secret_key)\n #end\n end\n \n\n end",
"def generate_url\n api_key = WavecellOtpAndSms.configuration.api_key\n sub_account = WavecellOtpAndSms.configuration.sub_account\n details = [uid, code]\n parameters = {\n uid: uid,\n code: code\n }\n query_string = parameters.to_a.map { |x| \"#{x[0]}=#{x[1]}\" }.join(\"&\")\n url = \"https://api.wavecell.com/otp/v1/#{sub_account}/#{uid}?code=#{code}\"\n HTTParty.get(url.to_str,\n :body => parameters.to_json,\n :headers => {\n \"Content-Type\" => \"application/json\",\n \"Authorization\" => \"Bearer #{api_key}\"\n })\n end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def get_amount(*params); raise('Stub or mock required.') end",
"def invoke_json_method(method, params={})\n response = self.class.post('/jsonrpc', :body => {\"jsonrpc\" => \"2.0\", \"params\" => params, \"id\" => \"1\", \"method\" => method}.to_json,:headers => { 'Content-Type' => 'application/json' } ) \nraise XBMCLibrary::UnauthorizedError, \"Could not authorize with XBMC. Did you set up the correct user name and password ?\" if response.response.class == Net::HTTPUnauthorized\n response\n \n # Capture connection errors and send them out with a custom message\n rescue Errno::ECONNREFUSED, SocketError, HTTParty::UnsupportedURIScheme => err\n raise err.class, err.message + \". Did you configure the url and port for XBMC properly using Xbmc.base_uri 'http://localhost:1234'?\"\n end",
"def send(*rest) end",
"def send(*rest) end",
"def send(*rest) end",
"def build_message\n\n # Get user\n user = User.find(params[\"user_id\"])\n\n # User Info\n user_info = user[\"name\"]+\" \"+user[\"last_name\"]+\" (\"+user[\"email\"]+\"), \"+user[\"jobtitle\"]+\n \", perteneciente al centro de costos \"+user[\"deptname\"]+\", a cursado una solicitud para \"\n\n # Transfer line\n if params[\"request\"] == \"transfer line\"\n ms = user_info+params[\"transfer_line_type\"]+\" su linea de teléfono con número telefónico: +56 9 \"+\n params[\"phone_number\"]\n\n # Smartphone\n elsif params[\"item\"] == \"smartphone\"\n lost = \"\"\n motive = \"\"\n\n #if not technical service\n if params[\"request\"] != \"technical service\"\n # Get smartphone info\n if params[\"want_all\"] == '0'\n params[\"model\"] = get_smartphone(params[\"model_one\"])\n params[\"price\"] = params[\"model\"][\"price\"]\n motive = \"\"\n else\n params[\"model\"] = get_smartphone(params[\"model_all\"])\n motive = \" El modelo smartphone elegido no corresponde al cargo que tiene el trabajador.\n El motivo de la elección que ha dado el trabajador es: \"+params[\"comment\"]+\".\"\n end\n end\n\n # New\n if params[\"request\"] == \"new\"\n ms = user_info+\" un nuevo smartphone modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n if params[\"want_sim\"] == \"true\"\n ms+= \"El smartphone debe traer tarjeta Sim y el número de teléfono asociado a él \"\n if params[\"want_new_number\"] == \"true\"\n ms+= \"debe ser nuevo.\"\n else\n ms+= \"será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n end\n else\n ms+= \"El smartphone no debe traer tarjeta Sim.\"\n end\n\n # Renew, stolen/lost\n elsif params[\"request\"] == \"renew\" || params[\"request\"] == \"stolen/lost\"\n ms = user_info+\" renovar su smartphone, eligiendo el modelo \"+params[\"model\"][\"model\"]+\n \", con un valor referencial de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n if params[\"request\"] == \"stolen/lost\"\n ms = user_info+\" un nuevo smartphone modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n lost = \" Esta solicitud fue cursada por la pérdido o robo del smartphone que el trabajador tenia asignado anteriormente.\"\n end\n\n if params[\"want_sim\"] == \"true\"\n ms+= \"El smartphone debe traer tarjeta Sim y el número de teléfono asociado a él \"\n if params[\"number_type\"] == \"new\"\n ms+= \"debe ser nuevo.\"\n params[\"want_new_number\"] = true\n elsif params[\"number_type\"] == \"same\"\n ms+= \"será el mismo que tiene asignado actualmente el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"same_number\"]+\".\"\n params[\"want_new_number\"] = false\n params[\"phone_number\"] = params[\"same_number\"]\n else\n ms+= \"será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n params[\"want_new_number\"] = false\n end\n else\n ms+= \"El smartphone no debe traer tarjeta Sim\"\n end\n\n # technical service\n elsif params[\"request\"] == \"technical service\"\n\n #If user want replacement\n if params[\"want_replacement\"] == \"true\"\n replace= \"El trabajador va a necesitar un dispositivo de reemplazo durante el periodo en que el smartphone es enviado al servicio técnico\"\n else\n replace= \"El trabajador no necesita un dispositivo de reemplazo durante el periodo en que el smartphone es enviado al servicio técnico\"\n end\n\n #message\n ms = user_info+\" enviar al servicio técnico su smartphone modelo \"+\n params[\"model\"]+\", IMEI \"+params[\"imei\"]+\", con número telefónico +56 9 \"+\n params[\"phone_number\"]+\". El desperfecto que presenta el smartphone es \"+\n params[\"comment\"]+\". \"+replace\n\n ms+= motive+lost\n end\n\n # Bam\n elsif params[\"item\"] == \"bam\"\n\n if params[\"request\"] != \"technical service\"\n # Get bam model's info\n params[\"model\"] = get_bam(params[\"model\"])\n # Get bam plan's info\n params[\"plan\"] = get_plan(params[\"plan\"])\n end\n\n # New, stolen/lost\n if params[\"request\"] == \"new\" || params[\"request\"] == \"stolen/lost\"\n # Message\n ms = user_info+\" un nuevo dispositivo Bam modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\n \", asociado al plan \"+params[\"plan\"][\"name\"]+\", el cual tiene un valor de $\"+\n params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n if params[\"request\"] == \"stolen/lost\"\n ms+= \" Esta solicitud fue cursada por la pérdido o robo del dispositivo Bam que el trabajador tenia asignado anteriormente.\"\n end\n\n # Renew\n elsif params[\"request\"] == \"renew\"\n # Message\n ms = user_info+\" renovar su dispositivo Bam, eligiendo el modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\n \". El usuario mantendrá el mismo plan, el cual tiene un valor de $\"+\n params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n # Technical service\n elsif params[\"request\"] == \"technical service\"\n #If user want replacement\n if params[\"want_replacement\"] == \"true\"\n replace= \"El trabajador va a necesitar un dispositivo de reemplazo durante el periodo en que el dispositivo Bam es enviado al servicio técnico\"\n else\n replace= \"El trabajador no necesita un dispositivo de reemplazo durante el periodo en que el dispositivo Bam es enviado al servicio técnico\"\n end\n #message\n ms = user_info+\" enviar al servicio técnico su dispositivo Bam modelo \"+\n params[\"model\"]+\", IMEI \"+params[\"imei\"]+\". El desperfecto que presenta el Bam es \"+\n params[\"comment\"]+\". \"+replace\n end\n\n # Sim\n elsif params[\"item\"] == \"sim\"\n # Message\n ms = user_info+\" una nueva Sim y el número de teléfono asociado a él\"\n\n if params[\"request\"] == \"stolen/lost\"\n ms+= \" debe ser el número telefónico: +56 9 \"+params[\"phone_number\"]+\n \". Esta solicitud fue cursada por la pérdida o robo de la Sim que el trabajador tenia asignado anteriormente.\"\n elsif params[\"want_new_number\"] == \"true\"\n ms+= \" debe ser nuevo.\"\n else\n # Message\n ms+= \" será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n end\n\n # Roaming\n elsif params[\"item\"] == \"roaming\"\n # Get Roaming plan's info\n params[\"plan\"] = get_plan(params[\"plan\"])\n # Modify date\n date_split = params[\"start_date\"].split(\"-\")\n params[\"start_date\"] = Date.parse(date_split[2]+\"/\"+date_split[1]+\"/\"+date_split[0])\n\n date_split = params[\"end_date\"].split(\"-\")\n params[\"end_date\"] = Date.parse(date_split[2]+\"/\"+date_split[1]+\"/\"+date_split[0])\n # Message\n ms = user_info+\" el servicio Roaming, con el plan: \"+params[\"plan\"][\"name\"]+\n \", el cual tiene un valor de $\"+params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". El servicio\n se solicita ya que el trabajador viaja al extranjero debido a: \"+params[\"comment\"]+\n \", entre las fechas: \"+params[\"start_date\"].strftime('%d/%m/%Y')+\" y \"+params[\"end_date\"].strftime('%d/%m/%Y')+\".\"\n end\n\n return ms\n end",
"def sip_amount\n 5\n end",
"def sip_amount\n 5\n end",
"def sip_amount\n 5\n end",
"def sip_amount\n 5\n end",
"def send_sms phone, message\n message = URI.escape message\n response = RestClient.get \"#{sender_base_url}/?from=#{@from}&to=#{phone}&text=#{message}&pass=#{@application_pass}\"\n @response = Response.new response\n end"
] |
[
"0.5711192",
"0.5678817",
"0.5639555",
"0.5566896",
"0.54750746",
"0.54276973",
"0.5391307",
"0.5325581",
"0.5277402",
"0.52635443",
"0.5261373",
"0.52587235",
"0.5229412",
"0.5215006",
"0.52139646",
"0.52070856",
"0.51984966",
"0.51947206",
"0.51614445",
"0.5154057",
"0.5133658",
"0.5132862",
"0.5127053",
"0.51246375",
"0.5095658",
"0.50858593",
"0.508402",
"0.50789607",
"0.50695926",
"0.5064056",
"0.5058784",
"0.50575036",
"0.5041319",
"0.50390255",
"0.50371426",
"0.50318724",
"0.50318724",
"0.50223505",
"0.50190204",
"0.50162405",
"0.50157183",
"0.50090003",
"0.49992338",
"0.4997801",
"0.49927476",
"0.4991444",
"0.4984174",
"0.4981043",
"0.49676523",
"0.4963097",
"0.4959688",
"0.4958079",
"0.4953058",
"0.49492207",
"0.49467123",
"0.49465457",
"0.4939821",
"0.49397588",
"0.49379596",
"0.49378434",
"0.49372953",
"0.49279332",
"0.49210045",
"0.4912605",
"0.49109307",
"0.48990995",
"0.48985022",
"0.48925513",
"0.48919526",
"0.4890928",
"0.4886243",
"0.48858878",
"0.48823866",
"0.4874451",
"0.4870163",
"0.4870163",
"0.48647618",
"0.4862621",
"0.48598778",
"0.48598778",
"0.48598778",
"0.48598778",
"0.48598778",
"0.48598778",
"0.48598778",
"0.48598778",
"0.48598778",
"0.48598778",
"0.48598778",
"0.48550722",
"0.48503786",
"0.48346913",
"0.48346913",
"0.48346913",
"0.48302433",
"0.4830113",
"0.4830113",
"0.4830113",
"0.4830113",
"0.48281905"
] |
0.5088457
|
25
|
make a request to tripsta like: plane("INV", "LON", "211113")
|
def plane(origin, destination, date)
param_date = date[0,2] + "%2f" + date[2,2] + "%2f20" + date[4,2]
url = "http://www.tripsta.co.uk/airline-tickets/results?dep=#{origin}&arr=#{destination}&passengersAdult=1&passengersChild=0&passengersInfant=0&class=&airlineCode=&directFlightsOnly=0&extendedDates=0&isRoundtrip=0&obDate=#{param_date}&obTime=&ibDate=&ibTime="
xml= Nokogiri::HTML(open(url).read)
#get prices
price_string = xml.css("span.amount").to_s
price_string.gsub!(/\s+/, "")
price_string.gsub!(/[<\/spancl=""moutright>]/, "") #I'm sure there's a better way but...
prices = price_string.split('£')
prices.delete_at(0)
#get durations
duration_string = xml.css('td.duration>span:first-child').inner_html
duration_string.gsub!(/\s+/, "")
duration_string = duration_string.scan(/\d*h\d*min/)
durations = Array.new
duration_string.each do |d|
dur = d.gsub('h', ':')
dur = dur.gsub!('min', '')
hours = dur[0, dur.index(':')]
mins = dur[dur.index(':')+1, dur.length]
if mins[0,1] == "0"
mins = mins[1,1]
end
durations.push(Integer(hours)*60 + Integer(mins))
end
#prepare results
results = Array.new
prices.count().times do |count|
pair = [prices[count], durations[count]]
results.push(pair)
end
return results, url
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def call\n uri = URI.parse(\"http://api.sejmometr.pl/posiedzenia/BZfWZ/projekty\")\n end",
"def request(method, path, params = nil)\n uri = URI.parse(url_for(path))\n\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = uri.kind_of?(URI::HTTPS)\n client.verify_mode = OpenSSL::SSL::VERIFY_PEER\n client.ca_file = CA_FILE\n\n request = net_class(method).new(uri.request_uri)\n request.basic_auth Codeplane.username, Codeplane.api_key\n request[\"Content-Type\"] = \"application/x-www-form-urlencoded\"\n request[\"User-Agent\"] = \"Codeplane/#{Codeplane::Version::STRING}\"\n request.body = params.to_param if request.request_body_permitted? && params\n\n response = client.request(request)\n\n case response.code\n when \"401\"\n raise Codeplane::UnauthorizedError, \"Double check you username and API key\"\n when \"404\"\n raise Codeplane::NotFoundError\n else\n Codeplane::Response.new(response)\n end\n end",
"def show \n id = params[:id] # id is part of the route so we can grab the params[:id]\n @plane = Plane.find(id)\n\n render :show\n end",
"def plan(from, to, trip_datetime, arrive_by=true, options={})\n\n url = build_url(from, to, trip_datetime, arrive_by, options)\n\n begin\n resp = Net::HTTP.get_response(URI.parse(url))\n rescue Exception=>e\n return {'id'=>500, 'msg'=>e.to_s}\n end\n\n return resp\n\n end",
"def show\n @plane = Plane.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plane }\n end\n end",
"def build_request origin, service, mode=\"TRANSIT,WALK\"\n\n if service.latlng.nil? \n return nil\n end\n\n {\n from: [\n origin[0],\n origin[1]\n ],\n to: [\n service.lat.to_s,\n service.lng.to_s\n ],\n trip_time: Time.now,\n arrive_by: true,\n label: \"#{service.id}_#{mode}\",\n options: {\n mode: mode,\n num_itineraries: 1\n }\n }\n end",
"def get_route\n data = {\n visits: visits,\n fleet: fleet\n }\n\n data[:options] = options if options\n result = Util.send_request(\"POST\", \"vrp\", Routific.token, data)\n RoutificApi::Route.parse(result)\n end",
"def plane\n end",
"def distance_to_plane(plane)\n end",
"def create\n @plane = Plane.new(params[:plane])\n\n respond_to do |format|\n if @plane.save\n format.html { redirect_to @plane, notice: 'Plane was successfully created.' }\n format.json { render json: @plane, status: :created, location: @plane }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plane.errors, status: :unprocessable_entity }\n end\n end\n end",
"def plane_params\n params.require(:plane).permit(:name, :model, :year, :description, :matricula, :status)\n end",
"def train_api(mapid)\n url_safe_mapid = URI.encode(mapid)\n apiKey = \"73b6a68e9e4f450792ba730b84d8c506\"\n apiLink = \"http://lapi.transitchicago.com/api/1.0/ttarrivals.aspx?key=#{apiKey}&mapid=#{url_safe_mapid}\"\n apiResults = open(apiLink).read\n return Hash.from_xml(apiResults)\n end",
"def get_json_from_openstreetmaps(key,val,constrain_to_usa = true)\n timeout = 20000\n bounds = \"#{CONTINENTAL_US[:s]},#{CONTINENTAL_US[:w]},#{CONTINENTAL_US[:n]},#{CONTINENTAL_US[:e]}\"\n bounds_string = constrain_to_usa ? \"(#{bounds})\" : \"\"\n\n #This string fetches all geometry of a way including center points, but does not restrict how many ways to download\n #str = \"data=[out:json][timeout:#{timeout}];way[\\\"#{key}\\\"=\\\"#{val}\\\"](#{bounds_string});foreach((._;>;);out center #{NUMBER_TO_DOWNLOAD};);\"\n\n #This string fetches almost all geometry of a way except for center points. Does restrict number to download. \n str = \"data=[out:json][timeout:#{timeout}][maxsize:1073741824];way[\\\"#{key}\\\"=\\\"#{val}\\\"]#{bounds_string};out count;out meta geom #{NUMBER_TO_DOWNLOAD};\"\n\n print str\n base_url = \"http://overpass-api.de/api/interpreter?\"\n url = \"#{base_url}#{URI.escape(str)}\"\n puts url\n response = Typhoeus.get(url, {followlocation: true, timeout: timeout})\n response.body\nend",
"def project_to_plane\n end",
"def request(type, id=\"\", params=\"\")\n id = id.to_s\n params = params.to_s\n api_path = case type\n when \"orders\"\n \"/api/v2/orders?\"\n when \"order_metadata\"\n raise \"ID required\" if id.empty?\n \"/api/v2/orders/#{id}?\"\n when \"shop_metadata\"\n raise \"ID required\" if id.empty?\n \"/api/v2/shop/#{id}?\"\n end\n api_path.chop! if params.empty?\n\n response = HTTParty.get(\n @domain + api_path + params, \n basic_auth: @auth\n )\n response_valid?(response)\n response\nend",
"def flight\n #Project.hit 35\n\n @planes = get_flight params[:flighte]\n\n respond_to do |format|\n format.html \n format.json { render json: @planes, callback: params[:callback] }\n format.xml { render xml: @planes }\n end\n end",
"def request(path, params = {})\n raise StandardError, \"Dev ID and secret key are required.\" unless @dev_id && @secret_key\n\n request_path = if params.empty?\n \"/v3/#{path}?devid=#{@dev_id}\"\n else\n \"/v3/#{path}?#{URI.encode_www_form(params)}&devid=#{@dev_id}\"\n end\n # Create unique SHA1 signature with each request\n signature = OpenSSL::HMAC.hexdigest(\"SHA1\", @secret_key, request_path)\n req = \"https://timetableapi.ptv.vic.gov.au\" + request_path + \"&signature=\" + signature.upcase\n\n parse(HTTParty.get(req))\n end",
"def by_cube opts\n opts.merge!('method': '3')\n \tresp = perform_request(:get, '/api/shipping', {}, opts)\n \tDeliveright::ShippingQuote.new(resp)\n end",
"def get_races_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UniverseApi.get_races ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail ArgumentError, 'invalid value for \"datasource\", must be one of tranquility, singularity'\n end\n if opts[:'language'] && !['de', 'en-us', 'fr', 'ja', 'ru', 'zh'].include?(opts[:'language'])\n fail ArgumentError, 'invalid value for \"language\", must be one of de, en-us, fr, ja, ru, zh'\n end\n # resource path\n local_var_path = \"/universe/races/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?\n query_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?\n query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].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 header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?\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 => 'Array<Race>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UniverseApi#get_races\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n @plane = Plane.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plane }\n end\n end",
"def get_api(origin, destination, departure)\n origin = get_place(origin)\n destination = get_place(destination)\n if origin == nil || destination == nil\n return nil\n end\n url = URI(\"https://rapidapi.p.rapidapi.com/apiservices/browseroutes/v1.0/US/USD/en-US/#{origin}/#{destination}/#{departure}?inboundpartialdate=anytime\")\n\n response_hash = access_api(url)\nend",
"def initialize(args)\n @latitude = args[:latitude]\n @longitude = args[:longitude]\n @endpoint_url = \"http://farmsense-prod.apigee.net/v1/frostdates/stations/?lat=#{@latitude}8&lon=#{@longitude}\"\n end",
"def typhoeus_request # rubocop:disable Metrics/MethodLength\n request = Typhoeus::Request.new(\n @url,\n method: @method,\n headers: {\n 'aftership-api-key' => @api_key,\n 'Content-Type' => 'application/json'\n }\n )\n\n request.options[:body] = MultiJson.dump(@body) if @body\n make_verbose(request) if AfterShip.debug\n\n request\n end",
"def set_airplane\n @airplane = Airplane.find(params[:id])\n end",
"def set_airplane\n @airplane = Airplane.find(params[:id])\n end",
"def add_section_plane(plane)\n end",
"def create_waypoint(city, state)\n url = \"http://local.yahooapis.com/MapsService/V1/geocode?appid=#{APP_ID}\"\n res = Net::HTTP.get(URI.parse( URI.escape(url + \"&state=#{state}&city=#{city}\") ))\n \n lat = res.slice(/Latitude\\>(.*)\\<\\/Latitude/,1)\n lon = res.slice(/Longitude\\>(.*)\\<\\/Longitude/,1)\n point = Waypoint.new :name=>city, :lon=>lon, :lat=>lat\n puts point\n point\nend",
"def api_request method, params = nil\n\t\t\tconnection = ZenfolioAPI::HTTP.new()\n\t\t\t@response = connection.POST(method, params, @auth.token)\n\t\tend",
"def ta_request(*tabs)\n stops = decode_tab_stops(*tabs)\n @tab_stops = stops\n @fill = false\n @center = false\n @justify = false\n @tabbed = true\n end",
"def departures\n # Project.hit 35\n @departing = true\n @from = params[:from]\n @to = params[:to]\n \n unless @from.nil? and @to.nil?\n @planes = get_flights(@from, @to, @departing)\n @airports = did_you_mean @from, @to if @planes == []\n end\n \n respond_to do |format|\n format.html\n format.json { render json: @planes, callback: params[:callback] }\n format.xml { render xml: @planes }\n end\n end",
"def show\n nodes = Node.get_coordinates(params[:id])\n @floor_plan = { 'floor_plan': nodes }\n respond_to do |format|\n if !nodes.blank?\n format.json { render json: @floor_plan, status: :ok }\n else\n format.json { render json: @floor_plan, status: :not_found }\n end\n end\n end",
"def request_access(local_id)\n soap_response = client.request :request_access do\n soap.header = soap_header\n soap.body = {\"localID\" => local_id}\n end\n\n @last_request = client.http\n @last_response = soap_response\n end",
"def show\n \n @url = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{@trip.origin.gsub(\" \", \"_\") + \"_ny\"}&destination=#{@trip.destination.gsub(\" \", \"_\") + \"_ny\"}\"\n \n #driving details\n @drivingroute=HTTParty.get(@url)\n @drivingroutedetails = {'distance' => @drivingroute['routes'][0]['legs'][0]['distance']['text'], 'time' => @drivingroute['routes'][0]['legs'][0]['duration']['text']}\n @urltransit = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{@trip.origin.gsub(\" \", \"_\") + \"_ny\"}&destination=#{@trip.destination.gsub(\" \", \"_\") + \"_ny\"}&departure_time=#{@trip.departure_time.to_i}&mode=transit\"\n\n #transit details\n @transitroute=HTTParty.get(@urltransit)\n @transitroutedetails = {'distance' => @transitroute['routes'][0]['legs'][0]['distance']['text'], 'time' => @transitroute['routes'][0]['legs'][0]['duration']['text']}\n\n \n @carbondioxideemission = @drivingroute['routes'][0]['legs'][0]['distance']['text'].to_f*248\n @gasolineused = @drivingroute['routes'][0]['legs'][0]['distance']['text'].to_f*0.04149\n\n # Trip.find(params[:id]).cabcost(@drivingroutedetails['distance'].to_f,@drivingroutedetails['time'].to_i)\n\n @moneyspent = Trip.find(params[:id]).cabcost(@drivingroutedetails['distance'].to_f,@drivingroutedetails['time'].to_i)\n @moneysaved = (@moneyspent/(Trip.find(params[:id]).number_of_people.to_f) - 2.50).to_f\n\n\n # 163g of CO2 emitted per mile for transit....411g of C02 emitted per mile for cars = 248 diff\n # 9.4g of CO emitted per mile for cars ...\n #sources: EPA, CarbonFund.org, \n\n #http://www.epa.gov/otaq/consumer/420f08024.pdf\n\n #stats to be seen: CO2, gasoline saved, money saved \n\n\n \n end",
"def send_request\n if latitude && longitude\n response = RestClient::Request.execute(\n method: :get,\n url: \"http://climateapi.scottpinkelman.com/api/v1/location/#{latitude}/#{longitude}\"\n )\n parsed = JSON.parse(response)\n self.climate_zone = parsed[\"return_values\"][0][\"koppen_geiger_zone\"]\n else\n p \"Unable to get geocoding location\"\n end\n end",
"def request(resource, method, params = nil) \n resource = Resources.get(resource, method, params)\n params = append_api_credentials(params)\n\n if method == :post\n payload = prepare_params(params)\n else\n payload = {}\n end\n\n headers = @options[:headers] || {}\n if method == :get \n resource.send(method, headers) do |response, request, result, &block| \n ZipMoney::Response.new(response)\n end\n else\n resource.send(method, payload, headers) do |response, request, result, &block|\n ZipMoney::Response.new(response)\n end\n end\n end",
"def create_service_request\n # Geocode the address\n lat, long = Geocoder.coordinates(\"#{self.restaurant_address} , Chicago, IL\") \n\n HTTParty.post('http://311api.cityofchicago.org/open311/v2/requests.json', :body => { \n :api_key => SETTINGS[\"OPEN_311_KEY\"],\n :service_code => '4fd6e4ece750840569000019',\n :attribute => {\n :PLEASESE => 'FOODPOIS',\n :WHATISTH => self.restaurant_name,\n :ONWHATDA => self.date\n },\n :address_string => self.restaurant_address,\n :description => self.description,\n :lat => lat, \n :long => long, \n :first_name => self.first_name,\n :last_name => self.last_name,\n :email => self.email,\n :phone => self.phone\n })\n end",
"def make_request(url)\n res = Typhoeus::Request.new(\n url,\n method: :get,\n headers: {\n \"Accept-Charset\": \"application/x-www-form-urlencoded; charset=UTF-8\",\n \"Accept-Language\" => \"en-US,en;q=0.9,pt;q=0.8\",\n \"X-Riot-Token\" => @api_key.to_s,\n \"User-Agent\": \"https://github.com/drish/rioter\"\n }\n ).run\n parse!(res)\n end",
"def prepare_http_requests\n {\n label: :lyft_prices,\n url: @lyft_api_service.price_url([@trip.destination.lat, @trip.destination.lng], [@trip.origin.lat, @trip.origin.lng]),\n action: :get,\n options: {\n head: @lyft_api_service.headers \n }\n }\n end",
"def request(args = {})\n response = @client.get(args[:url],\n argument_hash(args[:args] || {},\n args[:symbols] || []))\n JSON.parse(response.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 show\n @airplane = Airplane.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @airplane }\n end\n end",
"def set_at_room(roomneu,pos, newone)\r\n my_port = 8083\r\n room_map_message = \"/setmaps/#{roomneu}/#{pos}/#{newone}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n if my_json[\"ok\"] != \"everything is cool and good\"\r\n raise\"rooms not updated\"\r\n end\r\nend",
"def access_request(auth = {}, data = {})\n auth = {:pur => auth.pur, :prt => auth.prt} unless auth.is_a?(Hash)\n xml = Requests::AccessRequest.new( auth.merge(:data => data) ).render\n sendToTrufina(xml)\n end",
"def search_directions\n @query = 1\n @error = 0\n @departure_address = params[:departure_address]\n @arrival_address = params[:arrival_address]\n bus_transit = params[:bus_transit]\n train_transit = params[:train_transit]\n metra_transit = params[:metra_transit]\n @preferred = params[:preferred]\n apikey = \"AIzaSyCDeWWmT-KYmsgSz9d2vCy0KcOmJe114y4\"\n\n if @departure_address != \"\" && @arrival_address != \"\"\n url_safe_dep = URI.encode(@departure_address)\n url_safe_arr = URI.encode(@arrival_address)\n @type_transport = ''\n\n if !bus_transit.nil?\n @type_transport = bus_transit\n end\n\n if !train_transit.nil?\n @type_transport += \"|\" + train_transit\n end\n\n if !metra_transit.nil?\n @type_transport += \"|\" + metra_transit\n end\n\n if !@type_transport != '' && !@preferred.nil? && @preferred != \"\"\n url_safe_typ = URI.encode(@type_transport)\n url_safe_pref = URI.encode(@preferred)\n apiLink = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{url_safe_dep}&destination=#{url_safe_arr}&mode=transit&alternatives=true&transit_mode=#{@url_safe_typ}&transit_routing_preference=#{url_safe_pref}&key=#{apikey}\"\n\n elsif !@type_transport != ''\n url_safe_typ = URI.encode(@type_transport)\n apiLink = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{url_safe_dep}&destination=#{url_safe_arr}&mode=transit&alternatives=true&transit_mode=#{url_safe_typ}&key=#{apikey}\"\n\n elsif !@preferred.nil? && @preferred != \"\"\n url_safe_pref = URI.encode(@preferred)\n apiLink = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{url_safe_dep}&destination=#{url_safe_arr}&mode=transit&alternatives=true&transit_routing_preference=#{url_safe_pref}&key=#{apikey}\"\n else\n apiLink = \"https://maps.googleapis.com/maps/api/directions/json?origin=#{url_safe_dep}&destination=#{url_safe_arr}&mode=transit&alternatives=true\"\n end\n\n @directions = JSON.parse(open(apiLink).read, object_class: OpenStruct)\n\n if @directions.status == \"OK\"\n @routes = @directions.routes\n @error = 0\n else\n @message = \"No station found, try again\"\n @error = 1\n end\n else\n @message = \"Please enter a value for departure and arrival address\"\n @error = 1\n end\n\n #render :json => @routes\n render 'directions'\n end",
"def on_plane?(plane)\n end",
"def test_nad83_state_plane()\n srs = Gdal::Osr::SpatialReference.new()\n srs.set_state_plane(403, 1) # California III NAD83.\n\n parm_list = [\n [Gdal::Osr::SRS_PP_STANDARD_PARALLEL_1, 38.43333333333333],\n [Gdal::Osr::SRS_PP_STANDARD_PARALLEL_2, 37.06666666666667],\n [Gdal::Osr::SRS_PP_LATITUDE_OF_ORIGIN, 36.5],\n [Gdal::Osr::SRS_PP_CENTRAL_MERIDIAN, -120.5],\n [Gdal::Osr::SRS_PP_FALSE_EASTING, 2000000.0],\n [Gdal::Osr::SRS_PP_FALSE_NORTHING, 500000.0]\n ]\n\n parm_list.each() do |parm|\n value = srs.get_proj_parm(parm[0], -1111)\n assert_in_delta(parm[1], value, 0.0000001)\n end\n\n auth_list = [ ['GEOGCS', '4269'],\n ['DATUM', '6269'],\n ['PROJCS', '26943'],\n ['PROJCS|UNIT', '9001']\n ]\n\n auth_list.each() do |auth|\n assert_equal(srs.get_authority_name(auth[0]), 'EPSG')\n assert_equal(srs.get_authority_code(auth[0]), auth[1])\n end\n end",
"def create\n @airplane = Airplane.new(params[:airplane])\n\n respond_to do |format|\n if @airplane.save\n format.html { redirect_to @airplane, :notice => 'Airplane was successfully created.' }\n format.json { render :json => @airplane, :status => :created, :location => @airplane }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @airplane.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_info(lat, lon)\n Net::HTTP.get(URI(\"https://api.3geonames.org/#{lat},#{lon}.json\"))\nend",
"def landing_clearance_for(plane)\n\t\t@airport.open_runway_for(plane)\n\tend",
"def query(origin:, destination:, mode: nil, waypoints: nil, alternatives: false,\n avoid: nil, language: nil, units: nil, region: nil, departure_time: nil,\n arrival_time: nil, optimize_waypoints: false, transit_mode: nil,\n transit_routing_preference: nil, traffic_model: nil)\n params = {\n 'origin' => Convert.to_latlng(origin),\n 'destination' => Convert.to_latlng(destination)\n }\n\n if mode\n unless Constants::TRAVEL_MODES.include? mode\n raise StandardError, 'invalid travel mode.'\n end\n params['mode'] = mode\n end\n\n if waypoints\n waypoints = Convert.piped_location(waypoints)\n if optimize_waypoints\n waypoints = 'optimize:true|' + waypoints\n end\n params['waypoints'] = waypoints\n end\n\n if alternatives\n params['alternatives'] = true\n end\n\n if avoid\n unless ArrayBox.contains_all?(Constants::AVOID_FEATURES, avoid)\n raise StandardError, 'invalid avoid feature.'\n end\n params['avoid'] = Convert.join_array('|', avoid)\n end\n\n if language\n params['language'] = language\n end\n\n if units\n params['units'] = units\n end\n\n if region\n params['region'] = region\n end\n\n if departure_time\n params['departure_time'] = Convert.unix_time(departure_time)\n end\n\n if arrival_time\n params['arrival_time'] = Convert.unix_time(arrival_time)\n end\n\n if departure_time && arrival_time\n raise StandardError, 'should not specify both departure_time and arrival_time.'\n end\n\n if transit_mode\n params['transit_mode'] = Convert.join_array('|', transit_mode)\n end\n\n if transit_routing_preference\n params['transit_routing_preference'] = transit_routing_preference\n end\n\n if traffic_model\n params['traffic_model'] = traffic_model\n end\n\n case self.client.response_format\n when :xml\n self.client.request(url: '/maps/api/directions/xml', params: params).xpath('//route')\n when :json\n self.client.request(url: '/maps/api/directions/json', params: params)['routes']\n else\n raise StandardError, 'Unsupported response format. Should be either :json or :xml.'\n end\n end",
"def flight_params\n params.require(:flight).permit(:number, :origin, :destination, :date, :plane, :airplane_id)\n end",
"def plane\n return nil if @vertices.length < 3\n Plane.three_points(*@vertices[0..2])\n end",
"def arrivals\n #Project.hit 35\n @departing = false\n @from = params[:from]\n @to = params[:to]\n\n unless @from.nil? and @to.nil?\n @planes = get_flights(@from, @to, @departing)\n @airports = did_you_mean @from, @to if @planes == []\n end\n\n respond_to do |format|\n format.html \n format.json { render json: @planes, callback: params[:callback] }\n format.xml { render xml: @planes }\n end\n end",
"def request\n http_segments = @segments.clone\n @params.each do |key,value|\n http_segments[key] = value\n end\n \n # avoid using URI.encode\n query = ''\n http_segments.each do |key, value|\n query += \"&#{key}=#{value}\"\n end\n query = query[1..-1]\n \n uri = URI::HTTP.build(\n :host => HOST,\n :path => @action_path,\n :query => query\n ).to_s\n result = JSON.parse(HTTParty.get(uri).parsed_response)\n Baidumap::Response.new(result,self)\n end",
"def make_request\n url = 'https://www.googleapis.com/qpxExpress/v1/trips/search?key=' + @api_key\n request = compose_request\n response = RestClient.post url, request, content_type: :json, accept: :json\n response.body\n end",
"def prepare_http_requests\n {\n label: :uber_prices,\n url: @uber_api_service.estimates_price_url([@trip.destination.lat, @trip.destination.lng], [@trip.origin.lat, @trip.origin.lng]),\n action: :get,\n options: {\n head: @uber_api_service.headers \n }\n }\n end",
"def goto_point(in_point, tRo_x ,tRo_y, tRo_z)\n tem_pln = APlane.new(in_point.x, in_point.y, in_point.z, tRo_x, tRo_y, tRo_z)\n result_ik = MotionPlan.IKsolverNew(tem_pln , @current_ik)\n update(result_ik) if result_ik[:success]\n end",
"def add_plane()\n planes << Plane.new(\n gen_location,\n 0,\n width,\n height,\n gen_speed(),\n true\n )\n end",
"def request(method, path, params = {}, options = {})\n\n raise AirbrakeError.new('API Token cannot be nil') if @auth_token.nil?\n raise AirbrakeError.new('Account cannot be nil') if @account.nil?\n\n response = connection(options).run_request(method, nil, nil, nil) do |request|\n case method\n when :delete, :get\n request.url(path, params.merge(:auth_token => @auth_token))\n when :post, :put\n request.url(path, :auth_token => @auth_token)\n request.body = params unless params.empty?\n end\n end\n response.body\n end",
"def test_nad83_state_plane_feet()\n srs = Gdal::Osr::SpatialReference.new()\n # California III NAD83 feet\n srs.set_state_plane(403, 1, 'Foot', 0.3048006096012192)\n\n parm_list = [\n [Gdal::Osr::SRS_PP_STANDARD_PARALLEL_1, 38.43333333333333],\n [Gdal::Osr::SRS_PP_STANDARD_PARALLEL_2, 37.06666666666667],\n [Gdal::Osr::SRS_PP_LATITUDE_OF_ORIGIN, 36.5],\n [Gdal::Osr::SRS_PP_CENTRAL_MERIDIAN, -120.5],\n [Gdal::Osr::SRS_PP_FALSE_EASTING, 6561666.666666667],\n [Gdal::Osr::SRS_PP_FALSE_NORTHING, 1640416.666666667]\n ]\n\n parm_list.each() do |parm|\n value = srs.get_proj_parm(parm[0], -1111)\n assert_in_delta(parm[1], value, 0.0000001)\n end\n\n auth_list = [ ['GEOGCS', '4269'],\n ['DATUM', '6269']\n ]\n\n auth_list.each() do |auth|\n assert_equal(srs.get_authority_name(auth[0]), 'EPSG')\n assert_equal(srs.get_authority_code(auth[0]), auth[1])\n end\n\n assert_nil(srs.get_authority_name('PROJCS'))\n assert_not_equal(srs.get_authority_code('PROJCS|UNIT'), '9001',\n 'Got METER authority code on linear units.')\n\n assert_equal(srs.get_linear_units_name(), 'Foot')\n end",
"def make_request(type, params)\n params[:key] = apiKey\n\n uri = URI.parse \"https://api.hypixel.net/#{type}\"\n uri.query = URI.encode_www_form params\n\n JSON.parse uri.open.read\n end",
"def zonal_params\n params.require(:zonal).permit(:nombre_zona, :descripcion)\n end",
"def request(params)\n\n # Add auth header\n headers = params[:headers] || {}\n headers['x-vcloud-authorization'] = @auth_key if !@auth_key.nil? || !@auth_key.equal?('')\n\n # set connection options\n options = {:url => params[:url],\n :body => params[:body] || '',\n :expects => params[:expects] || 200,\n :headers => headers || {},\n :method => params[:method] || 'GET'\n }\n\n # connect\n res = RestClient::Request.execute options\n\n raise res if (res.code!=params[:expects] && res.code!=200)\n\n res\n\n\n end",
"def show_next_pass(latitude, longitude)\n result = call_api(\"/iss-pass.json?lat=#{latitude}&long=#{longitude}\")\n puts(\"The next ISS pass for #{result['request']['latitude']} #{result['request']['longitude']} is #{result['response'][0]['risetime']} for #{result['response'][0]['duration']} seconds\")\nend",
"def set_planejamento\n @planejamento = Planejamento.find(params[:id])\n end",
"def get_some_room_stuff(roomnumberone,pos)\r\n my_port = 8083\r\n room_map_message = \"/maps/#{roomnumberone}/#{pos}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n if my_json[\"east\"]\r\n return my_json[\"east\"]\r\n \r\n elsif my_json[\"west\"]\r\n return my_json[\"west\"]\r\n\r\n elsif my_json[\"north\"]\r\n return my_json[\"north\"]\r\n\r\n elsif my_json[\"contents\"]\r\n return my_json[\"contents\"]\r\n\r\n elsif my_json[\"south\"]\r\n return my_json[\"south\"]\r\n\r\n elsif my_json[\"down\"]\r\n return my_json[\"down\"]\r\n\r\n elsif my_json[\"up\"]\r\n return my_json[\"up\"] \r\n end\r\nend",
"def hit_api_direct\n # CollegiateLink API needs some data to be hashed and sent for auth purposes\n time = (Time.now.to_f * 1000).to_i.to_s\n ipaddress = ENV['cl_ipaddress']\n apikey = ENV['cl_apikey']\n privatekey = ENV['cl_privatekey']\n random = SecureRandom.hex\n hash = Digest::SHA256.hexdigest(apikey + ipaddress + time + random + privatekey)\n\n url = ENV['cl_apiurl'] + @resource + \"?time=\" + time + \"&apikey=\" + apikey + \"&random=\" + random + \"&hash=\" + hash + @url_options\n return send_request(url, nil)\n end",
"def trips\n get '/gtfs/trips'\n end",
"def request(method, params = nil, id = false)\n http_response = @http_client.post(request_message(method, params, id))\n MmJsonClient::JsonRpcHttp::Response.new(http_response.body)\n end",
"def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend",
"def make_request url, parameters={}, method=:get, settings={}\n raise 'not implemented'\n end",
"def make_request(operation, params, headers = {})\n path = Restool::Service::UriUtils.build_path(operation)\n\n Restool::Service::RemoteConnector.execute(\n @remote_client, operation, path, params, headers, @response_handler,\n @service_config.representations, @service_config.basic_auth\n )\n end",
"def get\n @get ||= Verb.new do |verb|\n verb.entity :air, :lodging, :car, :rail, :transport, \\\n :cruise, :restaurant, :activity, :note, :map, :directions, \\\n :points_program \\\n do |entity, id|\n do_request('get', entity, {:id=>id}, nil)\n end\n\n verb.entity :profile do |*args|\n entity = args[0]\n do_request('get', entity, nil, nil)\n end\n\n verb.entity :trip do |*args|\n entity, id, filter = args\n if filter.nil?\n filter = {}\n end\n filter[:id] = id\n do_request('get', entity, filter, nil)\n end\n end\n end",
"def flight_route(origin, destination, date=nil, params={})\n args = [origin, 'departures', destination, format(date)].compact.join('/')\n perform_get(\"/airports/#{args}.xml\", params)\n end",
"def show\n @airplane = Airplane.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @airplane }\n end\n end",
"def show\n query = {\n 'id' => unit_params[:id]\n }\n response = HTTParty.get(\"https://casa-core.herokuapp.com/api/units/?id\", :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n @unit = JSON.parse(response.body)\n else\n redirect_to unit_path(params[:id]), notice: 'Hmm...thats strange...try that again.'\n end\n end",
"def update\n @plane = Plane.find(params[:id])\n\n respond_to do |format|\n if @plane.update_attributes(params[:plane])\n format.html { redirect_to @plane, notice: 'Plane was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plane.errors, status: :unprocessable_entity }\n end\n end\n end",
"def zona_params\n params.require(:zona).permit(:nom, :clima, :temperatura, :humitat)\n end",
"def zona_params\n params.require(:zona).permit(:nom, :clima, :temperatura, :humitat)\n end",
"def request(*args); end",
"def test_post_shipments\n test_url = \"https://test.panel.olzalogistic.com/api/v1\"\n test_login = 'your test login'\n test_pwd = 'your test password'\n test_language = 'cs'\n\n data = {payload: {shipmentList: [123456]}} #use real Shipment ID\n\n client = OlzaApi::Client.new(test_login, test_pwd, test_url, test_language)\n response = client.post_shipments(data)\n\n assert_instance_of Hash, response\n end",
"def request(resource, method = \"get\", args = {}, sign_request=false)\n \t @now_playing_url = 'http://62.216.251.203:80/nowplaying'\n \t @submission_url = 'http://62.216.251.205:80/protocol_1.2'\n \t @session_id = '17E61E13454CDD8B68E8D7DEEEDF6170'\n\n \t if @base_url == Rockstar::API_URL + Rockstar::API_VERSION + \"/\"\n \t folder, file = resource.downcase.split(\".\")\n\n \t query = \"\"\n \t if args.size > 0\n \t query = \"_\" + flatten(args)\n end\n\n \t file = File.dirname(__FILE__) + \"/../fixtures/xml/#{folder}/#{file}#{query}.xml\"\n\n \t if (!File.exists? file)\n puts \"Mock file not found : #{file}\"\n \t else\n \t File.read(file)\n \t end\n elsif @base_url == @now_playing_url\n if args[:s] == @session_id && args.length == 7 && ![args[:a], args[:t], args[:b], args[:n]].any?(&:blank?)\n 'OK'\n end\n elsif @base_url == @submission_url\n if args[:s] == @session_id && args.length == 10 &&\n ![args['a[0]'], args['t[0]'], args['i[0]'], args['o[0]'], args['l[0]'], args['b[0]']].any?(&:blank?)\n 'OK'\n end\n\t end\n\n\t end",
"def getVideoFromPolylineAS\n\t\t\n\t\tif !params[:poly_id]\n\t\t\trender :text => \"Failed. (Parameters set improperly)\"\n\t\t\treturn false\n\t\tend\n\t\t\n\t\tspeed = Syncronisation.find_by_sql([\"select time, distance from syncronisations where route_id in (select id from routes where polyline_id = ?) order by time\", params[:poly_id]])\n\t\troute = Route.find(:first, :conditions => [ \"polyline_id = ?\", params[:poly_id] ]);\n\t\t\n\t\trender :json => {:video_id => route.video_id, :sync => speed}.to_json\n\tend",
"def getVideoFromPolylineAS\n\t\t\n\t\tif !params[:poly_id]\n\t\t\trender :text => \"Failed. (Parameters set improperly)\"\n\t\t\treturn false\n\t\tend\n\t\t\n\t\tspeed = Syncronisation.find_by_sql([\"select time, distance from syncronisations where route_id in (select id from routes where polyline_id = ?) order by time\", params[:poly_id]])\n\t\troute = Route.find(:first, :conditions => [ \"polyline_id = ?\", params[:poly_id] ]);\n\t\t\n\t\trender :json => {:video_id => route.video_id, :sync => speed}.to_json\n\tend",
"def index\n lat = params[:lat]\n long = params[:long]\n is_ok = params[:is_ok]\n id_panneaux = params[:id_panneaux] \n end",
"def allow_landing(plane)\n\t\traise \"This Airport is full\" if full?\n\t\traise \"This flight cannot land due to weather conditions\" if weather_stormy?\n\t\t# check your language, landed sounds like a question rather than a command\n\t\t# what about \"land!\" ?\n\t\tplane.landed!\n\t\t@planes << plane\n\tend",
"def test_find_route_success\n @south_america = Init.set_up_map('../JSON/test_data.json')\n santiago = @south_america.vertices[@south_america.metros['santiago']]\n lima = @south_america.vertices[@south_america.metros['lima']]\n route = santiago.find_route(@south_america.metros['lima'])\n assert_equal(1, route.length)\n assert_instance_of(Array, route)\n assert_equal(route[0].vertex, lima)\n end",
"def send_request method, params = {}\n uri = URI.parse(@api_url)\n if Time.now.to_i > @exp + 3600\n get_acces_token\n @exp = Time.now.to_i\n end\n required = { 'access_token' => @access_token, 'method' => method }\n params = required.merge(params)\n params = URI.escape(params.collect{ |k,v| \"#{k}=#{v}\"}.join('&'))\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.request_uri)\n req['User-Agent'] = \"zhzhussupovkz pleer.com-ruby-api\"\n req.body = params\n res = http.request(req)\n if res.code == \"200\"\n data = res.body\n result = JSON.parse(data)\n else\n puts \"Invalid getting data from server\"\n exit\n end\n end",
"def create_request(path)\n Fron::Request.new \"#{@rest_options.url}/#{path}\", 'Content-Type' => 'application/json'\n end",
"def create_request(path)\n Fron::Request.new \"#{@rest_options.url}/#{path}\", 'Content-Type' => 'application/json'\n end",
"def add_plane(plane)\n @planes << plane\n end",
"def flight_params\n params.require(:flight).permit(:request_id, :user_id, :aircraft_id, :number, :aircrew_id, :origin_id, :destination_id, :departure_time, :arrival_time, cargo: [:weight, :contents])\n end",
"def get_overlay\n uri = \"http://gisrevprxy.seattle.gov/ArcGIS/rest/services/SDOT_EXT/sdot_parking/MapServer/export\"\n query = self.request_params_to_query\n self.query = \"#{uri}?#{query}\"\n self.remote_overlay_url = self.query\n end",
"def acquire_new_plane(aircrafttype)\n home_airport = self.home_airport_game\n param_array = [aircrafttype,self,home_airport]\n new_plane = PlaneCreator.new(param_array).manufacture\n finalize_acquisition_and_save(new_plane)\n end",
"def index_tape_drives_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TapeDrivesApi.index_tape_drives ...'\n end\n # resource path\n local_var_path = '/tape_drives'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :pipe) if !opts[:'sort_by'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'tape_library_id'] = opts[:'tape_library_id'] if !opts[:'tape_library_id'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'serial'] = opts[:'serial'] if !opts[:'serial'].nil?\n query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n query_params[:'scsi_address'] = opts[:'scsi_address'] if !opts[:'scsi_address'].nil?\n query_params[:'vendor'] = opts[:'vendor'] if !opts[:'vendor'].nil?\n query_params[:'product'] = opts[:'product'] if !opts[:'product'].nil?\n query_params[:'firmware'] = opts[:'firmware'] if !opts[:'firmware'].nil?\n query_params[:'device'] = opts[:'device'] if !opts[:'device'].nil?\n query_params[:'sgdevice'] = opts[:'sgdevice'] if !opts[:'sgdevice'].nil?\n query_params[:'libso'] = opts[:'libso'] if !opts[:'libso'].nil?\n query_params[:'acs'] = opts[:'acs'] if !opts[:'acs'].nil?\n query_params[:'lsm'] = opts[:'lsm'] if !opts[:'lsm'].nil?\n query_params[:'panel'] = opts[:'panel'] if !opts[:'panel'].nil?\n query_params[:'transport'] = opts[:'transport'] if !opts[:'transport'].nil?\n query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?\n query_params[:'full'] = opts[:'full'] if !opts[:'full'].nil?\n query_params[:'mount_count'] = opts[:'mount_count'] if !opts[:'mount_count'].nil?\n query_params[:'use_to'] = opts[:'use_to'] if !opts[:'use_to'].nil?\n query_params[:'use_by'] = opts[:'use_by'] if !opts[:'use_by'].nil?\n query_params[:'barcode'] = opts[:'barcode'] if !opts[:'barcode'].nil?\n query_params[:'task_id'] = opts[:'task_id'] if !opts[:'task_id'].nil?\n query_params[:'use_file_processed_size'] = opts[:'use_file_processed_size'] if !opts[:'use_file_processed_size'].nil?\n query_params[:'use_file_size_to_process'] = opts[:'use_file_size_to_process'] if !opts[:'use_file_size_to_process'].nil?\n query_params[:'use_file_name_processed'] = opts[:'use_file_name_processed'] if !opts[:'use_file_name_processed'].nil?\n query_params[:'bandwidth'] = opts[:'bandwidth'] if !opts[:'bandwidth'].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[:body] \n\n # return_type\n return_type = opts[:return_type] || 'TapeDriveCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TapeDrivesApi#index_tape_drives\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def set_trip_request\n @trip_request = TripRequest.find_by_token!(params[:id])\n end",
"def airplane_params\n params.require(:airplane).permit(:name, :row, :column)\n end",
"def get_tier1_segment_port_0_with_http_info(tier_1_id, segment_id, port_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsPortsApi.get_tier1_segment_port_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.get_tier1_segment_port_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.get_tier1_segment_port_0\"\n end\n # verify the required parameter 'port_id' is set\n if @api_client.config.client_side_validation && port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'port_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.get_tier1_segment_port_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/ports/{port-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'port-id' + '}', port_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 = 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 => 'SegmentPort')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentsPortsApi#get_tier1_segment_port_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @zonas = Zona.all\n @zona = Zona.create(zona_params)\n end",
"def index\n ab(params[:lan])\n @pozis = Pozi.all\n end"
] |
[
"0.573053",
"0.5695246",
"0.56820446",
"0.56767565",
"0.56714404",
"0.56536955",
"0.5620115",
"0.5612157",
"0.5590911",
"0.5588296",
"0.55565244",
"0.5550627",
"0.5412829",
"0.53715193",
"0.53588456",
"0.5340669",
"0.5307712",
"0.5279672",
"0.5279569",
"0.5268617",
"0.5243696",
"0.5226695",
"0.5180667",
"0.51665306",
"0.51665306",
"0.514245",
"0.5134802",
"0.5113167",
"0.5089376",
"0.50839424",
"0.50759315",
"0.506825",
"0.5060194",
"0.5055926",
"0.5051955",
"0.5043633",
"0.50434554",
"0.5042337",
"0.50355554",
"0.50332284",
"0.5031297",
"0.5027539",
"0.500289",
"0.49877772",
"0.49795845",
"0.49737647",
"0.49698508",
"0.49477893",
"0.4945713",
"0.4934021",
"0.49323124",
"0.49202716",
"0.49131233",
"0.4905608",
"0.4904717",
"0.48797417",
"0.48745424",
"0.48735237",
"0.48725137",
"0.48715016",
"0.48650277",
"0.48633915",
"0.48593387",
"0.48571193",
"0.4855358",
"0.48462301",
"0.48366183",
"0.4832386",
"0.48317695",
"0.48284993",
"0.48262754",
"0.4822969",
"0.48212874",
"0.48199934",
"0.48195365",
"0.48097295",
"0.48007116",
"0.4796847",
"0.4796847",
"0.4786104",
"0.47836503",
"0.47778907",
"0.4775754",
"0.4775754",
"0.4774313",
"0.47577924",
"0.47552195",
"0.47538152",
"0.47535723",
"0.47535723",
"0.4747246",
"0.47448462",
"0.47441238",
"0.47439498",
"0.47417068",
"0.4736962",
"0.4736741",
"0.47187495",
"0.47185317",
"0.47185114"
] |
0.57402587
|
0
|
names = str.split string = "" until names.empty? string << names.pop + " " end puts string end
|
def name_shuffler(str)
p str.split.reverse.join(" ")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def liststrs(strs)\n return \"\" if strs.empty?\n if (strs.count == 1)\n strs[0]\n else\n last = strs.pop\n [strs.join(', '), last].join(' and ')\n end\nend",
"def get_name_initials(names)\n output = []\n names.each do |name|\n first, last = name.split(\" \")\n output << [first[0], last[0]].join\n end\n output\nend",
"def format_name(str)\n parts = str.split(\" \")\n print parts\nend",
"def split\n p @rev_name\n @split_name = @rev_name.split('')\n p @split_name\nend",
"def list names\n names = names.map { |name| name[:name] }\n p names\n case\n when names.count == 0\n \"\"\n when names.count == 1\n names[0]\n when names.count == 2\n names[0] + \" & \" + names[1]\n when names.count > 2\n last = names.pop\n names.join(\", \") + \" & \" + last\n end\nend",
"def swap_name(str)\n str.split(\"\\n\").map do |name|\n n = name.split(\" \")\n n[1] + \", \" + n[0]\n end.join\nend",
"def extract_full_names(s)\n\ts = \" \".concat(s).concat(\" \")\n\t#puts \"###############################################\"\n\t#puts s\n\tlist = s.scan(/\\s'?\"?\\w+,?\\s\\w+[,']?\\.?\\s?\\w*\\s?&?\\s?\\w*\"?'?\\s/)\n\t#puts \"=>\", list\n\tlist.map! do |name| \n\t\ttmp = name.sub(/^\\s*/, \"\").sub(/\\s*$/, \"\").sub(/<.+>/, \"\").sub(/,$/, \"\").delete(\"\\\"\\'\\.\")\n\t\tif tmp.include?(\",\") and !tmp.include?(\"&\")then\n\t\t\tl = tmp.split(\",\")\n\t\t\tl[1].sub!(/^\\s*/, \"\")\n\t\t\t#assert(l.length == 2, \"fails at #{tmp} out of #{s}\")\n\t\t\tif (l.length != 2) then\n\t\t\t\ttmp = \"\"\n\t\t\telse\n\t\t\t\ttmp = l[1].concat(\" \").concat(l[0])\n\t\t\tend\n\t\tend\n\t\ttmp\n\tend\n\tlist\nend",
"def list(arr)\n return \"\" if arr.empty?\n\n str = []\n\n arr.each do |hsh|\n hsh.each do |k, v|\n str << v\n end\n end\n \n return str[0] if str.length < 2\n\n names = ''\n idx = 0\n\n until idx == str.length - 2\n names << str[idx] + ', '\n idx += 1\n end\n names << str[-2] + ' & '\n names << str[-1]\n \nend",
"def swap_name(string)\n first, last = string.split\n \"#{last}, #{first}\"\nend",
"def swap_name(string)\n first, last = string.split\n \"#{last}, #{first}\"\nend",
"def list names\n names = names.map { |name| name[:name] }\n last_name = names.pop\n return last_name.to_s if names.empty?\n \"#{names.join(', ')} & #{last_name}\"\nend",
"def initials(name)\n idx = 0\n new_str = ''\n\n loop do\n new_str << name.split[idx][0].upcase\n new_str << '.'\n idx += 1\n break if idx == name.split.length - 1\n end\n \n new_str << name.split[-1].capitalize\n\n new_str\nend",
"def swap_name(string)\n new_string = ''\n arr = string.split(' ')\n new_string << \"#{arr[-1]}, #{arr[0]}\"\nend",
"def string_splitter( string )\n\n array = []\n array = string.split(\"\")\n p array\n return array\n\nend",
"def swap_name(str)\n arr = str.split\n p arr[1] + ', ' + arr[0]\nend",
"def space_separated(str: raise)\n\tfirst_index = 0\n\tlast_index = 0\n\tresults = []\n\n\tstr.size.times do\n\t\tcheck_string = str[first_index..last_index]\n\t\tif DICTIONARY[check_string]\n\t\t\tresults << check_string\n\t\t\tfirst_index = last_index += 1\n\t\t\tlast_index = first_index\n\t\telse\n\t\t\tlast_index += 1\n\t\tend\n\tend\n\n\tputs results.join(\" \")\nend",
"def surname_and_initials\n a = split\n initials = a.pop\n a.collect(&:capitalize).join(' ') + ' ' + initials\n end",
"def split_string(string, split)\n i = 0\n item = \"\"\n output = []\n while i <= string.length-1\n if string[i] != split\n item += string[i]\n elsif string[i] == split\n output << item\n item = \"\"\n end\n i += 1\n end\n if item != \"\"\n output << item\n item = \"\"\n end\n return output\nend",
"def split_name\n\t\t@full_name.split('')\n\tend",
"def to_initials(name)\n\n nameArr = name.split(\" \")\n returnArr = []\n \n nameArr.each do |ele|\n returnArr << ele[0]\n end\n\n print returnArr.join(\"\")\n\n\nend",
"def split_flip_name\n p \"what is your first and last name? (type 'print' to quit)\"\n name = gets.chomp.downcase\n old_name_array = []\n old_name_array << name\n p old_name_array\n split_name = name.split(' ')\n #more elegant to use reverse method\n flip_name = split_name[1], split_name[0]\n #p flip_name\n join_name = flip_name.join(' ').chars\n #p join_name\nend",
"def swap_name(str)\n str.split.reverse.join(', ')\nend",
"def swap_name(str)\n str.split.reverse.join(\", \")\nend",
"def name_shuffle(str)\n\t#creates an array with each word as an element\n\tstr = str.split\n\t#reverse the order of the array, last being first\n\t#first being last\n\tstr = str.reverse()\n\t#creates a string from the array, joining the words\n\t#with a space\n\tstr = str.join(\" \")\n\t#returns the string\n\treturn str\nend",
"def list names\ncase names.size\n when 0\n \"\"\n when 1\n names[0][:name]\n when 2\n \"#{names[0][:name]} & #{names[1][:name]}\"\n else\n \"#{names[0..names.size-2].map { |x| x[:name] }.join(\", \")} & #{names[names.size-1][:name]}\"\n end\nend",
"def list(names)\n if names.size == 0 ; return ''\n elsif names.size == 1 ; return \"#{names[0][:name]}\"\n else ; first_elements = names[0..-2].map {|element| element[:name]}\n return \"#{first_elements.join(\", \")} & #{names[-1][:name]}\"\n end\nend",
"def name_shuffler(str)\n str.split.reverse.join(' ')\nend",
"def name_shuffler(str)\n str.split.reverse.join(' ')\nend",
"def nameswap(name)\n name_reverse = []\n nameary = name.split(' ')\n counter = 1 \n loop do \n name_reverse << nameary[counter]\n counter -= 1\n break if counter < 0\n end\n \n name_reverse.join(', ')\nend",
"def swap_name(string)\n string.split.reverse.join(', ')\n end",
"def swap_name(string)\n string.split.reverse.join(', ')\nend",
"def accum(s)\n arr = s.split('')\n arr.map!.each_with_index do |letter, index|\n (letter * (index + 1)).capitalize\n # binding.pry\n end\n arr.join('-')\nend",
"def swap_name(name_str)\n first_name, last_name = name_str.split\n \"#{last_name}, #{first_name}\"\nend",
"def to_initials(name)\n # Write your code here\n new_name = name.split(\" \")\n\n first_ini = new_name[0][0]\n second_ini = new_name[1][0]\n\n puts \"#{first_ini.upcase}#{second_ini.upcase}\"\n\n # new_name1=new_name.split(\"\")\n # new_string1 =[]\n # new_name.each do |x|\n # new_string1 << x = x.shift\n # new_string2 = x.join(\"\")\n # end\n\nend",
"def name_slicer(names_switched)\n\tstringed_switched_name = names_switched.join(' ')\n\tstringed_switched_name.split(\"\")\nend",
"def spinWords(string)\r\n \r\n var= string.split(' ') #[\"Hey\", \"fellow\", \"warriors\"]\r\n finalarry=[]\r\n var.each do |x|\r\n arry= x.split('') \r\n if arry.count >= 5\r\n finalarry << arry.reverse\r\n else\r\n finalarry<< arry\r\n end\r\n\r\n \r\n end\r\n \r\n lastarry=[]\r\n finalarry.each do |y|\r\n lastarry << y.join(\"\")\r\n \r\n end\r\n \r\n result= lastarry\r\n p result.join(' ')\r\n\r\n\r\n \r\n \r\nend",
"def rearrange(string)\n match = /(\\w+), (\\w+) (\\w+)/.match(string) #(1)\n last_name = match[1]\n first_name = match[2]\n middle_name = match[3]\n \"#{first_name} #{middle_name[0,1]}. #{last_name}\" #(2)\nend",
"def first_last_name\n names = name.split\n names.first + \" \" + names.last\n end",
"def spy_name_map(str)\n# reverse first and last name\n\t# str = str.downcase\n\tsplit_name = str.split(' ')\n\treverse_name = split_name.reverse\n\tspy_name = reverse_name.join(' ')\n\tstored_names = []\n\nletters = spy_name.split('')\ni = 0\n\n\tletters.map! { |letter| letter.next }\n\tspy_final = letters.join('')\n# if spy_final.include? '!'\nspy_final = spy_final.gsub!('!', ' ')\n\tstored_names << spy_final\n\tp spy_final\nend",
"def substrings_at_start(string)\n result = []\n\n loop do\n break if string.empty?\n result << string\n string = string.chop\n end\n\n result.reverse\nend",
"def swap_name(str)\n \"#{str.split[1]}, #{str.split[0]}\"\nend",
"def swap_name(strings)\n strings.split.reverse.join(', ')\nend",
"def swapping_names(name)\n names = name.split('')\n names.reverse!\n names.join('')\nend",
"def list(names_hsh)\n names_arr = []\n names_hsh.each { |hsh| names_arr << hsh[:name] }\n last_name = names_arr.pop\n return last_name.to_s if names_arr.empty?\n \"#{names_arr.join(', ')} & #{last_name}\"\nend",
"def split_first_lastname s\n last,first = s.split(/,/,2)\n first = '' if first == nil\n return first,last.capitalize\n end",
"def alt_split(string)\n array = string.gsub(/([!\\?\\.]\\s)/, '\\1\\n').split(\" \\\\n\")\n array.each do |line|\n line[0] = \"\" while line.chars.first == \" \"\n line[0] = line[0].upcase if /[a-z]/.match(line.chars.first)\n end\nend",
"def get_spy_name(names)\n # no space in between names or too manynames\n if names.count(\" \") == 0\n print \"Enter 2 names\"\n return nil\n elsif names.count(\" \") > 1\n print \"Enter just 2 names\"\n return nil\n end\n\n names_arr = swap_names(names)\n\n names_arr.map!{ |name|\n chars_array = name.chars\n\n chars_array.map!{ |char|\n char = next_letter(char)\n }\n }\n\n # capitalize first letter of both names\n names_arr[0][0].capitalize!\n names_arr[1][0].capitalize!\n\n #insert space after new first name\n names_arr.insert(1, ' ')\n\n return names_arr.join()\nend",
"def name_shuffler(s)\n s.split.reverse.join(' ')\nend",
"def nameswap(string)\n name = string.split\n name.reverse.join(\" \")\nend",
"def swap_name(string)\n name_array = string.split\n \"#{name_array[1]}, #{name_array[0]}\"\n\nend",
"def first_to_last(name)\r\n\t# convert name into array\r\n\tnames = name.split(\" \")\r\n\t# swap first and last\r\n\tl = names.length - 1\r\n\ttemp = names[0]\r\n\tnames[0] = names[l]\r\n\tnames[l] = temp\r\n\t# convert array back into new string\r\n\tnew_name = names.join(\" \")\r\n\treturn new_name\r\nend",
"def black_spot(line)\n parts = line.chomp.split(\"|\")\n\n @names = parts[0].split(\" \")\n @count = parts[1].strip.to_i\n\n until @names.length == 1\n current_index = 0\n until @count == current_index\n @names.each_with_index do |name, index|\n current_index += 1\n if current_index == @count\n @names.delete_at(index)\n break\n end\n end\n end\n end\n\n puts @names[0]\n\nend",
"def swap_name(string)\n \"#{string.split[1]}, #{string.split[0]}\"\nend",
"def sub_strings(string)\r\n blank = []\r\n idx = 0\r\n while idx < string.length\r\n length = 1\r\n while (idx + length) <= string.length\r\n blank << string.slice(idx, length)\r\n length += 1\r\n end\r\n idx += 1\r\n end\r\n return blank\r\nend",
"def names\n nameparts = name.split(' ')\n firstinitial = nameparts.second ? \"#{firstname[0, 1]}.\" : ''\n secondname = nameparts.third ? nameparts.second : ''\n secondinitial = nameparts.third ? \"#{secondname[0, 1]}.\" : ''\n middlenames = nameparts.length > 2 ? nameparts.from(1).to(nameparts.from(1).length - 2) : []\n middleinitials = ''\n middlenames.each_with_index do |name, index|\n middleinitials << ' ' if index.positive?\n middleinitials << \"#{name.to_s[0, 1]}.\"\n end\n lastname = nameparts.last\n names = []\n names << full_name # Joseph Aloysius Hansom\n names << \"#{title} #{name}\" if titled? # Sir Joseph Aloysius Hansom\n names += aka # Boz, Charlie Cheese, and Crackers\n names << \"#{title} #{firstinitial} #{middleinitials} #{lastname}\" if titled? && nameparts.length > 2\n names << \"#{title} #{firstinitial} #{lastname}\" if titled? && nameparts.length > 1\n names << name if name != full_name # Joseph Aloysius Hansom\n if name.include? ',' # George Inn, Barcombe\n names << name.split(/,/).first\n return names\n end\n names << \"#{title} #{name.split(/ of /).first}\" if name.include?(' of ') && titled? # King Charles II [of England]\n names << name.split(/ of /).first if name.include?(' of ') # [King] Charles II [of England]\n names << \"#{firstname} #{middleinitials} #{lastname}\" if nameparts.length > 2 # Joseph A[loysius]. R[obert]. Hansom\n names << \"#{firstinitial} #{middleinitials} #{lastname}\" if nameparts.length > 2 # J. A. R. Hansom\n names << \"#{firstname} #{nameparts.second} #{lastname}\" if nameparts.length > 2 # Joseph Aaron Hansom\n names << \"#{firstname} #{secondinitial} #{lastname}\" if nameparts.length > 2 # Joseph A. Hansom\n names << \"#{firstinitial} #{secondname} #{lastname}\" if nameparts.length > 2 # J. Aaron Hansom\n names << \"#{title} #{firstname} #{lastname}\" if nameparts.length > 2 && titled? # Sir Joseph Hansom\n names << \"#{firstname} #{lastname}\" if nameparts.length > 2 # Joseph Hansom\n names << \"#{firstinitial} #{lastname}\" if nameparts.length > 1 # J. Hansom\n names << \"#{title} #{lastname}\" if titled? # Lord Carlisle\n names << \"#{title} #{firstname}\" if titled? # Sir William\n names << firstname if nameparts.length > 1 # Charles\n names << lastname if nameparts.length > 1 # Kitchener\n names.uniq\n end",
"def rearrange(name)\n match = /(\\w+), (\\w+)( \\w+)?/.match(name) # (1)\n\n last_name = match[1]\n first_name = match[2]\n if match[3]\n separator = \"#{match[3][0,2]}. \" # (2)\n else\n separator = ' ' # (3)\n end\n \n \"#{first_name}#{separator}#{last_name}\" # (4)\nend",
"def strings(array)\n string = \"\"\n array.each do |word|\n if word == array[-1]\n string << word\n else\n string << word + \", \"\n end\n end\n p string\nend",
"def initials(string)\n name = string.split\n init = \"\"\n name.each do |elem|\n init += elem[0]\n end\n init.upcase\nend",
"def substrings(str)\n result = []\n until str.empty?\n str.size.times { |index| result << str[0..index] }\n str[0] = ''\n end\n result\nend",
"def my_split(string, delimiter)\n\n array = []\n el = ''\n string.each_char{|char|\n if char != delimiter\n el = el + char\n else\n array << el\n el = ''\n end\n }\n array << el\n array\nend",
"def name_reverser(string)\r\n name_array = string.split(' ').reverse\r\n modified_name = name_array.join(' ')\r\nend",
"def rearrange(string)\n has_middle_name = /(\\w+), (\\w+) (\\w+)/.match(string) # (1)\n no_middle_name = /(\\w+), (\\w+)/.match(string) # (2)\n\n if has_middle_name # (3)\n last_name = has_middle_name[1]\n first_name = has_middle_name[2]\n middle_name = has_middle_name[3]\n \"#{first_name} #{middle_name[0,1]}. #{last_name}\"\n elsif no_middle_name\n last_name = no_middle_name[1]\n first_name = no_middle_name[2]\n \"#{first_name} #{last_name}\"\n end\nend",
"def my_split(string, divider)\n array = []\n current_element = ''\n\n formatted_string = string.clone\n formatted_string.strip!\n\n formatted_string.each_char do |char|\n if char == divider\n array << current_element\n current_element = ''\n else\n current_element << char\n end\n end\n\n array << current_element\n\n array\nend",
"def split_input(input)\n array = input.split('')\n array << array[0]\nend",
"def names\n self.name.split(' ')\n end",
"def chomp(sep=$/) end",
"def chomp(sep=$/) end",
"def problem(str)\n result = []\n temp = \"\"\n i = 0\n while i < str.length\n if str[i] == \" \"\n result.push(temp)\n temp = \"\"\n else\n temp = str[i] + temp\n end\n i += 1\n end\n result.push(temp)\n return result.join(\" \")\nend",
"def sub_strings(str, max_size)\n words = str.split\n return [] if words.empty?\n \n sub_strings = []\n line = words.shift\n until words == []\n word = words.shift\n if line.size + 1 + word.size <= max_size\n line << \" #{word}\"\n else\n sub_strings << line\n line = word\n end\n sub_strings << line if words.empty?\n end\n \n sub_strings\nend",
"def swap_name(str)\n full_name = str.split\n \"#{full_name[1]}, #{full_name[0]}\"\nend",
"def get_employee_names (employeeNames)\n i = 0\n while i < 50\n puts \"Enter an employee's first name:\"\n firstName = gets.chomp\n break if firstName.downcase == \"quit\"\n\n puts \"Enter the employee's last name:\"\n lastName = gets.chomp\n # Concatenating the entries\n employeeNames[i] = firstName + \" \" + lastName\n i += 1\n end\n # Printing the employee's full names\n puts employeeNames\nend",
"def split_name_for_automatic_splitting\n temp = name\n if temp\n if temp.match /\\A[A-Z]{3}[a-z]/\n temp = temp[2..-1]\n end\n (temp && temp.split(/([A-Z]?[a-z]+)/).map(&:downcase) || []).reject do |part|\n part.size < 3\n end\n else\n []\n end\n end",
"def next_letter(full_name)\r\n\tidx = 0\r\n\twhile idx < full_name.length\r\n\t\tname = full_name.split('')\r\n\t\tname.map! { |letter| letter.next }\r\n\t\tidx += 1\r\n\tend\r\n\tname\r\nend",
"def deconcatnating\n puts \"The Deconcatenated String is:\"\n val = @value.split(/\\s/)\n end",
"def seperate(str,seperator='-')\n str.split('').join(seperator)\nend",
"def to_initials(name)\n parts = name.split(\" \")\n print parts\nend",
"def all_deputies_last_names(full_names)\n last_names = []\n\n full_names.each_with_index do |name, index|\n last_names << name if index.even?\n end\n\n last_names\nend",
"def next_letter(full_name)\r\n\tidx = 0\r\n\twhile idx < full_name.length\r\n\t\tname = full_name.split('')\r\n\t\tname.map! { |letter| letter.next unless (letter.next == \"!\") }\r\n\t\tidx += 1\r\n\tend\r\n\tname\r\nend",
"def chomp!(sep=$/) end",
"def chomp!(sep=$/) end",
"def penultimate(string)\n penultimate_word = []\n\n string_array = string.split\n penultimate_word << string_array[-2]\n\n penultimate_word.join\nend",
"def printStr(str1)\n i = 0\n while i < str1.length\n puts str1[i]\n i += 1\n end\nend",
"def meeting(s)\n new_arr = []\n names_arr = s.split(\";\").map { |full_name| full_name.scan(/(\\w.+):(\\w.+)/) }\n names_arr.each {|i| new_arr << [i[0][1].upcase, i[0][0].upcase] }\n sorted = new_arr.sort\n str = \"\"\n sorted.each do |ele|\n str << \"(#{ele[0]}, #{ele[1]})\"\n end\n p str\nend",
"def left_strip(string)\n whitespaces = [\"\\n\", \"\\t\"]\n i = 0\n output = \"\"\n while i<=string.length-1\n if string[i] == whitespaces[1] || string[i] == whitespaces[2]\n i+=1 \n else\n while i<=string.length-1\n output += string[i]\n i+=1\n end\n return output\n end\n end\n return output\nend",
"def reverse(string)\n arr = string.split\n new_arr = []\n loop do\n reversed_word = arr.pop\n new_arr.push(reversed_word)\n break if arr.length == 0\n end\n new_string = new_arr.join(' ')\nend",
"def split_string(string, delimiter)\n if string.nil?\n return []\n end\n return string\n .split(',')\n .map{ |s| s.strip || s }\n .reject { |s| s.empty? }\nend",
"def list(names)\n array = names.map{|n| n.values}\n if array.size > 2\n array[0..-2].join(\", \") + \" & #{array[-1][0]}\"\n else\n array.join(\" & \")\n end\nend",
"def vr_beta(s)\n splits = []\n while s.size != 0 do\n for i in 0..s.size-1\n splits << s[0..i]\n s.gsub!(/^\\w/, '') if i == (s.size-1)\n end\n end\n splits\nend",
"def line(katz_deli)\n\nline_array = []\n if katz_deli != []\n katz_deli.each.with_index(1) do |person, index| \n line_array << (\"#{index}. #{person} \")\n end\n \n line_array_last = line_array.pop ## removes last element with extra space\n line_array_last[line_array_last.length-1] = \"\" ## determines length to elminiate extra space\n line_array << line_array_last ## shovels last element without extra space to the array\n puts \"The line is currently: #{line_array.join}\"\n else\n puts \"The line is currently empty.\" \n end \nend",
"def pirates_say_arrrrrrrrr(string)\n # split(\"r\") \n # print out 2 position of each string - the first word\n array = []\n string.split(\"\").each_with_index do |letter, i|\n if letter == 'r' or letter == \"R\"\n array << string[1+i]\n \n end\n end\n array.join(\"\")\nend",
"def splitter(input)\n array = input.downcase.split('')\nend",
"def first_name(names)\n names.map do |word|\n word.split(\" \")[0]\n end\nend",
"def temp(str)\n len = str.length() - 1;\n\treturn (str.split('')[len] + str + str.split('')[len]);\nend",
"def croon(string)\n arr = string.split(\" \")\n arr = arr.map do |word|\n \tword = word.split(\"\").join(\"-\")\n p word\n end\n arr.join(\" \")\n end",
"def to_initials(name)\n initials = \"\"\n arrName = name.split(' ')\n arrName.each { | name | initials += name[0] }\n return initials\nend",
"def translate_name(name)\nreversed_name = name.split(' ').reverse\nnew_first = reversed_name[0].chars.map {|x|\n x.next\n }\nnew_last = reversed_name[1].chars.map {|x|\n x.next\n }\nnew_name = \"#{new_first.join} #{new_last.join}\"\nend",
"def split; end",
"def initials(string)\n\tstring.split(\" \").map{|x| x=x[0].capitalize}.join\n\t\nend",
"def chomp(string)\n output = \"\"\n j = 0\n new_string = string[-1]\n if new_string == \"\\n\"\n while j < string.length-1\n output += string[j]\n j += 1\n end\n return output\n else \n return string\n end\nend",
"def remove_repeated(string)\n last_letter = \"\"\n fixed_string_array = []\n string.split(\"\").each do |letter|\n if letter == last_letter\n fixed_string_array.pop\n else\n fixed_string_array.push(letter)\n end\n last_letter = letter\n end\n fixed_string_array.join(\"\")\nend"
] |
[
"0.64150476",
"0.63771516",
"0.63720644",
"0.63210225",
"0.6252859",
"0.6249087",
"0.62449706",
"0.62322867",
"0.6216454",
"0.6216454",
"0.6112335",
"0.6075554",
"0.606516",
"0.6041707",
"0.5981446",
"0.596406",
"0.5961802",
"0.59560454",
"0.5922974",
"0.5915404",
"0.590735",
"0.5898441",
"0.5895657",
"0.5868257",
"0.58322495",
"0.5831026",
"0.5828853",
"0.5828853",
"0.58242506",
"0.58184224",
"0.5803552",
"0.5800905",
"0.5796642",
"0.57710296",
"0.576873",
"0.57660604",
"0.5765737",
"0.5758282",
"0.5755895",
"0.5741801",
"0.5736956",
"0.57345927",
"0.5732888",
"0.5728578",
"0.5726034",
"0.5723946",
"0.5710733",
"0.57068247",
"0.569709",
"0.5696537",
"0.5694175",
"0.56891525",
"0.5680329",
"0.56785005",
"0.5674385",
"0.5650063",
"0.5644319",
"0.56421334",
"0.5640343",
"0.5635841",
"0.5634429",
"0.56305885",
"0.561777",
"0.56140304",
"0.5612972",
"0.56042707",
"0.56042707",
"0.5602322",
"0.55937046",
"0.5593355",
"0.55928963",
"0.5590641",
"0.5583944",
"0.55733556",
"0.5561283",
"0.55579454",
"0.55579084",
"0.55546296",
"0.55478656",
"0.5547807",
"0.5542035",
"0.55419195",
"0.5540511",
"0.5538371",
"0.55343515",
"0.5529201",
"0.55189556",
"0.5517284",
"0.55132514",
"0.55064607",
"0.55051935",
"0.5498173",
"0.5496893",
"0.5496776",
"0.5483052",
"0.5473887",
"0.5473815",
"0.54712254",
"0.54708076",
"0.5469499"
] |
0.59536684
|
18
|
Create the filename to save the image locally as
|
def image_url_to_default_filename (image_url = @todays_image_url)
matches = image_url.scan(/\S+\/(\S+.jpg)/) # returns an array
if (matches.length != 1)
return nil
end
return matches[0].to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_filename(name)\n $file = \"images/\" << Time.now.strftime('%Y-%m-%d-%H-%M-%S-') << \"#{name}.jpg\"\nend",
"def filename\n \"mp-#{make_stamp}-1024.jpg\" if original_filename\n end",
"def image_filename\n File.join Img_Store, \"#{id}.#{extension}\"\n end",
"def filename\n #\"#{original_filename.split('.').first}.png\" if original_filename\n \"img.#{original_filename.split('.').last}\" if original_filename\n #original_filename if original_filename\n end",
"def filename()\n @name ||= \"#{SecureRandom.hex()}.png\"\n end",
"def filename\n @filename ||= generate_thumbnail!\n end",
"def filename\n # byebug\n \"#{secure_token}.jpg\" if original_filename.present?\n end",
"def filename_for_image_upload\n random_token = Digest::SHA2.hexdigest(\"#{Time.now.utc}--#{current_user.id.to_s}\").first(15)\n \"temp_upload_#{random_token}\"\n end",
"def filename_for_image_upload\n random_token = Digest::SHA2.hexdigest(\"#{Time.now.utc}--#{current_user.id.to_s}\").first(15)\n \"temp_upload_#{random_token}\"\n end",
"def build_filename(file, thumb = false)\n if thumb\n new_filename = SecureRandom.hex(8).to_s + '-thumb-' + current_user.id.to_s\n else\n new_filename = SecureRandom.hex(8).to_s + '-' + current_user.id.to_s\n end\n\n extension = if (file.content_type == 'image/png')\n '.png'\n elsif (file.content_type == 'image/jpeg')\n '.jpeg'\n elsif (file.content_type == 'image/jpg')\n '.jpg'\n end\n return new_filename + extension\n end",
"def storage_filename\n \"#{ frame.domain }\" +\n \"/images/\" + \n \"#{ Time.now.strftime( \"%m_%d_%Y\" ) }\" +\n \"_#{ SecureRandom.urlsafe_base64( 5 ) }_\" +\n \"#{ image_name }\"\n end",
"def filename\n if original_filename\n return \"#{model.id.to_s}.jpg\"\n else\n return model.portrait_filename\n end\n end",
"def filename\n \"#{Time.now.to_i}_cover.jpg\" if original_filename\n end",
"def store_full_image_name\n dirname = File.dirname(docker_name_path)\n FileUtils.mkdir_p(dirname) unless File.exist?(dirname)\n full_image_name = generate_name\n IO.write(docker_name_path, full_image_name)\n end",
"def filename\n \"#{@user.name}.png\"\n end",
"def create_filename(heat_number)\n name = competition.to_s\n name += \"_\"\n name += \"heat_\"\n name += heat_number.to_s.rjust(3, \"0\")\n \"#{name.first(59)}.txt\"\n end",
"def current_image_filename\n \"#{name.downcase.gsub(' ', '')}certification.png\"\n end",
"def file_name\n \"images/#{@name}.msf\"\n end",
"def filename\n \"#{resize_prefix}_#{original_filename}\"\n end",
"def filename\n \"vehicle.png\" if original_filename\n end",
"def filename\n @name ||= \"#{model.firstname.parameterize}-#{model.lastname.parameterize}.#{model.image.file.extension}\"\n end",
"def photo_filename\n\tFile.join PHOTO_STORE, \"#{id}.#{extension}\"\n end",
"def filename\n return @filename unless @filename.nil?\n generate_file_name()\n @filename\n end",
"def filename\n \"#{@user.screen_name}.png\"\n end",
"def filename\n @name ||= ActiveSupport::SecureRandom.hex\n\t\"#{@name}#{File.extname(original_filename).downcase}\" if original_filename\n end",
"def filename\n @filename = \"#{secure_token}_#{split_extension(original_filename)}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n \"passeport_photo.png\" if original_filename\n end",
"def filename\n \"#{Digest::SHA1.file(file.file).hexdigest}.png\" if original_filename\n end",
"def photo_filename\n \tFile.join PHOTO_STORE, \"#{id}.#{extension}\"\n end",
"def generate_file_name\n file_name = attachment.instance_read(:file_name).slugged_filename\n attachment.instance_write :file_name, file_name\n end",
"def filename\n filename = (model.name + '_' + model.artist.name + '_' + model.release.name).downcase.gsub(/\\s/, '-')\n \"#{filename}\" if original_filename \n end",
"def filename\n if @filename\n ext_name = File.extname(@filename)\n unless %w(jpg jpeg png gif).include?(ext_name)\n model.random_string + \".jpg\"\n else\n model.random_string + ext_name\n end\n end\n end",
"def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_current_time + \"_\" + original_filename\n end",
"def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_current_time + \"_\" + original_filename\n end",
"def generate_filename\n #if episodeTitle != brandTitle (brandTitle looks to be the name of the program) then use this in the filename\n if @metadata[:episodeTitle] != @metadata[:brandTitle]\n out_file = \"#{@metadata[:title1]}__#{@metadata[:title2]}__#{@metadata[:episodeTitle]}\"\n else #otherwise just use title1/2\n out_file = \"#{@metadata[:title1]}__#{@metadata[:title2]}\"\n end\n out_file.gsub!(/[^0-9A-Za-z.\\-]/, '_') #replace non alphanumerics with underscores\n\n @out_file = File.join(@out_dir, out_file)\n end",
"def make_filename(file_index)\n return SAVE_PATH + SAVE_FILE_NAME.gsub(/\\{ID\\}/i) { (file_index + 1).to_s }\n end",
"def filename\n if original_filename\n md5 = Digest::MD5.hexdigest(\"#{model.imagenable.friendly_id}_#{Time.now}\")\n \"#{md5}.#{file.extension}\"\n end\n end",
"def make_filename(index)\n return sprintf(\"Save%02d.rvdata2\", index + 1) if index.is_a?(Fixnum)\n \"#{index}.rvdata2\"\n end",
"def photo_filename\n File.join PHOTO_STORE, \"#{id}.#{extension}\"\n end",
"def photo_filename\n File.join PHOTO_STORE, \"#{id}.#{extension}\"\n end",
"def generate_name\n self.name = \"#{album.name}-#{self.image_file_file_name}\"\n end",
"def original_filename\n @original_filename ||= \"profile-#{Time.now.to_i}-#{SecureRandom.hex(16)}.png\"\n end",
"def new_file name\n raise \"Not a Valid Directory\" unless valid_directory?\n\n file_name = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}_#{name}.txt\"\n \"#{output_directory_path}#{file_name}\"\n end",
"def file_name\n \"#{name.downcase.gsub(/\\s/, '')}.jpg\"\n end",
"def generate_unique_filename\n name = options[:file_name] || wrapper.name\n # TODO: Sanitize the file name\n\n filename = \"#{name}.swatches\"\n\n related_files = related_file_indexes(filename)\n\n filename = if related_files.present?\n \"#{name}-#{related_files.max + 1}#{SWATCHES_EXTENSION}\"\n else\n \"#{name}#{SWATCHES_EXTENSION}\"\n end\n\n @swatches_path = File.join(options[:export_directory], filename)\n end",
"def generate_png\n img = IMGKit.new(url).to_png\n file = File.new(\"#{id}-full.png\", \"w\", :encoding => 'ascii-8bit')\n file.write(img)\n return file.path\n end",
"def filename\r\n \"#{model.user_id.to_s}_#{model.id.to_s}.mov\" if original_filename\r\n end",
"def filename\n DateTime.now.strftime('%Q') + Digest::MD5.hexdigest(original_filename) + original_filename if original_filename\n end",
"def filename\n \"restaurant_thumbnail\" if original_filename\n end",
"def getfilename()\n current_time = Time.new.strftime(\"%Y-%m-%d\")\n \n # Create filename\n filename = current_time + \"_sprint_update_CS.html\"\n\n # Create folder with all file of sprint update\n foldername = \"History\"\n Dir.mkdir(foldername) unless File.exists?(foldername)\n\n return File.join(\".\", foldername, filename)\nend",
"def genfilename(ext, time = Time.now)\n time.strftime(\"%Y-%m-%d\") + ext\n end",
"def randomize_filename\n extension = File.extname(asset_file_name).downcase\n self.asset.instance_write(:file_name, \"#{SecureRandom.hex.first(16)}#{extension}\")\n end",
"def filename\n 'profile_picture.jpg' if original_filename\n end",
"def write_image id, name_suffix=\"\"\n m_begin \"write_image\"\n filename = \"./temp/\" +id.to_s+name_suffix+\".gif\"\n get_image(id).write(filename)\n m_end \"write_image\"\n end",
"def filename\n if original_filename.present? && model.photoable.present?\n \"#{model.photoable.display_name.parameterize}-#{secure_token}.#{file.extension}\"\n elsif original_filename.present? && model.photoable.blank?\n \"mydiscoveries-#{secure_token}.#{file.extension}\"\n end\n end",
"def filename\n @name ||= \"#{timestamp}-#{secure_token(8)}.#{file.extension}\" if original_filename.present?\n end",
"def gen_filename\n name = @issue[\"created\"].strftime(\"%Y-%m-%d-\") + \n @issue[\"title\"].gsub(/\\W+/, \"_\") +\n \".yaml\"\n n = 1\n while File.exist?(File.join(@dir, name))\n name = File.basename(name, \".yaml\") + \"-\" + n.to_s + \".yaml\"\n n += 1\n end\n\n name\n end",
"def filename\n return unless original_filename\n if model.instance_variable_get('@_temporal_filename')\n model.instance_variable_get('@_temporal_filename')\n else\n timestamp = DateTime.now.strftime(\"%d-%m-%Y-%H-%M\")\n random_id = SecureRandom.hex\n temporal_filename = \"#{timestamp}-#{random_id}-#{original_filename}\"\n model.instance_variable_set('@_temporal_filename', temporal_filename)\n end\n end",
"def get_image_fname(spec, img_idx)\n if spec.use_original_filenames\n fname = @bridge.get_image_filename(img_idx).dup\n fname << \".jpg\" unless fname =~ /\\.(jpe|jpg|jpeg)$/i\n else\n fname = \"IMG_#{img_idx}.jpg\"\n end\n fname = append_fname_suffix(fname, \"@2x\") if spec.highDPI\n\n fname\n end",
"def get_image_fname(spec, img_idx)\n if spec.use_original_filenames\n fname = @bridge.get_image_filename(img_idx).dup\n fname << \".jpg\" unless fname =~ /\\.(jpe|jpg|jpeg)$/i\n else\n fname = \"IMG_#{img_idx}.jpg\"\n end\n fname = append_fname_suffix(fname, \"@2x\") if spec.highDPI\n\n fname\n end",
"def filename\n if original_filename\n \"#{model.name.parameterize}-#{secure_token(8)}.#{file.extension}\"\n end\n end",
"def create_file_name(ext = nil)\n ext ||= self.ext\n return name unless ext\n \"#{unique_key}.#{ext}\"\n end",
"def file_name\n ts = @entries.first.time_stamp\n File.join(@coord.options.output_dir,\n ts.strftime('%Y-%m-%d'),\n ts.strftime('%H-%M'),\n ts.strftime('%S.%3N-') + id)\n end",
"def filename\n \"#{original_filename}+#{secure_token}.#{file.extension}\" if original_filename.present?\n end",
"def makeNewFilename\n # note use of hard coded 6 digit counter width - is this enough files?\n pad = \"0\" * (6 - @count.to_s.length) + count.to_s\n newbase = @baseFilename.sub(/(\\.\\w*)$/, pad + '\\1')\n @filename = File.join(File.dirname(@filename), newbase)\n Logger.log_internal {\"File #{@filename} created\"}\n end",
"def filename\n if original_filename.present?\n \"#{model.story.slug}-#{secure_token}.#{file.extension}\"\n end\n end",
"def make_filename(file_index)\r\n return \"Save#{file_index + 1}.rxdata\"\r\n end",
"def make_file_name(proposal, type='paltrack')\n @filename = \"sales_export_#{Time.now.strftime('%Y%m%d%H%M%S')}.csv\"\n end",
"def image_png\r\ndirectory = File.expand_path File.dirname(__FILE__)\r\nspecific_filename = directory + \"/\" + \"Media/shop.png\"\r\nend",
"def image_save_path\n @image_save_path\n end",
"def image_name\n path = \"sets/#{set}/#{dimension}_#{polarity}_#{verbal}\"\n # Rails.application.assets.find_asset(path).nil? ? 'placeholder' : path\n path\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 save_filename(id, ext=\"SAV\")\n \"CHRDAT#{id}.#{ext}\"\n end",
"def filename\n @filename ||= File.join(tmpdir, \"#{File.basename(destination)}.#{compression.extension}\")\n end",
"def backup_filename\n [\n category,\n owner.full_name,\n title\n ].join(\"_\") + Pathname.new(original_filename).extname\n end",
"def filename\n \"wallpaper.#{file.extension}\" if file\n end",
"def make_file_name(proposal, type='paltrack')\n @filename = \"item_export_#{Time.now.strftime('%Y%m%d%H%M%S')}.csv\"\n end",
"def filename\n \"#{original_filename_without_extension.parameterize}_#{model.filename_token}#{original_extension}\" if original_filename\n end",
"def export(filename)\n @image.save(filename, interlace: true)\n end",
"def filename\n @filename ||= File.join(tmpdir, \"#{File.basename(destination)}.#{compression_extension}\")\n end",
"def file_path\n \"#{Time.now.to_f}.#{filename}\"\n end",
"def full_filename (for_file = model.source.file)\n super.chomp(File.extname(super)) + '.png'\n end",
"def to_actual_filename!\n filename = to_actual_filename\n replace(filename) if filename\n end",
"def filename\n \"#{model.class.to_s}_#{Date.today}.svg\"\n end",
"def file_name\n file_name = \"h\"\n write_zeros.times { file_name += \"0\" }\n file_name += @@count.to_s + \".txt\"\n end",
"def autoname(type)\n begin\n\treturn unless @outdir\n\tstamp = sprintf('%.6f',\"#{Time.now.to_i}.#{Time.now.usec}\".to_f).gsub('.','')\n\tFile.join(@outdir,\"#{type.upcase}_#{stamp}.#{@format.downcase}\")\n rescue Exception => e\n\t@output.puts \"#{e.message} #{e.backtrace.inspect}\"\n\t@logger.error \"#{e.message} #{e.backtrace.inspect}\" if @logger \n end\n end",
"def output_filename(path, opts)\n filename = File.basename(path) + '.png'\n if opts.filename\n if opts.targets.length == 1\n return opts.filename\n else\n opts.filename + '.' + filename\n end\n end\n filename\nend",
"def generate_filename(game)\n \"./data/#{Time.now.to_i}#{game.json.gamestate.opponent}.yml\"\n end",
"def filename(record, file)\n original = \"#{file.basename}.#{file.extension}\"\n write_attribute(:original_filename, original)\n ext = file.suffix.nil? || file.suffix == :original ? file.extension : file.suffix\n \"#{application_for_offering.id.to_s}-#{title.gsub(/[\\s,\\.\\\\\\/\\*\\?\\%\\:\\|\\\"\\'\\<\\>]?/,'')}.#{ext}\"\n end",
"def image_filename(mobile = false)\n mobile ? mobile_image_filename : desktop_image_filename\n end",
"def create_image(image_name)\n open(image_name, 'wb') do |file|\n file << open(URI.escape(@chart)).read\n end\n end",
"def filename\n if original_filename\n uuid = UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, original_filename)\n extname = File.extname(original_filename)\n return \"#{uuid}#{extname}\"\n end\n end",
"def storage_filename\n File.join(storage_path, @placeholder, @export_filename + @extension)\n end",
"def filename_generator\n\t\tparameter_array = Array.new\n\t\tunless params[:name].blank?\n\t\t\tparameter_array << params[:name]\n\t\tend\n\t\t\n\t\tunless params[:state].blank?\n\t\t\tparameter_array << params[:state]\n\t\t end\n\t\t\n\t\tunless params[:commodity].blank?\n\t\t\tparameter_array << params[:commodity]\n\t\tend\n\t\t\n\t\t\n\t\t unless params[:status].blank?\n\t\t\t parameter_array << params[:status].pluralize.parameterize.underscore\n\t\t else\n\t\t\t parameter_array << params[:controller]\n\t\t end\n\t\t\t\t \n\t\t unless params[:action] == 'index'\n\t\t\tparameter_array << params[:action]\n\t\t end\n\t\t \n\t\t if params[:action].in?([\"jorc\",\"resources\"])\n\t\t\tparameter_array << \"for_#{params[:year]}\" unless params[:year].blank?\n\t\t end\n\t\t\t\t\n\t\tparameter_array << Date.today.to_s.gsub(/-/,'')\n\t\t\n\t\t@filename = parameter_array.join('_')\n\tend",
"def remote_filename\n @remote_filename ||= File.join(remote_dir, \"copy-#{File.basename(destination)}.#{compression.extension}\")\n end",
"def save_image(url)\n file_name = get_filename(url)\n dir_name = '/vagrant/bookinfo/public/'\n file_path = dir_name + file_name\n\n mechanize = Mechanize.new\n page = mechanize.get(url)\n page.save_as(file_path)\n\n return file_path\n end",
"def image_filename(path, extension)\n \"html/images/#{path}.#{extension}\"\n end",
"def filename(domain_name, baseurl)\n @filename ||= generate_file_name(domain_name, baseurl)\n end",
"def image_jpg\r\n directory = File.expand_path File.dirname(__FILE__)\r\n specific_filename = directory + \"/\" + \"Media/1.jpg\"\r\nend",
"def to_filename\n \"#{year}#{sprintf(\"%02d\", month)}#{sprintf(\"%02d\", day)}-\" +\n \"#{sprintf(\"%02d\", hour)}_#{sprintf(\"%02d\", min)}_#{sprintf(\"%02d\", sec)}\"\n end",
"def filename\n \"property-#{property.picture}\"\n end"
] |
[
"0.75576806",
"0.73158324",
"0.7294669",
"0.7190004",
"0.71491385",
"0.7109095",
"0.7057079",
"0.7028486",
"0.7028486",
"0.6976257",
"0.69451445",
"0.69408506",
"0.6932692",
"0.69046056",
"0.6902102",
"0.68485284",
"0.6847525",
"0.6842672",
"0.6841337",
"0.6839679",
"0.6818499",
"0.6805518",
"0.6789861",
"0.678489",
"0.6777309",
"0.67633617",
"0.6759053",
"0.675289",
"0.6746728",
"0.6741274",
"0.6736473",
"0.67330045",
"0.6730618",
"0.6730618",
"0.6720881",
"0.6713697",
"0.6697516",
"0.66815835",
"0.6657375",
"0.6657375",
"0.6656976",
"0.66467524",
"0.66439515",
"0.6611749",
"0.6606418",
"0.6602614",
"0.6565346",
"0.65475285",
"0.6534342",
"0.6532014",
"0.6527715",
"0.65260845",
"0.6507103",
"0.64995176",
"0.6482458",
"0.6477194",
"0.64635015",
"0.64498055",
"0.64478123",
"0.64478123",
"0.6438193",
"0.64381146",
"0.64273834",
"0.6424905",
"0.6421124",
"0.64161897",
"0.6375307",
"0.63750535",
"0.6370498",
"0.6366323",
"0.6363272",
"0.63587004",
"0.63558066",
"0.6355473",
"0.6345989",
"0.6340028",
"0.6338385",
"0.6321756",
"0.630858",
"0.6302224",
"0.629523",
"0.62919813",
"0.6288693",
"0.62795335",
"0.6278202",
"0.6274002",
"0.62716216",
"0.62695044",
"0.62635785",
"0.62524295",
"0.6242249",
"0.62382424",
"0.6234482",
"0.62246853",
"0.62234557",
"0.62192446",
"0.62124604",
"0.62114453",
"0.6210538",
"0.6210449",
"0.6203228"
] |
0.0
|
-1
|
redcloth loves to put caps in 'spancaps', it's lame
|
def start_span attrs
if attrs['class'] == 'caps'
@nospan = true
else
@output << "%"
@output << add_attributes(attrs) if add_attributes(attrs)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def custom_caps(text)\n # $1 and $2 are excluded HTML tags, $3 is the part before the caps and $4 is the caps match\n text.gsub(%r{\n (<[^/][^>]*?>)| # Ignore any opening tag, so we don't mess up attribute values\n (\\s| |^|'|\"|>|) # Make sure our capture is preceded by whitespace or quotes\n ([A-Z\\d](?:(\\.|'|-|&|&|&\\#38;)?[A-Z\\d][\\.']?){1,}) # Capture capital words, with optional dots, numbers or ampersands in between\n (?!\\w) # ...which must not be followed by a word character.\n }x) do |str|\n tag, before, caps = $1, $2, $3\n\n # Do nothing with the contents if ignored tags, the inside of an opening HTML element\n # so we don't mess up attribute values, or if our capture is only digits.\n if tag || caps =~ /^\\d+\\.?$/\n str\n elsif $3 =~ /^[\\d\\.]+$/\n before + caps\n else\n before + '<span class=\"caps\">' + caps + '</span>'\n end\n end\n end",
"def jt_caps(text)\n return custom_caps(text.to_s)\n end",
"def expand(style = nil)\n word = EXPAND.fetch(to_sym, self)\n word = word.capitalize if style == :caps\n word\n end",
"def caps(text)\n exclude_sensitive_tags(text) do |t|\n # $1 and $2 are excluded HTML tags, $3 is the part before the caps and $4 is the caps match\n t.gsub(%r{\n (<[^/][^>]*?>)| # Ignore any opening tag, so we don't mess up attribute values\n (\\s| |^|'|\"|>|) # Make sure our capture is preceded by whitespace or quotes\n ([A-Z\\d](?:(\\.|'|&|&|&\\#38;)?[A-Z\\d][\\.']?){1,}) # Capture capital words, with optional dots, numbers or ampersands in between\n (?!\\w) # ...which must not be followed by a word character.\n }x) do |str|\n tag, before, caps = $1, $2, $3\n\n # Do nothing with the contents if ignored tags, the inside of an opening HTML element\n # so we don't mess up attribute values, or if our capture is only digits.\n if tag || caps =~ /^\\d+\\.?$/\n str\n elsif $3 =~ /^[\\d\\.]+$/\n before + caps\n else\n before + '<span class=\"caps\">' + caps + '</span>'\n end\n end\n end\n end",
"def caps(text)\n return Typogruby.caps(text.to_s)\n end",
"def alt_caps(string)\n case\n when string.length > 10\n string.upcase\n else\n string\n end\nend",
"def caps(name)\n\tputs \"#{name.upcase}\"\nend",
"def staggered_case(str)\n alt_cap = ''\n need_upper = true\n split_str = str.chars\n split_str.each do |char|\n if char =~ /[^A-z]/\n alt_cap << char\n else\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n end\n end\n alt_cap\nend",
"def staggered_case(string, cap_req = true, alpha_req = true)\n need_upper = cap_req\n stag_case = []\n string.chars.each do |char|\n need_upper ? stag_case << char.upcase : stag_case << char.downcase\n need_upper = !need_upper if alpha_req ? char =~ /[a-z]/i : true\n end\n stag_case.join\nend",
"def longcaps(words)\n if words.length > 10\n words.upcase\n else\n words\n end\nend",
"def conditional_caps(phrase)\n if phrase.length > 10\n phrase.upcase\n else \n phrase\n end\nend",
"def letter_cases(allow_prefixed_underscores: true)\n LuckyCase.cases self, allow_prefixed_underscores: allow_prefixed_underscores\n end",
"def caps_me\n caps self\n end",
"def capitalize() end",
"def wordcap\n self.split(\" \").each{|word| word.capitalize!}.join(\" \")\n end",
"def caps(word)\n if word.length > 10\n word.upcase\n else\n word\n end\nend",
"def studly_caps(delimiter = '_')\n ((self.start_with?(delimiter) ? '' : delimiter) + self).camel_case(delimiter)\n end",
"def caps(word)\n if (word.length > 10)\n word.upcase\n elsif\n word\n end\nend",
"def long_cap(word)\n\tif word.length > 10\n\t\tputs \"Ah... this word is worthy, I'll shout it out:#{word.upcase}!!!!!\"\n\telse\n\t\tputs \"Too shor! It wouldn't be worth it to put that word in all caps. This is hard work you know.\"\n\tend\nend",
"def staggered_case_decide(string, use_all_char=false)\n alt_cap = ''\n need_upper = true\n split_str = string.chars\n split_str.each do |char|\n if use_all_char\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n else\n if char =~ /[^A-z]/\n alt_cap << char\n else\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n end\n end\n end\n alt_cap\nend",
"def capitalize!() end",
"def caps(str)\n str.upcase\n end",
"def staggered_case(str, start_up_case = true)\n capital = start_up_case\n result_str = \"\"\n str.each_char do |char|\n if char =~ /[a-zA-Z]/\n capital ? char.upcase! : char.downcase!\n end\n result_str << char\n capital = !capital\n end\n p result_str \nend",
"def all_caps(word)\n if word.length >= 10\n return word.upcase\n end\n word\nend",
"def caps (string)\n\tif string.length > 10 \n\t\tstring.upcase\n\telse\n\t\tstring\nend\nend",
"def textilize\n\t\tunless self.blank?\n\t\t RedCloth.new(self, [:filter_styles, :no_span_caps]).to_html\n\t\telse\n\t\t \"\"\n\t end\n\tend",
"def all_caps(words)\n\t\twords = words.to_s\n\t\tif words.length < 10\n\t\t\tputs \"not 10 chars\"\n\t\telse\n\t\t\tputs words.upcase\n\t\tend\n\tend",
"def caps(string)\n return string.upcase\nend",
"def caps(string)\n return string.upcase\nend",
"def split_on_caps(word)\n word.split(/(?=[A-Z])/).join(\" \")\n end",
"def snake_case(group = true)\n\t\t\treturn self unless self =~ %r/[A-Z\\s]/\n\t\t\treverse.scan(%r/[A-Z]+|[^A-Z]*[A-Z]+?|[^A-Z]+/).reverse.map{|word| word.reverse.downcase}.join('_').gsub(/\\s/,'_')\n\t\tend",
"def capital(skip_prefixed_underscores: false)\n LuckyCase.capitalize self, skip_prefixed_underscores: skip_prefixed_underscores\n end",
"def snake_case(name); end",
"def capsV2(word, &block)\n puts 'In capsV2 method'\n block.call(word)\nend",
"def all_caps(string)\n\tif string.length > 10\n\t return string.upcase!\n \telse\n \t return string\n \tend\nend",
"def all_caps(words)\n if words.length > 10\n words.upcase\n else\n words.downcase\n end\nend",
"def caps(word)\n puts 'In caps method'\n yield(word)\nend",
"def unusualCapitalization(*x); field('unusualCapitalization', *x) end",
"def string_in_all_caps(the_string)\n puts 'your string in all caps is ' + the_string.upcase\nend",
"def capital_word_case(preserve_prefixed_underscores: true)\n LuckyCase.capital_word_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end",
"def all_caps(strn)\n strn = strn.upcase if strn.length > 10\nend",
"def caps(arg)\n yield(arg)\nend",
"def allcaps(string)\n if string.length > 10\n puts string.upcase # solution does not use puts here but down below as part\n else # of the method call --> puts allcaps(\"hello world\")\n puts string # I think i like this version better, saves writing puts so many times\n end\nend",
"def all_caps(string)\n if string.length < 10\n puts string\n else\n puts string.upcase\n end\nend",
"def staggered_case(str) # moving to new string\n capital_letter = true\n new_str = ''\n str.each_char do |letter|\n if letter =~ /[^a-z]/i\n new_str << letter\n else\n capital_letter ? letter.upcase! : letter.downcase!\n new_str << letter\n capital_letter = !capital_letter\n end\n end\n new_str\nend",
"def camel_caps(str, splitChr=\" \")\n words = str.downcase.split(splitChr).each_with_index.map { |v| v.capitalize }\n return [words.join('-'), words.join(' ')]\n end",
"def caps(argument)\n if argument.length > 10\n\t puts argument.upcase\n else\n\t puts argument\n\tend\nend",
"def caps(string)\n if string.length > 10\n string.upcase\n else\n string\n end\nend",
"def caps(str)\n puts str.length > 10 ? str.upcase : str\nend",
"def underscorize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"_\").downcase)\n end",
"def rl_capitalize_word(count, key)\r\n rl_change_case(count, CapCase)\r\n end",
"def staggered_case(input)\n input = input.downcase\n new_arr = []\n \n input.chars.each_with_index do |char, idx|\n if idx % 2 == 1 || (!(('a'..'z').to_a).include?(char) && !(('A'..'Z').to_a).include?(char))\n new_arr << char\n else\n new_arr << char.capitalize!\n end\n end\n new_arr.join\nend",
"def craft_names(rand_words, snippet, pattern, caps=false)\nnames = snippet.scan(pattern).map do\n word = rand_words.pop()\n caps ? word.capitalize : word\nend\n\nreturn names * 2\nend",
"def camel_case length=Randomaze::String.random_length, start=rand_base::ALPHA_UPCASE, &check\n rand_base.check_result check do\n rand_base.alpha(1, start) + rand_base.alnum(length-1, rand_base::ALPHA)\n end\n end",
"def caps(string)\n if string.length > 10\n string.upcase\n else\n string\n end\nend",
"def caps(string)\n if string.length > 10\n string.upcase\n else\n string\n end\nend",
"def caps(string)\n if string.length > 10\n string.upcase\n else\n string\n end\nend",
"def caps(string)\n if string.length > 10\n string.upcase\n else\n string\n end\nend",
"def staggered_case2(str, start_with = 'upper')\n case start_with.downcase\n when 'u', 'upper'\n str.chars.map.with_index \\\n { |chr, idx| idx.even? ? chr.upcase : chr.downcase }.join('')\n when 'l', 'lower'\n str.chars.map.with_index \\\n { |chr, idx| idx.odd? ? chr.upcase : chr.downcase }.join('')\n else\n puts \"start_with option #{start_with} is not recognized.\"\n puts \"Choose 'upper' ('u') or 'lower' ('l').\"\n end\nend",
"def staggered_case(string, need_upper= true)\n result = ''\n need_upper\n string.chars.each do |char|\n if need_upper\n result += char.upcase\n else\n result += char.downcase\n end\n need_upper = !need_upper\n end\n result\nend",
"def for_cap_list\n if /\\s/.match?(self)\n '\"' + self + '\"'\n else\n self\n end\n end",
"def caps(string_1)\n length_1 = string_1.length\n if length_1 > 10 then string_1.upcase! end\n puts string_1\nend",
"def staggered_case2(string, starting_case = 'uppercase')\n starting_case == 'uppercase' ? need_upper = true : need_upper = false\n result = ''\n string.chars.each do |char|\n if need_upper\n result += char.upcase\n else\n result += char.downcase\n end\n need_upper = !need_upper\n end\n result\nend",
"def staggered_case(string, start_on_0 = true)\n result = ''\n need_upper = start_on_0\n string.chars.each do |char|\n if need_upper\n result += char.upcase\n else\n result += char.downcase\n end\n need_upper = !need_upper\n end\n result\nend",
"def staggered_case2(str, start_with = 'upper')\n new_str = ''\n to_upcase = case start_with\n when 'u', 'upper' then true\n when 'l', 'lower' then false\n else\n puts \"start_with option #{start_with} is not recognized.\"\n puts \"Choose 'upper' ('u') or 'lower' ('l').\"\n return\n end\n str.chars.each do |chr|\n if chr =~ /[a-zA-Z]/\n new_str << (to_upcase ? chr.upcase : chr.downcase)\n to_upcase = !to_upcase\n else\n new_str << chr\n end\n end\n new_str\nend",
"def all_caps(string)\n string.length > 10 ? string.upcase : string\nend",
"def caps(string)\n if string.length > 10\n return string.upcase\n else\n return string\n end\nend",
"def get_camel_caps input\n tmp = input.split(\"_\")\n tmp.each do |x|\n x.downcase!\n x.capitalize!\n end\n return tmp.join(\"\")\n end",
"def mixed_case_2(name)\n\tname.downcase.gsub(/\\b\\w/, &:upcase)\nend",
"def caps(string)\n if string.length > 10\n string.upcase #the book did not use to_i, so it looks like length returns an integer.\n else #notice how the book did not use puts. puts returns nil, and the book told us to \"return\" an \n string #all-caps version of the string. checking to see how this works via irb now...\n end # !!! the string is used as a return value in their example !!! make note of this. oh boy.\nend",
"def caps(string)\n if string.length > 10\n string.upcase\n else\n string\n end\n end",
"def caps(str)\n if str.length > 10\n str.upcase!\n else\n puts str\n end\nend",
"def titlecase\n\t\tsplit(/(\\W)/).map(&:capitalize).join\n\tend",
"def caps(str)\n if str.length > 10\n str.upcase\n else\n str\n end\nend",
"def upper_case()\n LuckyCase.upper_case self\n end",
"def caps(string)\n if string.length > 10\n puts string.upcase\n else\n puts \"This cannot be changed.\"\n end\nend",
"def sentence_case(preserve_prefixed_underscores: true)\n LuckyCase.sentence_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end",
"def transform_control_title (title)\n title.gsub(/^\\(L1\\) /, '').gsub(/[()',.&:]/, '').gsub(/.scr/, '').gsub(/\\s+/, '_').gsub(/[\\\\%-]/, '_').gsub(/_+/,'_').downcase\nend",
"def titleize\n arr = %w(a an the by to)\n upcase_arr = %w(DX EDA AEDG LPD COP)\n r = gsub('_', ' ').gsub(/\\w+/) do |match|\n match_result = match\n if upcase_arr.include?(match.upcase)\n match_result = upcase_arr[upcase_arr.index(match.upcase)]\n elsif arr.include?(match)\n match_result = match\n else\n match_result = match.capitalize\n end\n match_result\n end\n\n r\n end",
"def name_case!\n self.gsub!(self, self.name_case)\n end",
"def title_case(string)\n no = 0\n no_cap = [\"a\",\"an\",\"the\",\"with\",\"and\",\"but\",\"or\",\"on\",\"in\",\"at\",\"to\"]\n split = string.split.map! do |word|\n no += 1\n if no < 2\n word.downcase.capitalize\n elsif word[0] == \"*\"\n word.sub!(\"*\",\"\")\n elsif word.include?('-')\n word.split('-').each{|i| i.capitalize!}.join('-')\n elsif no_cap.include?(word.downcase)\n word.downcase\n else\n word.capitalize\n end\n end\n split.join(' ')\nend",
"def snakecase(name)\n name.gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').downcase\n end",
"def all_caps(str)\n if str.length > 10 \n str.upcase\n else\n str\n end\nend",
"def capitalize_each_word(phrase)\r\n\r\nend",
"def titlecase!\n replace(titlecase)\n end",
"def case_fix(name)\r\n fixed_name = name.split(' ')\r\n fixed_name.each do |word|\r\n word.capitalize!\r\n end\r\n fixed_name.join(' ')\r\nend",
"def all_caps(string)\n if string.length > 10 then\n string.upcase\n else\n string\n end\nend",
"def Reflex\r\n reflex.cap_first\r\n end",
"def sillycase(str)\n midpoint = (str.length/2.0).ceil\n p midpoint\n first_half = str[0...midpoint].downcase\n p first_half\n second_half = str[midpoint..-1].upcase\n p second_half\n return first_half + second_half\nend",
"def snake_case\n self.gsub(/([a-z])([A-Z])/) {|s| \"#{s[0]}_#{s[1]}\"}.gsub(/([A-Z])([A-Z][a-z])/) {|s| \"#{s[0]}_#{s[1..2]}\"}.downcase\n end",
"def all_caps(str)\n if str.length > 10\n str.upcase\n else\n str\n end\nend",
"def all_caps(str)\n if str.length > 10\n str.upcase\n else\n str\n end\nend",
"def staggered_case(str)\narray = str.split(\"\")\nneed_upper = true\nresult = []\narray.each do |char|\n if char.match(/[a-zA-Z]/) && need_upper == true\n result.push(char.upcase)\n need_upper = !need_upper\n elsif char.match(/[a-zA-Z]/)\n result.push(char.downcase)\n need_upper = !need_upper\n else result.push(char) \n end\n \nend\nresult.join(\"\")\nend",
"def snake_case2\n (self.gsub! /(.)([A-Z])/, '\\1_\\2').downcase\n rescue\n self\n end",
"def snake_case length=rand_base.random_length, &check\n rand_base.check_result check do\n if length > 2\n weight = 3\n [\n rand_base.alpha(1, rand_base::ALPHA_DOWNCASE),\n rand_base.from_array(rand_base::ALPHA_DOWNCASE + rand_base::NUMBER + ['_'] * weight, length-2),\n rand_base.alpha(1, rand_base::ALPHA_DOWNCASE),\n ].join\n else\n rand_base.alpha(length, rand_base::ALPHA_DOWNCASE)\n end\n end\n end",
"def lucky_case(allow_prefixed_underscores: true)\n LuckyCase.case self, allow_prefixed_underscores: allow_prefixed_underscores\n end",
"def title_case(title, minor_words = \"\")\n if title == nil\n return nil\n else \n minor_words_array = minor_words.split(' ').map do |word|\n word.downcase\n end \n title_array = title.split(\" \").map do |word|\n word.downcase\n end \n titled = title_array.map do |word| \n if !minor_words_array.include?(word)\n word.capitalize \n else \n word.downcase \n end\n end \n titled[0] = titled[0].capitalize \n titled.join(\" \")\n binding.pry\n end\nend",
"def craft_names(rand_words, snippet, pattern, caps = false)\n\tnames = snippet.scan(pattern).map do\n\t\tword = rand_words.pop()\n\t\tcaps ? word.capitalize : word\n\tend\n\t\n\treturn names * 2\t\nend",
"def capitalize(skip_prefixed_underscores: false)\n self.capital skip_prefixed_underscores: skip_prefixed_underscores\n end",
"def staggered_case(str) \n next_char_is_uppercase = false\n\n new_chars = str.chars.map do |character|\n next_char_is_uppercase = !next_char_is_uppercase\n next_char_is_uppercase ? character.upcase : character.downcase\n end\n\n new_chars.join\nend"
] |
[
"0.72289354",
"0.6885218",
"0.6827235",
"0.6801748",
"0.6444477",
"0.6337838",
"0.6331051",
"0.62902665",
"0.6267668",
"0.6243935",
"0.6182852",
"0.6175215",
"0.6115733",
"0.6082101",
"0.60139275",
"0.59841365",
"0.5969673",
"0.5966692",
"0.5953061",
"0.59528863",
"0.59500206",
"0.5946345",
"0.5927761",
"0.5899959",
"0.5898439",
"0.58744067",
"0.58648866",
"0.58363235",
"0.58363235",
"0.58264905",
"0.5819967",
"0.58137536",
"0.5810351",
"0.5802372",
"0.58022827",
"0.5796158",
"0.57907784",
"0.5779044",
"0.5773226",
"0.5764679",
"0.57402813",
"0.57344264",
"0.57280576",
"0.57234305",
"0.57215506",
"0.57191867",
"0.5700819",
"0.56906366",
"0.5688159",
"0.5686853",
"0.5681165",
"0.5660181",
"0.56540835",
"0.56540275",
"0.5650174",
"0.5650174",
"0.5650174",
"0.5650174",
"0.56497276",
"0.5646304",
"0.5637984",
"0.5631393",
"0.5630773",
"0.5622988",
"0.5622888",
"0.5618896",
"0.5614502",
"0.56137806",
"0.5606531",
"0.56044024",
"0.5604088",
"0.56023824",
"0.5601259",
"0.5599971",
"0.55987",
"0.55957425",
"0.5586135",
"0.55840313",
"0.55780643",
"0.5567888",
"0.5567754",
"0.5563494",
"0.5561217",
"0.555911",
"0.5558431",
"0.55517006",
"0.55510616",
"0.55469745",
"0.55439806",
"0.55387264",
"0.5528313",
"0.5528313",
"0.5527153",
"0.5523687",
"0.55227876",
"0.5522374",
"0.5520061",
"0.55169785",
"0.55120564",
"0.5509912"
] |
0.6034458
|
14
|
def update songs=User.find(session[:user_id]).mediafiles.where(:id => params[:selected_songs],:mediatype => params[:mediatype]) devices=User.find(session[:user_id]).devices.where(:id => params[:selected_devices]) songs.each do |song| devices.each do |device| song.devices << device unless song.devices.include?(device) end end redirect_to '/media?mediatype='+params[:mediatype], success: 'The playlist has been updated!' end
|
def songs
<<<<<<< HEAD
file="#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}"
if File.exists?(file)
send_file(
file,
filename: "#{params[:file_name]}",
type: "application/mp3"
)
else
render nothing: true
end
=======
send_file(
"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}",
filename: "#{params[:file_name]}",
type: "application/mp3"
)
>>>>>>> b71dc3f177d170c9fc8bde7924fd28f948e88acc
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n params[:song][:song_type] = params[:song][:songs].content_type.chomp\n params[:song][:song_in] = params[:song][:songs].read\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, :flash => {:success => 'Song was successfully updated.'} }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit,:flash => {:danger => 'Song was failed to update.'} }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def move\n\t\tplayitems = params[:items]\n\t\t@playlist = Playlist.find(params[:playlist])\n\t\t\n\t\t\n\t\t#\n\t\t# Good or bad? this can't fail :) (technically)\n\t\t#\n\t\tPlaylistMedia.where('id IN (?)', playitems).update_all(:playlist_id => @playlist.id, :published => false)\n\t\n\t\t\n\t\trespond_with(@playlist) do |format|\n\t\t\tformat.js { render :action => 'update_playlist', :layout => false }\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @song.update(song_params)\n\n # NOTE: Clear the genres so we can update them if needed\n @song.genres.clear\n\n # NOTE: Update the genre relations.\n if params[:genres].present?\n params[:genres].each do |genre|\n @song.genres << @genres.find(genre)\n end\n end\n\n # NOTE: Clear the moods so we can update them if needed\n @song.moods.clear\n\n # NOTE: Update the mood relations.\n if params[:moods].present?\n params[:moods].each do |mood|\n @song.moods << @moods.find(mood)\n end\n end\n\n # NOTE: Clear the themes so we can update them if needed\n @song.themes.clear\n\n # NOTE: Update the theme relations.\n if params[:themes].present?\n params[:themes].each do |theme|\n @song.themes << @themes.find(theme)\n end\n end\n\n # flash[:notice] = song_params\n # flash[:alert] = params\n flash[:success] = 'Song was successfully updated.'\n format.html { redirect_to @song }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n playlist = Playlist.find_by(uuid: params[:id])\n if playlist[:user_id] == session[:user_id]\n change_playlist_title(playlist, params['playlist']['title'])\n update_playlist(playlist[:id], params['playlist']['tiktoks'])\n render json: { status: 200, playlist: playlist }\n else\n render json: { status: 500 }\n end\n end",
"def update\n song = Song.find(params[:song_id])\n @playlist = Playlist.find_by(user_id: current_user.id, song_id: params[:song_id])\n if @playlist\n new_playlist_total = @playlist.total + 1\n @playlist.update(total: new_playlist_total)\n new_total = song.total + 1\n song.update(total: new_total)\n redirect_to \"/songs\"\n else\n Playlist.create(user_id: current_user.id, song_id: params[:song_id], total: 1)\n redirect_to \"/songs\"\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n album_id = params[\"album\"]\n \n if not album_id.nil?\n album = Album.find_by(id: album_id)\n if not album.nil?\n album.songs << @song\n album.save\n\n artist = album.artist\n\n if not artist.nil?\n artist_id = artist.id\n if not artist_id.nil?\n artist.songs << @song\n artist.save\n end\n end\n end\n end\n \n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @playlist.update(playlist_params)\n\n render json: @playlist,status: :ok\n\n else\n\n render json: {error: true,errors: @playlist.errors},status: :unprocessable_entity\n\n end\n\n \t\tend",
"def create\n\t\tmedia_ids = params[:medias]\n\t\t@playlist = Playlist.find(params[:playlist_id])\n\t\tmedia_ids = GroupMedia.where('media_id IN (?) AND group_id = ?', media_ids, current_group.id).pluck(:id)\n\t\t\n\t\tPlaylistMedia.transaction do\n\t\t\tmedia_ids.each do |media_id|\n\t\t\t\tplayitem = PlaylistMedia.new(:playlist_id => @playlist.id, :group_media_id => media_id)\n\t\t\t\traise \"Save error\" unless playitem.save\n\t\t\tend\n\t\tend\n\t\t\n\t\trespond_with(@playlist) do |format|\n\t\t\tformat.js { render :action => 'update_playlist', :layout => false }\n\t\tend\n\tend",
"def update\n songs_to_remove = @music_disc.songs.select {|song| !music_disc_params[:music_category_ids].include?(song.music_category.id.to_s)}\n songs_to_remove.each do | song |\n @music_disc.songs.delete(song)\n end\n respond_to do |format|\n if @music_disc.update(music_disc_params)\n format.html { redirect_to @music_disc }\n format.json { render :show, status: :ok, location: @music_disc }\n else\n format.html { render :edit }\n format.json { render json: @music_disc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n \n respond_to do |format|\n updated_params = song_params\n if (@song.artist != song_params[:artist] || @song.songname != song_params[:songname])\n uri = 'http://developer.echonest.com/api/v4/song/search?api_key=6XUOAXHJOW28GGGRH&format=json&results=1&artist=' + Rack::Utils.escape(song_params[:artist]) + '&title=' + Rack::Utils.escape(song_params[:songname]) + '&bucket=audio_summary'\n result = open(uri).read\n parsed = JSON.parse(result)\n if parsed[\"response\"][\"songs\"].length > 0\n updated_params[:bpm] = parsed[\"response\"][\"songs\"][0][\"audio_summary\"][\"tempo\"]\n updated_params[:key] = parsed[\"response\"][\"songs\"][0][\"audio_summary\"][\"key\"]\n notice = \"Song found on EchoNest!\"\n else\n notice = \"Could not find updated song on EchoNest.\"\n end\n \n end\n if @song.update(updated_params)\n format.html { redirect_to @song, notice: \"#{notice} #{updated_params} \" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n Playlist.find(params[:id]).update(playlist_params)\n redirect_to \"/playlists/#{params[:id]}\"\n end",
"def update\n respond_to do |format|\n if @song.update_attributes(params[:song])\n format.html { redirect_to playlist_song_path(@playlist,@song), notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @playlist_song.update(playlist_song_params)\n format.html { redirect_to @playlist_song, notice: 'Playlist song was successfully updated.' }\n format.json { render :show, status: :ok, location: @playlist_song }\n else\n format.html { render :edit }\n format.json { render json: @playlist_song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @media_file.update(media_file_params) and @media_file.start_bookmark.update(media_bookmark_params)\n format.html { redirect_to @media_file, notice: 'Audio file was successfully updated.' }\n format.json { render :show, status: :ok, location: @media_file }\n else\n format.html { render :edit }\n format.json { render json: @media_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @playlist = Playlist.find(params[:id])\n\n if @playlist.update_attributes(params[:playlist])\n redirect_to \"/playlists\"\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to dashboard_songs_url, notice: \"歌曲更新成功。\" }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @song = Song.find(params[:id])\n unless @song.songtype.name == \"mp3\"\n flash[:error] = \"It doesn't work on that song type\"\n redirect_to(songs_url)\n end\n if (@song && tag = (Tagger.new(@song.file)) )\n ## Title\n title_tag = params[:title]\n if title_tag\n tag.title= title_tag\n params[:song][:title] = title_tag\n end\n ## Artist\n artist_tag = params[:artist]\n if artist_tag\n artist = (Artist.find_by_name artist_tag) || Artist.new({:name=>artist_tag})\n if artist.new_record?\n artist.save\n end\n params[:song][:artist] = artist\n tag.artist= artist_tag\n end\n ## Genre\n genre_tag = params[:genre]\n if genre_tag\n genre = (Genre.find_by_name genre_tag) || Genre.new({:name=>genre_tag})\n if genre.new_record?\n genre.save\n end\n params[:song][:genre] = genre\n tag.genre= genre_tag\n end\n genre ||= tag.lookup_genre\n genre_tag ||= genre.name\n ## Album\n\n album_tag = params[:album]\n if album_tag\n album = (Album.find_by_name album_tag) || Album.new({:name=>album_tag})\n if album.new_record?\n album = Album.new({:name=>album_tag, :genre=> genre})\n album.save\n album.artists.push artist\n else\n unless album.artists.include? artist\n album.artists.push artist\n end\n end\n params[:song][:album] = album\n tag.album= album_tag\n end\n tag.saveChanges\n b = Tagger.new(@song.file)\n unless ( ( params[:title] && b.title == params[:title]) && ( params[:artist] && b.artist == params[:artist]) && (params[:album] && b.album == params[:album]) && (params[:genre] && b.lookup_genre == params[:genre]) )\n flash[:error] = \"Song file did not save\"\n redirect_to edit_song_path(@song)\n end\n params[:song][:filemod] = Time.now\n respond_to do |format|\n if @song.update_attributes(params[:song])\n flash[:note] = 'Song was successfully updated.'\n format.html { redirect_to(@song) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @song.errors, :status => :unprocessable_entity }\n end\n end\n else\n flash[:error] = \"Song or its file Was not found\"\n redirect_to(songs_url)\n end\n end",
"def update\n respond_to do |format|\n if @playlist.update(playlist_params)\n format.html { redirect_to @playlist, notice: \"Playlist was successfully updated.\" }\n format.json { render :show, status: :ok, location: @playlist }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @playlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @plsbgmusic_mediafile.update(plsbgmusic_mediafile_params)\n format.html { redirect_to @plsbgmusic_mediafile, notice: 'Plsbgmusic mediafile was successfully updated.' }\n format.json { render :show, status: :ok, location: @plsbgmusic_mediafile }\n else\n format.html { render :edit }\n format.json { render json: @plsbgmusic_mediafile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n # @song = Song.where(id: params[:id])\n # @playlist = Userplaylist.where(song_id: params[:id])\n @user = User.find(session[:user_id])\n @song = Song.find(params[:id])\n @playlist = Userplaylist.where(song: @song)\n\n end",
"def update\n respond_to do |format|\n if @playlist.update(playlist_params)\n format.html { redirect_to confirmation_playlist_path(@playlist), notice: 'Playlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @playlist }\n else\n format.html { render :edit }\n format.json { render json: @playlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @playlist.update_attributes(params[:playlist])\n flash[:notice] = 'Playlist updated successfully'\n format.html { redirect_to single_path(@single_path) }\n format.xml { head :ok }\n else\n flash[:error] = 'There were problems updating the playlist'\n format.html { render :action => 'edit' }\n format.xml { render :xml => @single.errors.to_xml }\n end\n end\n end",
"def update\n if @playlist.user == current_user && @playlist.update(playlist_params)\n redirect_to @playlist.user\n else\n render :edit\n end\n end",
"def update\n authorize @song\n \n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n #songs = Song.all\n #byebug\n #puts \"got here - #{params[:song][:concert_ids]} - #{@song.id} - #{params[:song][:s_o]} - #{params[:song][:s_o1]}\"\n if !params[:song][:concert_ids][0].nil?\n @program = Program.find_by_concert_id_and_song_id(params[:song][:concert_ids][0],@song.id)\n @program.song_order = params[:song][:s_o]\n @program.save\n puts \"Song Id: #{@song.id} Concert ID: #{params[:song][:concert_ids][0]} Song Name: #{@song.name} Song Order: #{@program.song_order}\"\n end\n if !params[:song][:concert_ids][1].nil?\n @program = Program.find_by_concert_id_and_song_id(params[:song][:concert_ids][1],@song.id)\n @program.song_order = params[:song][:s_o1 ]\n @program.save\n puts \"Song Id: #{@song.id} Concert ID: #{params[:song][:concert_ids][1]} Song Name: #{@song.name} Song Order: #{@program.song_order}\"\n end\n if !params[:song][:concert_ids][2].nil?\n @program = Program.find_by_concert_id_and_song_id(params[:song][:concert_ids][2],@song.id)\n @program.song_order = params[:song][:s_o2 ]\n @program.save\n puts \"Song Id: #{@song.id} Concert ID: #{params[:song][:concert_ids][2]} Song Name: #{@song.name} Song Order: #{@program.song_order}\"\n end\n if !params[:song][:concert_ids][3].nil?\n @program = Program.find_by_concert_id_and_song_id(params[:song][:concert_ids][3],@song.id)\n @program.song_order = params[:song][:s_o3 ]\n @program.save\n puts \"Song Id: #{@song.id} Concert ID: #{params[:song][:concert_ids][3]} Song Name: #{@song.name} Song Order: #{@program.song_order}\"\n end\n if !params[:song][:concert_ids][4].nil?\n @program = Program.find_by_concert_id_and_song_id(params[:song][:concert_ids][4],@song.id)\n @program.song_order = params[:song][:s_o4 ]\n @program.save\n puts \"Song Id: #{@song.id} Concert ID: #{params[:song][:concert_ids][4]} Song Name: #{@song.name} Song Order: #{@program.song_order}\"\n end\n\n if false\n for concert in Concert.all\n if !concert.songs.find_by_name(@song.name).nil?\n sid = concert.songs.find_by_name(@song.name).id # get id of song in this concert\n @program = Program.find_by_concert_id_and_song_id(concert.id,sid) # create program instance\n #@program.nil?\n @program.song_order = @song[:s_o] # update value\n #puts \"Song Id: #{sid} Concert ID: #{concert.id} Song Name: #{@song.name} Song Order: #{@song[:s_o]}\"\n @program.save \n end # save it\n end \n end\n\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @playlist.update(playlist_params)\n format.html { redirect_to @playlist, notice: 'Playlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @playlist }\n else\n format.html { render :edit }\n format.json { render json: @playlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def added_songs(playlist)\n valid_songs(changes[\"playlists\"][\"update\"][playlist[\"id\"]][\"song_ids\"])\nend",
"def update\n respond_to do |format|\n if @songlist.update(songlist_params)\n format.html { redirect_to @songlist, notice: 'Songlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @songlist }\n else\n format.html { render :edit }\n format.json { render json: @songlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_playlist_and_track\n @playlist = Playlist.find(params[:playlist_id])\n @track = @playlist.playlist_tracks.find(params[:track_id])\n end",
"def update\n @playlist = current_user.playlists.find(params[:id])\n\n respond_to do |format|\n if @playlist.update_attributes(params[:playlist])\n format.html { redirect_to @playlist, notice: 'Playlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @playlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @song.update(song_params)\n render :show, status: :ok, location: @song\n else\n render json: @song.errors, status: :unprocessable_entity\n end\n end",
"def update\n @playlist = Playlist.find(params[:id])\n\n if @playlist.update_attributes(params[:playlist])\n head :no_content\n else\n render json: @playlist.errors, status: :unprocessable_entity\n end\n end",
"def update\n if not user_signed_in?\n redirect_to new_user_session_path\n else\n respond_to do |format|\n if @playlist.update(playlist_params)\n format.html { redirect_to @playlist, notice: 'Playlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @playlist }\n else\n format.html { render :edit }\n format.json { render json: @playlist.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @playlists = current_user.playlists.all\n respond_to do |format|\n if @movie.update(movie_params)\n format.html { redirect_to playilst_path(@playlist.playlist_id), notice: 'Movie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @playlist_movie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@song.update(song_params)\n\t\tredirect_to song_path(@song)\n\tend",
"def update\n respond_to do |format|\n if @user_song.update(user_song_params)\n format.html { redirect_to @user_song, notice: 'User song was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_song }\n else\n format.html { render :edit }\n format.json { render json: @user_song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def playlist_photo_player\n # Recent_Photos\n image_playlist_setting params[:item_id]\n if params[:item_id] == 'All_Photos' || params[:item_id] == 'Recent_Photos'\n uploads = @user.uploaded_photos.allowed.map {|photo| photo.image.url }\n urls = @user.photo_urls.allowed.map {|photo| photo.image_url }\n @image_url = uploads + urls\n @playlists = @user.image_playlists.where('social_network in (?)', %w(Facebook Twitter Instagram Flickr Picasa))\n render :partial => 'player/single/multi_playlist_photo'\n elsif params[:item_id] == 'Uploaded_Photos'\n @image_url = @user.uploaded_photos.allowed.map {|photo| photo.image.url }\n render :partial => 'player/single/twitter_photo'\n elsif params[:item_id] == 'URL_Photos'\n @image_url = @user.photo_urls.allowed.map {|photo| photo.image_url }\n render :partial => 'player/single/twitter_photo'\n else\n @media = ImagePlaylist.find(params[:item_id])\n render :partial => 'player/single/player'\n end\n end",
"def update\n @playlist = Playlist.find(params[:id])\n\n respond_to do |format|\n if @playlist.update_attributes(params[:playlist])\n flash[:notice] = \"Playlist '#{@playlist}' was successfully updated.\"\n format.html { redirect_to playlist_url(@playlist) }\n format.xml { head :ok }\n format.js { render :template => 'music/playlists/success' }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @playlist.errors.to_xml }\n format.js { render :template => 'music/playlists/error' }\n end\n end\n end",
"def index\n @musics = MusicLibrary.all\n @playlists = current_user.playlists.all\n @musics = @musics.singer(params[:singer]) if params[:singer].present?\n @musics = @musics.title(params[:title]) if params[:title].present?\n @new_playlist = Playlist.new\n end",
"def update\n # @playlist = Playlist.find(params[:id])\n\n respond_to do |format|\n if @playlist.update_attributes(params[:playlist])\n format.html { redirect_to playlist_path(@playlist), notice: 'Playlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render_json_response :unprocessable_entity, errors: @playlist.errors }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @media_folder = MediaFolder.find(params[:id])\n\n respond_to do |format|\n if @media_folder.update_attributes(params[:media_folder])\n flash[:notice] = 'Media Folder was successfully updated.'\n format.html { redirect_to(media_folders_url) }\n format.xml { head :ok }\n else\n @channels = Channel.all\n @aspects = Aspect.all\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @media_folder.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def copy\n\t\tplayitems = PlaylistMedia.find(params[:items])\n\t\t@playlist = Playlist.find(params[:playlist])\n\t\t\n\t\tPlaylistMedia.transaction do\n\t\t\tplayitems.each do |item|\n\t\t\t\tPlaylistMedia.create(item.attributes.merge({:playlist_id => @playlist.id, :id => nil, :published => false}))\n\t\t\tend\n\t\tend\n\t\t\n\t\trespond_with(@playlist) do |format|\n\t\t\tformat.js { render :action => 'update_playlist', :layout => false }\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to artist_album_song_url(@artist,@album,@song), notice: 'song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_songlist\n @songlist = Songlist.find(params[:id])\n end",
"def update\n redirect_to @song, alert: \"You can't edit that song.\" and return unless can?(:edit, @song)\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @pl = Playlist.new\n @songs = Song.all\n @music_categories = MusicCategory.all\n @category = @music_categories.first\n @music_plan = MusicPlan.where(music_category_id: @category.id).first\n @musics = Music.all\n if params[:plan].present?\n if params[:plan] == '1'\n @musics = Music.all\n else\n @category = MusicCategory.find(params[:plan])\n @music_plan = MusicPlan.where(music_category_id: @category.id).first\n @musics = Music.where(music_category_id: @category.id)\n end\n else\n @musics = Music.all\n end\n @musics = @musics.theme(params[:theme]) if params[:theme].present?\n @musics = @musics.style(params[:style]) if params[:style].present?\n @musics = @musics.mood(params[:mood]) if params[:mood].present?\n @musics = @musics.song_type(params[:song_type]) if params[:song_type].present?\n @musics = @musics.tempo(params[:tempo]) if params[:tempo].present?\n @musics = @musics.instrument(params[:instrument]) if params[:instrument].present?\n @musics = @musics.artist(params[:artist]) if params[:artist].present?\n @musics = @musics.title(params[:title]) if params[:title].present?\n @music_prices = MusicPlan.where(music_category_id: @category.id).order(:id)\n\n @trail_subscription = current_user.subscription\n if @trail_subscription\n @trail = @trail_subscription.music_subscription_id.present?\n end\n\n @current_plan = current_user.plan_billing\n @cmp = @current_plan.music_plan_id\n if @cmp.present?\n @mp = MusicPlan.find(@current_plan.music_plan_id)\n @current_category = @music_categories.find(@mp.music_category_id)\n end\n\n @playlists = current_user.playlists.all\n\n @no_of_songs = current_user.user_musics.all.count\n\n @current_user_subscription = current_user.subscription\n if @current_user_subscription.present?\n @subscription = @current_user_subscription.music_subscription_id.present?\n end\n end",
"def upload\n flash = if params[:song].present?\n params[:song].each { |song| SongUploader.new.store!(song) }\n list_all_files\n SongListBroadcastJob.perform_later(@files)\n { notice: \"#{params[:song].length} song(s) added successfully!\" }\n else\n { alert: \"Please select one or more songs to be uploaded!\" }\n end\n redirect_to root_path, flash\n end",
"def update\n respond_to do |format|\n if @user_follow_playlist.update(user_follow_playlist_params)\n format.html { redirect_to @user_follow_playlist, notice: 'User follow playlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_follow_playlist }\n else\n format.html { render :edit }\n format.json { render json: @user_follow_playlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_song_list\n @song_list_song = SongListSong.find(params[:id])\n end",
"def update\n @song = Song.find(params[:id])\n @song.name = params[:song][:name]\n if params[:song][:audio]\n @song.audio = params[:song][:audio]\n end\n respond_to do |format|\n if @song.save\n format.js\n format.html { redirect_to root_url }\n format.json { head :no_content }\n else\n format.js\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @song = Song.find(params[:id])\n thread = Thread.new{@song.update_attributes(params[:song]) && @song.song_upload.update_attributes(:file => params[:file])} \n respond_to do |format|\n if thread\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @persona = current_persona\n @upload_date_list = Photo.where(:persona_id => @persona.id).pluck(:created_at).map{|s| s.to_date }.uniq.reverse\n @mediaset = Mediaset.find(params[:id])\n @current_selection = @mediaset.photos\n\n current_order = 1\n if @current_selection.empty? then\n #empty mediaset, create new ones\n params[:photo].each do |photo|\n @mediaset.mediaset_photos.create(:photo_id => photo, :order => current_order)\n current_order += 1\n end\n else\n #reset ordering\n @mediaset.mediaset_photos.update_all('\"order\" = 0')\n\n #reset ordering, add new entries if not found in current list\n params[:photo].each do |photo_id|\n @current_photo = @mediaset.mediaset_photos.where(:photo_id => photo_id)\n if @current_photo.empty? then\n @mediaset.mediaset_photos.create(:photo_id => photo_id, :order => current_order)\n else\n @current_photo.first.update_attribute(:order, current_order)\n end\n current_order += 1\n end \n @mediaset.mediaset_photos.where(:order => 0).delete_all\n end\n\n respond_to do |format|\n if @mediaset.update_attributes(params[:mediaset])\n format.html { \n redirect_to view_sets_path(current_persona.screen_name, \n @mediaset), notice: 'Mediaset was successfully updated'\n }\n format.json { head :no_content }\n else\n format.html { \n flash[:notice] = \"Failed\"\n render action: \"edit\"\n }\n format.json { render json: @mediaset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n MediaCategory.update(params[:category].keys, params[:category].values)\n\n redirect_to admin_medias_path\n end",
"def update\n\n artist_id = update_artist_exist_or_new(params[:artist_name])\n\n album_id = update_album_exist_or_new(params[:album_name], params[:genre], artist_id)\n\n respond_to do |format|\n\n @song.album_id = album_id\n a = @song.album\n a.artist_id = artist_id\n a.save\n\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @playlist = Playlist.find(params[:id])\n\n respond_to do |format|\n if @playlist.update_attributes(params[:playlist])\n format.html { redirect_to(@playlist, :notice => 'Playlist was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @playlist.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_songs\n @mix = Mix.find(params[:mix_id])\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @base_song.update(base_song_params)\n format.html { redirect_to @base_song, notice: 'Base song was successfully updated.' }\n format.json { render :show, status: :ok, location: @base_song }\n else\n format.html { render :edit }\n format.json { render json: @base_song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@music = Music.find(params[:id])\n end",
"def set_playlist\n @playlists = Playlist.where(id: params[:id].to_i)\n\n if @playlists.empty? \n respond_to do |format|\n format.html { redirect_to user_path(current_user) }\n format.json {render json: {status: 404, :error => 'Unable to find a playlist with id: #{params[:id]}'} }\n end\n else\n @playlist = @playlists.first\n end\n\n end",
"def update\n if @playlist.update(playlist_params)\n render json: @playlist\n else\n render json: { error: @playlist.errors }, status: :unprocessable_entity\n end\n end",
"def add_multiple_videos\n\n @notice = \"\"\n @video_playlist = VideoPlaylist.find(params[:playlist_id])\n video_ids = params[:video_ids]\n\n video_ids.each do |video_id|\n @video_playlist_item_position = VideoPlaylistItem.where(\"video_playlist_id=?\", params[:playlist_id])\n .order(\"position ASC\")\n .find(:last)\n @video_playlist_item_position = @video_playlist_item_position.nil? ? 1 : @video_playlist_item_position.position + 1\n @video_playlist_item = VideoPlaylistItem.new(video_playlist_id: params[:playlist_id],\n video_id: video_id,\n position: @video_playlist_item_position)\n\n @video_to_add = Video.find(video_id)\n if @video_playlist_item.save\n flash[:notice] = 'Videos were successfully added.'\n session[:videos_search] = collection_to_id_array(@video_playlist.videos)\n end\n end # loop through video ids\n\n end",
"def add_song\n \t# add this song to the users personal list (history)\n new_song = Song.create(title: params[:title], video_id: params[:video_id], status: \"added to MusiQ!\")\n current_user.songs << new_song\n\n # add this song to the player queue (tracks)\n Track.create(title: params[:title], video_id: params[:video_id], user_id: current_user.id, status: 'waiting')\n redirect_to root_url\n end",
"def update\n @music =Music.find_by_sql(\"SELECT * FROM Musics M Where M.id = \" + params[:id]).first()\n\n respond_to do |format|\n if @music.update_attributes(params[:music])\n format.html { redirect_to \"/musics\", notice: 'Music was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @music.update(music_params)\n format.html { redirect_to @music, notice: 'Изменена запись о музыке.' }\n format.json { render :show, status: :ok, location: @music }\n else\n format.html { render :edit }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @playlist = Playlist.find(params[:id])\n\n respond_to do |format|\n if @playlist.update_attributes(params[:playlist])\n format.html { redirect_to playlists_path, notice: 'Playlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @playlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @service_song.update(service_song_params)\n format.html { redirect_to @service_song.service, notice: 'Service song was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_song }\n else\n format.html { render :edit }\n format.json { render json: @service_song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @song = Song.find_by(id: params[:id])\n if @song.update(song_params)\n \n render 'api/songs/show'\n else\n # debugger\n render json: @song.errors.full_messages, status: 401\n end\n end",
"def update\n @song = Song.find(params[:id])\n\n params[:song].each do |tag, value|\n if TagInfo::USEFULL_TAGS.include?(tag)#tag on file is a useful tag\n @song[tag] = value #update the useful tag in DB\n end\n end\n respond_to do |format|\n begin\n Song.transaction do #update both file and DB or neither\n @song.update_tags_on_file(params[:song])\n @song.save!\n end\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { head :ok }\n rescue Exception=>e\n format.html { render action: \"edit\" }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_medias(data)\n result = @client.api_request(\n :method => \"user.updatemedia\",\n :params => {\n :users => { :userid => data[:userid] },\n :medias => data[:medias],\n :output => \"extend\"\n }\n )\n result ? result['userids'][0].to_i : nil\n end",
"def update\n current_user.update(playlist_names: params[:playlists])\n render json: current_user\n end",
"def user_screams\n # Update the user for the current item he checks that he likes the item.\n # Return JSON with ok if the updation is done succesfully else return a error status to the user.\n if current_user\n Rails.logger.debug { \"The current loged in user is #{current_user.email}\" }\n audio = Audio.find(params[:id])\n current_user.screams << audio\n render nothing: true , status: 200\n else\n render nothing: true , status: 400\n end\n end",
"def update\n @playlist = Playlist.find(params[:id])\n\n if @playlist.update(playlist_params)\n head :no_content\n else\n render json: @playlist.errors, status: :unprocessable_entity\n end\n end",
"def update\n#require 'logger'\n\n\t\tparams = song_params\n\t\tsongkey = params['song_key']\n\t\tparams.delete('song_key')\n\n songtags = params['tags']\n params.delete('tags')\n\n\t\trespond_to do |format|\n\t\t\tif @song.update(params)\n\n\t\t\t\tif songkey.to_s.length > 0\n\t\t\t\t\t@song.song_keys = [SongKey.find(songkey)]\n\t\t\t\telse\n\t\t\t\t\t@song.song_keys.destroy_all\n\t\t\t\tend\n\n @song.tags.destroy_all\n\n if !songtags.nil?\n @tags = []\n for tagid in songtags\n @tags.push(Tag.find(tagid))\n end\n @song.tags = @tags\n end\n\n#\t\t\t\tformat.html { redirect_to songs_url, notice: \"#{@song.name} was successfully updated!\" }\n\t\t\t\tformat.html { redirect_to song_url, notice: \"#{@song.name} was successfully updated!\" }\n\t\t\t\tformat.json { render :show, status: :ok, location: @song }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @song.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @audio.update(audio_params)\n format.html { redirect_to @audio, notice: 'Categorie audio was successfully updated.' }\n format.json { render :show, status: :ok, location: @audio }\n else\n format.html { render :edit }\n format.json { render json: @audio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @playlist.update(get_params)\n format.html { redirect_to @playlist, notice: 'Playlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @playlist }\n else\n format.html { render :edit }\n format.json { render json: @playlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @music.update(music_params)\n format.html { redirect_to @music, notice: 'Song was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\nend",
"def set_playlist\n @playlist = Playlist.find(params[:playlist_id])\n end",
"def update\n @video = Video.find(params[:id])\n respond_to do |format|\n if @video.update_attributes(params_video)\n flash[:notice] = ts('edit.successful', :what => Video.model_name.human.capitalize)\n format.html { redirect_to medium_url(@video) }\n format.xml { head :ok }\n else\n format.html do\n @capture_device_models = CaptureDeviceMaker.order('title').collect{|maker| maker.capture_device_models}.flatten\n @photographers = AuthenticatedSystem::Person.order('fullname')\n @quality_types = QualityType.order('id')\n @recording_orientations = RecordingOrientation.order('title') \n @resource_types = Topic.find(2687).children \n render :action => 'media/edit'\n end\n format.xml { render :xml => @video.errors.to_xml }\n end\n end\n end",
"def update\n @tags_songs = TagsSongs.find(params[:id])\n\n respond_to do |format|\n if @tags_songs.update_attributes(params[:tags_songs])\n flash[:notice] = 'TagsSongs was successfully updated.'\n format.html { redirect_to(@tags_songs) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tags_songs.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_playlist_song\n @playlist_song = PlaylistSong.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @top_music.update(top_music_params)\n format.html { redirect_to @top_music, notice: 'Top music was successfully updated.' }\n format.json { render :show, status: :ok, location: @top_music }\n else\n format.html { render :edit }\n format.json { render json: @top_music.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@song.genre_id = params[:genre_id]\n if @song.update(song_params)\n redirect_to song_path(@song)\n else\n render 'edit'\n end\n end",
"def update\n @song = Song.find(params[:id])\n respond_to do |format|\n if @song.update(song_params)\n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @user=current_user\n @playlist = Playlist.find(params[:id])\n @userId = Playlist.userId params[:id]\n @musicsPlaylists = MusicPlaylist.allMusic params[:id]\n end",
"def update\n respond_to do |format|\n if @youtube_playlist.update(youtube_playlist_params)\n format.html { redirect_to @youtube_playlist, notice: 'Youtube playlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @youtube_playlist }\n else\n format.html { render :edit }\n format.json { render json: @youtube_playlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @media_item.update(media_item_params)\n format.html { redirect_to media_item_path(@media_item), notice: t('media_items.was_updated') }\n format.json { render :show, status: :ok, location: @media_item }\n else\n format.html { render :edit }\n format.json { render json: @media_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @music.update(music_params)\n redirect_to musics_path\n else\n render :edit\n end\n end",
"def update_mp3_files(settings)\n songs.each do |song|\n song.update_file(settings)\n end\n end",
"def touch\n playlist = self.class.first(\n :readonly => false,\n :conditions => {:user_id => user.id, :url_spotify => self.class.url_to_url_spotify(url)})\n return unless playlist\n playlist.updated_at = DateTime.now\n playlist.save\n end"
] |
[
"0.6968963",
"0.6918466",
"0.6864413",
"0.67567044",
"0.6695875",
"0.6656355",
"0.6644359",
"0.6636006",
"0.6626034",
"0.66091925",
"0.65767044",
"0.65570587",
"0.65552163",
"0.6513207",
"0.64864624",
"0.6485873",
"0.64698684",
"0.64669",
"0.64482707",
"0.6446513",
"0.6426641",
"0.64257306",
"0.64163893",
"0.64108443",
"0.6407815",
"0.6391939",
"0.6383458",
"0.6360533",
"0.6355744",
"0.63398635",
"0.6335613",
"0.633045",
"0.63283795",
"0.63191277",
"0.631456",
"0.6309045",
"0.6308528",
"0.6300547",
"0.628903",
"0.6272547",
"0.6272547",
"0.6272547",
"0.6272547",
"0.6272547",
"0.6272547",
"0.6272547",
"0.6272547",
"0.6265825",
"0.6260725",
"0.62558585",
"0.62429667",
"0.6227516",
"0.6212247",
"0.62085897",
"0.6191885",
"0.6184811",
"0.6178271",
"0.6172135",
"0.61594397",
"0.61561304",
"0.61295784",
"0.61249155",
"0.6116766",
"0.6116669",
"0.6115962",
"0.6115962",
"0.6115962",
"0.61113906",
"0.6104542",
"0.60997343",
"0.6093408",
"0.6091834",
"0.60901177",
"0.6086884",
"0.6080832",
"0.60808164",
"0.6070176",
"0.6069402",
"0.6064351",
"0.6064065",
"0.6060112",
"0.6053916",
"0.60494256",
"0.6047247",
"0.6043398",
"0.6042046",
"0.60403574",
"0.60295296",
"0.60256183",
"0.602414",
"0.6016768",
"0.6013711",
"0.600789",
"0.59985256",
"0.5998255",
"0.5996908",
"0.5987809",
"0.59808844",
"0.59699804",
"0.5969873",
"0.59685224"
] |
0.0
|
-1
|
Expand include_path to actual path with recursive_include If recursive_include is true, files in subdir would be included.
|
def load_file_path!
@files = FilepathScanner.call(
include_paths,
exclude_path_regexps,
recursive_scan: recursive_include
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def include\n File.join(@root, 'include')\n end",
"def add_include(path)\n @includes << path\n end",
"def add_include(path)\n @includes << path\n end",
"def add_include include\n add_to @includes, include\n\n include\n end",
"def include_path\n @include_paths.map { |p| \"-I#{ p }\" }.join( \" \" )\n end",
"def includes(*paths)\n self.included_files.concat(expand_globs(paths))\n end",
"def prepend_include_path(path)\n $LOAD_PATH.unshift(path)\nend",
"def add_include(include)\n add_to @includes, include\n end",
"def add_includes out, includes\n add_extension_modules out, 'Includes', includes\n end",
"def addIncludeDirs(incdirs)\n\t\t@INCDIRS += ensureArray(incdirs).map {|p| Pathname.new(p)}\n\tend",
"def add_include(include)\n @includes << include\n end",
"def include_directory(dir)\n files = []\n \n if defined? @@directory\n # \n # Do we have an absolute path?\n #\n dir = File.join(@@directory, dir) if '/' != dir[0,1]\n end\n \n #\n # Resolve the filename.\n #\n dir = File.expand_path(dir)\n\n #\n # Exceptions are caught by #include_file\n #\n Dir.glob(dir).sort.each do |entry|\n #file = File.join(dir,entry)\n #pp file\n #next unless File.file?(file)\n\n self.include(entry)\n end\n\n self\n end",
"def find_includes include_dirs, src\r\n includes = Rake::CParser.parse_file_includes src\r\n res = includes.collect { |inc|\r\n search_includes include_dirs, src, inc\r\n }\r\n res.compact\r\n end",
"def include_from(path)\n mod = import(path, caller(1..1).first)\n add_module_methods(mod, self)\n add_module_constants(mod, self)\n end",
"def include(*files)\n @include += files.flatten\n self\n end",
"def expand_path(path, root=opts[:root])\n ::File.expand_path(path, root)\n end",
"def expand_path(path, root=opts[:root])\n ::File.expand_path(path, root)\n end",
"def includes\n @mpc_project.recipe.get_relative_paths(@mpc_project.includes)\n end",
"def copy_include_files\n include_directory = Pathname.new(@env[\"package.directory\"]).join(\"include\")\n\n @env[\"package.files\"].each do |from, dest|\n # We place the file in the include directory\n to = include_directory.join(dest)\n\n @env[:ui].info I18n.t(\"vagrant.actions.general.package.packaging\", :file => from)\n FileUtils.mkdir_p(to.parent)\n\n # Copy direcotry contents recursively.\n if File.directory?(from)\n FileUtils.cp_r(Dir.glob(from), to.parent, :preserve => true)\n else\n FileUtils.cp(from, to, :preserve => true)\n end\n end\n end",
"def include(*args)\n include_or_extend(:include, *args)\n end",
"def do_xinclude(options = T.unsafe(nil)); end",
"def do_xinclude(options = T.unsafe(nil)); end",
"def expand_path(path)\n load_path.each do |dir|\n test_path = File.expand_path(File.join(dir, path))\n FILE_EXTS.each do |ext|\n full_path = test_path + ext\n return full_path if File.file?(full_path)\n end\n end\n nil\n end",
"def includes(*args)\n @options[:include] ||= []\n @options[:include] |= args\n end",
"def expand_path path\n path_segments, path_root = partition_path path\n if path.include? DOT_DOT\n resolved_segments = []\n path_segments.each do |segment|\n segment == DOT_DOT ? resolved_segments.pop : resolved_segments << segment\n end\n join_path resolved_segments, path_root\n else\n join_path path_segments, path_root\n end\n end",
"def do_includes\n @content.scan(/rb_include_module\\s*\\(\\s*(\\w+?),\\s*(\\w+?)\\s*\\)/) do |c,m|\n next unless cls = @classes[c]\n m = @known_classes[m] || m\n\n comment = new_comment '', @top_level, :c\n incl = cls.add_include RDoc::Include.new(m, comment)\n incl.record_location @top_level\n end\n end",
"def check_include_file(file_path)\n can_be_included = File.exists? file_path\n\n if not ENV['ORG_RUBY_INCLUDE_ROOT'].nil?\n # Ensure we have full paths\n root_path = File.expand_path ENV['ORG_RUBY_INCLUDE_ROOT']\n file_path = File.expand_path file_path\n\n # Check if file is in the defined root path and really exists\n if file_path.slice(0, root_path.length) != root_path\n can_be_included = false\n end\n end\n\n can_be_included\n end",
"def includes(*paths)\n @includes.concat(paths) unless paths.empty?\n @includes\n end",
"def include( *modules )\n \n super if defined?( super )\n original_include( *modules )\n \n end",
"def include(path)\n path = resolve_path(path)\n\n return if @files_included.include?(path)\n @files_included << path\n\n @env.logger.info \"- interpreting: #{path}\"\n\n file_contents = File.open(path) { |f| f.read }\n file_iseq = ::RubyVM::InstructionSequence.compile(file_contents)\n\n @interpreter.process_iseq(file_iseq.to_a, path)\n end",
"def include(arg)\n Object.module_eval \"include #{arg}\"\n end",
"def process_include(inc_fidl, idl_scanner)\n # skip analyzing IDL file if already analyzed or not part of project\n return unless inc_fidl.is_member?\n\n # scan IDL files, register includes and other properties\n # and recursively scan includes\n idl_scanner.scan_idl_file(inc_fidl) unless inc_fidl.has_been_scanned?\n\n # now recursively process any included IDL files found if not registered yet\n inc_fidl.includes.each do |ifidl|\n process_include(ifidl, idl_scanner)\n end\n end",
"def ancestors(reload=false, include_node = false)\n return nil if is_root? || self.id_path.blank?\n @ancestors = self.class.find(:all, :conditions => \"id in (#{self.id_path}) and id <> #{self.id}\", :order => \"level asc\") if @ancestors.nil? || reload\n include_node ? @ancestors << self : @ancestors \n end",
"def include(header)\n @inc << \"#include #{header}\"\n end",
"def header_include_paths\n cmd = RbConfig::MAKEFILE_CONFIG[\"CC\"]\n args = %w{-Wp,-v -xc /dev/null -fsyntax-only}\n paths = []\n reading_paths = false\n run_command(cmd, *args) do |line|\n line.chomp!\n if reading_paths\n if line == 'End of search list.'\n reading_paths = false\n elsif line.match(/\\A /)\n line.strip!\n line.sub!(/\\s+\\(framework directory\\)\\Z/, '')\n paths << line\n end\n elsif line == '#include <...> search starts here:'\n reading_paths = true\n end\n end\n paths\nend",
"def included\n return [] if directory.empty? || directory == '*'\n @included ||= process_globs(@raw_data['include'])\n end",
"def expanded\n raise \"You need to set a path root\" unless @root.path\n result = []\n\n each do |path|\n path = File.expand_path(path, @root.path)\n\n if @glob && File.directory?(path)\n result.concat files_in(path)\n else\n result << path\n end\n end\n\n result.uniq!\n result\n end",
"def include inc\n @includes << inc\n end",
"def each_include # :yields: include\n @includes.each do |i| yield i end\n end",
"def each_include # :yields: include\n @includes.each do |i| yield i end\n end",
"def expand_path(path)\n File.expand_path(\"../#{path.to_s}\", __FILE__)\n end",
"def do_xinclude(options = XML::ParseOptions::DEFAULT_XML)\n options = Nokogiri::XML::ParseOptions.new(options) if Integer === options\n\n # give options to user\n yield options if block_given?\n\n # call c extension\n process_xincludes(options.to_i)\n end",
"def expand(*args)\r\n File.expand_path(*args)\r\n end",
"def include(*args)\n include_private(*args)\n end",
"def get_included(file)\n included = []\n\n @include_path.each do |dir|\n file_name = File.join dir, file\n\n if File.exist? file_name then\n included = IO.readlines file_name\n break\n end\n end\n\n included\nend",
"def use_shared_path\n include_str = '#include \"'\n include_re = Regexp.new \"^#{include_str}(.*)\"\n @lines.each_with_index do |l, i|\n if l =~ include_re\n @lines[i] = include_str + shared_file($1)\n end\n end\n\n find_by_name('network_node', 1).nested.each do |obj|\n obj[:file] = shared_file(obj[:file]) if obj[:file]\n end\n end",
"def add_include(include)\n object_class.record_location self\n return include unless @document_self\n object_class.add_include include\n end",
"def redo_include_and_extend\n reinclude + reextend\n end",
"def transform_path(path_to_transform)\n cur_path = Pathname.new(storage_config.relative_paths_root)\n include_path = Pathname.new(path).dirname\n include_path.relative_path_from(cur_path).join(path_to_transform).to_s\n end",
"def include_load_paths(load_paths)\n load_paths.each do |load_path|\n expanded_load_path = File.expand_path(load_path)\n\n unless $LOAD_PATH.include? expanded_load_path\n $LOAD_PATH.unshift expanded_load_path\n end\n end\n end",
"def include_strategy\n :includes\n end",
"def locate_include_file(context, file, safe)\n includes_dirs = ['_templates','_templates/liquid','_templates/liquid/ops','_templates/ops','theme/_includes','theme/_layouts']\n includes_dirs.each do |dir|\n path = File.join(dir.to_s, file.to_s)\n return path if File.exist?(path)\n end\n raise IOError, could_not_locate_message(file, includes_dirs, safe)\n end",
"def change_include_possible(include,user)\n\t\t\n \tend",
"def include_extensions\n @included_extensions ||= include_extensions!\n end",
"def expand_path(path)\n path = path.to_s.gsub(/~(\\w+)?/) { |m| homedir($1) }\n File.expand_path(path, cwd.to_s)\n end",
"def add_includes out, includes\n return if includes.empty?\n out << RDoc::Markup::Rule.new(1)\n out << RDoc::Markup::Heading.new(1, \"Includes:\")\n includes.each do |modules, store|\n if modules.length == 1 then\n include = modules.first\n name = include.name\n path = store.friendly_path\n out << RDoc::Markup::Paragraph.new(\"#{name} (from #{path})\")\n if include.comment then\n out << RDoc::Markup::BlankLine.new\n out << include.comment\n end\n else\n out << RDoc::Markup::Paragraph.new(\"(from #{store.friendly_path})\")\n wout, with = modules.partition { |incl| incl.comment.empty? }\n out << RDoc::Markup::BlankLine.new unless with.empty?\n with.each do |incl|\n out << RDoc::Markup::Paragraph.new(incl.name)\n out << RDoc::Markup::BlankLine.new\n out << incl.comment\n end\n unless wout.empty? then\n verb = RDoc::Markup::Verbatim.new\n wout.each do |incl|\n verb.push incl.name, \"\\n\"\n end\n out << verb\n end\n end\n end\n end",
"def translate_glob iss_glob\n raise \"Can't expand path #{iss_glob}\" if iss_glob.include?('**')\n prefix = flags.include?('recursesubdirs') ? \"**/\" : \"\"\n \"#{prefix}#{iss_glob}\"\n end",
"def expand_all path\n real_path = VirtualLayer.realpath(path)\n elems = real_path.split('/'); elems.shift # throw away the first element which is empty for a FQ pathname\n if path[-1] == '/'\n filt_fn = ->(p) { VirtualLayer.directory?(p) }\n else\n filt_fn = ->(p) { p }\n end\n result = rejoin(walk_globs(elems)).flatten.select(&filt_fn).sort\n\n if path[0] == '/'\n result\n else\n cwd = VirtualLayer.pwd\n result.map {|p| p[(cwd.length+1)..] }\n end\nend",
"def includes_file filename\n Waitress::Chef.include_absfile filename\n end",
"def prepend_path(path)\n mutate_config(:paths) do |paths|\n path = File.expand_path(path, root).dup.freeze\n paths.unshift(path)\n end\n end",
"def include(*files)\n fail \"AchiveTask.include() called with nil values\" if files.include? nil\n @paths[''].include *files if files.compact.size > 0\n self\n end",
"def k8s_include(path)\n ERB.new(File.read(Pathname(@_curr_file).dirname + (path + '.yml'))).result(binding)\n end",
"def includes filename\n Waitress::Chef.include_file filename\n end",
"def expand(file, context)\n root = context.registers[:site].source\n if file =~ /^\\.\\/(.+)/\n local_dir = File.dirname context.registers[:page]['path']\n File.join root, local_dir, $1\n elsif file =~ /^[\\/~]/\n Pathname.new(file).expand_path\n else\n File.join root, file\n end\n end",
"def path_prepend(path)\n path_set([File.expand_path(path)] + path_components)\n end",
"def do_includes\n @body.scan(/rb_include_module\\s*\\(\\s*(\\w+?),\\s*(\\w+?)\\s*\\)/) do |c,m|\n if cls = @classes[c]\n m = @known_classes[m] || m\n cls.add_include(Include.new(m, \"\"))\n end\n end\n end",
"def update include_dirs, source\r\n if not @source_files.include? source\r\n @source_files << source\r\n end\r\n update_depends include_dirs, source\r\n end",
"def uninclude(mod, recurse = false) end",
"def include(template_file_path, markdown_file_path)\n send(:generate_file, template_file_path, markdown_file_path, __method__) do |input_lines, output_lines|\n send(:include_files, template_file_path, input_lines, output_lines, Inclusions.new)\n end\n end",
"def add_default_includes!(options)\r\n return if options[:include] or default_includes.blank?\r\n options[:include] = default_includes\r\n end",
"def prepend_path(path)\n @paths.unshift(File.expand_path(path, root))\n end",
"def ready\n includes = @options.includes\n unless Array === includes\n error \"Invalid value for @options.includes: #{includes.inspect}\"\n end\n includes.each do |dir|\n $:.unshift dir\n end\n end",
"def include; end",
"def include; end",
"def insert_includes\n # match all variables, every variable begins with an at (@).\n # variables can also end with a semicolon to have a safe declaration.\n @output = @output.gsub(/\\<(.+)\\>/) {\n match = Regexp.last_match[1]\n match.prepend('/') unless match.start_with?('/')\n IO.read(\"#{PATHS[:template_dir]}#{match}\")\n }\n end",
"def prepend_load_path(sub_dirs)\n priority = sub_dirs.reverse\n priority.each do |sub_dir|\n path = File.expand_path(File.join(File.dirname(__FILE__), sub_dir))\n #puts path\n $LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)\n end\nend",
"def set_include_statement\n super\n end",
"def include(*i)\n @includes |= i.flatten\n end",
"def load_subtemplate( path )\n\t\t\tif self.include_stack.include?( path )\n\t\t\t\tstack_desc = ( self.include_stack + [path] ).join( ' --> ' )\n\t\t\t\tmsg = \"Recursive load of %p detected: from %s\" % [ path, stack_desc ]\n\n\t\t\t\tself.log.error( msg )\n\t\t\t\traise Inversion::StackError, msg\n\t\t\tend\n\n\t\t\t# self.log.debug \"Include stack is: %p\" % [ self.include_stack ]\n\n\t\t\tsubstate = self.dup\n\t\t\tsubstate.clear_nodes\n\t\t\tsubstate.include_stack.push( path )\n\n\t\t\treturn Inversion::Template.load( path, substate, self.options )\n\t\tend",
"def set_Include(value)\n set_input(\"Include\", value)\n end",
"def set_Include(value)\n set_input(\"Include\", value)\n end",
"def set_Include(value)\n set_input(\"Include\", value)\n end",
"def expand_magic_path(aPath, aBasePath=nil)\n\t\t\t\taBasePath ||= Dir.pwd\n\t\t\t\tpath = aPath\n\t\t\t\tif path.begins_with?('...')\n\t\t\t\t\trel_part = path.split3(/\\.\\.\\.[\\/\\\\]/)[2]\n\t\t\t\t\tpath = find_upwards(aBasePath, rel_part)\n\t\t\t\tend\n\t\t\tend",
"def expand_path(path)\n if Rscons.phony_target?(path)\n path\n elsif path.is_a?(Array)\n path.map do |path|\n expand_path(path)\n end\n else\n path.sub(%r{^\\^\\^(?=[\\\\/])}, Rscons.application.build_dir).sub(%r{^\\^(?=[\\\\/])}, @build_root).gsub(\"\\\\\", \"/\")\n end\n end",
"def ___set_includes\n ___upd_valid\n each_value do |item|\n next unless (ary = item.delete(:include))\n ary.each do |ref|\n item.get(:group) { Hashx.new }.update(self[ref][:group])\n end\n end\n end",
"def include_partial(relative_path)\n return if @partial_templates.key?(relative_path)\n\n @partial_templates[relative_path] = nil\n render(Pathname.new(\"#{@script_path}/#{relative_path}\"))\n end",
"def expand(path)\n File.expand_path(path, working_dir).to_s\n end",
"def generate_includes(path_string)\n files = path_string_to_files(path_string)\n if !files.empty?\n paths = Container.new(*files).required_files(self.class.settings[:includes_root])\n respond_with(Jsus::Util::CodeGenerator.generate_includes(paths))\n else\n not_found!\n end\n end",
"def link_include_file(file); end",
"def link_include_file(file); end",
"def add_includes(inc)\r\n return if inc.nil?\r\n \r\n inc = [inc] if (!inc.respond_to?(:each) || inc.kind_of?(String))\r\n \r\n if inc.include?(:all)\r\n ole_methods.each do |m|\r\n m = m.to_s\r\n if m =~ /\\AInclude/ && m != 'IncludeRetElementList'\r\n @request.__send__(\"#{m.underscore}=\", true)\r\n end\r\n end\r\n return\r\n end\r\n \r\n inc.each do |item|\r\n cam_item = item.to_s.camelize.gsub(/Id/, \"ID\")\r\n if @request.respond_to_ole?(\"Include#{cam_item}\")\r\n @request.__send__(\"include_#{item}=\", true)\r\n else\r\n @request.IncludeRetElementList.Add(cam_item)\r\n end\r\n end\r\n end",
"def expand_path(path)\n File.expand_path(\n path.gsub(\n 'CLIPPDIR', CLIPPDIR\n ).gsub(\n 'BUILDDIR', BUILDDIR\n )\n )\n end",
"def include_file(spec)\n elements << Raw.new(\" Include '#{spec}'\")\n end",
"def expand_path path\n dir = File.dirname path\n full_dir = call \"cd #{dir} && pwd\"\n File.join full_dir, File.basename(path)\n end",
"def update_loadpath\n project_directory = File.expand_path( \"../..\", __FILE__ ) # filepath, minus filename and lib directory\n child_directories = find_all_directories( project_directory )\n $LOAD_PATH.unshift( child_diretories )\n $LOAD_PATH.unshift( project_directory )\n $LOAD_PATH.flatten!\nend",
"def expand_path file_name\n @defaults[ :root_dir ] ||= Dir.pwd\n \n if file_name.kind_of? Array \n file_name.collect { |f| File.expand_path f, @defaults[ :root_dir ] }\n else \n File.expand_path file_name, @defaults[ :root_dir ]\n end\n end",
"def included_files; end",
"def include(*args)\n options = Hash === args.last ? args.pop : nil\n files = to_artifacts(args)\n raise 'AchiveTask.include() values should not include nil' if files.include? nil\n\n if options.nil? || options.empty?\n @includes.include *files.flatten\n elsif options[:path]\n sans_path = options.reject { |k,v| k == :path }\n path(options[:path]).include *files + [sans_path]\n elsif options[:as]\n raise 'You can only use the :as option in combination with the :path option' unless options.size == 1\n raise 'You can only use one file with the :as option' unless files.size == 1\n include_as files.first.to_s, options[:as]\n elsif options[:from]\n raise 'You can only use the :from option in combination with the :path option' unless options.size == 1\n raise 'You cannot use the :from option with file names' unless files.empty?\n fail 'AchiveTask.include() :from value should not be nil' if [options[:from]].flatten.include? nil\n [options[:from]].flatten.each { |path| include_as path.to_s, '.' }\n elsif options[:merge]\n raise 'You can only use the :merge option in combination with the :path option' unless options.size == 1\n files.each { |file| merge file }\n else\n raise \"Unrecognized option #{options.keys.join(', ')}\"\n end\n self\n end",
"def eager_includes(include_referenced: true, vm_path: [])\n association_specs = {}\n\n return nil if vm_path.count(self) > 2\n\n child_path = vm_path + [self]\n _members.each do |assoc_name, association_data|\n next unless association_data.is_a?(AssociationData)\n next if association_data.external?\n\n case\n when association_data.through?\n viewmodel = association_data.direct_viewmodel\n children = viewmodel.eager_includes(include_referenced: include_referenced, vm_path: child_path)\n\n when !include_referenced && association_data.referenced?\n children = nil # Load up to the root viewmodel, but no further\n\n when association_data.polymorphic?\n children_by_klass = {}\n association_data.viewmodel_classes.each do |vm_class|\n klass = vm_class.model_class.name\n children_by_klass[klass] = vm_class.eager_includes(include_referenced: include_referenced, vm_path: child_path)\n end\n children = DeepPreloader::PolymorphicSpec.new(children_by_klass)\n\n else\n viewmodel = association_data.viewmodel_class\n children = viewmodel.eager_includes(include_referenced: include_referenced, vm_path: child_path)\n end\n\n association_specs[association_data.direct_reflection.name.to_s] = children\n end\n DeepPreloader::Spec.new(association_specs)\n end",
"def expand_path(subpath)\n if subpath[0] == ALT_SEPARATOR\n result = []\n else\n result = pwd.dup\n end\n\n if subpath.include?(ALT_SEPARATOR) || subpath =~ NAVIGATION\n # filesystem-like subpath\n # apply Unix-style directory navigation shortcuts\n # ge rid of successive //// and other oddities\n pieces = subpath.split(ALT_SEPARATOR).select { |p| !p.nil? && !p.empty? }\n pieces.each do |piece|\n case piece\n when '..' then result.pop\n when '.' then nil\n else result.push(piece)\n end\n end\n\n CMDB.join(result)\n else\n # standard dotted notation\n # get rid of successive .... and other oddities\n pieces = CMDB.split(subpath).select { |p| !p.nil? && !p.empty? }\n result += pieces\n end\n\n CMDB.join(result)\n end"
] |
[
"0.6387776",
"0.6252814",
"0.6252814",
"0.5995808",
"0.58833057",
"0.58222693",
"0.5713803",
"0.57063824",
"0.55212444",
"0.5461311",
"0.54587555",
"0.5425509",
"0.534797",
"0.53277665",
"0.5291778",
"0.52727497",
"0.52727497",
"0.5233622",
"0.5159083",
"0.51562554",
"0.5069252",
"0.5069252",
"0.50526345",
"0.5051989",
"0.5033544",
"0.5033148",
"0.50303435",
"0.5025502",
"0.5020435",
"0.5016881",
"0.49950296",
"0.49688843",
"0.4962418",
"0.49608293",
"0.49569646",
"0.4955348",
"0.49439368",
"0.49405357",
"0.49310288",
"0.49310288",
"0.49202314",
"0.49067107",
"0.48830196",
"0.48766577",
"0.48763973",
"0.48705864",
"0.48562586",
"0.48528394",
"0.48089302",
"0.4795625",
"0.47922146",
"0.47899562",
"0.47753632",
"0.47726825",
"0.47620443",
"0.47516194",
"0.47485468",
"0.473566",
"0.47273302",
"0.47221428",
"0.47197938",
"0.47131458",
"0.47086725",
"0.4707118",
"0.47020707",
"0.46998984",
"0.4699353",
"0.46976373",
"0.46969277",
"0.46856079",
"0.46789175",
"0.46682084",
"0.46635237",
"0.46635237",
"0.46501744",
"0.4644829",
"0.46370026",
"0.4630748",
"0.4615684",
"0.4601209",
"0.4601209",
"0.4601209",
"0.4592507",
"0.45919263",
"0.45909536",
"0.45881394",
"0.45813265",
"0.4581123",
"0.4575792",
"0.4575792",
"0.4565827",
"0.45630795",
"0.4559063",
"0.45580223",
"0.4556439",
"0.45558622",
"0.45540413",
"0.4543944",
"0.45384327",
"0.45375282"
] |
0.5449057
|
11
|
Update the tower state. Called once per frame.
|
def update event
@image.fill :white
enemy_in_range?
attack! unless @target.nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n update_flow\n update_sprites\n update_weather\n update_timer\n update_viewports\n @brightness -= 15 if @brightness > 0\n end",
"def update_state\r\n case @state\r\n when STATE_PICK\r\n @ip1.copy! @ip\r\n Sketchup::set_status_text \"[WALL] Click for end of wall\"\r\n Sketchup::set_status_text \"Length\", SB_VCB_LABEL\r\n Sketchup::set_status_text \"\", SB_VCB_VALUE\r\n @state = STATE_PICK_NEXT\r\n\twhen STATE_PICK_NEXT\r\n\t\tself.draw_wall\r\n\t\treset\r\n end\r\nend",
"def warmer_state=(warmer_state); end",
"def update\n state.fire_events_for_mouse_movement\n state.fire_events_for_held_buttons\n scene.base_update\n end",
"def update\n if $game_system.battle_interpreter.running?\n $game_system.battle_interpreter.update\n if $game_temp.forcing_battler == nil\n unless $game_system.battle_interpreter.running?\n unless judge\n setup_battle_event\n end\n end\n if @phase != 5\n @status_window.refresh\n end\n end\n end\n $game_system.update\n $game_screen.update\n if $game_system.timer_working and $game_system.timer == 0\n $game_temp.battle_abort = true\n end\n @help_window.update\n @party_command_window.update\n @actor_command_window.update\n @status_window.update\n @message_window.update\n @spriteset.update\n if $game_temp.transition_processing\n $game_temp.transition_processing = false\n if $game_temp.transition_name == \"\"\n Graphics.transition(20)\n else\n Graphics.transition(40, \"Graphics/Transitions/\" +\n $game_temp.transition_name)\n end\n end\n if $game_temp.message_window_showing\n return\n end\n if @spriteset.effect?\n return\n end\n if $game_temp.gameover\n $scene = Scene_Gameover.new\n return\n end\n if $game_temp.to_title\n $scene = Scene_Title.new\n return\n end\n if $game_temp.battle_abort\n $game_system.bgm_play($game_temp.map_bgm)\n battle_end(1)\n return\n end\n if @wait_count > 0\n @wait_count -= 1\n return\n end\n\n # this one holds the battle while the player moves\n for actor in @spriteset.actor_sprites\n if actor.moving\n if $FOG == \"on\"\n if $FOG_E or $FOG_A\n if actor.y >= 200\n actor.bush_depth = 12\n else\n actor.bush_depth = 0\n end\n end\n end\n return\n end\n if $FOG == \"on\"\n if $FOG_E or $FOG_A\n if actor.y >= 200\n actor.bush_depth = 24\n else\n actor.bush_depth = 0\n end\n end\n end\n end\n # and this one is for the enemy... \n for enemy in @spriteset.enemy_sprites\n if enemy.moving# and $game_system.animated_enemy\n if $FOG == \"on\"\n if $FOG_E or $FOG_A\n if enemy.y >= 200\n enemy.bush_depth = 24\n else\n enemy.bush_depth = 0\n end\n end\n end\n return\n end\n if $FOG == \"on\"\n if $FOG_E or $FOG_A\n if enemy.y >= 200\n enemy.bush_depth = 12\n else\n enemy.bush_depth = 0\n end\n end\n end\n end\n \n if $game_temp.forcing_battler == nil and\n $game_system.battle_interpreter.running?\n return\n end\n case @phase\n when 1\n update_phase1\n when 2\n update_phase2\n when 3\n update_phase3\n when 4\n update_phase4\n when 5\n update_phase5\n end\n end",
"def update\n super\n @layers.each { |layer| layer.update }\n update_move\n self\n end",
"def update\n colourable_update\n movable_update\n end",
"def update\n\t\tif @swimming\n\t\t\tcurr_time = Gosu::milliseconds\n\t\t\tif (curr_time - @prev_time).abs > @animation_update_interval\n\t\t\t\tincrement_swim_tile_index\n\t\t\t\t@prev_time = curr_time\n\t\t\t\t@@swim_sound.play\n\t\t\tend\n\t\telsif face_left?\n\t\t\t@tile_idx = 0\n\t\telse\n\t\t\t@tile_idx = 3\n\t\tend\n\n\t\tmove_party_horn\n\t\t@party_horn.update\n\tend",
"def update\n \t@currentState.update\n\tend",
"def update_world\n update_fish\n update_eggs\n update_food\n update_bubbles\n end",
"def update\n @player = @player.get_state\n self.run\n self\n end",
"def update\n @ship.update\n @needs_redraw ||= @ship.needs_redraw?\n end",
"def update\n\t\tif @player_moved\n\t\t\t@prawn.swimming = true\n\t\telse\n\t\t\tdrift \n\t\t\t@prawn.swimming = false\n\t\tend\n\n\t\tif !@moved_y_axis && !is_plane\n\t\t\tstabilise\n\t\t\t@has_moved = true\n\t\tend\n\n\t\tcheck_bounds\n\n\t\t@prawn.update\n\t\t@player_moved = @moved_y_axis = false\n\tend",
"def refresh_states(force = false)\n if force or @actor != @states_act or @actor.states != @states\n @states_act = @actor\n x = 0\n y = self.contents.height-24\n @states = @actor.states.clone\n draw_states(x,y,@states, [])\n end\n end",
"def update\r\n super if @_animation || @_loop_animation\r\n # Check if the graphic info where updated\r\n update_graphics if @character_name != @character.character_name || @tile_id != @character.tile_id\r\n\r\n return unless update_position\r\n\r\n update_pattern if @tile_id == 0\r\n\r\n self.bush_depth = @character.bush_depth\r\n self.opacity = (@character.transparent ? 0 : @character.opacity)\r\n\r\n update_load_animation if @character.animation_id != 0\r\n update_bush_depth if @bush_depth > 0\r\n update_shadow if @shadow\r\n end",
"def update_state\n raise \"Nothing to do\"\n end",
"def update_weather\r\n # Update weather graphic\r\n @weather.type = $game_screen.weather_type\r\n @weather.max = $game_screen.weather_max\r\n @weather.update\r\n end",
"def update\n syn_map_update\n if Input.dir4 == 0\n wait(1, false) if StandWalkRun::Use_idle_sprite\n call_idle($game_player.character_name + StandWalkRun::Idle_sprite_suffix, StandWalkRun::Use_anime) if @wait_time == StandWalkRun::Idle_time\n $game_temp.syn_state = \"idle\"\n restore_run if StandWalkRun::Use_run\n else\n $game_temp.syn_state = \"\"\n restore_run if StandWalkRun::Restore_run_while_walking\n call_idle($game_player.old_character_name, false) if $game_player.character_name != $game_player.old_character_name\n @wait_time = 0\n end\n if $game_temp.sprite_changed == true\n $game_player.old_character_name = $game_player.character_name\n $game_temp.sprite_changed = false\n end\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_frame\n # If animation frame is different, change graphic\n if @unit.frame != Graphics.frame_count % 60 / 15\n @unit.frame = Graphics.frame_count % 60 / 15\n end\n #Update the flag graphic\n # Is $viewing ranges necessary?#\n unless @is_moving or @unit.selected\n @flag.moveto(@unit.x, @unit.y)\n @flag.update\n @health.moveto(@unit.x, @unit.y)\n @health.update\n else\n @flag.bitmap = nil\n @health.bitmap = nil\n end\n \n end",
"def update\n # update_move\n # update_tone_change\n update_rotate\n end",
"def update_tsbs_battler_references\n self.visible = @battler.visible\n self.mirror = @battler.battler_flip\n self.tone.set(@battler.state_tone)\n self.angle = @battler.angle\n end",
"def update\n update_animation\n end",
"def update\n syn_map_update\n if Input.dir4 == 0\n wait(1, false) if StandWalkRun::Use_idle_sprite\n call_idle($game_player.character_name + StandWalkRun::Idle_sprite_suffix, StandWalkRun::Use_anime) if @wait_time == StandWalkRun::Idle_time\n $game_temp.syn_state = \"idle\"\n restore_run if StandWalkRun::Use_run\n else\n @wait_time = 0\n restore_run if StandWalkRun::Restore_run_while_walking\n call_idle($game_player.old_character_name, false) if $game_player.character_name != $game_player.old_character_name\n $game_temp.syn_state = \"\"\n end\n end",
"def update\n super\n $game_chrono.update\n @window_gameDescription.update() unless @window_gameDescription == nil\n @inPauseMode = false\n #sleep(0.5)\n if @spriteGem1 != nil && @spriteGem1.moving && @spriteCursor1 != nil && @spriteGem2 != nil && @spriteCursor2 != nil \n update_switch2Gem()\n elsif( @spriteGems != nil ) #&& @spriteGems[6].moving )\n#~ for y in 0...BOARD_MAX_Y\n#~ #@spriteGems[y].update\n#~ # if( isUpdating == false )\n#~ # sleep(2)\n#~ # end\n#~ end\n end\n if( @isHeroAttacking == true && @HeroAttackZone != nil )\n \n if ( @HeroAttackZone.update )\n @inPauseMode = true \n #@HeroAttackZone.doAnimation( 1, false )\n # @HeroAttackZone.start_animation($data_animations[1], false)\n else\n @inPauseMode = false \n @HeroAttackZone = nil\n end \n end\n \n end",
"def update\n if idle?\n if Gosu.distance(@hb.x,@hb.y,$WINDOW.player.hb.x, $WINDOW.player.hb.y) < 150\n # If distance is 150 or less, behaviour changes to approaching\n change_state(GameStates::States::WALKING)\n @vect_v = 1\n @vect_angle = Gosu.angle(@hb.x, @hb.y, $WINDOW.player.hb.x, $WINDOW.player.hb.y)\n end\n elsif walking?\n # While walking, wolf tries to approach the main character\n @vect_angle = Gosu.angle(@hb.x, @hb.y, $WINDOW.player.hb.x, $WINDOW.player.hb.y)\n if @una_check_tiks <= 0\n # When next attack check counter reaches 0, wolf can attack.\n dieroll = Random.rand\n if dieroll <= ATTACK_PROBABILITY\n # If random is within attack probability, the wolf changes behaviour to attack\n change_state(GameStates::States::ATTACKING)\n @event_tiks =60\n @vect_v = 0\n else\n #If random is not within attack probability, next attack check counter is reset to 30.\n @una_check_tiks = 30\n end\n end\n check_change_dir\n elsif attacking?\n # If attacking, wolf waits for a little while, then charges in a straight line. Then waits a little while.\n if @event_tiks > 20\n check_change_dir\n elsif @event_tiks == 20\n @vect_angle = Gosu.angle(@hb.x, @hb.y, $WINDOW.player.hb.x, $WINDOW.player.hb.y)\n @vect_v = 3.5\n elsif @event_tiks == 10\n @venct_v = 0\n elsif @event_tiks <= 0\n change_state(GameStates::States::IDLE)\n @una_check_tiks = 100\n end\n end\n\n if normal? && $WINDOW.player.inv_frames <= 0 && !$WINDOW.player.recoiling? && @hb.check_brute_collision($WINDOW.player.hb)\n # If it connects with player, player is set to impacted.\n $WINDOW.player.impacted(@hb.center, @attack_dmg)\n end\n\n if !idle? && Gosu.distance(@hb.x,@hb.y,$WINDOW.player.hb.x, $WINDOW.player.hb.y) > 250\n #If distance surpasses 250, the wolf turns back to idle.\n change_state(GameStates:States::IDLE)\n end\n\n super\n @una_check_tiks -= 1 unless idle? || @una_check_tiks <= 0\n end",
"def update\n\t\t# Timing for the key input\n\t\tif @last_time % 3 == 0\n\t\t\tcase (@button_state)\n\t\t\t\twhen :up then @shape.rotate(:clockwise)\n\t\t\t\twhen :left then @shape.move_left\n\t\t\t\twhen :right then @shape.move_right\n\t\t\t\twhen :down then @shape.move_down\n\t\t\tend\n\t\t\t@button_state = nil\n\t\tend\n\n\t\t# Timing for moving the pieces down\n\t\t@shape.move_down if @last_time % 60 == 0\n\n\t\t@last_time += 1\n\tend",
"def update_interpreter\r\n # If battle event is running\r\n if $game_system.battle_interpreter.running?\r\n # Update interpreter\r\n $game_system.battle_interpreter.update\r\n # If a battler which is forcing actions doesn't exist\r\n if $game_temp.forcing_battler == nil\r\n # If battle event has finished running\r\n unless $game_system.battle_interpreter.running?\r\n # Rerun battle event set up if battle continues\r\n unless judge\r\n setup_battle_event\r\n end\r\n end\r\n # If not after battle phase\r\n if @phase != 5\r\n # Refresh status window\r\n @status_window.refresh\r\n end\r\n end\r\n end\r\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 update\n update_animation(false) if @animated\n update_position if @moving\n super\n end",
"def update\r\n #\r\n # Register a tick with our rather standard tick/framerate counter. \r\n # Returns the amount of milliseconds since last tick. This number is used in all update()-calls.\r\n # Without this self.fps would return an incorrect value.\r\n # If you override this in your Chingu::Window class, make sure to call super.\r\n #\r\n @milliseconds_since_last_tick = @fps_counter.register_tick\r\n \r\n intermediate_update\r\n end",
"def update\n if @connected\n @window.state = NetGameState.new(@window, @socket)\n else\n try_accept\n end\n end",
"def update\n # increase frame counter\n @time += 1\n # update movement\n update_move\n # update input\n update_input\n # update commands\n update_command\n # update character\n update_character\n # end combo if reached end of commands\n @ended = true if @commands.size == 0\n end",
"def update\n if @state == :game\n @player.update\n @level.update\n end\n end",
"def update_current_state(player)\n player.correct_letters.each do |key, values|\n values.each do |index|\n player.current_state[index] = key\n end\n end\n end",
"def tower_1\n @@tower_1\n end",
"def update\n self.caption = \"Tennis - [FPS: #{Gosu::fps.to_s}]\"\n if not @game_over\n # Move the game objects around.\n @player.update\n if @twoplayer\n @player2.update\n else\n @bot.update\n end\n @ball.update\n # No need to call update on wall, since it doesn't move :-)\n end\n end",
"def update\n\t\t\t\tprotect_runtime_errors do\n\t\t\t\t\tif @clear_history\n\t\t\t\t\t\t@history_cache = nil \n\t\t\t\t\t\tGC.start\n\t\t\t\t\tend\n\t\t\t\t\t@window.show_text(CP::Vec2.new(352,100), \"ERROR: See terminal for details. Step back to start time traveling.\")\n\t\t\t\t\t\n\t\t\t\t\t# -- update files as necessary\n\t\t\t\t\t# need to try and load a new file,\n\t\t\t\t\t# as loading is the only way to escape this state\n\t\t\t\t\tdynamic_load @files[:body]\n\t\t\t\t\t\n\t\t\t\t\t@ui.update @window, self, @wrapped_object, turn_number()\n\t\t\t\tend\n\t\t\tend",
"def update\n\t\tif @is_blown\n\t\t\tcurr_time = Gosu::milliseconds\n\t\t\tif (curr_time - @start_time).abs > BLOW_DURATION\n\t\t\t\t@is_blown = false\n\t\t\t\t@has_changed = true\n\t\t\tend\n\t\tend\n\tend",
"def update\n @player.shape.body.reset_forces\n\n 6.times do\n if button_down? Gosu::KbLeft or button_down? Gosu::GpLeft then\n @player.move_left\n end\n if button_down? Gosu::KbRight or button_down? Gosu::GpRight then\n @player.move_right\n end\n #if button_down? Gosu::KbUp or button_down? Gosu::GpRight then\n # @player.shape.body.a += 0.1\n #\n # puts @player.shape.body.a.inspect\n #end\n #if button_down? Gosu::KbDown or button_down? Gosu::GpRight then\n # @player.shape.body.a -= 0.1\n # puts @player.shape.body.a.inspect\n #end\n\n\n @space.step 1.0/10.0\n end\n end",
"def update\n super\n @forge_animator.update\n end",
"def update(time_since_tick)\n fall_more(time_since_tick) if @falling #keep falling if there is no ground beneath our feet\n end",
"def update_turning_ball\n @ball.update_anim\n end",
"def update\n super\n @spriteset.update\n $game_timer.update\n $game_fishing.update\n end",
"def intermediate_update\r\n #\r\n # Call update() on all game objects belonging to the main window.\r\n #\r\n @game_objects.update\r\n \r\n #\r\n # Call update() on all game objects belonging to the current game state.\r\n #\r\n\r\n #\r\n # Call update() on our game_state_manger\r\n # -> call update on active states\r\n # -> call update on all game objects in that state\r\n #\r\n @game_state_manager.update\r\n end",
"def update\n prev_index = @index\n # If 10 frame counts have passed\n if @sprite_frame != Graphics.frame_count % 60 / 15\n # Update frame count\n @sprite_frame = Graphics.frame_count % 60 / 15\n # Update unit graphics to new animation frame\n refresh_graphics\n end\n \n @info_window.update if @info_window.active\n super if self.active\n \n if self.active\n @info_window.unit = @units[@index] if prev_index != @index\n @desc_window.draw_info(@units[@index].stat_desc[0]) if prev_index != @index\n \n if Input.trigger?(Input::RIGHT)\n $game_system.se_play($data_system.cursor_se)\n self.cursor_rect.visible = false\n self.active = false\n @info_window.active = true\n @info_window.cursor_rect.visible = true\n end\n else # Info Window is active\n if Input.trigger?(Input::LEFT) or Input.trigger?(Input::B)\n $game_system.se_play($data_system.cursor_se)\n self.cursor_rect.visible = true\n self.active = true\n @info_window.index = 0\n @info_window.active = false\n @info_window.cursor_rect.visible = false\n # Reset description window to brief unit profile\n @desc_window.draw_info(@units[@index].stat_desc[0])\n end\n end\n end",
"def state_ontable_lessplayers\n @log.debug(\"Net_state: change to state state_ontable_lessplayers\")\n @network_state = :state_ontable_lessplayers\n make_state_change_ntfy(:ntfy_state_ontable_lessplayers)\n end",
"def state=(new_state)\n @state = new_state\n refresh\n end",
"def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end",
"def tower_3\n @@tower_3\n end",
"def tower_2\n @@tower_2\n end",
"def change_obstacle_states\n @linked_obstacles.each do |i|\n i.switch_state\n end\n end",
"def watch\n watch_state_znode\n end",
"def update(robot, action, state)\n if action == PICK_BEEPER_ACTION \n move()\n end\n end",
"def update\n\t\tif @onWorld\n\t\t\t@map.get_monsters.each do |monster|\n\t\t\t\tif monster.isAlive\n\t\t\t\t\tmonster.move\n\t\t\t\t\tif monster.get_x == @x && monster.get_y == @y\n\t\t\t\t\t\t@alive = false\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def water_manager_update(id)\n wm = WaterManager.find(id)\n # change state\n wm.update(state: (wm.state == ACTIVE ? STANDBY : ACTIVE))\n wm = WaterManager.find(id)\n # log \"wm.state --> #{wm.state}\\n\"\n \n if wm.state == ACTIVE\n # log \"wm.arm\\n\"\n arm\n else\n # log \"wm.disarm\\n\"\n disarm\n end\n end",
"def update\n @loc += vel\n end",
"def update\n super\n @ucCharStatus.ucActStates.update()\n end",
"def update\n\t\tif Gosu::button_down? Gosu::KbLeft or Gosu::button_down? Gosu::GpLeft then @player.turn_left\n\t\tend\n\t\tif Gosu::button_down? Gosu::KbRight or Gosu::button_down? Gosu::GpRight then @player.turn_right\n\t\tend\n\t\tif Gosu::button_down? Gosu::KbUp or Gosu::button_down? Gosu::GpButton0 then @player.accelerate\n\t\tend\n\t\t\n\t\t@player.move\n\t\t@player.collect_stars(@stars)\n\n\t\tif rand(100) < 4 and @stars.size < 25 then\n\t\t\t@stars.push(Star.new(@star_anim))\n\t\tend\n\tend",
"def update(state_manager, game)\n\n end",
"def update\n @vel.mult(0) if not @movable\n @vel.limit(@max_vel)\n @loc.add(@vel)\n @vel.mult(@dumping)\n end",
"def update\n\t\t\t\tprotect_runtime_errors do\n\t\t\t\t\tif @clear_history\n\t\t\t\t\t\t@history_cache = nil \n\t\t\t\t\t\tGC.start\n\t\t\t\t\tend\n\t\t\t\t\t@forecast_fiber ||= Fiber.new do\n\t\t\t\t\t\tputs \"forecasting...\"\n\t\t\t\t\t\t\n\t\t\t\t\t\t# update the state\n\t\t\t\t\t\t# TODO: figure out if I can remove the nil check by enforcing some paths in the state system. can I be sure that by this point, @wrapped_object will be non-nil?\n\t\t\t\t\t\t@forcasted_the_end = false\n\t\t\t\t\t\t@forecasting_lock = true\n\t\t\t\t\t\t\n\t\t\t\t\t\t# forecasting is a bit different from normal time traveling.\n\t\t\t\t\t\t# In normal time traveling, you just need to draw the states,\n\t\t\t\t\t\t# but in forecasting, you want to run the code again.\n\t\t\t\t\t\t\n\t\t\t\t\t\t# Therefore...\n\t\t\t\t\t\t\n\t\t\t\t\t\t# these are the states you want to draw\n\t\t\t\t\t\ttarget_range = ((@time_travel_i+1)..(@history.length-1))\n\t\t\t\t\t\t\n\t\t\t\t\t\t# but you have to re-simulate them first,\n\t\t\t\t\t\t# so you need the states prior to those\n\t\t\t\t\t\tgrab_range = ((target_range.min-1)..(target_range.max-1))\n\t\t\t\t\t\t\n\t\t\t\t\t\t# now we can grab states, update them, and then draw them\n\t\t\t\t\t\tgrab_range.each do |i|\n\t\t\t\t\t\t\t# -- get the state\n\t\t\t\t\t\t\tstate = @history[i]\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t# -- update state\n\t\t\t\t\t\t\tsym = :update\n\t\t\t\t\t\t\tsignal = state.send sym, @window\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t# -- save\n\t\t\t\t\t\t\t@history.save @turn, state\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t# @time_travel_i = i\n\t\t\t\t\t\t\t@forecast_range = ((target_range.min)..(i+1))\n\t\t\t\t\t\t\t# ^ shows range of history that was overridden by forecasting\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t@history_cache[@forecast_range.max] = state\n\t\t\t\t\t\t\t# ^ can store this state object in cache, because next frame I'll pull a new object from @history\n\t\t\t\t\t\t\t# (In fact, the object I pull out will be a copy of this one)\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t# if there's an error, we will transition to \"forecasting_error\"\n\t\t\t\t\t\t\t\t# (automatically caught by protect_runtime_errors block)\n\t\t\t\t\t\t\t\t# (automatically transition due to state machine)\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t# otherwise, visualize the correct forecasting path by transitioning to a different time-traveling state\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif signal == :finished\n\t\t\t\t\t\t\t\t@forcasted_the_end = true\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t# # if the last state generated results in the update fiber running to completion, then the found timeline is actually the \"true timeline\". In that case, call this method instead:\n\t\t\t\t\t\t\t\t# self.forecast_found_true_timeline()\n\t\t\t\t\t\t\t\t# break # may be stopping short of the previous timeline's end\n\t\t\t\t\t\t\t\t# # when breaking out into the true timeline, you can resize the history cache if the true ending occurs before the current end of the cache.\n\t\t\t\t\t\t\t\t# \t# => callback: on_forecast_to_true_timeline\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t@forecasting_lock = false\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\t\t# When time traveling ends in the true timeline, execution temporarily returns to the :running state, executes a NO-OP and then proceeds to the \"true ending.\"\n\t\t\t\t\t\t# May not have to have separate forecast_found_good_timeline() and forecast_found_true_timeline() functions. It may be sufficient to return to the paused / running state.\n\t\t\t\t\t\t\n\t\t\t\t\t\t# alternatively: may be able to use the same timeline called state, and then branch based on a callback defined elsewhere?\n\t\t\t\t\t\t# nah, that sounds bad.\n\t\t\t\t\tend\n\t\t\t\t\t@forecast_fiber.resume while @forecast_fiber&.alive?\n\t\t\t\t\t\n\t\t\t\t\tdynamic_load @files[:body]\n\t\t\t\t\t\n\t\t\t\t\t@ui.update @window, self, @wrapped_object, turn_number()\n\t\t\t\tend\n\t\t\tend",
"def update_maze_presenter(window, state)\n\n if state[:needs_reset]\n reset_grid(state)\n state[:needs_reset] = false\n end\n\n grid = state[:grid]\n player = state[:player]\n\n step_through_maze_generator(grid, state)\n\n state[:game_state] = GameState::GAME_STARTED if state[:algorithm_state][:generation_complete]\n\n update_remaining_time(window, state)\n\n last_row = grid[grid.length - 1]\n last_cell = last_row[last_row.length - 1]\n level_maze_up(window, state) if player == last_cell\nend",
"def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end",
"def up\n @state -= 1 unless @state == 0\n @y -= 1 * @boost\n end",
"def update\n \n unless @state == :paused\n # Update player\n # TODO externalize this part PlayerCtrl\n if @player.is_alive? or @player.resurrecting?\n @player.move_left if button_down? Gosu::Button::KbLeft or button_down? Gosu::Button::GpLeft\n @player.move_right if button_down? Gosu::Button::KbRight or button_down? Gosu::Button::GpRight\n @player.accelerate if button_down? Gosu::Button::KbUp or button_down? Gosu::Button::GpUp\n @player.brake if button_down? Gosu::Button::KbDown or button_down? Gosu::Button::GpDown\n @player.shoot if button_down? Gosu::Button::KbZ or button_down? Gosu::GpButton0\n end\n @player.update\n \n # Check touching bullets\n @bullets.reject! { |b| b.touch? @ennemies }\n @e_bullets.reject! { |b| b.touch? @player }\n \n # Update bullets and ennemies\n # Remove all objects whose update method returns false. \n @bullets.reject! { |o| o.update == false }\n @e_bullets.reject! { |o| o.update == false }\n @ennemies.reject! { |e| e.update == false }\n @bonuses.reject! { |b| b.update == false }\n @particles.reject! { |p| p.update == false }\n \n #@gl_background.scroll\n \n # Generate new ennemies\n @finished = @w_generator.update\n end\n \n end",
"def refresh_state\n logger.info \"Refreshing current state\" do\n @run_context.refresh_state\n end\n end",
"def update\n if @step_count == 20 # 3 times / s\n @board.step!\n @step_count = 0\n else\n @step_count += 1\n end\n end",
"def start_update \n @updating = $app.animate(UPDATE_SPEED) do\n update\n end\n end",
"def update\n super\n unless @unit.needs_deletion #@unit.health > 0\n update_bitmap # Update unit animation frame\n update_screen # Update the position the graphic should be displayed\n update_frame # Update the frame count and flag graphic\n update_movement if @is_moving # If unit is moving, update its movement\n end\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 update\n accelerate(0, 1) if should_fall?\n move\n end",
"def update\n move\n if $WINDOW.global_frame_counter%4 == 0 && !(dying? || attacking?) && @inv_frames <= 0\n unclip\n end\n @event_tiks -=1 unless @event_tiks <= 0\n\n if recoiling? && @vect_v > 0\n fraction_event_tiks = @event_tiks.to_f/@recoil_frames.to_f\n fraction_bigger_than = 1.00/3.00\n if fraction_event_tiks < fraction_bigger_than\n @vect_v = 0\n end\n end\n\n if @event_tiks <= 0 && @current_hp <=0\n change_state(GameStates::States::DYING)\n @event_tiks = @dying_frames\n end\n end",
"def update_tsbs_extra\n @focus_bg.update\n @cutin.update\n @battle_plane.update\n @one_anim.update\n end",
"def west\n @state.west(self)\n end",
"def set_door_state(state)\r\n\t\t@state = state\r\n\tend",
"def update\n if dash?\n unless $game_temp.syn_state == \"idle\"\n set_graphic(@character_name + StandWalkRun::Run_sprite_suffix) if StandWalkRun::Use_run_sprite\n @run_points -= 1\n @move_speed = StandWalkRun::Run_speed\n syn_player_update\n end\n else\n @move_speed = StandWalkRun::Walk_speed\n $game_temp.syn_state == \"\"\n syn_player_update\n end\n end",
"def update\n super\n @ucActStates.update()\n end",
"def update_state\n Thread.new do\n Dictionary.commands.each do |zone, _commands|\n Dictionary.commands[zone].each do |command, info|\n info[:values].each do |value, _|\n next unless value == 'QSTN'\n\n send_recv(Parser.parse(\"#{command}QSTN\"))\n end\n end\n end\n end\n end",
"def updatestate\n @attributes.fetch('updatestate', 0)\n end",
"def upload_state\n 0.upto(ROWS - 1) do |row|\n 0.upto(COLUMNS - 1) do |column|\n state = @cell_state[row * ROWS + column]\n @lp.set_led_colors(column, row, *@colors[state])\n end\n end\n @lp.set_led_colors(0, -1, *((@iteration % 2) == 0) ? [1,3] : [3,3])\n @lp.update\n @lp.flip_buffers\n end",
"def pbUpdate(cw=nil)\r\n pbGraphicsUpdate\r\n pbInputUpdate\r\n pbFrameUpdate(cw)\r\n end",
"def update!(**args)\n @state = args[:state] if args.key?(:state)\n end",
"def update!(**args)\n @state = args[:state] if args.key?(:state)\n end",
"def update!(**args)\n @state = args[:state] if args.key?(:state)\n end",
"def update!(**args)\n @state = args[:state] if args.key?(:state)\n end",
"def update!(**args)\n @state = args[:state] if args.key?(:state)\n end",
"def update!(**args)\n @state = args[:state] if args.key?(:state)\n end",
"def update!(**args)\n @state = args[:state] if args.key?(:state)\n end",
"def _update\n\t\t\t\t@index = (@index % @weapons.size)\n\t\t\t\t@current = @weapons[@index]\n\t\t\tend",
"def update_state_effects\n @state_poptimer[0] += 1 unless primary_state_ani.nil?\n if @state_poptimer[0] == 30\n @animation_id = primary_state_ani\n @animation_id = 0 if @animation_id.nil?\n elsif @state_poptimer[0] == 180\n @state_poptimer[0] = 0\n end\n update_state_action_steps \n end",
"def lite_refresh\n if @actor.hp != @hp or @actor.mhp != @maxhp\n refresh_hp\n end\n if @actor.mp != @mp or @actor.mmp != @maxmp\n refresh_mp\n end\n if @actor.atb != @act\n refresh_act\n end\n if @actor.tp != @tp\n refresh_tp\n end\n update_gauges\n refresh_states\n dmg_preview?\n end",
"def update\n return if self.disposed?\n @viewport.color.alpha -= 8 if @viewport.color.alpha > 0\n @sprites[\"bg\"].update\n @sprites[\"streak\"].update\n @sprites[\"shine\"].opacity += 16/self.delta if @sprites[\"shine\"].opacity < 255\n @sprites[\"shine\"].angle += 8/self.delta if $PokemonSystem.screensize < 2\n @sprites[\"shine\"].zoom_x -= 0.04*@sprites[\"shine\"].toggle/self.delta\n @sprites[\"shine\"].zoom_y -= 0.04*@sprites[\"shine\"].toggle/self.delta\n @sprites[\"shine\"].toggle *= -1 if @sprites[\"shine\"].zoom_x <= 0.8 || @sprites[\"shine\"].zoom_x >= 1.2\n return if !@started\n @sprites[\"vs\"].x += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].y += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].toggle *= -1 if (@sprites[\"vs\"].x - 92).abs >= 2*self.delta\n end",
"def update\n return if self.disposed?\n @sprites[\"bg\"].update\n @sprites[\"streak\"].update\n @sprites[\"shine\"].angle += 8.delta_sub if $PokemonSystem.screensize < 2\n @sprites[\"shine\"].zoom_x -= (0.04*@sprites[\"shine\"].toggle).delta_sub(true)\n @sprites[\"shine\"].zoom_y -= (0.04*@sprites[\"shine\"].toggle).delta_sub(true)\n @sprites[\"shine\"].toggle *= -1 if @sprites[\"shine\"].zoom_x <= 0.8 || @sprites[\"shine\"].zoom_x >= 1.2\n # skips the animation that is not called before the end of the whole animation\n return if !@started\n @viewport.color.alpha -= 16.delta_sub if @viewport.color.alpha > 0\n @sprites[\"trainer_a\"].x -= 1 if @i < 12\n @sprites[\"vs\"].x += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].y += @sprites[\"vs\"].toggle\n @sprites[\"vs\"].toggle *= -1 if (@sprites[\"vs\"].x - 140).abs >= 2\n @i += 1 if @i < 128\n end",
"def update_control\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # reset move speed\n player.move_speed = player.normal_speed\n # reset spriteset name\n player.character_name = player.character_name_org\n # if allowed to change speed\n unless $game_system.map_interpreter.running? ||\n player.move_route_forcing || $game_temp.message_window_showing\n # if run button works and running\n if $game_system.running_button && Input.press?(Input::Run)\n # set running speed\n player.move_speed = Config::RUN_SPEED\n # if sneak button works and sneaking\n elsif $game_system.sneaking_button && Input.press?(Input::Sneak) ||\n Config::SNEAK_SPEED > 0 && Config::SNEAK_ON_CHARGE && player.charging?\n # set sneaking speed\n player.move_speed = Config::SNEAK_SPEED\n end\n end\n # if battler exists and either dead or select triggered\n if player.battler != nil && ($game_system.select_button &&\n Input.trigger?(Input::Select) || player.battler.dead?)\n # switch to next valid actor\n switch_leader\n end \n # setup sprite animation\n player.sprite_animation_setup\n # update action\n player.update_action\n # if allowed to turn and pressed turning button or defending\n if ((player.ai.act.defend? && player.attacked == 0) ||\n $game_system.turn_button && Input.press?(Input::Turn)) &&\n !player.moving? && !$game_system.map_interpreter.running? &&\n !player.move_route_forcing && !$game_temp.message_window_showing\n # get input depending on confusion\n input = (player.restriction == 3 ? 10 - Input.dir4 : Input.dir4)\n # depending on input turn\n case input\n when 2 then player.turn_down\n when 4 then player.turn_left\n when 6 then player.turn_right\n when 8 then player.turn_up\n end\n # updates any attacked action\n player.update_attacked\n # abort method\n return nil\n end\n # updates any attacked action\n player.update_attacked\n # if acting\n if player.in_action > 0\n # decrease action counter if in_action is greater than 0\n player.in_action -= 1 if player.in_action > 0\n # return data\n return [player.moving?, player.real_x, player.real_y]\n end\n # if allowed to move\n unless $game_system.map_interpreter.running? ||\n player.move_route_forcing || $game_temp.message_window_showing\n # if jump button was pressed and not already jumping\n if $game_system.jumping_button && Input.trigger?(Input::Jump) &&\n !player.jumping? && player.restriction < 4\n # set to jump\n @memory_jump = true\n end\n # if not moving\n unless player.moving?\n # get jumping range\n range = Config::JUMPING\n # if jumping turned on and not jumping and jumped\n if range > 0 && !player.jumping? && @memory_jump\n # if sneaking or running is possible\n if Config::RUN_SPEED > 0 || Config::SNEAK_SPEED > 0\n # get difference between current speed and normal speed\n dplus = player.move_speed - player.normal_speed\n else\n # difference is 0\n dplus = 0\n end\n # get direction\n direction = $game_system._8_way ? Input.dir8 : Input.dir4\n # set jumping direction\n x, y = Cache::DirOffsets[direction]\n # jump into direction with considering running/sneaking\n player.jump(x*range + x*dplus, y*range + y*dplus, direction)\n # if not already jumping\n elsif !player.jumping?\n # move\n move($game_system._8_way ? Input.dir8 : Input.dir4)\n # allow idle if no movement\n player.idle_allowed = !player.moving?\n end\n # not jumping anymore\n @memory_jump = false\n end\n end\n # return data\n return [player.moving?, player.real_x, player.real_y]\n end",
"def times_walked_to(state); end",
"def update_basic(main = false)\n super()\n $game_troop.update # Update enemy group\n $game_map.update(false) # Update map data\n @spriteset.update # Update sprite set\n update_win_visible\n update_battlers\n if @message_window.visible != $game_message.visible\n @message_window.visible = $game_message.visible\n @message_window.update # Update message window\n end\n end",
"def update\n update_input\n update_position\n end",
"def game_state\n\t\t\"YOURTURN #{self.current_round} #{@hunter.to_state}, #{@prey.to_state}, W[#{@walls.map{|w| w.to_state}.join(\", \")}]\"\n\tend",
"def run\n while @current_state != @final_state do\n #if the reading head is at a new cell, create the cell\n unless @tape.has_key? @reading_head.to_s\n @tape[@reading_head.to_s] = Cell.new({value: \"e\", being_read: false})\n end\n\n #set the variable that is being read (for display purposes)\n @tape[@reading_head.to_s].being_read = true\n\n print_tape\n\n #get instructions for the current state\n state = @transition_table[@current_state]\n puts \"Current state is #{@current_state}\" if @verbose\n\n #read\n read_value = @tape[@reading_head.to_s].value.to_s\n read_value = 2 if read_value == \"e\"\n\n state = state[read_value.to_i]\n\n puts \"Just read a(n) #{read_value}\" if @verbose\n\n #write\n @tape[@reading_head.to_s].value = state[\"write\"]\n\n puts \"Just wrote a(n) #{state[\"write\"]}\" if @verbose\n\n #The value is no longer being read\n @tape[@reading_head.to_s].being_read = false\n\n #move\n if state[\"direction\"] == \"R\"\n move_right\n puts \"Just moved right\" if @verbose\n else\n move_left\n puts \"just moved left\" if @verbose\n end\n\n #update state\n @current_state = state[\"next_state\"]\n puts \"Just updated state to #{@current_state}\" if @verbose\n puts \"-------------------------------------------\" if @verbose\n end\n end",
"def update\n\t\t\tcall_position_change_if_necessary\n\t\t\t@on_speed_change.call if @on_speed_change and @speed != @last_speed\n\t\t\t@last_speed = @speed\n\t\t\t@on_course_change.call if @on_course_change and @course != @last_course\n\t\t\t@last_course = @course\n\t\t\t@on_altitude_change.call if @on_altitude_change and @altitude != @last_altitude\n\t\t\t@last_altitude = @altitude\n\t\t\t@on_satellites_change.call if @on_satellites_change and @satellites != @last_satellites\n\t\t\t@last_satellites = @satellites\n\t\tend"
] |
[
"0.63458997",
"0.60826844",
"0.60565686",
"0.6054759",
"0.59838015",
"0.5922708",
"0.59080523",
"0.5905839",
"0.59017",
"0.58204085",
"0.5783788",
"0.57798034",
"0.5777637",
"0.577515",
"0.57426196",
"0.5660861",
"0.5659293",
"0.56495744",
"0.56351167",
"0.5631331",
"0.56082296",
"0.5593454",
"0.5591537",
"0.5587544",
"0.55858594",
"0.5579283",
"0.5563357",
"0.5560654",
"0.5530923",
"0.5530717",
"0.5519937",
"0.55183065",
"0.5510618",
"0.5495997",
"0.54828924",
"0.54801065",
"0.5474506",
"0.54642755",
"0.54569095",
"0.54328626",
"0.54292077",
"0.5423987",
"0.5423726",
"0.54181874",
"0.5407739",
"0.5394661",
"0.5393781",
"0.5389703",
"0.5383664",
"0.5379313",
"0.53775805",
"0.53743964",
"0.5374272",
"0.5372239",
"0.5364909",
"0.53640777",
"0.53597873",
"0.53546107",
"0.534597",
"0.53402597",
"0.5335434",
"0.5325546",
"0.5323238",
"0.53187495",
"0.53187495",
"0.5298852",
"0.52930695",
"0.5288324",
"0.5284905",
"0.5282233",
"0.52800906",
"0.52721965",
"0.5268679",
"0.52680904",
"0.52679944",
"0.5258552",
"0.5255789",
"0.52537173",
"0.5250946",
"0.5247992",
"0.52451307",
"0.52407736",
"0.52182597",
"0.52182597",
"0.52182597",
"0.52182597",
"0.52182597",
"0.52182597",
"0.52182597",
"0.5208962",
"0.5208426",
"0.52021974",
"0.52015764",
"0.51997393",
"0.51984835",
"0.5194727",
"0.5192478",
"0.519206",
"0.518749",
"0.51833683",
"0.51815015"
] |
0.0
|
-1
|
! ! ! ! ! ! ! !
|
def to_s
channel = (self.h % :channel)
channel.children.each_with_index do |e,i|
if e.class == Hpricot::Elem && e.name == "item"
channel.children[i] = Hpricot::XML("")
end
end
@items.each do |item|
channel.children << item.to_h
end
self.h.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def anchored; end",
"def terpene; end",
"def probers; end",
"def star; end",
"def suivre; end",
"def villian; end",
"def nn\n end",
"def nebula; end",
"def king_richard_iii; end",
"def sk! ; k! ; s! ; end",
"def hiddens; end",
"def gounod; end",
"def celebration; end",
"def berlioz; end",
"def stderrs; end",
"def malts; end",
"def schubert; end",
"def surge; end",
"def cops; end",
"def cops; end",
"def cops; end",
"def offences_by; end",
"def buzzword; end",
"def buzzword; end",
"def fuse\r\n\t\ti,j=0\r\n\t\twhile i<8 do \r\n\t\t j=0\r\n\t\t while j<8 do\r\n\t\t \r\n\t\t if @nha[i][j] == nil\r\n\t\t @nha[i][j] =\".\" \r\n\t\t end\r\n\t\t j+=1\r\n\t\t end \r\n\t\t i+=1\r\n\t\tend \r\n\t\treturn true\r\n\tend",
"def succ!() end",
"def starship; end",
"def flag; end",
"def gen_washing\r\r\n end",
"def operations; end",
"def operations; end",
"def p15\n\t\nend",
"def bye; end",
"def pass; end",
"def pass; end",
"def whiny; end",
"def blg; end",
"def reap; end",
"def does\n puts \"ALL THE THINGESSSS!!!eleventy\"\nend",
"def ring; end",
"def ring; end",
"def bellini; end",
"def herald; end",
"def hiss; end",
"def private; end",
"def guct\n end",
"def op; end",
"def multi; end",
"def who_we_are\r\n end",
"def r; end",
"def r; end",
"def right_bot\n\t\t[ cl[0]+1, cl[1]+1 ]\n\tend",
"def jeweler; end",
"def jeweler; end",
"def jeweler; end",
"def alpha; end",
"def wip\n end",
"def verdi; end",
"def strain; end",
"def ravel; end",
"def zuruecksetzen()\n end",
"def normal\n end",
"def normal\n end",
"def leeway; end",
"def leeway; end",
"def multiplex\n\t\t\t\t\t1\n\t\t\t\tend",
"def mitch_hedberg; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def ibu; end",
"def formation; end",
"def hd\n \n end",
"def alt; end",
"def eplore\n end",
"def quebecmandate\n\n end",
"def y; end",
"def y; end",
"def y; end",
"def alg; end",
"def same; end",
"def runnables; end",
"def slop!; end",
"def slop!; end",
"def mech; end",
"def mech; end",
"def diagonal_win\n 6.times do\n end\n end",
"def jack_handey; end",
"def internship_passed; end",
"def witcher; end",
"def weber; end",
"def z\n end",
"def passes; end",
"def passes; end",
"def squeek\r\n\t\treturn \"eeeep\"\r\n\tend",
"def dh; end",
"def star\n end",
"def parrot_two\n\n return \"Squawk!\"\n\n return \"Squawkeroni!\"\n\n return \"Squawkity squawk squawk!\"\n\nend"
] |
[
"0.62127715",
"0.61551666",
"0.61286193",
"0.61057",
"0.6098053",
"0.60567224",
"0.60322005",
"0.6004552",
"0.5983333",
"0.5961636",
"0.592969",
"0.58922714",
"0.5861197",
"0.5849029",
"0.58401144",
"0.5838243",
"0.58128154",
"0.5779364",
"0.5756141",
"0.5756141",
"0.5756141",
"0.5748785",
"0.5746188",
"0.5746188",
"0.57444865",
"0.57441777",
"0.5685496",
"0.56719494",
"0.56666833",
"0.56636506",
"0.56636506",
"0.5658876",
"0.5646532",
"0.56417334",
"0.56417334",
"0.56332475",
"0.5615559",
"0.5602537",
"0.56011164",
"0.5598285",
"0.5598285",
"0.55917615",
"0.55909324",
"0.55862343",
"0.5576617",
"0.5576331",
"0.55759126",
"0.5569205",
"0.5561859",
"0.5561553",
"0.5561553",
"0.5553561",
"0.55496424",
"0.55496424",
"0.55496424",
"0.5548795",
"0.5537985",
"0.55305845",
"0.552957",
"0.5527115",
"0.5521531",
"0.5510513",
"0.5510513",
"0.5507308",
"0.5507308",
"0.5506898",
"0.54911166",
"0.54841554",
"0.54841554",
"0.54841554",
"0.54841554",
"0.54841554",
"0.54841554",
"0.5481009",
"0.54799294",
"0.5467651",
"0.5465621",
"0.5461418",
"0.54613364",
"0.54559004",
"0.54559004",
"0.54559004",
"0.54557323",
"0.5449197",
"0.54474837",
"0.5446936",
"0.5446936",
"0.544662",
"0.544662",
"0.5442641",
"0.5439269",
"0.54331154",
"0.54278344",
"0.5422638",
"0.5419904",
"0.5412467",
"0.5412467",
"0.5410331",
"0.54069644",
"0.5401875",
"0.5391563"
] |
0.0
|
-1
|
Returns a contributor whose quiz is to be taken if available, otherwise will raise an error
|
def contributor_for_quiz(reviewer, topic)
raise 'Please select a topic.' if topics? && topic.nil?
raise 'This assignment does not have topics.' unless topics? || !topic
# This condition might happen if the reviewer/quiz taker waited too much time in the
# select topic page and other students have already selected this topic.
# Another scenario is someone that deliberately modifies the view.
if topic
raise 'Too many quizzes have been taken for this topic; please select another one.' unless candidate_topics_for_quiz.include?(topic)
end
contributor_set = Array.new(contributors)
work = topic.nil? ? 'assignment' : 'topic'
# 1) Only consider contributors that worked on this topic; 2) remove reviewer/quiz taker as contributor
# 3) remove contributors that have not submitted work yet
contributor_set.reject! do |contributor|
(signed_up_topic(contributor) != topic) || # both will be nil for assignments with no signup sheet
contributor.includes?(reviewer) # ##or !contributor.has_quiz?
end
raise "There are no more submissions to take quiz on for this #{work}." if contributor_set.empty?
# Reviewer/quiz taker can take quiz for each submission only once
contributor_set.reject! { |contributor| quiz_taken_by?(contributor, reviewer) }
# raise "You have already taken the quiz for all submissions for this #{work}." if contributor_set.empty?
# Choose a contributor at random (.sample) from the remaining contributors.
# Actually, we SHOULD pick the contributor who was least recently picked. But sample
# is much simpler, and probably almost as good, given that even if the contributors are
# picked in round-robin fashion, the reviews will not be submitted in the same order that
# they were picked.
contributor_set.sample
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def contributor?\n self.contributor\n end",
"def get_contributor(username)\n contributor = @database.get_item(\n table_name: contributors_table_name,\n key: { \"username\" => username },\n consistent_read: true\n )[:item]\n\n contributor\n end",
"def contributor?( id )\n acl.has_permission?(id, AlbumACL::CONTRIBUTOR_ROLE) || SystemRightsACL.singleton.has_permission?(id, SystemRightsACL::SUPPORT_HERO_ROLE)\n end",
"def get_question\n if self.key.to_s =~ /(an_)([0-9])/\n q_id = QUESTION_MAP[\"qs_#{$+}\".to_sym][:id]\n q = ProfileQuestion.find_by_profile_id_and_question_id(self.profile_id, q_id)\n q.answer\n else\n nil\n end\n end",
"def atest_ID_25872_access_granted_as_contributor()\n #Need to be clarified. Looks like it's already covered with access_granted_as_manager()\n end",
"def quiz_owner_user\n unless quiz_owner?(params[:id])\n redirect_to quizzes_path\n flash[:error] = \"Step Off!! You don't own that quiz\"\n end\n end",
"def contributors(exact = false)\n acl.get_users_with_role(AlbumACL::CONTRIBUTOR_ROLE, exact)\n end",
"def poll_author?\n self.answer_choice.question.poll.author_id\n end",
"def get_reviewer\n self\n end",
"def show\n if @question.user_id.nil?\n @question_author = 'anonymous'\n else\n @question_author = User.find(@question.user_id).name\n end\n end",
"def current_contributor\n @current_contributor ||= Contributor.find_by(id: session[:contributor_id])\n end",
"def contributor_details\n logger.debug(\"Role contributor_details\")\n @role = Role.find(params[:id])\n #@role.updated_by= get_user.login_id\n \n @person = @role.person\n @organisation = @role.organisation\n #if !@person.is_contributor?\n # flash[:notice] = 'Please make this person a contributor before editing contributor information'\n # redirect_to :action => 'edit', :id => @person\n # return\n #end\n setup_contributor\n end",
"def name\n self.evaluation.user.slug\n end",
"def users_role_with_this_submission(user)\n if self.corresponding_author == user\n return 'Corresponding Author'\n elsif self.coauthors.include?(user)\n return 'Coauthor'\n elsif self.reviewers.include?(user)\n return 'Reviewer'\n elsif section_editors.include?(user)\n return 'Section Editor'\n else\n return 'This user is not associated with this manuscript'\n end \n end",
"def submission_of(user)\n Submission.find(challenge_id, user.username)\n end",
"def participant\n self_link.try(:participant)\n end",
"def get_tutor_question\n questions.find { |q| q.type == \"tutor_table\" }\n end",
"def has_contributor_plan?\n (current_user.plan.id == 5)\n end",
"def questions_author\n self.question.poll.author.id\n end",
"def author\n # data = QuestionsDatabase.instance.execute(\"SELECT fname, lname FROM questions\")\n User.find_by_user_id(@author_id)\n\n end",
"def adult_sponsor\n self.users.where(role: \"adult sponsor\").first\n end",
"def lesson_coach\n lesson.coach_name\n end",
"def is_contributor?(story)\n User.role_for_story(self, story.id) == \"loggedout\" || User.role_for_story(self, story.id) == \"reader\"\n end",
"def retrieve_answer\n return self if self.correct?\n Answer.find_by(correct: true, trivia_question_id: self.trivia_question_id)\n end",
"def other_party(person)\n person == starter ? listing.author : starter\n end",
"def this_user_and_assignment\n rec = CONNECTION.execute(\"SELECT * FROM #{table} WHERE user_id = #{user.id} AND assignment_id = #{assignment.id};\").first\n if rec.blank?\n Collaborator.new\n else\n Collaborator.new(rec)\n end\n end",
"def item_requester\n participants.reject { |p| p.id == item_owner.id }.first\n end",
"def authored_questions\n Question.find_by_author_id(self.id)\n end",
"def authored_questions\n Question.find_by_author_id(self.id)\n end",
"def author\n if @submission.user != current_user.sk\n render 'errors/access_refused' and return\n end\n end",
"def set_contributor\n @contributor = Contributor.find(params[:id])\n end",
"def set_contributor\n @contributor = Contributor.find(params[:id])\n end",
"def set_contributor\n @contributor = Contributor.find(params[:id])\n end",
"def authored_questions\n Question.find_by_author_id(@id)\n end",
"def get_instructor(first_initials, last_name)\n # TODO check by first initial\n instructors = Instructor.find_all_by_last_name(last_name)\n instructors.reject! do |instructor|\n instructor.first_name.empty? or instructor.first_name[0] != first_initials[0]\n end\n if !instructors.empty?\n return instructors[0]\n end\nend",
"def get_question(answer)\n answer.is_a?(Answer) ? answer.question : answer\n end",
"def is_author?\n Response.joins(question: :poll).where(\"polls.user_id = ?\", self.user_id).exists?\n end",
"def role_reviewer(role)\n result = self.design_review_results.detect { |r| r.role_id == role.id }\n return User.find(result.reviewer_id) if result\n end",
"def contributor_names\n @contributor_names ||= contributors.map {|c| c.realname || c.username }\n end",
"def to_contributor(plan, name, email, phone, identifier, org)\n return nil, nil unless name.present? || email.present?\n\n # If the name is not an array already split it up\n orcid = IdentifierScheme.find_by(name: 'orcid')\n\n # If no Org and/or identifier were nil try to look them up in the User table\n user = User.includes(:identifiers).where(email: email).first\n if user.present?\n org = user.org_id if org.blank?\n\n unless identifier.present?\n ident = user.identifiers.find { |i| i.identifier_scheme == orcid }\n identifier = ident.value if ident.present?\n end\n end\n\n contributor = Contributor.where('plan_id = ? AND (LOWER(email) = LOWER(?) OR LOWER(name) = LOWER(?))', plan.id,\n email, name).first\n if contributor.blank?\n contributor = Contributor.new(email: email, plan: plan)\n contributor.name = name\n contributor.phone = phone\n contributor.org_id = org\n end\n return contributor, nil if identifier.nil?\n\n # Get the ORCID id from the string\n matched = identifier.match(/([0-9]{4}-?){4}/)\n orcid_id = matched[0] if matched.present?\n return contributor, nil if orcid_id.blank?\n\n id = Identifier.find_or_initialize_by(identifiable: contributor,\n identifier_scheme: orcid)\n id.value = orcid_id\n [contributor, id]\n end",
"def contributors\n has_contributors\n end",
"def find_by_name(provenance:, json: {})\n return nil unless json[:name].present?\n\n contributor = ::Contributor.where('LOWER(name) = ?', json[:name].downcase).first\n return contributor if contributor.present?\n\n # If no good result was found just initialize a new one\n ::Contributor.new(provenance: provenance, name: json[:name], email: json[:mbox])\n end",
"def missing_contributor_or_referrer_attributes? (contribution)\n r_attrs = contribution[:referrer_attributes]\n c_attrs = contribution[:contributor_attributes]\n (r_attrs.present? &&\n !User.exists?(r_attrs[:id]) &&\n (r_attrs[:email].blank? || r_attrs[:first_name].blank? || r_attrs[:last_name].blank?)) ||\n (c_attrs.present? &&\n !User.exists?(c_attrs[:id]) &&\n (c_attrs[:email].blank? || c_attrs[:first_name].blank? || c_attrs[:last_name].blank?))\n end",
"def pick_grader(question)\n question.auto_grader\n end",
"def contributor\n (self.contributors.empty?) ? '' : self.contributors.join(', ')\n end",
"def is_contributor\n user = UserAdmin.find_by_user_id(current_user.id)\n if user and user.level >0\n return true || false\n end\n end",
"def check_user_ownership\n @answer = current_user.answers.find_by(id: params[:id])\n if @answer.nil?\n redirect_to(request.referrer || root_url, flash: { danger: 'You do not have permission to do that.' })\n end\n end",
"def owner\n collaborators.where(role: \"owner\").first.user\n end",
"def question\n answer.question\n end",
"def contributed\n\t\tif @contributed.nil? then false else @contributed end\n\tend",
"def not_author_response\n if author_respondent?\n errors[:author] << 'cannot answer their own poll'\n end\n end",
"def designer\n \n if self.designer_id > 0\n User.find(self.designer_id)\n else\n User.new(:first_name => 'Not', :last_name => 'Assigned')\n end\n rescue\n return User.new(:first_name => 'Unknown', :last_name => 'User')\n end",
"def correct_answer\n self.answers.where(correct: true).first\n end",
"def get_contributor_user_by_email(email, display_name)\n if self.everyone_can_contribute?\n # this is open album, so go ahead and create Anonymous user if necessary\n return User.find_by_email_or_create_automatic( email, display_name, false )\n end\n\n # only contributors allowed to add photos\n user = User.find_by_email(email)\n # if we have a user, see if a contributor, if not return nil\n if user\n if contributor?(user.id)\n # this user is a contributor, if we are currently auto_by_contact, upgrade to automatic\n user = User.find_by_email_or_create_automatic( email, display_name, false ) if user.auto_by_contact?\n else\n user = nil\n end\n end\n user\n end",
"def correct_user\n if @submission.user != current_user.sk && !current_user.sk.admin && (!current_user.sk.corrector || !current_user.sk.pb_solved?(@problem))\n render 'errors/access_refused' and return\n end\n end",
"def show\n authorize! :read, @admin_question\n end",
"def reviewer; fund_source ? fund_source.organization : nil; end",
"def author; User.get(self.author_id); end",
"def org_question_privacy(org)\n privacy = question_privacies.by_org(org)\n #privacy = privacy.by_course(course)\n privacy = privacy.first\n if privacy\n privacy.question_privacy\n else\n self.question_privacy\n end\n end",
"def author\n val = authors and val.first\n end",
"def canAnswer(i, g)\n print \"Player #{i} asked you about #{g.to_s}\"\n answers = [] #array\n\n if @cards.include? g.person\n answers.push(g.person)\n end\n\n if @cards.include? g.place\n answers.push(g.place)\n end\n\n if @cards.include? g.weapon\n answers.push(g.weapon)\n end\n\n if answers.length == 0\n puts \", but you couldn't answer\"\n return nil\n elsif answers.length == 1\n puts \", but you you only have one card, #{answers[0].to_s}, showed it to them.\"\n return answers[0]\n else\n puts \". Which do you show?\"\n return getUserInputFromArray(answers)\n end\n end",
"def answering_person\n respond_to?(:answerHasAnsweringPerson) ? answerHasAnsweringPerson.first : nil\n end",
"def is_reviewer?\n self.reviewer_role != nil\n end",
"def associated_student\n annotation.try(:response).try(:user) || response.try(:user)\n end",
"def answered_by\r\n answer_response.answerer\r\n end",
"def contributor_link(pic)\n\t\tunless pic.contributor.blank?\n\t\t\tcontent_tag :span, class: \"contributor\" do\n\t\t\t\tlink_to \"By #{pic.contributor}\", pic.contrib_link\n\t\t\tend\n\t\tend\n\tend",
"def originator\n self.user ? self.user.name : NOT_SET\n end",
"def contributor_realnames\n @contributor_realnames ||= contributors.map(&:realname).compact\n end",
"def get_author()\n return @author\n end",
"def respondent_is_not_author_poll?\n #\n # respondend.id == author.id\n\n if question.poll.author.id == user.id\n errors[:user_id] << 'author should not answer to his/her poll'\n end\n end",
"def questionGradable (question)\n return true if question.input.is_a? org.concord.otrunk.ui.OTChoice and question.correctAnswer \nend",
"def questionGradable (question)\n return true if question.input.is_a? org.concord.otrunk.ui.OTChoice and question.correctAnswer \nend",
"def get_contributable_version\n if self.contributable_version.blank?\n return self.contributable\n else\n if self.contributable.respond_to?(:find_version)\n return self.contributable.find_version(self.contributable_version)\n else\n return nil\n end\n end\n end",
"def get_contributable_version\n if self.contributable_version.blank?\n return self.contributable\n else\n if self.contributable.respond_to?(:find_version)\n return self.contributable.find_version(self.contributable_version)\n else\n return nil\n end\n end\n end",
"def has_contributed_to\n self.contributed_non_profits\n end",
"def author\n commenter.try(:name)\n end",
"def user_is_contributor?\n !current_cookbook.is_owner?(current_user)\n end",
"def corresponding_author=(user)\n contribution = self.corresponding_author_contribution || Contribution.new(:role_id => 1)\n contribution.user_id = user.id\n contribution.save(false)\n self.corresponding_author \n end",
"def set_admin_academy_question\n @admin_academy_question = Academy::Question.find(params[:id])\n end",
"def quiz\n end",
"def possible_reviewers\n if self.reviewer.include?(\"/\")\n org, team = self.reviewer.split(\"/\", 2)\n access_token = integration_access_token(\n installation_id: self.repository.installation.github_id\n )\n context = { access_token: access_token }\n result = Graphql::Github.team_members(\n org: org,\n team: team,\n context: context\n )\n result.data.organization.team.members.nodes.map(&:login)\n elsif self.reviewer.match?(/^\\d+$/)\n team_members = github_client.team_members(self.reviewer)\n team_members.map(&:login)\n else\n # it's just a single user\n Array(self.reviewer)\n end\n end",
"def show\n if user_signed_in? && current_user.admin?\n @question = @quiz.questions.build\n elsif user_signed_in?\n else\n redirect_to root_url, notice: \"Sorry, you have to sign in first.\"\n end\n end",
"def answer?\n @plan.readable_by?(@user.id)\n end",
"def accepted_genus\n @accepted_genus ||=\n begin\n accepted = approved_name\n if accepted.text_name.include?(\" \")\n genus_name = accepted.text_name.split(\" \", 2).first\n genera = Name.with_correct_spelling.where(text_name: genus_name)\n accepted = genera.reject(&:deprecated)\n genera = accepted if accepted.any?\n nonsensu = genera.reject { |n| n.author.start_with?(\"sensu \") }\n genera = nonsensu if nonsensu.any?\n genera.first\n end\n end\n end",
"def test_github_profile_exists\n people.each do |name, info|\n github_username = info.fetch(\"github\", false)\n if github_username\n assert_kind_of Sawyer::Resource, octokit.user(github_username), \"#{github_username} is not a real GitHub account\"\n end\n end\n end",
"def designer\n if self.designer_id > 0\n User.find(self.designer_id)\n else\n User.new( :first_name => 'Not', :last_name => 'Assigned')\n end\n end",
"def instructor #want to return the instructor id and name from the users table\n # return Users.Section.where(:users.id => :section.id)\n return User.find(self.user_id)\n end",
"def role_for(cdmp)\n case cdmp.role\n when 'http://credit.niso.org/contributor-roles/data-curation'\n 'DataCurator'\n when 'http://credit.niso.org/contributor-roles/formal-analysis',\n 'http://credit.niso.org/contributor-roles/validation'\n 'Researcher'\n when 'http://credit.niso.org/contributor-roles/investigation'\n 'ProjectLeader'\n when 'http://credit.niso.org/contributor-roles/methodology'\n 'DataManager'\n when 'http://credit.niso.org/contributor-roles/project-administration'\n 'ProjectManager'\n when 'http://credit.niso.org/contributor-roles/software'\n 'Producer'\n when 'http://credit.niso.org/contributor-roles/supervision'\n 'Supervisor'\n when 'http://credit.niso.org/contributor-roles/writing-review-editing'\n 'Editor'\n else\n 'ProjectMember'\n end\n end",
"def reviewer_role\n self.roles.detect { |r| r.reviewer? }\n end",
"def get_creator\n User.find_by_id(creator_id)\n end",
"def valid_prize_teacher\n return self.teachers.first if self.prize_teacher_id.blank? || self.teachers.first.try(:id) == self.prize_teacher_id\n nil\n end",
"def has_answered(question)\n return question.responses.find_by(beta_user_id: self.id)\n end",
"def take_quiz\n end",
"def current_project_participant(project_id)\n # if self.has_accepted?(project_id)\n Participant.where(project_id: project_id, user_id: self.id).first\n # end\n end",
"def has_name_been_collected?(question)\n ri = false\n if person.full_name_exists?\n ri = true\n elsif person.only_middle_name_missing?\n ri = true if middle_name_response_exists?\n else\n ri = true if first_name_response_exists? && middle_name_response_exists? && last_name_response_exists?\n end\n answer_for(question, ri)\n end",
"def correct_user\n check_owner_of(@micropost)\n end",
"def submitter_from_resource\n proposal_urs_user = retrieve_urs_users([get_resource.submitter_id])[0]\n { name: \"#{proposal_urs_user['first_name']} #{proposal_urs_user['last_name']}\", email: proposal_urs_user['email_address'] } unless proposal_urs_user.blank?\n end",
"def logged_in?\n !current_contributor.nil?\n end",
"def show\n authorize @question\n end",
"def check_requester(submission_id)\n if(!Submission.find(submission_id).submitted_by_user?(current_user.id) && !current_user.is_admin?)\n unauthorized_request\n end\n end"
] |
[
"0.6231927",
"0.6070218",
"0.599577",
"0.5886823",
"0.5781174",
"0.57043993",
"0.56336546",
"0.56161594",
"0.55781585",
"0.5479549",
"0.54765236",
"0.54365355",
"0.54283124",
"0.538915",
"0.53851753",
"0.53477496",
"0.5331976",
"0.52874494",
"0.52767706",
"0.5272094",
"0.5259314",
"0.5257037",
"0.52090114",
"0.5207649",
"0.5192202",
"0.5187248",
"0.51809394",
"0.5179893",
"0.5179893",
"0.5166192",
"0.51570493",
"0.51570493",
"0.51570493",
"0.5156415",
"0.5153978",
"0.5153822",
"0.5148743",
"0.5141318",
"0.51265407",
"0.51183116",
"0.5108738",
"0.509812",
"0.50970227",
"0.5088799",
"0.5084995",
"0.50780094",
"0.50697714",
"0.5061679",
"0.5048542",
"0.5045265",
"0.5036957",
"0.50280106",
"0.5025681",
"0.50226486",
"0.50163925",
"0.50080436",
"0.5004809",
"0.50043523",
"0.500088",
"0.49877873",
"0.49871278",
"0.49852127",
"0.49768248",
"0.4976122",
"0.4963996",
"0.49608868",
"0.49562845",
"0.4956178",
"0.49549904",
"0.49470803",
"0.49465442",
"0.49465442",
"0.4935483",
"0.4935483",
"0.49343926",
"0.49301815",
"0.49299413",
"0.49295202",
"0.49286792",
"0.4925485",
"0.49250448",
"0.49230567",
"0.492049",
"0.49186757",
"0.491792",
"0.49009567",
"0.4900894",
"0.48994026",
"0.4899217",
"0.4898828",
"0.48967713",
"0.4891914",
"0.48870593",
"0.48846552",
"0.4882994",
"0.48795995",
"0.48784593",
"0.48741093",
"0.48721865",
"0.48673254"
] |
0.7391718
|
0
|
GET /project_messages/1 GET /project_messages/1.json
|
def show
@project_message = ProjectMessage.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @project_message }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @project_message = ProjectMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_message }\n end\n end",
"def messages\n get_json('messages.json')\n end",
"def show\n @v1_message = V1::Message.find(params[:id])\n\n render json: @v1_message\n end",
"def show\n @project = Project.find(params[:id])\n\n #we need to unit test the email part\n if(@project.thread_id)\n email_account = Emailaccount.where(email_address: @project.email_address).first\n inbox = Inbox::API.new(Rails.configuration.inbox_app_id, Rails.configuration.inbox_app_secret, email_account.authentication_token)\n @messages = EmailsController.new.get_messages(inbox,@project.thread_id)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def new\n @message = Message.new\n @projects = Project.all\n @pems = Pem.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def get_messages(project_id, queue_name, opts = {})\n \n # verify the required parameter 'project_id' is set\n raise \"Missing the required parameter 'project_id' when calling get_messages\" if project_id.nil?\n \n # verify the required parameter 'queue_name' is set\n raise \"Missing the required parameter 'queue_name' when calling get_messages\" if queue_name.nil?\n \n\n # resource path\n path = \"/{project_id}/queues/{queue_name}/messages\".sub('{format}','json').sub('{' + 'project_id' + '}', project_id.to_s).sub('{' + 'queue_name' + '}', queue_name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'n'] = opts[:'n'] if opts[:'n']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['oauth_token']\n response = Swagger::Request.new(:GET, path, @host, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :token => token}).make.body\n obj = MessageList.new() and obj.build_from_hash(response)\n end",
"def index\n @messages = message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = Message.all\n render json: @messages\n end",
"def index\n @messages = Message.all\n render json: @messages\n end",
"def index\n messages = Message.all\n render json: messages\n end",
"def index\n @messages = Message.all\n\n render json: @messages\n end",
"def index\n @messages = Message.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def get_messages(page = 0)\r\n if page > 0\r\n message_url = \"/message_threads?page=#{page}\"\r\n else\r\n message_url = \"/message_threads\"\r\n end\r\n response = self.class.get(message_url, headers: { \"authorization\" => @user_auth_token })\r\n JSON.parse(response.body)\r\n end",
"def index\n @messages = Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n\t\t@messages = Message.all.order('created_at DESC')\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @messages }\n\t\tend\n\tend",
"def show\n\t\t@messages = Message.where(recipient: params[:id]).order('created_at DESC')\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @messages }\n\t\tend\n\tend",
"def index\n @messages = current_user.received_messages.paginate(:page => params[:page])\n @title = \"Входящие сообщения\"\n @path = \"index\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def show\n @message = Message.find(params[:id])\n render json: @message\n\n end",
"def index\n @messaging_messages = Messaging::Message.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messaging_messages }\n end\n end",
"def index\n @messages = Message.order(\"time desc\").page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @response_messages = @request_message.response_messages\n respond_to do |format|\n format.html { raise ActionController::RoutingError.new('Not Found') }\n format.json {}\n end\n end",
"def index\n\n if @current_user.admin?\n @v1_messages = V1::Message.all\n else\n @v1_messages = V1::Message.all.where(company_id: @current_user.company.id)\n end\n\n render json: @v1_messages\n end",
"def index\n @messages = Message.all\n respond_to do |format|\n format.html { render :index }\n format.json { render :json => @messages}\n end\n end",
"def show\n @pmessage = Pmessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pmessage }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :_message }\n end\n end",
"def index\n render json: Message.all\n end",
"def index\n @mod_messages = ModMessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mod_messages }\n end\n end",
"def get_message_by_id(project_id, queue_name, message_id, opts = {})\n \n # verify the required parameter 'project_id' is set\n raise \"Missing the required parameter 'project_id' when calling get_message_by_id\" if project_id.nil?\n \n # verify the required parameter 'queue_name' is set\n raise \"Missing the required parameter 'queue_name' when calling get_message_by_id\" if queue_name.nil?\n \n # verify the required parameter 'message_id' is set\n raise \"Missing the required parameter 'message_id' when calling get_message_by_id\" if message_id.nil?\n \n\n # resource path\n path = \"/{project_id}/queues/{queue_name}/messages/{message_id}\".sub('{format}','json').sub('{' + 'project_id' + '}', project_id.to_s).sub('{' + 'queue_name' + '}', queue_name.to_s).sub('{' + 'message_id' + '}', message_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['oauth_token']\n response = Swagger::Request.new(:GET, path, @host, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :token => token}).make.body\n obj = SingleMessage.new() and obj.build_from_hash(response)\n end",
"def show\n @message = Message.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def destroy\n @project_message = ProjectMessage.find(params[:id])\n @project_message.destroy\n\n respond_to do |format|\n format.html { redirect_to project_messages_url }\n format.json { head :no_content }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @message = Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def show\n @text_message = TextMessage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_message }\n end\n end",
"def show\n authorize! :read, Message\n @messages = Message.find_conversation(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def index\n #@messages = Message.all\n \n @messages = Message.page(params[:page]).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = current_user.received_messages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n @messages = current_user.received_messages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages }\n end\n end",
"def index\n\n if params[:user_id]\n @messages = Message.where(:user_id => params[:user_id].to_i)\n else\n @messages = Message.all\n end\n if params[:page] and params[:per_page]\n @messages = @messages.paginate(:per_page=>params[:per_page].to_i,:page=>params[:page].to_i).order(\"id desc\")\n @page = params[:page]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :messages }\n end\n end",
"def message_list(project_id, category_id=nil)\n url = \"/projects/#{project_id}/msg\"\n url << \"/cat/#{category_id}\" if category_id\n url << \"/archive\"\n \n records \"post\", url\n end",
"def index\n\t\t@messages = Message.where(:to_user => current_user.id)\n\t\trespond_with(@messages) \n\tend",
"def read_all_messages\n post(\"/api/read_all_messages\")\n end",
"def show\n @home_searches_message = Home::Searches::Message.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_searches_message }\n end\n end",
"def show\n @topic = Topic.find(params[:id])\n @messages = @topic.messages.order(\"created_at DESC\")\n @message = Message.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @topic }\n end\n end",
"def get_messages\n \tuser = User.find(params[:user_id]);\n \tif user\n \t\tmessages = Message.where(message_type: user.user_type)\n \t\tconversation = Conversation.where(request_id: params[:request_id])\n texts = []\n conversation.each{ |msg| texts.push(Message.find_by(id: msg.message_id) ? Message.find(msg.message_id) : {})}\n \t\trender json: {messages: messages, conversation: conversation, texts: texts}\n \telse\n\t\trender json: {error: 'User not found.'}\n \tend\n end",
"def get_all\n if @messages = Message.all\n render json: @messages\n else\n render json: \"Error!\"\n end\n\n end",
"def index\n phone_number = params[:phone_number]\n\n response = Faraday.get \"#{BASE_URL}/api/v1/getMessages/#{phone_number}\", nil, {'Authorization': \"Bearer \"}\n\n @data = {\n phone_number: phone_number\n }\n\n if response.status === 200\n response_body = JSON.parse(response.body)\n @data[:messages] = response_body['messages']['items']\n end\n\n render json: @data\n end",
"def index\n raise ApiAccessEvanta::PermissionDenied unless AppSettings::Value.new(:messages, user: current_user).on?\n @messages = Message.get_message_list(current_user)\n render json: @messages\n end",
"def show\n respond_with @project do |format|\n format.json do\n render json: @project.as_json.merge(\n commits_url: project_commits_url(@project, format: 'json'),\n commits: @project.commits.order('committed_at DESC').limit(10).map { |commit|\n commit.as_json.merge(\n percent_done: commit.fraction_done.nan? ? 0.0 : commit.fraction_done*100,\n translations_done: commit.translations_done,\n translations_total: commit.translations_total,\n strings_total: commit.strings_total,\n import_url: import_project_commit_url(@project, commit, format: 'json'),\n sync_url: sync_project_commit_url(@project, commit, format: 'json'),\n url: project_commit_url(@project, commit),\n status_url: project_commit_url(@project, commit),\n )\n }\n )\n end\n end\n end",
"def show\n\t\t@project = Project.accessible(current_user).find_by_name(params[:project_id])\n\t\traise \"There is no such project.\" unless @project.present?\n\n\t\t@job = Job.find(params[:id])\n\t\t@messages_grid = initialize_grid(@job.messages,\n\t\t\torder: :created_at,\n\t\t\tper_page: 10\n\t\t)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @job }\n\t\tend\n\tend",
"def show\n authorize @rcable\n @message = @rcable.messages.new\n @messages = @rcable.messages.order(created_at: :desc).paginate(page: params[:page], per_page: 20)\n end",
"def messages_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MessagesApi.messages_get ...'\n end\n # resource path\n local_var_path = '/messages'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'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'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiKey']\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 => 'MessagesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MessagesApi#messages_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n messages = Message.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message }\n end\n end",
"def get_new_messages\n get_messages_link_and_content\n end",
"def index\n @messages = Message.find_all_by_user_id(session[:user_id], :order => \"timestamp DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @messages }\n end\n end",
"def show\n @message_log = MessageLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_log }\n end\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end",
"def index\n @messages = Message.all\n end"
] |
[
"0.7161965",
"0.7043464",
"0.6896931",
"0.68699974",
"0.6760796",
"0.6629397",
"0.66057634",
"0.65428597",
"0.65428597",
"0.65364516",
"0.65329796",
"0.647289",
"0.6470949",
"0.646479",
"0.64640623",
"0.64599264",
"0.64507496",
"0.64480793",
"0.6445571",
"0.63953716",
"0.6390561",
"0.6386258",
"0.6352564",
"0.6325433",
"0.63037735",
"0.63029385",
"0.62708205",
"0.6269993",
"0.62692505",
"0.626759",
"0.6267211",
"0.62647283",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62646097",
"0.62622154",
"0.62485296",
"0.6228808",
"0.6222768",
"0.6221995",
"0.61851156",
"0.61665994",
"0.6165984",
"0.6162958",
"0.61407745",
"0.61266965",
"0.6122249",
"0.6117073",
"0.6114995",
"0.6112726",
"0.61095613",
"0.61095065",
"0.61060166",
"0.610286",
"0.6101569",
"0.60857695",
"0.6084038",
"0.6078806",
"0.6075635",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199",
"0.6063199"
] |
0.76166475
|
0
|
GET /project_messages/new GET /project_messages/new.json
|
def new
@project_message = ProjectMessage.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @project_message }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @message = Message.new\n @projects = Project.all\n @pems = Pem.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message = current_user.messages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def create\n @project_message = ProjectMessage.new(params[:project_message])\n\n respond_to do |format|\n if @project_message.save\n format.html { redirect_to @project_message, notice: 'Project message was successfully created.' }\n format.json { render json: @project_message, status: :created, location: @project_message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @message = Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @message }\n end\n end",
"def new\n @message = Message.new\n\n render json: @message\n end",
"def new\n @pmessage = Pmessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pmessage }\n end\n end",
"def new\n @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 @project = Project.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 # we don't want to use /messages/new, always use root path /\n flash.keep and redirect_to root_path and return unless request.fullpath == root_path\n\n @message = Message.new\n @show_editable_fields = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @project = Project.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 @text_message = TextMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_message }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.json { render json: @project }\n format.html # new.html.erb\n end\n end",
"def new\n @project = Project.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 @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 @project = Project.new\n\n respond_to do |format|\n format.html\n format.json { render json: @project }\n end\n end",
"def new_project\n @topic = ProjectTopic.new\n respond_to do |format|\n format.html { render 'form' }\n format.json { render json: @topic }\n end\n end",
"def new\n @message = Message.new\n @users = User.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @message_pattern = MessagePattern.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_pattern }\n end\n end",
"def new\n @message_field = MessageField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_field }\n end\n end",
"def new\n @campaign = Campaign.find(params[:campaign_id])\n @project = @campaign.projects.new(params[: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_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 new\n @message_post = MessagePost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_post }\n end\n end",
"def new\n @message_log = MessageLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_log }\n end\n end",
"def new\n @message_template = @company.message_templates.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_template }\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 @message = Message.new\n @message.signature = 1\n @message.send_date = Date.today\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @users = User.all\n @groups = Group.all\n @message = Message.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @mod_message = ModMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mod_message }\n end\n end",
"def new\n @project_template = ProjectTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_template }\n end\n end",
"def new\n @message = Message.new\n \n respond_to do |format|\n format.html # new.html.erb \n end\n end",
"def new\n @unfinished_project = UnfinishedProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unfinished_project }\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 create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to new_message_url, notice: t(\"messages.created\") }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @ourproject = Ourproject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ourproject }\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 @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 @current_project = CurrentProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @current_project }\n end\n end",
"def new\n @messaging_message = Messaging::Message.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @messaging_message }\n end\n end",
"def new\n @project = Project.new\n\n respond_to do |format|\n format.html { render layout: 'project'}\n format.json { render json: @project }\n end\n end",
"def new\n @file_project = FileProject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @file_project }\n end\n end",
"def new\n @project = Project.new\n \n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @new_project = Project.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_project }\n end\n end",
"def new\n @room_message = RoomMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @room_message }\n end\n end",
"def new\n @projectcontact = Projectcontact.new\n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projectcontact }\n end\n end",
"def new\n @minimessage = Minimessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @minimessage }\n end\n end",
"def new\n @project = Project.find(params[:project_id])\n @project_entry = ProjectEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_entry }\n end\n end",
"def new\n @conversation = Conversation.new\n logger.debug \"In new!\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversation }\n end\n end",
"def new\n @project_detail = ProjectDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_detail }\n end\n end",
"def new\n @messages_comment = MessagesComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @messages_comment }\n end\n end",
"def new\n @projects_person = ProjectsPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projects_person }\n end\n end",
"def new\n @project = @client.projects.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @project }\n end\n end",
"def new_project\n @request = Request.new(data_type: :project)\n @request.build_contact\n @request.build_project\n @request.build_general_information\n\n render 'new'\n end",
"def new\n authenticate_user!\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n @message = Message.new\n respond_with @message\n end",
"def new\n @project = Project.create\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def new\n # Agrega el breadcrumb de la pagina new de proyecto\n add_breadcrumb I18n.t('project.new'), :controller => \"projects\", :action => \"new\"\n @project = Project.new\n end",
"def new\n @admin_message = AdminMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_message }\n end\n end",
"def new\n @project_comment = ProjectComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @project_comment }\n end\n end",
"def new\n @message = Message.new(:relation_id => params[:relation_id], :user_id => params[:user_id], :sent => false)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def new\n @notice = @person.notices.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\n end\n end"
] |
[
"0.79634416",
"0.76264054",
"0.76264054",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.7605502",
"0.75653803",
"0.7558802",
"0.7540075",
"0.75227493",
"0.7456403",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.74190795",
"0.7400848",
"0.73860806",
"0.7377634",
"0.73528755",
"0.7349263",
"0.7317734",
"0.7299431",
"0.7265609",
"0.72513735",
"0.72429335",
"0.72003925",
"0.71823126",
"0.71815205",
"0.71784794",
"0.715984",
"0.71454066",
"0.71452457",
"0.713755",
"0.7130558",
"0.7118477",
"0.7079401",
"0.7073744",
"0.70649135",
"0.70642877",
"0.70607966",
"0.70292634",
"0.7008303",
"0.70039845",
"0.7003626",
"0.7003533",
"0.69942886",
"0.699169",
"0.69896764",
"0.6985255",
"0.69765925",
"0.6949532",
"0.6939335",
"0.6938191",
"0.69328403",
"0.6930306",
"0.691906",
"0.68977857",
"0.68968076",
"0.6892551",
"0.6890284",
"0.6887331",
"0.68862087",
"0.686475",
"0.6856332",
"0.68514484",
"0.6851001",
"0.6848796"
] |
0.8406446
|
0
|
POST /project_messages POST /project_messages.json
|
def create
@project_message = ProjectMessage.new(params[:project_message])
respond_to do |format|
if @project_message.save
format.html { redirect_to @project_message, notice: 'Project message was successfully created.' }
format.json { render json: @project_message, status: :created, location: @project_message }
else
format.html { render action: "new" }
format.json { render json: @project_message.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @message = Message.new(params[:message])\n \n @message.project=Project.find(params[:pid])\n @message.project.pem=Pem.find(params[:pemids])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @project_message = ProjectMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_message }\n end\n end",
"def create\n message = Message.new(message_params)\n message.message = params[:message_text]\n message.display_name = params[:display_name]\n message.save!\n render json: message\n end",
"def create\n @message = @app_thread.messages.new(message_params)\n @message.user_id = @user.id\n\n respond_to do |format|\n if @message.save\n format.js {}\n format.html { redirect_to user_project_app_thread_url(@user, @project, @app_thread), notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { redirect_to user_project_app_thread_url(@user, @project, @app_thread), notice: @message.errors.full_messages.inspect }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n if @message.save\n render json: @message, status: :created, location: [:api, @message]\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def post_messages(project_id, queue_name, opts = {})\n \n # verify the required parameter 'project_id' is set\n raise \"Missing the required parameter 'project_id' when calling post_messages\" if project_id.nil?\n \n # verify the required parameter 'queue_name' is set\n raise \"Missing the required parameter 'queue_name' when calling post_messages\" if queue_name.nil?\n \n\n # resource path\n path = \"/{project_id}/queues/{queue_name}/messages\".sub('{format}','json').sub('{' + 'project_id' + '}', project_id.to_s).sub('{' + 'queue_name' + '}', queue_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = Swagger::Request.object_to_http_body(opts)\n \n auth_names = ['oauth_token']\n response = Swagger::Request.new(:POST, path, @host, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :token => token}).make.body\n obj = MessageIdList.new() and obj.build_from_hash(response)\n end",
"def application_params\n params.permit(:project_id, :message)\n end",
"def create\n @message = Message.new(message_params)\n\n if @message.save\n render json: @message, status: :created, location: @message\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def create\n @message = Message.new(message_params)\n\n if @message.save\n render json: @message, status: :created, location: @message\n else \n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end",
"def create\n @message = Message.new(message_params)\n\n if @message.save\n @user = User.find(@message.user_id)\n @user.messages << @message\n render json: @message, status: :created\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def new\n @message = Message.new\n @projects = Project.all\n @pems = Pem.all\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end",
"def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to new_message_url, notice: t(\"messages.created\") }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def message_params\n params.require(:message).permit(:project, :description, :name, :email_address, :listen_online, :send_suggestions, :types)\n end",
"def create\n @message = Message.new(post_params)\n respond_to do |format|\n if @message.save\n flash[:success] = \"문자가 성공적으로 업로드 되었습니다.\"\n format.html { render :show}\n else\n flash[:error] = \"부족한 곳을 채워주세요\"\n format.html { render :new}\n format.json { render json: @message.errors }\n end\n end\n end",
"def message_list(project_id, category_id=nil)\n url = \"/projects/#{project_id}/msg\"\n url << \"/cat/#{category_id}\" if category_id\n url << \"/archive\"\n \n records \"post\", url\n end",
"def create\n\n @message = current_user.messages.new(message_params)\n\n if @message\n respond_to do |format|\n if @message.save\n # debugger\n format.html do\n redirect_to @message, notice: 'Message was successfully created.'\n end\n format.json { render :_message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @message = Message.new(params[:message])\n @message.user_id = current_user.id\n \n respond_to do |format|\n if @message.save\n format.json { render json: @message, status: :created}\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n respond_to do |format|\n if @message.save\n format.json {render json: :created}\n else\n format.json {render json: \"not created\"}\n end\n end\n end",
"def create\n @message = @conversation.messages.build(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to conversation_messages_path(@conversation), notice: 'メッセージを送信しました。' }\n format.json { render :show, status: :created, location: conversation_messages_path(@conversation) }\n else\n format.html { render :index }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_message(user_id, recipient_id, token , subject, message)\n response = self.class.post('/messages', body: { \"user_id\": user_id, \"recipient_id\": recipient_id,\"token\": token , \"subject\": subject, \"stripped-text\": message }, headers: { \"authorization\" => @auth_token })\n puts response\n\n end",
"def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end",
"def message(user, text)\n post('/direct_messages/new.json', :user => user, :text => text)\n end",
"def send\n inf = params.permit(:to, :from, :time, :priority, :message, :til)\n message = Message.new\n message.user = current_user\n message.entered = DateTime.now.in_time_zone\n message.year = DateTime.now.in_time_zone.year\n\n message.to = inf[:to]\n message.from = inf[:from]\n message.message_time = inf[:time]\n message.priority = inf[:priority]\n message.message = inf[:message]\n message.til = inf[:til]\n\n unless message.save\n render json: {message: @message.errors}.to_json, \\\n status: :unprocessable_entity\n end\n\n render json: {message: 'Success'}.to_json, status: 200\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message crée avec succès.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n create_message(params)\n end",
"def create\n message = Message.new(message_params)\n message.messager = current_user\n\n if message.valid?\n message.save!\n render json: MessageSerializer.new(message).serialize\n else\n render json: { errors: message.errors.messages }, status: 422\n end\n end",
"def create\n @message = Message.new(message_params)\n @message.message_type = 'Reqular Message `'\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post( text )\n message = {\n 'time' => Time.now.strftime('%Y%m%d%H%M%S'),\n 'text' => text\n }\n\n data['plans'][me]['messages'] << message\n end",
"def create\n @message = Message.new(message_params)\n @message.sent_at = Time.now\n if @message.save\n render text: 'message successfully created.', status: :created\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def create\n @pmessage = Pmessage.new(params[:pmessage])\n\n respond_to do |format|\n if @pmessage.save\n format.html { redirect_to @pmessage, notice: 'Pmessage was successfully created.' }\n format.json { render json: @pmessage, status: :created, location: @pmessage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pmessage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_create\n @message = Message.new\n @message.user_id = params[:message][:user_id]\n @message.room_id = params[:message][:room_id]\n @message.content = params[:message][:content]\n @message.save\n\n #Generate de js to publish\n jsScript = createMessage(@message)\n PrivatePub.publish_to(\"/rooms/#{@message.room_id}\", jsScript)\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.json { render json: @message}\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n if @message.save\n render json: { \"status\": \"success\" }, status: 200\n else\n render json: {}, status: 401\n end\n end",
"def message_params\n params.require(:message).permit(:text, :task_id)\n end",
"def create\n @message = Message.new(message: params[:message_content], from_id: current_user.id, to_id: params[:to_id])\n respond_to do |format|\n if @message.save\n format.html { redirect_to user_path(@message.to_id), notice: 'Message was successfully sent.' }\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @message = Message.new(message_params)\n @message.types = params['types']\n\n respond_to do |format|\n if @message.save\n # Send an email to the appropriate place\n if params['contact_type'] == 'project'\n ContactMailer.project_request(@message).deliver_now\n ContactMailer.project_request_confirmation(@message).deliver_now\n else\n ContactMailer.contact_request.deliver_later\n end\n\n format.html { redirect_to @message, notice: ' Message was successfully created.', style: 'success' }\n format.json { render :show, status: :created, location: @message }\n else\n if params['contact_type'] == 'project'\n format.html { render template: 'messages/_form_project_request' }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def create\n @message = Message.new(params[:message])\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @room = Room.find_or_create_by(room_params)\n @message = @room.messages.new(message_params)\n\n if @message.save\n render json: @message, status: :created, location: [@room, @message]\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def create\n @message = @ride_request.messages.new(message_params)\n @message.user = current_user\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to :back, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :back }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n inbound_messages.each(&:save)\n render :nothing => true, :status => 200\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @channel = Channel.find(params[:channel_id])\n @message = @channel.messages.build(message_params)\n\n respond_to do |format|\n if @message.save\n format.json { render json: @message, status: :created }\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to admin_message_path(@message), notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(params[:message])\n @status = if @message.save then\n @message \n else\n render :json=> @message, :status=> :unprocessable_entity\n end\n end",
"def create\n @message = Message.new(message_params)\n @message.sender_id = current_user.id\n @message.recipient_id = params[:recipient_id]\n\n respond_to do |format|\n if @message.save\n flash[:notice] = \"Mesaj gönderildi.\"\n format.json { render json: {success: true} } \n # Pusher.trigger('private-'+params[:recipient_id],'new_message', {:from => current_user.name, \n # :subject => @message.subject})\n else\n flash[:error] = \"Mesaj gönderilemedi.\"\n redirect_to '/'\n end\n end\n end",
"def create\n @message_field = MessageField.new(params[:message_field])\n\n respond_to do |format|\n if @message_field.save\n format.html { redirect_to @message_field, notice: 'Message field was successfully created.' }\n format.json { render json: @message_field, status: :created, location: @message_field }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message_field.errors, status: :unprocessable_entity }\n end\n end\n end",
"def message(message)\n render json: {\n message: message,\n status: :success\n }, status: 200\n end",
"def create\n @message = Message.new(message_params)\n \n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully sent.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render action: 'show', status: :created, location: @message }\n else\n format.html { render action: 'new' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n create_message(params)\n end",
"def create\n @internal_message = InternalMessage.new(internal_message_params)\n\n respond_to do |format|\n if @internal_message.save\n format.html { redirect_to @internal_message, notice: 'Internal message was successfully created.' }\n format.json { render :show, status: :created, location: @internal_message }\n else\n format.html { render :new }\n format.json { render json: @internal_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @response_message = ResponseMessage.new(response_message_params)\n @response_message.request_message = @request_message\n respond_to do |format|\n if @response_message.save\n format.html { redirect_to @request_message, notice: 'Response message was successfully created.' }\n format.json { render :show, status: :created, location: @response_message }\n else\n format.html { render :new }\n format.json { render json: @response_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @form_message = FormMessage.new(form_message_params)\n respond_to do |format|\n if @form_message.save\n ContactQueryMailer.new_contact_query(@form_message).deliver_now\n format.html { redirect_to root_path, notice: 'Thanks for contacting us. We’ll get back to you in the next 12 hours.' }\n format.json { render :root, status: :created, location: @form_message}\n else\n format.html { render :new }\n format.json { render json: @form_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_message = Admin::Message.new(admin_message_params)\n\n respond_to do |format|\n if @admin_message.save\n format.html { redirect_to @admin_message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @admin_message }\n else\n format.html { render :new }\n format.json { render json: @admin_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def message_params\n params.require(:message).permit(:date_message, :text_message)\n end",
"def create\n user = User.find_by(token: params[:token])\n new_message_params = {\n text: message_params[:text],\n conversation_id: message_params[:conversation_id],\n user_id: user.id,\n username: user.username\n }\n @message = Message.new(new_message_params)\n conversation = Conversation.find(message_params[:conversation_id])\n\n if @message.save\n # render json: @message, status: :created, location: @message\n serialized_data = ActiveModelSerializers::Adapter::Json.new(\n MessageSerializer.new(@message)\n ).serializable_hash\n MessagesChannel.broadcast_to conversation, serialized_data\n head :ok\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def create\n @group_message = GroupMessage.new(group_message_params)\n\n respond_to do |format|\n if @group_message.save\n format.html { redirect_to @group_message, notice: 'Group message was successfully created.' }\n format.json { render :show, status: :created, location: @group_message }\n else\n format.html { render :new }\n format.json { render json: @group_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n\n respond_to do |format|\n if @message.save\n format.html { redirect_to url_for(action: 'index'), notice: f(@message) }\n format.json { render :show, status: :created, location: url_for(action: 'show', id: @message) }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @project = Project.new(project_params)\n if @project.save\n render json: @project, status: :ok\n else\n render json: {error: @project.errors.full_messages.to_sentence } , status: :unprocessable_entity\n end\n end",
"def create\n @user_message = UserMessage.new(user_message_params)\n\n if @user_message.save\n render :show, status: :created, location: @user_message\n else\n render json: @user_message.errors, status: :unprocessable_entity\n end\n end",
"def post_message(text)\n body ={\n \"title\" => @from_name,\n \"picture\" => @from_picture,\n \"message\" => text\n }\n\n self.class.post(room_path, request_options(body))\n end",
"def message_params\n params.permit(:team_id, :title, :content)\n end",
"def create\n @system_message = SystemMessage.new(system_message_params)\n\n respond_to do |format|\n if @system_message.save\n format.html { redirect_to system_messages_path, notice: 'System message was successfully created.' }\n format.json { render :show, status: :created, location: @system_message }\n else\n format.html { render :new }\n format.json { render json: @system_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \tparams[:message][:group_id] = params[:group_id]\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.save\n \tcurrent_user.sent_messages << @message\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def message_params\n params.permit(:message)\n end",
"def create\n msg = Message.new(message_params)\n msg.user_id = current_user.id\n msg.status = 'closed' if params[:close_tkt]\n respond_to do |format|\n if msg.save\n parent_msg = Message.where(id: msg.message_id).first if msg.message_id\n @message = parent_msg ? parent_msg : msg\n parent_msg ? MessageMailer.new_reply(parent_msg, msg).deliver : MessageMailer.new_message(msg).deliver\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n parent_msg = Message.where(id: msg.message_id).first if msg.message_id\n @message = parent_msg ? parent_msg : msg\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @text_message = TextMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @text_message }\n end\n end",
"def create\n @message = Message.new(message_params)\n @message.user = current_user\n respond_to do |format|\n if @message.save\n format.html { redirect_to root_path, notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\n else\n format.html { render :new }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @home_searches_message = Home::Searches::Message.new(params[:home_searches_message])\n\n respond_to do |format|\n if @home_searches_message.save\n format.html { redirect_to @home_searches_message, notice: 'Message was successfully created.' }\n format.json { render json: @home_searches_message, status: :created, location: @home_searches_message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @home_searches_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_project\n @topic = ProjectTopic.new\n respond_to do |format|\n format.html { render 'form' }\n format.json { render json: @topic }\n end\n end",
"def create\n @project = Project.new(project_params)\n\n render text: params[:project].inspect\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to projects_path, notice: 'Proyecto creado sastifactoriamente' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @message = current_user.messages.build(params[:message])\n\n \n if @message.save\n \n flash[:notice] = \"Message Sent\"\n else \n flash[:notice] = \"Opps.\"\n end\n \n end",
"def message_params\n params.require(:message).permit(:client_id, :content, :severity, :logtime)\n end",
"def create\n @saved_message = SavedMessage.new(saved_message_params)\n\n respond_to do |format|\n if @saved_message.save\n format.html { redirect_to @saved_message, notice: 'Saved message was successfully created.' }\n format.json { render :show, status: :created, location: @saved_message }\n else\n format.html { render :new }\n format.json { render json: @saved_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n message_params = params[:message]\n message_params[:text] = params[:text]\n message = Message.new(\n author_id: current_user.id,\n chat: Chat.find(message_params[:chat_id]),\n parse_mode: message_params[:parse_mode],\n text: (message_params[:text].join \"\\r\\n\\r\\n\")\n )\n message.image = message_params[:image] if message_params[:image].present?\n puts JSON.pretty_generate message.as_json\n message.save!\n redirect_to admin_message_path(message), notice: 'A message has been created'\n # Message.create!(\n # author_id: current_user.id,\n # chat: Chat.find(message_params[:chat_id]),\n # image: message_params[:image],\n # parse_mode: message_params[:parse_mode],\n # text: (message_params[:text].join \"\\r\\n\\r\\n\")\n # )\n end",
"def create\n @project = Project.new(project_params)\n\n if @project.save\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end",
"def create\n @message = Message.new\n @message.create_one!(params[:message])\n #Juggernaut.publish(1, parse_chat_message(params[:message][:message], current_user))\n respond_to do |format|\n format.html { redirect_to :index }\n format.js\n end\n end",
"def post_messages!(hash)\n Net::HTTP.post_form(URI.parse(@target), {'data'=>hash.to_json})\n end",
"def create\n @room_message = RoomMessage.new(params[:room_message])\n\n respond_to do |format|\n if @room_message.save\n format.html { redirect_to @room_message, notice: 'Room message was successfully created.' }\n format.json { render json: @room_message, status: :created, location: @room_message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @room_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_message(token, channel, text, username)\n uri = URI.parse(URL[\"post_msg\"])\n params = { :token => token,\n :channel => channel,\n :text => text,\n :username => username,\n :as_user => true }\n uri.query = URI.encode_www_form( params )\n return JSON.parse( uri.open.read )\n end",
"def messages\n get_json('messages.json')\n end",
"def message_params\n params.require(:message).permit(:text)\n end",
"def create\n @message = Message.new(params[:message])\n\n respond_to do |format|\n if @message.deliver\n format.html { render :thank_you }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@message = Message.create!(params[:message])\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend",
"def message_params\n params.require(:message).permit(:text, :result, :protocol, :response, :recipient, :sender, :url, :token, :appname)\n end",
"def create\n @project = Project.new(params[:project] || JSON.parse(request.body.read))\n\n if (params[:id])\n @project.id = params[:id]\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to(@project, :notice => 'Project was successfully created.') }\n format.xml { render :xml => @project, :status => :created, :location => @project }\n format.json { render :json => @project }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @project.errors, :status => :unprocessable_entity }\n format.json { render :text => \"error creating project via http/json\" }\n end\n end\n end",
"def create\n @conversation = Conversation.new()\n @conversation.sender_email_id = params[:message][:from]\n experience = Experience.find(params[:message][:experience_id])\n user = User.find(experience.user_id)\n @conversation.user_id = user.id\n @conversation.experience_id = experience.id\n @conversation.customer_name = params[:message][:name]\n @message = @conversation.messages.build(message_params)\n @message.to = user.email\n\n respond_to do |format|\n if @conversation.save\n @message.save\n format.json{ render :json => @conversation }\n else\n format.json { render json: @conversation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @message = Message.new(message_params)\n respond_to do |format|\n if @message.save\n\tformat.html { redirect_to subject_path(@message.subject, :page => @message.subject.calculate_page_count), notice: 'Message was successfully created.' }\n format.json { render :show, status: :created, location: @message }\t\n else\n\tsetup_new_message_params\n\tformat.html { render :new }\n\t#format.html { redirect_to new_message_path, notice:'errors'}\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.68976545",
"0.6820342",
"0.67595994",
"0.657837",
"0.65494204",
"0.65420383",
"0.64857656",
"0.6466357",
"0.6457209",
"0.643171",
"0.64138055",
"0.63485736",
"0.63360125",
"0.63187516",
"0.62885374",
"0.6288041",
"0.62687224",
"0.6264546",
"0.62539226",
"0.62458557",
"0.62148434",
"0.6214659",
"0.6214659",
"0.61917335",
"0.6150774",
"0.6148451",
"0.6146715",
"0.6138212",
"0.61226225",
"0.61208296",
"0.6103587",
"0.6098358",
"0.6093358",
"0.6087057",
"0.6086331",
"0.60856175",
"0.6085305",
"0.60827655",
"0.60744846",
"0.60638636",
"0.6041784",
"0.60416013",
"0.6033418",
"0.6031313",
"0.6031313",
"0.6031313",
"0.6031313",
"0.6031313",
"0.6031313",
"0.6031313",
"0.6031313",
"0.6031313",
"0.6031313",
"0.6003155",
"0.5983835",
"0.59707624",
"0.59666884",
"0.59623843",
"0.5959343",
"0.59520024",
"0.5949375",
"0.5942054",
"0.5941749",
"0.59399825",
"0.59390754",
"0.5927285",
"0.5927107",
"0.59160525",
"0.59147453",
"0.590187",
"0.5900381",
"0.58949256",
"0.5886973",
"0.588131",
"0.5879842",
"0.5868238",
"0.5866291",
"0.58605015",
"0.585722",
"0.5856034",
"0.5852643",
"0.58488685",
"0.5841153",
"0.58410734",
"0.5838963",
"0.581906",
"0.58180255",
"0.5816832",
"0.5814108",
"0.5812517",
"0.5810426",
"0.5808627",
"0.58072037",
"0.58054173",
"0.5795649",
"0.5793682",
"0.578511",
"0.57811725",
"0.5778568",
"0.5778349"
] |
0.7452937
|
0
|
PUT /project_messages/1 PUT /project_messages/1.json
|
def update
@project_message = ProjectMessage.find(params[:id])
respond_to do |format|
if @project_message.update_attributes(params[:project_message])
format.html { redirect_to @project_message, notice: 'Project message was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @project_message.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @v1_message = V1::Message.find(params[:id])\n\n if @v1_message.update(message_params)\n render json: @v1_message, status: :ok\n else\n render json: @v1_message.errors, status: :unprocessable_entity\n end\n end",
"def update\n message = Message.find(params[:id])\n message.update(message_params)\n render json: message\n end",
"def update\n if @message.update(message_params)\n render json: @message\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def update\n @message = Message.find(params[:id])\n @message.update(text: params[\"_json\"])\n render json: @message\n end",
"def update\n if @message.update(message_params)\n render json: @message, status: :ok\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @message.update(message_params) \n render json: @message, status: :ok, location: @message\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.json {render json: :created}\n else\n format.json {render json: \"not created\"}\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to user_project_app_thread_url(@user,@project,@app_thread), notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { redirect_to user_project_app_thread_url(@user,@project,@app_thread), notice: @message.errors.full_messages.inspect }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n if @message.update_attributes(message_params)\n head :no_content\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def update\n @message = Message.find(params[:id])\n @message.update_attributes(params[:message])\n respond_with(@message)\n end",
"def update\n if @project\n if @project.update(project_params)\n render json: @project, status: :ok\n else\n render json: {error: @project.errors.full_messages.to_sentence } , status: :unprocessable_entity\n end\n else\n render json: {error: \"Project does not exist\"} , status: :unprocessable_entity\n end\n end",
"def update(params = {})\n params ||= {}\n params[:id] = @attributes[:id]\n raise MissingParameterError.new(\"Current object doesn't have a id\") unless @attributes[:id]\n raise InvalidParameterError.new(\"Bad parameter: id must be an Integer\") if params[:id] and !params[:id].is_a?(Integer)\n raise InvalidParameterError.new(\"Bad parameter: project_id must be an Integer\") if params[:project_id] and !params[:project_id].is_a?(Integer)\n raise InvalidParameterError.new(\"Bad parameter: subject must be an String\") if params[:subject] and !params[:subject].is_a?(String)\n raise InvalidParameterError.new(\"Bad parameter: body must be an String\") if params[:body] and !params[:body].is_a?(String)\n raise MissingParameterError.new(\"Parameter missing: id\") unless params[:id]\n raise MissingParameterError.new(\"Parameter missing: project_id\") unless params[:project_id]\n raise MissingParameterError.new(\"Parameter missing: subject\") unless params[:subject]\n raise MissingParameterError.new(\"Parameter missing: body\") unless params[:body]\n\n Api.send_request(\"/messages/#{@attributes[:id]}\", :patch, params, @options)\n end",
"def update\n # find and update a specific message\n end",
"def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, :notice => 'Message was successfully set.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @message.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_back_to messages_path, flash: { success: 'Message was successfully updated.' } }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, :notice => 'Message was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @message.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to @project, notice: 'Project was successfully updated.' }\n format.json { render json: @project.as_json(:include => [:client, :project_participants ] ) }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @text_message = TextMessage.find(params[:id])\n\n respond_to do |format|\n if @text_message.update_attributes(params[:text_message])\n format.html { redirect_to @text_message, notice: 'Text message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @text_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n if params[:name] == \"project_name\"\n project_name = params[:value]\n @project.project_name = project_name\n end\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n\n @projects = Project.all\n format.html {\n render :action => \"index\"\n }\n format.json { render json: @project }\n else\n logMessage = self.class.to_s + \"#\" + __method__.to_s + \" \" + current_user.username + \" errors:\" + @project.errors.full_messages.to_s\n logger.info logMessage\n\n format.html {\n flash[:error] = 'Project was not successfully updated.'\n redirect_to action: \"index\"\n }\n errorMsg = @project.errors.full_messages.to_s.split(\"\\\"\")\n format.json { render json: errorMsg[1], status: 500 }\n end\n end\n end",
"def update\n respond_to do |format|\n if @system_message.update(system_message_params)\n format.html { redirect_to system_messages_path, notice: 'System message was successfully updated.' }\n format.json { render :show, status: :ok, location: @system_message }\n else\n format.html { render :edit }\n format.json { render json: @system_message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message_queue.update(message_queue_params)\n format.html { redirect_to @message_queue, notice: 'Message queue was successfully updated.' }\n format.json { render :show, status: :ok, location: @message_queue }\n else\n format.html { render :edit }\n format.json { render json: @message_queue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: \"Message was successfully updated.\" }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: \"Message was successfully updated.\" }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n # format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n # format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { redirect :back }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # find and update a specific message\n end",
"def update\n # find and update a specific message\n end",
"def update\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to outbox_path, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message = Message.find(params[:id])\n authorize! :update, @message\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: t(\"messages.updated\") }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @project.update(project_params)\n render json: {status: :success, project: @project}\n else\n render json: {status: :failed, project: @project}\n end\n end",
"def update\n if request.headers[\"Authorization\"] == \"Basic 78f91d346838110d9edb6be3996624a9\"\n @message = Message.find(params[:id])\n\n respond_to do |format|\n if @message.update_attributes(params[:message])\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n params.require(:id)\n msg = Message.find(params[:id])\n msg.read = true\n msg.save\n render :json => msg.as_json, status: :ok\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Le message a bien été mis à jour.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @message.update(message_params)\n format.html { redirect_to @message, notice: 'Message was successfully updated.' }\n format.json { render :show, status: :ok, location: @message }\n else\n format.html { render :edit }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n endrender :'messages/create'\n end\n end\n end",
"def update\n authorize! :update, @project\n\n if @project.update(project_params)\n head :no_content\n else\n render 'projects/error', status: 422\n end\n end"
] |
[
"0.6938673",
"0.6773656",
"0.67365515",
"0.67293",
"0.6717503",
"0.6665718",
"0.66467106",
"0.66152567",
"0.6483713",
"0.64349705",
"0.6343872",
"0.63343585",
"0.63289434",
"0.62956613",
"0.62865186",
"0.62662524",
"0.6265127",
"0.6246748",
"0.62433255",
"0.62400305",
"0.6239907",
"0.6239907",
"0.62388533",
"0.62247396",
"0.6223005",
"0.6221267",
"0.62200415",
"0.62200415",
"0.62158865",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.6211213",
"0.62095046",
"0.62087965",
"0.6203906",
"0.62028414",
"0.620281",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.62027675",
"0.6202327",
"0.6202327",
"0.62023115",
"0.6199641",
"0.61968064",
"0.6168632",
"0.6160755",
"0.6160755",
"0.61518604",
"0.61509293",
"0.61501247",
"0.61461884",
"0.61357033",
"0.61308205",
"0.6122302",
"0.6119906"
] |
0.7271294
|
0
|
DELETE /project_messages/1 DELETE /project_messages/1.json
|
def destroy
@project_message = ProjectMessage.find(params[:id])
@project_message.destroy
respond_to do |format|
format.html { redirect_to project_messages_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @v1_message = V1::Message.find(params[:id])\n @v1_message.destroy\n\n head :no_content\n end",
"def destroy\n # delete a specific message\n end",
"def delete\n @client.post('/api/del_msg', id: get_attribute(:name))\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n # delete a specific message\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to user_project_app_thread_url(@user,@project,@app_thread), notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n render json: 'Message was successfully deleted', status: :ok\n end",
"def delete_message(id)\n record \"/msg/delete/#{id}\"\n end",
"def destroy\n @message.destroy\n \n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def delete_messages(project_id, queue_name, opts = {})\n \n # verify the required parameter 'project_id' is set\n raise \"Missing the required parameter 'project_id' when calling delete_messages\" if project_id.nil?\n \n # verify the required parameter 'queue_name' is set\n raise \"Missing the required parameter 'queue_name' when calling delete_messages\" if queue_name.nil?\n \n\n # resource path\n path = \"/{project_id}/queues/{queue_name}/messages\".sub('{format}','json').sub('{' + 'project_id' + '}', project_id.to_s).sub('{' + 'queue_name' + '}', queue_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = Swagger::Request.object_to_http_body(opts)\n \n auth_names = ['oauth_token']\n response = Swagger::Request.new(:DELETE, path, @host, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :token => token}).make.body\n obj = ResponseMessage.new() and obj.build_from_hash(response)\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end",
"def delete_message(message_id)\n RestClient.delete(\"#{@url}/messages/#{message_id}\")\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'message.deleted' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n respond_to do |format|\n format.html { redirect_to noticias_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def message_delete(id)\n request(:delete, \"messages/#{id.to_s}\")\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message_log = MessageLog.find(params[:id])\n @message_log.destroy\n\n respond_to do |format|\n format.html { redirect_to message_logs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_message = AdminMessage.find(params[:id])\n @admin_message.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n head :no_content\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n head :no_content\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to success_path, notice: _('Message deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to [@member, :messages] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @text_message = TextMessage.find(params[:id])\n @text_message.destroy\n\n respond_to do |format|\n format.html { redirect_to text_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n \t\n @message = Message.find(params[:id])\n @message.delete\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @msg.destroy\n respond_to do |format|\n format.html { redirect_to msgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_message.destroy \n respond_to do |format|\n format.html { redirect_to admin_messages_url, notice: \"#{ t 'activerecord.successful.messages.message_deleted' }\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hello_message.destroy\n respond_to do |format|\n format.html { redirect_to hello_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Messages.find(params[:id])\n @message.destroy\n end",
"def destroy\n #@message = Message.find(params[:id])\n #@message.destroy\n #redirect_to projects_path\n current_user.delete_message(ActsAsMessageable::Message.find(params[:id]))\n redirect_to trash_url\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to url_for(action: 'index'), notice: f(@message) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.mark_deleted(current_user)\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @outgoing_message_log = OutgoingMessageLog.find(params[:id])\n @outgoing_message_log.destroy\n\n respond_to do |format|\n format.html { redirect_to outgoing_message_logs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n message = Message.find(params[:id])\n message.destroy\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'El Mensaje ha sido eliminado correctamente!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n\n @message.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Le message a bien été supprimé.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Admin::Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_messages_url) }\n format.xml { head :ok }\n end\n end",
"def delete_message_by_id(project_id, queue_name, message_id, opts = {})\n \n # verify the required parameter 'project_id' is set\n raise \"Missing the required parameter 'project_id' when calling delete_message_by_id\" if project_id.nil?\n \n # verify the required parameter 'queue_name' is set\n raise \"Missing the required parameter 'queue_name' when calling delete_message_by_id\" if queue_name.nil?\n \n # verify the required parameter 'message_id' is set\n raise \"Missing the required parameter 'message_id' when calling delete_message_by_id\" if message_id.nil?\n \n\n # resource path\n path = \"/{project_id}/queues/{queue_name}/messages/{message_id}\".sub('{format}','json').sub('{' + 'project_id' + '}', project_id.to_s).sub('{' + 'queue_name' + '}', queue_name.to_s).sub('{' + 'message_id' + '}', message_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = Swagger::Request.object_to_http_body(opts)\n \n auth_names = ['oauth_token']\n response = Swagger::Request.new(:DELETE, path, @host, {:params => query_params, :headers => header_params, :form_params => form_params, :body => post_body, :token => token}).make.body\n obj = ResponseMessage.new() and obj.build_from_hash(response)\n end",
"def destroy\n @mod_message = ModMessage.find(params[:id])\n @mod_message.destroy\n\n respond_to do |format|\n format.html { redirect_to mod_messages_url }\n format.json { head :no_content }\n end\n end",
"def delete(message_id)\n Mailgun.submit :delete, messages_url(message_id)\n end",
"def destroy\n if request.headers[\"Authorization\"] == \"Basic 78f91d346838110d9edb6be3996624a9\"\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n get_message().delete\n end",
"def destroy\n if @message.destroy\n head :no_content\n else\n render json: @message.errors, status: :unprocessable_entity\n end\n end",
"def destroy\r\n push_notification :remove\r\n @message.destroy\r\n respond_to do |format|\r\n format.html { redirect_to channel_messages_url(@channel) }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @messaging_message = Messaging::Message.find(params[:id])\n @messaging_message.destroy\n\n respond_to do |format|\n format.html { redirect_to messaging_messages_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @system_message = SystemMessage.find(params[:id])\n @system_message.destroy\n\n respond_to do |format|\n format.html { redirect_to system_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to admin_messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notice = Notice.find(params[:id])\n project = @notice.project\n @notice.destroy\n\n respond_to do |format|\n format.html { redirect_to project }\n format.json { head :ok }\n end\n end",
"def destroy\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to(messages_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pmessage = Pmessage.find(params[:id])\n @pmessage.destroy\n\n respond_to do |format|\n format.html { redirect_to pmessages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url, notice: t(:message_destroyed) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to conversations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @home_searches_message = Home::Searches::Message.find(params[:id])\n @home_searches_message.destroy\n\n respond_to do |format|\n format.html { redirect_to home_searches_messages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message = Message.find(params[:id])\n authorize! :destroy, @message\n @message.destroy\n\n respond_to do |format|\n format.html { redirect_to messages_url, notice: t(\"messages.deleted\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @direct_message.destroy\n \n respond_to do |format|\n format.html { redirect_to DirectMessages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message_log.destroy\n respond_to do |format|\n format.html { redirect_to message_logs_url, notice: 'Message log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.json { head :no_content }\n format.js # looks for destroy.js.erb in the views/messages folder\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.747845",
"0.7337599",
"0.7268884",
"0.726298",
"0.7209047",
"0.7188055",
"0.717306",
"0.71701425",
"0.7153404",
"0.7146793",
"0.71298754",
"0.71000135",
"0.71000135",
"0.70876807",
"0.70876807",
"0.70876807",
"0.70876807",
"0.70823574",
"0.7076121",
"0.7071061",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70501685",
"0.70499265",
"0.70452577",
"0.70384663",
"0.70282125",
"0.7013936",
"0.6981826",
"0.69809496",
"0.6979667",
"0.6976751",
"0.6976623",
"0.6975221",
"0.6974401",
"0.6973047",
"0.6966906",
"0.69593143",
"0.6951296",
"0.69427407",
"0.6937259",
"0.6933998",
"0.6931581",
"0.69315773",
"0.6925928",
"0.6918862",
"0.69127357",
"0.6910068",
"0.69075125",
"0.6906889",
"0.690611",
"0.6904064",
"0.69032174",
"0.68966573",
"0.68764263",
"0.68716204",
"0.6868648",
"0.6863587",
"0.685861",
"0.68570226",
"0.6854288",
"0.6852997",
"0.6845751",
"0.6834811",
"0.68322235",
"0.68302417",
"0.6818442",
"0.6816009",
"0.68131334",
"0.6811941",
"0.6811941",
"0.6811941",
"0.6811941",
"0.6811941",
"0.6811941",
"0.6811941",
"0.6811941",
"0.6811941",
"0.6811941",
"0.6811941",
"0.6811941",
"0.6811941"
] |
0.7711854
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_forum_thread
@forum_thread = ForumThread.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 forum_thread_params
params.fetch(:forum_thread, {})
params.inspect
params.require(:forum_thread).permit(:title, :user_id, :body, :unread_posts, :total_posts, :post_time, :anonymous)
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
|
destroys import on remote module and then destroys self
|
def rollback
if self.failed? && !self.rollbacked?
response = RestClient.delete resource_uri, app_key: Contacts::API_KEY
if response.code == 200
self.update_attribute(:status, 'rollbacked')
else
return false
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_local\n super\n end",
"def desist\n self.class.delete self\n end",
"def destroy\n run_callbacks :destroy do\n rpc_execute('unlink', [id], context)\n @destroyed = true\n freeze \n end\n end",
"def reset\n @instance = nil\n @local_env = nil\n end",
"def reset\n @instance = nil\n @local_env = nil\n end",
"def destroy(context={})\n self.class.rpc_execute('unlink', self.id, context)\n end",
"def remove_remote(name)\n self.lib.remote_remove(name)\n end",
"def remove\n unrealize\n remove_from_dependencies\n remove_from_dependents\n end",
"def unlink_local_clone?(type,module_name,version=nil)\n Response.wrap_helper_actions() do\n local_repo_dir = local_repo_dir(type,module_name,version)\n git_dir = \"#{local_repo_dir}/.git\"\n if File.directory?(git_dir)\n FileUtils.rm_rf(git_dir)\n end\n end\n end",
"def tear_down; end",
"def destroy(context={})\n rpc_execute('unlink', [self.id], context)\n end",
"def clear_import_cache\n self.import_cache = {}\n self.import_errors = false\n end",
"def unload\n @structures = []\n @controllers = []\n @helpers = @helpers.is_a?(Array) ? @helpers.select { |h| h.options[:unloadable] == false } : []\n @authenticators = {}\n @shared_actions = {}\n @default_access = nil\n end",
"def unload(inst)\n # If the reference count drops to zero, remove it from the list of\n # loaded plugins. This will indirectly call the cleanup method on the\n # plugin.\n if (inst.deref == true)\n delete(inst)\n end\n end",
"def remove_virus_affected_file()\n @import.destroy\n end",
"def unlink\n self.class.unlink(@path)\n end",
"def unlink\n return if @unlinked\n begin\n File.unlink(@tmpfile.path)\n rescue Errno::ENOENT\n rescue Errno::EACCES\n # may not be able to unlink on Windows; just ignore\n return\n end\n ObjectSpace.undefine_finalizer(self)\n @unlinked = true\n end",
"def cleanup!; end",
"def cleanup!; end",
"def unuse\n @use = nil\n end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def unhook\n Nest.get(base_module).remove(self)\n Agency.instance.retire(self)\n\n and_return(@original_value) if previously_defined?\n\n @original_value = @previously_defined = nil\n self\n end",
"def destroy(sym)\n klass = get_plugin sym\n @klasses.delete klass\n remove_const canonize sym\n end",
"def remove_old_package\n template_files.clear\n test_cases.clear\n self.import_job = nil\n end",
"def clear_dependencies\n if self == ActiveRecord::Base.acl_manager.initial_destroy\n ActiveRecord::Base.acl_manager.destroy_pool = []\n ActiveRecord::Base.acl_manager.initial_destroy = nil\n end\n end",
"def destroy\n\t\tFile.delete @filepath\n\t\t@data_base = nil\n\t\t@data_base.freeze\n\t\tself.freeze\n\tend",
"def unlink\n self.transaction do\n self.class.factory.model.connection.execute <<-SQL\n ALTER TABLE #{name} NO INHERIT #{self.class.factory.model.table_name};\n ALTER TABLE #{name} RENAME TO #{name}_unlinked;\n SQL\n self.destroy\n end\n end",
"def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end",
"def unsave_module(valid_uni_module)\n uni_modules.delete(valid_uni_module)\n end",
"def destroy_and_undefine\n # Shamb0_TODO_20200609=>POC/WT-bringup\n # old_net = @virt.lookup_network_by_name(@net_name)\n # old_net.destroy if old_net.active?\n # old_net.undefine\n rescue StandardError\n # Nothing to clean up\n end",
"def tear_down\n self.instance.tear_down unless self.instance.nil?\n self.instance = nil\n end",
"def remove_via_api!\n QA::Runtime::Logger.debug(\"#{self.class.name} - deferring removal until after suite\")\n end",
"def unbind; end",
"def cleanup!(h)\n Sudo::System.kill h[:pid]\n Sudo::System.unlink h[:socket]\n end",
"def destroy\n delete\n freeze\n end",
"def finalize()\n # below function is not yet fully functional\n unlock_all_instances()\n end",
"def destroy_from_proto\n destroy\n end",
"def unlink\n # keep this order for thread safeness\n begin\n File.unlink(@tmpname) if File.exist?(@tmpname)\n @@cleanlist.delete(@tmpname)\n @data = @tmpname = nil\n ObjectSpace.undefine_finalizer(self)\n rescue Errno::EACCES\n # may not be able to unlink on Windows; just ignore\n end\n end",
"def remove!\n begin\n connection.sync_clock\n connection.delete_object(bucket, File.join(remote_path, remote_file))\n rescue Excon::Errors::SocketError; end\n end",
"def stop(*)\n @module_started = false\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def unfreeze(&block); end",
"def unload_target!\n listeners_for(:before_load_target).each(&:before_load_target)\n clear_dynamic_resources\n clear_dynamic_resources(:static)\n Origen::Pins.clear_pin_aliases\n $dut = nil\n end",
"def destroy\n kill\n reset\n end",
"def cleanup_hook; end",
"def destroy_import_data\n Managers::MVideo.new(self).delete_localization_folder\n end",
"def delete\n rpc_execute('unlink', [id], context) if persisted?\n @destroyed = true\n freeze\n end",
"def cleanup\n\t\tcleanup_ssh\n\n\tend",
"def teardown\n #commented this out because it is now unnecessary\n # @api = nil\n #GC.start\n @api.close_api\n # @server.close\n end",
"def rest__delete_remote\n remote_module_name = ret_non_null_request_params(:remote_module_name)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n\n remote_params = remote_params_dtkn(:test_module, remote_namespace, remote_module_name)\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n\n project = get_default_project()\n TestModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n rest_ok_response\n end",
"def unbind(url)\n @allocations.delete(url)\n @http_server.unmount(url)\n @http_server.remap\n end",
"def unload!\n Origen.app.unload_target!\n end",
"def unfreeze; end",
"def remove(plugin); end",
"def unbind() end",
"def clear_remote\n execute(:rm, '-rf', File.join(remote_cache_path, '*')) if test!(\"[ -d #{remote_cache_path} ]\")\n end",
"def rest__delete_remote\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n version = ret_request_params(:version)\n\n opts = {}\n opts.merge!(namespace: remote_namespace) unless remote_namespace.empty?\n\n remote_namespace, remote_module_name = Repo::Remote.split_qualified_name(ret_non_null_request_params(:remote_module_name), opts)\n remote_params = remote_params_dtkn(:component_module, remote_namespace, remote_module_name, version)\n\n project = get_default_project()\n response = ComponentModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n\n rest_ok_response response\n end",
"def cleanup\n super\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def rm(*path)\n super; on_success{ nil }\n end",
"def destroy\n super\n parent.unlist_item(@sym)\n end",
"def cleanup\n super\n disconnect\n end",
"def cleanup\r\n end",
"def rest__delete_remote\n remote_module_name = ret_non_null_request_params(:remote_module_name)\n remote_namespace = ret_request_params(:remote_module_namespace)\n force_delete = ret_request_param_boolean(:force_delete)\n\n remote_params = remote_params_dtkn(:node_module, remote_namespace, remote_module_name)\n client_rsa_pub_key = ret_request_params(:rsa_pub_key)\n project = get_default_project()\n\n NodeModule.delete_remote(project, remote_params, client_rsa_pub_key, force_delete)\n rest_ok_response\n end",
"def unloading_dup\n d = dup\n d.unload!\n yield d if block_given?\n d\n end",
"def cleanup\n begin\n File.unlink(File.join(Restore::Config.socket_dir, 'restore_backend.sock'))\n rescue => e\n BackgrounDRb::ServerLogger.log_exception('server', e)\n end\n end",
"def unlink\n @generator.unlink\n end",
"def pop\n orphan_resource(super)\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n return unless @dst\n\n @dst.unlink\n @dst = nil\n end",
"def cleanup\n super\n end",
"def unshare_library(repo_id,share_type,user,group_id)\n delete_unshare_library(repo_id,share_type,user,group_id)\n end",
"def destroy_remote(options = {}, &block)\n raise MotionModelResource::URLNotDefinedError.new \"URL is not defined for #{self.class.name}!\" unless self.class.respond_to?(:url)\n \n model = self\n\n BW::HTTP.delete(save_url, {payload: options[:params]}) do |response|\n if response.ok? || options[:force] == true\n model.delete\n end\n\n block.call if block.present? && block.respond_to?(:call)\n end\n end",
"def unref\n UV.unref(@handle)\n end",
"def close\n\t\t\tcleanup_abstraction\n\t\tend",
"def cleanup!\n # This method may be left unimplemented if that is applicable\n end",
"def cleanup\n # override and do something appropriate\n end",
"def delete_tunnel\n super\n end",
"def destroy\n if self.class.cfg_name == \"server\"\n begin\n ip = canonicalIP\n MU::Master.removeIPFromSSHKnownHosts(ip) if ip\n if @deploy and @deploy.deployment and\n @deploy.deployment['servers'] and @config['name']\n me = @deploy.deployment['servers'][@config['name']][@mu_name]\n if me\n [\"private_ip_address\", \"public_ip_address\"].each { |field|\n if me[field]\n MU::Master.removeIPFromSSHKnownHosts(me[field])\n end\n }\n if me[\"private_ip_list\"]\n me[\"private_ip_list\"].each { |private_ip|\n MU::Master.removeIPFromSSHKnownHosts(private_ip)\n }\n end\n end\n end\n rescue MU::MuError => e\n MU.log e.message, MU::WARN\n end\n end\n if !@cloudobj.nil? and !@cloudobj.groomer.nil?\n @cloudobj.groomer.cleanup\n elsif !@groomer.nil?\n @groomer.cleanup\n end\n if !@deploy.nil?\n if !@cloudobj.nil? and !@config.nil? and !@cloudobj.mu_name.nil?\n @deploy.notify(self.class.cfg_plural, @config['name'], nil, mu_name: @cloudobj.mu_name, remove: true, triggering_node: @cloudobj, delayed_save: @delayed_save)\n elsif !@mu_name.nil?\n @deploy.notify(self.class.cfg_plural, @config['name'], nil, mu_name: @mu_name, remove: true, triggering_node: self, delayed_save: @delayed_save)\n end\n @deploy.removeKitten(self)\n end\n # Make sure that if notify gets called again it won't go returning a\n # bunch of now-bogus metadata.\n @destroyed = true\n if !@cloudobj.nil?\n def @cloudobj.notify\n {}\n end\n else\n def notify\n {}\n end\n end\n end",
"def unload!\n @versions = nil\n @version_json = {}\n @last_update = {}\n @maps = {}\n @mappings = nil\n end",
"def destroy\n requires :ip\n remove(:release => true)\n end",
"def uninstall(env); end",
"def cleanup\n cleanup_unpack_path\n cleanup_download_path\n end",
"def destroy(inst)\n self.class.destroy inst\n end",
"def destroy(_state)\n workflow do\n run_destroy.bind do\n remove_instance_directory\n end\n end\n end",
"def lounge\n self.resource = @resource = resource_class.to_adapter.get!(send(:\"current_#{resource_name}\").to_key)\n yield(:success,resource) if block_given?\n end",
"def remove_dynamic_loadable_module(opts)\n opts = check_params(opts,[:mod_info])\n super(opts)\n end",
"def unmanage window\n if h=managed[window]\n h[:source_funcs].each do |sf|\n sf.remove()\n end\n \n managed.delete window\n end\n end",
"def unlink_site\n FileUtils.rm_rf(self.absolute_path) if File.exists?(self.absolute_path)\n end",
"def unload\n @all = nil\n end",
"def remove_classes_and_modules\n initialize_classes_and_modules\n end",
"def unlock; end"
] |
[
"0.6391121",
"0.6148912",
"0.6148435",
"0.6027159",
"0.6027159",
"0.6019726",
"0.5977239",
"0.5918988",
"0.59025776",
"0.5877782",
"0.58320504",
"0.58259004",
"0.581805",
"0.58129156",
"0.58129025",
"0.57984436",
"0.5797054",
"0.5766546",
"0.5766546",
"0.57536966",
"0.574283",
"0.574283",
"0.574283",
"0.574283",
"0.57353383",
"0.57309365",
"0.5723144",
"0.5706116",
"0.56867903",
"0.56652355",
"0.56604993",
"0.5659072",
"0.56296414",
"0.56099266",
"0.5604211",
"0.5598195",
"0.55958956",
"0.558689",
"0.55839586",
"0.5583022",
"0.55797315",
"0.55777884",
"0.5577626",
"0.5563308",
"0.5563308",
"0.5563308",
"0.5563308",
"0.5562855",
"0.55586666",
"0.5557165",
"0.5552571",
"0.5551889",
"0.55453604",
"0.5543647",
"0.5543213",
"0.5538401",
"0.55376816",
"0.55312264",
"0.5524035",
"0.55225027",
"0.55177593",
"0.55142593",
"0.5506057",
"0.5502666",
"0.5499022",
"0.5499022",
"0.5499022",
"0.54969645",
"0.54965115",
"0.5489516",
"0.5484706",
"0.54846066",
"0.5482205",
"0.5480443",
"0.5479072",
"0.54705864",
"0.54615045",
"0.54615045",
"0.5458646",
"0.54507947",
"0.54455477",
"0.5441233",
"0.54366964",
"0.54347634",
"0.5433533",
"0.5424731",
"0.54193634",
"0.5418928",
"0.54161906",
"0.54082227",
"0.5400266",
"0.5393389",
"0.5392717",
"0.53913486",
"0.53884065",
"0.5374471",
"0.53627515",
"0.53596705",
"0.53588027",
"0.5358349",
"0.53576654"
] |
0.0
|
-1
|
ContactImportModule (ContactImporter) is always ready
|
def ready?
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def import\n if request.post?\n login = params[:email].to_s\n password = params[:password].to_s\n begin\n case params[:lib]\n when \"gmail.com\"\n @contacts = Contacts::Gmail.new(login, password)\n when \"yahoo.com\"\n @contacts = Contacts::Yahoo.new(login, password)\n when \"yahoo.co.in\"\n @contacts = Contacts::Yahoo.new(login, password)\n when \"hotmail.com\"\n @contacts = Contacts::Hotmail.new(login+\"@hotmail.com\", password)\n when \"aol.in\"\n @contacts = Contacts::Aol.new(login+\"@aol.in\", password)\n else\n @contacts = Contacts::Plaxol.new(login, password)\n end\n @contacts = @contacts.contacts\n\n rescue\n flash.now[:error] = I18n.t('contact.import.error')\n render :action => \"index\"\n return\n end\n for contact in @contacts\n email = params[:lib] == 'hotmail.com' ? contact[0].to_s.strip : contact[1].to_s.strip\n name = params[:lib] == 'hotmail.com' ? contact[1].to_s.strip : contact[0].to_s.strip\n if !ImportedContact.exists?(:email => email, :user_id => current_user.id)\n ImportedContact.new(:user_id => current_user.id, :name => name.to_s, :email => email).save\n end\n end\n redirect_to user_contacts_path(current_user)\n return\n end\n render :action => \"index\"\n end",
"def prepare_pre_import\n end",
"def parse_contacts\n case params[:importer]\n when GMAIL, YAHOO, HOTMAIL\n request.env['omnicontacts.contacts'].map { |c| [c[:email], c[:email]] }.to_json\n when LINKEDIN then fetch_linkedin_contacts\n end\n end",
"def post_import\n end",
"def before_import ; end",
"def request_import\n end",
"def load_contacts\r\n CSV.open('contacts.csv', 'r').readlines.each{|file| file}\r\n end",
"def import\n end",
"def import\n end",
"def import\n end",
"def import\n end",
"def fetch_contacts!\n create_agent\n prepare\n scrape_contacts\n end",
"def import()\n # TODO\n end",
"def import(params)\r\n if lines = params[:contact][:import_text]\r\n lines = params[:contact][:import_text].gsub(\"\\n\", '').split(\"\\r\")\r\n if lines.count >= 2\r\n header_labels = lines[0].split(',')\r\n lines.delete_at(0) # remove the header\r\n\r\n lines.each do |line|\r\n fields = line.split(',') # get fields\r\n\r\n if fields.count >= 5 # skip blank lines and short data\r\n name = fields[0].split(' ') # split name into first name and last name\r\n first_name = name[0] # address books can be a mess, so we're just assuming first name is first.\r\n last_name = '' # Assume no last name is provided.\r\n\r\n # If the name is something like \"John Van Burk\" then the first name will be \"John\" and the last name \"Van Burk\"\r\n if name.count >= 2\r\n last_name = name[1..-1].join(' ') # concat rest of name data.\r\n end\r\n\r\n # The google contacts export will have phone numbers like this:\r\n # Home,<home phone #>,\r\n # Work,<work phone #>,\r\n # Mobile,<cell phone #>,\r\n # If there's multiple phone #'s for a category, they will appear as <phone #> ::: <phone #> (yes, literally \" ::: \" with the spaces.)\r\n # Example:\r\n # Emma,,,Emma,,,,,,,,,,,,,,,,,,,,,,,* My Contacts,,,Home,5183290085,Mobile,5188211924 ::: 8577531441,,,,\r\n\r\n work_phone = get_phone('Work', header_labels, fields)\r\n home_phone = get_phone('Home', header_labels, fields)\r\n cell_phone = get_phone('Mobile', header_labels, fields)\r\n email = fields[header_labels.index('E-mail 1 - Value')]\r\n website = fields[header_labels.index('Website 1 - Value')]\r\n\r\n contact = Contact.new({user_id: session[:user_id], first_name: first_name, last_name: last_name, home_phone: home_phone, work_phone: work_phone, cell_phone: cell_phone, email: email, website: website})\r\n contact.save()\r\n end\r\n end\r\n else\r\n flash[:notice] = 'Please provide some data besides the header to import.'\r\n end\r\n else\r\n flash[:notice] = 'Please provide some data to import.'\r\n end\r\n\r\n nil\r\n end",
"def import\n CSV.foreach(@file.path, :converters => :all, :return_headers => false, :headers => :first_row) do |row|\n campaign_id, source, tag, created_at, first_name, last_name,\n email, phone, company, title, status, background_info, comments,\n street1, street2, city, state, zip, country = *row.to_hash.values\n\n #TODO: implement smarter_csv and/or resque\n # https://github.com/tilo/smarter_csv\n # https://github.com/resque/resque\n\n # Rails.logger.info \"XXXXXXXX created_at#{created_at}\"\n\n if @make_contact\n # Don't Allow Duplicates\n contact = Contact.find_or_initialize_by_first_name_and_last_name_and_email(\n first_name,\n last_name,\n email\n ).tap do |contact|\n contact.user_id = @assigned.id,\n contact.source = source,\n contact.first_name = first_name,\n contact.last_name = last_name,\n contact.email = email,\n contact.phone = phone,\n # contact.company = company,\n contact.title = title,\n # contact.status = status,\n contact.background_info = process_bg_info(contact.background_info, background_info),\n contact.created_at = created_at.to_time rescue Time.current\n end\n contact.save!\n\n contact.first_name = \"INCOMPLETE\" if contact.first_name.blank?\n contact.last_name = \"INCOMPLETE\" if contact.last_name.blank?\n # contact.access? = \"Private | Public\"\n contact.access = Setting.default_access\n contact.assignee = @assigned if @assigned.present?\n contact.tag_list.add(tag)\n contact.add_comment_by_user(comments, @assigned)\n\n contact.save!\n\n #TODO: Better validation on address fields.\n if zip\n contact.business_address = Address.new(:street1 => street1, :street2 => street2, :city => city, :state => state, :zipcode => zip, :country => country, :address_type => \"Business\")\n else\n puts \"INCOMPLETE ADDRESS\"\n end\n contact.save!\n\n #\n if contact.account_contact.nil?\n\n if company\n account_name = company\n else\n account_name = contact.first_name + ' ' + contact.last_name + ' (Individual)'\n end\n\n #TODO: rails 4 Account.find_or_initialize_by(name: account_name)\n account = Account.find_or_initialize_by_name(account_name).tap do |account|\n account.user_id = @assigned.id\n account.assignee = @assigned if @assigned.present?\n account.access = contact.access\n account.category = 'customer'\n end\n account.save!\n\n contact.account_contact = AccountContact.new(:account => account, :contact => contact)\n\n # Rails.logger.info \"XXXXXXXX ACCOUNT CONTACT CREATED! #{contact.account_contact.inspect}\"\n\n # contact_account = { account: { id: account.id }, access: contact.access }\n # @account, @opportunity, @contact = contact.promote(contact_account)\n # contact = Contact.find(@contact)\n end\n\n # Rails.logger.info \"XXXXXXXX CONTACT CREATED! #{contact.inspect}\"\n\n else\n\n # Allow Duplicates\n # lead = Lead.new(\n # :user_id => @assigned.id,\n # :campaign_id => campaign_id.to_i,\n # :source => source,\n # :first_name => first_name,\n # :last_name => last_name,\n # :email => email,\n # :phone => phone,\n # :company => company,\n # :title => title, :status => status,\n # :background_info => background_info,\n # :created_at => created_at.to_time\n # )\n\n\n #TODO: rails 4 Lead.find_or_initialize_by(email: email) without tap\n # Don't Allow Duplicates\n lead = Lead.find_or_initialize_by_first_name_and_last_name_and_email(\n first_name,\n last_name,\n email\n ).tap do |lead|\n lead.user_id = @assigned.id,\n lead.campaign_id = campaign_id.to_i,\n lead.source = source,\n lead.first_name = first_name,\n lead.last_name = last_name,\n lead.email = email,\n lead.phone = phone,\n lead.company = company,\n lead.title = title,\n lead.status = status,\n lead.background_info = process_bg_info(lead.background_info, background_info),\n lead.created_at = created_at.to_time rescue Time.current\n end\n lead.save!\n\n lead.first_name = \"INCOMPLETE\" if lead.first_name.blank?\n lead.last_name = \"INCOMPLETE\" if lead.last_name.blank?\n\n # lead.access? = \"Private | Public\"\n lead.access = Setting.default_access\n lead.assignee = @assigned if @assigned.present?\n lead.tag_list.add(tag)\n lead.add_comment_by_user(comments, @assigned)\n lead.save!\n\n #TODO: Better validation on address fields.\n if zip\n lead.business_address = Address.new(:street1 => street1, :street2 => street2, :city => city, :state => state, :zipcode => zip, :country => country, :address_type => \"Business\")\n else\n puts \"INCOMPLETE ADDRESS\"\n end\n lead.save!\n\n end\n end\n\n\n end",
"def load_contact_types\n ContactType.create(name_cd: 'email')\n ContactType.create(name_cd: 'phone')\n ContactType.create(name_cd: 'mobile')\n ContactType.create(name_cd: 'address')\nend",
"def main_build_loop\n @import = Import.find_or_create_by(name: IMPORT_NAME) \n @import.metadata ||= {} \n handle_projects_and_users(@data, @import)\n raise '$project_id or $user_id not set.' if $project_id.nil? || $user_id.nil?\n handle_namespaces(@data, @import)\n handle_preparation_types(@data, @import)\n handle_controlled_vocabulary(@data, @import)\n\n handle_people(@data, @import) ## !created as new\n\n handle_taxa(@data, @import)\n\n checkpoint_save(@import) if ENV['no_transaction']\n\n # !! The following can not be loaded from the database they are always created anew.\n handle_collecting_events(@data, @import)\n handle_specimens(@data, @import)\n\n # handle_users(@data, @import)\n\n @import.save!\n puts \"\\n\\n !! Success \\n\\n\"\n end",
"def bootstrap\n @import_rows_to_class = association_symbol_for_rows.to_s.classify.constantize\n @validate_headers = true\n @validate_on_import = ::Configuration.for('attachments').validate_on_import\n @destructive_import = true\n @timestamp_import = true\n @converted_headers = set_converted_headers\n end",
"def start_importation!\n if can?(:import)\n importing!\n Courses::ImportJob.perform_later self\n end\n end",
"def load_data\n @contact_types = ContactType.find(:all, :order => \"name\", :conditions => 'enabled = 1')\n end",
"def post_import(&block)\n Autoproj.post_import(self, &block)\n end",
"def valid_import?\n true\n end",
"def index\n @invalid_contacts = Contact.last_import.invalid_contact\n @valid_contacts = Contact.last_import.valid_contact\n end",
"def process_fnz_imports\n ProductImporter.create(import: @import)\n SaleImporter.create(import: @import)\n MembershipImporter.create(import: @import)\n InstallmentImporter.create(import: @import)\n end",
"def initiate_import!\n ROOT_FETCHERS.each do |importer|\n importer.new.import!\n end\n end",
"def transfer_contacts(appdata,customfieldscheck)\n\n puts \"Importing Contacts...\"\n\n #SOURCE APP\n #---------------------------------------\n\n puts \"=> Initializing Source App\"\n #initialize source app\n initialize_infusionsoft(appdata[:src_appname], appdata[:src_apikey])\n\n puts \"=> Getting Source Custom Fields\"\n #get list of contact custom fields\n #then store the list of names in an array to add to fields for lookup\n source_app_custom_fields = get_table('DataFormField')\n contact_fields = []\n contact_fields = FIELDS['Contact'].map(&:clone)\n source_app_custom_fields.each { |cf| contact_fields.push(\"_\" + cf['Name']) if cf['FormId'] == -1 }\n\n puts \"=> Getting Source Contacts\"\n #Option 1\n #________\n #get all contacts from the source app\n all_contacts = get_table('Contact',contact_fields)\n\n #Option 2\n #________\n #get contacts with specific criteria\n #all_contacts = get_table('Contact',contact_fields,{Id: 282589})\n #all_contacts += (get_table('Contact',contact_fields,{OwnerID: 118786}))\n\n #reduce list of custom fields to create by detecting which fields have data\n fields_with_data = []\n all_contacts.each { |c| fields_with_data |= c.keys }\n custom_fields_to_import = fields_with_data.grep(/^_/)\n source_app_custom_fields.reject! { |cf| custom_fields_to_import.exclude? '_' + cf['Name']}\n\n\n puts \"=> Getting Source Opt Outs\"\n #get list of opted out emails\n opted_out_emails = get_table('EmailAddStatus').select { |email| OPT_OUT_STATUSES.include? email['Type'] }\n\n puts \"=> Getting Source Lead Sources\"\n #get list of Lead Sources and Categories from source app\n source_app_lead_source_categories = get_table('LeadSourceCategory')\n source_app_lead_sources = get_table('LeadSource')\n\n puts \"=> Getting Source Users\"\n #get list of users for comparing username to source app\n source_app_users = get_table('User')\n\n puts \"=> Getting Source App Settings\"\n #gets lists of app settings for comparing to dest app, stored as arrays\n source_types = Infusionsoft.data_get_app_setting('Contact','optiontypes').split(',')\n source_titles = Infusionsoft.data_get_app_setting('Contact','optiontitles').split(',')\n source_suffixes = Infusionsoft.data_get_app_setting('Contact','optionsuffixes').split(',')\n source_phonetypes = Infusionsoft.data_get_app_setting('Contact','optionphonetypes').split(',')\n source_faxtypes = Infusionsoft.data_get_app_setting('Contact','optionfaxtypes').split(',')\n\n\n #DESTINATION APP\n #--------------------------------------\n\n #INITIALIZATION\n #______________\n puts \"=> Initializing Dest App\"\n #initialize destination app\n initialize_infusionsoft(appdata[:dest_appname], appdata[:dest_apikey])\n\n #LEAD SOURCE\n #___________\n\n puts \"=> Importing Lead Sources...\"\n\n #creates Lead Sources and Categories if they don't exist\n #Adds all category names and lead source names to hashes to compare\n dest_app_lead_source_categories = {}\n get_table('LeadSourceCategory').each { |cat| dest_app_lead_source_categories[cat['Id']] = cat['Name'] }\n\n dest_app_lead_sources = {}\n get_table('LeadSource').each { |src| dest_app_lead_sources[src['Id']] = src['Name'] }\n\n #adds lead source categories to dest app, and sets the ID of the source app lead source category equal to the category created\n #only adds lead source category if it doesn't already exist in dest app\n category_relationship = {}\n source_app_lead_source_categories.each { |cat|\n category_relationship[cat['Id']] = dest_app_lead_source_categories.key(cat['Name']) || Infusionsoft.data_add('LeadSourceCategory',cat)\n }\n\n #create empty hash with default relationship of 0 to 0\n lead_source_relationship = {0=>0}\n source_app_lead_sources.each do |src|\n #swaps old category ID with new category ID\n src['LeadSourceCategoryId'] = category_relationship[src['LeadSourceCategoryId']] unless src['LeadSourceCategoryId'] == 0\n\n #creates lead source if it doesn't exist by the same name\n lead_source_relationship[src['Id']] = dest_app_lead_sources.key(src['Name']) || Infusionsoft.data_add('LeadSource',src)\n end\n\n #FKID AND CONTACT CUSTOM FIELDS\n #__________________\n\n puts \"=> Importing Custom Fields...\"\n\n #creates Source App Contact and Company ID custom fields if they don't exist\n @@source_app_contact_id = create_custom_field('Source App Contact ID')['Name']\n @@source_app_company_id = create_custom_field('Source App Company ID')['Name']\n\n #create contact custom fields if the custom fields check is true\n #also maps the source app custom fields to any existing custom fields in the dest app\n rename_mapping = {}\n\n source_app_custom_fields.each do |cf|\n #checks if app has ANY custom fields; also skips any of type 25, which is unknown, or when it's not a contact custom field\n next if cf.nil? || cf['DataType'] == 25 || cf['FormId'] != -1\n field = create_custom_field(cf['Label'],0,'Contact',DATATYPES[DATATYPE_IDS[cf['DataType']]]['dataType'],cf['Values'])\n rename_mapping['_' + cf['Name']] = field['Name']\n end if customfieldscheck\n\n\n #switches the 'Id' key to be 'Source App Contact ID'\n #switches the 'CompanyID' key to be 'Source App Company ID'\n rename_mapping['Id'] = @@source_app_contact_id\n rename_mapping['CompanyID'] = @@source_app_company_id\n\n #USERS\n #_____\n puts \"=> Creating User Relationship\"\n #Matches up users based on their 'GlobalUserId' which is the Infusionsoft ID\n users_relationship = create_user_relationship(source_app_users,get_table('User'))\n\n #APP SETTINGS\n #____________\n puts \"=> Generating App Settings Differences\"\n\n #Get differene between source app settings and dest app settings\n $types = source_types - Infusionsoft.data_get_app_setting('Contact','optiontypes').split(',')\n $titles = source_titles - Infusionsoft.data_get_app_setting('Contact','optiontitles').split(',')\n $suffixes = source_suffixes - Infusionsoft.data_get_app_setting('Contact','optionsuffixes').split(',')\n $phonetypes = source_phonetypes - Infusionsoft.data_get_app_setting('Contact','optionphonetypes').split(',')\n $faxtypes = source_faxtypes - Infusionsoft.data_get_app_setting('Contact','optionfaxtypes').split(',')\n\n #CREATE IMPORT TAG\n #_________________\n\n puts \"=> Creating Import Tag...\"\n\n #check if Category and Tag already exist\n existing_cat_id = Infusionsoft.data_query('ContactGroupCategory',1000,0,{'CategoryName' => 'Application Transfer'},['Id'])\n existing_tag_id = Infusionsoft.data_query('ContactGroup',\n 1000,\n 0,\n {'GroupCategoryId' => existing_cat_id.first['Id'], 'GroupName' => \"Data from #{appdata[:src_appname]}\"},\n ['Id']) unless existing_cat_id.to_a.empty?\n\n import_tag_cat_id = existing_cat_id.to_a.empty? ? Infusionsoft.data_add('ContactGroupCategory',{'CategoryName' => 'Application Transfer'}) : existing_cat_id.first['Id']\n import_tag_id = existing_tag_id.to_a.empty? ? Infusionsoft.data_add('ContactGroup',{'GroupCategoryId' => import_tag_cat_id, 'GroupName' => \"Data from #{appdata[:src_appname]}\"}) : existing_tag_id.first['Id']\n\n #GET CONTACTS THAT HAVE ALREADY BEEN TRANSFERRED\n #_______________________________________________\n dest_contacts = get_table(\"Contact\",[@@source_app_contact_id],{@@source_app_contact_id => \"_%\"}).map { |c| c[@@source_app_contact_id]}\n\n #ADD CONTACTS\n #____________\n\n puts \"=> Adding contacts...\"\n\n #adds each contact in the list of contacts to destination app\n #swaps lead source IDs before import to dest app lead source ID\n #swaps user ID to destination app user ID based on users_relationship matching\n dest_emails = []\n all_contacts.each do |contact|\n next if dest_contacts.include? contact['Id'].to_s #skips importing contacts that have previously been transferred\n contact.keys.each { |k| contact[ rename_mapping[k] ] = contact.delete(k).to_s if rename_mapping[k] }\n contact.delete('AccountId')\n contact['LeadSourceId'] = lead_source_relationship[contact['LeadSourceId']]\n contact['OwnerID'] = users_relationship[contact['OwnerID']] || 0\n contact_id = Infusionsoft.contact_add(contact) unless contact[@@source_app_contact_id] == contact[@@source_app_company_id]\n Infusionsoft.contact_add_to_group(contact_id, import_tag_id) unless contact_id.nil?\n dest_emails |= [contact['Email']]\n end\n\n puts \"=> Opting Out Emails\"\n #opt out all emails that were opted out in the source app\n opted_out_emails.each do |email|\n Infusionsoft.email_optout(email, 'Source App Opt Out') if dest_emails.include? email\n end\n\n puts \"Contacts Imported.\"\n end",
"def process\n proccess_contacts_imports\n proccess_attendance_imports\n process_fnz_imports\n proccess_crm_imports\n process_planning_imports\n process_mailing_imports\n end",
"def populatecontactfields\n @contact = Contact.new\n @contact_stage = get_contact_stages(@company.contact_stages.array_to_hash('lvalue'),['Client'])\n @lead_status = false\n render :partial=>'common/newcontact', :object=>@contact\n end",
"def import_contacts(email, password, with_names = false)\n data = { :email => email, :password => password }\n data[:names] = 1 if with_names\n self.api_post(:contacts, data)\n end",
"def import!\n # start_async provided by Asyncable module\n return start_async if run_async?\n process_now\n end",
"def import\n # GET http://www.google.com/m8/feeds/contacts/default/base\n token = params[:token]\n uri = URI.parse(\"https://www.google.com\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n path = \"/m8/feeds/contacts/default/full?max-results=10000\"\n headers = {'Authorization' => \"AuthSub token=#{token}\", 'GData-Version' => \"3.0\"}\n resp, data = http.get(path, headers)\n # extract the name and email address from the response data\n # HERE USING REXML TO PARSE GOOGLE GIVEN XML DATA\n xml = REXML::Document.new(data)\n contacts = []\n xml.elements.each('//entry') do |entry|\n person = {}\n person['name'] = entry.elements['title'].text\n gd_email = entry.elements['gd:email']\n logger.debug(entry)\n if gd_email\n person['email'] = gd_email.attributes['address'] \n @user.profile.contacts << person if person\n end \n end\n @user.profile.save\n redirect_to root_url , :notice => \"imported successfully\"\n end",
"def import!\n return selected_importer.import!\n end",
"def delegate_import\n if Rails.env == 'development'\n # use local file path on development\n csv = open(self.import.import_file.products.path)\n else\n # use s3 file on production\n csv = open_tmp_file(self.import.import_file.products.url)\n end\n\n\n # Send file to fnz module using import api\n response = RestClient.post Fnz::HOST + '/api/v0/imports',\n app_key: Fnz::API_KEY,\n import: {\n object: 'Product',\n padma_id: self.import.account.name,\n upload: csv\n }\n if response.code == 201\n # If import was created successfully create a product importer\n #that will show the status of this import\n remote_import_id = JSON.parse(response.body)['id']\n self.update_attributes(status_url: Fnz::HOST + '/api/v0/imports/' + remote_import_id.to_s)\n end\n end",
"def perform(import, group_ids)\n\n filepath = import.file.current_path\n user = import.user\n\n puts \"Prepare to import #{filepath} ...\"\n\n #faz um array de grupos validos do usuario\n groups = []\n group_ids.each do |g|\n if user.groups.exists?(g)\n groups.push Group.find(g)\n end\n end if group_ids.length > 0\n\n begin\n #le todas as linhas do csv\n lines = CSV.read filepath, headers: true, col_sep: import.separator\n\n #atualiza o numero de linhas de contatos para importar\n import.update! contacts_count: lines.count\n\n #hash de colunas dos contatos\n contacts_columns = Contact.column_names.reject{|key| key==\"id\"}\n\n lines.each_with_index do |row, row_n|\n\n #verifica se a chave da coluna do csv é uma coluna na tabela\n row = row.to_hash\n row.select! do |key,_|\n contacts_columns.include? key\n end\n\n contact = Contact.new row\n contact.user_id = import.user_id\n if contact.valid?\n #se tem grupos para por os contatos\n if groups.size > 0\n groups.each do |group|\n group.contacts << contact\n end\n else\n #para os contatos do usuario\n user.contacts << contact\n end\n else\n #escreve os erros no import_infos caso o contato não seja valido\n contact.errors.full_messages.each do |message|\n error = \"Um problema ocorreu na linha #{row_n+1}, #{message}\"\n import.import_infos.create! message: error\n puts error\n end\n end\n end\n\n puts \"Import #{filepath} completed\"\n ensure\n #atualiza a importação para terminado\n import.done!\n #envia a notificação para view do usuario usando o pusher\n Pusher[user.id.to_s].trigger('import_group_done', {:status => 'success', :message => \"A importação do arquivo #{import.file.identifier} está pronto!\"})\n\n puts \"Job completed with problems!\"\n end\n\n\n end",
"def create\n contacts = fetch_contacts\n case params[:importer]\n when LINKEDIN then send_linkedin_message(contacts)\n when GMAIL, YAHOO, HOTMAIL, OUTLOOK, OTHER_EMAIL then send_emails(contacts)\n when FACEBOOK then current_user.increase_invites_count!(params[:sended_invites].to_i)\n end\n redirect_after_send\n end",
"def initialize\n\t\t@contacts = [] #empty arrary to hold entire contact list.\n\tend",
"def initialize#(contacts)\n\t\t@contacts = [] #if we have different contacts with the same name we need to add another value to give each contact a unique identifier to differentiate between them\n\tend",
"def initialize #what attritubes\n\t\t@contacts = []\n\tend",
"def set_contacts_file\n @contacts_file = ContactsFile.includes(:importer_logs).find(params[:id])\n end",
"def import!\n t = Thread.new do\n begin\n do_import\n rescue Exception => ex\n Rails.logger.error \"ERROR in import thread: #{ex.inspect}\"\n throw ex\n end\n end\n at_exit { t.join }\n t\n end",
"def scrape_contacts; end",
"def do_import\n if(reset)\n TaliaUtil::Util.full_reset\n puts \"Data Store has been completely reset\"\n end\n errors = []\n run_callback(:before_import)\n if(index_data)\n import_from_index(errors)\n else\n puts \"Importing from single data file.\"\n TaliaCore::ActiveSource.create_from_xml(xml_data, :progressor => progressor, :reader => importer, :base_file_uri => @true_root, :errors => errors, :duplicates => duplicates)\n end\n if(errors.size > 0)\n puts \"WARNING: #{errors.size} errors during import:\"\n errors.each { |e| print_error e }\n end\n run_callback(:after_import)\n end",
"def contact; end",
"def set_imports_import\n @imports_import = Imports::Import.find(params[:imports_import_id])\n end",
"def setup\n # Retrieve fixtures via their name\n # @first = contacts(:first)\n end",
"def contact\n \t@contact = Contact.new\n end",
"def initialize\n @contacts = []\n end",
"def initialize\n @contacts = []\n end",
"def importDonors\n end",
"def setup_roster!\n # Clean the roster\n self.connection.roster.items.each_pair do |jid, roster_item|\n jid = jid.strip.to_s\n unless self.class.contacts.include?( jid )\n self.connection.remove( jid )\n end\n end\n \n # Add missing contacts\n self.class.contacts.each do |contact|\n unless self.connection.subscribed_to?( contact )\n self.connection.add( contact )\n self.connection.roster.accept_subscription( contact )\n end\n end\n end",
"def import\n records.each_slice(1000) do |slice|\n FieldContact.transaction do\n import_slice(slice)\n end\n end\n end",
"def rest__import\n rest_ok_response install_from_dtkn_helper(:component_module)\n end",
"def importer\n Importer.new context\n end",
"def import\n task = Task.create!(name: 'Preparing to import MARCXML records',\n service: Service::LOCAL_STORAGE,\n status: Task::Status::SUBMITTED)\n RecordSource.new.import_async(task)\n rescue => e\n handle_error(e)\n else\n flash['success'] = 'Import will begin momentarily.'\n ensure\n redirect_back fallback_location: tasks_path\n end",
"def import(_, project)\n project.after_import\n report_import_time(project)\n end",
"def initial_import(username, projectname)\n # set import status\n project = GithubRepo.find_by(github_user: username, project_name: projectname, user_id: current_user.id)\n\n if project.imported.nil? || !project.imported\n\n project.imported = 1\n project.save\n\n\n # encounter stop\n if Encounter.last\n Encounter.last.close\n end\n\n # new encounter\n import_campaign = Campaign.create({name: projectname,\n description: \"Imported Project for #{projectname}\",\n user_id: current_user.id\n })\n\n create_round(import_campaign, action_name, import_campaign)\n\n # import commits & issues\n list_commits username, projectname, Encounter.last, import_campaign\n list_issues username, projectname, Encounter.last, import_campaign\n\n\n end\n\n\n end",
"def run\n super\n\n # Replace bad characters\n #\n # For future, consider:\n # http://stackoverflow.com/questions/20650681/ruby-gsub-multiple-characters-in-string\n phone_number = _get_entity_attribute(\"name\").gsub(\".\",\"\").gsub(\" \",\"\").gsub(\"-\",\"\").gsub(\"(\",\"\").gsub(\")\",\"\")\n\n # get the API key\n api_key = _get_global_config \"carrierlookup_api_key\"\n\n lookup_uri = \"http://www.carrierlookup.com/index.php/api/lookup?key=#{api_key}&number=#{phone_number}\"\n\n begin\n response = http_get_body lookup_uri\n attributes = JSON.parse response if response\n\n if attributes[\"Response\"][\"error\"]\n _log_error \"Error querying API #{attributes[\"Response\"][\"error\"]}\"\n return\n end\n\n _log \"You have #{attributes[\"Response\"][\"creditBalance\"]} credits remaining.\"\n\n # Edit the phone number entity\n @entity.details[\"carrier_type\"] = attributes[\"Response\"][\"carrier_type\"]\n @entity.details[\"carrier\"] = attributes[\"Response\"][\"carrier\"]\n @entity.save\n\n _log \"Carrier Type: #{@entity.details[\"carrier_type\"]}\"\n _log \"Carrier: #{@entity.details[\"carrier\"]}\"\n\n # Add an info entity_ids\n #{}_create_entity \"Info\", attributes.merge({\"name\" => \"Carrier Lookup for #{phone_number}: #{attributes}\"})\n\n rescue JSON::ParserError\n _log_error \"Unable to retrieve provider info\"\n end\n\n end",
"def import!\n log \"Importing #{csv_file.split('/').last.sub('.csv', '')}\"\n\n @errors_count = 0\n\n before_import()\n with_each_row { process_row }\n after_import()\n\n log \"Import complete (#{@errors_count} errors in #{@has_header_row ? @current_row_number-1 : @current_row_number} rows)\"\n end",
"def initialize_modules\n # NOTE: this gets called after all the module initializers complete\n end",
"def import\n authorize! :import, Contact\n respond_to do |format|\n format.html # new.html.erb\n format.js\n end\n end",
"def import!\n return unless imported? or updated?\n\n Outgoing::Workcamp.transaction do\n import_changes.each do |change|\n change.apply(self)\n change.destroy\n end\n\n self.state = nil\n save!\n end\n end",
"def import!\n return unless imported? or updated?\n\n Outgoing::Workcamp.transaction do\n import_changes.each do |change|\n change.apply(self)\n change.destroy\n end\n\n self.state = nil\n save!\n end\n end",
"def start(*)\n @module_started = true\n end",
"def sync\n Logger.d(\"Sync invoked for ContactsSync\")\n find_all_contacts_with_email { |emails|\n Logger.d(\"Going to sync #{emails.length} contacts\")\n # Save the contacts on the server \n json = {\n :user => {\n :contacts => emails\n },\n :auth_token => @auth_token\n }.to_json\n\n on_api_call_failed = Proc.new { |json_obj|\n Logger.d(\"API CALL FAILED in ContactsSync.sync\", \">\")\n } \n\n # Save on network\n network_post(CONFIG.get(:sync_contacts), nil, json, on_api_call_failed) do |response_obj|\n Logger.d(\"Contacts sync done\", \":) \")\n end \n }\n end",
"def contacts_upload\n #checking for csv file or not\n if params[:file].content_type == \"text/csv\"\n\n #read contents from csv file\n contacts = []\n\n CSV.foreach(params[:file].tempfile) { |row|\n row = row.first.split(\",\") if row.count == 1\n \n contact_data = {}\n contact_data[\"first_name\"] = row[0]\n contact_data[\"last_name\"] = row[1]\n contact_data[\"email\"] = row[2]\n contact_data[\"org\"] = row[3]\n contact_data[\"events\"] = row[4]\n contact_data[\"interests\"] = row[5]\n contacts << contact_data\n }\n\n #remove first row with column name and make a new array with contacts\n contacts = contacts[1..contacts.length]\n contacts.each do |contact|\n @contact = Contact.new\n @contact.first_name=contact[\"first_name\"]\n @contact.last_name=contact[\"last_name\"]\n @contact.email=contact[\"email\"]\n @contact.org=contact[\"org\"]\n @contact.events=contact[\"events\"]\n @contact.interests=contact[\"interests\"]\n @contact.save\n end\n\n else\n puts \"----->>>>> Error found due to wrong file format <<<<<-----\"\n end\n\n contacts_list\n end",
"def create\n @contact = Contact.new(contact_params)\n @contact.locale_id = current_user.locale_id\n @contact.contact_type_id = 12\n @contact.is_team = true\n respond_to do |format|\n if @contact.save\n format.html { redirect_to team_path(@contact), notice: 'Contact was successfully created.' }\n format.json { render :show, status: :created, location: @contact }\n else\n flash[:error] = @contact.errors.full_messages\n @contact = Contact.new(contact_params)\n load_lists\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize\n\t\t@contacts = []\n\t\t#@index = 1000 #1003 for 2 rolodexes with 3 contacts.\n\tend",
"def initialize contact_data\n #@message = message\n @contact_data = contact_data\n @type = type\n end",
"def contacts\n @contacts ||= Harvest::API::Contacts.new(credentials)\n end",
"def add_contacts\n \tap \"adding contacts\"\n # asking whether we are already authorized\n AddressBook.request_authorization unless AddressBook.authorized?\n\n \n if AddressBook.authorized?\n 25.times do\n person = AddressBook::Person.create(\n :first_name => Forgery::Name.first_name, \n :last_name => Forgery::Name.last_name, \n :email => [{ :value => Forgery(:internet).email_address , :label => 'Home'}], :phones => [{ :value => rand(10 ** 10).to_s, :label => 'Mobile'}])\n end\n else\n #ap \"This app is not authorized to access the address book.\"\n end\n #enVd\n end",
"def read_JSON_file # called a helper method (is helping you to use less code and dealing with something so that your other methods don't have to)\n @json_data = File.read('./lib/contacts.json')\n @contacts = JSON.parse(@json_data, {:symbolize_names => true})\n end",
"def importable?\n true\n end",
"def async_operation\n run_importer\n end",
"def contacts\n contact_client.contacts\n end",
"def delegate_import\n if Rails.env == 'development'\n # use local file path on development\n csv = open(self.import.import_file.time_slots.path)\n else\n # use s3 file on production\n csv = open_tmp_file(self.import.import_file.time_slots.url)\n end\n\n\n # Send file to attendance module using import api\n # The last two headers are: vacancy (it doesn't matter) and school_id (already imported)\n response = RestClient.post Attendance::HOST + '/api/v0/imports',\n app_key: Attendance::API_KEY,\n account_name: self.import.account.name,\n import: {\n object: 'TimeSlot',\n csv_file: csv,\n headers: headers\n }\n if response.code == 201\n # If import was created successfully create a time_slot importer\n #that will show the status of this import\n remote_import_id = JSON.parse(response.body)['id']\n self.update_attributes(status_url: Attendance::HOST + '/api/v0/imports/' + remote_import_id.to_s)\n end\n end",
"def initialize(attrs)\n super\n @ccapi = Ccontact.new()\n end",
"def should_create_shared_contact\n _supplier = Supplier.find(supplier)\n _entity = Entity.find(_supplier.entity)\n # Maybe contact exists previously\n _contact = SharedContact.find_by_name_organization_type(last_name, first_name, organization_id, 2) rescue nil\n if _contact.nil?\n # Let's create a new contact\n _contact = create_shared_contact(_entity, _supplier)\n else\n # Contact exists, updates it\n _contact = update_shared_contact(_contact, _entity, _supplier)\n end\n # Update contact id\n self.update_column(:shared_contact_id, _contact.id) if !_contact.id.nil?\n true\n end",
"def contact_create(contact)\n super # placeholder so that I can add some doc\n end",
"def contact_create(contact)\n super # placeholder so that I can add some doc\n end",
"def setup\n @last_import_data = { string_field: \"import four\", integer_field: 4, extra_field: \" extra\" }\n end",
"def fetch_contacts\n case params[:importer]\n when OTHER_EMAIL then params[:emails].split(',')\n when GMAIL, YAHOO, HOTMAIL, OUTLOOK, LINKEDIN then params[:contacts]\n end\n end",
"def contacts\n\t\t@contact = Contact.first();\n\tend",
"def contacts\r\n\r\n end",
"def transaction_import_process(send_transaction)\n readcsv\n check\n save\n send_to_acx if send_transaction\n end",
"def add_data_com_contacts(datacom_contacts)\n datacom_contacts.each do |contact|\n contacts << Contact.new(contact.to_sugar_data.merge(contacts_defaults))\n end\n end",
"def import_all\n EmailAccount.active.each do |email_account|\n log \"Importing #{email_account.username}\"\n email_account.loggers = self.loggers\n email_account.import_emails\n log \"Done importing #{email_account.username}\"\n end\n true\n end",
"def load_file_for_import(module_name)\n if @action == 'initial_run'\n filename = \"#{@csv_dir}/initial/#{module_name}_export.csv\"\n else\n today = lambda { Date.today.to_s }\n dir = \"#{@csv_dir}/update/#{today.call}\"\n filename = \"#{dir}/#{module_name}_export.csv\"\n end\n @logger.error(\"Could not create or find a csv filename for module #{module_name}\") unless defined? filename\n @logger.info(\"Loading CSV file #{filename} for import\")\n csv_file = ::CSV.read(filename, :encoding => 'utf-8')\n transform_csv_file(csv_file)\n end",
"def importer_mode\n fail \"This method is intended for use with a block\" unless block_given?\n original = importer_mode_on\n begin\n self.importer_mode_on = true\n yield\n ensure\n self.importer_mode_on = original\n end\n end",
"def initialize(contact_name)\n @contact_name = contact_name\n @client = nil\n self.use_markdown = Ahoy.use_markdown\n end",
"def import_gmail_contacts\n @group = Group.find(params[:id])\n if @group.user_id == @login_user.id\n if request.post?\n begin\n @contacts = Contacts::Gmail.new(params[:email], params[:password]).contacts\n @contacts.each{|c| c[0] = c[1] if c[0].blank? }\n @contacts = @contacts.sort{|a,b| a[0].nil? ? -1 : b[0].nil? ? 1 : a[0].downcase <=> b[0].downcase }\n rescue Exception => e\n @message = e.message == \"Username or password are incorrect\" ? \"Username or password is incorrect.\" : e.message\n end\n respond_to do |format|\n format.js\n end\n else\n respond_to do |format|\n format.html { render :layout => false}\n end\n end\n else\n flash[:notice] = \"Not your group.\"\n redirect_to :back\n end\n end",
"def set_contact\n @supplier = Supplier.find(params[:supplier_id])\n @contact = @supplier.contact\n end",
"def set_contact\n if params[:action] == \"update\"\n @contact = Contact.find(params[:format]) \n else\n @contact = Contact.find(params[:id])\n end\n end",
"def at_init\n\n\t\tend",
"def import(&block)\n return enum_for(:import) unless block_given?\n self.block = block\n import_with_block\n end",
"def contacts\n @contacts ||= DebtorContactProxy.new(self)\n end",
"def enable\n @contact = Sfcontact.find_by_sf_id(params[:id])\n sf_contact = Contact.find(@contact.id)\n sf_contact.portal_privilege__c = AppConstants::PRIVILEGE[:member]\n sf_contact.save_and_update\n end",
"def initial_setup\n # Copy across the application_record_loader.rb unless it already exists\n copy_file '../static_files/application_record_loader.rb',\n 'lib/record_loader/application_record_loader.rb',\n skip: true\n # Copy across the record_loader.rake unless it already exists\n copy_file '../static_files/record_loader.rake',\n 'lib/tasks/record_loader.rake',\n skip: true\n end",
"def contacts() @contacts ||= Flickr::Contacts.new(self) end",
"def create_contact_if_missing!\n return true unless contact.blank?\n\n # when creating a contact we should assume we're primary\n self.options.primary = true\n build_contact(create_contact_parameters)\n save\n end",
"def contacts(params = {})\n # contacts in this group\n @contacts = nil\n contacts!\n end",
"def prepare_contacts\n return unless defined? @user\n @user.user_default_emails.sort_by{|a| a.role_id.to_i}\n end"
] |
[
"0.61401707",
"0.5984866",
"0.5954104",
"0.59204066",
"0.58920145",
"0.58590335",
"0.5825482",
"0.5816464",
"0.5816464",
"0.5816464",
"0.5816464",
"0.57686454",
"0.5670945",
"0.5597657",
"0.55604506",
"0.54979175",
"0.54939264",
"0.5463692",
"0.546064",
"0.54560035",
"0.5449388",
"0.5438867",
"0.54066825",
"0.5398377",
"0.5382396",
"0.53790736",
"0.5354278",
"0.5346189",
"0.52694726",
"0.5256414",
"0.52305317",
"0.5185459",
"0.5180988",
"0.51355976",
"0.5123536",
"0.509932",
"0.50920326",
"0.5053863",
"0.50456464",
"0.5044213",
"0.50396115",
"0.502912",
"0.5022783",
"0.5021635",
"0.5012637",
"0.5011059",
"0.50010026",
"0.50010026",
"0.500015",
"0.4993345",
"0.49897632",
"0.49876553",
"0.49811852",
"0.49811396",
"0.4957709",
"0.49406302",
"0.49355006",
"0.4930195",
"0.49252293",
"0.49151015",
"0.490681",
"0.490681",
"0.49018106",
"0.4897577",
"0.48771948",
"0.48701087",
"0.4865215",
"0.48475736",
"0.48408678",
"0.48400778",
"0.48391438",
"0.48372623",
"0.48348147",
"0.48204252",
"0.48101234",
"0.48091015",
"0.48017046",
"0.4796413",
"0.4796413",
"0.47929826",
"0.47926098",
"0.47874835",
"0.47855076",
"0.4785184",
"0.4784553",
"0.47831634",
"0.47822678",
"0.4773601",
"0.47707725",
"0.4770198",
"0.47683355",
"0.47675297",
"0.47619665",
"0.47601983",
"0.47581345",
"0.47569665",
"0.4739011",
"0.47369516",
"0.47320217",
"0.473012",
"0.47276792"
] |
0.0
|
-1
|
The view for making a new post.
|
def new
@post = Post.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @post = Post.new\n render :new\n end",
"def new\n # responsbile for creating a new instance of a post\n @post = Post.new\n end",
"def new\r\n @post = Post.new\r\n end",
"def new\n @post = Post.new\n end",
"def new\n # Display a form to create a new post\n # The actual post creation is handled by method: create\n @post = Post.new\n end",
"def new \n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new\n @post = Post.new\n end",
"def new # Showing the new form\n # Responsible for creating a new instance of a post - not saved in DB yet.\n @post = Post.new\n end",
"def new\n\t\t@post = Post.new\n\t\trender :new\n\tend",
"def create\n\t\t@post = Post.new(params[:post].permit(:title, :text))\n\t\t\n\t\tif @post.save\n\t\t\n\t\t\t#tell browser to issue anothe request\n\t\t\tredirect_to @post\n\t\telse\n\t\t\n\t\t\t#render is used so that @post is passed back to the\n\t\t\t#new template when it is rendered\n\t\t\trender 'new'\n\t\tend\n\tend",
"def new\n\t @post = Post.new\n\tend",
"def new\n @post = Post.new()\n end",
"def new\n\t\t@post = Post.new \n\tend",
"def new\n @post = Post.new()\n end",
"def new\n @post = Post.new()\n end",
"def new\n @post = Post.new()\n end",
"def new\n @post = Post.new\n\n end",
"def new\n @post = Post.new\n\n end",
"def new \n @post = Post.new\n end",
"def create \n #render plain: params[:post].inspect\n @post = Post.new(post_params) #Capture paramters from the View\n @post.save #Save the new Post object to the DV\n redirect_to @post #Display the new post once saved\n end",
"def new\t\n\t\t@post = Post.new\n\tend",
"def create\n if @post.save\n redirect_to root_path, notice: t('.notice_create')\n else\n render :new\n end\n end",
"def new \n\t\t@post = Post.new\n\tend",
"def create\n\t\t@post = Post.new(post_params)\n\n\t\t#if the post has been saved redirects to index of posts\n\t\tif @post.save\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend",
"def new\n\t@post = Post.new\nend",
"def create\n\t\t@post = Post.new\n\t\tif @post.save(post_params)\n\t\t\tflash[:notice] = \"Post Created!\"\n\t\t\tredirect_to post_path(@post)\n\t\telse\n\t\t\tflash[:alert] = \"Something is wrong!\"\n\t\t\trender :edit\n\t\tend\n\tend",
"def new\n \t@post = Post.new\n end",
"def new #http://localhost:3000/posts/new\n\t@post = Post.new #creates a new empty post,if a form is created for it, it will be empty as well \n end",
"def new\n @post = Post.new #returns an empty post\n end",
"def new\n @post = model.new\n\n respond_to do |format|\n format.html { render :action => resource_template(\"new\") }\n end\n end",
"def create\n @post = Post.new(params[:post])\n if @post.save\n redirect_to post_path(@post)\n else\n render :action => \"new\"\n end\n end",
"def create\n\t\t@post = Post.new(post_params)\n\t\tif @post.save\n\t\t\tflash[:notice] = \"Successfully created post!\"\n\t\t\tredirect_to post_path(@post)\n\t\telse\n\t\t\tflash[:alert] = \"Error creating new post!\"\n\t\t\trender :new\n\t\tend\n\tend",
"def create\n\t\t@post = Post.new(post_params)\n\t\tif @post.save\n\t\t\tflash[:notice] = \"Successfully created post!\"\n\t\t\tredirect_to post_path(@post)\n\t\telse\n\t\t\tflash[:alert] = \"Error creating new post!\"\n\t\t\trender :new\n\t\tend\n\tend",
"def new\n @post = flash[:form_data] || Post.new\n @title = 'New post'\n\n render_view(:form)\n end",
"def new\n \n @post = Post.new\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 respond_to do |format|\n if @post.save\n format.html { redirect_to @post, 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 new\n @post = Post.new\n\n respond_to do |format|\n format.html\n end\n end",
"def new\n @post = Post.new\nend",
"def create\n @post = Post.new\n @post.title = params[:title]\n @post.description = params[:description]\n @post.save\n\n #each route will automatically check for a matching view..\n # since we don't need a view for create, we must redirect\n # after we are done saving the post... in order to avoid errors.\n \n redirect_to post_path(@post)\n end",
"def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new #creates new instance of the/a post\n #since it's only creating an instance in memory have to create/post method create blw\n end",
"def create\n # render plain: params[:post].inspect #get the inspected parameters filled by the user in the form\n @post = Post.new(post_params) #Create a new post with the supplied post parameters\n if(@post.save) #Saves the post to the database\n redirect_to @post #Redirects to the show method\n else\n render 'new' #If got any errors while saving, render the new.html.erb page and show the error \n end\n end",
"def create\n # displays post information in JSON format\n # render([current,] :text => params[:post].inspect )\n# render text: params[:post].inspect\n\n # get post form data from params as new Post\n# Rails 4.0\n# @post = Post.new(params[:post].permit(:title, :text))\n @post = Post.new(params[:post])\n\n # save post in sqlite db; save returns false if invalid\n if @post.save\n # send GET request to post, conveying post id => posts#show\n redirect_to @post\n else # invalid form\n # same form => posts#new\n render 'new'\n end\n end",
"def new\n @post = Post.new\n respond_with(@post)\n end",
"def new\n @post = Post.new\n respond_with(@post)\n end",
"def create\n @post = Post.new(post_params)\n if @post.save\n redirect_to post_path(@post)\n else\n render :new\n end\n end",
"def new\n @title = \"Create New Post\"\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end",
"def new\n\t\t@post = Post.new\n\t\trender layout: \"admin_layout\"\n\tend",
"def new\n @post = Post.new\n @title = \"New Post\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n format.json { render :json => @post }\n end\n end",
"def new\n @post = Post.new\n @title = \"New post\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end",
"def create\n post\n end",
"def create\n @post = Post.new(params[:post])\n\n if @post.save\n redirect_to posts_path, :notice => t(:post_added)\n else\n render :action => \"new\"\n end\n end",
"def new\n redirect_to posts_path and return unless Mist.authorized?(:create_post, self)\n @post = Mist::Post.new\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 @post = current_user.posts.create(post_params)\n \n if @post.save\n redirect_to action: :index\n else\n flash.now[:alert] = \"Unable to create new post\"\n render :new\n #redirect_to action: :new\n end\n end",
"def new\n authorize! :write, Post\n @post = current_user.posts.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end"
] |
[
"0.8107586",
"0.8079042",
"0.80599034",
"0.8051818",
"0.80067784",
"0.7966639",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79664767",
"0.79652727",
"0.794985",
"0.7932482",
"0.79205734",
"0.7910282",
"0.79054123",
"0.7904594",
"0.7892653",
"0.7892653",
"0.7892653",
"0.7853716",
"0.7853716",
"0.7849901",
"0.7834226",
"0.78087413",
"0.7791619",
"0.77688396",
"0.7760511",
"0.77526987",
"0.7752661",
"0.7748015",
"0.77326727",
"0.768042",
"0.7655394",
"0.7614465",
"0.7611786",
"0.7611786",
"0.7611532",
"0.7598165",
"0.75909716",
"0.75707394",
"0.7566101",
"0.7543766",
"0.75329536",
"0.7528748",
"0.7526483",
"0.7515372",
"0.75113386",
"0.75113386",
"0.74872357",
"0.74770737",
"0.7471857",
"0.74627656",
"0.7448133",
"0.7417425",
"0.7412669",
"0.74122274",
"0.7408281",
"0.73839027",
"0.7383606"
] |
0.7911565
|
54
|
Actually make the post
|
def create
@post = Post.new(post_params)
@post.user_id = current_user.id # current_user is given to us from devise
if @post.save
# Redirect to the show page for Post. And pass along this cool (useless...) notice
redirect_to @post, notice: 'Your post was created successfully'
else
render :new
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post\r\n end",
"def post; end",
"def post\n end",
"def post\n if phase.has_key?('post')\n execute(\"post\", phase['post'])\n end\n end",
"def POST; end",
"def post(*args)\n execute(:post, *args)\n end",
"def post\n Rentlinx.client.post(self)\n end",
"def post(data = \"\")\n submit :Post, data\n end",
"def post data\n commit data\n end",
"def create\n post\n end",
"def post #:doc:\n end",
"def post(*args, &block); end",
"def post(action, **args); end",
"def post\n resource.post(request, response)\n end",
"def post\n raise NotImplementedError\n end",
"def post *args, &block\n handle @conn.post *args, &block\n end",
"def post(*args)\n request :post, *args\n end",
"def post_data; end",
"def post(*args)\n Request.post(*args)\n end",
"def post!\n request! :post\n end",
"def post(*args)\n request(:post, *args)\n end",
"def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend",
"def post(path, **args); end",
"def post(*args, &block)\n map_method(:post, args, &block)\n end",
"def create\n\n current_user_or_redirect ? nil : return\n\n @post = Post.new(params[:post])\n @post.user_id = @current_user.id\n\n if @post.link?\n @post.status = 'live'\n @post.link = \"http://#{@post.link}\" unless @post.link[/^https?/]\n end\n\n respond_to do |format|\n if @post.save\n @post.delay.update_slug\n @post.delay.add_interactions\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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\n end",
"def post_request(object)\n end",
"def post(data = {})\n call data, method: :post\n end",
"def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"def create\n @active_link = \"upload\"\n params[:post][:is_upload] = true\n @post = generate_post(session_obj, params[:post])\n if @post.save\n flash[:notice] = \"You made a new post!\"\n redirect_to board_path(@board)\n else\n flash[:error] = @post.errors.full_messages.first\n render :new\n end\n end",
"def submits; end",
"def create(*args)\n post(*args)\n end",
"def create(*args)\n post(*args)\n end",
"def post url, object = nil\n request url, HTTP::Post, object\n end",
"def submit; end",
"def make\n\t@post = Post.new(post_parameter)\n\n if @post.save\n redirect_to @post, notice: 'Post was successfully made.'\n \n else\n render :fresh\n \n end\n \nend",
"def create\n post = Post.new(comment: post_params[:comment], user: current_user, pokemon: retrieve_pokemon)\n return render_model_errors(post.errors, :unprocessable_entity) unless post.save\n broadcast(post, 'create')\n head :ok\n end",
"def post_to_fancyhands\n post_to_fancyhands_now\n end",
"def create\n @post = Post.new(post_params)\n\n conn = Bunny.new(:automatically_recover => false)\n conn.start\n\n ch = conn.create_channel\n q = ch.queue(\"main\")\n\n ch.default_exchange.publish(@post.body, :routing_key => q.name)\n\n redirect_to posts_url, notice: 'Text was successfully added.'\n\n conn.close\n end",
"def process_post\n true\n end",
"def raw_post; end",
"def post_http(args)\n\t\t return(Net::HTTP.post_form @uri, args)\t\t\t\n \tend",
"def create\n #binding.pry\n # saving the post w/the form values into the database\n @post = Post.new(post_params) #call a new method as params - post in memory\n if @post.save #making active record call to see if we saved in db\n redirect_to post_path(@post) #look at rake routes bundle exec rake routes read right left; rails is smart enough that u don't need @post.id\n else\n # unsuccessful create attempt\n render :new #render new page (most basic flow here)\n end\n end",
"def create\n msg = params[:msg]\n # @post = Post.new(params[:post])\n @current_user= current_user\n\n # call to create will generate a new post with these information and on this aspect\n message = {'status_message'=>{'text'=>msg},'aspect_ids' => '9'}\n @status_message =JSON.parse(current_user.access_token.token.post(\n '/api/v0/create', message))\n \n\n respond_to do |format|\n if @status_message.status.equals(\"201\")\n format.html { render action: \"done\" }\n # if @post.save\n # format.html { redirect_to @post, notice: 'Post was successfully created.' }\n # format.json { render json: @post, 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 sub_post\n page(NavTabBarPage).select_storytab(\"Reply\")\n page(SubmissionPage).create_post(\"reply post\")\n page(NavTabBarPage).flag_handler(\"Cancel\")\n page(SubmissionPage).touch_discard\n end",
"def post; FacebookPostJob.new.async.perform(self.id); end",
"def submit\n end",
"def post(url, body = {})\n call(url: url, action: :post, body: body)\n end",
"def create_post\n begin\n #asks the user for the title, body, and whether it should be anonymous\n print \"Title: \"\n title = STDIN.gets.chomp\n print \"Body: \"\n body = STDIN.gets.chomp\n print \"Post as Anonymous? (y/n): \"\n anonymous = STDIN.gets.chomp.upcase == 'Y' ? true : false\n # check user information from login\n\n # Rails will reject this unless you configure the cross_forgery_request check to\n # a null_session in the receiving controller. This is because we are not sending\n # an authenticity token. Rails by default will only send the token with forms /users/new and\n # /users/1/edit and REST clients don't get those.\n # We could perhaps arrange to send this on a previous\n # request but we would then have to have an initial call (a kind of login perhaps).\n # This will automatically send as a multi-part request because we are adding a\n # File object.\n response = RestClient.post \"#{@@DOMAIN}/api/posts.json\",\n\n {\n post: {\n title: title,\n body: body,\n anonymous: anonymous\n },\n }, authorization_hash\n\n if (response.code == 201)\n puts \"Created successfully\"\n end\n puts \"URL for new resource: #{response.headers[:location]}\"\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def _eval_post\n _eval_action('post')\n end",
"def create \n #render plain: params[:post].inspect\n @post = Post.new(post_params) #Capture paramters from the View\n @post.save #Save the new Post object to the DV\n redirect_to @post #Display the new post once saved\n end",
"def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end",
"def create\n\n\t\t@post = Post.new(post_params)\n\t\tif @post.tag == \"\"\n\t\t\tredirect_to :back\n\t\telsif @post.body == \"\"\n\t\t\tredirect_to :back\n\t\telse\n\t\t\t@post.save\n\t\t\tredirect_to \"#\"\n\t\t\tflash[:info] = \"Post submited!\"\n\t\tend\n\tend",
"def create\n @post = Post.new(:user_id => @user_id,\n :location => parse_location(post_params[:location]),\n :description => post_params[:description],\n :image => post_params[:image])\n if @post.save\n response.headers['X-MESSAGE-ID'] = @post.id.to_s\n head :ok\n else\n head :unprocessable_entity\n end\n\n end",
"def post(params = nil)\n request.method = :post\n execute(params)\n end",
"def create\n @post = postable.posts.build(params[:post])\n @post.author = current_agent\n\n respond_to do |format|\n if @post.save\n flash[:success] = t('post.created')\n format.html { redirect_to(polymorphic_path([ postable.container, postable ], :anchor => dom_id(@post))) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post\n RestClient.post(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def post\n doc = Nokogiri::XML(request.body)\n id= (doc/'id').text\n # p = Post.exists?(id) ? Post.find(id) : Post.new\n p= Post.find_or_create_by_intranet_id id\n p.update_attributes :subject => (doc/'subject').text,\n :body => (doc/'body').text, :post_type => (doc/'post-type').text,\n :pic => (doc/'pic') .text, :begin_on=>(doc/'begin-on').text,\n :pic_postimg => (doc/'pic-postimg').text,\n :video => (doc/'video').text, \n :end_on => (doc/'end-on').text, :stick => (doc/'stick').text \n render :text => \"ok\"\n end",
"def post!\n self.https.request self.http_request # Net::HTTPResponse object\n end",
"def create\n @post = current_user.posts.build(post_params)\n @post.body = detokenize(@post.body)\n @post.body = linkify_hashtags(@post.body)\n @post.body = convertBIUS(@post.body)\n @post.body = convertEnter(@post.body)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Wpis został dodany.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save #always post\n #TODO: don't let people overwrite others' posts by changing the URL\n @post ||= generate_post(@user, {\n :paint_time=>0, \n :in_progress=>true})\n #overwrite work in progress\n if params[:started_at] && @post.paint_time.present?\n @post.paint_time += Time.now.to_i - params[:started_at].to_i\n else\n @post.paint_time = nil\n end\n @post.image = params[:picture]\n @post.anim = params[:chibifile]\n @post.palette = params[:swatches]\n @post.rotation = params[:rotation]\n @post.save!\n \n #save and continue drawing option\n render :text=>\"CHIBIOK\\n\" and return\n end",
"def post(content)\n remote_post_to(@uri, content)\n end",
"def post(path, *args)\n page.driver.post(path, *args)\n page.driver.follow_redirects!\n end",
"def post(url, post_data, custom_headers = {})\n headers = @default_headers.merge(custom_headers)\n # slow down the request rate! otherwise you will get blocked\n sleep 1\n return @agent.post(url, post_data, headers)\n end",
"def post_act(act, params)\n Cloudflare::Util::Component.parse_response(HTTParty.post(Cloudflare::Util::Config.get('host.base_url'), body: get_body(act, params)))\n end",
"def create\n @user = current_user\n @turf = Turf.find_by_id(params[:post][:turf_id_value])\n\n @post = @turf.posts.build(:content => params[:post][:content])\n @post.user = current_user\n\n if @post.save\n respond_with(@post)\n flash[:success] = \"Post created!\" \n else\n flash[:error] = \"Post not created :(\"\n end\n end",
"def post(message)\n puts message\n end",
"def post(name,&block)\n build_resource(name, :post, &block)\n end",
"def test_create_on_post\n post :create,\n :post_id => posts(:by_quentin).id,\n :content => 'This is a test note from aaron...'\n assert_response :redirect\n end",
"def submit!\n\tend",
"def post_message\n\t\tdata = {\n\t\t\t:name => \"test_name_#{rand(256)}\",\n\t\t\t:message => \"test_name_#{rand(256)}\"\n\t\t}\n\t\tpost '/', data\n\t\t# Refering to the data variable in the last line of the code block\n\t\t# will cause data to be the return value.\n\t\tdata\n\tend",
"def create\n user_post_param\n respond_to do |format|\n if @post.save\n format.html do\n redirect_to @post, notice:\n \"Post was successfully created.\"\n end\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json do\n render json: @post.errors, status:\n :unprocessable_entity\n end\n end\n end\n end",
"def api_post(action, data)\n api_request(action, data, 'POST')\n end",
"def post(action, params = T.unsafe(nil), header = T.unsafe(nil), query = T.unsafe(nil)); end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: \"Post was successfully created. #{make_undo_link}\" }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(message)\n puts message\n end",
"def post payload, path = \"\" \n make_request(path, \"post\", payload)\n end",
"def create\n \n unless current_user.can_post\n redirect_to welcome_page_path\n end\n \n @post = Post.new\n @post.user = current_user\n @post.privly_application = params[:post][:privly_application]\n\n # Posts default to Private\n if params[:post][:public]\n @post.public = params[:post][:public]\n else\n @post.public = false\n end\n\n set_burn_date\n \n # The random token will be required for users other than the owner\n # to access the content. The model will generate a token before saving\n # if it is not assigned here.\n @post.random_token = params[:post][:random_token]\n \n @post.update_attributes(params[:post])\n \n respond_to do |format|\n if @post.save\n response.headers[\"X-Privly-Url\"] = @post.privly_URL\n format.any { render :json => get_json, \n :status => :created, :location => @post }\n else\n format.any { render :json => @post.errors, \n :status => :unprocessable_entity }\n end\n end\n end",
"def create\n isSavePost = PostsService.createPost(post_params,current_user)\n if isSavePost\n redirect_to root_path , notice: Messages::POST_CREATE_SUCCESS\n else\n render :new\n end\n end",
"def create\n if !session[:id] && !session[:token]\n redirect_to({controller:'users', action:'signin'})\n end\n\n params[:post][:content] = ::Utility.remove_style_and_script_tag(params[:post][:content])\n\n if params[:post][:image]\n url_image = Post::upload(params[:post][:image])\n if url_image != false\n string_encode = Base64.encode64(File.open(Rails.root.to_s + \"/public\" + url_image.to_s,\"rb\").read)\n original_image = params[:post][:image].original_filename\n params[:post][:image] = string_encode\n params[:post][:name_original_image] = original_image\n # File.delete(Rails.root.to_s + \"/public\" + url_image.to_s)\n end\n end\n \n params[:post][:session_id] = session[:id]\n params[:post][:session_token] = session[:token]\n data_input = params[:post]\n data_output = ::Utility.send_request_to_host_api(\"post\",DOMAIN_HOST+VERSION_API+\"/\"+POSTS_TABLE,data_input)\n\n if data_output[\"meta\"][\"code\"].to_i == 1001\n flash[:errors] = data_output[\"meta\"][\"messages\"]\n else\n if data_output[\"meta\"][\"code\"].to_i == 200\n flash[:notice] = data_output[\"meta\"][\"description\"]\n else\n flash[:error] = data_output[\"meta\"][\"description\"]\n end\n end\n redirect_to({action:'new'})\n end",
"def post_message(form)\n begin\n config.sleep_before_post\n form.submit\n rescue StandardError => err\n raise Impostor::PostError.new(err)\n end\n end",
"def post(url, post_vars={})\n send_request url, post_vars, 'POST'\n end",
"def poteti_post(action, parameters = nil, session = nil, flash = nil)\n process_action(action, parameters, session, flash, 'POST')\n end",
"def post(request)\n request.method = :post\n request.call\n end",
"def create\n @post = Post.new(post_params)\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: '投稿は正常に保存されました。' }\n format.json { render :show, status: :created, location: @post }\n logger.debug(@post)\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n frm.button(:name=>\"post\").click\n AssignmentsList.new(@browser)\n end",
"def create\n\t\t@post = Post.new(post_params) # calls the method down below where i state my params\n\t\tif @post.save\n\t\t\tflash[:notice] = \"Successfully created post!\"\n\t\t\tredirect_to post_path(@post)\n\t\telse\n\t\t\tflash[:alert] = \"Error creating new post!\"\n\t\t\trender :new\n\t\tend\n\tend",
"def post(payload)\n post_like payload, Net::HTTP::Post.new(@uri.path)\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post creado con éxito.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def create\n # @post = current_user.posts.new()\n @post = Post.new\n @post.user_id = 1\n @post.content = params[:content]\n @post.anonymous_flag = params[:password]\n @post.weight = 1 #本体自身权重\n @post.epoch_time = Time.now.to_i\n @post.hot = RankingUtils.post_hot(@post.weight, @post.epoch_time)\n @post.publish_date = DateUtils.to_yyyymmdd(Date.today)\n is_post_saved = @post.save\n # 创建问题主题关联\n is_post_theme_saved = save_post_theme\n # 创建用户行为(发布问题)\n is_activities_saved = save_activities(@post.id, \"Post\", 3)\n\n if is_post_saved and is_post_theme_saved and is_activities_saved\n render :json => {:code => ReturnCode::S_OK }\n else\n render :json => {:code => ReturnCode::FA_WRITING_TO_DATABASE_ERROR }\n end\n end",
"def create\n @post = Post.create(post_params)\n\n # post_url comes from the prefix from our route\n redirect_to post_url(@post)\n end",
"def http_post(*args)\n url = args.shift\n c = Curl::Easy.new url\n yield c if block_given?\n c.http_post *args\n c\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def create\n #raise params.inspect\n \n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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 create\n @post = Post.new(name: params[:name],\n email: params[:email],\n year: params[:year],\n major: params[:major],\n Q1: params[:Q1],\n Q2: params[:Q2],\n Q3: params[:Q3],\n Q4: params[:Q4],\n Q5: params[:Q5],\n Q6: params[:Q6],\n user_id: @current_user.id)\n if @post.save\n flash[:notice] = \"Your answer has been recorded.\"\n redirect_to(\"/user/#{@current_user.id}\")\n else\n render(\"post/new\")\n end\n end",
"def do_request\n\t\t\tself.response = post_request(options)\n\t\tend",
"def post(url, args = {})\r\n make_request(:post, url, args)\r\n end",
"def create\n @post = Post.new(params[:post])\n @post.user_id = current_user.id\n @post.date = Time.now\n \n DaoHelper.instance.save_new_post(@post)\n \n redirect_to( :action =>\"index\")\n \n # respond_to do |format|\n # flash[:notice] = 'Post was successfully created.'\n # format.html { redirect_to(\"posts\") }\n # end\n \n # respond_to do |format|\n # if @post.save \n # flash[:notice] = 'Post was successfully created.'\n # format.html { redirect_to(\"posts\") }\n # format.xml { render :xml => @post, :status => :created, :location => @post }\n # else\n # flash[:notice] = 'Post was NOT successfully created: ' + @post.errors \n # format.html { render :action => \"new\" }\n # format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n # end\n # end\n \n end",
"def commit(post)\n add_credentials(post)\n validate_request(post)\n url = URI.parse(resource_url)\n req = Net::HTTP::Post.new(url.path)\n params = post.to_s\n #display \"#{resource_url}?\" + params.map{|k,v| \"#{k}=#{v}\"}.join(\"&\")\n req.set_form_data(params)\n res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }\n case res\n when Net::HTTPSuccess#, Net::HTTPRedirection\n response(res)\n else\n raise Shipsurance::RequestError, res.error!\n end\n end",
"def create\n @post = Post.new(params[:post])\n\t\t\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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 post\n messages.each do |message|\n Flowdock::Client.new(flow_token: @token).post_to_thread(message)\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n save_notice(\"文章创建成功,可以 <a href=\\\"#{url_for(:controller => \"/posts\", :action => \"show\", :slug => @post.slug)}\\\" target=\\\"_blank\\\">点击这里</a> 查看\")\n format.html { redirect_to :controller => \"posts\", :action => \"index\" }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.8352422",
"0.82043755",
"0.81769395",
"0.7831789",
"0.76249915",
"0.7567621",
"0.7523996",
"0.7409122",
"0.73441756",
"0.7314405",
"0.72897834",
"0.7287683",
"0.72528833",
"0.7247261",
"0.72376204",
"0.7107416",
"0.70709574",
"0.7053492",
"0.7044218",
"0.7034199",
"0.6991819",
"0.69519424",
"0.6930622",
"0.69272023",
"0.6873773",
"0.6863949",
"0.6848518",
"0.6830827",
"0.6828915",
"0.6804393",
"0.6766421",
"0.6766421",
"0.67508507",
"0.67312413",
"0.67169404",
"0.6711219",
"0.67101043",
"0.67089856",
"0.6681845",
"0.6647776",
"0.66436625",
"0.6643166",
"0.66355115",
"0.662736",
"0.66205",
"0.6605934",
"0.6602738",
"0.65964377",
"0.65908927",
"0.65906084",
"0.65871334",
"0.6583934",
"0.6569392",
"0.655418",
"0.6551765",
"0.65426636",
"0.65381956",
"0.6534982",
"0.65325075",
"0.65318567",
"0.65292674",
"0.65260035",
"0.6522952",
"0.6522883",
"0.6519876",
"0.6494329",
"0.6491083",
"0.6487811",
"0.64853317",
"0.6475802",
"0.6472679",
"0.64482456",
"0.643213",
"0.64300436",
"0.64287776",
"0.64276224",
"0.64215124",
"0.641978",
"0.64071083",
"0.6406881",
"0.6406116",
"0.64037216",
"0.6402816",
"0.6402565",
"0.6388144",
"0.6384689",
"0.63820064",
"0.6378216",
"0.6371561",
"0.63628733",
"0.6359737",
"0.63569623",
"0.6352331",
"0.63520277",
"0.6351705",
"0.6351555",
"0.63504314",
"0.63484234",
"0.63437164",
"0.6343272",
"0.63414705"
] |
0.0
|
-1
|
This is called in a before action at the top of this file
|
def set_post
@post = Post.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def before_run; end",
"def before_setup; end",
"def before_bootstrap; end",
"def before\n end",
"def before\n end",
"def before() ; end",
"def before_bootstrap\n end",
"def on_before_load\n end",
"def before; end",
"def before\n\t\t\ttrue\n\t\tend",
"def before_setup\n # do nothing by default\n end",
"def before() nil ; end",
"def before_import ; end",
"def post_setup\n end",
"def before_dispatch(env); end",
"def around_hooks; 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 before_filter; end",
"def before_processing\n end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def before_all\n super if defined?(super)\n end",
"def setup\n # override this if needed\n end",
"def before_resolution\n end",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n\t\t# Do nothing\n\tend",
"def before_request\n end",
"def post_init\n end",
"def after_init\n end",
"def post_init\n\tend",
"def post_init\n end",
"def private; end",
"def setup\n\t\tend",
"def setup\n\t\tend",
"def before_dispatch(_env)\n end",
"def after_setup\n # do nothing by default\n end",
"def before_each\n super if defined?(super)\n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def setup\n \n end",
"def on_pre_request( request ); end",
"def on_pre_request( request )\n end",
"def before_initialize(&block); end",
"def before_test(test); end",
"def before_test(test); end",
"def after_view_setup\n end",
"def before_run(ant)\n end",
"def setup\r\n end",
"def after_initialize; end",
"def after_initialize; end",
"def after_initialize; end",
"def after_initialize; end",
"def setup; end",
"def before_lint; end",
"def at_init\n\n\t\tend",
"def after_processing_hook; end",
"def after_initialize\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def setup\n end",
"def after_initialize\n end",
"def after_initialize\n end",
"def on_after_load\n end",
"def setup\n\n end",
"def setup\n\n end",
"def before_assert\n end",
"def before_setup(ant)\n end",
"def after_initialized\n end",
"def setup\n # noop\n end",
"def startup_hook; end",
"def setup\n end",
"def setup\n end",
"def setup\n end"
] |
[
"0.78709",
"0.7815782",
"0.74950093",
"0.7378815",
"0.73123467",
"0.7301313",
"0.730084",
"0.72632384",
"0.7230923",
"0.71606666",
"0.71034265",
"0.71029437",
"0.70081866",
"0.70067257",
"0.7005263",
"0.6983161",
"0.6934832",
"0.6934832",
"0.6849517",
"0.6825912",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6794129",
"0.6785025",
"0.6767631",
"0.67325705",
"0.6691259",
"0.6691259",
"0.66912025",
"0.6690397",
"0.66728824",
"0.666721",
"0.6634392",
"0.66329724",
"0.6631901",
"0.6631901",
"0.66210586",
"0.65889794",
"0.6545618",
"0.6521451",
"0.6521451",
"0.6521451",
"0.6521451",
"0.6521451",
"0.6521451",
"0.6521451",
"0.6507495",
"0.65057284",
"0.6501537",
"0.64948857",
"0.64948857",
"0.64893705",
"0.6474096",
"0.6471528",
"0.6458598",
"0.6458598",
"0.6458598",
"0.6458598",
"0.64531523",
"0.64467573",
"0.6437791",
"0.6435889",
"0.6432014",
"0.6409308",
"0.6409308",
"0.6409308",
"0.63889426",
"0.63889426",
"0.63889426",
"0.63889426",
"0.63889426",
"0.63889426",
"0.63830274",
"0.63830274",
"0.6375722",
"0.6351511",
"0.6351511",
"0.6350476",
"0.6345966",
"0.6321996",
"0.6314007",
"0.6292362",
"0.62463474",
"0.62463474",
"0.62463474"
] |
0.0
|
-1
|
GET /slideshows/1 GET /slideshows/1.json
|
def show
@slideshow = Slideshow.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @slideshow }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @slideshow = Slideshow.find(params[:id])\n @slides = @slideshow.slides\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @slideshow_item = SlideshowItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"def get_slideshow slideshow_id, options = {}\n do_request 'get_slideshow', options.merge(q: q)\n end",
"def index\n @slideshows = Slideshow.all\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def index\n # authorize\n authorize! :read, Slideshow\n \n @slideshows = Slideshow.order(\"style ASC\").paginate(:page => params[:page], :per_page => 10)\n end",
"def index\n @slides = Slide.all\n end",
"def index\n @slideshow_items = SlideshowItem.order(\"display_order ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slideshow_items }\n end\n end",
"def index\n @slideshows = Slideshow.all\n @pag_url = '/slideshows/reload_pag'\n @page = 'home'\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def set_slideshow\n @slideshow = Slideshow.find(params[:id])\n end",
"def set_slideshow\n @slideshow = Slideshow.find(params[:id])\n end",
"def show\n @slide_image = SlideImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide_image }\n end\n end",
"def show\n @page_slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_slide }\n end\n end",
"def new\n @slideshow_item = SlideshowItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"def index\n @slideshows = Slideshow.order(title: :asc)\n end",
"def index\n @title = t('view.slides.index_title')\n @slides = @lesson.slides.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slides }\n end\n end",
"def index\n @illustrations = Illustration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illustrations }\n end\n end",
"def index\n @slider_images = SliderImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def new\n @slideshow = Slideshow.new\n @user.slideshows << @slideshow\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @title = t('view.slides.show_title')\n @slide = @lesson.slides.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def index\n @slides = Slide.paginate(:page => 1, :per_page => 10)\n @page = 'slides'\n end",
"def destroy\n id = @slideshow.id\n @slideshow.delete\n render :json => {:id => id}\n end",
"def show\n session[:slideshow] = @slideshow\n session[:slide_index] = 0\n @slide = @slideshow.slides[0]\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n session[:slideshow] = @slideshow\n session[:slide_index] = 0\n @slide = @slideshow.slides[0]\n\n#respond_to do |format|\n# format.html # show.html.erb\n# format.xml { render :xml => @slideshow }\n# end\n end",
"def show\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def show\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def set_slideshow\n if !params[:id].nil?\n @slideshow = Slideshow.find(params[:id])\n else\n @slideshow = Slideshow.find(session[:slideshow][\"id\"])\n end\n end",
"def set_slideshow\n @slideshow = Slideshow.find_by_uid(params[:id].downcase)\n end",
"def show\n @slides =@lecture.slides(params[:urlpage])\n \n end",
"def slideshow\n self\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @event = Event.find params[:id]\n @slides = @event.slides.page(params[:page]).per(10)\n end",
"def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @illustration }\n end\n end",
"def index\n @food_sliders = FoodSlider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @food_sliders }\n end\n end",
"def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @illustration }\n end\n end",
"def search_slideshows q, options = {}\n do_request 'search_slideshows', options.merge(q: q)\n end",
"def slideshow(options={})\n default_options = { duration: 7000, slides: [], transition: \"toggle\" }\n options = default_options.merge(options)\n html = ''\n if options[:slides].size > 1\n html += slideshow_controls(options)\n options[:slides].each_with_index do |slide,i|\n html += slideshow_frame(slide, i)\n end\n raw(html + javascript_tag(\"start_slideshow(1, #{options[:slides].size}, #{options[:duration]}, '#{options[:transition]}');\"))\n else\n raw(slideshow_frame(options[:slides].first))\n end\n end",
"def index\n render json: Picture.all\n end",
"def get_slideshows_by_tag tag, options = {}\n do_request 'get_slideshows_by_tag', options.merge(tag: tag)\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def index\n @live_promo_slides = PromoSlide.where(live: true).order('sort_order')\n @promo_slides = PromoSlide.where(live: false).order('updated_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @promo_slides }\n end\n end",
"def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end",
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @pic_stories = PicStory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pic_stories }\n end\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @pslide = Pslide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pslide }\n end\n end",
"def show\n @food_slider = FoodSlider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_slider }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @galleries }\n end\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @slideshow }\n end\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @slideshow }\n end\n end",
"def get_slideshows_by_user username_for, options = {}\n do_request 'get_slideshows_by_user', options.merge(username_for: username_for)\n end",
"def new\n @page_slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_slide }\n end\n end",
"def index\n @galleries = current_client.galleries\n @title = \"My Galleries\"\n end",
"def show\n @pro_wmall_slide_picture = Wmall::SlidePicture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pro_wmall_slide_picture }\n end\n end",
"def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def index\n @slider_image_types = SliderImageType.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def index\n @slides = Slide.paginate(:page => params[:page], :per_page => 10).order('id DESC').accessible_by(current_ability)\n end",
"def index\n if params[:search].present?\n @slides = Slide.where('LOWER(title) ILIKE ?', \"%#{params[:search].downcase}%\")\n else\n @slides = Slide.all\n end\n @slides = @slides.order('created_at desc').paginate(:page => params[:page])\n end",
"def slideshow_params\n params.require(:slideshow).permit(:index, :show, :new, :create, :edit, :update, :destroy)\n end",
"def show_slide\n @slide = @slideshow.slides[session[:slide_index]]\n session[:slide_index] += 1\n if @slide.nil?\n session[:slide_index] = 0\n @slide = @slideshow.slides[0]\n end\n render partial: \"show_slides\"\n end",
"def new\n @slide_image = SlideImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide_image }\n end\n end",
"def index\n @images = Image.all\n\n render json: @images\n end",
"def index\n @photos = Photo.all\n\n render json: @photos\n end",
"def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.slim\n format.json { render json: @images }\n end\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def index\n @episodes = Episode.all\n\n render json: @episodes\n end",
"def show\n @pic = Pic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic }\n end\n end",
"def show\n @pic_story = PicStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic_story }\n end\n end",
"def show\n @presentation = Presentation.find_by_name(params[:prez_id])\n @pslide = Pslide.find(params[:id])\n @pcontent=Array.new\n @pbehavior=Pbehavior.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pslide }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def show\n @casestudy = Casestudy.find(params[:id])\n @photos = @casestudy.photos.order( :created_at )\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @casestudy }\n end\n end",
"def index\n @web_car_galleries = WebCarGallery.all\n\n render json: @web_car_galleries\n end",
"def index\n @thumbs = Thumb.all\n\n render json: @thumbs\n end",
"def index\n @images = getmydata(\"Image\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def show_slide\n @slideshow = session[:slideshow]\n session[:slide_index] += 1\n @slide = @slideshow.slides[session[:slide_index]]\n if @slide == nil\n session[:slide_index] = 0\n @slide = @slideshow.slides[session[:slide_index]]\n end\n render :partial => \"show_slide\"\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshows_url }\n format.json { head :no_content }\n end\n end",
"def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def update\n respond_to do |format|\n if @slideshow.update(slideshow_params)\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }\n format.json { render :show, status: :ok, location: @slideshow }\n else\n format.html { render :edit }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slideshow.update(slideshow_params)\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }\n format.json { render :show, status: :ok, location: @slideshow }\n else\n format.html { render :edit }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @write_right = userCould :slide\n if params[:search] then\n @slides = Slide.find(:all, :conditions => [\"name LIKE ?\", \"%#{params[:search]}%\"])\n redirect_to @slides[0] if @slides.count == 1\n else\n @slides = Slide.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slides }\n end\n end\n end",
"def index\n logger.info params.inspect\n if params[:toggle_activation]\n slide = Slide.where(:id => params[:toggle_activation]).first\n logger.info slide\n slide.toggle_visibility!\n slide.save\n end\n if params[:up]\n slide = Slide.where(:position => params[:up]).first\n if slide.position > 1\n other_slide = Slide.where(:position => slide.position-1).first\n other_slide.increment :position\n slide.decrement :position\n other_slide.save\n slide.save\n slide.reorder_positions!\n end\n end\n if params[:down]\n slide = Slide.where(:position => params[:down]).last\n logger.info \"found slide #{slide.inspect}\"\n if slide.position < Slide.where(:visible => true).count\n other_slide = Slide.where(:position => slide.position+1).first\n other_slide.decrement :position\n slide.increment :position\n other_slide.save\n slide.save\n slide.reorder_positions!\n end\n end\n\n @slides = Slide.find( :all, :order => \"visible DESC, position ASC\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @slides }\n end\n end",
"def show\n @carousel_slides = @carousel.carousel_slides\n end",
"def get_slideshows_by_group group_name, options = {}\n do_request 'get_slideshows_by_group', options.merge(group_name: group_name)\n end",
"def index\n @presentation = Presentation.friendly.find(params[:presentation_id])\n @slides = @presentation.slides.order(sort_order: :asc)\n redirect_to new_presentation_slide_path(@presentation) unless @slides.any?\n\n add_breadcrumb @presentation.name, presentation_path(@presentation)\n add_breadcrumb 'Slides', presentation_slides_path(@presentation)\n\n end",
"def index\n @activity = Activity.find(params[:activity_id])\n @pictures = @activity.pictures\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end"
] |
[
"0.82744855",
"0.7762472",
"0.77482057",
"0.77462846",
"0.7373935",
"0.7373935",
"0.71811527",
"0.71302176",
"0.71240145",
"0.71027374",
"0.7046371",
"0.7046371",
"0.7046371",
"0.6972977",
"0.6972977",
"0.69592965",
"0.6883599",
"0.68524235",
"0.6838921",
"0.6777041",
"0.6735912",
"0.6700359",
"0.66920537",
"0.66447216",
"0.6612289",
"0.659632",
"0.6586762",
"0.6554498",
"0.6524209",
"0.6524209",
"0.6522215",
"0.65170753",
"0.6464188",
"0.6454167",
"0.64492536",
"0.64492536",
"0.64492536",
"0.6447594",
"0.6432105",
"0.6409496",
"0.6406447",
"0.63941246",
"0.6329928",
"0.630284",
"0.62982684",
"0.62897384",
"0.62897384",
"0.62897384",
"0.6284988",
"0.6283572",
"0.6282852",
"0.6282852",
"0.6282852",
"0.6282087",
"0.6281355",
"0.6281355",
"0.6271717",
"0.62633216",
"0.62581813",
"0.62492126",
"0.62492126",
"0.6249167",
"0.6241838",
"0.6221719",
"0.6219152",
"0.6215199",
"0.6201448",
"0.61759007",
"0.61749387",
"0.6170674",
"0.6168495",
"0.6158267",
"0.6152888",
"0.61447984",
"0.613747",
"0.6132655",
"0.6121891",
"0.61010283",
"0.60892713",
"0.60726357",
"0.60676885",
"0.6064847",
"0.60551435",
"0.60394174",
"0.60349137",
"0.6031836",
"0.60256773",
"0.60222656",
"0.60222656",
"0.60203654",
"0.600759",
"0.600759",
"0.59949344",
"0.597702",
"0.597654",
"0.5975707",
"0.5971379",
"0.59663695",
"0.5962756"
] |
0.8133371
|
2
|
GET /slideshows/new GET /slideshows/new.json
|
def new
@slideshow = Slideshow.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @slideshow }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @slideshow_item = SlideshowItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @slideshow = Slideshow.new\n @user.slideshows << @slideshow\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def new\n @page_slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_slide }\n end\n end",
"def new\n @pslide = Pslide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pslide }\n end\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @slide_image = SlideImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide_image }\n end\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @slideshow }\n end\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @slideshow }\n end\n end",
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(url=\"\")\n if url.present?\n @slideshow = Slideshow.new\n @slideshow.name = url\n else\n @slideshow = Slideshow.new(params[:slideshow])\n end\n @slideshow.slide_order_hash = {}\n respond_to do |format|\n \n if @slideshow.save\n format.html { \n redirect_to(\"/#{@slideshow.name}/new\", :notice => 'Slideshow was successfully created.') } #CONSTRUCTION, finish this path after completing routes\n \n #format.html { redirect_to(new_slideshow_slide_path(@slideshow), :notice => 'Slideshow was successfully created.') }\n format.xml { render :xml => @slideshow, :status => :created, :location => @slideshow }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n return false if !userCan :slide\n @slide = Slide.new\n @items = Item.find(:all, :order => \"position\")\n @agendas= Agenda.find(:all, :order => \"position\")\n @projectors = Projector.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @title = t('view.slides.new_title')\n @slide = @lesson.slides.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @promo_slide = PromoSlide.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promo_slide }\n end\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to(@slideshow, :notice => 'Slideshow was successfully created.') }\n format.xml { render :xml => @slideshow, :status => :created, :location => @slideshow }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def new\n @slider_image = SliderImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def new\n @slider_image = SliderImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n @user.slideshows << @slideshow\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @pic = Pic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pic }\n end\n end",
"def create\n @slide = Slide.new(params[:slide])\n\n # If we're creating a new slide from the slideshow editing page, add the\n # slide to the slideshow and then redirect to the slideshow edit screen.\n @slide.slideshows << (@slideshow = Slideshow.find(params[:slideshow_id])) if params[:slideshow_id]\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to (@slideshow ? edit_slideshow_path(@slideshow) : @slide), notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n @slides = @slideshow.slides\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def create\n # authorize\n authorize! :create, Slideshow\n @slideshow = Slideshow.new(slideshow_params)\n \n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to edit_admin_slideshow_path(@slideshow.id), notice: 'Tạo mới trình chiếu thành công.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow_item = SlideshowItem.new(params[:slideshow_item])\n\n respond_to do |format|\n if @slideshow_item.save\n format.html { redirect_to @slideshow_item, notice: \"\\\"#{@slideshow_item.title}\\\" was successfully created.\".html_safe }\n format.json { render json: @slideshow_item, status: :created, location: @slideshow_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @presentation = Presentation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presentation }\n end\n end",
"def new\n @gallery = Gallery.new(:public => true)\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gallery }\n end\n end",
"def new\n @illustration = Illustration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @illustration }\n end\n end",
"def new\n @food_slider = FoodSlider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @food_slider }\n end\n end",
"def create\n newparams = coerce(params) \n @slide = Slide.new(newparams[:slide])\n @slide.name = @slide.image_file_name\n @slide.position = @slide.presentation.slides.count + 1\n if @slide.save\n flash[:notice] = \"Successfully created slide.\"\n respond_to do |format| \n format.html {redirect_to @slide.presentation} \n format.json { render :json => { :result => 'success', :slide => slide_url(@slide) } }\n end\n else\n render :action => 'new'\n end\n end",
"def new\n @illustration = Illustration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @illustration }\n end\n end",
"def new\n @photo = Photo.new\n\n render json: @photo\n end",
"def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @gallery }\n end\n end",
"def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @gallery }\n end\n end",
"def new\n @gallery = Gallery.new\n \n respond_to do |format|\n format.html{ redirect_to edit_portfolio_project_path(params[:project_id])+\"?new_gallery=1\" }\n format.json { render json: @gallery }\n end\n end",
"def new\n \n @page = Page.new\n @page.images.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end",
"def show\n @slideshow_item = SlideshowItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"def new\n @livro = Livro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @livro }\n end\n end",
"def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recurso }\n end\n end",
"def new\n @pro_wmall_slide_picture = Wmall::SlidePicture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pro_wmall_slide_picture }\n end\n end",
"def new\n @image_gallery = ImageGallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_gallery }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @livestock = Livestock.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @livestock }\n end\n end",
"def new\n @cycle = Cycle.new\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cycle }\n end\n end",
"def create\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to @slide, notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @photo = @allbum.photos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end",
"def new\n @voc = Voc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @voc }\n end\n end",
"def new\n @album = Album.new\n @title = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @album }\n format.js {}\n end\n end",
"def new\n @photoid = Photoid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photoid }\n end\n end",
"def new\n @picture = Picture.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @picture }\n end\n end",
"def new\n @photo_library = PhotoLibrary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo_library }\n end\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @photo }\n end\n end",
"def new\n @picture = Picture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @picture }\n end\n end",
"def new\n @picture = Picture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @picture }\n end\n end",
"def new\n @picture = Picture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @picture }\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 @image_url = ImageUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_url }\n end\n end",
"def new\n @pictures_of_cat = PicturesOfCat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pictures_of_cat }\n end\n end",
"def new\n @image_section = ImageSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_section }\n end\n end",
"def new\n @drawable = Drawable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @drawable }\n end\n end",
"def new\n @video_gallery = VideoGallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @video_gallery }\n end\n end",
"def index\n @slideshows = Slideshow.all\n end",
"def new\n @page = Page.new\n @photos = Photo.all\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @go_slim = GoSlim.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_slim }\n end\n end",
"def new\n @imovel = Imovel.new\n @imovel.images.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @imovel }\n end\n end",
"def new\n @slide_type = SlideType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @slide_type }\n end\n end",
"def new\n @mision = Mision.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mision }\n end\n end",
"def new\n @publication = Publication.new\n @publication.url ||= 'http://www.'\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @publication }\n end\n end",
"def new\n @picture = Picture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=>@picture}\n end\n end",
"def new\n\t\t@post = Post.new\n\t\t# respond_to do |format|\n\t\t# \tformat.html\n\t\t# \tformat.json {render json: @post}\n\t\t# end\n\n\t\t3.times do\n\t\t\tphoto = @post.photos.build\n\t\tend\n\tend",
"def create\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to slides_url, notice: '幻灯片创建成功.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @pic_story = current_user.pic_stories.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pic_story }\n end\n end",
"def new\n @wallpaper = Wallpaper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wallpaper }\n end\n end",
"def new\n @podcast = Podcast.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @podcast }\n end\n end",
"def new\n @podcast = Podcast.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @podcast }\n end\n end",
"def new\n @podcast = Podcast.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @podcast }\n end\n end",
"def new\n @foto = Foto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foto }\n end\n end",
"def new\n @portion = Portion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @portion }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end"
] |
[
"0.80901617",
"0.7739159",
"0.7739159",
"0.7739159",
"0.77233624",
"0.76675105",
"0.764971",
"0.7520389",
"0.7520389",
"0.7458036",
"0.7436885",
"0.7436885",
"0.73529214",
"0.73529214",
"0.73529214",
"0.71064067",
"0.7106325",
"0.70932066",
"0.7074958",
"0.70222527",
"0.6958117",
"0.6958117",
"0.6948863",
"0.6948863",
"0.690506",
"0.6869583",
"0.68467414",
"0.68446416",
"0.679607",
"0.6789002",
"0.6785553",
"0.67650664",
"0.67366195",
"0.67343366",
"0.6714344",
"0.6701975",
"0.66769093",
"0.66743517",
"0.66743517",
"0.665282",
"0.6638799",
"0.6611068",
"0.66044164",
"0.65843016",
"0.656691",
"0.6566859",
"0.65400666",
"0.6539655",
"0.6539655",
"0.6539655",
"0.6539655",
"0.6539655",
"0.6539655",
"0.6539655",
"0.6539655",
"0.6539655",
"0.6539655",
"0.6539655",
"0.6539655",
"0.65353125",
"0.65330565",
"0.6520162",
"0.65186036",
"0.6497866",
"0.64877325",
"0.6480863",
"0.6479916",
"0.647969",
"0.64754194",
"0.6475287",
"0.6475287",
"0.64582884",
"0.64582884",
"0.64582884",
"0.6448479",
"0.6447659",
"0.64456165",
"0.6419666",
"0.63967925",
"0.63818276",
"0.6378631",
"0.6378384",
"0.63743335",
"0.63702667",
"0.6369069",
"0.6366484",
"0.6358118",
"0.6350791",
"0.6347414",
"0.63472724",
"0.63429695",
"0.63385355",
"0.63373613",
"0.63373613",
"0.63373613",
"0.6335142",
"0.63295525",
"0.6322369",
"0.6322369"
] |
0.8400732
|
0
|
POST /slideshows POST /slideshows.json
|
def create
@slideshow = Slideshow.new(params[:slideshow])
respond_to do |format|
if @slideshow.save
format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }
format.json { render json: @slideshow, status: :created, location: @slideshow }
else
format.html { render action: "new" }
format.json { render json: @slideshow.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n @user.slideshows << @slideshow\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def slideshow_params\n params.require(:slideshow).permit(:index, :show, :new, :create, :edit, :update, :destroy)\n end",
"def new\n @slideshow = Slideshow.new\n @user.slideshows << @slideshow\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def create\n @slide = Slide.new(params[:slide])\n\n # If we're creating a new slide from the slideshow editing page, add the\n # slide to the slideshow and then redirect to the slideshow edit screen.\n @slide.slideshows << (@slideshow = Slideshow.find(params[:slideshow_id])) if params[:slideshow_id]\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to (@slideshow ? edit_slideshow_path(@slideshow) : @slide), notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n @slides = @slideshow.slides\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to(@slideshow, :notice => 'Slideshow was successfully created.') }\n format.xml { render :xml => @slideshow, :status => :created, :location => @slideshow }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @slideshows = Slideshow.all\n end",
"def slideshow_params\n params.require(:slideshow).permit(:image_url, :title_1, :color_1, :title_2, :color_2, :name_button, :link, :style)\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def create(url=\"\")\n if url.present?\n @slideshow = Slideshow.new\n @slideshow.name = url\n else\n @slideshow = Slideshow.new(params[:slideshow])\n end\n @slideshow.slide_order_hash = {}\n respond_to do |format|\n \n if @slideshow.save\n format.html { \n redirect_to(\"/#{@slideshow.name}/new\", :notice => 'Slideshow was successfully created.') } #CONSTRUCTION, finish this path after completing routes\n \n #format.html { redirect_to(new_slideshow_slide_path(@slideshow), :notice => 'Slideshow was successfully created.') }\n format.xml { render :xml => @slideshow, :status => :created, :location => @slideshow }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @slideshow_item = SlideshowItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"def create\n # authorize\n authorize! :create, Slideshow\n @slideshow = Slideshow.new(slideshow_params)\n \n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to edit_admin_slideshow_path(@slideshow.id), notice: 'Tạo mới trình chiếu thành công.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def slideshow_params\n params.require(:slideshow).permit(:name, :public, :head_image)\n end",
"def slideshow_params\n params.require(:slideshow).permit(:title, :highlights_only)\n end",
"def create\n @slideshow_item = SlideshowItem.new(params[:slideshow_item])\n\n respond_to do |format|\n if @slideshow_item.save\n format.html { redirect_to @slideshow_item, notice: \"\\\"#{@slideshow_item.title}\\\" was successfully created.\".html_safe }\n format.json { render json: @slideshow_item, status: :created, location: @slideshow_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upload_slideshow username, password, slideshow_title, options = {}\n do_request 'upload_slideshow', options.merge(username: username, password: password,\n slideshow_title: slideshow_title)\n end",
"def set_slideshow\n @slideshow = Slideshow.find(params[:id])\n end",
"def set_slideshow\n @slideshow = Slideshow.find(params[:id])\n end",
"def index\n @slideshow_items = SlideshowItem.order(\"display_order ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slideshow_items }\n end\n end",
"def create\n newparams = coerce(params) \n @slide = Slide.new(newparams[:slide])\n @slide.name = @slide.image_file_name\n @slide.position = @slide.presentation.slides.count + 1\n if @slide.save\n flash[:notice] = \"Successfully created slide.\"\n respond_to do |format| \n format.html {redirect_to @slide.presentation} \n format.json { render :json => { :result => 'success', :slide => slide_url(@slide) } }\n end\n else\n render :action => 'new'\n end\n end",
"def create\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to @slide, notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n id = @slideshow.id\n @slideshow.delete\n render :json => {:id => id}\n end",
"def create\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to slides_url, notice: '幻灯片创建成功.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slide = Slide.new(slide_params)\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to @slide, notice: \"Slide was successfully created.\" }\n format.json { render :show, status: :created, location: @slide }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @slideshow_item = SlideshowItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"def index\n @slides = Slide.all\n end",
"def create\n @page_slide = Slide.new(params[:page_slide])\n\n respond_to do |format|\n if @page_slide.save\n format.html { redirect_to @page_slide, notice: 'Slide was successfully created.' }\n format.json { render json: @page_slide, status: :created, location: @page_slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page_slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slide = Slide.new(slide_params)\n @slide.presentation = @presentation\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to location: presentation_slides_url(@presentation), notice: 'Slide was successfully created.' }\n format.json { render action: 'show', status: :created, location: @slide }\n else\n format.html { render action: 'new' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_slideshow slideshow_id, options = {}\n do_request 'get_slideshow', options.merge(q: q)\n end",
"def slideshow(options={})\n default_options = { duration: 7000, slides: [], transition: \"toggle\" }\n options = default_options.merge(options)\n html = ''\n if options[:slides].size > 1\n html += slideshow_controls(options)\n options[:slides].each_with_index do |slide,i|\n html += slideshow_frame(slide, i)\n end\n raw(html + javascript_tag(\"start_slideshow(1, #{options[:slides].size}, #{options[:duration]}, '#{options[:transition]}');\"))\n else\n raw(slideshow_frame(options[:slides].first))\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def new\n @slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def update\n @slideshow = @user.slideshows.find(params[:id])\n @user.slideshows << @slideshow\n\n respond_to do |format|\n if @slideshow.update_attributes(params[:slideshow])\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @page_slide = Slide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_slide }\n end\n end",
"def new\n @pslide = Pslide.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pslide }\n end\n end",
"def index\n @slideshows = Slideshow.all\n @pag_url = '/slideshows/reload_pag'\n @page = 'home'\n end",
"def index\n # authorize\n authorize! :read, Slideshow\n \n @slideshows = Slideshow.order(\"style ASC\").paginate(:page => params[:page], :per_page => 10)\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @slideshow }\n end\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @slideshow }\n end\n end",
"def index\n @slideshows = Slideshow.order(title: :asc)\n end",
"def index\n @slider_images = SliderImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def create\n @slide_image = SlideImage.new(params[:slide_image])\n\n respond_to do |format|\n if @slide_image.save\n format.html { redirect_to @slide_image, notice: 'Slide image was successfully created.' }\n format.json { render json: @slide_image, status: :created, location: @slide_image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @slide_image = SlideImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide_image }\n end\n end",
"def set_slideshow\n if !params[:id].nil?\n @slideshow = Slideshow.find(params[:id])\n else\n @slideshow = Slideshow.find(session[:slideshow][\"id\"])\n end\n end",
"def create\n @image_slider = ImageSlider.new(image_slider_params)\n\n respond_to do |format|\n if @image_slider.save\n format.html { redirect_to @image_slider, notice: 'Image slider was successfully created.' }\n format.json { render :show, status: :created, location: @image_slider }\n else\n format.html { render :new }\n format.json { render json: @image_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def slides\n @id = params[:id]\n @item = Item.find(@id)\n begin\n @slides = @item.images.where(['publish=?', true]).order('position')\n rescue => error\n flash[:error] = error.message\n ensure\n # no slides found so create some\n if @slides.empty?\n @slides = @item.create_images\n end\n end\n unless @id.nil? || @slides.nil? || @slides.empty?\n respond_to do |format|\n format.xml\n end\n else\n flash[:error] = 'Unable to locate process slides for id number ' + params[:id].to_s + '.'\n end\n end",
"def create\n\n @slide = Slide.new(slide_params)\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to [:admin, @slide], notice: 'Slide was successfully created.' }\n format.json { render action: 'show', status: :created, location: @slide }\n else\n format.html { render action: 'new' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slideshow = Slideshow.find(params[:id])\n\n @slideshow.slides += params[:add_slides].map{ |es| Slide.find(es) } if params[:add_slides]\n\n @slideshow.slideshow_slides.where(:slide_id => params[:del_slides]).delete_all\n\n respond_to do |format|\n if @slideshow.update_attributes(params[:slideshow])\n format.js { render :nothing => true }\n format.html { redirect_to (params[:existing_slides] ? edit_slideshow_path(@slideshow) : @slideshow), notice: 'Slideshow was successfully updated.' }\n format.json { head :no_content }\n else\n format.js { render :nothing => true }\n format.html { render action: \"edit\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slideshow.update(slideshow_params)\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }\n format.json { render :show, status: :ok, location: @slideshow }\n else\n format.html { render :edit }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slideshow.update(slideshow_params)\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }\n format.json { render :show, status: :ok, location: @slideshow }\n else\n format.html { render :edit }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshows_url }\n format.json { head :no_content }\n end\n end",
"def set_slideshow\n @slideshow = Slideshow.find_by_uid(params[:id].downcase)\n end",
"def create\n @title = t('view.slides.new_title')\n @slide = @lesson.slides.build slide_params\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to(course_lesson_url(@lesson.course, @lesson, anchor: @slide.anchor), notice: t('view.slides.correctly_created')) }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: 'new' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n uploaded_io = params[:image_this]\n slide = Slide.new\n slide.user_id = current_user.id\n slide.file = uploaded_io\n if slide.save\n if params[:name].present?\n name = params[:name]\n else\n name = slide.file.to_s.split('/').last\n end\n\n if params[:tags].present?\n params[:tags].split(',').each do |tag|\n t = Tag.find_or_create_by(:name => tag)\n Tagging.create(:tag_id => t.id, :slide_id => slide.id, :user_id => current_user.id)\n end\n end\n\n slide.update_attributes(:name => name)\n out = 'success'\n else\n out = 'fail'\n end\n render :json => { :outcome => out, :url => slide.file.thumb.url }\n end",
"def destroy\n @slideshow.destroy\n respond_to do |format|\n format.html { redirect_to slideshows_url, notice: 'Slideshow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slideshow.destroy\n respond_to do |format|\n format.html { redirect_to slideshows_url, notice: 'Slideshow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @title = t('view.slides.index_title')\n @slides = @lesson.slides.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slides }\n end\n end",
"def new\n @title = t('view.slides.new_title')\n @slide = @lesson.slides.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def index\n logger.info params.inspect\n if params[:toggle_activation]\n slide = Slide.where(:id => params[:toggle_activation]).first\n logger.info slide\n slide.toggle_visibility!\n slide.save\n end\n if params[:up]\n slide = Slide.where(:position => params[:up]).first\n if slide.position > 1\n other_slide = Slide.where(:position => slide.position-1).first\n other_slide.increment :position\n slide.decrement :position\n other_slide.save\n slide.save\n slide.reorder_positions!\n end\n end\n if params[:down]\n slide = Slide.where(:position => params[:down]).last\n logger.info \"found slide #{slide.inspect}\"\n if slide.position < Slide.where(:visible => true).count\n other_slide = Slide.where(:position => slide.position+1).first\n other_slide.decrement :position\n slide.increment :position\n other_slide.save\n slide.save\n slide.reorder_positions!\n end\n end\n\n @slides = Slide.find( :all, :order => \"visible DESC, position ASC\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @slides }\n end\n end",
"def update\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n if @slideshow.update_attributes(params[:slideshow])\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def search_slideshows q, options = {}\n do_request 'search_slideshows', options.merge(q: q)\n end",
"def index\n @slides = Slide.paginate(:page => 1, :per_page => 10)\n @page = 'slides'\n end",
"def destroy\n #@slideshow = @user.slideshows.find(params[:id])\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshows_url }\n format.json { head :no_content }\n end\n end",
"def slide_params\n params.require(:slide).permit(:name, :slimg)\n end",
"def create\n @promo_slide = PromoSlide.new(promo_slide_params)\n respond_to do |format|\n if @promo_slide.save\n format.html { redirect_to @promo_slide, notice: 'Promo slide was successfully created.' }\n format.json { render json: @promo_slide, status: :created, location: @promo_slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @promo_slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @presentation = Presentation.new(presentation_params)\n @presentation.user = current_user\n \n respond_to do |format|\n if @presentation.save\n format.html { redirect_to presentation_slides_path(@presentation), notice: 'Presentation was successfully created.' }\n format.json { render action: 'show', status: :created, location: @presentation }\n else\n format.html { render action: 'new' }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slide = Slide.new(slide_params)\n respond_to do |format|\n if @slide.save\n @slide.take_screenshot\n @slide.create_activity(:create, owner: current_user, parameters: { name: @slide.menu_name })\n current_user.slides << @slide\n format.html { redirect_to edit_slide_path(@slide) }\n format.json { render :show, status: :created, location: @slide }\n else\n format.html { render :new }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n session[:slideshow] = @slideshow\n session[:slide_index] = 0\n @slide = @slideshow.slides[0]\n end",
"def index\n @food_sliders = FoodSlider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @food_sliders }\n end\n end",
"def create\n @mode = 'I'\n render 'admin/slides/slide'\n end",
"def delete_slideshow username, password, slideshow_id\n do_request 'delete_slideshow', username: username, password: password, slideshow_id: slideshow_id\n end",
"def destroy\n @slideshow_item = SlideshowItem.find(params[:id])\n @slideshow_item.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshow_items_url }\n format.json { head :ok }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n session[:slideshow] = @slideshow\n session[:slide_index] = 0\n @slide = @slideshow.slides[0]\n\n#respond_to do |format|\n# format.html # show.html.erb\n# format.xml { render :xml => @slideshow }\n# end\n end",
"def create\n @slidedeck = Slidedeck.new(slidedeck_params)\n\n respond_to do |format|\n if @slidedeck.save\n format.html { redirect_to @slidedeck, notice: 'Slidedeck was successfully created.' }\n format.json { render :show, status: :created, location: @slidedeck }\n else\n format.html { render :new }\n format.json { render json: @slidedeck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @slider_image_types = SliderImageType.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to(slideshows_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to(slideshows_url) }\n format.xml { head :ok }\n end\n end",
"def saveSlide\n if params[:mode] == 'I'\n update = SlidesHlp.saveSlide(params[:slide])\n else\n update = SlidesHlp.updateSlide(params[:slide])\n end\n render json: update\n end",
"def new\n return false if !userCan :slide\n @slide = Slide.new\n @items = Item.find(:all, :order => \"position\")\n @agendas= Agenda.find(:all, :order => \"position\")\n @projectors = Projector.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slide }\n end\n end",
"def index\n @illustrations = Illustration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illustrations }\n end\n end",
"def create\n return false if !userCan :slide\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n if params[:projector_add] then\n params[:projector_add].each {|v|\n Projector.find(v).update_attributes(:slide_id => params[:id]);\n Message.Command(:id => \"projector-#{v}\", :cmd => \"load\", :slide => params[:id])\n }\n end\n format.html { redirect_to @slide, notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def slide_params\n params.require(:slide).permit(:title, :header, :number, :body, :presentation_id)\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def edit_slideshow username, password, slideshow_id, options = {}\n do_request 'edit_slideshow', options.merge(username: username, password: password,\n slideshow_id: slideshow_id)\n end",
"def create\n @slider_serv = SliderServ.new(slider_serv_params)\n\n respond_to do |format|\n if @slider_serv.save\n format.html { redirect_to @slider_serv, notice: 'Slider serv was successfully created.' }\n format.json { render :show, status: :created, location: @slider_serv }\n else\n format.html { render :new }\n format.json { render json: @slider_serv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slider_image = SliderImage.new(params[:slider_image])\n\n respond_to do |format|\n if @slider_image.save\n format.html { redirect_to @slider_image, notice: 'Slider image was successfully created.' }\n format.json { render json: @slider_image, status: :created, location: @slider_image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slider_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @main_slider = MainSlider.new(main_slider_params)\n\n respond_to do |format|\n if @main_slider.save\n format.html { redirect_to @main_slider, notice: 'Main slider was successfully created.' }\n format.json { render :show, status: :created, location: @main_slider }\n else\n format.html { render :new }\n format.json { render json: @main_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def slideshow\n self\n end",
"def slide_params\n params.require(:slide).permit(:start_time, :title, :image_id, :notes, :slide_type)\n end"
] |
[
"0.74267346",
"0.74267346",
"0.74267346",
"0.7147942",
"0.7098196",
"0.7098196",
"0.7049254",
"0.6980505",
"0.689624",
"0.6893306",
"0.6858169",
"0.677515",
"0.6753637",
"0.6713457",
"0.6713457",
"0.6639847",
"0.6608018",
"0.65958506",
"0.65389365",
"0.64928275",
"0.64604634",
"0.6410056",
"0.6358552",
"0.6358552",
"0.6316159",
"0.63109833",
"0.63005567",
"0.62886125",
"0.62817115",
"0.622915",
"0.6192607",
"0.61881316",
"0.6173976",
"0.6168008",
"0.6160602",
"0.6156783",
"0.61464196",
"0.61464196",
"0.61464196",
"0.612805",
"0.6122984",
"0.61028886",
"0.60634524",
"0.6033533",
"0.60255617",
"0.60255617",
"0.5990616",
"0.5974238",
"0.5951855",
"0.5943208",
"0.5928538",
"0.59044594",
"0.5901954",
"0.59005964",
"0.5885314",
"0.58852357",
"0.58852357",
"0.5879486",
"0.5879486",
"0.58335954",
"0.58331853",
"0.57791144",
"0.5770845",
"0.5770845",
"0.5759856",
"0.5724541",
"0.5703777",
"0.56975657",
"0.56973183",
"0.56939197",
"0.5664537",
"0.5624779",
"0.56213206",
"0.56208",
"0.55907905",
"0.5584762",
"0.5574729",
"0.5567232",
"0.5557464",
"0.55476356",
"0.55464506",
"0.5543563",
"0.5531898",
"0.55255413",
"0.55255413",
"0.5525349",
"0.5516407",
"0.5511825",
"0.55115354",
"0.54893",
"0.5479747",
"0.5479747",
"0.5479747",
"0.5468169",
"0.54604834",
"0.54546636",
"0.5453568",
"0.545203",
"0.54375064"
] |
0.74475336
|
0
|
PUT /slideshows/1 PUT /slideshows/1.json
|
def update
@slideshow = Slideshow.find(params[:id])
respond_to do |format|
if @slideshow.update_attributes(params[:slideshow])
format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @slideshow.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @slideshow = @user.slideshows.find(params[:id])\n @user.slideshows << @slideshow\n\n respond_to do |format|\n if @slideshow.update_attributes(params[:slideshow])\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slideshow.update(slideshow_params)\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }\n format.json { render :show, status: :ok, location: @slideshow }\n else\n format.html { render :edit }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slideshow.update(slideshow_params)\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully updated.' }\n format.json { render :show, status: :ok, location: @slideshow }\n else\n format.html { render :edit }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n if @slideshow.update_attributes(params[:slideshow])\n format.html { redirect_to(@slideshow, :notice => 'Slideshow was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n if @slideshow.update_attributes(params[:slideshow])\n format.html { redirect_to(@slideshow, :notice => 'Slideshow was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @slideshow = Slideshow.find(params[:id])\n\n @slideshow.slides += params[:add_slides].map{ |es| Slide.find(es) } if params[:add_slides]\n\n @slideshow.slideshow_slides.where(:slide_id => params[:del_slides]).delete_all\n\n respond_to do |format|\n if @slideshow.update_attributes(params[:slideshow])\n format.js { render :nothing => true }\n format.html { redirect_to (params[:existing_slides] ? edit_slideshow_path(@slideshow) : @slideshow), notice: 'Slideshow was successfully updated.' }\n format.json { head :no_content }\n else\n format.js { render :nothing => true }\n format.html { render action: \"edit\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slideshow_item = SlideshowItem.find(params[:id])\n\n respond_to do |format|\n if @slideshow_item.update_attributes(params[:slideshow_item])\n format.html { redirect_to @slideshow_item, notice: \"\\\"#{@slideshow_item.title}\\\" was successfully updated.\".html_safe }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slideshow_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # authorize\n authorize! :update, @slideshow\n \n respond_to do |format|\n if @slideshow.update(slideshow_params)\n format.html { redirect_to edit_admin_slideshow_path(@slideshow.id), notice: 'Chỉnh sửa trình chiếu thành công.' }\n format.json { render :show, status: :ok, location: @slideshow }\n else\n format.html { render :edit }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_slideshow username, password, slideshow_id, options = {}\n do_request 'edit_slideshow', options.merge(username: username, password: password,\n slideshow_id: slideshow_id)\n end",
"def set_slideshow\n @slideshow = Slideshow.find(params[:id])\n end",
"def set_slideshow\n @slideshow = Slideshow.find(params[:id])\n end",
"def update\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @slide.update_attributes(params[:slide])\n format.html { redirect_to \"/slides\", notice: 'slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @slide.update_attributes(params[:slide])\n format.html { redirect_to @slide, notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @slide.update_attributes(params[:slide])\n format.html { redirect_to :back, notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def slideshow_params\n params.require(:slideshow).permit(:index, :show, :new, :create, :edit, :update, :destroy)\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow = Slideshow.new(slideshow_params)\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @slide.update_attributes(params[:slide])\n format.html { redirect_to slides_url, notice: '幻灯片修改成功.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n id = @slideshow.id\n @slideshow.delete\n render :json => {:id => id}\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n @slides = @slideshow.slides\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @slideshow = Slideshow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def update\n respond_to do |format|\n if @slide.update(slide_params)\n format.html { redirect_to @slide, notice: 'Slide was successfully updated.' }\n format.json { render :show, status: :ok, location: @slide }\n else\n format.html { render :edit }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_slideshow\n if !params[:id].nil?\n @slideshow = Slideshow.find(params[:id])\n else\n @slideshow = Slideshow.find(session[:slideshow][\"id\"])\n end\n end",
"def update\n @pslide = Pslide.find(params[:id])\n\n respond_to do |format|\n if @pslide.update_attributes(params[:pslide])\n format.html { redirect_to @pslide, notice: 'Pslide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pslide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slide.update(slide_params)\n format.html { redirect_to @slide, notice: \"Slide was successfully updated.\" }\n format.json { render :show, status: :ok, location: @slide }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n slideshow_params.delete(:slides_to_add)\n slides_to_add_ids = params[:slideshow][:slides_to_add]\n slides_to_remove_ids = params[:slideshow][:slides_to_remove]\n\n if slides_to_remove_ids.present?\n slides_to_remove = Slide.find(slides_to_remove_ids.values)\n slides_to_remove.each do |slide|\n @slideshow.slide_entries.select { |e| e.slide_id == slide.id }.each do |se|\n se.delete\n end\n end\n end\n\n\n if slides_to_add_ids.present?\n slides_to_add = Slide.find(slides_to_add_ids.values)\n slides_to_add.each do |slide|\n se = SlideEntry.new(:slide_id => slide.id, :slideshow_id => @slideshow.id)\n se.save!\n end\n end\n\n if @slideshow.update(slideshow_params)\n render :partial => 'slideshow_list_sect', :locals => { :slideshows => current_user.slideshows.paginate(:page => params[:page]), :context_page => 'account', :pag_url => '/slideshows/reload_pag_user' }\n else\n render :partial => 'slideshow_list_sect', :locals => { :slideshows => current_user.slideshows.paginate(:page => params[:page]), :context_page => 'account', :pag_url => '/slideshows/reload_pag_user' }\n flash[:error] = \"Error Updating: #{@slideshow.errors.full_messages}\"\n end\n end",
"def update\n @slide_image = SlideImage.find(params[:id])\n\n respond_to do |format|\n if @slide_image.update_attributes(params[:slide_image])\n format.html { redirect_to @slide_image, notice: 'Slide image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_slideshow\n @slideshow = Slideshow.find_by_uid(params[:id].downcase)\n end",
"def update\n respond_to do |format|\n if @slide.update(slide_params)\n format.html { redirect_to presentation_slide_url(@presentation, @slide), notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def slideshow_params\n params.require(:slideshow).permit(:name, :public, :head_image)\n end",
"def update\n upload_slides(params)\n build_kiosks(params)\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updateShowSlide\n result = Hash.new\n result['status'] = true\n begin # try\n result['status'] = Slide.where(id: params[:id])\n .update_all('slides.show = NOT slides.show, updated_by = ' + $user_id.to_s + ', updated_at = \\'' + Time.now.to_formatted_s(:db) + '\\'')\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end",
"def update\n respond_to do |format|\n if @slide.update(slide_params)\n format.html { redirect_to [:admin, @slide], notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slide = Slide.new(params[:slide])\n\n # If we're creating a new slide from the slideshow editing page, add the\n # slide to the slideshow and then redirect to the slideshow edit screen.\n @slide.slideshows << (@slideshow = Slideshow.find(params[:slideshow_id])) if params[:slideshow_id]\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to (@slideshow ? edit_slideshow_path(@slideshow) : @slide), notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @slideshow = Slideshow.new\n @user.slideshows << @slideshow\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def index\n @slideshows = Slideshow.all\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n @user.slideshows << @slideshow\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to @slideshow, notice: 'Slideshow was successfully created.' }\n format.json { render json: @slideshow, status: :created, location: @slideshow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def new\n @slideshow = Slideshow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow }\n end\n end",
"def show\n @slideshow_item = SlideshowItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"def update\n @page_slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @page_slide.update_attributes(params[:page_slide])\n format.html { redirect_to page_slide_url(@page_slide.page, @page_slide), notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page_slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slider.update(slider_params)\n format.html { redirect_to action: :index, notice: 'Обновлено.' }\n format.json { render :index, status: :ok, location: @slider }\n else\n format.html { render :crop }\n format.json { render json: @slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def saveSlide\n if params[:mode] == 'I'\n update = SlidesHlp.saveSlide(params[:slide])\n else\n update = SlidesHlp.updateSlide(params[:slide])\n end\n render json: update\n end",
"def slideshow_params\n params.require(:slideshow).permit(:image_url, :title_1, :color_1, :title_2, :color_2, :name_button, :link, :style)\n end",
"def update\n respond_to do |format|\n if @image_slider.update(image_slider_params)\n format.html { redirect_to @image_slider, notice: 'Image slider was successfully updated.' }\n format.json { render :show, status: :ok, location: @image_slider }\n else\n format.html { render :edit }\n format.json { render json: @image_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshows_url }\n format.json { head :no_content }\n end\n end",
"def update\n @slide = Slide.find(params[:id])\n @slide.name = params[:slide][:name] unless params[:slide][:name].nil?\n @slide.position = params[:slide][:position] unless params[:slide][:position].nil?\n if @slide.update_attributes(params[:slide])\n flash[:notice] = \"Successfully updated slide.\"\n redirect_to @slide.presentation\n else\n render :action => 'edit'\n end\n end",
"def create\n @slideshow = Slideshow.new(params[:slideshow])\n\n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to(@slideshow, :notice => 'Slideshow was successfully created.') }\n format.xml { render :xml => @slideshow, :status => :created, :location => @slideshow }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n if @slider_image.update_attributes(params[:slider_image])\n format.html { redirect_to slider_images_path, notice: 'Slider image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slider_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n if @illustration.update_attributes(params[:illustration])\n format.html { redirect_to @illustration, :notice => 'Illustration was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @illustration.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end",
"def update\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n if @illustration.update_attributes(params[:illustration])\n format.html { redirect_to @illustration, notice: 'Illustration was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @illustration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @title = t('view.slides.edit_title')\n @slide = @lesson.slides.find(params[:id])\n\n respond_to do |format|\n if @slide.update slide_params\n format.html { redirect_to(course_lesson_url(@lesson.course, @lesson, anchor: @slide.anchor), notice: t('view.slides.correctly_updated')) }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n\n rescue ActiveRecord::StaleObjectError\n redirect_to edit_lesson_slide_url(@lesson, @slide), alert: t('view.slides.stale_object_error')\n end",
"def update\n @food_slider = FoodSlider.find(params[:id])\n\n respond_to do |format|\n if @food_slider.update_attributes(params[:food_slider])\n format.html { redirect_to food_sliders_url, notice: 'Food slider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def slideshow_params\n params.require(:slideshow).permit(:title, :highlights_only)\n end",
"def update\n authorize! :update, resource\n\n respond_to do |format|\n if resource.update_attributes(params[:slideset])\n format.html { redirect_to slideset_slides_path(resource), notice: 'Slideset 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 set_slide\n @slide = Slide.find(params[:id])\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def update\n respond_to do |format|\n if UpdateSlide.execute(@slide, slide_params, current_user)\n @slide.take_screenshot\n @slide.create_activity(:update, owner: current_user, parameters: { name: @slide.menu_name })\n format.html { redirect_to @slide, notice: 'Slide was successfully updated.' }\n format.json { render :show, status: :ok, location: @slide }\n else\n format.html { render :edit }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n #@slideshow = @user.slideshows.find(params[:id])\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshows_url }\n format.json { head :no_content }\n end\n end",
"def update\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n if @slider_image.update_attributes(params[:slider_image])\n format.html { \n redirect_to slider_images_path\n gflash success: 'Slider image was successfully updated!' \n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slider_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @slideshow_item = SlideshowItem.find(params[:id])\n @slideshow_item.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshow_items_url }\n format.json { head :ok }\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def create\n # authorize\n authorize! :create, Slideshow\n @slideshow = Slideshow.new(slideshow_params)\n \n respond_to do |format|\n if @slideshow.save\n format.html { redirect_to edit_admin_slideshow_path(@slideshow.id), notice: 'Tạo mới trình chiếu thành công.' }\n format.json { render :show, status: :created, location: @slideshow }\n else\n format.html { render :new }\n format.json { render json: @slideshow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n newparams = coerce(params) \n @slide = Slide.new(newparams[:slide])\n @slide.name = @slide.image_file_name\n @slide.position = @slide.presentation.slides.count + 1\n if @slide.save\n flash[:notice] = \"Successfully created slide.\"\n respond_to do |format| \n format.html {redirect_to @slide.presentation} \n format.json { render :json => { :result => 'success', :slide => slide_url(@slide) } }\n end\n else\n render :action => 'new'\n end\n end",
"def new\n @slideshow_item = SlideshowItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slideshow_item }\n end\n end",
"def update\n respond_to do |format|\n if @promo_slide.update(promo_slide_params)\n format.html { redirect_to @promo_slide, notice: 'Promo slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @promo_slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end",
"def upload_slideshow username, password, slideshow_title, options = {}\n do_request 'upload_slideshow', options.merge(username: username, password: password,\n slideshow_title: slideshow_title)\n end",
"def update\n return false if !userCan :slide\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n if @slide.update_attributes(params[:slide])\n if params[:projector_add] then\n params[:projector_add].each {|v|\n Projector.find(v).update_attributes(:slide_id => params[:id]);\n Message.Command(:id => \"projector-#{v}\", :cmd => \"load\", :slide => params[:id])\n }\n end\n format.html { redirect_to @slide, notice: 'Slide was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slideshow_item = SlideshowItem.new(params[:slideshow_item])\n\n respond_to do |format|\n if @slideshow_item.save\n format.html { redirect_to @slideshow_item, notice: \"\\\"#{@slideshow_item.title}\\\" was successfully created.\".html_safe }\n format.json { render json: @slideshow_item, status: :created, location: @slideshow_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slideshow_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to(slideshows_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to(slideshows_url) }\n format.xml { head :ok }\n end\n end",
"def create(url=\"\")\n if url.present?\n @slideshow = Slideshow.new\n @slideshow.name = url\n else\n @slideshow = Slideshow.new(params[:slideshow])\n end\n @slideshow.slide_order_hash = {}\n respond_to do |format|\n \n if @slideshow.save\n format.html { \n redirect_to(\"/#{@slideshow.name}/new\", :notice => 'Slideshow was successfully created.') } #CONSTRUCTION, finish this path after completing routes\n \n #format.html { redirect_to(new_slideshow_slide_path(@slideshow), :notice => 'Slideshow was successfully created.') }\n format.xml { render :xml => @slideshow, :status => :created, :location => @slideshow }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @slideshow.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slider_serv.update(slider_serv_params)\n format.html { redirect_to @slider_serv, notice: 'Slider serv was successfully updated.' }\n format.json { render :show, status: :ok, location: @slider_serv }\n else\n format.html { render :edit }\n format.json { render json: @slider_serv.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to @slide, notice: 'Slide was successfully created.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @slides = Slide.all\n end",
"def set_slide\n @slide = Slide.find(params[:id])\n end",
"def destroy\n @slideshow.destroy\n respond_to do |format|\n format.html { redirect_to slideshows_url, notice: 'Slideshow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slideshow.destroy\n respond_to do |format|\n format.html { redirect_to slideshows_url, notice: 'Slideshow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n @web_slide = WebSlide.find(params[:id])\n\n respond_to do |format|\n if @web_slide.update_attributes(params[:web_slide])\n format.html { redirect_to(@web_slide, :notice => 'Web slide was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @web_slide.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @slide = Slide.new(params[:slide])\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to slides_url, notice: '幻灯片创建成功.' }\n format.json { render json: @slide, status: :created, location: @slide }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slide = Slide.new(slide_params)\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to @slide, notice: \"Slide was successfully created.\" }\n format.json { render :show, status: :created, location: @slide }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def show\n @slide = Slide.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end",
"def update\n respond_to do |format|\n if @presentation.update(presentation_params)\n format.html { redirect_to @presentation, notice: 'Presentation was successfully updated.' }\n format.json { render :index, status: :ok, location: @presentation }\n else\n format.html { render :edit }\n format.json { render json: @presentation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @slide = Slide.new(slide_params)\n\n respond_to do |format|\n if @slide.save\n format.html { redirect_to [:admin, @slide], notice: 'Slide was successfully created.' }\n format.json { render action: 'show', status: :created, location: @slide }\n else\n format.html { render action: 'new' }\n format.json { render json: @slide.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @main_slider.update(main_slider_params)\n format.html { redirect_to @main_slider, notice: 'Main slider was successfully updated.' }\n format.json { render :show, status: :ok, location: @main_slider }\n else\n format.html { render :edit }\n format.json { render json: @main_slider.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @slideshows = Slideshow.all\n @pag_url = '/slideshows/reload_pag'\n @page = 'home'\n end"
] |
[
"0.75111306",
"0.74391097",
"0.74391097",
"0.71799284",
"0.71799284",
"0.7068016",
"0.6866891",
"0.6795044",
"0.678487",
"0.675374",
"0.675374",
"0.66529506",
"0.65569437",
"0.652209",
"0.6500816",
"0.6457901",
"0.6457901",
"0.64310133",
"0.64310133",
"0.64310133",
"0.64275646",
"0.64106494",
"0.63839066",
"0.6364118",
"0.6364118",
"0.6326228",
"0.63173443",
"0.6313113",
"0.6307913",
"0.62629676",
"0.624665",
"0.62205034",
"0.61836195",
"0.61545813",
"0.6144982",
"0.6130901",
"0.6128746",
"0.6125011",
"0.6089108",
"0.6078432",
"0.60518175",
"0.60442317",
"0.60442317",
"0.6026301",
"0.6012618",
"0.598737",
"0.59870833",
"0.59646404",
"0.5962938",
"0.5961986",
"0.5930549",
"0.5930549",
"0.591977",
"0.5907307",
"0.5901632",
"0.58955604",
"0.58506817",
"0.5838212",
"0.58263814",
"0.5801238",
"0.5800511",
"0.5794016",
"0.57892156",
"0.57892156",
"0.57892156",
"0.57892156",
"0.57892156",
"0.5763922",
"0.57526624",
"0.5736409",
"0.5736085",
"0.5729565",
"0.5723665",
"0.57186407",
"0.5693538",
"0.56905216",
"0.5678267",
"0.5671895",
"0.5659321",
"0.5656566",
"0.5655252",
"0.5655252",
"0.56363946",
"0.56263715",
"0.5600573",
"0.5594262",
"0.55559915",
"0.55395174",
"0.55395174",
"0.5528549",
"0.5524108",
"0.5523276",
"0.5513743",
"0.55127954",
"0.55127954",
"0.55127954",
"0.55019295",
"0.54768646",
"0.5471323",
"0.5468765"
] |
0.75944984
|
0
|
DELETE /slideshows/1 DELETE /slideshows/1.json
|
def destroy
@slideshow = Slideshow.find(params[:id])
@slideshow.destroy
respond_to do |format|
format.html { redirect_to slideshows_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n id = @slideshow.id\n @slideshow.delete\n render :json => {:id => id}\n end",
"def destroy\n @slideshow_item = SlideshowItem.find(params[:id])\n @slideshow_item.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshow_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n #@slideshow = @user.slideshows.find(params[:id])\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to slideshows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slideshow.destroy\n respond_to do |format|\n format.html { redirect_to slideshows_url, notice: 'Slideshow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slideshow.destroy\n respond_to do |format|\n format.html { redirect_to slideshows_url, notice: 'Slideshow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_slideshow username, password, slideshow_id\n do_request 'delete_slideshow', username: username, password: password, slideshow_id: slideshow_id\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to(slideshows_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @slideshow = Slideshow.find(params[:id])\n @slideshow.destroy\n\n respond_to do |format|\n format.html { redirect_to(slideshows_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # authorize\n authorize! :delete, @slideshow\n @slideshow.destroy\n \n render nothing:true\n flash[:notice] = 'Xóa trình chiếu thành công.'\n end",
"def destroy\n @slide = Slide.find(params[:id])\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide = Slide.find(params[:id])\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide = Slide.find(params[:id])\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide_image = SlideImage.find(params[:id])\n @slide_image.destroy\n\n respond_to do |format|\n format.html { redirect_to slide_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide.destroy\n respond_to do |format|\n format.html { redirect_to slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pslide = Pslide.find(params[:id])\n @pslide.destroy\n\n respond_to do |format|\n format.html { redirect_to homepage_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page_slide = Slide.find(params[:id])\n @page_slide.destroy\n\n respond_to do |format|\n format.html { redirect_to page_slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @illustration = Illustration.find(params[:id])\n @illustration.destroy\n\n respond_to do |format|\n format.html { redirect_to illustrations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @illustration = Illustration.find(params[:id])\n @illustration.destroy\n\n respond_to do |format|\n format.html { redirect_to illustrations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide.destroy\n respond_to do |format|\n format.html { redirect_to admin_slides_url, notice: 'Slide was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide.destroy\n respond_to do |format|\n format.html { redirect_to slides_url, notice: \"Slide was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @promo_slide.destroy\n\n respond_to do |format|\n format.html { redirect_to promo_slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide = @lesson.slides.find(params[:id])\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to(lesson_slides_url(@lesson)) }\n format.json { head :ok }\n end\n end",
"def delete\n DATABASE.execute(\"DELETE from slides WHERE id = #{id}\")\n end",
"def destroy\n @slider_image = SliderImage.find(params[:id])\n @slider_image.destroy\n\n respond_to do |format|\n format.html { redirect_to slider_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slider_image = SliderImage.find(params[:id])\n @slider_image.destroy\n\n respond_to do |format|\n format.html { redirect_to slider_images_url }\n format.json { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @food_slider = FoodSlider.find(params[:id])\n @food_slider.destroy\n\n respond_to do |format|\n format.html { redirect_to food_sliders_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slider.destroy\n respond_to do |format|\n format.html { redirect_to sliders_url, notice: 'Удалено.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_slider.destroy\n respond_to do |format|\n format.html { redirect_to image_sliders_url, notice: 'Image slider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide.destroy\n render :nothing => true\n end",
"def destroy\n return false if !userCan :slide\n @slide = Slide.find(params[:id])\n @slide.destroy\n Message.Send(\"slide-#{params[:id]}\",{ :type => \"data\", :id => \"slide-#{params[:id]}\", :data => \"<h1 class='middel'>Slide has been removed!</h1>\"})\n\n respond_to do |format|\n format.html { redirect_to slides_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @web_slide = WebSlide.find(params[:id])\n @web_slide.destroy\n\n respond_to do |format|\n format.html { redirect_to(web_slides_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @pic = Pic.find(params[:id])\n @pic.destroy\n\n respond_to do |format|\n format.html { redirect_to pics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slide = Slide.find(params[:id])\n @presentation = @slide.presentation\n @slide.destroy\n\n respond_to do |format|\n format.html { redirect_to(@presentation, :notice => 'Presentation was successfully created.') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @content.destroy\n respond_to do |format|\n format.html { redirect_to presentation_slide_contents_url(@presentation, @slide) }\n format.json { head :no_content }\n end\n end",
"def delete\n api_client.delete(url)\n end",
"def destroy\n @pic.destroy\n respond_to do |format|\n format.html { redirect_to pics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_section = ImageSection.find(params[:id])\n @image_section.destroy\n\n respond_to do |format|\n format.html { redirect_to image_sections_url }\n format.json { head :no_content }\n end\n end",
"def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def destroy\n @slider_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_slider_images_url, success: 'Slider image successfully deleted' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @carousel.destroy\n respond_to do |format|\n format.html {redirect_to carousels_url, notice: 'Carousel was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n ImagesIndex.delete params[:id]\n respond_to do |format|\n format.html { redirect_to(\"/images_indices\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image_gallery = ImageGallery.find(params[:id])\n @image_gallery.destroy\n\n respond_to do |format|\n format.html { redirect_to image_galleries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @imagedemo.destroy\n respond_to do |format|\n format.html { redirect_to imagedemos_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 @slide.create_activity(:destroy, owner: current_user, parameters: { name: @slide.menu_name })\n @slide.destroy\n respond_to do |format|\n format.html { redirect_to slides_url, notice: 'Slide was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story_image.destroy\n respond_to do |format|\n format.html { redirect_to story_images_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def destroy\n @pro_wmall_slide_picture = Wmall::SlidePicture.find(params[:id])\n @pro_wmall_slide_picture.destroy\n\n respond_to do |format|\n format.html { redirect_to pro_wmall_slide_pictures_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_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 @banner_img = BannerImg.find(params[:id])\n @banner_img.destroy\n\n respond_to do |format|\n format.html { redirect_to banner_imgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to @photo.item }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slider_depo.destroy\n respond_to do |format|\n format.html { redirect_to slider_depos_url, notice: 'Slider depo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @main_slider.destroy\n respond_to do |format|\n format.html { redirect_to main_sliders_url, notice: 'Main slider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auction_carousel.destroy\n respond_to do |format|\n format.html { redirect_to auction_carousels_url, notice: '删除成功' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_pic.destroy\n respond_to do |format|\n format.html { redirect_to post_pics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n redirect_to action: \"latest\"\n @davis = Davis.find(params[:id])\n @davis.destroy\n\n #respond_to do |format|\n # format.html { redirect_to davis_url }\n # format.json { head :no_content }\n #end\n end",
"def destroy\n @photogallery.destroy\n respond_to do |format|\n format.html { redirect_to photogalleries_url, notice: 'Photogallery was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @draft_pic.destroy\n respond_to do |format|\n format.html { redirect_to draft_pics_url, notice: 'Draft pic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @livestock = Livestock.find(params[:id])\n @livestock.destroy\n\n respond_to do |format|\n format.html { redirect_to livestocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tbl_slide.destroy\n\n if session[:fromeditpage] == 1\n qu='DELETE FROM tbl_slide_layers WHERE \"SlideID\"='+\"#{params[:id]}\"+';'\n ActiveRecord::Base.connection.execute(qu);\n end\n respond_to do |format|\n format.html { redirect_to tbl_slides_url, notice: 'Tbl slide was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @testimonial = Testimonial.find(params[:id])\n @testimonial.destroy\n\n respond_to do |format|\n format.html { redirect_to testimonials_url }\n format.json { head :no_content }\n end\n end",
"def delete\n Vision.destroy_all\n Goal.destroy_all\n render 'welcome/index'\n end",
"def destroy\n @slider_serv.destroy\n respond_to do |format|\n format.html { redirect_to slider_servs_url, notice: 'Slider serv was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n gallery = @photo.gallery\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to gallery_path(gallery) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @interview.destroy\n respond_to do |format|\n format.html { redirect_to interviews_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slidedeck.destroy\n respond_to do |format|\n format.html { redirect_to slidedecks_url, notice: 'Slidedeck was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photoid = Photoid.find(params[:id])\n @photoid.destroy\n\n respond_to do |format|\n format.html { redirect_to photoids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n File.delete(Rails.root.join(\"app\",'assets','images',@photo.path))\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gallery.destroy\n respond_to do |format|\n format.html { redirect_to galleries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gallery.destroy\n respond_to do |format|\n format.html { redirect_to galleries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @slide_type = SlideType.find(params[:id])\n @slide_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(slide_types_path, :notice => 'Slide type was successfully destroyed.') }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @photo = Photo.find(params[:id])\r\n @photo.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to photos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\r\n @photo = Photo.find(params[:id])\r\n @photo.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to photos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n head :no_content\n end",
"def destroy\n Carousel.find(params[:id]).destroy\n redirect_to(:action => 'list')\n end",
"def destroy\n Track.destroy(params[:id])\n delete_file BSON::ObjectId(params[:id])\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 @photoalbum = Photoalbum.find(params[:id])\n @photoalbum.destroy\n\n respond_to do |format|\n format.html { redirect_to photoalbums_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @im.destroy\n respond_to do |format|\n format.html { redirect_to ims_url, notice: 'Im was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gallery.pics.each do |pic|\n Cloudinary::Uploader.destroy(pic.public_id.split(\"/\").last.split(\".\")[0] ,@auth) if pic.public_id.present?\n pic.delete\n end\n @gallery.delete\n respond_to do |format|\n format.html { redirect_to galleries_url, notice: 'Gallery was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.8474956",
"0.7959318",
"0.7947231",
"0.7908333",
"0.7908333",
"0.78684115",
"0.7847883",
"0.7847883",
"0.74992585",
"0.74213576",
"0.74213576",
"0.74213576",
"0.73651767",
"0.73429066",
"0.72759145",
"0.7234686",
"0.714241",
"0.71375084",
"0.71106845",
"0.7081164",
"0.7074283",
"0.70552015",
"0.6987938",
"0.69633496",
"0.69435966",
"0.6890931",
"0.6879916",
"0.68181545",
"0.68052614",
"0.6804246",
"0.6793169",
"0.67718595",
"0.6736805",
"0.6722343",
"0.6688823",
"0.6660477",
"0.66519934",
"0.66393423",
"0.66359675",
"0.66336936",
"0.66121584",
"0.659911",
"0.6593578",
"0.65932244",
"0.6586396",
"0.6583823",
"0.6578173",
"0.6574941",
"0.6573245",
"0.6564741",
"0.65590304",
"0.65457034",
"0.65415037",
"0.65413195",
"0.654069",
"0.65389556",
"0.6530498",
"0.65299416",
"0.65266395",
"0.6513106",
"0.6512077",
"0.6511367",
"0.6510371",
"0.6504836",
"0.6501467",
"0.649575",
"0.6493252",
"0.6493158",
"0.64912784",
"0.6488666",
"0.6488298",
"0.6481342",
"0.6475959",
"0.6464803",
"0.6464803",
"0.6464803",
"0.6464803",
"0.6464803",
"0.646329",
"0.64614177",
"0.64592475",
"0.64592475",
"0.6453715",
"0.64532954",
"0.64532954",
"0.64532954",
"0.64532954",
"0.64532954",
"0.64532954",
"0.64505124",
"0.6450412",
"0.6450412",
"0.6447392",
"0.6444844",
"0.6444434",
"0.6441304",
"0.6427555",
"0.64225924",
"0.6421037"
] |
0.81346536
|
1
|
Show Method Method used by API to return a teacher from database GET /api/v1/teachers/[id]
|
def show
teacher = Teacher.find(params[:id])
render json: {status: 'SUCCESS', message: 'Loaded teacher', data: teacher}, include:'school', status: :ok
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @teacher = Teacher.find(params[:id])\n \n end",
"def show\n id = params[:id]\n\n raise \"must specify id parameter\" unless !id.nil?\n \n @teacher = Teacher.find(id)\n respond_with(@teacher)\n end",
"def show\n @teacher = Teacher.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teacher }\n end\n end",
"def show\n if current_teacher.teacher?\n @teacher = current_teacher\n else\n @teacher = Teacher.find(params[:id])\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teacher }\n end\n end",
"def show\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @teacher }\n end\n end",
"def show\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.json { render json: @teacher }\n end\n end",
"def show\n if params[:course_id]\n @teacher = Course.find(params[:course_id]).teacher\n else\n @teacher = Teacher.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @teacher }\n end\n end",
"def index\n @teachers = Teacher.all\n end",
"def index\n @teachers = Teacher.all\n end",
"def index\n @teachers = Teacher.all\n end",
"def index\n @teachers = Teacher.all\n end",
"def index\n @teachers = Teacher.all\n end",
"def show\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @teacher }\n end\n end",
"def show\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @teacher }\n end\n end",
"def show\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @teacher }\n end\n end",
"def teacher\n self.teachers.first\n end",
"def teachers\n if current_user.is_admin?\n @teachers= User.find(:all, :conditions => \"is_teacher = '1' and is_admin = '0'\")\n respond_to do |format|\n format.xml { render :xml => @teachers }\n end\n else\n respond_to do |format|\n format.xml { render :text => \"error\" }\n end\n end\n end",
"def show\n @student = Student.find(params[:id])\n @teacher = Teacher.find(@student.teacher_id)\n render :show\n end",
"def set_teacher\n @teacher = User.teachers.find_by_id(params[:id])\n end",
"def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def show\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def teacher\n @teacher ||= begin\n record = Teacher.find_by_time_punch_code(params[:teacher_id])\n\n raise ActiveRecord::RecordNotFound if record.nil?\n\n record\n end\n rescue ActiveRecord::RecordNotFound\n message = 'Teacher not found!'\n\n render json: [message], status: :unprocessable_entity\n end",
"def show\n @subjects = @teacher.subjects\n respond_with @teacher\n end",
"def show\n @tuiter = Tuiter.find(params[:id])\n end",
"def set_teacher_id\n @teachers=Teacher.find_by(name: params[:course][:teacher_name])\n end",
"def index\n if current_user.role == 'admin'\n @teachers = Teacher.all\n else\n @teacher = current_user.teacher\n end\n end",
"def index\n @teachers = Teacher.all.select { |t| t unless t.user.nil? }\n respond_with @teachers\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def teacher\n self.course_person.first(:type => \"teacher\").person\n end",
"def edita\n @teacher = Teacher.find(params[:id])\n end",
"def index\n @subject_teachers = SubjectTeacher.all\n end",
"def teachers\n url = drop_url_version + \"/count/teacherAssociations/#{params['edorg_id']}/teachers\"\n begin\n entities = RestClient.get(url, get_header)\n entities = JSON.parse(entities)\n rescue => e\n logger.info(\"Could not get ed orgs for #{entities} because of #{e.message}\")\n end\n \n respond_to do |format|\n format.json { render json: entities }\n end\n end",
"def index\n @course_has_teachers = CourseHasTeacher.all\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def teacher\n return nil unless self.teacher_id\n return User.find_by_id(self.teacher_id)\n end",
"def index\n @teachers = Teacher.order(:tea_no).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teachers }\n end\n end",
"def show\n @teacher_history = TeacherHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teacher_history }\n end\n end",
"def set_teacher\n\t\t@teacher = Teacher.find(params[:id])\n\tend",
"def index\n @courses_teachers = CoursesTeacher.all\n end",
"def editd\n @teacher = Teacher.find(params[:id])\n end",
"def show\n if current_teacher.teacher?\n @teacher = current_teacher\n else\n @teacher = Teacher.find(params[:teacher_id])\n end\n @learningwalk = @teacher.learningwalks.find(params[:id])\n render :layout => \"print\"\n \n \n end",
"def show\n @students = Student.where(school: @school.id)\n @teachers = Teacher.where(school: @school.id) \n end",
"def index\n\t\tif !isLogin\n\t\t\tredirect_to controller: 'login', action: 'login'\n\t\t\treturn\n\t\tend\n\t\t@teachers = Teacher.all.order(\"id\").paginate(page: params[:page], per_page: ROWSperPAGE)\n\tend",
"def show\n if params[:teacher_id]\n @school = Teacher.find(params[:teacher_id]).school\n else\n @school = School.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @school }\n end\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n @title = @teacher.name\n end",
"def edit\n @teacher = Teacher.find(params[:id])\n end",
"def index\n @current_teacher = current_teacher\n @school = School.find(@current_teacher.school_id)\n @teachers = Teacher.where(school_id: @current_teacher.school_id).paginate(page: params[:page], :per_page => 10)\n @teachers = @teachers.order('LOWER(full_name) ASC')\n end",
"def index\n @teacher_matters = TeacherMatter.all\n end",
"def editc\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find( params[ :teacher_id ] )\n end",
"def set_teacher\n @teacher = Teacher.find( params[ :teacher_id ] )\n end",
"def teaching_activity\n @teaching_activity = Api::Cnes::TeachingActivity.find(params[:id])\n end",
"def tutors\n User.teaching(self)\n end",
"def show\n @lab_teach_resource = LabTeachResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_teach_resource }\n end\n end",
"def set_teacher\n @teacher = Teacher.joins(:account).select(\"teachers.*, teachers.id,\n\t accounts.id AS account_id\").where(\"accounts.id\": params[:id]).first\n\tend",
"def get_teacher\n if current_user.teacher\n @teacher =current_user.teacher\n else\n @teacher = current_user.create_teacher\n end\n end",
"def show\n @tutor = Tutor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutor }\n end\n end",
"def teacher_assign\n @course_allocation = CourseAllocation.find_by_course_id(params[:id])\n @course = Course.find(params[:id])\n @teachers = get_teachers_for_institute\n end",
"def index\n @teacher_data = TeacherDatum.all\n end",
"def new\n @teacher = Teacher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @teacher }\n end\n end",
"def new\n @teacher = Teacher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teacher }\n end\n end",
"def new\n @teacher = Teacher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teacher }\n end\n end",
"def show_groups\n @teacher = Teacher.find(params[:id])\n end",
"def show\n\t\t@tutorial = Tutorial.find(params[:id])\n\t\t@tutorial_reviews = TutorialReview.find_all_by_tutorial_id(@tutorial.id).reverse\n\n\t\t#@tweets = Tweet.find_all_by_tutorial_id(@tutorial.id)\n\n\t\t@tweets = Tweet.where(\"tweets.updated_at <= (SELECT MIN(t.updated_at) FROM tweets AS t WHERE t.from_user=tweets.from_user)\").order(\"tweets.tweet_id desc\").find_all_by_tutorial_id(@tutorial.id).first(108)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render :json => @tutorial }\n\t\tend\n\tend",
"def show\n @teaching_method = TeachingMethod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @teaching_method }\n end\n end",
"def index\n @teachers = Teacher.all\n @cohorts = Cohort.all\n @page_title = \"Teachers Page\"\n end",
"def refine_by_teacher\n history = History.where(teacher_id: current_api_v1_user)\n render json: history\n end",
"def set_teach\n @teach = Teach.find(params[:id])\n end",
"def index\n @tutors = Tutor.all\n end",
"def properties\n @teacher = current_teacher\n params[:id] = @teacher.id\n end",
"def show\n @title = t 'view.teaches.show_title'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @teach }\n end\n end",
"def index\n @teacher_classes = TeacherClass.all\n end",
"def show\n @evaluation = Evaluation.friendly.find params[:id]\n @tutee = Tutee.find params[:tutee_id]\n end",
"def set_teacher_chatting\n @teacher_chatting = TeacherChatting.find(params[:id])\n end",
"def index\n @stay_has_teachers = StayHasTeacher.all\n end",
"def index\n @students = Student.is_active.page(params[:page]).per(50)\n @teachers = Teacher.all\n render :index\n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n end",
"def teachers\n @all_teachers = User.all_teachers\n @current_teachers = User.current_teachers(get_selected_project)\n @number_of_teachers_per_section = User.get_number_of_teachers_per_section(get_array_of_all_sections(get_selected_project), get_selected_project) \n end",
"def show\n if current_person.type == 'Teacher'\n redirect_to teachers_load_course_url(course_id: params[:id])\n else\n redirect_to :controller => 'controllername', :action => 'actionname' \n end\n \n end",
"def show\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tutorial }\n end\n end",
"def student_teachers_list\n self.teachers.collect do |teacher|\n teacher.teacher_name\n end\n end",
"def show\n id = params[:id]\n @voter = Voter.find(id)\n end",
"def tutor\n User.find_by(id: tutor_id)\n end",
"def profile\n @teacher = current_teacher\n params[:id] = @teacher.id\n end",
"def new\n @teacher = Teacher.new\n @user = User.new\n respond_with @teacher\n end",
"def super_teacher\n Teacher.first\n end",
"def set_teacher_datum\n @teacher_datum = TeacherDatum.find(params[:id])\n end",
"def show\n @classroom = @observation.classroom\n @teacher = @classroom.teacher\n# authorize! :show, @observation\n end",
"def tutors_by_specialization\n @faculty = Faculty.find_by_short_name(params[:id])\n @specializations = @faculty.specializations\n end",
"def show\n authorize! :show, @reservation\n @user = current_user\n @reservations = Reservation.select{|res| res.teacher_id == @user.id}\n end",
"def show\n @tater = Tater.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tater }\n end\n end"
] |
[
"0.821759",
"0.81778306",
"0.79979455",
"0.79771054",
"0.7966516",
"0.7945637",
"0.76841635",
"0.76648563",
"0.76648563",
"0.76648563",
"0.76648563",
"0.76648563",
"0.7475807",
"0.7475807",
"0.7475807",
"0.73484814",
"0.72715",
"0.72134",
"0.72031844",
"0.718469",
"0.718469",
"0.7183945",
"0.71650434",
"0.70549434",
"0.7032113",
"0.70044416",
"0.7002965",
"0.6942802",
"0.6942802",
"0.6942802",
"0.6942802",
"0.6942802",
"0.6942802",
"0.6942802",
"0.6942802",
"0.6942802",
"0.6942802",
"0.6932853",
"0.693167",
"0.6909249",
"0.690587",
"0.6903896",
"0.6900011",
"0.68939984",
"0.68763363",
"0.6841655",
"0.68340516",
"0.68266416",
"0.68159455",
"0.6800351",
"0.67972016",
"0.67683864",
"0.6757284",
"0.6754593",
"0.6739494",
"0.6721659",
"0.67097366",
"0.66575396",
"0.66513646",
"0.66513646",
"0.66459674",
"0.6633053",
"0.6630927",
"0.66015977",
"0.6589183",
"0.65782726",
"0.6574294",
"0.6572166",
"0.6562518",
"0.6549161",
"0.6549161",
"0.65331626",
"0.6498397",
"0.6493859",
"0.6493376",
"0.6488253",
"0.64868027",
"0.64861435",
"0.64473194",
"0.6431651",
"0.64240986",
"0.6420936",
"0.64024615",
"0.6401644",
"0.6399373",
"0.63918847",
"0.63665956",
"0.63552296",
"0.63364017",
"0.6317437",
"0.63048035",
"0.62996554",
"0.6293226",
"0.6287272",
"0.62832373",
"0.6271265",
"0.6257531",
"0.62562495",
"0.62531626",
"0.62411106"
] |
0.7349782
|
15
|
Create Method Method used by API to create new teacher into database POST /api/v1/teachers
|
def create
teacher = Teacher.new(teacher_params)
if teacher.save
render json: {status: 'SUCCESS', message: 'Teacher has been saved.', data: teacher}, include:'school', status: :ok
else
render json: {status: 'ERROR', message: 'Teacher has not been saved.', data: teacher.errors}, status: :unprocessable_entity
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @teacher = Teacher.new(teacher_params)\n \n respond_to do |format|\n if @teacher.save\n format.html { redirect_to teachers_url, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.html { render :new }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher = Teacher.new(params[:teacher])\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render json: @teacher, status: :created, location: @teacher }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher = Teacher.new(params[:teacher])\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render json: @teacher, status: :created, location: @teacher }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher = Teacher.new(teacher_params)\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.html { render :new }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher = Teacher.new(teacher_params)\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.html { render :new }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher = Teacher.new(params[:teacher])\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to [:admin, @teacher], :notice => 'Teacher was successfully created.' }\n format.json { render :json => @teacher, :status => :created, :location => @teacher }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @teacher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher = Teacher.new(teacher_params)\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Преподаватель создан!' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.html { render :new } \n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\tif !isLogin\n\t\t\tredirect_to controller: 'login', action: 'login'\n\t\t\treturn\n\t\tend\n\t\t@teacher = Teacher.new(teacher_params)\n\t\t@teacher.event_id = getLoginEventId\n\t\t@teacher.code = @teacher.getCode\n\t\t@teacher.changed_id = getLoginUserId\n\t\trespond_to do |format|\n\t\t\tif @teacher.save\n\t\t\t\tformat.html { redirect_to @teacher, notice: 'Der Lehrer wurde erfolgreich eröffnet.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @teacher }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @teacher.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @teacher = Teacher.new(params.require(:teacher).permit(:name, :email, :address, :discipline, :phone))\n #redirect_to '/teachers'\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.html { render :new }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher = Teacher.new(params[:teacher])\n\n respond_to do |format|\n if @teacher.save\n flash[:notice] = 'Teacher was successfully created.'\n format.html { redirect_to(teachers_path) }\n format.xml { render :xml => @teacher, :status => :created, :location => @teacher }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @teacher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:id]\n begin\n check_admin\n course = Course.find(params[:course_id])\n teacher = User.find(params[:id])\n course.teachers << teacher\n if course.save\n json_successful\n else\n json_failed\n end\n rescue ActiveRecord::RecordNotFound\n json_failed(REASON_RESOURCE_NOT_FOUND)\n end\n else\n json_failed(REASON_NOT_IMPLEMENTED)\n end\n end",
"def create\n return\n teacher = Teacher.find_by_name(params[:teacher])\n user = User.new(:username => params[:username])\n\n teacher.users << user\n \n user.record_exam(params)\n\n respond_to do |format|\n format.html { render :status => 200, :text => 'done' }\n end\n end",
"def create\n @teacher = Teacher.new(teacher_params)\n if @teacher.save\n redirect_to @teacher, notice: 'Teacher was successfully created.'\n else\n render :new\n end\n end",
"def create\n @student = Student.new(student_params)\n @teachers = Teacher.all\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: \"Student was successfully created.\" }\n else\n format.html { render :new, status: :unprocessable_entity }\n end\n end\n end",
"def add_teacher(first, last, campus, veracross, email)\n puts(\"Adding #{first} #{last} #{campus} #{veracross} #{email}\")\n Student.create(\n first_name: first,\n last_name: last,\n campus: campus,\n veracross_id: veracross,\n email: email,\n teacher: true\n )\nend",
"def create\n @subject_teacher = SubjectTeacher.new(subject_teacher_params)\n\n respond_to do |format|\n if @subject_teacher.save\n format.html { redirect_to @subject_teacher, notice: 'Subject teacher was successfully created.' }\n format.json { render :show, status: :created, location: @subject_teacher }\n else\n format.html { render :new }\n format.json { render json: @subject_teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @courses_teacher = CoursesTeacher.new(courses_teacher_params)\n\n respond_to do |format|\n if @courses_teacher.save\n format.html { redirect_to @courses_teacher, notice: 'Courses teacher was successfully created.' }\n format.json { render :show, status: :created, location: @courses_teacher }\n else\n format.html { render :new }\n format.json { render json: @courses_teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course_has_teacher = CourseHasTeacher.new(course_has_teacher_params)\n\n respond_to do |format|\n if @course_has_teacher.save\n format.html { redirect_to @course_has_teacher, notice: 'Course has teacher was successfully created.' }\n format.json { render :show, status: :created, location: @course_has_teacher }\n else\n format.html { render :new }\n format.json { render json: @course_has_teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher = User.teachers.new(teacher_params)\n @teacher.password = 'Password01'\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to admin_teachers_path, notice: 'teacher was successfully created.' }\n format.json { render action: 'show', status: :created, location: @teacher }\n else\n format.html { render action: 'new' }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher = Teacher.new(params[:teacher])\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to(@teacher, :notice => 'Profesor creado con éxito.') }\n format.xml { render :xml => @teacher, :status => :created, :location => @teacher }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @teacher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.new(params[:user])\n if params[:teacher_id].nil?\n @user.save!\n respond_to do |format|\n if @user.save!\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n else\n assign_account(:teacher) #assign account to teacher\n end\n \n end",
"def create\n teacher_exclusive\n @test = Test.create title: params[:title], test_date: params[:test_date], subject_id: params[:subject_id],teacher_id: @current_user.id\n\n respond_to do |format|\n if @test.save\n format.html { redirect_to @test, notice: \"L'épreuve a été créée\"}\n format.json { render :show, status: :created, location: @test }\n else\n format.html { render :new }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teach = Teach.new(params[:teach])\n\n respond_to do |format|\n if @teach.save\n format.html { redirect_to @teach, notice: 'Teach was successfully created.' }\n format.json { render json: @teach, status: :created, location: @teach }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher = Teacher.new(teacher_params)\n @school = School.find(@teacher.school_id)\n\n if @teacher.save\n flash[ :success] = \"Teacher #{ @teacher.full_name } was successfully created.\"\n redirect_to teachers_path\n else\n render :new\n end\n end",
"def create\n begin\n case\n when params[:teacher_id]\n course_create_params = params.require(:course).permit(:name, :description, :semester_id)\n check_token(params[:teacher_id], params[:token], true)\n teacher = User.find(params[:teacher_id])\n course = Course.create(course_create_params)\n if teacher.teaching_courses.create(course_id: course.id)\n json_successful(id: course.id)\n else\n json_failed\n end\n when params[:assistant_id] && params[:id]\n check_token(params[:assistant_id])\n if Participation.create(user_id: params[:assistant_id],\n course_id: params[:id], role: ROLE_ASSISTANT).valid?\n json_successful\n else\n json_failed\n end\n when params[:student_id] && params[:id]\n check_token(params[:student_id])\n if Participation.create(user_id: params[:student_id],\n course_id: params[:id], role: ROLE_STUDENT).valid?\n json_successful\n else\n json_failed\n end\n else\n json_failed(REASON_INVALID_OPERATION)\n end\n rescue\n json_failed(REASON_RESOURCE_NOT_FOUND)\n end\n end",
"def add_teacher(teacher)\n CourseTeachingAssignment.create :user_id => teacher.id, :course_id => self.id\n end",
"def create\n @teach = Teach.new(teach_params)\n\n respond_to do |format|\n if @teach.save\n format.html { redirect_to @teach, notice: 'Teach was successfully created.' }\n format.json { render :show, status: :created, location: @teach }\n else\n format.html { render :new }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n hasError = 0\n @subject = Subject.new(params[:subject])\n if params[:teachers_id] == nil\n session[:error] =\"You have to select one or more teachers.\"\n hasError = 1\n else\n if @subject.save\n params[:teachers_id].each{|t|\n teacher_aux =Teacher.find(t)\n @subject.teachers << teacher_aux\n }\n CustomLogger.debug(\"Subject created\")\n CustomLogger.debug(\"--------------\") \n to_log(@subject) \n @subject= Subject.new\n end\n end\n restore_lists\n end",
"def create_teacher(teacher, email)\n pwd = generate_password\n Professor.create(:name => teacher.css('h4.people-details-h4').text.match(/(\\S+\\.?\\s?)+/),\n :email => email,\n :username => email.match(/[^@]+/),\n :role => match_role(teacher.css('span.people-details.p-people').text),\n :password => pwd,\n :password_confirmation => pwd)\n end",
"def create\n @teacher_datum = TeacherDatum.new(teacher_datum_params)\n\n respond_to do |format|\n if @teacher_datum.save\n format.html { redirect_to @teacher_datum, notice: \"Teacher datum was successfully created.\" }\n format.json { render :show, status: :created, location: @teacher_datum }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @teacher_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher_matter = TeacherMatter.new(teacher_matter_params)\n\n respond_to do |format|\n if @teacher_matter.save\n format.html { redirect_to @teacher_matter, notice: 'Teacher matter was successfully created.' }\n format.json { render :show, status: :created, location: @teacher_matter }\n else\n format.html { render :new }\n format.json { render json: @teacher_matter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher = Teacher.new(params[:teacher])\n respond_to do |format|\n if @teacher.save\n Employment.create(:teacher_id => @teacher[:id], :school_id => params[:employment][:school_id])\n format.html { redirect_to teachers_path(:teacher => @teacher.last_name), notice: 'Teacher was successfully created.' }\n format.json { render json: @teacher, status: :created, location: @teacher }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teacher.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 create\n @teach = Teach.new(params[:teach])\n\n respond_to do |format|\n if @teach.save\n format.html { redirect_to '/instructors/'+current_instructor.id.to_s+'/courses/'+@teach.course_id, notice: 'Teacher was successfully added.' }\n format.json { render json: @teach, status: :created, location: @teach }\n else\n # format.html { redirect_to '/instructors/'+current_instructor.id.to_s+'/courses/'+@teach.course_id+'/newinstructor'}\n format.html { render action: \"new\" }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n\n #'/instructors/'+params[:id]+'/courses/'+params[:course_id]+'/newinstructor'\n end\n end\n end",
"def create\n file_data = params[:teacher][:file]\n\t\tif !file_data.nil?\n\t\t\tCSV.foreach(file_data.path) do |row|\n\t\t\t\t@name = row[0]\n\t\t\t\t@email = row[1]\n\t\t\t\t@business = row[2]\n\t\t\t\t@teacher_params = { \"user_name\" => \"#{@email}\", \"name\" => \"#{@name}\", \"email\" => \"#{@email}\", \"business\" => \"#{@business}\" , \"password\" => \"1234\"} \n\t\t \t@teacher = Teacher.new(@teacher_params)\t\n\t\t\t\t@teacher.save\n\t\t\t\t@predecessor_id = @teacher.predecessor.id\n\t\t\t\t@teacher_id = @teacher.id\n\t\t\t\tTeacher.update_all(\"id = '#{@predecessor_id}'\", \"id = '#{@teacher_id}'\")\n\t\t\t\tUser.update_all(\"heir_id = '#{@predecessor_id}'\", \"heir_id = '#{@teacher_id}'\")\n\t\t\t\t#UserMailer.welcome_email(@teacher,\"1234\").deliver\n\t\t\tend\t\n\t\telse\n\t\t\t@teacher = Teacher.new(teacher_params)\n\t\t\tUserMailer.welcome_email(@teacher,\"1234\").deliver\n\t\tend\n\n respond_to do |format|\n if @teacher.save\n #format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @teacher }\n\t\t\t\tformat.html { redirect_to teachers_url, notice: 'Teacher was successfully created.' }\n else\n format.html { render action: 'new' }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def teacher_params\n params.require(:teacher).permit(:first_name, :last_name, :gender, :date_of_birth, :mobile_number, :email, :listening_skills_jaws, :writing_skills_with_jaws, :strengths, :weaknesses, :tirms, :user_id)\n end",
"def create\n if teacher_signed_in?\n create_for_teacher\n end\n\n respond_to do |format|\n if @practical_work.save\n format.html { redirect_to teacher_practical_works_url, notice: 'Laboratory work was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def teacher_params\n params.require(:teacher).permit(:name, :degree, :university_id, :phone_number, :email)\n end",
"def create\n @teacher = Teacher.new(teacher_params)\n User.where(:role => 2).each do |admin|\n admin.notify(\"C/I has a new teacher!\",\"#{current_user.email} created a teacher profile\" )\n end\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n format.html { render :new }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = current_teacher.courses.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to @course, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def teacher_params\n params.require(:teacher).permit(:teach_id,:teach_name,:teach_gender,:teach_level,:addr_no,:address,:tel)\n end",
"def teacher_params\n params.require(:teacher).permit(:first_name, :last_name, :profile_name, :profile_pic_url, :about_me, :github_username, :codecademy_username, :user_id, :school_id)\n end",
"def create\n @tuiter = current_user.tuiters.new(tuiter_params)\n\n respond_to do |format|\n if @tuiter.save\n format.html { redirect_to @tuiter, notice: 'Tuiter was successfully created.' }\n format.json { render :show, status: :created, location: @tuiter }\n else\n format.html { render :new }\n format.json { render json: @tuiter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @course = current_teacher.courses.new(course_params)\n\n respond_to do |format|\n if @course.save\n format.html { redirect_to courses_url, notice: 'Course was successfully created.' }\n format.json { render :show, status: :created, location: @course }\n else\n format.html { render :new }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def teacher_params\n params.require(:teacher).permit(:name, :email, :password, :teacher_id, :password_confirmation)\n end",
"def teacher_params\n params.require(:teacher).permit(:name, :email, :password, :password_confirmation)\n end",
"def teacher_params\n params.require(:teacher).permit(:name, :email, :address, :discipline, :phone)\n end",
"def teacher_params\n\t\tparams.require(:teacher).permit(:name, :firstname, :abbreviation, :email, :room_title, :team_id)\n\tend",
"def create\n\n @teacher_instrument = TeacherInstrument.new(params[:teacher_instrument])\n\n @teacher = Teacher.find(params[:teacher_instrument][:teacher_id])\n\n respond_to do |format|\n if @teacher_instrument.save\n format.html { redirect_to @teacher, notice: 'Instrument was successfully added.' }\n format.json { render json: @teacher, status: :created, location: @teacher }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_teacher\n @signature = Signature.find(params[:id])\n @signatures_teacher = @signature.signatures_teachers.build(params[:signatures_teacher])\n\n respond_to do |format|\n if @signatures_teacher.save\n format.html { redirect_to(@signature, :notice => 'Profesor añadido con éxito.') }\n format.xml { render :xml => @signature, :status => :created, :location => @signature }\n else\n format.html { render :action => \"show\" }\n format.xml { render :xml => @signature.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher = Teacher.new(params[:teacher])\n#u = User.new(:f_name => @teacher.f_name, :s_name => @teacher.s_name, :l_name => @teacher.l_name, :login => @teacher.login, :password => @teacher.password, :password_confirmation => @teacher.password, :role => 0)\n if @teacher.save\n u = User.new\n u.f_name = @teacher.f_name\n u.s_name = @teacher.s_name\n u.l_name = @teacher.l_name\n u.login = @teacher.login\n u.password = @teacher.password\n u.password_confirmation = @teacher.password\n u.role=0\n u.save\n \n redirect_to @teacher, :notice => ' '\n else\n render :action => \"new\"\n end\n end",
"def teacher_params\n params.require(:teacher).permit(:name, :email, :password, :current_topic_id)\n end",
"def add_teacher(person)\n c = CoursePerson.new type: \"teacher\"\n c.person = person\n self.course_person << c\n end",
"def run\n return invalid_course unless teacher_valid? && course_params\n\n TeacherCourse.create(teacher: teacher, course: course) if course.valid?\n\n course\n end",
"def create\n @teacher = Teacher.new(params[:teacher])\n<<<<<<< HEAD\n @vote = @teacher.votes.build(params[:vote])\n @vote.user_id = current_user.id\n @vote.teacher_id = @teacher.id\n=======\n>>>>>>> dca75f7c24244f2a9b84649ee8642ecab0988738\n\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render json: @teacher, status: :created, location: @teacher }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def teacher_params\n params.require(:teachers).permit(:name, :email, :subject, :grade_level)\n end",
"def teacher_params\n params.require(:teacher).permit(:first_name, :last_name, :title, :email, :password, \n :password_confirmation, :current_class, :user_number, :school_id)\n end",
"def create\n @teacher = Teacher.new(teacher_params)\n respond_to do |format|\n if @teacher.save\n format.html { redirect_to @teacher, notice: 'Teacher was successfully created.' }\n format.json { render :show, status: :created, location: @teacher }\n else\n 3.times { @teacher.posts.build }\n format.html { render :new }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t 'view.teaches.new_title'\n\n respond_to do |format|\n if @teach.save\n format.html { redirect_to @teach, notice: t('view.teaches.correctly_created') }\n format.json { render json: @teach, status: :created, location: @teach }\n else\n format.html { render action: 'new' }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @teacher = Teacher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teacher }\n end\n end",
"def new\n @teacher = Teacher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @teacher }\n end\n end",
"def teacher_params\n params.require(:teacher).permit(:name, :email, :password)\n end",
"def create\n teacher_exclusive\n @subject = Subject.create title: params[:title], start_date: params[:start_date], end_date: params[:end_date], teacher_id: @current_user.id\n\t\n\n respond_to do |format|\n if @subject.save\n format.html { redirect_to @subject, notice: 'La matière a été insérée' }\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def teacher_params\n params.require(:teacher).permit(:id_number, :name, :subject_id )\n end",
"def create\n msg = check_valid_names\n if !msg.empty?\n logger.debug msg\n flash[:error] = msg\n redirect_to :action => 'new'\n return\n end\n update_course_faculty_label\n\n @team = Team.new(params[:team])\n @team.course_id = params[:course_id]\n\n respond_to do |format|\n if @team.save\n flash[:notice] = 'Team was successfully created.'\n format.html { redirect_to(course_teams_path(@team.course_id)) }\n format.xml { render :xml => @team, :status => :created, :location => @team }\n else\n @faculty = User.find(:all, :order => \"twiki_name\", :conditions => [\"is_teacher = true\"])\n format.html { render :action => \"new\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_subjects\n Subject.create!([{\n name: \"History\",\n teacher_id:1 \n },\n {\n name: \"Math\",\n teacher_id: 2\n },\n {\n name: \"Economics\",\n teacher_id: 3\n }])\nend",
"def create\n @tutorial = current_user.tutorials.create(tutorial_params)\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render :show, status: :created, location: @tutorial }\n else\n format.html { render :new }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def teacher_params\n params.require(:teacher).permit(:name, :email, :location_id, :password, :password_confirmation)\n end",
"def teacher_params\n params.require(:teacher).permit(:user_name, :teacher_icon_name, \n :teacher_name, :teacher_email, :admin_powers, :analysis_powers, \n :teacher_description, :color, :school_id, :teacher_password, \n :teacher_password_confirmation)\n end",
"def new\n @teacher = Teacher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @teacher }\n end\n end",
"def create\n @teacher_history = TeacherHistory.new(params[:teacher_history])\n\n respond_to do |format|\n if @teacher_history.save\n format.html { redirect_to @teacher_history, notice: 'Teacher history was successfully created.' }\n format.json { render json: @teacher_history, status: :created, location: @teacher_history }\n else\n format.html { render action: \"new\" }\n format.json { render json: @teacher_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def teacher_params\n params.require( :teacher).permit( :user_name, :full_name, :email, :admin,\n :password, :password_confirmation, :color, :icon, :description,\n :school_id, :suspended)\n end",
"def create\n @stay_has_teacher = StayHasTeacher.new(stay_has_teacher_params)\n\n respond_to do |format|\n if @stay_has_teacher.save\n format.html { redirect_to @stay_has_teacher, notice: 'Stay has teacher was successfully created.' }\n format.json { render :show, status: :created, location: @stay_has_teacher }\n else\n format.html { render :new }\n format.json { render json: @stay_has_teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def teacher_params\n params.require(:teacher).permit(:name)\n end",
"def create\n admin_only\n @subject = Subject.new(subject_params)\n\n new_tutor_ids = []\n unless params[:subject][:people_teaching_attributes].blank?\n params[:subject][:people_teaching_attributes].each do |attribute|\n id = attribute[1][:incoming_tutor_id]\n new_tutor_ids << id unless attribute[1][:_destroy] == \"1\"\n end\n end\n\n respond_to do |format|\n if @subject.save\n\n unless new_tutor_ids == []\n new_tutor_ids.each do |id|\n e = ProvidingEnrollment.new\n e.user_id = id\n e.subject_id = @subject.id\n e.save!\n end\n end\n\n format.html { redirect_to @subject, notice: 'Subject was successfully created.' }\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n if is_admin?\n @tutorial = Tutorial.new({user_id: @cur_user.id, title: \"#{@cur_user.name}'s Tutorial\"})\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render json: @tutorial.to_hash(false), status: :created, location: @tutorial }\n else\n format.html { render :status => 404 }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { render text: \"Not allowed\", status: 404 }\n format.json { render json: @tutorial.errors, status: :forbidden }\n end\n end\n end",
"def create\n @teaching = Teaching.new(teaching_params)\n @teaching.user_id = current_user.id\n @teaching.lesson_id = session[:lesson_id]\n\n respond_to do |format|\n if @teaching.save\n format.html { redirect_to @teaching, notice: \"教学已被成功创建\" }\n format.json { render :show, status: :created, location: @teaching }\n else\n format.html { render :new }\n format.json { render json: @teaching.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_teacher_id\n @teachers=Teacher.find_by(name: params[:course][:teacher_name])\n end",
"def create\n @tutorial_committee = TutorialCommittee.new(tutorial_committee_params)\n\n respond_to do |format|\n if @tutorial_committee.save\n format.html { redirect_to @tutorial_committee, notice: 'Tutorial committee was successfully created.' }\n format.json { render :show, status: :created, location: @tutorial_committee }\n else\n format.html { render :new }\n format.json { render json: @tutorial_committee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assign_teacher\n @teacher = Teacher.find(params[:teacher_id])\n @teaching = Teaching.find(params[:id])\n @teaching.teacher = @teacher\n if @teaching.save\n flash[:notice] = \"Docente assegnato con successo\"\n redirect_to administration_teachings_url\n else\n redirect_to select_teacher_teaching_url(@teaching)\n end\n end",
"def create\n @student = Student.new(params[:student])\n @student.idSchool = current_user.teacher.idSchool \n\n respond_to do |format|\n if @student.save\n StdTeacher.create(idStd: @student.id, idTeacher: current_user.teacher.id, idGroup: @student.idGroup)\n format.html { redirect_to students_path, notice: 'Student was successfully created.' }\n format.json { render json: @student, status: :created, location: @student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @current_teacher = current_teacher\n @school = School.find(@current_teacher.school_id)\n @teacher = Teacher.new\n @teacher.color = teacherColors.first\n @teacher.icon = teacherIcons.first\n end",
"def new\n @teacher = Teacher.new\n @user = User.new\n respond_with @teacher\n end",
"def get_teacher\n if current_user.teacher\n @teacher =current_user.teacher\n else\n @teacher = current_user.create_teacher\n end\n end",
"def set_teacher\n @teacher = User.teachers.find_by_id(params[:id])\n end",
"def create\n @teachers_textbook = Textbook.new(teachers_textbook_params)\n # binding.pry\n respond_to do |format|\n if @teachers_textbook.save\n format.html { redirect_to [:teachers,@teachers_textbook], notice: \"Textbook was successfully created.\" }\n format.json { render :show, status: :created, location: @teachers_textbook }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @teachers_textbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @teacher = Teacher.new(params[:teacher])\n @user = User.new(params[:user]) do |u|\n u.rolable = @teacher\n u.skip_password_validation = true\n u.is_admin = params[:user][:is_admin] if current_user.is_admin # is_admin is non accessible\n end\n \n valid = @user.valid? \n valid = @teacher.valid? && valid\n \n if valid\n create_and_send_invitation(@user, @teacher, \"Teacher\")\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def teacher_params\n params.permit(:name, :email, :phone, :subject, :school_id)\n end",
"def set_teacher\n @teacher = Teacher.find( params[ :teacher_id ] )\n end",
"def set_teacher\n @teacher = Teacher.find( params[ :teacher_id ] )\n end",
"def create_technician\n @technician = Technician.new(params[:technician])\n if @technician.save\n redirect_to technician_show_path\n else\n flash[:notice] = \"Please enter Technician Name\"\n render technician_new_path\n end\n end",
"def create\n @teacher = Teacher.new(params.require(:teacher).permit(:email, :password, :password_confirmation, :name, :last, :times, :reserved)) #Create a new teacher instance with set variables\n @teacher.reserved = [\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\",\"Avalible\"] #Create teacher time slots\n if @teacher.save#If teacher saves correctly\n redirect_to prin_user_path #Redirect to the home page\n else\n render \"new\" #If else, redirect back to creation screen\n \n end\nend",
"def create\n @technic = Technic.new(technic_params)\n\n respond_to do |format|\n if @technic.save\n format.html { redirect_to @technic, notice: 'Technic was successfully created.' }\n format.json { render :show, status: :created, location: @technic }\n else\n format.html { render :new }\n format.json { render json: @technic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # raise.params\n @teacher = Teacher.find_by_name(params[:teacher][:name])\n # byebug\n if @teacher.try(:authenticate, params[:teacher][:password])\n session[:teacher_id] = @teacher.id\n flash[:message] = 'Login successful!'\n redirect_to home_path\n else\n flash[:error] = 'Incorrect username or password'\n redirect_to '/login'\n end\n end",
"def create\n teacher_exclusive\n @note = Note.create(note: params[:note], teacher_id: @current_user.id, student_id: params[:student_id], subject_id: params[:subject_id], test_id: params[:test_id])\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to test_grade_path(params[:test_id]), notice: 'La note a été insérée' }\n format.json { render :show, status: :created, location: @note }\n else\n format.html {redirect_to test_grade_path(params[:test_id]) }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorials = Tutorial.all\n @tutorial = Tutorial.new(tutorial_params)\n\n if @tutorial.save\n render json: @tutorial\n else\n render json: @tutorial.errors.full_messages, status:400\n end\n end",
"def create\n\n @teaching = Teaching.new(teaching_params)\n @user = User.find(session[:user_id]) \n \n respond_to do |format|\n if @teaching.save\n @user.teachings << @teaching\n format.html { redirect_to @teaching, notice: 'La actividad se registro con exito.' }\n format.json { render :show, status: :created, location: @teaching }\n else\n format.html { render :new }\n format.json { render json: @teaching.errors, status: :unprocessable_entity }\n end\n end\n\n \n end",
"def create\n @tutorial = Tutorial.new(params[:tutorial])\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render json: @tutorial, status: :created, location: @tutorial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tutorial = Tutorial.new(params[:tutorial])\n\n respond_to do |format|\n if @tutorial.save\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully created.' }\n format.json { render json: @tutorial, status: :created, location: @tutorial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tutor = Tutor.new(params[:tutor])\n\n respond_to do |format|\n if @tutor.save\n format.html { redirect_to @tutor, notice: 'Tutor was successfully created.' }\n format.json { render json: @tutor, status: :created, location: @tutor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tutor.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.80228996",
"0.8002134",
"0.8002134",
"0.79118246",
"0.79118246",
"0.7903219",
"0.7809076",
"0.77314436",
"0.76530373",
"0.7637161",
"0.758569",
"0.753495",
"0.74805236",
"0.734051",
"0.7319702",
"0.72887254",
"0.72540617",
"0.72211564",
"0.7204599",
"0.7194",
"0.7148154",
"0.71442586",
"0.712869",
"0.7084745",
"0.707376",
"0.70669717",
"0.7055033",
"0.70513386",
"0.7031002",
"0.7028947",
"0.70000017",
"0.69793475",
"0.68973446",
"0.6881008",
"0.683319",
"0.6825661",
"0.67440057",
"0.67379373",
"0.6735633",
"0.67140204",
"0.6713194",
"0.67006487",
"0.66828984",
"0.66809994",
"0.6673796",
"0.66736865",
"0.66580456",
"0.6653072",
"0.6633133",
"0.6632156",
"0.66143054",
"0.66125196",
"0.66124934",
"0.660322",
"0.6595748",
"0.65789926",
"0.6546623",
"0.6528413",
"0.65219146",
"0.6513771",
"0.6513771",
"0.6507981",
"0.650294",
"0.6499195",
"0.6497908",
"0.64837176",
"0.6473196",
"0.64712244",
"0.6469176",
"0.64504075",
"0.6449676",
"0.643155",
"0.64277244",
"0.64223856",
"0.6420834",
"0.641222",
"0.6409062",
"0.64059836",
"0.64000267",
"0.63992345",
"0.6389908",
"0.63783973",
"0.6378128",
"0.6362038",
"0.6357276",
"0.6349943",
"0.63458425",
"0.634504",
"0.63249004",
"0.63249004",
"0.6320588",
"0.63205206",
"0.6312265",
"0.6296898",
"0.6290622",
"0.6290298",
"0.62814444",
"0.62674475",
"0.62674475",
"0.6265727"
] |
0.749344
|
12
|
Update Method Method used by API to update a teacher into database PUT /api/v1/teachers/[id]
|
def update
teacher = Teacher.find(params[:id])
if teacher.update_attributes(teacher_params)
render json: {status: 'SUCCESS', message: 'Teacher has been updated.', data: teacher}, include:'school', status: :ok
else
render json: {status: 'ERROR', message: 'Teacher has not been updated.', data: teacher.errors}, status: :unprocessable_entity
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n if @teacher.update_attributes(params[:teacher])\n flash[:notice] = 'Teacher was successfully updated.'\n format.html { redirect_to(teachers_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @teacher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n if @teacher.update_attributes(params[:teacher])\n format.html { redirect_to @teacher, notice: 'Teacher was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n if @teacher.update_attributes(params[:teacher])\n format.html { redirect_to @teacher, notice: 'Teacher was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n if @teacher.update_attributes(params[:teacher])\n format.html { redirect_to [:admin, @teacher], :notice => 'Teacher was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @teacher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @teacher = Teacher.find(params[:id])\n respond_to do |format|\n if @teacher.update(params.require(:teacher).permit(:name, :email, :address, :discipline, :phone))\n format.html { redirect_to @teacher, notice: 'Teacher was successfully updated.' }\n format.json { render :show, status: :ok, location: @teacher }\n else\n format.html { render :edit }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n if @teacher.update_attributes(params[:teacher])\n format.html { redirect_to(@teacher, :notice => 'Teacher was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @teacher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @teacher.update(teacher_params)\n format.html { redirect_to @teacher, notice: 'Teacher was successfully updated.' }\n format.json { render :show, status: :ok, location: @teacher }\n else\n format.html { render :edit }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @teacher.update(teacher_params)\n format.html { redirect_to @teacher, notice: 'Teacher was successfully updated.' }\n format.json { render :show, status: :ok, location: @teacher }\n else\n format.html { render :edit }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @teacher.update(teacher_params)\n format.html { redirect_to @teacher, notice: 'Teacher was successfully updated.' }\n format.json { render :show, status: :ok, location: @teacher }\n else\n format.html { render :edit }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @teacher.update(teacher_params)\n format.html { redirect_to @teacher, notice: 'Teacher was successfully updated.' }\n format.json { render :show, status: :ok, location: @teacher }\n else\n format.html { render :edit }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @teacher.update(teacher_params)\n format.html { redirect_to edit_teacher_path, notice: 'Teacher was successfully updated.' }\n format.json { render :show, status: :ok, location: @teacher }\n else\n format.html { render :edit }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @teacher.update(teacher_params)\n format.html { redirect_to teachers_path, notice: 'Преподаватель обновлен!' }\n format.json { render :show, status: :ok, location: @teacher }\n else\n format.html { render :edit }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @teacher.update(teacher_params)\n format.html { redirect_to @teacher, notice: 'Teacher was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n if @teacher.update_attributes(params[:teacher])\n format.html { redirect_to(@teacher, :notice => 'Информация отредактирована.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @teacher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n if @teacher.update_attributes(params[:teacher])\n format.html { redirect_to(@teacher, :notice => 'Profesor guardado con éxito.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @teacher.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n if @teach.update_attributes(params[:teach])\n format.html { redirect_to @teach, notice: 'Teach was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #params = parse_parametrs(params)\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n if @teacher.update_attributes(params[:teacher]) &&\n @teacher.user.update_attributes({:name => params[:name],\n :last_name => params[:last_name],\n :middle_name => params[:middle_name],\n :role_pending => params[:role_pending]\n })\n\n format.html { redirect_to @teacher, notice: 'Teacher was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @teach = Teach.find(params[:id])\n\n respond_to do |format|\n if @teach.update_attributes(params[:teach])\n format.html { redirect_to @teach, notice: 'Teach was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\tif !isLogin\n\t\t\tredirect_to controller: 'login', action: 'login'\n\t\t\treturn\n\t\tend\n\t\trespond_to do |format|\n\t\t\t@teacher.changed_id = getLoginUserId\n\t\t\tif @teacher.update(teacher_params)\n\t\t\t\tformat.html { redirect_to @teacher, notice: 'Der Lehrer wurde erfolgreich gespeichert.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @teacher }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @teacher.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @teacher = Teacher.find(params[:id])\n\n respond_to do |format|\n if @teacher.update_attributes(params[:teacher])\n format.html do\n\n if current_teacher.superuser?\n redirect_to :back\n else\n redirect_to @teacher, notice: 'Teacher was successfully updated.'\n end\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @teacher.update(teacher_params)\n format.html { redirect_to admin_teacher_path(@teacher), notice: 'teacher was successfully updated.' }\n format.json { render action: 'show', status: :updated, location: @teacher }\n #format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_teacher\n @teacher = User.teachers.find_by_id(params[:id])\n end",
"def update\n respond_to do |format|\n if @teach.update(teach_params)\n format.html { redirect_to @teach, notice: 'Teach was successfully updated.' }\n format.json { render :show, status: :ok, location: @teach }\n else\n format.html { render :edit }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @courses_teacher.update(courses_teacher_params)\n format.html { redirect_to @courses_teacher, notice: 'Courses teacher was successfully updated.' }\n format.json { render :show, status: :ok, location: @courses_teacher }\n else\n format.html { render :edit }\n format.json { render json: @courses_teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course_has_teacher.update(course_has_teacher_params)\n format.html { redirect_to @course_has_teacher, notice: 'Course has teacher was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_has_teacher }\n else\n format.html { render :edit }\n format.json { render json: @course_has_teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @teacher = Teacher.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @subject_teacher.update(subject_teacher_params)\n format.html { redirect_to @subject_teacher, notice: 'Subject teacher was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject_teacher }\n else\n format.html { render :edit }\n format.json { render json: @subject_teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_teacher_id\n @teachers=Teacher.find_by(name: params[:course][:teacher_name])\n end",
"def set_teacher\n @teacher = Teacher.find( params[ :teacher_id ] )\n end",
"def set_teacher\n @teacher = Teacher.find( params[ :teacher_id ] )\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def update\n\t\t@course = @teacher.courses.find(params[:id])\n\n respond_to do |format|\n if @course.update_attributes(params[:course])\n format.html { redirect_to [:teacher, @course], :notice => 'Course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def editd\n @teacher = Teacher.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @course.update(course_params)\n @course.teacher = Teacher.where(email: params[:teacher]).first\n @course.save\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edita\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def editc\n @teacher = Teacher.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @teacher_datum.update(teacher_datum_params)\n format.html { redirect_to @teacher_datum, notice: \"Teacher datum was successfully updated.\" }\n format.json { render :show, status: :ok, location: @teacher_datum }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @teacher_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_teacher\n\t\t@teacher = Teacher.find(params[:id])\n\tend",
"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 @course.teacher == current_teacher\n if @course.update(course_params)\n format.html { redirect_to @course, notice: 'Course was successfully updated.' }\n format.json { render :show, status: :ok, location: @course }\n else\n format.html { render :edit }\n format.json { render json: @course.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to @course, alert: 'Forbidden. Course belongs to different teacher.' }\n format.json { render json: {forbidden: \"Course belongs to different teacher.\"}, status: :forbidden }\n end\n end\n end",
"def update\n respond_to do |format|\n if @teacher_matter.update(teacher_matter_params)\n format.html { redirect_to @teacher_matter, notice: 'Teacher matter was successfully updated.' }\n format.json { render :show, status: :ok, location: @teacher_matter }\n else\n format.html { render :edit }\n format.json { render json: @teacher_matter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assign_teacher\n @teacher = Teacher.find(params[:teacher_id])\n @teaching = Teaching.find(params[:id])\n @teaching.teacher = @teacher\n if @teaching.save\n flash[:notice] = \"Docente assegnato con successo\"\n redirect_to administration_teachings_url\n else\n redirect_to select_teacher_teaching_url(@teaching)\n end\n end",
"def update\n @tuiter = current_user.tuiters.find(params[:id])\n respond_to do |format|\n if @tuiter.update(tuiter_params)\n format.html { redirect_to @tuiter, notice: 'Tuiter was successfully updated.' }\n format.json { render :show, status: :ok, location: @tuiter }\n else\n format.html { render :edit }\n format.json { render json: @tuiter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @teachers_textbook.update(teachers_textbook_params)\n format.html { redirect_to [:teachers,@teachers_textbook], notice: \"Textbook was successfully updated.\" }\n format.json { render :show, status: :ok, location: @teachers_textbook }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @teachers_textbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def teacher=(_teacher)\n add_teacher(_teacher)\n end",
"def update\n hasError = 0 \n @subject = Subject.find(params[:id]) \n if params[:teachers_id] == nil\n session[:error] =\"You have to select one or more teachers.\" \n hasError = 1\n else\n if @subject.update_attributes(params[:subject]) \n @subject.teachers.delete_all\n adding_teachers \n CustomLogger.debug(\"Subject updated\")\n CustomLogger.debug(\"--------------\") \n to_log(@subject) \n @subject = Subject.new\n end \n end \n restore_lists\n end",
"def update\n @teaching_method = @school_subject.teaching_methods.find(params[:id])\n\n respond_to do |format|\n if @teaching_method.update_attributes(params[:teaching_method])\n format.html { redirect_to( school_subject_teaching_methods_path(@school_subject) ) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @teaching_method.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stay_has_teacher.update(stay_has_teacher_params)\n format.html { redirect_to @stay_has_teacher, notice: 'Stay has teacher was successfully updated.' }\n format.json { render :show, status: :ok, location: @stay_has_teacher }\n else\n format.html { render :edit }\n format.json { render json: @stay_has_teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @teach_video = TeachVideo.find(params[:id])\n\n respond_to do |format|\n if @teach_video.update_attributes(params[:teach_video])\n format.html { redirect_to @teach_video, notice: 'Teach video was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teach_video.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = @teacher.user\n respond_to do |format|\n if @teacher.update_attributes(params[:teacher]) && @user.update_attributes(params[:user])\n @user.update_attribute(:is_admin, params[:user][:is_admin]) if current_user.is_admin # is_admin is non accessible\n format.html { redirect_to @teacher, notice: 'Teacher was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n teacher_exclusive\n respond_to do |format|\n if @test.update title: params[:title], test_date: params[:test_date], teacher_id: @current_user.id\n format.html { redirect_to @test, notice: \"L'épreuve a été modifiée\" }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @teacher_history = TeacherHistory.find(params[:id])\n\n respond_to do |format|\n if @teacher_history.update_attributes(params[:teacher_history])\n format.html { redirect_to @teacher_history, notice: 'Teacher history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @teacher_history.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @teaching.update(teaching_params)\n format.html { redirect_to @teaching, notice: \"教学已被成功更新\" }\n format.json { render :show, status: :ok, location: @teaching }\n else\n format.html { render :edit }\n format.json { render json: @teaching.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_teacher_datum\n @teacher_datum = TeacherDatum.find(params[:id])\n end",
"def change_teacher\n member = Member.find(params[:member_id])\n user = User.find(params[:teacher_to_change_to])\n \n User.change_teacher(user.id, member)\n\n redirect_to users_teachers_path, notice: \"#{user.first_name} #{user.last_name} is now a teacher of section #{member.section_number}.\"\n end",
"def set_courses_teacher\n @courses_teacher = CoursesTeacher.find(params[:id])\n end",
"def update\n @tweeter = Tweeter.find(params[:id])\n\n respond_to do |format|\n if @tweeter.update_attributes(params[:tweeter])\n format.html { redirect_to @tweeter, notice: 'Tweeter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tweeter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:id])\n\n msg = check_valid_names\n if !msg.empty?\n logger.debug msg\n flash[:error] = msg\n redirect_to :action => 'update'\n return\n end\n handle_teams_people\n\n update_course_faculty_label\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n flash[:notice] = 'Team was successfully updated.'\n format.html { redirect_to(course_teams_path(@team.course)) }\n format.xml { head :ok }\n else\n @faculty = User.find(:all, :order => \"twiki_name\", :conditions => [\"is_teacher = true\"])\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @course = Course.find_by(id: params[:id])\n @teacher = current_user\n if @course and @course.teacher_id == @teacher.id\n @course.name = params[:name]\n if @course.name != nil and @course.name != \"\"\n @course.save\n end\n redirect_to \"/courses/view/#{@course.id}\"\n else\n redirect_to \"/users/view/#{@teacher.id}\"\n end\n end",
"def set_subject_teacher\n @subject_teacher = SubjectTeacher.find(params[:id])\n end",
"def update\n @student = current_user.teacher.students.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n StdTeacher.where(\"idStd = ? AND idTeacher = ?\", @student.id, current_user.teacher.id).update_all(idGroup: @student.idGroup)\n format.html { redirect_to students_path, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tender = get_tender_for_user #Tender.find(params[:id])\n\n respond_to do |format|\n if @tender.update_attributes(params[:tender])\n flash[:notice] = 'Tender was successfully updated.'\n format.html { redirect_to(@tender) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tender.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tutor = Tutor.find(params[:id])\n\n respond_to do |format|\n if @tutor.update_attributes(params[:tutor])\n flash[:notice] = 'Tutor was successfully updated.'\n format.html { redirect_to(@tutor) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tutor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@tutorial = Tutorial.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @tutorial.update_attributes(params[:tutorial])\n\t\t\t\tformat.html { redirect_to @tutorial, :notice => 'Tutorial was successfully updated.' }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.json { render :json => @tutorial.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def set_teacher\n @teacher = Teacher.find(session[:teacher_id])\n end",
"def set_teacher\n @teacher = Teacher.find(session[:teacher_id])\n end",
"def update\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n if @tutorial.update_attributes(params[:tutorial])\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tutorial = Tutorial.find(params[:id])\n\n respond_to do |format|\n if @tutorial.update_attributes(params[:tutorial])\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tutorial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_teacher_class\n @teacher_class = TeacherClass.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n @title = @teacher.name\n end",
"def set_teacher\n @teacher = Teacher.find(session[:teacher_id])\n end",
"def set_teacher\n current_teacher = Teacher.find_by_id(params[:teacher_id])\n redirect_to root_path if !current_teacher\n end",
"def update\n @teacher = Teacher.find(params[:teacher_id])\n @learningwalk = @teacher.learningwalks.find(params[:id])\n\n respond_to do |format|\n if @learningwalk.update_attributes(params[:learningwalk])\n format.html { redirect_to teacher_learningwalk_path(@teacher), notice: 'Observation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @learningwalk.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tutor.update(tutor_params)\n format.html { redirect_to @tutor, notice: 'Tutor was successfully updated.' }\n format.json { render :show, status: :ok, location: @tutor }\n else\n format.html { render :edit }\n format.json { render json: @tutor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @title = t 'view.teaches.edit_title'\n\n respond_to do |format|\n if @teach.update(teach_params)\n format.html { redirect_to @teach, notice: t('view.teaches.correctly_updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @teach.errors, status: :unprocessable_entity }\n end\n end\n\n rescue ActiveRecord::StaleObjectError\n flash.alert = t 'view.teaches.stale_object_error'\n redirect_to edit_teach_url(@teach)\n end",
"def update\n respond_to do |format|\n if @tutorial_committee.update(tutorial_committee_params)\n format.html { redirect_to @tutorial_committee, notice: 'Tutorial committee was successfully updated.' }\n format.json { render :show, status: :ok, location: @tutorial_committee }\n else\n format.html { render :edit }\n format.json { render json: @tutorial_committee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @assignment.update(assignment_params)\n redirect_to teacher_index_path, notice: 'Assignment was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n respond_to do |format|\n if @ty.update(ty_params)\n format.html { redirect_to @ty, notice: 'Tie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_teachers_textbook\n @teachers_textbook = Textbook.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @cd_admin_tutor.update(cd_admin_tutor_params)\n format.html {redirect_to cd_admin_tutor_path(@cd_admin_tutor), notice: 'Tutor was successfully updated.'}\n format.json {render :show, status: :ok, location: @cd_admin_tutor}\n else\n format.html {render :edit}\n format.json {render json: @cd_admin_tutor.errors, status: :unprocessable_entity}\n end\n end\n end",
"def teacher_assign\n @course_allocation = CourseAllocation.find_by_course_id(params[:id])\n @course = Course.find(params[:id])\n @teachers = get_teachers_for_institute\n end",
"def teacher_params\n params.require(:teacher).permit(:first_name, :last_name, :gender, :date_of_birth, :mobile_number, :email, :listening_skills_jaws, :writing_skills_with_jaws, :strengths, :weaknesses, :tirms, :user_id)\n end",
"def update\n @team = Team.find(params[:id])\n @course = @team.course\n if has_permissions_or_redirect(:staff, course_team_path(@course, @team))\n @faculty = User.find(:all, :order => \"twiki_name\", :conditions => [\"is_teacher = true\"])\n\n msg = @team.update_members(params[:people])\n unless msg.blank?\n flash.now[:error] = msg\n render :action => 'edit'\n return\n end\n\n # handle_teams_people\n\n update_course_faculty_label\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n flash[:notice] = 'Team was successfully updated.'\n format.html { redirect_to(course_teams_path(@team.course)) }\n format.xml { head :ok }\n else\n @faculty = User.find(:all, :order => \"twiki_name\", :conditions => [\"is_teacher = true\"])\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @trainer = Trainer.find(params[:id])\n\n respond_to do |format|\n if @trainer.update_attributes(params[:trainer])\n format.html { redirect_to @trainer, notice: 'Trainer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trainer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @twee.update(twee_params)\n format.html { redirect_to @twee, notice: 'Twee was successfully updated.' }\n format.json { render :show, status: :ok, location: @twee }\n else\n format.html { render :edit }\n format.json { render json: @twee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def teacher_params\n params.require(:teacher).permit(:teach_id,:teach_name,:teach_gender,:teach_level,:addr_no,:address,:tel)\n end",
"def editing_teacher\n unless params[:student_ids].empty?\n @students = Student.where(id: params[:student_ids])\n p @students.size\n @students.each do |s|\n p s.first_name\n s.class_name = params[:class_name]\n s.save\n end\n message = {message: @students.size.to_s + ' students have had their class name updated.'}\n else\n message = {message: 'No student ids were received.'}\n end\n render json: message\n end",
"def set_teacher_chatting\n @teacher_chatting = TeacherChatting.find(params[:id])\n end",
"def update\n @trainer = Trainer.find(params[:id])\n\n respond_to do |format|\n if @trainer.update_attributes(params[:trainer])\n format.html { redirect_to @trainer, :notice => 'Trainer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @trainer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @learn = Learn.find(params[:id])\n\n respond_to do |format|\n if @learn.update_attributes(params[:learn])\n format.html { redirect_to @learn, notice: 'Learn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @learn.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.8052105",
"0.79975593",
"0.79975593",
"0.7967521",
"0.7896907",
"0.7771634",
"0.7763963",
"0.7763963",
"0.7763963",
"0.7763963",
"0.7753108",
"0.768382",
"0.76357996",
"0.7602473",
"0.75106627",
"0.7416016",
"0.7408979",
"0.738581",
"0.7376093",
"0.73698795",
"0.7350446",
"0.7186817",
"0.71363336",
"0.7117466",
"0.71160525",
"0.70836306",
"0.70638",
"0.7040562",
"0.7032962",
"0.7032962",
"0.70311445",
"0.70311445",
"0.70311445",
"0.70311445",
"0.70311445",
"0.70311445",
"0.70311445",
"0.70311445",
"0.70311445",
"0.70311445",
"0.70214283",
"0.7014892",
"0.7003664",
"0.69913787",
"0.69732165",
"0.6928208",
"0.6890306",
"0.6884525",
"0.67781585",
"0.6767025",
"0.67171544",
"0.6690457",
"0.66753006",
"0.6645788",
"0.6637765",
"0.65775585",
"0.6561019",
"0.6550281",
"0.6501639",
"0.6468691",
"0.64554626",
"0.64498365",
"0.6426025",
"0.64215624",
"0.6403207",
"0.6385295",
"0.6377714",
"0.63736707",
"0.6371821",
"0.636026",
"0.6348402",
"0.630907",
"0.6288993",
"0.62871",
"0.62814283",
"0.62814283",
"0.6275316",
"0.6275316",
"0.6271569",
"0.6266589",
"0.6258006",
"0.6250747",
"0.6234271",
"0.62222826",
"0.6208321",
"0.62019306",
"0.61919165",
"0.6190998",
"0.6181105",
"0.6171934",
"0.61715436",
"0.616647",
"0.61649275",
"0.61589617",
"0.61527514",
"0.615217",
"0.6142125",
"0.61412036",
"0.6139887",
"0.6136298"
] |
0.7512325
|
14
|
Destroy Method Method used by API to delete a teacher from database DELETE /api/v1/teachers/[id]
|
def destroy
teacher = Teacher.find(params[:id])
teacher.destroy
render json: {status: 'SUCCESS', message: 'Teacher has been deleted.', data: teacher}, status: :ok
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @teacher = Teacher.find(params[:id])\n @teacher.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_teachers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n teacher.destroy\n respond_to do |format|\n format.html { redirect_to admin_teachers_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher = Teacher.find(params[:id])\n @teacher.destroy\n\n respond_to do |format|\n format.html { redirect_to(teachers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @teacher = Teacher.find(params[:id])\n @teacher.destroy\n\n respond_to do |format|\n format.html { redirect_to(teachers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @teacher = Teacher.find(params[:id])\n @teacher.destroy\n\n respond_to do |format|\n format.html { redirect_to teachers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher = Teacher.find(params[:id])\n @teacher.destroy\n\n respond_to do |format|\n format.html { redirect_to teachers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher = Teacher.find(params[:id])\n @teacher.destroy\n\n respond_to do |format|\n format.html { redirect_to teachers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher = Teacher.find(params[:id])\n @teacher.destroy\n\n respond_to do |format|\n format.html { redirect_to teachers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher.user.destroy\n @teacher.destroy\n\n respond_to do |format|\n format.html { redirect_to teachers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @teacher = Teacher.find(params[:id]) \n @teacher.destroy\n\n\n respond_to do |format|\n format.html { redirect_to(teachers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @teacher.destroy\n respond_to do |format|\n format.html { redirect_to teachers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher.destroy\n respond_to do |format|\n format.html { redirect_to teachers_url, notice: 'Teacher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher.destroy\n respond_to do |format|\n format.html { redirect_to teachers_url, notice: 'Teacher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher.destroy\n respond_to do |format|\n format.html { redirect_to teachers_url, notice: 'Teacher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher.destroy\n respond_to do |format|\n format.html { redirect_to teachers_url, notice: 'Teacher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher.destroy\n respond_to do |format|\n format.html { redirect_to teachers_url, notice: 'Teacher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher.destroy\n respond_to do |format|\n format.html { redirect_to teachers_url, notice: 'Преподаватель удален!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\tif !isLogin\n\t\t\tredirect_to controller: 'login', action: 'login'\n\t\t\treturn\n\t\tend\n\t\t@teacher.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to teachers_url, notice: 'Der Lehrer wurde erfolgreich gelöscht.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @course_has_teacher.destroy\n respond_to do |format|\n format.html { redirect_to course_has_teachers_url, notice: 'Course has teacher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher = Teacher.find(params[:id])\n @teacher.destroy rescue flash[:notice] = 'No se puede borrar el profesor'\n\n respond_to do |format|\n format.html { redirect_to(teachers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @courses_teacher.destroy\n respond_to do |format|\n format.html { redirect_to courses_teachers_url, notice: 'Courses teacher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject_teacher.destroy\n respond_to do |format|\n format.html { redirect_to subject_teachers_url, notice: 'Subject teacher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher_datum.destroy\n respond_to do |format|\n format.html { redirect_to teacher_data_url, notice: \"Teacher datum was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n if params[:course_id]\n begin\n check_admin\n course = Course.find(params[:course_id])\n teacher = User.find(params[:id])\n if teacher.teaching_courses.where(course_id: course.id).first.destroy\n json_successful\n else\n json_failed\n end\n rescue ActiveRecord::RecordNotFound\n json_failed(REASON_RESOURCE_NOT_FOUND)\n end\n elsif params[:id]\n check_admin\n begin\n @teacher = User.find(params[:id])\n json_failed(REASON_RESOURCE_NOT_FOUND) unless @teacher.is_teacher\n if @teacher.destroy\n json_successful\n else\n json_failed\n end\n rescue ActiveRecord::RecordNotFound\n json_failed(REASON_RESOURCE_NOT_FOUND)\n end\n else\n json_failed(REASON_INVALID_OPERATION)\n end\n end",
"def destroy\n @teacher = Teacher.find(params[:id])\n @user_value = User.find_by(email: @teacher.email)\n @teacher.destroy\n #TeacherCourse.delete_all(teacherid: params[:id])\n TeacherCourse.where(teacherid: params[:id]).destroy_all\n CourseRegistration.where(:teacherid => params[:id]).destroy_all\n Feedback.where(:teacherid => params[:id]).destroy_all\n StudentCourse.where(:teacherid => params[:id]).destroy_all\n @user_value.destroy\n respond_to do |format|\n format.html { redirect_to teachers_url, notice: 'Teacher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stay_has_teacher.destroy\n respond_to do |format|\n format.html { redirect_to stay_has_teachers_url, notice: 'Stay has teacher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teach = Teach.find(params[:id])\n @teach.destroy\n\n respond_to do |format|\n format.html { redirect_to teaches_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @teachers_textbook.destroy\n respond_to do |format|\n format.html { redirect_to teachers_textbooks_url, notice: \"Textbook was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teach = Teach.find(params[:id])\n @teach.destroy\n\n respond_to do |format|\n format.html { redirect_to teaches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher_class.destroy\n respond_to do |format|\n format.html { redirect_to teacher_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user.destroy\n redirect_to teacher_index_path, notice: 'User was successfully destroyed.'\n end",
"def destroy\n @teacher_matter.destroy\n respond_to do |format|\n format.html { redirect_to teacher_matters_url, notice: 'Teacher matter was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n StdTeacher.where(\"idStd = ? AND idTeacher = ?\", params[:id], current_user.teacher.id).delete_all\n #@student = current_user.teacher.students.find(params[:id])\n #@student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teaching.destroy\n respond_to do |format|\n format.html { redirect_to teachings_url, notice: \"教学已被成功删除\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @course.teacher == current_teacher\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n format.html { redirect_to @course, alert: 'Forbidden. Course belongs to different teacher.' }\n format.json { render json: {forbidden: \"Course belongs to different teacher.\"}, status: :forbidden }\n end\n end",
"def destroy\n @teach.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Teach was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teach.destroy\n\n respond_to do |format|\n format.html { redirect_to course_teaches_url(@course) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutor = Tutor.find(params[:id])\n @tutor.destroy\n\n respond_to do |format|\n format.html { redirect_to tutors_url }\n end\n end",
"def destroy\n @tutor = Tutor.find(params[:id])\n @tutor.destroy\n\n respond_to do |format|\n format.html { redirect_to tutors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tuiter = current_user.tuiters.find(params[:id])\n @tuiter.destroy\n respond_to do |format|\n format.html { redirect_to tuiters_url, notice: 'Tuiter was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher_history = TeacherHistory.find(params[:id])\n @teacher_history.destroy\n\n respond_to do |format|\n format.html { redirect_to teacher_histories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teaching = Teaching.find(params[:id])\n @teaching.destroy\n respond_to do |format|\n format.html { redirect_to(administration_teachings_url) }\n end\n end",
"def destroy\n @teacher_instrument = TeacherInstrument.find(params[:id])\n @teacher = Teacher.find(@teacher_instrument.teacher_id)\n @teacher_instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to @teacher, notice: 'Instrument was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classroom.students.destroy_all\n @classroom.destroy\n respond_to do |format|\n format.html { redirect_to current_user.teacher, notice: 'Classroom was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutor = Tutor.find(params[:id])\n @tutor.destroy\n\n respond_to do |format|\n format.html { redirect_to(tutors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tutor = Tutor.find(params[:id])\n @tutor.destroy\n\n respond_to do |format|\n format.html { redirect_to(tutors_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @teaching_assistant.destroy\n respond_to do |format|\n format.html { redirect_to teaching_assistants_url, notice: 'Teaching assistant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutor.destroy\n respond_to do |format|\n format.html { redirect_to tutors_url, notice: 'Tutor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutor.destroy\n respond_to do |format|\n format.html { redirect_to tutors_url, notice: 'Tutor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher = Teacher.find(params[:teacher_id])\n @learningwalk = @teacher.learningwalks.find(params[:id])\n @learningwalk.destroy\n\n respond_to do |format|\n format.html { redirect_to teacher_path(@teacher) }\n format.json { head :no_content }\n end\n end",
"def destroy\n must_be_a_teacher_of(params[:token], @course)\n case\n when params[:student_id]\n p = Participation.where(user_id: params[:student_id], course_id: @course.id, role: ROLE_STUDENT)\n if p.count > 0 && p.first.destroy\n json_successful\n else\n json_failed(REASON_RESOURCE_NOT_FOUND)\n end\n when params[:assistant_id]\n p = Participation.where(user_id: params[:assistant_id], course_id: @course.id, role: ROLE_ASSISTANT)\n if p.first.destroy\n json_successful\n else\n json_failed(REASON_RESOURCE_NOT_FOUND)\n end\n when @course\n if @course.destroy\n json_successful\n else\n json_failed\n end\n else\n json_failed\n end\n end",
"def destroy\n teacher_exclusive\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url, notice: \"L'épreuve a été supprimée\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_teach_resource = LabTeachResource.find(params[:id])\n @lab_teach_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_teach_resources_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if current_user.teacher?(@class_group.id)\n @question_set.destroy\n respond_to do |format|\n format.html { redirect_to class_group_question_sets_url, notice: 'Question set was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n flash[:error_not_teacher] = \"You must be a teacher to perform this action.\"\n redirect_to class_groups_path\n end \n end",
"def destroy_teacher\n @signature = Signature.find(params[:id])\n @signature_teacher = @signature.signatures_teachers.find(:first,\n :conditions=>['year_id=? AND teacher_id=?', params[:year_id], params[:teacher_id]])\n @signature_teacher.destroy #rescue flash[:notice] = 'No se puede borrar al profesor de esta asignatura'\n\n respond_to do |format|\n format.html { redirect_to(@signature) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tutorial_committee.destroy\n respond_to do |format|\n format.html { redirect_to tutorial_committees_url, notice: 'Tutorial committee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teaching_activity.destroy\n respond_to do |format|\n format.html { redirect_to teaching_activities_url, notice: 'Teaching activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @practitioner.destroy\n respond_to do |format|\n format.html { redirect_to practitioners_url, notice: 'Practitioner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n set_practical_work_for_teacher\n @practical_work.destroy\n respond_to do |format|\n format.html { redirect_to teacher_practical_works_url, notice: 'Laboratory work was successfully destroyed.' }\n end\n end",
"def destroy\n @teaching_method = TeachingMethod.find(params[:id])\n @teaching_method.destroy\n\n respond_to do |format|\n format.html { redirect_to( school_subject_teaching_methods_path(@school_subject) ) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tutoring.destroy\n respond_to do |format|\n format.html { redirect_to tutorings_url, notice: 'Tutoring was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @instructor.destroy\n end",
"def destroy\n\t\t@tutorial = Tutorial.find(params[:id])\n\t\t@tutorial.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to tutorials_url }\n\t\t\tformat.json { head :ok }\n\t\tend\n\tend",
"def destroy\n @trainer = Trainer.find(params[:id])\n @trainer.destroy\n\n head :no_content\n end",
"def destroy\n @twittter.destroy\n respond_to do |format|\n format.html { redirect_to twittters_url, notice: 'Twittter was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher_schedule = TeacherSchedule.find(params[:id])\n # re-route in case we are trying to destroy reserve for a full time teacher\n return destroy_reserve if @teacher_schedule.in_reserved_state?\n @teacher = @teacher_schedule.teacher\n @teacher.current_user = @teacher_schedule.current_user = @teacher_schedule.teacher.current_user = current_user\n\n respond_to do |format|\n if @teacher_schedule.can_delete?\n @teacher_schedule.destroy\n format.html { redirect_to teacher_teacher_schedules_path(@teacher) }\n format.json { head :no_content }\n else\n format.html { redirect_to teacher_teacher_schedules_path(@teacher), :alert => \"[ ACCESS DENIED ] Cannot perform the requested action. Please contact your coordinator for access.\" }\n format.json { render json: @teacher_schedule.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n if current_user.is_admin?\n @user = User.find(params[:id])\n if @user.is_teacher?\n Query.destroy_all([\"teacher_id = ?\", @user.id])\n else \n Query.destroy_all([\"student_id = ?\", @user.id])\n end\n @user.destroy\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { render :xml => \"success\" }\n end\n else\n respond_to do |format|\n flash[:notice] = 'You cannot do this.'\n format.html { redirect_to(@user) }\n format.xml { render :text => \"error\" }\n end\n end\n end",
"def destroy\n @lecture = Lecture.find(params[:id])\n @lecture.destroy\n\n respond_to do |format|\n format.html { redirect_to lectures_url, notice: \"Lecture was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teacher_cohort.destroy\n respond_to do |format|\n format.html { redirect_to teacher_cohorts_url, notice: 'Teacher cohort was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @technic.destroy\n respond_to do |format|\n format.html { redirect_to technics_url, notice: 'Technic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutor_subject.destroy\n respond_to do |format|\n format.html { redirect_to tutor_subjects_url, notice: 'Tutor subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teather.destroy\n respond_to do |format|\n format.html { redirect_to teathers_url, notice: 'Teather was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @cd_admin_tutor.destroy\n # respond_to do |format|\n # format.html { redirect_to cd_admin_tutors_url, notice: 'Tutor was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n redirect_to :back, alert: \"you're not allow to perform this action\"\n end",
"def destroy\n @teacher_prize.destroy\n respond_to do |format|\n format.html { redirect_to teacher_prizes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n\n respond_to do |format|\n format.html { redirect_to tutorials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @t = DThread.find(params[:id])\n @t.destroy\n\n respond_to do |format|\n format.html { redirect_to(courses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @technician = Technician.find(params[:id])\n @technician.destroy\n\n respond_to do |format|\n format.html { redirect_to(technicians_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lecturer.destroy\n respond_to do |format|\n format.html { redirect_to lecturers_url, notice: \"Lecturer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @trainer.is_delete == 1\n user_id = @trainer.user_id\n @trainer.destroy\n User.destroy(user_id)\n else\n @trainer.is_delete = 1\n @trainer.save\n end\n respond_to do |format|\n format.html { redirect_to trainers_url, notice: 'Trainer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teach_video = TeachVideo.find(params[:id])\n @teach_video.destroy\n\n respond_to do |format|\n format.html { redirect_to teach_videos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to tutorials_url, notice: 'Tutorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to admin_course_tutorials_path(@course) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tweeter.destroy\n respond_to do |format|\n format.html { redirect_to tweeters_url, notice: 'Tweeter was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@tutorial = Tutorial.find(params[:id])\n #@tutorial.destroy\n #\n #respond_to do |format|\n # format.html { redirect_to tutorials_url }\n # format.json { head :no_content }\n #end\n end",
"def destroy\n respond_to do |format|\n if @teaching.destroy\n format.html { redirect_to teachings_url, notice: \"Teaching was successfully destroyed: \" }\n format.json { head :no_content }\n else\n format.html { redirect_to teachings_url, notice: \"Teaching was not destroyed: #{@teaching.errors.full_messages}\" }\n format.json { render json: @teaching.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n\t\t@participant.destroy\n\n\t\thead :no_content\n\tend",
"def destroy\n @assignment.destroy\n redirect_to teacher_index_path, notice: 'Assignment was successfully destroyed.'\n end",
"def destroy\n @pt_trainer.destroy\n respond_to do |format|\n format.html { redirect_to pt_trainers_url, notice: 'Trainer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@user=User.find(params[:id])\n \n @trainer.destroy\n puts \"Destroyed\"\n\n end",
"def destroy\n @trainer = current_user.trainers.find_by_id(params[:id])\n unless @trainer\n flash[:error] = 'You are not permitted to delete this trainer'\n redirect_to :action => 'index'\n return\n end\n @trainer.destroy\n flash[:notice] = 'Trainer was successfully deleted'\n redirect_to :action => 'index'\n return\n end",
"def destroy\n unless current_user.admin? or current_user.coordinador? or current_user.tutor?\n redirect_to '/', :alert => \"Acceso denegado.\" #por ahora solo un adminsitrador puede ver esto\n end\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n redirect_to tutorials_path\n \n end",
"def destroy\n @tutorials = Tutorials.find(params[:id])\n @tutorials.destroy\n\n respond_to do |format|\n format.html { redirect_to(tutorials_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tutor_attendance = TutorAttendance.find(params[:id])\n @tutor_attendance.destroy\n\n respond_to do |format|\n format.html { redirect_to(tutor_attendances_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @talent = Talent.find(params[:id])\n @talent.destroy\n\n respond_to do |format|\n format.html { redirect_to talents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to tutorials_url, notice: 'Your Tutorial post was successfully deleted and is now permanently offline...' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to profile_path(locale: I18n.locale,username: @tutorial.user.username), notice: 'tutorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_tutorial.destroy\n respond_to do |format|\n format.html { redirect_to user_tutorials_url, notice: 'User tutorial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n render json: @tutorial\n end",
"def destroy\n @trainer.destroy\n respond_to do |format|\n format.html { redirect_to trainers_url, notice: 'Trainer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to tutorials_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.8410002",
"0.8358778",
"0.83311886",
"0.83311886",
"0.82799214",
"0.82793546",
"0.82793546",
"0.82793546",
"0.82093024",
"0.8155484",
"0.81123024",
"0.81035995",
"0.81035995",
"0.81035995",
"0.81035995",
"0.81035995",
"0.80392414",
"0.78662366",
"0.782562",
"0.7764053",
"0.7763351",
"0.77602553",
"0.7648157",
"0.7647184",
"0.75256497",
"0.7469909",
"0.74451655",
"0.74402755",
"0.74239457",
"0.7353711",
"0.73179483",
"0.730622",
"0.72314614",
"0.7215357",
"0.720575",
"0.7205098",
"0.71692044",
"0.71448356",
"0.7120285",
"0.7119085",
"0.7105786",
"0.71020937",
"0.7101382",
"0.7069443",
"0.70576787",
"0.70576787",
"0.704284",
"0.70245844",
"0.70245844",
"0.6991001",
"0.6988706",
"0.6884351",
"0.6843474",
"0.6797036",
"0.6777824",
"0.6763505",
"0.6760207",
"0.6751783",
"0.67146134",
"0.6707432",
"0.670519",
"0.6702158",
"0.67006636",
"0.66891",
"0.6687977",
"0.66826844",
"0.66820365",
"0.66774327",
"0.66657794",
"0.6660051",
"0.66522884",
"0.6651087",
"0.66455656",
"0.6644105",
"0.66431546",
"0.6628078",
"0.66228026",
"0.662272",
"0.66160417",
"0.66097534",
"0.66062444",
"0.6605809",
"0.65926355",
"0.6590646",
"0.65736854",
"0.6572404",
"0.65594995",
"0.6552899",
"0.655072",
"0.65498745",
"0.65455997",
"0.6530843",
"0.6530753",
"0.65291774",
"0.65286714",
"0.652569",
"0.652075",
"0.65175843",
"0.6513707",
"0.6511581"
] |
0.8289337
|
4
|
Method teacher_params Private params for Teacher
|
def teacher_params
params.permit(:name, :email, :phone, :subject, :school_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def teacher_params\n # Steven Royster: Changed the teacher_params. Got rid of a lot of them in an attempt to fix login.\n params.require(:teacher).permit(:user_name, :teacher_password)\n end",
"def teacher_params\n params.require( :teacher).permit( :user_name, :full_name, :email, :admin,\n :password, :password_confirmation, :color, :icon, :description,\n :school_id, :suspended)\n end",
"def teacher_params\n\t\t\t@usr = User.find_by_id(session[:user_id])\n\t\t\tif @usr.admin?\n \tparams.require(:teacher).permit(:user_name, :name, :password, :diploma_supervisor, :reviewer, :commissioner, :business, :access)\n\t\t\telse \n\t\t\t\tparams.require(:teacher).permit(:user_name, :name, :password, :diploma_supervisor, :reviewer, :commissioner, :business)\n\t\t\tend\n \n end",
"def teacher_params\n params.require(:teacher).permit(:first_name, :last_name, :gender, :date_of_birth, :mobile_number, :email, :listening_skills_jaws, :writing_skills_with_jaws, :strengths, :weaknesses, :tirms, :user_id)\n end",
"def teacher_params\n params.require(:teacher).permit(:first_name, :last_name, :profile_name, :profile_pic_url, :about_me, :github_username, :codecademy_username, :user_id, :school_id)\n end",
"def teacher_params\n\t\tparams.require(:teacher).permit(:name, :firstname, :abbreviation, :email, :room_title, :team_id)\n\tend",
"def teacher_params\n params.require(:teacher).permit(:name, :email, :password, :current_topic_id)\n end",
"def teacher_params\n params.require(:teacher).permit(:user_name, :teacher_icon_name, \n :teacher_name, :teacher_email, :admin_powers, :analysis_powers, \n :teacher_description, :color, :school_id, :teacher_password, \n :teacher_password_confirmation)\n end",
"def teacher_params\n params.require(:teacher).permit(:first_name, :last_name, :title, :email, :password, \n :password_confirmation, :current_class, :user_number, :school_id)\n end",
"def teacher_params\n params.require(:teacher).permit(:name, :degree, :university_id, :phone_number, :email)\n end",
"def teacher_params\n params.require(:teacher).permit(:teach_id,:teach_name,:teach_gender,:teach_level,:addr_no,:address,:tel)\n end",
"def teacher_params\n params.require(:teacher).permit(:name, :email, :password, :teacher_id, :password_confirmation)\n end",
"def teacher_params\n params.require(:teacher).permit(:name, :email, :password, :password_confirmation)\n end",
"def teacher_params\n params.require(:teacher).permit(:id_number, :name, :subject_id )\n end",
"def teacher_params\n params.require(:teacher).permit(:name, :lname, :mname, :pin, :degree, :master, :dictamen, :shift, :age, :total_hrs, {academy_ids: []}, {subject_ids: []}, posts_attributes: [:id, :name, :hrs, :_destroy])\n end",
"def teacher_params\n params.require(:teachers).permit(:name, :email, :subject, :grade_level)\n end",
"def teacher_params\n params.require(:teacher).permit(:lname, :fname, :sname, :birth, :degree, :rank, :post)\n end",
"def teacher_params\n params.require(:user).permit(:export_id, :first_name, :last_name, :preferred_name, :email, :current_grade_id, :next_grade_id, :active, :can_update)\n end",
"def teacher_params\n params.require(:teacher).permit(:name, :email, :location_id, :password, :password_confirmation)\n end",
"def teacher_params\n params.require(:teacher).permit(:name, :email, :address, :discipline, :phone)\n end",
"def teacher_params\n params.require(:teacher).permit(:name, :email, :password)\n end",
"def teacher_params\n params.require(:teacher).permit( :name, :email, :password,\n students_attributes: [:id, :name, :email, :password, :teacher_id, :_delete,\n grades_attributes: [:id, :student_id, :assignment_name, :grade, :_delete]])\n end",
"def teacher_params\n params.require(:teacher).permit(:name)\n end",
"def teacher_params\n params.require(:teacher).permit(:first_name, :last_name, :age, :salary, :education, :image)\n end",
"def subject_teacher_params\n params.require(:subject_teacher).permit(:teacher_id, :subject_id)\n end",
"def course_has_teacher_params\n params.require(:course_has_teacher).permit(:status, :course_id, :teacher_id)\n end",
"def course_params\n teacher_id = params.require(:course)[:teacher]\n if teacher_id\n teacher = Person.find(teacher_id)\n else\n teacher = nil\n end\n\n params.require(:course).permit(\n :title, :code, :quota\n ).merge(:teacher => teacher)\n end",
"def tutoring_params\n params.permit(:due_date, :subject_id, :teacher_id)\n end",
"def courses_teacher_params\n params.require(:courses_teacher).permit(:course_id, :teacher_id, :start_date, :end_date)\n end",
"def teacher_datum_params\n params.require(:teacher_datum).permit(:first_name, :last_name, :nine_hundred, :email)\n end",
"def teach_params\n params.fetch(:teach, {})\n end",
"def properties\n @teacher = current_teacher\n params[:id] = @teacher.id\n end",
"def get_params_for_teacher_create\n params.require(:practical_work).permit(:name, :description, :group, :academic_plan_id, :end_date)\n end",
"def set_teacher\n @teacher = Teacher.find( params[ :teacher_id ] )\n end",
"def set_teacher\n @teacher = Teacher.find( params[ :teacher_id ] )\n end",
"def teacher_class_params\n params.require(:teacher_class_relationship).permit(:user_id, :class_section_id, :teacher_role_id)\n end",
"def tutor_params\n params.require(:tutor).permit(:type_of_tutor, :grade_level, :classes_id, :email, :first_name, :last_name)\n end",
"def teacher_matter_params\n params.require(:teacher_matter).permit(:teacher_id, :matter_id, :custo)\n end",
"def teacher_chatting_params\n params.require(:teacher_chatting).permit(:teacher_id, :chat_id)\n end",
"def course_params\n params.require(:course).permit(:teacher, :subject, :grade, :level, :teacher_id)\n end",
"def tutorial_committee_params\n params.require(:tutorial_committee).permit(:name, :period, :teacher_type_id, :student_id)\n end",
"def class_room_subject_params\n params.require(:class_room_subject).permit(:subject_id, :class_room_id,:teacher_id)\n end",
"def set_teacher\n\t\t@teacher = Teacher.find(params[:id])\n\tend",
"def set_teacher_id\n @teachers=Teacher.find_by(name: params[:course][:teacher_name])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def stay_has_teacher_params\n params.require(:stay_has_teacher).permit(:status, :stay_id, :teacher_id)\n end",
"def teaching_params\n params.require(:teaching).permit(:tipo, :nombre, :descripcion, :horas, :fecha_i, :fecha_f, :ano_periodo, :creador, user_ids: [])\n end",
"def tutor_subject_params\n params.require(:tutor_subject).permit(:tutor_id, :subject_id)\n end",
"def teacher_assign\n @course_allocation = CourseAllocation.find_by_course_id(params[:id])\n @course = Course.find(params[:id])\n @teachers = get_teachers_for_institute\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n end",
"def set_teacher\n @teacher = Teacher.find(params[:id])\n @title = @teacher.name\n end",
"def techers_assignment_params\n params.require(:techers_assignment).permit(:teacher_id, :assignment_id)\n end",
"def user_params\n params.require(:user).permit(:email, :password, :role_id, teacher: [:first_name, :last_name], student: [:first_name, :last_name, :teacher_id], parent: [:first_name, :last_name, :student_id])\n end",
"def tutor_profile_params\n params.require(:tutor_profile).permit(:user_id, :university, :degree_subject, :teaching_subject, :location, :about_myself, :tutoring_approach, :teaching_experience, :extracurricular_interests, :image, :tutor_profile_id)\n end",
"def tutor_params\n \n params.require(:tutor).permit(\n :rut,:firstname,:lastname,:email,:careercode,:level,:dv,:lastnamema,:phone,:status, :department_id)\n \n end",
"def tutor_params\n params[:tutor].permit(:email, :password, :password_confirmation, :first_name, :last_name, :user_name, :work_place, :phone_number, :dob, :gender, :about_me, :interest, :occupation, :avatar)\n end",
"def classroom_params\n\t\tparams.require(:classroom).permit(:course_id, :teacher_id, :description, :period, :course_name, :teacher_name)\n\tend",
"def teacher_class_params\n p = params.require(:teacher_class).permit(:school_id, :teacher_id, :subject_id, :classroom_id, :weekday, :start_time, :end_time)\n\n if p[\"start_time(4i)\"].blank?\n @teacher_class.start_time = nil\n p = p.except(\"start_time(1i)\", \"start_time(2i)\", \"start_time(3i)\", \"start_time(4i)\", \"start_time(5i)\") \n end\n\n if p[\"end_time(4i)\"].blank?\n @teacher_class.end_time = nil\n p = p.except(\"end_time(1i)\", \"end_time(2i)\", \"end_time(3i)\", \"end_time(4i)\", \"end_time(5i)\")\n end\n\n p\n end",
"def set_teacher\n @teacher = User.teachers.find_by_id(params[:id])\n end",
"def tutor_params\n params.require(:tutor).permit(:username, :internal_password, :name, :first_last_name, :second_last_name, :email, :country, :state, :city, :partner, :organization_code, :gender, :dob, :phone_number, :language)\n end",
"def teacher_cohort_params\n params.require(:teacher_cohort).permit(:teacher_id, :cohort_id)\n end",
"def teacher_cohort_params\n params.require(:teacher_cohort).permit(:teacher_id, :cohort_id)\n end",
"def course_params\n params.require(:course).permit(:name, :description, :teacher_id)\n end",
"def tutor_params\n params.require(:tutor).permit(:name, :course, :yrs_of_exp, :availability)\n end",
"def teaching_params\n params.require(:teaching).permit(:user_id, :lesson_id, :title)\n end",
"def timetable_params\n params.require(:timetable).permit(:subject, :day_of_week, :slot_time, :teacher_id, :school_class_id)\n end",
"def teacher= name\n set_teacher(name, Term.current)\n end",
"def teacher=(_teacher)\n add_teacher(_teacher)\n end",
"def cd_admin_tutor_params\n params.require(:tutor).permit(:title, :description, :hour_rate, :highest_education, :teach_online, :currency, :place_of_work, :status)\n end",
"def teaching_params\n params.require(:teaching).permit(:name, :teaching_class_school_id, :teaching_teacher_id,\n :teaching_matter_id, :teaching_domain_id, :teaching_location_id, :teaching_start_time, :teaching_duration, :teaching_repetition, :teaching_repetition_number, :description, :custo)\n end",
"def set_teacher_datum\n @teacher_datum = TeacherDatum.find(params[:id])\n end",
"def set_subject_teacher\n @subject_teacher = SubjectTeacher.find(params[:id])\n end",
"def tutor_params\n params.require(:tutor).permit(:ammountStudents)\n end",
"def teacher_prize_params\n params.require(:teacher_prize).permit(:prize_provider_id, :code, :user_id)\n end",
"def dormitory_params\n params.require(:dormitory).permit(:name, :description, :teacher_id)\n end",
"def profile\n @teacher = current_teacher\n params[:id] = @teacher.id\n end",
"def membership_params\n params.require(:membership).permit(:teacher, :nickname)\n end",
"def subject_params\n params.require(:subject).permit(:name, :grade, :tutor_id)\n end",
"def suspended_teacher_params\n params.permit(:suspended)\n end",
"def homeroom_params\n params.require(:homeroom).permit(:goal, :name, :teacher)\n end",
"def school_cycle_has_subject_params\n params.require(:school_cycle_has_subject).permit(:school_cycle_id, :teacher_id, :subject_id, :lunes, :martes, :miercoles, :jueves, :viernes, :sabado, :horario_clases)\n end",
"def course_params\n params.require(:course).permit(:teacher_id, :course_number, :name, :deptName, :section, :submitted)\n end",
"def student_params\n params.require(:student).permit(:roll_no, :first_name, :middle_name, :last_name, :dob, :age, :teacher_id)\n end",
"def student_params\n params.require(:student).permit(:name, :email, :password, :teacher_id, :password_confirmation)\n end",
"def set_teacher\n @teacher = Teacher.joins(:account).select(\"teachers.*, teachers.id,\n\t accounts.id AS account_id\").where(\"accounts.id\": params[:id]).first\n\tend",
"def teachers_textbook_params\n params.require(:textbook).permit(:name)\n end",
"def ensemble_params\n params.require(:ensemble).permit(:subject_id, :teacher_id, :academic_year)\n end",
"def index\n # byebug\n @attendences = Attendence.all\n @teachers= Teacher.all\n params[:data_value]\n\n\n\n\n\n end",
"def teaching_period_params\n params[:teaching_period]\n end",
"def required_teacher\n require_user_type(:teacher)\n end",
"def teacher_attachment_params\n params.require(:teacher_attachment).permit(:teacher_id, :avatar)\n end"
] |
[
"0.81150186",
"0.7974617",
"0.794482",
"0.79345787",
"0.7888767",
"0.788833",
"0.7874398",
"0.78552693",
"0.78465366",
"0.7768704",
"0.7749777",
"0.77125067",
"0.7705771",
"0.76323205",
"0.7623158",
"0.7614509",
"0.7603085",
"0.7501094",
"0.7472192",
"0.7470412",
"0.7441826",
"0.7403792",
"0.7374878",
"0.7354849",
"0.73227876",
"0.7172152",
"0.71368676",
"0.7083387",
"0.70638293",
"0.69518197",
"0.6928186",
"0.6900942",
"0.6900821",
"0.67108595",
"0.67108595",
"0.6710609",
"0.6693835",
"0.6669437",
"0.6659879",
"0.66259474",
"0.6610729",
"0.656983",
"0.65490085",
"0.65215164",
"0.65173066",
"0.6514802",
"0.64703315",
"0.646793",
"0.6465845",
"0.6464964",
"0.6464964",
"0.6464964",
"0.6464964",
"0.6464964",
"0.6464964",
"0.6464964",
"0.6464964",
"0.6464964",
"0.6464964",
"0.64610064",
"0.643558",
"0.6421198",
"0.6416811",
"0.6404649",
"0.638101",
"0.63770956",
"0.6347136",
"0.6325887",
"0.63203037",
"0.6315554",
"0.6315554",
"0.6290123",
"0.6285228",
"0.6266101",
"0.62543994",
"0.6251941",
"0.62488925",
"0.6243693",
"0.62214154",
"0.62211925",
"0.61799246",
"0.6176432",
"0.61734706",
"0.6166851",
"0.6162812",
"0.6148124",
"0.61353076",
"0.61252165",
"0.60985136",
"0.6096671",
"0.6094614",
"0.60637397",
"0.6060804",
"0.60409826",
"0.60355663",
"0.60252714",
"0.60241205",
"0.60192674",
"0.60035783",
"0.6001863"
] |
0.74345434
|
21
|
Overridden method from OmniAuth::Strategy. This is the first step in the authentication process.
|
def request_phase
redirect authorize_endpoint_url
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def authenticate_once_state\n super\n end",
"def authentication_method\n super\n end",
"def authenticate!\n\n # mapping comes from devise base class, \"mapping.to\" is the class of the model\n # being used for authentication, typically the class \"User\". This is set by using\n # the `devise` class method in that model\n #byebug\n klass = mapping.to\n\n if request.headers['X-HC-FB-AUTH'].present?\n # the returned user object will be saved and serialised into the session\n\n decoded = Base64.decode64(request.headers['X-HC-FB-AUTH'])\n user_and_token = decoded.split(':')\n\n users = klass.includes(:identities).where(socify_identities: { uid: user_and_token[0], token: user_and_token[1], provider: \"facebook\"})\n begin\n if users.size == 1\n u = users.first\n identity = u.identities.find_by!(uid: user_and_token[0], token: user_and_token[1], provider: \"facebook\")\n if !identity.expires_at || (identity.expires_at && identity.expires_at > Time.now)\n success! u\n else\n fail! \"token expired\"\n end\n else\n fail! \"invalid uid and/or token\"\n end\n rescue\n fail!\n end\n end\n\n # if we wanted to stop other strategies from authenticating the user\n end",
"def http_auth_login\n # FIXME: Implement\n end",
"def authenticated?; super; end",
"def authenticate!\n # Do nothing yet\n end",
"def authenticate!\n\n # mapping comes from devise base class, \"mapping.to\" is the class of the model\n # being used for authentication, typically the class \"User\". This is set by using\n # the `devise` class method in that model\n klass = mapping.to\n\n if request.headers['HTTP_X_MY_API'].present?\n # the returned user object will be saved and serialised into the session\n user = klass.find_or_initialize_by_email(request.headers['HTTP_X_MY_API'])\n success! user\n end\n\n # if we wanted to stop other strategies from authenticating the user\n end",
"def user_authentication\n end",
"def authentication_profile\n super\n end",
"def auth\n end",
"def auth\n end",
"def after_custom_authentication; end",
"def authenticate!\n if in_flow?\n continue_flow!\n else\n begin_flow!\n end\n end",
"def capable_login_auth?; end",
"def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end",
"def successful_authentication(user)\n set_brute_force_counter(user, 0)\n super\n end",
"def handle_request( request, &block )\n\t\tself.log.debug \"[:auth] Wrapping request in auth with a %p\" % [ self.auth_provider ]\n\n\t\trequest.auth_provider = self.auth_provider\n\t\tself.authenticate_and_authorize( request )\n\n\t\tsuper\n\tend",
"def authenticate\n end",
"def initialize\n super\n @strategy = :user\n end",
"def login_required\n authenticate_user! \n end",
"def active_for_authentication?; end",
"def active_for_authentication?; end",
"def after_custom_authentication\n\n end",
"def before_request\n self.login if require_login? && !@authenticating\n end",
"def authenticate\n if user_has_session_cookie? and user_in_database?\n Thread.current['uid'] = session[:uid]\n else\n unless authentication_in_progress?\n redirect '/auth/google_oauth2', 303\n end\n end\n end",
"def callback_phase\n ym_session_id = env['rack.session'][RACK_SESSION_KEY]\n fail!(E_YM_SESSION_ID_BLANK) if ym_session_id.blank?\n ym_session = YourMembership::Session.new(ym_session_id, 100)\n\n begin\n fail! 'Failed To Log In' unless ym_session.authenticated?\n rescue YourMembership::Error => e\n fail! e.error_description\n end\n\n @user_id = ym_session.user_id\n @access_token = ym_session.to_s\n\n super\n end",
"def authenticate\n unless session[:user_id]\n session['return_url'] = request.url\n logger.debug request.url\n # Recreate user abilities on each login\n @current_ability = nil\n redirect_to polymorphic_url(:new_user_session)\n end\n end",
"def after_hash_token_authentication\n end",
"def oauth_authentication; end",
"def authenticate\n redirect_to '/login' unless current_user\n end",
"def authenticate(_)\n super(session_params)\n end",
"def auth_setup\n service = Person::OmniauthService::SetupPhase.new(community: @current_community, params: params, request: request)\n service.run\n render :plain => \"Setup complete.\", :status => 404 #This notifies the ominauth to continue\n end",
"def authenticate!\n session = DeviseTwitterAnywhere::Twitter::Session.new(cookies, params)\n\n if session.valid?\n klass = mapping.to\n user = klass.authenticate_twitter_user session.uid\n\n if user.blank? && klass.twitter_auto_create_account?\n user = klass.new\n user.twitter_session = session\n user.set_twitter_credentials_from_session!\n user.run_callbacks :create_by_twitter do\n begin\n user.save(:validate => klass.run_validations_when_creating_twitter_user)\n rescue ActiveRecord::RecordNotUnique\n fail!(:not_unique_user_on_creation) and return\n end\n end\n\n if klass.run_validations_when_creating_twitter_user && !user.persisted?\n fail!(:invalid_twitter_user_on_creation) and return\n end\n end\n\n if user.present? && user.persisted?\n user.twitter_session = session\n user.run_callbacks :connecting_to_twitter do\n success!(user) and return\n end\n else\n fail!(:twitter_user_not_found_locally) and return\n end\n else\n fail!(:invalid_twitter_session) and return\n end\n end",
"def authenticate_request!\n return render_unauthorized unless request.headers['Authorization'].present?\n\n @token ||= AuthenticateRequest.get(User, request.headers['Authorization'].split(' ').last)\n @current_user = @token[:user]\n end",
"def authenticate_user!\n redirect_to '/auth/sweetsuite' unless access_token && current_user\n end",
"def set_authenticate_once_state(opts)\n opts = check_params(opts,[:states])\n super(opts)\n end",
"def user_authentication!\n if params[:auth_token].present? or params[:token_authentication]== \"true\"\n #this is for api authentication and access\n authenticate_user_from_token!\n else\n #normal devise authentication\n authenticate_user!\n end\n end",
"def authenticate_user!(*args)\n if request.get? && !logged_in?\n session[:return_to] = request.fullpath\n session[:return_to_for_new_user] = request.fullpath\n end\n super\n end",
"def authenticate!(request, params, *rest)\n opts = rest.last.kind_of?(Hash) ? rest.pop : {}\n rest = rest.flatten\n \n strategies = if rest.empty?\n if request.session[:authentication_strategies] \n request.session[:authentication_strategies]\n else\n Merb::Authentication.default_strategy_order\n end\n else\n request.session[:authentication_strategies] ||= []\n request.session[:authentication_strategies] << rest\n request.session[:authentication_strategies].flatten!.uniq!\n request.session[:authentication_strategies]\n end\n \n msg = opts[:message] || error_message\n user = nil \n # This one should find the first one that matches. It should not run antother\n strategies.detect do |s|\n s = Merb::Authentication.lookup_strategy[s] # Get the strategy from string or class\n unless s.abstract?\n strategy = s.new(request, params)\n user = strategy.run! \n if strategy.halted?\n self.headers, self.status, self.body = [strategy.headers, strategy.status, strategy.body]\n halt!\n return\n end\n user\n end\n end\n \n # Check after callbacks to make sure the user is still cool\n user = run_after_authentication_callbacks(user, request, params) if user\n \n # Finally, Raise an error if there is no user found, or set it in the session if there is.\n raise Merb::Controller::Unauthenticated, msg unless user\n session[:authentication_strategies] = nil # clear the session of Failed Strategies if login is successful \n self.user = user\n end",
"def authentication\n raise NotImplementedError\n end",
"def authenticate_request!\n\t\t# unless is if in reverse. If user_id_in_token == false then render error\n\t unless user_id_in_token?\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\t return\n\t end\n\t @current_user = User.find(auth_token[:user_id])\n\trescue JWT::VerificationError, JWT::DecodeError\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\tend",
"def authenticate\n\n # This suppresses the log in suggestion on subsequent\n # request if the user clicks \"No\"\n if params[:stay_anonymous]\n cookies[:shunt_hint] = 'anonymous'\n logger.info \"Suppressing log in suggestion\"\n redirect_to url_for(params.except!(:stay_anonymous))\n end\n\n if params[:public]\n cookies[:shunt_hint] = 'public'\n redirect_to url_for(params.except!(:public))\n end\n\n if should_force_authentication\n force_authentication\n end\n end",
"def strategy(name, *args, &block)\n ware = OmniAuth::Strategies.const_get(OmniAuth::Utils.camelize(name.to_s))\n Scrapple.middleware_stack.insert_before(App, ware, *args, &block)\n end",
"def set_auth\n @auth = session[:omniauth] if session[:omniauth]\n end",
"def valid_for_authentication?; end",
"def valid_for_authentication?; end",
"def after_token_authentication\n end",
"def after_token_authentication\n end",
"def callback\n @user = User.find_by_hash(auth_hash)\n if @user\n login(@user)\n redirect_to \"/\" and return\n else\n # We store the authorization so that the user cannot modify\n # the provider/uid details in the form\n @authorization = Authorization.create_from_hash(auth_hash)\n session[:auth_id] = @authorization.id\n @user = User.new_from_hash(auth_hash)\n end\n end",
"def authenticate_with(identity, next_service, username); end",
"def callback_phase\n @user_info = get_user(@auth_token = fetch_auth_token(session['omniauth.ebay.session_id']))\n super\n end",
"def authenticate!\n if (options = @config[:auth])\n auth_method = options.fetch(:type).to_s + '_auth'\n self.class.send(auth_method, options[:user], options[:password])\n end\n end",
"def auth\n {}\n end",
"def before_rodauth\n rails_verify_authenticity_token\n super\n end",
"def initialize( * )\n\t\tsuper\n\t\t@auth_provider = self.class.auth_provider.new( self )\n\tend",
"def authenticate!\n\t #when we solve the require relative problem write the line: unless session[:user_id] && User.where(id: session[:user_id])\n\n\t\tif session[:user_id] && User.where(id: session[:user_id]).exists? #if the user id saved in session does not belong to any user, also direct to general homepage\n\t\t\ttrue\n\t\telse\n\t\t\tsession[:original_request] = request.path_info\n\t\t\tfalse\n\t\tend\nend",
"def call(credentials)\n @strategy.authenticate(credentials)\n end",
"def authenticate_depth\n super\n end",
"def authenticate_user!\n if current_user.id != @user.id\n redirect_back(fallback_location: root_path)\n end\n end",
"def authenticate\n\n redirect_to_login if current_user.nil?\n \n end",
"def auth_store; end",
"def authenticate\n if sesssion[:user_id].nil?\n redirect_to login_path, notice: \"You must log in first.\"\n end\n end",
"def authenticate!\n not_authorized() unless logged_in?()\n end",
"def authenticate(request)\n\n end",
"def http_auth?; end",
"def create\n\t # get the authentication parameter from the Rails router\n\t params[:provider] ? authentication_route = params[:provider] : authentication_route = 'No authentication recognized (invalid callback)'\n\n\t # get the full hash from omniauth\n\t omniauth = request.env['omniauth.auth']\n\t \n\t # continue only if hash and parameter exist\n\t if omniauth and params[:provider] == 'identity'\n\t # in the session his user id and the authentication id used for signing in is stored\n\t session[:identity] = omniauth['uid']\n\t redirect_to root_url, :notice => \"Signed in successfully.\"\n\t \n\t elsif omniauth and params[:provider]\n\t # create a new hash\n\t @authhash = Hash.new\n\t if authentication_route == 'google_oauth2'\n\t omniauth['info']['email'] ? @authhash[:email] = omniauth['info']['email'] : @authhash[:email] = ''\n\t omniauth['info']['name'] ? @authhash[:name] = omniauth['info']['name'] : @authhash[:name] = ''\n\t omniauth['uid'] ? @authhash[:uid] = omniauth['uid'].to_s : @authhash[:uid] = ''\n\t omniauth['provider'] ? @authhash[:provider] = omniauth['provider'] : @authhash[:provider] = ''\n\t else \n\t # debug to output the hash that has been returned when adding new authentications\n\t render :text => omniauth.to_yaml\n\t return\n\t end\n\t \n\t if @authhash[:uid] != '' and @authhash[:provider] != ''\n\t auth = Authentication.find_by_provider_and_uid(@authhash[:provider], @authhash[:uid])\n\t # if the user is currently signed in, he/she might want to add another account to signin\n\t if logged_in?\n\t if auth\n\t flash[:notice] = 'Your account at ' + @authhash[:provider].capitalize + ' is already connected with this site.'\n\t redirect_to authentications_path\n\t else\n\t current_user.authentications.create!(:provider => @authhash[:provider], :uid => @authhash[:uid], :uname => @authhash[:name], :uemail => @authhash[:email])\n\t flash[:notice] = 'Your ' + @authhash[:provider].capitalize + ' account has been added for signing in at this site.'\n\t redirect_to authentications_path\n\t end\n\t else\n\t if auth\n\t # signin existing user\n\t # in the session his user id and the authentication id used for signing in is stored\n\t session[:user] = auth.user.id\n\t session[:authentication_id] = auth.id\n\t \n\t flash[:notice] = 'Signed in successfully.'\n\t redirect_to root_url\n\t else\n\t # this is a new user; show signup; @authhash is available to the view and stored in the sesssion for creation of a new user\n\t if Rails.env == \"development\" or @authhash[:email].split('@').include?('intridea.com')\n\t session[:authhash] = @authhash\n\t render signup_authentications_path\n\t end\n\t # render signup_authentications_path\n\t end\n\t end\n\t else\n\t flash[:error] = 'Error while authenticating via ' + authentication_route + '/' + @authhash[:provider].capitalize + '. The authentication returned invalid data for the user id.'\n\t redirect_to login_path\n\t end\n\t else\n\t flash[:error] = 'Error while authenticating via ' + authentication_route.capitalize + '. The authentication did not return valid data.'\n\t redirect_to login_path\n\t end\n\t end",
"def require_authentication\n\n # No matter what the app does a user can always login, forgot\n # password and register. The controllers provided by this\n # plugin alreaddy have these controllers/actions on an\n # exception list but this prevents a mistake an overridden\n # controller from preventing the normal login behavior.\n %w(session password user).each do |c|\n \t %w(new create).each do |a|\n return if (controller_name == c) && (action_name == a)\n end\n \t end\n\n # If we cannot get the current user store the requested page\n # and send them to the login page.\n if current_user.nil? or current_user.anonymous?\n redirect_to login_url(:return_to => request.url) and false\n end\n end",
"def authenticate\n self.get && true\n end",
"def authenticate_name\n super\n end",
"def request_login\n _store_request_information 'login'\n\n redirect_to user_omniauth_authorize_path(params[:provider])\n end",
"def callback_phase\n @auth_token = get_auth_token(request.params[\"username\"], request.params[\"sid\"])\n @user_info = get_user_info(request.params[\"username\"], @auth_token)\n ap @user_info\n super\n rescue => ex\n fail!(\"Failed to retrieve user info from ebay\", ex)\n end",
"def force_auth\n\t\tlogger.debug \" Callback: force_auth\"\n\t\tsession[:last_ts] = nil\n\t\tCASClient::Frameworks::Rails::Filter.filter self unless @current_user\n\tend",
"def authenticate_user!\n session[:user_return_to] = env['PATH_INFO']\n redirect_to user_omniauth_authorize_path(:twitter) unless user_signed_in?\n end",
"def multi_authenticate\n if user_signed_in?\n @user = current_user #from devise authentication\n else\n @user = find_user(request, cookies) #find user by user_cookie\n end\n end",
"def auth_user\n redirect_to new_user_session_url unless user_signed_in?\n end",
"def authenticate!\n #\n # mapping.to is a wrapper over the resource model\n #\n # Treat the password as idToken\n resource = mapping.to.firebase_authentication(token)\n\n return fail! unless resource\n\n # remote_authentication method is defined in Devise::Models::RemoteAuthenticatable\n #\n # validate is a method defined in Devise::Strategies::Authenticatable. It takes\n #a block which must return a boolean value.\n #\n # If the block returns true the resource will be loged in\n # If the block returns false the authentication will fail!\n #\n if validate(resource)\n success!(resource)\n end\n end",
"def auth_trap_state\n super\n end",
"def authenticate_user\n Rails.application.config.use_omniauth ? login_required : check_session\n end",
"def before_method(request, response)\n if @current_principal\n # We already have authentication information. This means that the\n # event has already fired earlier, and is now likely fired for a\n # sub-request.\n #\n # We don't want to authenticate users twice, so we simply don't do\n # anything here. See Issue #700 for additional reasoning.\n #\n # This is not a perfect solution, but will be fixed once the\n # \"currently authenticated principal\" is information that's not\n # not associated with the plugin, but rather per-request.\n #\n # See issue #580 for more information about that.\n return nil\n end\n\n if @backends.empty?\n fail Dav::Exception, 'No authentication backends were configured on this server.'\n end\n\n reasons = []\n @backends.each do |backend|\n result = backend.check(request, response)\n\n if !result.is_a?(Array) ||\n result.size != 2 ||\n !(result[0].is_a?(TrueClass) || result[0].is_a?(FalseClass)) ||\n !result[1].is_a?(String)\n fail Dav::Exception, 'The authentication backend did not return a correct value from the check method.'\n end\n\n if result[0]\n @current_principal = result[1]\n # Exit early\n return nil\n end\n reasons << result[1]\n end\n\n # If we got here, it means that no authentication backend was\n # successful in authenticating the user.\n @current_principal = nil\n\n @backends.each do |backend|\n backend.challenge(request, response)\n end\n fail Exception::NotAuthenticated, reasons.join(', ')\n end",
"def create\n # Where do we want to redirect to with our new session\n path = cookies.encrypted[:continue] || success_path\n\n # Get auth hash from omniauth\n auth = request.env[OMNIAUTH]\n\n if auth.nil?\n return login_failure({})\n end\n\n # Find an authentication or create an authentication\n auth_model = ::Auth::Authentication.from_omniauth(auth)\n\n # adding a new auth to existing user\n if auth_model.nil? && signed_in?\n logger.info \"User signed in and re-authenticating\"\n\n ::Auth::Authentication.create_with_omniauth(auth, current_user.id)\n redirect_to path\n Auth::Authentication.after_login_block.call(current_user, auth[PROVIDER], auth)\n\n # new auth and new user\n elsif auth_model.nil?\n args = safe_params(auth.info)\n user = ::User.new(args)\n\n # Use last name and first name by preference\n fn = args[:first_name]\n if fn && !fn.empty?\n user.name = \"#{fn} #{args[:last_name]}\"\n end\n\n authority = current_authority\n\n existing = ::User.find_by_email(authority.id, user.email)\n user = existing if existing\n user.deleted = false if user.respond_to?(:deleted)\n\n user.authority_id = authority.id\n\n # now the user record is initialised (but not yet saved), give\n # the installation the opportunity to modify the user record or\n # reject the signup outright\n result = Auth::Authentication.before_signup_block.call(user, auth[PROVIDER], auth)\n\n logger.info \"Creating new user: #{result.inspect}\\n#{user.inspect}\"\n \n if result != false && user.save\n # user is created, associate an auth record or raise exception\n Auth::Authentication.create_with_omniauth(auth, user.id)\n\n # make the new user the currently logged in user\n remove_session\n new_session(user)\n\n # redirect the user to the page they were trying to access and\n # run any custom post-login actions\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n else\n logger.info \"User save failed: #{user.errors.messages}\"\n\n # user save failed (db or validation error) or the before\n # signup block returned false. redirect back to a signup\n # page, where /signup is a required client side path.\n store_social(auth[UID], auth[PROVIDER])\n redirect_to '/signup/index.html?' + auth_params_string(auth.info)\n end\n\n # existing auth and existing user\n else\n begin\n # Log-in the user currently authenticating\n remove_session if signed_in?\n user = User.find_by_id(auth_model.user_id)\n new_session(user)\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n rescue => e\n logger.error \"Error with user account. Possibly due to a database failure:\\nAuth model: #{auth_model.inspect}\\n#{e.inspect}\"\n raise e\n end\n end\n end",
"def authenticate_request!\n fail NotAuthenticatedError unless user_id_included_in_auth_token?\n @current_user = User.find(decoded_auth_token[:user_id] || decoded_auth_token[:id])\n fail NotAuthenticated if @current_user.blank?\n rescue JWT::ExpiredSignature, JWT::ImmatureSignature\n raise AuthenticationTimeoutError\n rescue JWT::VerificationError, JWT::DecodeError, ActiveRecord::RecordNotFound\n raise NotAuthenticatedError\n end",
"def custom_user_auth\n\t\t\tunless student_signed_in? || admin_signed_in?\n\t\t\t\tredirect_to root_path, notice: \"You have to sign in.\"\n\t\t\tend\n\t\tend",
"def setup\n case\n when session.delete(:only_dtu)\n request.env['omniauth.strategy'].options[:login_url] = '/login?only=dtu&template=dtu_user'\n when session.delete(:prefer_dtu)\n request.env['omniauth.strategy'].options[:login_url] = '/login?template=dtu_user'\n when session.delete(:public)\n request.env['omniauth.strategy'].options[:login_url] = '/login?template=local_user'\n else\n request.env['omniauth.strategy'].options[:login_url] = '/login'\n end\n\n render :text => \"Omniauth setup phase.\", :status => 404\n end",
"def authenticate_user\n redirect_to login_path unless logged_in_user?\n end",
"def before_save\n if self.access_token.blank?\n self.authenticated = Twitter::Client.new.authenticate?(self.username, self.password)\n end\n \n return true\n end",
"def authenticate\n if @current_user\n else\n redirect_to login_url\n end\n end",
"def authenticate_user!\n \tif user_signed_in?\n \t super\n else\n redirect_to new_user_session_path, notice: 'Debes iniciar sesión'\n end\n end",
"def authenticate_user\n redirect_to \"/login\" unless logged_in?\n end",
"def login_required\n return if authorized?\n unauthorized! unless auth.provided?\n bad_request! unless auth.basic?\n unauthorized! unless authorize(*auth.credentials)\n @req.env['REMOTE_USER'] = auth.username\n end",
"def authenticate!\n raise 'No authentication middleware present' unless authentication_middleware\n middleware = authentication_middleware.new nil, self, @options\n middleware.authenticate!\n end",
"def before(strategy)\n order = Merb::Authentication.default_strategy_order\n order.delete(self)\n index = order.index(strategy)\n order.insert(index,self)\n end",
"def authenticate\n unless logged_in?\n redirect_to login_url\n end\n end",
"def authenticate!\n Challah.techniques.values.each do |klass|\n technique = klass.new(self)\n technique.user_model = user_model if technique.respond_to?(:\"user_model=\")\n\n @user = technique.authenticate\n\n if @user\n @persist = technique.respond_to?(:persist?) ? technique.persist? : false\n break\n end\n end\n\n if @user\n # Only update user record if persistence is on for the technique.\n # Otherwise this builds up quick (one session for each API call)\n if @persist\n @user.successful_authentication!(ip)\n end\n\n return @valid = true\n end\n\n @valid = false\n end",
"def auth_options\n # Use Devise's first authentication method (e.g. email or username) to\n # get the sign in parameter\n authn_method = serialize_options(resource)[:methods].first\n authn_value = sign_in_params[authn_method]\n\n # Look for a user matching that email/username\n user = resource_class.find_for_authentication(authn_method => authn_value)\n\n super.merge(\n sign_in_params: sign_in_params.except(\"password\"),\n user: user\n )\n end",
"def authenticate\n authenticated_session || render_unauthorized\n end",
"def authenticate\n if !logged_in? || current_user.nil?\n redirect '/login'\n end\n end",
"def auth_methods; end",
"def authenticate\n if logged_in_user\n redirect_to root_url unless current_user?(find_user)\n end\n end",
"def shibboleth_passive_login\n # This is the original action called\n # before checking if we were logged in\n origin = params[:origin] if params[:origin]\n # If there is a session, authenticate the user\n if shib_session_exists?\n redirect_to user_nyu_shibboleth_omniauth_authorize_path(institute: current_institution.code, auth_type: :nyu, origin: origin)\n # If there is no session, redirect back to the last action\n else\n redirect_to origin || root_url\n end\n end",
"def authenticate_user!\n authenticated_user = authenticate_with_http_basic do |group_name, group_api_key|\n authorize_group_from_api_key(group_name: group_name, group_api_key: group_api_key)\n end\n if authenticated_user\n @current_user = authenticated_user\n else\n super\n end\n end",
"def authenticate\n redirect_to :login unless user_signed_in?\n end"
] |
[
"0.6917292",
"0.67753625",
"0.6543912",
"0.64825565",
"0.64818954",
"0.647117",
"0.6447113",
"0.63365775",
"0.6275532",
"0.6257608",
"0.6257608",
"0.6255135",
"0.6234224",
"0.6232851",
"0.62021816",
"0.6195844",
"0.6194512",
"0.61902326",
"0.61775994",
"0.6119965",
"0.61126566",
"0.61126566",
"0.6101842",
"0.61018354",
"0.6058854",
"0.60553014",
"0.603784",
"0.60259306",
"0.60231316",
"0.6002244",
"0.59741145",
"0.59733415",
"0.59731996",
"0.59723467",
"0.596764",
"0.59529525",
"0.59500813",
"0.59485745",
"0.5933411",
"0.59303105",
"0.58874685",
"0.58833456",
"0.5873041",
"0.58707106",
"0.5869208",
"0.5869208",
"0.58673406",
"0.58673406",
"0.5858793",
"0.5857936",
"0.58562213",
"0.58504647",
"0.58494115",
"0.5840453",
"0.58354956",
"0.5833008",
"0.58328474",
"0.5827345",
"0.58256876",
"0.58112925",
"0.58004767",
"0.5796486",
"0.579407",
"0.57912517",
"0.5789892",
"0.5789819",
"0.57890326",
"0.5777784",
"0.5771837",
"0.5770051",
"0.5767541",
"0.5756778",
"0.5755254",
"0.5753301",
"0.57528174",
"0.57484025",
"0.5744577",
"0.5739184",
"0.5732275",
"0.5731928",
"0.5725624",
"0.5723512",
"0.57232535",
"0.5720376",
"0.57191426",
"0.57178944",
"0.5717375",
"0.57146466",
"0.57125735",
"0.5711369",
"0.57098174",
"0.57065773",
"0.570271",
"0.57019466",
"0.57010114",
"0.5699474",
"0.56969035",
"0.5696725",
"0.5696226",
"0.56952727",
"0.56936413"
] |
0.0
|
-1
|
Overridden method from OmniAuth::Strategy. This is the second step in the authentication process. It is called after the user enters credentials at the authorization endpoint.
|
def callback_phase
error = request.params['error_reason'] || request.params['error']
fail(OAuthError, error) if error
@session_state = request.params['session_state']
@id_token = request.params['id_token']
@code = request.params['code']
@claims, @header = validate_and_parse_id_token(@id_token)
# validate_chash(@code, @claims, @header)
super
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def after_custom_authentication; end",
"def after_custom_authentication\n\n end",
"def after_token_authentication\n end",
"def after_token_authentication\n end",
"def after_hash_token_authentication\n end",
"def after_crowd_authentication\n end",
"def successful_authentication(user)\n set_brute_force_counter(user, 0)\n super\n end",
"def after_auth(user)\n # Push the avatar (Just in case any clients support it)\n # AvatarUpdaterService.new(user).update\n\n # Set rooms, groups, etc.\n UserService.update(user).save\n\n # We're done here\n sign_in_and_redirect user\n end",
"def callback\n @user = User.find_by_hash(auth_hash)\n if @user\n login(@user)\n redirect_to \"/\" and return\n else\n # We store the authorization so that the user cannot modify\n # the provider/uid details in the form\n @authorization = Authorization.create_from_hash(auth_hash)\n session[:auth_id] = @authorization.id\n @user = User.new_from_hash(auth_hash)\n end\n end",
"def auth_after\n url = session[:auth_redirect] || root_path\n redirect_to url\n end",
"def callback_phase\n @user_info = get_user(@auth_token = fetch_auth_token(session['omniauth.ebay.session_id']))\n super\n end",
"def callback_phase\n @auth_token = get_auth_token(request.params[\"username\"], request.params[\"sid\"])\n @user_info = get_user_info(request.params[\"username\"], @auth_token)\n ap @user_info\n super\n rescue => ex\n fail!(\"Failed to retrieve user info from ebay\", ex)\n end",
"def handle_request( request, &block )\n\t\tself.log.debug \"[:auth] Wrapping request in auth with a %p\" % [ self.auth_provider ]\n\n\t\trequest.auth_provider = self.auth_provider\n\t\tself.authenticate_and_authorize( request )\n\n\t\tsuper\n\tend",
"def after_successful_token_authentication\n @user = current_user\n end",
"def on_new_oauth!(oauth_response)\n authentications.new(\n \"uid\" => oauth_response[\"uid\"],\n \"provider\" => oauth_response[\"provider\"]\n )\n self\n end",
"def after_authentication\n @initiating_url = session[:initiating_url]\n session[:initiating_url] = nil\n render :'authentication/after_authentication'\n end",
"def callback_phase\n ym_session_id = env['rack.session'][RACK_SESSION_KEY]\n fail!(E_YM_SESSION_ID_BLANK) if ym_session_id.blank?\n ym_session = YourMembership::Session.new(ym_session_id, 100)\n\n begin\n fail! 'Failed To Log In' unless ym_session.authenticated?\n rescue YourMembership::Error => e\n fail! e.error_description\n end\n\n @user_id = ym_session.user_id\n @access_token = ym_session.to_s\n\n super\n end",
"def request_phase\n redirect authorize_endpoint_url\n end",
"def authenticate_once_state\n super\n end",
"def callback\n rpx_auth\n after_auth(params[:on_complete_url])\n end",
"def authentication_method\n super\n end",
"def authenticate!\n if in_flow?\n continue_flow!\n else\n begin_flow!\n end\n end",
"def oauth_authentication; end",
"def authenticate_user!\n session[:user_return_to] = env['PATH_INFO']\n redirect_to user_omniauth_authorize_path(:twitter) unless user_signed_in?\n end",
"def handle_oauth\n data = request.env['omniauth.auth']\n\n # Try find student for provider, if found authenticate normally otherwise redirect to oauth signup page.\n student = Student.find_open_auth(data.provider, data.uid).first\n\n if student&.persisted?\n flash[:notice] = I18n.t 'devise.omniauth_callbacks.success', :kind => data.provider\n sign_in_and_redirect student, :event => :authentication\n else\n # Store auth data in session (remove extra to stop cookie overflow). We mark this with 'devise' so it gets\n # #automatically cleaned up.\n session['devise.oauth_data'] = data.except(:extra)\n redirect_to new_student_oauth_path, alert: (student.errors.full_messages.join(\"\\n\") if student)\n end\n end",
"def call(credentials)\n @strategy.authenticate(credentials)\n end",
"def after_database_authentication; end",
"def after_successful_token_authentication\n # binding.pry\n # Make the authentication token to be disposable - for example\n # renew_authentication_token!\n end",
"def authorize_switch_user\n authenticate_user!\n if params[:response_type].nil?\n params[:response_type] = \"code\"\n end\n @authorizer = OAuth::Provider::Authorizer.new current_user, true, params\n render :text => @authorizer.redirect_uri\n end",
"def after_magic_link_authentication\n end",
"def callback\n # This stores all the user information that came from Auth0\n # and the IdP\n userinfo = request.env['omniauth.auth']\n\n begin\n result = SessionService.process!(userinfo, session)\n\n if result.new_user?\n redirect_to welcome_path\n else\n # Redirect to the URL you want after successful auth\n redirect_to services_path,\n flash: {\n success: I18n.t(:welcome_html, scope: [:auth, :existing_user])\n }\n end\n rescue SignupNotAllowedError\n # no new user or existing user, so they weren't allowed to sign up\n redirect_to signup_not_allowed_path\n end\n end",
"def auth_succeeded( request, credentials )\n\t\tself.log.info \"Authentication for %p succeeded.\" % [ credentials ]\n\t\t# No-op by default\n\tend",
"def callback_phase # rubocop:disable AbcSize, CyclomaticComplexity, MethodLength, PerceivedComplexity\n super\n @env['omniauth.params'] = decode_jwt_state(session['omniauth.state'])\n end",
"def auth_process\n\t\tif @auth_file.authorization.nil?\n \t\t\tmake_auth\n\t\telse\n\t\t\t@client.authorization = @auth_file.authorization\n\t\tend\n\tend",
"def callback_phase\n options.client_options[:access_token_path] = \"/oauth/qzoneoauth_access_token?oauth_vericode=#{request['oauth_vericode'] }\" if request['oauth_vericode']\n super\n end",
"def add_credentials!\n @accessor.auth_manager.add_credentials(self)\n end",
"def oauth\n session[:return_to_url] = params[:redirect_after_login] if params[:redirect_after_login]\n login_at(auth_params[:provider])\n end",
"def authenticate\n if user_has_session_cookie? and user_in_database?\n Thread.current['uid'] = session[:uid]\n else\n unless authentication_in_progress?\n redirect '/auth/google_oauth2', 303\n end\n end\n end",
"def after_authenticate(auth_token)\n log :info, 'after_authenticate'\n log :info, \"after_authenticate, auth_token: #{auth_token.inspect}\"\n\n auth_result = Auth::Result.new\n\n # Grab the info we need from OmniAuth\n # We also may need to modify the EdX username to conform to Discourse's username\n # validations.\n omniauth_params = auth_token[:info]\n auth_result.username = build_discourse_username omniauth_params[:email].split('@').first\n auth_result.name = omniauth_params[:fullname]\n auth_result.email = omniauth_params[:email]\n auth_result.email_valid = auth_result.email.present?\n lti_uid = auth_token[:uid]\n auth_result.extra_data = omniauth_params.merge(lti_uid: lti_uid)\n log :info, \"after_authenticate, auth_result: #{auth_result.inspect}\"\n log :warn, \"roles: #{omniauth_params[:roles]}\"\n\n # Lookup or create a new User record, requiring that both email and username match.\n # Discourse's User model patches some Rails methods, so we use their\n # methods here rather than reaching into details of how these fields are stored in the DB.\n # This appears related to changes in https://github.com/discourse/discourse/pull/4977\n user_by_email = User.find_by_email(auth_result.email.downcase)\n user_by_username = User.find_by_username(auth_result.username)\n\n ins_name = omniauth_params[:context_label] + 'I'\n\n log :warn, \"ins_group: #{ins_name}\"\n\n group_by_name = Group.find_by(name: omniauth_params[:context_label])\n ins_group_by_name = Group.find_by(name: ins_name)\n\n category_by_name = Category.find_by(name: omniauth_params[:context_label])\n\n both_matches_found = user_by_email.present? && user_by_username.present?\n no_matches_found = user_by_email.nil? && user_by_username.nil?\n no_groups = group_by_name.nil? && ins_group_by_name.nil?\n new_user = false\n\n if both_matches_found && user_by_email.id == user_by_username.id\n log :warn, \"after_authenticate, found user records by both username and email and they matched, using existing user...\"\n user = user_by_email\n elsif no_matches_found\n log :warn, \"after_authenticate, no matches found for email or username, creating user record for first-time user...\"\n user = User.new(email: auth_result.email.downcase, username: auth_result.username, name: auth_result.name,)\n user.staged = false\n user.active = true\n user.password = SecureRandom.hex(32)\n if omniauth_params[:roles].include? \"instructor\"\n user.trust_level = 4\n end\n user.save!\n user.reload\n new_user = true\n else\n log :warn, \"after_authenticate, found user records that did not match by username and email\"\n log :warn, \"after_authenticate, user_by_email: #{user_by_email.inspect}\"\n log :warn, \"after_authenticate, user_by_username: #{user_by_username.inspect}\"\n raise ::ActiveRecord::RecordInvalid('LTIAuthenticator: edge case for finding User records where username and email did not match, aborting...')\n end\n\n if group_by_name.nil?\n main_group = Group.new(name: omniauth_params[:context_label])\n main_group.visibility_level = 4\n main_group.save!\n main_group.reload\n end\n\n if ins_group_by_name.nil?\n ins_group = Group.new(name: ins_name)\n ins_group.visibility_level = 4\n ins_group.save!\n ins_group.reload\n end\n\n\n group_by_name = Group.find_by(name: omniauth_params[:context_label])\n ins_group_by_name = Group.find_by(name: ins_name)\n\n if category_by_name.nil?\n category = Category.new(name: omniauth_params[:context_label], slug: omniauth_params[:context_label], user_id: user.id)\n category.reviewable_by_group_id = ins_group_by_name.id\n category.read_restricted = true\n category.save!\n category.reload\n\n cat_group_main = CategoryGroup.new(category_id: category.id, group_id: group_by_name.id)\n cat_group_ins = CategoryGroup.new(category_id: category.id, group_id: ins_group_by_name.id)\n\n cat_group_main.save!\n cat_group_main.reload\n cat_group_ins.save!\n cat_group_ins.reload\n end\n\n\n if new_user\n if omniauth_params[:roles].include? \"instructor\"\n g_user = GroupUser.new(group_id: ins_group_by_name.id, user_id: user.id)\n g_user.owner = true\n g_user.save!\n g_user.reload\n end\n g_user = GroupUser.new(group_id: group_by_name.id, user_id: user.id)\n\n if omniauth_params[:roles].include? \"instructor\"\n g_user.owner = true\n end\n\n g_user.save!\n g_user.reload\n else\n if omniauth_params[:roles].include? \"instructor\"\n g_user_by_id = GroupUser.find_by(group_id: ins_group_by_name.id, user_id: user.id)\n\n if g_user_by_id.nil?\n g_user = GroupUser.new(group_id: ins_group_by_name.id, user_id: user.id)\n g_user.owner = true\n g_user.save!\n g_user.reload\n end\n end\n\n g_user_by_id = GroupUser.find_by(group_id: group_by_name.id, user_id: user.id)\n\n if g_user_by_id.nil?\n g_user = GroupUser.new(group_id: group_by_name.id, user_id: user.id)\n if omniauth_params[:roles].include? \"instructor\"\n g_user.owner = true\n end\n g_user.save!\n g_user.reload\n end\n end\n\n # Return a reference to the User record.\n auth_result.user = user\n log :info, \"after_authenticate, user: #{auth_result.user.inspect}\"\n\n # This isn't needed for authentication, it just tracks the unique EdX user ids\n # in a way we could look them up from the EdX username if we needed to.\n plugin_store_key = \"lti_usernam_#{auth_result.username}\"\n ::PluginStore.set('lti', plugin_store_key, auth_result.as_json)\n log :info, \"after_authenticate, PluginStore.set for auth_result: #{auth_result.as_json}\"\n\n auth_result\n end",
"def authenticate!\n # Do nothing yet\n end",
"def auth\n end",
"def auth\n end",
"def on_after_oauth2_connect(oauth2_user_attributes)\n if self.respond_to?(:after_oauth2_connect)\n self.send(:after_oauth2_connect, oauth2_user_attributes)\n end\n end",
"def user_authentication\n end",
"def authenticate!\n\n # mapping comes from devise base class, \"mapping.to\" is the class of the model\n # being used for authentication, typically the class \"User\". This is set by using\n # the `devise` class method in that model\n #byebug\n klass = mapping.to\n\n if request.headers['X-HC-FB-AUTH'].present?\n # the returned user object will be saved and serialised into the session\n\n decoded = Base64.decode64(request.headers['X-HC-FB-AUTH'])\n user_and_token = decoded.split(':')\n\n users = klass.includes(:identities).where(socify_identities: { uid: user_and_token[0], token: user_and_token[1], provider: \"facebook\"})\n begin\n if users.size == 1\n u = users.first\n identity = u.identities.find_by!(uid: user_and_token[0], token: user_and_token[1], provider: \"facebook\")\n if !identity.expires_at || (identity.expires_at && identity.expires_at > Time.now)\n success! u\n else\n fail! \"token expired\"\n end\n else\n fail! \"invalid uid and/or token\"\n end\n rescue\n fail!\n end\n end\n\n # if we wanted to stop other strategies from authenticating the user\n end",
"def authenticate!\n\n # mapping comes from devise base class, \"mapping.to\" is the class of the model\n # being used for authentication, typically the class \"User\". This is set by using\n # the `devise` class method in that model\n klass = mapping.to\n\n if request.headers['HTTP_X_MY_API'].present?\n # the returned user object will be saved and serialised into the session\n user = klass.find_or_initialize_by_email(request.headers['HTTP_X_MY_API'])\n success! user\n end\n\n # if we wanted to stop other strategies from authenticating the user\n end",
"def authenticate!\n session = DeviseTwitterAnywhere::Twitter::Session.new(cookies, params)\n\n if session.valid?\n klass = mapping.to\n user = klass.authenticate_twitter_user session.uid\n\n if user.blank? && klass.twitter_auto_create_account?\n user = klass.new\n user.twitter_session = session\n user.set_twitter_credentials_from_session!\n user.run_callbacks :create_by_twitter do\n begin\n user.save(:validate => klass.run_validations_when_creating_twitter_user)\n rescue ActiveRecord::RecordNotUnique\n fail!(:not_unique_user_on_creation) and return\n end\n end\n\n if klass.run_validations_when_creating_twitter_user && !user.persisted?\n fail!(:invalid_twitter_user_on_creation) and return\n end\n end\n\n if user.present? && user.persisted?\n user.twitter_session = session\n user.run_callbacks :connecting_to_twitter do\n success!(user) and return\n end\n else\n fail!(:twitter_user_not_found_locally) and return\n end\n else\n fail!(:invalid_twitter_session) and return\n end\n end",
"def after_successful_token_authentication\n set_driver\n end",
"def authenticate\n\n # This suppresses the log in suggestion on subsequent\n # request if the user clicks \"No\"\n if params[:stay_anonymous]\n cookies[:shunt_hint] = 'anonymous'\n logger.info \"Suppressing log in suggestion\"\n redirect_to url_for(params.except!(:stay_anonymous))\n end\n\n if params[:public]\n cookies[:shunt_hint] = 'public'\n redirect_to url_for(params.except!(:public))\n end\n\n if should_force_authentication\n force_authentication\n end\n end",
"def complete_session_authentication\n raise 'No authentication in session' unless session[:pending_authentication_id]\n @user = User.new(params[:user])\n if @user.save\n @user.authentications << Authentication.find(session[:pending_authentication_id])\n session[:pending_authentication_id] = nil #nix the id in session after successful assoc\n sign_in_and_redirect_back_or_default(@user, user_path(@user))\n else\n render :action=>\"incomplete_authorization\"\n end\n end",
"def http_auth_login\n # FIXME: Implement\n end",
"def auth_trap_state\n super\n end",
"def callback\n\t\tself.twitagent.exchange_request_for_access_token( session[:request_token], session[:request_token_secret], params[:oauth_verifier] )\n\t\t\n\t\tuser_info = self.twitagent.verify_credentials\n\t\t\n\t\t#raise OauthSystem::RequestError unless user_info['id'] && user_info['screen_name'] && user_info['profile_image_url']\n\t\t\n\t\t# We have an authorized user, save the information to the database.\n\t\t@user = User.find_by_screen_name(user_info['screen_name'])\n\t\tif @user\n\t\t\t@user.token = self.twitagent.access_token.token\n\t\t\t@user.secret = self.twitagent.access_token.secret\n\t\t\t@user.profile_image_url = user_info['profile_image_url']\n\t\telse\n\t\t\t@user= User.new({ \n\t\t\t\t:twitter_id => user_info['id'],\n\t\t\t\t:screen_name => user_info['screen_name'],\n\t\t\t\t:token => self.twitagent.access_token.token,\n\t\t\t\t:secret => self.twitagent.access_token.secret,\n\t\t\t\t:profile_image_url => user_info['profile_image_url'] })\n\t\tend\n\t\tif @user.save!\n\t\t\tself.current_user = @user\n\t\telse\n\t\t\traise OauthSystem::RequestError\n\t\tend\n\t\t# Redirect to the show page\n\t\tredirect_to user_path(@user)\n\t\t\n\trescue\n\t\t# The user might have rejected this application. Or there was some other error during the request.\n\t\tRAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n\t\tflash[:error] = \"Twitter API failure (account login)\"\n\t\tredirect_to root_url\n\tend",
"def after_login(&block)\n add_callback(:login, block)\n end",
"def authenticate(request, realm, &password_procedure); end",
"def authenticate_user!\n redirect_to '/auth/sweetsuite' unless access_token && current_user\n end",
"def when_auth &block # :yields: abs_url, realm\n @get_auth_details = block\n end",
"def grant_authorization\n create_verification_code if authorized?\n redirect_back\n end",
"def after(strategy)\n order = Merb::Authentication.default_strategy_order\n order.delete(self)\n index = order.index(strategy)\n index == order.size ? order << self : order.insert(index + 1, self)\n end",
"def authentication_profile\n super\n end",
"def default_oauth_callback(&on_fail)\n auth = request.env['omniauth.auth']\n\n @user = User.send(\"find_for_#{auth.provider.to_s}_oauth\", auth, current_user)\n unless @user.persisted?\n # save oauth data if user creation failed\n session[\"devise.#{auth.provider.to_s}_data\"] = auth.except(:extra)\n end\n auth.fail_redirect ||= new_user_registration_path\n\n unless handle_oauth_login\n if on_fail\n yield auth\n else\n default_oauth_fail\n end\n end\n end",
"def request_login\n _store_request_information 'login'\n\n redirect_to user_omniauth_authorize_path(params[:provider])\n end",
"def authenticate\n unless session[:user_id]\n session['return_url'] = request.url\n logger.debug request.url\n # Recreate user abilities on each login\n @current_ability = nil\n redirect_to polymorphic_url(:new_user_session)\n end\n end",
"def authenticate_user!(*args)\n if request.get? && !logged_in?\n session[:return_to] = request.fullpath\n session[:return_to_for_new_user] = request.fullpath\n end\n super\n end",
"def auth_response\n @auth_response ||= self.authenticate\n end",
"def after_ip_authentication\n end",
"def on_after_oauth2_connect(oauth2_user_attributes)\n \n if self.respond_to?(:after_oauth2_auto_create)\n self.send(:after_oauth2_auto_create, oauth2_user_attributes) \n end\n on_after_oauth2_connect\n end",
"def redirect_after_signup &blk\n self.lwt_authentication_system_options[:redirect_after_signup] = blk\n end",
"def auth_callback\n current_user\n omniauth_origin = session[:omniauth_origin]\n session.delete(:omniauth_origin)\n redirect_to omniauth_origin || '/'\n end",
"def callback_call\n setup_phase\n log :debug, 'Callback phase initiated.'\n @env['omniauth.origin'] = session.delete('omniauth.origin')\n @env['omniauth.origin'] = nil if env['omniauth.origin'] == ''\n @env['omniauth.params'] = session.delete('omniauth.params') || {}\n OmniAuth.config.before_callback_phase.call(@env) if OmniAuth.config.before_callback_phase\n callback_phase\n end",
"def authenticate\n end",
"def callback_phase\n # Prep the urls using the account ID.\n # TODO: Could we use the :setup option and a Proc\n # to handle this rather than call here? \n set_omniauth_zendesk_urls\n\n # Continue the request as usual.\n super\n end",
"def authenticate_user!\n if current_user.id != @user.id\n redirect_back(fallback_location: root_path)\n end\n end",
"def authorize!\n redirect to(\"/login?to=#{request.path}\", true, false) unless has_auth?\n end",
"def auth_user\n redirect_to new_user_session_url unless user_signed_in?\n end",
"def authenticate_user!\n unless logged_in?\n store_location\n redirect_to log_in_path\n end\n end",
"def shibboleth_passive_login\n # This is the original action called\n # before checking if we were logged in\n origin = params[:origin] if params[:origin]\n # If there is a session, authenticate the user\n if shib_session_exists?\n redirect_to user_nyu_shibboleth_omniauth_authorize_path(institute: current_institution.code, auth_type: :nyu, origin: origin)\n # If there is no session, redirect back to the last action\n else\n redirect_to origin || root_url\n end\n end",
"def before_method(request, response)\n if @current_principal\n # We already have authentication information. This means that the\n # event has already fired earlier, and is now likely fired for a\n # sub-request.\n #\n # We don't want to authenticate users twice, so we simply don't do\n # anything here. See Issue #700 for additional reasoning.\n #\n # This is not a perfect solution, but will be fixed once the\n # \"currently authenticated principal\" is information that's not\n # not associated with the plugin, but rather per-request.\n #\n # See issue #580 for more information about that.\n return nil\n end\n\n if @backends.empty?\n fail Dav::Exception, 'No authentication backends were configured on this server.'\n end\n\n reasons = []\n @backends.each do |backend|\n result = backend.check(request, response)\n\n if !result.is_a?(Array) ||\n result.size != 2 ||\n !(result[0].is_a?(TrueClass) || result[0].is_a?(FalseClass)) ||\n !result[1].is_a?(String)\n fail Dav::Exception, 'The authentication backend did not return a correct value from the check method.'\n end\n\n if result[0]\n @current_principal = result[1]\n # Exit early\n return nil\n end\n reasons << result[1]\n end\n\n # If we got here, it means that no authentication backend was\n # successful in authenticating the user.\n @current_principal = nil\n\n @backends.each do |backend|\n backend.challenge(request, response)\n end\n fail Exception::NotAuthenticated, reasons.join(', ')\n end",
"def request_phase\n p session['omniauth.state']\n OmniAuth::Strategies::Dailycred::AUTH_PARAMS.each do |param|\n val = session['omniauth.params'][param]\n if val && !val.empty?\n options[:authorize_params] ||= {}\n options[:authorize_params].merge!(param => val)\n end\n end\n old_request_phase\n end",
"def authenticated?; super; end",
"def after_create_account(user, auth)\n # not required\n end",
"def recognize_user\n rack_response = oauth2_authorizer.call(request.env)\n redirect_to rack_response.last.header['Location']\n end",
"def auth_setup\n service = Person::OmniauthService::SetupPhase.new(community: @current_community, params: params, request: request)\n service.run\n render :plain => \"Setup complete.\", :status => 404 #This notifies the ominauth to continue\n end",
"def login_required\n authenticate_user! \n end",
"def request_phase\n # Stash the account into the session so that we\n # can trieve it during the callback.\n session['omniauth.zendesk.account'] = fetch_zendesk_account\n\n # Prep the urls using the account ID.\n # TODO: Could we use the :setup option and a Proc\n # to handle this rather than call here?\n set_omniauth_zendesk_urls\n\n # Continue the request as usual.\n super\n end",
"def auth\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"params=#{params}\",\n \"\" ] if browse_everything_controller_debug_verbose\n # params contains the access code with with the key :code\n provider_session.token = provider.connect(params, provider_session.data, connector_response_url_options)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider_session.token=#{provider_session.token}\",\n \"\" ] if browse_everything_controller_debug_verbose\n provider_session.token\n end",
"def after_login!(user, username = '', password = '', options = {})\n sorcery_config.after_login.each do |callback|\n send(callback, user, username, password, options)\n end\n end",
"def redirect_after_login &blk\n self.lwt_authentication_system_options[:redirect_after_login] = blk\n end",
"def callback\n\n\n # Access the authentication hash for omniauth\n data = request.env['omniauth.auth']\n\n # Temporary for testing!\n render json: data.to_json\n\n\n # Access the authentication hash for omniauth\n # data = request.env['omniauth.auth']\n\n # microsoft_email_address = data.dig(:extra, :raw_info, :mail) || data.dig(:extra, :raw_info, :userPrincipalName)\n\n # if user_account = UserAccount.find_by(email: microsoft_email_address)\n # session[:user_account_id] = user_account.id\n # if session[:previously_requested_page]\n # last_page = session[:previously_requested_page]\n # session.delete(:previously_requested_page)\n # redirect_to last_page\n # else\n # redirect_to root_path\n # end\n # else\n # redirect_to new_session_path, notice: \"An account could not be found for #{microsoft_email_address}.\"\n # end\n end",
"def force_auth\n\t\tlogger.debug \" Callback: force_auth\"\n\t\tsession[:last_ts] = nil\n\t\tCASClient::Frameworks::Rails::Filter.filter self unless @current_user\n\tend",
"def authenticate\n authenticate_token || render_unauthorized\n end",
"def authentication_flow(params)\n if params.key?(:cognito_session_id)\n resp = respond_to_challenge(params)\n else\n resp = initiate_auth(email: params[:email], password: params[:password])\n end\n return process_response(cognito_response: resp, params: params) if resp.present?\n\n raise AuthenticationBackendException, \"No Response Back from Authentication Service to process\"\n end",
"def authenticate\n authenticate_token || render_unauthorized\n end",
"def oauth\n login_at(auth_params[:provider])\n end",
"def oauth\n login_at(auth_params[:provider])\n end",
"def pre_authorize_cb; end",
"def before_save\n if self.access_token.blank?\n self.authenticated = Twitter::Client.new.authenticate?(self.username, self.password)\n end\n \n return true\n end",
"def reauthenticate \n\t\t\tself.login(@email, @password)\n\t\tend",
"def authenticate(_)\n super(session_params)\n end",
"def authorize\n params[:access_token] ||= params[:oauth_token]\n super\n end"
] |
[
"0.7168384",
"0.7061061",
"0.673652",
"0.673652",
"0.66804063",
"0.6413441",
"0.6320074",
"0.6299635",
"0.6280201",
"0.62683916",
"0.6208505",
"0.62056977",
"0.61840904",
"0.618167",
"0.61622494",
"0.6151446",
"0.611958",
"0.61117077",
"0.61112285",
"0.60952693",
"0.605659",
"0.6045216",
"0.5966742",
"0.5964373",
"0.5909708",
"0.5888456",
"0.5882437",
"0.58655816",
"0.5855875",
"0.5850197",
"0.58190554",
"0.5797001",
"0.57861984",
"0.5767375",
"0.5763803",
"0.5758211",
"0.5756383",
"0.5756166",
"0.5744888",
"0.5741261",
"0.5740846",
"0.5740846",
"0.57377434",
"0.5737168",
"0.5728861",
"0.5717476",
"0.57092917",
"0.5703971",
"0.56873834",
"0.56836826",
"0.56799495",
"0.56733954",
"0.5669094",
"0.56610376",
"0.5660441",
"0.565903",
"0.56508523",
"0.56484455",
"0.5648176",
"0.5646575",
"0.56425184",
"0.56251943",
"0.5623102",
"0.55983835",
"0.55954707",
"0.5576679",
"0.55668026",
"0.55615413",
"0.55606246",
"0.5558218",
"0.5558068",
"0.55577976",
"0.55517083",
"0.55165386",
"0.5501914",
"0.5486474",
"0.5481721",
"0.54778934",
"0.54775596",
"0.54663396",
"0.5465721",
"0.54651326",
"0.5464477",
"0.5457199",
"0.5456247",
"0.5450983",
"0.5448156",
"0.5437188",
"0.5433867",
"0.54238796",
"0.54230994",
"0.54223645",
"0.5420774",
"0.5418329",
"0.5418329",
"0.541084",
"0.54099363",
"0.54045767",
"0.54041237",
"0.53991723"
] |
0.55153674
|
74
|
Constructs a onetimeuse authorize_endpoint. This method will use a new nonce on each invocation.
|
def authorize_endpoint_url
uri = URI(openid_config['authorization_endpoint'])
uri.query = URI.encode_www_form(client_id: client_id,
redirect_uri: callback_url,
response_mode: response_mode,
response_type: response_type,
nonce: new_nonce)
uri.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def authorize_endpoint(params = nil)\n params = params.reject { |_, v| v.nil? } if params.respond_to? :select\n if params.nil? || params.empty?\n URI::HTTPS.build(host: @host, path: '/' + @tenant + AUTHORIZE_PATH)\n else\n URI::HTTPS.build(host: @host,\n path: '/' + @tenant + AUTHORIZE_PATH,\n query: URI.encode_www_form(params))\n end\n end",
"def nonce=(_arg0); end",
"def authorize_token(attribs={})\n params = parse_request_params(attribs)\n parsed, creds = request(:post, resource_path+'/authorize', params)\n self.class.factory(parsed, creds)\n end",
"def authorize_endpoint(allow_approval = false)\n \n Rack::OAuth2::Server::Authorize.new do |req, res|\n @client = Oauth2Providable::Client.find_by_identifier(req.client_id) || req.bad_request!\n res.redirect_uri = @redirect_uri = req.verify_redirect_uri!(@client.redirect_uri)\n \n if allow_approval\n if params[:approve].present? && req.response_type == :code\n authorization_code = current_user.authorization_codes.create!(\n :client => @client,\n :account_sid => request.env['rack.session']['session_id'])\n res.code = authorization_code.token\n res.approve!\n else\n req.access_denied!\n end\n else\n @response_type = req.response_type\n end\n \n end\n \n end",
"def authorize(attribs={})\n params = parse_request_params(attribs)\n parsed, creds = request(:post, resource_path+'/authorize', params)\n factory(parsed, creds)\n end",
"def create_authorization\n @authorization = AwsRequestAuthorization.new.tap do |authorization|\n authorization.url = url\n authorization.method = method\n authorization.query = query\n authorization.body = form_body\n authorization.region = region\n authorization.service = service\n authorization.credentials = credentials\n authorization.headers = headers\n end\n end",
"def authorize\n end",
"def authorize\n end",
"def authorize_url(attribs={})\n self.class.authorize_url id, attribs.reverse_merge(credentials: api_creds)\n end",
"def authorize(params = {})\n open_url authorize_url(params)\n end",
"def generate_authorization_token\n \t# create the token that contains the necessary elements to authorize the user\t\n \t# using a nested array because the alphabetical order must be maintained\n \ttoken = [['credentials', self.user.to_credential_string,], ['identity', self.user.to_identity_string], ['time', Time.now.to_i.to_s]]\n \tencoded_parms = token.collect {|pair| pair[1] = CGI.escape(pair[1]); pair.join('=')}.join('&')\n\n digest = Digest::SHA2.new\n digest.update(encoded_parms)\n\n hmac = HMAC::SHA256.new(self.options[:shared_secret])\n hmac.update(encoded_parms)\n\n # add the hashed digital signature to the end of the query parameters\n encoded_parms += \"&signature=#{hmac.hexdigest}\"\n end",
"def authorize\n credentialsFile = FILE_POSTFIX\n\n if File.exist? credentialsFile\n File.open(credentialsFile, 'r') do |file|\n credentials = JSON.load(file)\n @authorization.access_token = credentials['access_token']\n @authorization.client_id = credentials['client_id']\n @authorization.client_secret = credentials['client_secret']\n @authorization.refresh_token = credentials['refresh_token']\n @authorization.expires_in = (Time.parse(credentials['token_expiry']) - Time.now).ceil\n if @authorization.expired?\n @authorization.fetch_access_token!\n save(credentialsFile)\n end\n end\n else\n auth = @authorization\n url = @authorization.authorization_uri().to_s\n server = Thin::Server.new('0.0.0.0', 8081) do\n run lambda { |env|\n # Exchange the auth code & quit\n req = Rack::Request.new(env)\n auth.code = req['code']\n auth.fetch_access_token!\n server.stop()\n [200, {'Content-Type' => 'text/html'}, RESPONSE_HTML]\n }\n end\n\n Launchy.open(url)\n server.start()\n\n save(credentialsFile)\n end\n\n return @authorization\n end",
"def authorize_url\n request_token.authorize_url\n end",
"def sign_request(options, authorize = true)\n options.merge!(:auth_token => self.auth.token(false).to_s, :api_key => @api_key) if authorize and self.auth.token(false)\n options.delete(:api_sig)\n options.merge!(:api_sig => Digest::MD5.hexdigest(@api_secret + options.to_a.sort_by{|k| k[0].to_s}.flatten.join)) if @api_secret\n end",
"def initialize(user, connection, client_nonce: nil)\n super\n @client_nonce = client_nonce || SecureRandom.base64\n end",
"def auth_uri(nonce)\n client.authorization_uri(\n scope: %i[user_group_path email profile esdl-mapeditor microprofile-jwt user_group],\n state: nonce,\n nonce: nonce\n )\n end",
"def request_phase\n redirect authorize_endpoint_url\n end",
"def init\n\t\tuser_credentials = {\n\t\t\t:access_token => access_token,\n\t\t\t:refresh_token => refresh_token,\n\t\t\t:expires_at => Time.now + expires_in\n\t\t}\n\n client_id = '694fc2f618facf30b3b41726ee6d0ac04c650669ca3d114cb0bae4223cecade3'\n client_secret = '3e7cfd07d829211ac50dd6486fe677ca76e965f25ad7d68e67e845e0d4a213e7'\n\t\tCoinbase::OAuthClient.new(client_id, client_secret, user_credentials)\n\tend",
"def content_security_policy_nonce_generator=(_arg0); end",
"def content_security_policy_nonce_generator=(_arg0); end",
"def initialize(config=OpenAuth2::Config.new)\n @config = config\n @endpoint = endpoint\n end",
"def authorize_url(params=nil)\n connection.build_url(options[:authorize_url], params).to_s\n end",
"def initialize access_key_id, secret_access_key, opts={}\n opts = DEFAULTS.merge opts\n @sts = SecurityTokenService.new access_key_id, secret_access_key\n @endpoint = opts[:endpoint]\n @debug = opts[:debug]\n end",
"def authorize\n client_id = create_client_id\n token_store = create_token_store\n\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI\n )\n Rails.logger.debug do\n 'Open the following URL in the browser and enter the ' \\\n 'resulting code after authorization'\n end\n Rails.logger.debug url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id:, code:, base_url: OOB_URI\n )\n end\n credentials\n end",
"def create_authorization(opts = {})\n client = opts[:client] || create_pw_client(opts)\n\n return create_authorization_token(client, opts[:two_factor])\n end",
"def create_token_for(client, scope, identity = nil, expires = nil)\n expires_at = Time.now.to_i + expires if expires && expires != 0\n token = { :_id=>Server.secure_random, :scope=>scope,\n :client_id=>client.id, :created_at=>Time.now.to_i,\n :expires_at=>expires_at, :revoked=>nil }\n token[:identity] = identity if identity\n collection.insert token\n Client.collection.update({ :_id=>client.id }, { :$inc=>{ :tokens_granted=>1 } })\n Server.new_instance self, token\n end",
"def nonce; end",
"def authorize_url(auth_provider_id, attribs={})\n params = parse_request_params(attribs)\n parsed, creds = request(:get, resource_path+\"/#{CGI.escape auth_provider_id}/authorize\", params)\n raise QueryError, parsed[:errors] if parsed[:errors].any?\n factory(parsed, creds)\n end",
"def authorize\n if params[:response_type].nil?\n params[:response_type] = \"code\"\n end\n @authorizer = OAuth::Provider::Authorizer.new current_user, true, params\n client_application = ClientApplication.find_by_key(params[:client_id])\n statsd = StatsManager.new\n statsd.feedAuthorizeMetric(current_user, client_application)\n #If this is an auto authentication transparent for end user\n redirect_to @authorizer.redirect_uri\n end",
"def initialize\n # Create the configuration object\n @config = Configuration.new Client.configure\n\n # Yield the configuration if needed\n yield @config if block_given?\n\n # Create credentials\n credentials = @config.credentials\n # Use self-signed JWT if the endpoint is unchanged from default,\n # but only if the default endpoint does not have a region prefix.\n enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&\n !@config.endpoint.split(\".\").first.include?(\"-\")\n credentials ||= Credentials.default scope: @config.scope,\n enable_self_signed_jwt: enable_self_signed_jwt\n if credentials.is_a?(::String) || credentials.is_a?(::Hash)\n credentials = Credentials.new credentials, scope: @config.scope\n end\n\n @quota_project_id = @config.quota_project\n @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id\n\n @identity_aware_proxy_o_auth_service_stub = ::Google::Cloud::Iap::V1::IdentityAwareProxyOAuthService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials\n end",
"def authorize_resource(*args); end",
"def create\n user = validate_user_token\n current_account = find_or_create_parti_account user\n endpoint = AuthorizationEndpoint.new current_account\n rack_response = endpoint.call request.env\n respond_as_rack_app(*rack_response)\n end",
"def initialize address, lifetime\n #@identity = identity\n @address = address\n #@service = nil\n @expiry = Time.now + 0.001 * lifetime\n end",
"def new\n @annonce = Annonce.new\n end",
"def initialize(ctoken, csecret, options={})\n @ctoken, @csecret, @consumer_options = ctoken, csecret, {}\n\n # if options[:sign_in]\n # @consumer_options[:authorize_path] = '/oauth/authenticate'\n # end\n end",
"def authorize\n authorizer = Google::Auth::ServiceAccountCredentials.make_creds(\n json_key_io: File.open(CREDENTIALS_PATH),\n scope: SCOPE)\n\n authorizer\n end",
"def try_authorize\n authorize = Authorize.new(config, settings)\n authorize.configure\n end",
"def generate_token(client_nonce)\n generation_time = time_to_block(Time.now.to_i)\n encryptor(client_nonce).encode(generation_time, 0)\n end",
"def authorize_url(ticket = nil)\n ticket = self.ticket unless ticket\n \"#{ api.base_url }/auth/#{ ticket }\"\n end",
"def authorization_request(tid)\n authorization_request = Cielo::AuthorizationRequest.new\n response = send_request(authorization_request.serialize(tid,@affiliation, @affiliation_key))\n end",
"def authorize\n params[:access_token] ||= params[:oauth_token]\n super\n end",
"def authorize_url\n client.web_server.authorize_url( :redirect_uri => callback_url )\n end",
"def initialize\n super('OAuth')\n @config = nil # common config\n @auth = {} # configs for each site\n @nonce_count = 0\n @signature_handler = {\n 'HMAC-SHA1' => method(:sign_hmac_sha1)\n }\n end",
"def authorize_url\n @connection.authorize_url\n end",
"def oauth\n Auth.new(params[:uid], params[:oauth_token], action_name)\n end",
"def perform(secret, endpoint, _args = {})\n @client = ::OpenNebula::Client.new(secret, endpoint)\n end",
"def authorize(options = {})\r\n # full_res_file_access = ['10.128.99.55','10.128.1.167','10.224.6.10','10.128.99.167','10.128.98.50','10.224.6.26','10.224.6.35','172.16.1.94', '66.234.38.35']\r\n #'65.88.88.115'\r\n # logger = Java::edu.illinois.library.cantaloupe.script.Logger\r\n # logger.debug(\"CONTEXT HASH: #{context}\")\r\n # logger.debug(\"REQUEST URI: #{context['request_uri']}\")\r\n if context['request_uri'].include?(\"info.json\") \r\n true\r\n else \r\n type = is_region?()? \"full_res\" : derivative_type(context['resulting_size'])\r\n # logger.debug(\"TYPE: #{type}\")\r\n rights = get_rights(context['identifier'], context['client_ip'])\r\n allowed = returns_rights?(rights) && is_not_restricted?(rights, type)\r\n # logger.debug(\"ALLOWED? #{allowed}\")\r\n allowed\r\n end\r\n end",
"def nonce_state\n super\n end",
"def create\n super\n \n if @access_token.client.uses_account_sid\n # Never expire this token. It will be expired when the user explicitly\n # ends their session (by logging out), and possibly after a configurable\n # amount of time, if the provider is using expiration scheduling\n # (see the sessions:expire rake task).\n @access_token.expires_at = Time.mktime(2100, 12, 31)\n end\n \n authorization_code = Oauth2Providable::AuthorizationCode.find_by_token(params[:code])\n @access_token.account_sid = authorization_code.account_sid\n @access_token.client_sid = params[:client_sid]\n @access_token.save\n end",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n credentials = authorizer.get_credentials('default')\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n\n server = WEBrick::HTTPServer.new(Port: 3000)\n server.mount_proc('/oauth2callback') do |req, res|\n code = req.query['code']\n credentials = authorizer.get_and_store_credentials_from_code(user_id: 'default', code: code, base_url: OOB_URI)\n res.body = 'Authorization successful. You can close this window and return to the terminal.'\n server.shutdown\n end\n\n warn('Open the following URL in your browser and authorize the app:')\n warn(url)\n server.start\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n\n # changed SCOPE to SCOPES to pass in multiple OAUTH scopes\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPES, token_store)\n\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\n end",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n \n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\n end",
"def build_authorization_link\n @oauth.auth_code.authorize_url(\n redirect_uri: @redirect_uri,\n scope: 'read_write',\n initial_view: 'signup'\n )\n end",
"def initialize(from, to, client_secret)\n @from = from\n @to = to\n @client_secret = client_secret\n @access_token = fetch_access_token\n end",
"def initialize(certname, reusable=false, validfor=7200, requester, secret)\n # set up logging\n @log = Logging.logger[self.class]\n @log.debug \"initializing #{self.class.name}\"\n\n @validfor = validfor\n @certname = certname\n @reusable = reusable\n @requester = requester\n @secret = secret\n @uuid = SecureRandom.uuid # UUID is needed to allow token regeneration with the same settings\n @validto = Time.now.to_i + self.validfor\n end",
"def initialize(options={})\n @next_url = options[:callback_url] \n @sess = true\n @secure = SECURE_AUTHSUB_ENABLED # set secure = true for signed AuthSub requests\n if options[:auth_token]\n @client.authsub_token = options[:auth_token] \n # Set private key when upgrading token to session\n @client.authsub_private_key = private_key if @secure\n end\n end",
"def create_activation_digest\n #create the token and digest here\n self.activation_token = Doctor.new_token\n self.activation_digest = Doctor.digest(activation_token)\n end",
"def initialize(code: nil, login: nil, password: nil)\n # code (arg) - exchange for access token\n @authenticator = if code.present?\n Oauth.new(code)\n else\n Standard.new(login, password)\n end\n\n end",
"def authorize(options = {})\n @post = ActiveMerchant::PostData.new\n\n self.add_receivers(options)\n self.add_customer(options)\n self.add_meta(options)\n self.add_callbacks(options)\n\n response = commit(:authorize)\n @token = response.success? ? response.token : nil\n response\n end",
"def authorize\n\tclient_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n\ttoken_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n\tauthorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n\tuser_id = 'default'\n\n\tcredentials = authorizer.get_credentials(user_id)\n\treturn credentials unless credentials.nil?\n\n\turl = authorizer.get_authorization_url(base_url: OOB_URI)\n\tputs 'Open the following URL in the browser and enter the ' \\\n\t\t \"resulting code after authorization:\\n#{url}\"\n\tcode = gets\n\n\treturn authorizer.get_and_store_credentials_from_code(\n\t\tbase_url: OOB_URI,\n\t\tuser_id: user_id,\n\t\tcode: code,\n\t)\n\nend",
"def authenticate\n Access.new(\n 'access_token' => access_token,\n 'token_type' => token_type,\n 'expires_in' => 1 << (1.size * 8 - 2) - 1 # Max int value\n )\n end",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def create_2f_authorization(client)\n two_factor = Configuration.ask_for_two_factor\n\n create_authorization_token(client, two_factor)\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the resulting code after authorization:\"\n puts url\n puts \"\"\n puts \"paste code here:\"\n code = gets\n\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def initialize()\n @tenantId = MyAzure.get_tenant_id\n @clientId = MyAzure.get_client_id\n @clientSecret = MyAzure.get_client_secret\n \n # Generate bearer token.\n @bearerToken = auth_bearer_aad\n \n end",
"def authorize_url(redirect_url, state=nil)\n params = {:redirect_uri => redirect_url}\n params[:state] = state if state\n client.auth_code.authorize_url(params).gsub(/api-ssl\\./,'')\n end",
"def authorize\n\tFileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n\tclient_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n\ttoken_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n\tauthorizer = Google::Auth::UserAuthorizer.new(\n\t\tclient_id, SCOPE, token_store)\n\tuser_id = 'default'\n\tcredentials = authorizer.get_credentials(user_id)\n\tif credentials.nil?\n\t\turl = authorizer.get_authorization_url(\n\t\t\tbase_url: OOB_URI)\n\t\tputs \"Open the following URL in the browser and enter the \" +\n\t\t\"resulting code after authorization\"\n\t\tputs url\n\t\tcode = STDIN.gets\n\t\tcredentials = authorizer.get_and_store_credentials_from_code(\n\t\t\tuser_id: user_id, code: code, base_url: OOB_URI)\n\tend\n\tcredentials\nend",
"def initialize(ctoken, csecret, options={})\n @ctoken, @csecret, @consumer_options = ctoken, csecret, {}\n @api_endpoint = options[:api_endpoint] || 'http://api.teambox.com'\n @signing_endpoint = options[:signing_endpoint] || 'http://api.teambox.com'\n if options[:sign_in]\n @consumer_options[:authorize_path] = '/oauth/authenticate'\n end\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI,\n )\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(\n client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(\n base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def initialize(options = {:retry_auth => true}) \n @authuser = options[:username] || (raise Exception::MissingArgument, \"Must supply a :username\")\n @authkey = options[:api_key] || (raise Exception::MissingArgument, \"Must supply an :api_key\")\n @auth_url = options[:auth_url] || (raise Exception::MissingArgument, \"Must supply an :auth_url\")\n @authtenant = options[:authtenant] || @authuser\n @auth_method = options[:auth_method] || \"password\"\n @service_name = options[:service_name] || nil\n @service_type = options[:service_type] || \"compute\"\n @region = options[:region] || @region = nil\n @is_debug = options[:is_debug]\n\n auth_uri=nil\n begin\n auth_uri=URI.parse(@auth_url)\n rescue Exception => e\n raise Exception::InvalidArgument, \"Invalid :auth_url parameter: #{e.message}\"\n end\n raise Exception::InvalidArgument, \"Invalid :auth_url parameter.\" if auth_uri.nil? or auth_uri.host.nil?\n @auth_host = auth_uri.host\n @auth_port = auth_uri.port\n @auth_scheme = auth_uri.scheme\n @auth_path = auth_uri.path\n @retry_auth = options[:retry_auth]\n @proxy_host = options[:proxy_host]\n @proxy_port = options[:proxy_port]\n @authok = false\n @http = {}\n OpenStack::Compute::Authentication.init(self)\n end",
"def authorize_url(params = {})\n super\n .tap { |result| __ext_debug(\"--> #{result.inspect}\") }\n end",
"def create_token\n client_requested_expires_in = server.jwt['exp'].to_i - server.jwt['iat'].to_i\n server_expires_in = Authorization::Token.access_token_expires_in(configuration, client)\n if server_expires_in\n expires_in = (client_requested_expires_in > 0 && client_requested_expires_in <= server_expires_in) ? client_requested_expires_in : server_expires_in\n else\n expires_in = nil\n end\n @access_token = AccessToken.find_or_create_for(application: client.application, resource_owner: resource_owner, scopes: scopes, expires_in: expires_in, use_refresh_token: configuration.refresh_token_enabled?)\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts \"Open the following URL in the browser and enter the \" +\n \"resulting code after authorization\"\n puts url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code( user_id: user_id, code: code, base_url: OOB_URI)\n end\n credentials\nend",
"def initialize(client_id=nil, client_secret=nil, callback_url=nil, *args)\n opts = (args.last.is_a?(Hash) ? args.last : {}).with_indifferent_access\n\n opts.delete_if { |k, v| v.nil? }.reverse_merge!(default_tout_configuration)\n\n @client_id = client_id\n @client_secret = client_secret\n @access_token = opts[:access_token]\n @callback_url = callback_url\n @uri_scheme = opts[:uri_scheme]\n @uri_host = opts[:uri_host]\n @uri_port = opts[:uri_port]\n @uri_base_path = opts[:uri_base_path]\n @uri_version = opts[:uri_version]\n @auth_site = opts[:auth_site]\n @authorize_url = opts[:authorize_url]\n @token_url = opts[:token_url]\n @email = opts[:email]\n @password = opts[:password]\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n 'resulting code after authorization:\\n' + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize_url\n client = OAuth2::Client.new(client_id, client_secret, :site => oauth_url)\n client.auth_code.authorize_url(:redirect_uri => redirect_uri)\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CLIENT_SECRETS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: CREDENTIALS_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\n end",
"def authorize\n return credentials if credentials\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = $stdin.gets\n authorizer.get_and_store_credentials_from_code(\n user_id: user_id,\n code: code,\n base_url: OOB_URI\n )\n end",
"def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, token_store)\n user_id = 'default'\n credentials = authorizer.get_credentials(user_id)\n if credentials.nil?\n url = authorizer.get_authorization_url(base_url: OOB_URI)\n puts 'Open the following URL in the browser and enter the ' \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend",
"def authorize\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE, token_store\n user_id = \"default\"\n credentials = authorizer.get_credentials user_id\n if credentials.nil?\n url = authorizer.get_authorization_url base_url: OOB_URI\n puts \"Open the following URL in the browser and enter the \" \\\n \"resulting code after authorization:\\n\" + url\n code = gets\n credentials = authorizer.get_and_store_credentials_from_code(\n user_id: user_id, code: code, base_url: OOB_URI\n )\n end\n credentials\nend"
] |
[
"0.60011697",
"0.56872374",
"0.56861",
"0.56339306",
"0.56310654",
"0.5540841",
"0.55286527",
"0.55286527",
"0.5516922",
"0.5486267",
"0.5474361",
"0.54203796",
"0.53846484",
"0.53522766",
"0.5316563",
"0.5291127",
"0.5277887",
"0.5272494",
"0.52596784",
"0.52596784",
"0.52595854",
"0.5252343",
"0.5226212",
"0.52219504",
"0.52197397",
"0.52159375",
"0.5194969",
"0.51876754",
"0.5183129",
"0.5179021",
"0.51752317",
"0.516138",
"0.51512814",
"0.5143461",
"0.5138242",
"0.5133777",
"0.5129741",
"0.5127317",
"0.5125205",
"0.5113826",
"0.5095355",
"0.5089641",
"0.5074056",
"0.5070669",
"0.5068378",
"0.5066303",
"0.5056907",
"0.50561094",
"0.505597",
"0.5036616",
"0.50365686",
"0.50146264",
"0.50140893",
"0.50132614",
"0.501323",
"0.5012121",
"0.500797",
"0.50079674",
"0.50019366",
"0.49980435",
"0.49953526",
"0.49932367",
"0.4991393",
"0.49875945",
"0.4980297",
"0.498004",
"0.4977923",
"0.49746233",
"0.4965597",
"0.49652478",
"0.49645287",
"0.49645287",
"0.49645287",
"0.49645287",
"0.49645287",
"0.49645287",
"0.49630588",
"0.49630588",
"0.49630588",
"0.49630588",
"0.49630588",
"0.49630588",
"0.49630588",
"0.49630588",
"0.49630588",
"0.49630588",
"0.49630588",
"0.49615166",
"0.49598676",
"0.49597314",
"0.49589968",
"0.49586472",
"0.49576107",
"0.49576065",
"0.495366",
"0.49529678",
"0.49513945",
"0.49513537",
"0.49513537",
"0.49513537"
] |
0.5731563
|
1
|
The client id of the calling application. This must be configured where AD is installed as an OmniAuth strategy.
|
def client_id
return options.client_id if options.client_id
fail StandardError, 'No client_id specified in AzureAD configuration.'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_client_id\n @client_id\n end",
"def client_id\n @client_id\n end",
"def client_id\n @client_id\n end",
"def client_id\n return @client_id\n end",
"def client_id\n me.client.id\n end",
"def client_id\n me.client.id\n end",
"def client_id\n @client_id ||= Staccato.build_client_id\n end",
"def oauth2_client_id(value = nil)\n rw_config(:oauth2_client_id, value, '')\n end",
"def client_id\n request.headers['X-Client-ID']\n end",
"def client_id\n connection.id\n end",
"def default_client_id\n \"1B47512E-9743-11E2-8092-7F654762BE04\"\n end",
"def openid_client_id; end",
"def client_id\n ENV['KONTENA_CLIENT_ID'] || CLIENT_ID\n end",
"def client_guid\n client_id\n end",
"def oauth2_client_id\n is_auth_session? ? self.class.oauth2_client_id : session_class.oauth2_client_id\n end",
"def client_id\n ENV['AZURE_CLIENT_ID']\n end",
"def client\n query[\"client_id\"]\n end",
"def client_id\n ENV['WICKET_CLIENT_ID']\n end",
"def current_client_id\n @session[@session_key]\n end",
"def client_id; end",
"def clientid\n @obj['clientid']\n end",
"def consent_id\n Rails.configuration.x.true_layer.client_id\n end",
"def application_id\n get_key('ALGOLIA_APPLICATION_ID', 'application_id')\n end",
"def app_identifier\n return @app_identifier\n end",
"def app_id\n return @app_id\n end",
"def app_id\n return @app_id\n end",
"def app_id\n return @app_id\n end",
"def get_client_customer_id\n adwords.credential_handler.credentials[:client_customer_id]\n end",
"def application_id\n @application_id || YodleeApi.application_id\n end",
"def client_id\n super\n end",
"def client_app(client_id)\n Doorkeeper::Application.all.find { |app| app.uid == client_id }\n end",
"def application_id\n return @application_id\n end",
"def client_id=(value)\n @client_id = value\n end",
"def app_id\n @app.id\n end",
"def client_id\n ENV['VIPPS_CLIENT_ID']\n end",
"def client_application_ids\n return @client_application_ids\n end",
"def openid_client_id=(_arg0); end",
"def kiosk_mode_built_in_app_id\n return @kiosk_mode_built_in_app_id\n end",
"def get_client_id( socket )\n # UNIX socket return effective UID/GID for connected client\n euid, _ = socket.getpeereid\n\n # Find record in /etc/passwd\n user_info = Etc.getpwuid euid\n\n return \"#{user_info.name} (#{user_info.gecos})\"\n end",
"def anonymous_client_id(web_socket)\n @clients[web_socket.signature] || \"__anonymous-client-#{(@anonymous_client_id += 1)}\".to_sym\n end",
"def resource_app_id\n return @resource_app_id\n end",
"def app_id; end",
"def app_id; end",
"def client_id=(_arg0); end",
"def ccdb_app_id()\n KNIFE::get_app_id(@current_name)\n end",
"def current_user_id\n app_session.current_user_id\n end",
"def get_client_name\n client_name = nil\n if env.present?\n Webmetrics::Config.client_matchers.each do |key, matcher|\n if matcher.respond_to?(:call) and matcher.call(env)\n client_name = key\n break\n end\n end\n end\n\n # return client name\n client_name || Webmetrics::Config.default_client\n end",
"def client_id=(value)\n reset_agent\n @client_id = value\n end",
"def connection_for_application\n oauth_client.client_credentials.get_token\n end",
"def app_id\n @object.send(Innsights.user_id)\n end",
"def callerid\n if @initiated_by == :client\n id = \"cert=#{File.basename(client_public_key).gsub(/\\.pem$/, '')}\"\n raise \"Invalid callerid generated from client public key\" unless valid_callerid?(id)\n else\n # servers need to set callerid as well, not usually needed but\n # would be if you're doing registration or auditing or generating\n # requests for some or other reason\n id = \"cert=#{File.basename(server_public_key).gsub(/\\.pem$/, '')}\"\n raise \"Invalid callerid generated from server public key\" unless valid_callerid?(id)\n end\n\n return id\n end",
"def app_id\n fb_app.id\n end",
"def clientid\n @data['clientid'].to_i\n end",
"def client_token\n data[:client_token]\n end",
"def appid\n if (@appid.nil? or @appid.empty?)\n fatal(\"Error: appid: App ID was not set. Aborting.\")\n end\n @appid\n end",
"def app_id\n self.class.send :class_variable_get, :@@app_id\n end",
"def user_id\n raise \"Implement in Client or Advocate\"\n end",
"def client_channel\n \"#{access_key}-client\"\n end",
"def target_id\n user_app_token\n end",
"def access_key\n ENV['RANCHER_CLIENT_ID']\n end",
"def is_user_owner_client_app\n get(\"/api/v1/oauth_is_user_owner_client_app.json\")\n end",
"def openid_redirect_uri; end",
"def bot_user_id\n client.self.id\n end",
"def app_activity_id\n return @app_activity_id\n end",
"def user_app_id(force=false)\n @user_app_id = nil if force\n @user_app_id ||= read_user_app_id\n end",
"def app_identifier\n Origen.config.initials || 'Anon App'\n end",
"def fb_app_id\n ENV['facebook_app_id']\n end",
"def client_application\n @client_application ||= new_client_application\n end",
"def resource_owner_id\n env['HTTP_X_AUTHENTICATED_USERID']\n end",
"def kiosk_mode_managed_app_id\n return @kiosk_mode_managed_app_id\n end",
"def set_client_application\n @client_application = ClientApplication.find(params[:id])\n end",
"def get_client\n @client\n end",
"def client\n ::DelegatedAuthentication.new(options[:app_id], options[:app_secret], nil, nil, options[:privacy_url], callback_url)\n end",
"def app_scope_id\n return @app_scope_id\n end",
"def current_user_id(context = {})\n context[:cbac_user].to_i\n end",
"def doorkeeper_client\n doorkeeper_token.resource_owner_id ? Client.find(doorkeeper_token.resource_owner_id) : Client.new\n end",
"def client_name\n me.client.name\n end",
"def bc_client_id\n ENV['BC_CLIENT_ID']\nend",
"def app_identifier\n 'com.spothero.spothero'\n end",
"def app_id=(value)\n @app_id = value\n end",
"def app_id=(value)\n @app_id = value\n end",
"def app_id=(value)\n @app_id = value\n end",
"def set_applicationclient\n @applicationclient = Applicationclient.find(params[:id])\n end",
"def new_client_application\n OAuth2::Client.new(caller_service.client_id, caller_service.client_secret, :site => authorizator_service.site, :raise_errors => false)\n end",
"def correlation_id\n ENV['MHV_SM_USER_ID']\n end",
"def app_id\n @values.fetch('appId') { \n @values['appId'] = nil\n }\n end",
"def client_id_secret\n {\n client_id: ENV['CLIENT_ID'], \n client_secret: ENV['CLIENT_SECRET'], \n }\n end",
"def github_client_id\n Rails.application.secrets.github_client_id\n end",
"def client\n # Merge in authorize url if supplied\n options.authorize_params[:clientId] = options.client_id\n options.authorize_params[:redirect] = callback_url\n options.client_options[:authorize_url] = options.authorize_url if options.authorize_url.present?\n options.client_options[:site] = options.site if options.site.present?\n\n ::OAuth2::Client.new(\n options.client_id,\n options.client_secret,\n deep_symbolize(options.client_options)\n )\n end",
"def app_id\n object.send(:try, Innsights.group_id)\n end",
"def openid_callback_url\n \"#{request.protocol}://#{request.host}#{Merb::Router.url(:openid)}\"\n end",
"def current_session_id(env)\n env[ENV_SESSION_OPTIONS_KEY][:id]\n end",
"def application_id=(value)\n @application_id = value\n end",
"def set_client_id_in_suite\n self.client_id = self.try(:user).try(:client).try(:id)\n end",
"def client\n @client ||= OpenIDConnect::Client.new(\n identifier: @client_id,\n secret: @secret,\n redirect_uri: @redirect_url,\n realm: 'esdl-mapeditor',\n audience: @audience,\n authorization_endpoint: discovery.authorization_endpoint,\n token_endpoint: discovery.token_endpoint,\n userinfo_endpoint: discovery.userinfo_endpoint\n )\n end",
"def openid_config_url\n \"https://login.windows.net/#{tenant}/.well-known/openid-configuration\"\n end",
"def notification_url_app_id\n return @notification_url_app_id\n end",
"def generate_client_id\n generated_id = \"id#@client_ids_generated\"\n @client_ids_generated = @client_ids_generated + 1\n\n return generated_id\n end",
"def azure_ad_user_id\n return @azure_ad_user_id\n end",
"def engine_client\n if current_user\n identity_session.access_token.http_client\n else\n Identity.http_client\n end\n end"
] |
[
"0.7609361",
"0.75925803",
"0.75925803",
"0.75781375",
"0.74705297",
"0.74705297",
"0.7407728",
"0.73422515",
"0.73301923",
"0.73136103",
"0.7310691",
"0.7308098",
"0.7256761",
"0.72355103",
"0.7170703",
"0.71651953",
"0.7125279",
"0.7030615",
"0.7024217",
"0.694726",
"0.6947165",
"0.69227177",
"0.68770516",
"0.6817238",
"0.6800714",
"0.6800714",
"0.6800714",
"0.68003356",
"0.67083734",
"0.66431177",
"0.6635361",
"0.66295904",
"0.66062427",
"0.65398324",
"0.6503871",
"0.64920807",
"0.6442035",
"0.63943595",
"0.6347827",
"0.6319518",
"0.62648094",
"0.6260469",
"0.6260469",
"0.6253249",
"0.6248689",
"0.6232307",
"0.6226884",
"0.62021464",
"0.61933345",
"0.6179312",
"0.61755574",
"0.61724913",
"0.61506975",
"0.6136661",
"0.61227",
"0.6122673",
"0.6122257",
"0.60777",
"0.60683763",
"0.60633004",
"0.6060936",
"0.60233325",
"0.60188675",
"0.6018548",
"0.6015442",
"0.6005334",
"0.5992738",
"0.598756",
"0.5979778",
"0.5974134",
"0.5972844",
"0.5949659",
"0.5940673",
"0.5940015",
"0.5938756",
"0.5937954",
"0.59294605",
"0.59149456",
"0.5911865",
"0.59116864",
"0.59116864",
"0.59116864",
"0.59102714",
"0.59030116",
"0.59019744",
"0.58948946",
"0.5860082",
"0.5858483",
"0.585486",
"0.5842065",
"0.58246756",
"0.5823642",
"0.58130693",
"0.58120567",
"0.58092016",
"0.5807623",
"0.5801986",
"0.5800907",
"0.5788352",
"0.5784127"
] |
0.7838771
|
0
|
The expected id token issuer taken from the discovery endpoint.
|
def issuer
openid_config['issuer']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def issuer\n return @issuer\n end",
"def issuer\n return @issuer\n end",
"def issuer\n @issuer\n end",
"def retrieve_issuer_id\n @saml_issuer_id = @saml_request[/<saml:Issuer\\s?.*>(.*)<\\/saml:Issuer>/, 1]\n return true\n end",
"def issuer_name\n return @issuer_name\n end",
"def issuer\n @issuer=EzCrypto::Name.new(@cert.issuer) unless @issuer\n @issuer\n end",
"def issuer\n fetch(:@issuer) { |grid_string| grid_string[2,5] }\n end",
"def issuer\n issuer = %x{echo \"#{self.certificate}\" | openssl x509 -noout -issuer}\n issuer.gsub(/^(.*)O=/,'').gsub(/\\/(.*)$/, '')\n end",
"def issuer=(value)\n @issuer = value\n end",
"def issuer=(value)\n @issuer = value\n end",
"def set_issuer\n @issuer = Issuer.find(params[:id])\n end",
"def issuer\n plan && plan.issuer\n end",
"def account_provider_issuer(serialized_data)\n issuer(serialized_data, Darrrr::RECOVERY_TOKEN_TYPE)\n end",
"def issuer(h)\n build_issuer(h) if valid_keys.include?(h[:k][0..3] + \"issuer\")\n end",
"def valid_issuer?\r\n begin\r\n assertion = REXML::XPath.first(document, \"/p:Response/a:Assertion\", { \"p\" => PROTOCOL, \"a\" => ASSERTION })\r\n issuer = assertion.attribute('Issuer').value\r\n raise SA1008Exception unless issuer == settings.issuer\r\n rescue RuntimeError => exp\r\n Rails.logger.error \"#{exp.class} - #{exp.message}\"\r\n return false\r\n else\r\n return true\r\n end\r\n end",
"def saml_provider_issuer_url\n @attributes[:saml_provider_issuer_url]\n end",
"def recovery_provider_issuer(serialized_data)\n issuer(serialized_data, Darrrr::COUNTERSIGNED_RECOVERY_TOKEN_TYPE)\n end",
"def valid_issuer?(token)\n issuer = token[/&?Issuer=([^&]+)/, 1]\n [trusted_issuers].flatten.include?(CGI.unescape(issuer))\n end",
"def issuer_department\n @issuer_department || ServiceProviderIssuerParser.new(issuer).parse[:department]\n end",
"def issuer_name=(value)\n @issuer_name = value\n end",
"def issuer\n raise NotImplementedError\n end",
"def issuer\n self.respond_to?(:user) && self.user.present? ? self.user.email : self.storage_issuer\n end",
"def tracking_identifier\n self.issuer\n end",
"def token_user_id\n decoded_token.first['id']\n end",
"def issuer= new_issuer\n @issuer = new_issuer\n end",
"def crear_issuer issuer\n body = {\n slug: issuer['id_app'].downcase,\n name: issuer['name'],\n url: issuer['url'] #cientificos-sarasa\n }\n response = signed_post_request @@API_ROOT+'/issuers', body\n \n end",
"def decoded_id_token public_key = nil, options = {}, &keyfinder\n options[:algorithm] ||= signing_algorithm\n verify = !public_key.nil? || block_given?\n payload, _header = JWT.decode(id_token, public_key, verify, options, &keyfinder)\n raise Signet::UnsafeOperationError, \"No ID token audience declared.\" unless payload.key? \"aud\"\n unless Array(payload[\"aud\"]).include?(client_id)\n raise Signet::UnsafeOperationError,\n \"ID token audience did not match Client ID.\"\n end\n payload\n end",
"def get_issuer(*params); raise('Stub or mock required.') end",
"def credential_authentication_inverso_issuer(h)\n [credential_authentication_inverso(h), issuer(h)].compact.join(\" \")\n end",
"def sb_issuer\n ENV['AZURE_SERVICEBUS_ISSUER'] || 'owner'\n end",
"def configure!(issuer:, logger: nil)\n @issuer = issuer\n @auth_server_id = issuer.split('/').last\n end",
"def user_id\n decoded_token.first['user_id']\n end",
"def issuer_object\n self.user.nil? ? self.storage_issuer : self.user\n end",
"def storage_issuer\n self.storage.service.credentials.issuer\n end",
"def storage_issuer\n self.storage.service.credentials.issuer\n end",
"def auth_inst_id\n auth[:institution_id]\n end",
"def current_user_id\n if request.headers && request.headers['Authorization']\n token = request.headers['Authorization'].split(' ')[1] #[Bearer <token>]\n begin\n decoded_token = JWT.decode(token, 'this should be in .env', true, algorithm: 'HS256')\n if decoded_token\n user_id = decoded_token[0]['user_id'] #[{ \"user_id\"=>\"2\" }, { \"alg\"=>\"HS256\" }]\n end\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def auth0_id_token\n session.fetch(:id_token, nil)\n end",
"def issuer\n self.storage_issuer\n end",
"def jwt_subject\n auth0_id_string\n end",
"def decode_id_token(id_token)\n decoded = JSON::JWT.decode(id_token, :skip_verification)\n algorithm = decoded.algorithm.to_sym\n\n validate_client_algorithm!(algorithm)\n\n keyset =\n case algorithm\n when :HS256, :HS384, :HS512\n secret\n else\n public_key\n end\n\n decoded.verify!(keyset)\n ::OpenIDConnect::ResponseObject::IdToken.new(decoded)\n rescue JSON::JWK::Set::KidNotFound\n # If the JWT has a key ID (kid), then we know that the set of\n # keys supplied doesn't contain the one we want, and we're\n # done. However, if there is no kid, then we try each key\n # individually to see if one works:\n # https://github.com/nov/json-jwt/pull/92#issuecomment-824654949\n raise if decoded&.header&.key?('kid')\n\n decoded = decode_with_each_key!(id_token, keyset)\n\n raise unless decoded\n\n decoded\n end",
"def validate_and_parse_id_token(id_token)\n # The second parameter is the public key to verify the signature.\n # However, that key is overridden by the value of the executed block\n # if one is present.\n #\n # If you're thinking that this looks ugly with the raw nil and boolean,\n # see https://github.com/jwt/ruby-jwt/issues/59.\n jwt_claims, jwt_header =\n JWT.decode(id_token, nil, false, verify_options) do |header|\n # There should always be one key from the discovery endpoint that\n # matches the id in the JWT header.\n x5c = (signing_keys.find do |key|\n key['kid'] == header['kid']\n end || {})['x5c']\n if x5c.nil? || x5c.empty?\n fail JWT::VerificationError,\n 'No keys from key endpoint match the id token'\n end\n # The key also contains other fields, such as n and e, that are\n # redundant. x5c is sufficient to verify the id token.\n OpenSSL::X509::Certificate.new(JWT.base64url_decode(x5c.first)).public_key\n end\n return jwt_claims, jwt_header if jwt_claims['nonce'] == read_nonce\n fail JWT::DecodeError, 'Returned nonce did not match.'\n end",
"def test_retrieval_of_issuers\n assert_equal [{ :id => '0151', :name => 'Issuer Simulator' }], @gateway.issuers.list\n end",
"def id_token\n @id_token ||= nil\n end",
"def verify_iat; end",
"def verify_iat; end",
"def get_user_id_from_token\n if request.headers['Authorization'].present?\n @token = request.headers['Authorization'].split(' ').last\n @payload ||= AuthToken.decode(@token)\n if @payload && @payload[:user_id]\n return @payload[:user_id]\n end\n end\n return nil\n end",
"def get_identity(token, options ={})\n options = els_options.dup.merge(options)\n return fake_id(options) if options.has_key?('faker')\n begin\n if is_token_valid?(token, options)\n get_token_identity(token, options)\n else\n raise \"token is invalid\"\n end\n rescue Exception => e\n raise e\n end\n end",
"def current_identity\n token_locations = [cookies[:auth_token], ENV['DANGEROUS_AUTH_HACK'], params[:auth_token]]\n token = token_locations.find{|x| !x.blank? }\n if token\n Identity.find_by(token: token)\n else\n nil\n end\n end",
"def client_key_authentication\n if request.headers['JWT'].present?\n auth_header = request.headers['JWT'].split(' ').last\n @token_payload = decodeJWT auth_header.strip\n if @token_payload\n @creators_id = @token_payload[0]['creators_id']\n else\n selected_format({ error: 'The provided token wasn´t correct' },:bad_request)\n end\n else\n selected_format({ error: 'Need to include the Authorization header JWT with correct key' },:forbidden)\n end\n end",
"def identification\n request('getIdentification')\n end",
"def consumer_id\n @yadis_url\n end",
"def id\n token\n end",
"def identifier_value\n user.icn\n end",
"def get_token_identity(token,options={})\n ElsIdentity.new(get_raw_token_identity(token,options))\n end",
"def authority_key_identifier\n extensions[R509::Cert::Extensions::AuthorityKeyIdentifier]\n end",
"def external_identifier \n elements = []\n elements << ipaddress || 'UNKNOWNIP'\n elements << custid || 'anon'\n #OT.ld \"sess identifier input: #{elements.inspect}\"\n @external_identifier ||= elements.gibbler.base(36)\n @external_identifier\n end",
"def validate_client\n @client ||= if configuration.jwt_use_issuer_as_client_id\n OAuth::Client.find(server.jwt['iss']) if server.jwt['iss'].present?\n elsif sever.parameters[:client_id].present?\n OAuth::Client.find(sever.parameters[:client_id])\n end\n end",
"def get_metadata_by_issuer(issuer)\n headers = MagicAdmin::Util.headers(magic.secret_key)\n options = { params: { issuer: issuer }, headers: headers }\n magic.http_client\n .call(:get, \"/v1/admin/auth/user/get\", options)\n end",
"def provider_id_for_audits\n nil\n end",
"def logged_in_user_id\n token = request.headers[\"Authorization\"]\n # something which might raise an exception\n begin \n decoded_payload = JWT.decode(token, hmac_secret, true, { algorithm: 'HS256' })\n return decoded_payload.first[\"user_id\"].to_i\n # code that deals with some exception\n rescue\n return nil\n end\n end",
"def org_id\n @org_id ||= query_org_id # lazy query org_id when not set by login response\n end",
"def meta\n { iss: 'issuer_name', aud: 'user' }\n end",
"def user_id\n raise \"Implement in Client or Advocate\"\n end",
"def get_login_redirect\n @openid_consumer ||= OpenID::Consumer.new(session,\n OpenID::Store::Filesystem.new(\"#{File.dirname(__FILE__)}/tmp/openid\"))\n begin\n oidreq = @openid_consumer.begin(OPENID_DISCOVERY_ENDPOINT)\n rescue OpenID::DiscoveryFailure => why\n \"Sorry, we couldn't find your identifier #{openid}.\"\n else\n axreq = OpenID::AX::FetchRequest.new\n axreq.add(OpenID::AX::AttrInfo.new(OPENID_AX_EMAIL_SCHEMA, nil, true))\n oidreq.add_extension(axreq)\n oidreq.redirect_url(root_url,root_url + \"/login/complete\")\n end\n end",
"def validate!(assertions = {})\n raise Expired if expired?\n\n # TODO: Nonce validation\n\n audiences = assertions[:audiences] || Array(assertions[:audience])\n if audiences.any?\n audience = id_token.aud\n unless audiences.include? audience\n raise InvalidAudience.new(audience)\n end\n end\n\n if assertions[:issuer]\n issuer = id_token.iss\n unless issuer == assertions[:issuer]\n raise InvalidIssuer.new(issuer)\n end\n end\n\n true\n end",
"def token_type\n target_audience ? :id_token : :access_token\n end",
"def openid_client_id; end",
"def assigning_authority\n 'ICN'\n end",
"def company_id\n self.dig_for_string(\"agentSummary\", \"office\", \"companyId\")\n end",
"def decoded_token\n if auth_header\n token = auth_header.split(' ')[1]\n begin\n token = JWT.decode token, Rails.application.credentials.jwt_secret,\n true,\n { algorithm: 'HS256' }\n token&.first['jti']\n rescue JWT::DecodeError\n nil\n end\n end\n end",
"def iss_url\n session[:iss_url]\n end",
"def target_id\n user_app_token\n end",
"def key_for(token)\n \"afid-access-token:#{token}\".to_sym\n end",
"def invitation_token\n invitation.token if invitation\n end",
"def decoded_token\n bearer, token = request.authorization.to_s.split\n\n if bearer == \"Bearer\"\n JWT.decode(token, Rails.application.secrets.secret_key_base, true, { algorithm: 'HS256' }).first\n else\n {}\n end\n end",
"def linkedin_token\n x = authentications.find_by(provider: 'linkedin')\n return x.token unless x.nil?\n end",
"def next_available_token_id\n raise \"Not yet implemented\"\n # implementation idea: list token ids owned by our backend (ie the public key associated w/ AIRDROP_PRIVATE_KEY)\n # https://ethereum.stackexchange.com/questions/54959/list-erc721-tokens-owned-by-a-user-on-a-web-page\n #\n # return nil unless we find a token id that can be delivered\n end",
"def institution_id\n\t\tif organisation.nil?\n\t\t\treturn nil\n\t\telse\n\t\t\treturn organisation.root.id\n\t\tend\n\tend",
"def id_found?\n token && decoded_token && decoded_token[:id]\n end",
"def provider\n return nil unless user_id\n user_id.split('/').last\n end",
"def provider\n return nil unless user_id\n user_id.split('/').last\n end",
"def resource_owner_id\n env['HTTP_X_AUTHENTICATED_USERID']\n end",
"def issuer_params\n params.require(:issuer).permit(:ISSUER_ID, :SendingTime)\n end",
"def identity_resource_identifier\n return @identity_resource_identifier\n end",
"def get_account_id(arn)\n /:(\\d{12}):config-rule/.match(arn)&.captures&.first || 'no-account-id'\n end",
"def user_id\n payload = authenticate!(via: :jwt)\n return payload[\"user\"]\n end",
"def fetch_and_set_token_id\n\n token_resp = Util::EntityHelper.fetch_and_validate_token(@client_id, 'a_s_cm_ggca')\n\n return validation_error(\n 'a_s_cm_ggca_3',\n 'invalid_api_params',\n ['invalid_client_id'],\n GlobalConstant::ErrorAction.default\n ) unless token_resp.success?\n\n @token_details = token_resp.data\n\n @token_id = @token_details[:id]\n\n success\n\n end",
"def current_user\n puts decoded_token\n \n if decoded_token\n # user_id = User.find_by(id: user_id)\n User.find_by(id: decoded_token[0][\"user_id\"])\n\n end\n end",
"def token_for(provider)\n ident = self.identities_dataset.where(:provider => provider.to_s).first\n if(ident)\n ident.credentials[:token]\n end\n end",
"def id\n Akero.fingerprint_from_cert(@cert)\n end",
"def invitation_token\n \tinvitation.token if invitation\n end",
"def callerid\n if @initiated_by == :client\n id = \"cert=#{File.basename(client_public_key).gsub(/\\.pem$/, '')}\"\n raise \"Invalid callerid generated from client public key\" unless valid_callerid?(id)\n else\n # servers need to set callerid as well, not usually needed but\n # would be if you're doing registration or auditing or generating\n # requests for some or other reason\n id = \"cert=#{File.basename(server_public_key).gsub(/\\.pem$/, '')}\"\n raise \"Invalid callerid generated from server public key\" unless valid_callerid?(id)\n end\n\n return id\n end",
"def device_id\n apn_device_token\n end",
"def id\n to_nil _response_entity.fetch(\"entityId\", nil)\n end",
"def extract_identity(uri)\n return $1.downcase if uri =~ %r[/user/([a-zA-Z_1-9-]*)] || uri =~ %r[://([a-zA-Z_1-9-]*)?\\.#{AppConfig.host(request.host)}] || uri =~ %r[://(.*?)/?$]\n return nil\n end",
"def invitation_token\n invitation.token if invitation\n end",
"def sakai_init\n {\n \"openid_configuration\": SAKAI_OPENID_CONFIGURATION,\n \"registration_token\": \"1641258858:09e941d2-15cc-4389-be3f-dc1e04c14061\",\n }\nend",
"def id_of_namespace(namespace)\n ret = RestClient.get \"#{@url}/namespaces?search=#{namespace}\", \n { \"Private-Token\": @token}\n json = JSON.parse(ret.body)\n\n json[0]['id']\n end",
"def identifier(account)\n identity_url(:account => account, :protocol => scheme)\n end"
] |
[
"0.7226521",
"0.7226521",
"0.71805733",
"0.717203",
"0.7109209",
"0.7059036",
"0.6930751",
"0.68863004",
"0.6447318",
"0.6447318",
"0.6262485",
"0.6135825",
"0.61190593",
"0.6080033",
"0.6020959",
"0.601819",
"0.6011183",
"0.5950463",
"0.5947751",
"0.5884221",
"0.5879113",
"0.5871348",
"0.585642",
"0.58550006",
"0.5853531",
"0.5806563",
"0.5803448",
"0.5701456",
"0.56947714",
"0.5690758",
"0.5680971",
"0.5622014",
"0.55566657",
"0.550078",
"0.550078",
"0.5489514",
"0.5482095",
"0.54263926",
"0.54254323",
"0.5409141",
"0.53794086",
"0.5301045",
"0.5256626",
"0.52338886",
"0.5231926",
"0.5231926",
"0.5230179",
"0.5177232",
"0.51524127",
"0.51419204",
"0.5138935",
"0.51218194",
"0.51202434",
"0.5120069",
"0.50971735",
"0.5090538",
"0.50654936",
"0.5030561",
"0.50245094",
"0.5019803",
"0.5010127",
"0.4978119",
"0.49439293",
"0.49430186",
"0.4918151",
"0.49174878",
"0.4916119",
"0.48992413",
"0.48957348",
"0.48752084",
"0.48701638",
"0.4867229",
"0.4862263",
"0.48594633",
"0.48544845",
"0.48544765",
"0.4853677",
"0.48485437",
"0.4845227",
"0.48405254",
"0.48354906",
"0.48354906",
"0.48327464",
"0.482768",
"0.4823717",
"0.48186442",
"0.48115975",
"0.48038912",
"0.48009387",
"0.479824",
"0.47960258",
"0.47863424",
"0.47861552",
"0.47790644",
"0.4777511",
"0.47759125",
"0.47748995",
"0.4773019",
"0.47677588",
"0.47611004"
] |
0.76082546
|
0
|
Fetches the current signing keys for Azure AD. Note that there should always two available, and that they have a 6 week rollover. Each key is a hash with the following fields: kty, use, kid, x5t, n, e, x5c
|
def fetch_signing_keys
response = JSON.parse(Net::HTTP.get(URI(signing_keys_url)))
response['keys']
rescue JSON::ParserError
raise StandardError, 'Unable to fetch AzureAD signing keys.'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def signing_keys\n @signing_keys ||= fetch_signing_keys\n end",
"def list_signing_keys(opts = {})\n data, _status_code, _headers = list_signing_keys_with_http_info(opts)\n data\n end",
"def get_keys\n @encryption_io.get_keys\n end",
"def keys\n # Lock for thread safety\n # Only one thread can write to the hash at a time and prevent partial keys from being returned.\n @thread_lock.synchronize do\n if @keys.nil?\n @keys = {}\n @user_keys.each_pair do |name, rsa_keys|\n # Use the sha256 of the user name as the internal name\n # This is to both avoid naming problems when uploading and to obfuscate the key name\n keys_key = BackupEngine::Checksums::Engines::SHA256.new.block(name.to_s)\n raise('Key name sha collission') if @keys.key?(keys_key)\n\n @keys[keys_key] = rsa_keys.merge(name: name)\n end\n end\n end\n\n raise('No encryption keys') if @keys.empty?\n\n return @keys\n end",
"def keys\n ::M2X::Client::Key.list(@client, params.merge(device: self[\"id\"]))\n end",
"def list_signing_keys_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SigningKeysApi.list_signing_keys ...'\n end\n # resource path\n local_var_path = '/system/v1/signing-keys'\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] || 'ListSigningKeysResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['accessToken']\n\n new_options = opts.merge(\n :operation => :\"SigningKeysApi.list_signing_keys\",\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: SigningKeysApi#list_signing_keys\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_storage_account_keys(name)\n if get_storage_account name\n path = \"/services/storageservices/#{name}/keys\"\n request = client.management_request(:get, path)\n response = request.call\n Serialization.storage_account_keys_from_xml(response)\n else\n Azure::Loggerx.warn \"Storage Account '#{name}' does not exist.\"\n end\n end",
"def get_keys(user=nil) \n\t\tuser = Account.current_account if !user\n\t\tKey.all(:account_id => user.id, :project_id => self.id)\n\tend",
"def claimed_keys\n [key]\n end",
"def list\n @keychain.keys\n end",
"def all\n path = \"/signers\"\n\n response, status = BeyondApi::Request.get(@session,\n path)\n\n handle_response(response, status)\n end",
"def get_key_list\n read(Common::KEY) || Hash.new\n end",
"def keys\n IbmCloudRest.get \"#{@uri}/keys\"\n end",
"def keys(options={})\n get(\"/user/keys\", options, 3)\n end",
"def recovery_keys\n return @recovery_keys\n end",
"def keys\n storage_hash.keys\n rescue\n nil\n end",
"def list_api_keys(opts = {})\n @transporter.read(:GET, '/1/keys', {}, opts)\n end",
"def get_keys(opts = {})\n data, _status_code, _headers = get_keys_with_http_info(opts)\n data\n end",
"def key_ids\n @keys.keys\n end",
"def keys\n @ledger.keys\n end",
"def authentication_keys\n @authentication_keys ||= [mapping.to.token_authentication_key]\n end",
"def list_keys\n @keys.keys\n end",
"def keys\n jiak.client.keys(jiak.bucket)\n end",
"def get_ssh_keys\n get(\"tenants/#{tenant}\")[\"sshKeys\"]\n end",
"def keys(arg = nil)\n if arg.nil?\n storage.keys\n else\n with_interest(arg).map { |key, _, _| key }\n end\n end",
"def generate_keys\n\t\tself.token = OAuth::Helper.generate_key(20)[0,20]\n\t\tself.expires_at = 10.minutes.from_now\n\t\tself.authorized_at = Time.now\n\tend",
"def keys_for(username)\n @api.client.users.keys.list(user: username).body\n end",
"def primary_storage_key(storage_account, system_config)\n cmdline = Schott::AzureCLI::Commandlines.storage_keys(storage_account)\n cmd = run_command(\"Retrieve #{storage_account} keys\", cmdline, system_config)\n keys = JSON.load(cmd.output)\n return keys.first[\"value\"]\n end",
"def authentication_keys\n @authentication_keys ||= User.authentication_keys\n end",
"def list_keys\n @keydict.keys\n end",
"def list_keys()\n # TODO\n end",
"def current_keys\n @current_keys ||= []\n end",
"def keys_including_timestamps\n @keys_including_timestamps ||= if record_timestamps?\n keys + model.all_timestamp_attributes_in_model\n else\n keys\n end\n end",
"def list_keychains(params: {})\n call :get, '/keychain', params\n end",
"def signing_key; end",
"def retrieve_signing_key(datestamp)\n if @cache_signing_keys\n if value = @signing_key_cache[datestamp]\n value\n else\n value = @signing_key_cache[datestamp] = make_signing_key(datestamp)\n while @signing_key_cache.size > MAX_CACHED_SIGNING_KEYS\n @signing_key_cache.delete(@signing_key_cache.keys.first)\n end\n value\n end\n else\n make_signing_key(datestamp)\n end\n end",
"def keys\n return @keys if defined?(@keys)\n @keys = all.map do |tone|\n Key.from_index(tone.tone, tone.letter_index)\n end\n end",
"def generate_access_key\n access_keys.generate_new\n end",
"def keys\n k ||= {}\n @zones ||= load_zones\n return if @zones.nil? || @zones.empty?\n\n # global default keys if they exist\n # TODO: need to work out the namespace on dns stuff here.\n # TODO: be good to support knife-vault/encrypted bags for keys\n if node.key?(:dns) && node['dns'].key?(:rndc_key)\n k[node.normal['dns']['rndc_key']] = get_key node['dns']['rndc_key']\n end\n\n @zones.each { |zone| k[zone['rndc_key']] = get_key zone['rndc_key'] if zone.key? 'rndc_key' }\n k\n end",
"def get_keys(jwt)\n\t\tp 'Setting the keys'\n\t\t@decodedJWT = JWT.decode(jwt.to_s,nil,settings.appSig)\n\t\t@jwtJSON = JSON.parse(@decodedJWT.to_json) \n\t\tsettings.oauthToken = @jwtJSON[\"request\"][\"user\"][\"oauthToken\"]\n\t\tsettings.internalOauthToken = @jwtJSON[\"request\"][\"user\"][\"internalOauthToken\"]\n\t\tsettings.refreshToken = @jwtJSON[\"request\"][\"user\"][\"refreshToken\"]\n\t\tsettings.jwt = jwt\n\t\tsettings.exp = @jwtJSON[\"exp\"]\nend",
"def key_files; end",
"def get_account_key(storage_acct, skip_accessors_definition = false)\n if recent_api_version?\n list_account_key_objects(storage_acct.name_from_hash, storage_acct.resource_group, skip_accessors_definition).first.key\n else\n list_account_keys(storage_acct.name_from_hash, storage_acct.resource_group).fetch('key1')\n end\n end",
"def get_device_keys\n begin\n decoded_access_token = JWT.decode(params[:accessToken], 's3cr3t', true, algorithm: 'HS256')\n if decoded_access_token\n @device_keys = User.pluck(:device_key)\n render json: {device_keys: @device_keys}\n end\n\n rescue => exception\n render json: {status: \"Invalid Token\"}\n end\n\n end",
"def derive_keys(key)\n derived_key_size = key.size / 2\n mac_key = key[0...derived_key_size]\n enc_key = key[derived_key_size..-1]\n return mac_key, enc_key\n end",
"def all_keys\n @cluster.client.list_keys(@name)\n end",
"def stored_key_associations\n associations.values.select(&:stored_key?)\n end",
"def credential_keys\n %w(seal certificate) & valid_keys\n end",
"def keys\n @keys ||= LicenseField.all.map(&:key)\n end",
"def list_api_keys(request_options = {})\n client.get(Protocol.index_keys_uri(name), :read, request_options)\n end",
"def signing_key\n @signing_key\n end",
"def get_keys()\n\t\t\treturn @config.keys\n\t\tend",
"def keys\n authorized_keys = []\n if team.present?\n log \"Got Github Team '#{team.name}' for Org '#{@org}'\"\n\n members = team_members(team.id)\n\n members.each do |member|\n log(\"Getting Member...#{member.login}\")\n\n keys = keys_for(member.login)\n\n # Can't get the real email address without logging in as that user\n email = \"#{member.login}@github.com\"\n\n keys.each do |key|\n authorized_keys << [key[:key], email]\n end\n end\n else\n log(\"No '#{@team_name}' team for '#{@org}' found\")\n log(teams.inspect)\n end\n authorized_keys\n end",
"def list_access_keys(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListAccessKeys'\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? :user_name\n\t\t\targs[:query]['UserName'] = optional[:user_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def signing_key\n digest = \"SHA256\"\n kDate = OpenSSL::HMAC.digest(digest, \"AWS4\" + credentials.aws_secret, request_datestamp)\n kRegion = OpenSSL::HMAC.digest(digest, kDate, region)\n kService = OpenSSL::HMAC.digest(digest, kRegion, service)\n OpenSSL::HMAC.digest(digest, kService, \"aws4_request\")\n end",
"def signature_key; end",
"def generate_keys(from_wallet_name, master_key)\n ks = { 'master' => master_key }\n %w(recovery money social memo).each do |role|\n private_key = Xgt::Ruby::Auth.generate_wif(from_wallet_name, master_key, 'recovery')\n public_key = Xgt::Ruby::Auth.wif_to_public_key(private_key, @address_prefix)\n ks[\"#{role}_private\"] = private_key\n ks[\"#{role}_public\"] = public_key\n end\n ks['wallet_name'] = Xgt::Ruby::Auth.generate_wallet_name(ks['recovery_public'])\n ks\nend",
"def list_keys(iam, user_name)\n begin\n list_access_keys_response = iam.list_access_keys({ user_name: user_name })\n\n if list_access_keys_response.access_key_metadata.count == 0\n puts \"No access keys.\"\n else\n puts \"Access keys:\"\n list_access_keys_response.access_key_metadata.each do |key_metadata|\n puts \" Access key ID: #{key_metadata.access_key_id}\"\n end\n end\n\n rescue Aws::IAM::Errors::NoSuchEntity\n puts \"Cannot find user '#{user_name}'.\"\n exit(false)\n end\nend",
"def keys\n\t\t\treturn @storage.keys\n\t\tend",
"def user_keys\n @user_keys ||= begin\n _keys = keys || {}\n ret = Hash[_keys.map { |k, v| [clean_identifier(k), v] }]\n if ret.keys.count != _keys.keys.count\n Logger.warn \\\n \"Duplicate public key identifiers were detected in #keys.\"\n end\n ret\n end\n end",
"def keys(salt, password = nil)\n dkey_len = @key_len + @mac_key_len\n if !password.nil?\n begin\n dkey = OpenSSL::PKCS5.pbkdf2_hmac(\n password, salt, @key_iterations, dkey_len, OpenSSL::Digest::SHA512.new\n )\n rescue NotImplementedError\n dkey = pbkdf2_sha512(password, salt, dkey_len, @key_iterations)\n end\n elsif !@master_key.nil?\n dkey = hkdf_sha256(@master_key, salt, dkey_len)\n else\n raise ArgumentError, 'No password or key specified!'\n end\n [dkey[0, @key_len], dkey[@key_len, dkey_len]]\n end",
"def get_assigned_keys(endusers)\n keys = Array.new\n endusers.each do |enduser|\n relationships = Relationship.where(\"endusers like?\", \"%#{enduser[:id]}\")\n relationships.each do |relationship|\n unless relationship[:keys].blank?\n key = Key.find(relationship[:keys])\n key = key.as_json\n key[\"enduser\"] = enduser[:id]\n keys.push(key)\n end\n end\n end\n\n return keys\n end",
"def list_gen1_accounts() \n response = HTTParty.get(\"https://management.azure.com/subscriptions/#{subscriptionId}/providers/Microsoft.DataLakeStore/accounts?api-version=2016-11-01\", {\n\n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Accept\" => '*/*',\n \"Cache-Control\" => 'no-cache',\n \"Connection\" => 'keep-alive',\n \"cache-control\" => 'no-cache'\n },\n \n verify: true,\n })\n\n return JSON.parse response.read_body\n end",
"def account_api_keys_get(opts = {})\n data, _status_code, _headers = account_api_keys_get_with_http_info(opts)\n return data\n end",
"def get_keys\n access_key = USER_DATA[0].to_s.strip\n secret_access_key = USER_DATA[1].to_s.strip\n keys = { :access_key_id => access_key,\n :secret_access_key => secret_access_key}\nend",
"def sign_key; end",
"def keys\n Results::KeyOccurrences.merge_keys collect_results.flatten(1)\n end",
"def list_checkout_keys\n CircleCi.request(conf, \"#{base_path}/checkout-key\").get\n end",
"def get_key\n @key = Base64.decode64('MzRlZTc5ODMtNWVlNi00MTQ3LWFhODYtNDQzZWEwNjJhYmY3NzQ0OTNkNmEtMmExNS00M2ZlLWFhY2UtZTc4NTY2OTI3NTg1Cg==')\n end",
"def get_keys(start_date, end_date = nil)\n keys = []\n keys << get_key_for(start_date)\n unless end_date.nil?\n while start_date <= end_date\n start_date += 60*60\n keys << get_key_for(start_date) unless start_date > end_date\n end\n keys << get_key_for(end_date)\n end\n keys.uniq\n end",
"def kms_key_id\n data[:kms_key_id]\n end",
"def kms_key_id\n data[:kms_key_id]\n end",
"def keys\n @redis.keys(@list + '*').reject { |s| s.end_with? '_MD5' }\n end",
"def encrypted_keys\n @encrypted_keys ||= encrypted_attributes.keys\n end",
"def list_keys(iam, user_name)\r\n begin \r\n list_access_keys_response = iam.list_access_keys({ user_name: user_name })\r\n\r\n if list_access_keys_response.access_key_metadata.count == 0\r\n puts \"No access keys.\"\r\n else\r\n puts \"Access keys:\"\r\n list_access_keys_response.access_key_metadata.each do |key_metadata|\r\n puts \" Access key ID: #{key_metadata.access_key_id}\"\r\n end\r\n end\r\n \r\n rescue Aws::IAM::Errors::NoSuchEntity\r\n puts \"Cannot find user '#{user_name}'.\"\r\n exit(false)\r\n end \r\nend",
"def list_account_key_objects(account_name, group = configuration.resource_group, skip_accessors_definition = false)\n validate_resource_group(group)\n\n unless recent_api_version?\n raise ArgumentError, \"unsupported api-version string '#{api_version}'\"\n end\n\n url = build_url(group, account_name, 'listKeys')\n response = rest_post(url)\n JSON.parse(response.body)['keys'].map { |hash| StorageAccountKey.new(hash, skip_accessors_definition) }\n end",
"def next\n return nil unless next?\n ensure_service!\n gapi = @service.list_hmac_keys \\\n service_account_email: @service_account_email,\n show_deleted_keys: @show_deleted_keys, token: @token, max: @max,\n user_project: @user_project\n\n HmacKey::List.from_gapi \\\n gapi, @service,\n service_account_email: @service_account_email,\n show_deleted_keys: @show_deleted_keys, max: @max,\n user_project: @user_project\n end",
"def list_key_credentials_for_application(app_id, options = {})\n get(\"/apps/#{app_id}/credentials/keys\", options)\n end",
"def row_keys(uuids, bucket_size, start_timestamp, end_timestamp, options={})\n times = usec_aligned_chunks(start_timestamp, end_timestamp, bucket_size)\n out = []\n times.each do |ts|\n uuids.each do |uuid|\n if options[:rollup_period]\n out << \"#{uuid}-#{options[:rollup_period]}-#{ts}\"\n end\n\n unless options[:rollup_only]\n out << \"#{uuid}-#{ts}\"\n end\n end\n end\n out\n end",
"def discovery_keys\n @data[:discovery_keys]\n end",
"def all_keys\n [\n input_samples.keys,\n input_parameters.keys,\n input_data.keys,\n output_samples.keys,\n output_data.keys,\n operation_data.keys\n ].flatten.uniq.sort\n end",
"def keys\n list = []\n each_key{|key| list << key}\n list\n end",
"def keys\n keys = []\n each_pair {|k,v| keys << k}\n keys\n end",
"def keys\n\t\tdoc = xml get('/user/keys')\n\t\tdoc.elements.to_a('//keys/key').map do |key|\n\t\t\tkey.elements['contents'].text\n\t\tend\n\tend",
"def keys\n\t\tdoc = xml get('/user/keys')\n\t\tdoc.elements.to_a('//keys/key').map do |key|\n\t\t\tkey.elements['contents'].text\n\t\tend\n\tend",
"def signing_key\n [percent_encode(@secret), percent_encode(@token)].join('&')\n end",
"def masterfile_keys\n ['orgzn', 'acct', 'farm']\n end",
"def list_account_keys(account_name, group = configuration.resource_group)\n validate_resource_group(group)\n\n url = build_url(group, account_name, 'listKeys')\n response = rest_post(url)\n hash = JSON.parse(response.body)\n\n parse_account_keys_from_hash(hash)\n end",
"def list_access_keys(iam, user_name)\n response = iam.list_access_keys(user_name: user_name)\n\n if response.access_key_metadata.count.positive?\n puts \"Access key IDs:\"\n response.access_key_metadata.each do |key_metadata|\n puts \" #{key_metadata.access_key_id}\"\n end\n else\n puts \"No access keys found for user '#{user_name}'.\"\n end\nrescue Aws::IAM::Errors::NoSuchEntity\n puts \"Error listing access keys: cannot find user '#{user_name}'.\"\n exit 1\nrescue StandardError => e\n puts \"Error listing access keys: #{e.message}\"\nend",
"def keys\n deprecate # 07/31/2012\n doc = xml get('/user/keys').to_s\n doc.elements.to_a('//keys/key').map do |key|\n key.elements['contents'].text\n end\n end",
"def generate_keys\n one = 1.to_bn\n # Gera os 2 numeros primos aleatorios\n p = OpenSSL::BN.generate_prime(512, safe=true)\n q = OpenSSL::BN.generate_prime(512, safe=true)\n # gera n\n n = p * q\n # Computa a função totiente phi(n) = (p -1) (q -1)\n phi_n = (p - one) * (q - one)\n # pega o valor de e (pega um primo aleatorio menor que que phi n e testa se é co-primo com phi(n))\n e = OpenSSL::BN.generate_prime(256, safe=true)\n while(phi_n.gcd(e) > one) do\n e = e + one\n end\n # calcula d, o inverso multiplicativo de e\n d = e.to_bn.mod_inverse(phi_n)\n pub_key = [n, e]\n pvt_key = [n, d]\n return [pub_key, pvt_key]\n end",
"def fetch_collection_of_keys\n cmd_out, cmd_err, status = fetch_all_gpg_keys\n if status.success?\n [true, create_a_collection_of_keys(cmd_out)]\n else\n [false, cmd_err]\n end\n end",
"def keycerts; end",
"def encrypted_keys\n Array(config[:encrypted_keys]).concat(\n Array(Chef::Config[:knife][:secure_data_bag][:encrypted_keys])\n ).uniq\n end",
"def kms_key\n @gapi.kms_key_name\n end",
"def getKeys(data_keys)\r\n data_keys[0].keys\r\n end",
"def get_twitter4j_apks\n Apk.where(:lib_names => \"twitter4j\").map { |x| x[:eid] }\nend",
"def generate_new_keys(\n name:,\n email: \"\",\n comment: \"\",\n creation_date: Time.now,\n key_validity_seconds: 1.year\n )\n\n generated =\n Rnp.new.generate_key(\n default_key_params(\n name: name,\n email: email,\n comment: comment,\n creation_date: creation_date,\n key_validity_seconds: key_validity_seconds,\n ),\n )\n\n %i[primary sub].map do |key_type|\n raw = generated[key_type]\n creation_hash = creation_params(\n raw: raw, activation_date: creation_date, metadata: raw.json,\n )\n\n RK::Key::PGP.create(creation_hash)\n end\n end",
"def active_bucket_keys\n active_bucket_times.map &method(:bucket_key)\n end",
"def keys\n @key\n end",
"def all\n @keys\n end"
] |
[
"0.6876577",
"0.62724376",
"0.6162911",
"0.6088269",
"0.59036756",
"0.58111596",
"0.5808923",
"0.5758461",
"0.57541597",
"0.5753374",
"0.56644094",
"0.56461036",
"0.5613344",
"0.5608864",
"0.55876255",
"0.5552408",
"0.5544535",
"0.5539555",
"0.5527357",
"0.54653937",
"0.54631937",
"0.54540074",
"0.5439229",
"0.5412873",
"0.5406762",
"0.537265",
"0.5366061",
"0.53642344",
"0.5340362",
"0.5334509",
"0.5331037",
"0.53133833",
"0.52862895",
"0.5281492",
"0.5269674",
"0.5268836",
"0.5265535",
"0.5238267",
"0.5237503",
"0.52301335",
"0.52221584",
"0.5216986",
"0.5205527",
"0.5190527",
"0.5167838",
"0.516687",
"0.5156809",
"0.5152359",
"0.5151543",
"0.5141742",
"0.51407915",
"0.51400304",
"0.51282656",
"0.5112622",
"0.511236",
"0.5109149",
"0.5105889",
"0.50917846",
"0.50895333",
"0.5087217",
"0.5081922",
"0.5071705",
"0.50387967",
"0.5030048",
"0.5025296",
"0.5020609",
"0.5018346",
"0.5008545",
"0.49964532",
"0.499462",
"0.499462",
"0.49898425",
"0.49895418",
"0.49838436",
"0.49777684",
"0.49584374",
"0.49550515",
"0.49535802",
"0.49532408",
"0.49501425",
"0.49482933",
"0.49472198",
"0.49390668",
"0.49390668",
"0.49377996",
"0.49283367",
"0.4917458",
"0.4915647",
"0.49146459",
"0.49069056",
"0.49047732",
"0.48925722",
"0.48855913",
"0.48837468",
"0.48828152",
"0.485852",
"0.4850426",
"0.48410374",
"0.48389992",
"0.48371512"
] |
0.7588368
|
0
|
Fetches the OpenId Connect configuration for the AzureAD tenant. This contains several import values, including: authorization_endpoint token_endpoint token_endpoint_auth_methods_supported jwks_uri response_types_supported response_modes_supported subject_types_supported id_token_signing_alg_values_supported scopes_supported issuer claims_supported microsoft_multi_refresh_token check_session_iframe end_session_endpoint userinfo_endpoint
|
def fetch_openid_config
JSON.parse(Net::HTTP.get(URI(openid_config_url)))
rescue JSON::ParserError
raise StandardError, 'Unable to fetch OpenId configuration for ' \
'AzureAD tenant.'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def openid_config_url\n \"https://login.windows.net/#{tenant}/.well-known/openid-configuration\"\n end",
"def openid_config\n @openid_config ||= fetch_openid_config\n end",
"def azure_options\n options = { tenant_id: tenant_id!,\n subscription_id: subscription_id,\n credentials: ::MsRest::TokenCredentials.new(token_provider),\n active_directory_settings: ad_settings,\n base_url: endpoint_settings.resource_manager_endpoint_url }\n options[:client_id] = client_id if client_id\n options[:client_secret] = client_secret if client_secret\n options\n end",
"def azure_options\n options = { tenant_id: tenant_id!,\n subscription_id: subscription_id,\n credentials: ::MsRest2::TokenCredentials.new(token_provider),\n active_directory_settings: ad_settings,\n base_url: endpoint_settings.resource_manager_endpoint_url }\n options[:client_id] = client_id if client_id\n options[:client_secret] = client_secret if client_secret\n options\n end",
"def oidc_configuration\n proxy&.oidc_configuration || OIDCConfiguration.new\n end",
"def active_directory_settings\n MsRestAzure::ActiveDirectoryServiceSettings.get_azure_settings\n end",
"def api_connector_configuration\n return @api_connector_configuration\n end",
"def parse_oauth_options\n {\n :request_token_url => full_oauth_url_for(:request_token, :api_host),\n :access_token_url => full_oauth_url_for(:access_token, :api_host),\n :authorize_url => full_oauth_url_for(:authorize, :auth_host),\n :site => @consumer_options[:site] || @consumer_options[:api_host] || DEFAULT_OAUTH_OPTIONS[:api_host]\n }\n end",
"def get_configuration(etag = \"\", retries = 0)\n fetch_response = _fetch(etag)\n\n # If there wasn't a config change, we return the response.\n if !fetch_response.is_fetched()\n return fetch_response\n end\n\n preferences = fetch_response.entry.config.fetch(PREFERENCES, nil)\n if preferences === nil\n return fetch_response\n end\n\n base_url = preferences.fetch(BASE_URL, nil)\n\n # If the base_url is the same as the last called one, just return the response.\n if base_url.equal?(nil) || @_base_url == base_url\n return fetch_response\n end\n\n redirect = preferences.fetch(REDIRECT, nil)\n # If the base_url is overridden, and the redirect parameter is not 2 (force),\n # the SDK should not redirect the calls, and it just has to return the response.\n if @_base_url_overridden && redirect != RedirectMode::FORCE_REDIRECT\n return fetch_response\n end\n\n # The next call should use the base_url provided in the config json\n @_base_url = base_url\n\n # If the redirect property == 0 (redirect not needed), return the response\n if redirect == RedirectMode::NO_REDIRECT\n # Return the response\n return fetch_response\n end\n\n # Try to download again with the new url\n\n if redirect == RedirectMode::SHOULD_REDIRECT\n @log.warn(3002, \"The `dataGovernance` parameter specified at the client initialization is not in sync with the preferences on the ConfigCat Dashboard. \" \\\n \"Read more: https://configcat.com/docs/advanced/data-governance/\")\n end\n\n # To prevent loops we check if we retried at least 3 times with the new base_url\n if retries >= 2\n @log.error(1104, \"Redirection loop encountered while trying to fetch config JSON. Please contact us at https://configcat.com/support/\")\n return fetch_response\n end\n\n # Retry the config download with the new base_url\n return get_configuration(etag, retries + 1)\n end",
"def parse_oauth2_options\n default = {site: DEFAULT_OAUTH2_OPTIONS[:api_host],\n token_url: full_oauth_url_for(:access_token, :auth_host),\n authorize_url: full_oauth_url_for(:authorize, :auth_host)}\n return default.merge(@client_options)\n end",
"def ad_settings\n case environment.downcase\n when \"azureusgovernment\"\n ::MsRestAzure2::ActiveDirectoryServiceSettings.get_azure_us_government_settings\n when \"azurechina\"\n ::MsRestAzure2::ActiveDirectoryServiceSettings.get_azure_china_settings\n when \"azuregermancloud\"\n ::MsRestAzure2::ActiveDirectoryServiceSettings.get_azure_german_settings\n when \"azure\"\n ::MsRestAzure2::ActiveDirectoryServiceSettings.get_azure_settings\n end\n end",
"def ad_settings\n case environment.downcase\n when \"azureusgovernment\"\n ::MsRestAzure::ActiveDirectoryServiceSettings.get_azure_us_government_settings\n when \"azurechina\"\n ::MsRestAzure::ActiveDirectoryServiceSettings.get_azure_china_settings\n when \"azuregermancloud\"\n ::MsRestAzure::ActiveDirectoryServiceSettings.get_azure_german_settings\n when \"azure\"\n ::MsRestAzure::ActiveDirectoryServiceSettings.get_azure_settings\n end\n end",
"def certificate_based_auth_configuration()\n return MicrosoftGraph::CertificateBasedAuthConfiguration::CertificateBasedAuthConfigurationRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def get_config()\n return @api.do_request(\"GET\", get_base_api_path() + \"/config\")\n end",
"def get_importers_configuration\n return @client.raw(\"get\", \"/config/importers/configuration\")\n end",
"def config\n \n # loads up config instance_var once if all environment variables are available, otherwise load up from YAML file.\n @config ||= if ENV['fb_client_id'] && ENV['fb_client_secret'] && ENV['fb_scope']\n {\n :client_id => ENV['fb_client_id'],\n :client_secret => ENV['fb_client_secret'],\n :scope => ENV['fb_scope']\n }\n else\n YAML.load_file(\"#{Rails.root}/config/facebook.yml\")[Rails.env].symbolize_keys\n end\n \n rescue Errno::ENOENT => e\n raise StandardError.new(\"config/facebook.yml could not be loaded.\")\n end",
"def connection_for_application\n oauth_client.client_credentials.get_token\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => \"https://login.microsoftonline.com\",\n :authorize_url => \"/common/oauth2/v2.0/authorize\",\n :token_url => \"/common/oauth2/v2.0/token\")\n # :authorize_url => \"/oauth2/v2.0/authorize\",\n # :token_url => \"/oauth2/v2.0/token\")\n # :authorize_url => \"/auth/office365/callback\",\n # :token_url => \"/oauth2/v2.0/token\"\n # )\n# /auth/office365/callback\n\n login_url = client.auth_code.authorize_url(:redirect_uri => office365_callback_url, :scope => SCOPES.join(' '))\n end",
"def openid_oauth(value = nil)\n rw_config(:openid_oauth, value, false)\n end",
"def config\n Grape::OAuth2.config\n end",
"def config(kb_tenant_id=nil)\n @@glob_config.merge(get_tenant_config(kb_tenant_id) || {})\n end",
"def get(base_url, options)\n System::GeneralConfiguration.new(\"#{base_url}/api/system/configuration\", options)\n end",
"def openid_options(value = nil)\n rw_config(:openid_options, value, {})\n end",
"def tenant\n return options.tenant if options.tenant\n fail StandardError, 'No tenant specified in AzureAD configuration.'\n end",
"def fetch_access_token options = {}\n c = options[:connection] || Faraday.default_connection\n retry_with_error do\n uri = target_audience ? COMPUTE_ID_TOKEN_URI : COMPUTE_AUTH_TOKEN_URI\n query = target_audience ? { \"audience\" => target_audience, \"format\" => \"full\" } : nil\n headers = { \"Metadata-Flavor\" => \"Google\" }\n resp = c.get uri, query, headers\n case resp.status\n when 200\n content_type = resp.headers[\"content-type\"]\n if content_type == \"text/html\"\n { (target_audience ? \"id_token\" : \"access_token\") => resp.body }\n else\n Signet::OAuth2.parse_credentials resp.body, content_type\n end\n when 404\n raise Signet::AuthorizationError, NO_METADATA_SERVER_ERROR\n else\n msg = \"Unexpected error code #{resp.status}\" \\\n \"#{UNEXPECTED_ERROR_SUFFIX}\"\n raise Signet::AuthorizationError, msg\n end\n end\n end",
"def oauth_options\n {\n consumer_key: client_id,\n consumer_secret: client_secret,\n token: access_token,\n token_secret: access_token_secret\n }\n end",
"def authentication_method_configurations()\n return MicrosoftGraph::AuthenticationMethodConfigurations::AuthenticationMethodConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def get_configuration(alias_param, intent, extra_parameters)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'alias', alias_param)\n\t\t\tclient.add_param(kparams, 'intent', intent)\n\t\t\tclient.add_param(kparams, 'extraParameters', extra_parameters)\n\t\t\tclient.queue_service_action_call('paymentgatewayprofile', 'getConfiguration', 'KalturaPaymentGatewayConfiguration', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def base_opts\n {\n client_id: '277ef29692f9a70d511415dc60592daf4cf2c6f6552d3e1b769924b2f2e2e6fe',\n client_secret: 'd6106f26e8ff5b749a606a1fba557f44eb3dca8f48596847770beb9b643ea352'\n }\n end",
"def default_config\n data = {\n 'acr_values' => 'http://idmanagement.gov/ns/assurance/loa/1',\n 'client_id' => 'urn:gov:gsa:openidconnect:sp:sinatra',\n }\n\n if LoginGov::Hostdata.in_datacenter?\n # EC2 deployment defaults\n\n env = LoginGov::Hostdata.env\n domain = LoginGov::Hostdata.domain\n\n if env == 'prod'\n data['idp_url'] = \"https://secure.#{domain}\"\n else\n data['idp_url'] = \"https://idp.#{env}.#{domain}\"\n end\n data['redirect_uri'] = \"https://sp-oidc-sinatra.#{env}.#{domain}/\"\n data['sp_private_key_path'] = \"aws-secretsmanager:#{env}/sp-oidc-sinatra/oidc.key\"\n data['redact_ssn'] = true\n else\n # local dev defaults\n data['idp_url'] = 'http://localhost:3000'\n data['redirect_uri'] = 'http://localhost:9292/'\n data['sp_private_key_path'] = demo_private_key_path\n data['redact_ssn'] = false\n end\n\n data\n end",
"def config\n Simple::OAuth2.config\n end",
"def fetch_entity_config\n @entity_config = GlobalConstant::CmsConfigurator.get_entity_config(@entity_type)\n end",
"def auth_settings\n {\n AuthZ:\n {\n type: 'oauth2',\n in: 'header',\n key: 'Authorization',\n value: \"Bearer #{access_token}\"\n },\n apiKeyAuth:\n {\n type: 'api_key',\n in: 'header',\n key: 'DD-API-KEY',\n value: api_key_with_prefix('apiKeyAuth')\n },\n appKeyAuth:\n {\n type: 'api_key',\n in: 'header',\n key: 'DD-APPLICATION-KEY',\n value: api_key_with_prefix('appKeyAuth')\n },\n }\n end",
"def endpoint_configuration\n return @endpoint_configuration\n end",
"def auth_settings\n {\n 'auth' =>\n {\n type: 'oauth2',\n in: 'header',\n key: 'Authorization',\n value: \"Bearer #{access_token}\"\n },\n }\n end",
"def get_options\n options = YAML.load_file(\n File.expand_path(\"#{ENV['HOME']}/.right_api_client/login.yml\")\n )\nend",
"def api_connector_configuration=(value)\n @api_connector_configuration = value\n end",
"def initialize(options = {})\n LinkedInConnect.load_config.each do |k, v|\n instance_variable_set(\"@#{k}\", v)\n end\n @consumer_options = {\n :site => @site,\n :request_token_path => @request_token_path,\n :authorize_path => @authorize_path,\n :access_token_path => @access_token_path,\n :oauth_callback => @oauth_callback\n }\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => \"https://login.microsoftonline.com\",\n :authorize_url => \"/common/oauth2/authorize\",\n :token_url => \"/common/oauth2/token\")\n\n login_url = client.auth_code.authorize_url(:redirect_uri => authorize_url)\n end",
"def client_id\n return options.client_id if options.client_id\n fail StandardError, 'No client_id specified in AzureAD configuration.'\n end",
"def endpoint_settings\n case environment.downcase\n when \"azureusgovernment\"\n ::MsRestAzure2::AzureEnvironments::AzureUSGovernment\n when \"azurechina\"\n ::MsRestAzure2::AzureEnvironments::AzureChinaCloud\n when \"azuregermancloud\"\n ::MsRestAzure2::AzureEnvironments::AzureGermanCloud\n when \"azure\"\n ::MsRestAzure2::AzureEnvironments::AzureCloud\n end\n end",
"def configure_oauth!(config)\n [\n { backend: :google_oauth2, id: \"id\", secret: \"secret\" },\n { backend: :open_id },\n { backend: :openid_connect },\n { backend: :github, id: \"client_id\", secret: \"client_secret\" },\n { backend: :gitlab, id: \"application_id\", secret: \"secret\" },\n { backend: :bitbucket, id: \"key\", secret: \"secret\" }\n ].each do |b|\n if b[:id]\n id = APP_CONFIG[\"oauth\"][b[:backend].to_s][b[:id]]\n secret = APP_CONFIG[\"oauth\"][b[:backend].to_s][b[:secret]]\n else\n id = nil\n secret = nil\n end\n\n configure_backend!(config, b[:backend], id, secret)\n end\nend",
"def oai_config\n blacklight_config.oai || {}\n end",
"def auth_oauth\n @attributes[:auth_oauth]\n end",
"def acquire_token\n token_acquire_url = TOKEN_ACQUIRE_URL.dup\n token_acquire_url['{authentication_endpoint}'] = @settings.authentication_endpoint\n token_acquire_url['{tenant_id}'] = @tenant_id\n\n url = URI.parse(token_acquire_url)\n\n connection = Faraday.new(:url => url, :ssl => MsRest.ssl_options) do |builder|\n builder.adapter Faraday.default_adapter\n end\n\n request_body = REQUEST_BODY_PATTERN.dup\n request_body['{resource_uri}'] = ERB::Util.url_encode(@settings.token_audience)\n request_body['{client_id}'] = ERB::Util.url_encode(@client_id)\n request_body['{username}'] = ERB::Util.url_encode(@username)\n request_body['{password}'] = ERB::Util.url_encode(@password)\n\n response = connection.get do |request|\n request.headers['content-type'] = 'application/x-www-form-urlencoded'\n request.body = request_body\n end\n\n fail AzureOperationError,\n 'Couldn\\'t login to Azure, please verify your tenant id, client id and username/password' unless response.status == 200\n\n response_body = JSON.load(response.body)\n @token = response_body['access_token']\n @token_expires_on = Time.at(Integer(response_body['expires_on']))\n @token_type = response_body['token_type']\n end",
"def oai_config\n blacklight_config.oai || {}\n end",
"def oai_config\n blacklight_config.oai || {}\n end",
"def endpoint_settings\n case environment.downcase\n when \"azureusgovernment\"\n ::MsRestAzure::AzureEnvironments::AzureUSGovernment\n when \"azurechina\"\n ::MsRestAzure::AzureEnvironments::AzureChinaCloud\n when \"azuregermancloud\"\n ::MsRestAzure::AzureEnvironments::AzureGermanCloud\n when \"azure\"\n ::MsRestAzure::AzureEnvironments::AzureCloud\n end\n end",
"def default_config\n data = {\n 'acr_values' => ENV['acr_values'] || 'http://idmanagement.gov/ns/assurance/ial/1',\n 'client_id' => ENV['client_id'] || 'urn:gov:gsa:openidconnect:sp:sinatra',\n 'mock_irs_client_id' => ENV['mock_irs_client_id'] ||\n 'urn:gov:gsa:openidconnect:sp:mock_irs',\n 'redirect_uri' => ENV['redirect_uri'] || 'http://localhost:9292/',\n 'sp_private_key_path' => ENV['sp_private_key_path'] || './config/demo_sp.key',\n 'redact_ssn' => true,\n 'cache_oidc_config' => true,\n }\n\n # EC2 deployment defaults\n\n env = ENV['idp_environment'] || 'int'\n domain = ENV['idp_domain'] || 'identitysandbox.gov'\n\n data['idp_url'] = ENV.fetch('idp_url', nil)\n unless data['idp_url']\n if env == 'prod'\n data['idp_url'] = \"https://secure.#{domain}\"\n else\n data['idp_url'] = \"https://idp.#{env}.#{domain}\"\n end\n end\n data['sp_private_key'] = ENV.fetch('sp_private_key', nil)\n\n data\n end",
"def configure\n Ros::Platform::Client.configure(client_config.to_h.merge(connection_type: connection_type))\n # Possible to configure service clients independently\n # Ros::IAM::Client.configure(scheme: 'http', host: 'localhost', port: 3001)\n Ros::Sdk::Credential.configure(access_key_id: access_key_id, secret_access_key: secret_access_key)\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n login_url = client.auth_code.authorize_url(:redirect_uri => authorize_url, :scope => SCOPES.join(' '))\n end",
"def oidc\n return unless @oidc\n raise(StandardError, OIDC_EMAIL_MISSING_ERROR) unless @oidc[:service_account_email]\n\n {\n service_account_email: @oidc[:service_account_email],\n audience: @oidc[:audience] || processor_host\n }\n end",
"def options_for_klient(options = {})\n user_tenant_options = Kaui.current_tenant_user_options(current_user, session)\n user_tenant_options.merge(options)\n user_tenant_options\n end",
"def mobile_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::MobileAppConfigurations::MobileAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def get_auth_token\n log_step \"start\", \"get_auth_token\"\n login_url = \"https://login.microsoft.com\"\n token_url = \"#{login_url}/#{@tenant}/oauth2/token?api-version=1.0\"\n body = {\n client_id: @client_id,\n client_secret: @client_secret,\n grant_type: 'client_credentials',\n resource: @resource\n }\n response = HTTParty.post \"#{token_url}\", body: body\n @access_token = response['access_token']\n log_step 'auth_token', @access_token\nend",
"def akamai_client\n\n unless File.exist?(@edgerc)\n @log.warn(\"\\t The configuration file '#{@edgerc}' does not exist or cannot be read.\")\n return nil\n end\n\n config = IniFile.load(@edgerc)\n\n if(config[@akamai_profile].empty?)\n @log.warn(\"\\t The configuration file '#{@edgerc}' does not contain a '[#{@akamai_profile}]' profile.\")\n return nil\n end\n\n api_config = config[@akamai_profile]\n api_endpoint = URI(\"https://#{api_config['host']}\")\n\n #\n # Currently we only support clearing the 'production' cache as we do not have a staging cache.\n #\n @fast_purge_api_endpoint = \"#{api_endpoint.to_s}/ccu/v3/invalidate/url/production\"\n\n api_client = Akamai::Edgegrid::HTTP.new(\n address = api_endpoint.host,\n port = api_endpoint.port\n )\n api_client.setup_edgegrid(\n client_token: api_config['client_token'],\n client_secret: api_config['client_secret'],\n access_token: api_config['access_token']\n )\n api_client.open_timeout = 20\n api_client.read_timeout = 20\n api_client\n\n end",
"def oauth_client\n if @oauth_client\n @oauth_client\n else\n conn ||= Faraday::Connection.new \\\n :url => \"https://api.gowalla.com\",\n :headers => default_headers\n\n oauth= OAuth2::Client.new(api_key, api_secret, oauth_options = {\n :site => 'https://api.gowalla.com',\n :authorize_url => 'https://gowalla.com/api/oauth/new',\n :access_token_url => 'https://gowalla.com/api/oauth/token'\n })\n oauth.connection = conn\n oauth\n end\n end",
"def index_configurations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.index_configurations ...'\n end\n # resource path\n local_var_path = '/users/me/configurations'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].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[:body] \n\n # return_type\n return_type = opts[:return_type] || 'UserConfigurationCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#index_configurations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_access_token\n @oauth_access_token = oauth_request.get_access_token\n @authenticated_user_uri = oauth_consumer.token_request_response[\"Content-Location\"]\n end",
"def load_config()\n Kitchenplan::Log.debug \"Loading configs from #{self.options[:config_dir]} ...\"\n #Kitchenplan::Log.debug self.platform.ohai.inspect\n self.config = Kitchenplan::Config.new(self.platform.ohai, parse_configs=true,config_path=self.options[:config_dir]).config()\n end",
"def openid_endpoint; end",
"def client_config\n cc = Settings.dig(:connection, connection_type)\n return cc unless host\n\n uhost = URI(host)\n cc.host = uhost.hostname\n cc.port = uhost.port\n cc.scheme = uhost.scheme\n cc\n end",
"def auth_bearer_aad\n response = HTTParty.get(\"https://login.microsoftonline.com/#{tenantId}/oauth2/v2.0/token\", {\n body: \"grant_type=client_credentials&client_id=#{clientId}\"+\n \"&client_secret=#{clientSecret}\"+\n \"&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default\"\n })\n \n parsed_json = JSON.parse response.read_body\n return parsed_json[\"access_token\"]\n end",
"def faraday_options\n cfg_get(:faraday_options)\n end",
"def setup_orcid_access_token\n @orcid_access_token = ENV['ORCID_ACCESS_TOKEN'] unless ENV['ORCID_ACCESS_TOKEN'].blank?\n if @orcid_access_token.blank?\n setup_faraday_conn if @faraday_conn.blank?\n response = @faraday_conn.post '/oauth/token', {\n :client_id => ENV['CLIENT_ID'],\n :client_secret => ENV['CLIENT_SECRET'],\n :scope => \"/read-public\",\n :grant_type => \"client_credentials\"\n }\n @orcid_access_token = JSON.parse(response.body)['access_token']##\n end\n end",
"def auth_settings\n {\n 'JWT' =>\n {\n type: 'oauth2',\n in: 'header',\n key: 'Authorization',\n value: \"Bearer #{access_token}\"\n },\n }\n end",
"def auth_settings\n {\n 'JWT' =>\n {\n type: 'oauth2',\n in: 'header',\n key: 'Authorization',\n value: \"Bearer #{access_token}\"\n },\n }\n end",
"def auth_settings\n {\n 'Bearer' =>\n {\n type: 'api_key',\n in: 'header',\n key: 'Authorization',\n value: api_key_with_prefix('Authorization')\n },\n 'Educator' =>\n {\n type: 'api_key',\n in: 'query',\n key: 'educator_slug',\n value: api_key_with_prefix('educator_slug')\n },\n }\n end",
"def client_configuration\n return @client_configuration\n end",
"def auth_config\n @authority_config ||= LINKED_DATA_AUTHORITIES_CONFIG[@authority_name]\n raise Qa::InvalidLinkedDataAuthority, \"Unable to initialize linked data authority '#{@authority_name}'\" if @authority_config.nil?\n @authority_config\n end",
"def authorize_client session_token\n base_url = \"#{APP_CONFIG['okta_base_url']}/oauth2/v1/authorize\"\n redirect_uri = \"#{APP_CONFIG['okta_openid_redirect_uri']}\"\n client_id = \"#{APP_CONFIG['okta_client_id']}\"\n scopes = [\"openid\", \"email\", \"groups\"].join(\"%20\")\n url = \"#{base_url}?sessionToken=#{session_token}&redirect_uri=#{redirect_uri}&response_type=id_token&client_id=#{client_id}&scope=#{scopes}&response_mode=fragment\"\n\n begin\n HttpClient.get(url)\n rescue HTTParty::RedirectionTooDeep => e\n open_id_token = e.response.header['location']\n end\n open_id_token.split('=').last\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n client.auth_code.authorize_url(:redirect_uri => REDIRECT_URI,\n :scope => SCOPES.join(' '))\n end",
"def get_conn_params\n\n # Excon.defaults[:read_timeout] = 10\n # Excon.defaults[:write_timeout] = 10\n # Excon.defaults[:ssl_verify_peer] = false\n\n params = {}\n open_rc = read_prop_file('/etc/openrc')\n provider = @options['provider']\n case provider\n when 'openstack'\n params[:provider] = provider\n params[:openstack_username] = @options['OS_USERNAME'] || open_rc['OS_USERNAME'] || ENV['OS_USERNAME']\n params[:openstack_api_key] = @options['OS_PASSWORD'] || open_rc['OS_PASSWORD'] || ENV['OS_PASSWORD']\n params[:openstack_auth_url] = (@options['OS_AUTH_URL'] || open_rc['OS_AUTH_URL'] || ENV['OS_AUTH_URL']).to_s + '/tokens'\n else\n exit_with_error \"Cloud provider: #{provider} not supported!\"\n end\n puts \"Cloud connection params: #{params}\" if @options['verbose']\n params\nend",
"def faraday_configuration\n @faraday_configuration ||= Faraday.new(:url => @management_console_endpoint) do |http|\n http.headers[:user_agent] = user_agent\n http.request :multipart\n http.request :url_encoded\n\n # Disabling SSL is essential for certain self-hosted Enterprise instances\n if self.connection_options[:ssl] && !self.connection_options[:ssl][:verify]\n http.ssl[:verify] = false\n end\n\n http.use Octokit::Response::RaiseError\n http.adapter Faraday.default_adapter\n end\n end",
"def openid_client_id; end",
"def client\n @client ||= OpenIDConnect::Client.new(\n identifier: @client_id,\n secret: @secret,\n redirect_uri: @redirect_url,\n realm: 'esdl-mapeditor',\n audience: @audience,\n authorization_endpoint: discovery.authorization_endpoint,\n token_endpoint: discovery.token_endpoint,\n userinfo_endpoint: discovery.userinfo_endpoint\n )\n end",
"def auth\n cfg_get(:auth)\n end",
"def set_oauth2_auth(client, secret, authorize_path, token_path, site = nil)\n FHIR.logger.info 'Configuring the client to use OpenID Connect OAuth2 authentication.'\n @use_oauth2_auth = true\n @use_basic_auth = false\n @security_headers = {}\n options = {\n site: site || @base_service_url,\n authorize_url: authorize_path,\n token_url: token_path,\n raise_errors: true\n }\n client = OAuth2::Client.new(client, secret, options)\n client.connection.proxy(proxy) unless proxy.nil?\n @client = client.client_credentials.get_token\n end",
"def api_config()\n AdwordsApi::ApiConfig\n end",
"def faraday_options\n cfg_get(:faraday_options)\n end",
"def options\n options = super\n\n options.merge(login: preferred_secret_key)\n end",
"def oauth_url\n @oauth_url || File.join(host, \"oauth20/token\")\n end",
"def all_merchant_configs\n profile.merchant_configs\n end",
"def access_token\n @config[\"token\"]\n end",
"def get_http_config\n http_conf = @opts['http'] || {}\n return http_conf\n end",
"def auth\n cfg_get(:auth)\n end",
"def client\n # Merge in authorize url if supplied\n options.authorize_params[:clientId] = options.client_id\n options.authorize_params[:redirect] = callback_url\n options.client_options[:authorize_url] = options.authorize_url if options.authorize_url.present?\n options.client_options[:site] = options.site if options.site.present?\n\n ::OAuth2::Client.new(\n options.client_id,\n options.client_secret,\n deep_symbolize(options.client_options)\n )\n end",
"def openid_redirect_uri; end",
"def load_configuration(conf_path, cert_path, key_path)\n return true if @@ConfigurationLoaded\n return false if !test_onboard_file(conf_path) or !test_onboard_file(cert_path) or !test_onboard_file(key_path)\n\n @@ProxyConfig = get_proxy_config(@@ProxyConfigFilePath)\n\n endpoint_lines = IO.readlines(conf_path).select{ |line| line.start_with?(\"OMS_ENDPOINT\")}\n if endpoint_lines.size == 0\n OMS::Log.error_once(\"Could not find OMS_ENDPOINT setting in #{conf_path}\")\n return false\n elsif endpoint_lines.size > 1\n OMS::Log.warn_once(\"Found more than one OMS_ENDPOINT setting in #{conf_path}, will use the first one.\")\n end\n\n begin\n endpoint_url = endpoint_lines[0].split(\"=\")[1].strip\n @@ODSEndpoint = URI.parse( endpoint_url )\n @@GetBlobODSEndpoint = @@ODSEndpoint.clone\n @@GetBlobODSEndpoint.path = '/ContainerService.svc/GetBlobUploadUri'\n @@NotifyBlobODSEndpoint = @@ODSEndpoint.clone\n @@NotifyBlobODSEndpoint.path = '/ContainerService.svc/PostBlobUploadNotification'\n rescue => e\n OMS::Log.error_once(\"Error parsing endpoint url. #{e}\")\n return false\n end\n\n begin\n diagnostic_endpoint_lines = IO.readlines(conf_path).select{ |line| line.start_with?(\"DIAGNOSTIC_ENDPOINT=\")}\n if diagnostic_endpoint_lines.size == 0\n # Endpoint to be inferred from @@ODSEndpoint\n @@DiagnosticEndpoint = @@ODSEndpoint.clone\n @@DiagnosticEndpoint.path = '/DiagnosticsDataService.svc/PostJsonDataItems'\n else\n if diagnostic_endpoint_lines.size > 1\n OMS::Log.warn_once(\"Found more than one DIAGNOSTIC_ENDPOINT setting in #{conf_path}, will use the first one.\")\n end\n diagnostic_endpoint_url = diagnostic_endpoint_lines[0].split(\"=\")[1].strip\n @@DiagnosticEndpoint = URI.parse( diagnostic_endpoint_url )\n end\n rescue => e\n OMS::Log.error_once(\"Error obtaining diagnostic endpoint url. #{e}\")\n return false\n end\n\n agentid_lines = IO.readlines(conf_path).select{ |line| line.start_with?(\"AGENT_GUID\")}\n if agentid_lines.size == 0\n OMS::Log.error_once(\"Could not find AGENT_GUID setting in #{conf_path}\")\n return false\n elsif agentid_lines.size > 1\n OMS::Log.warn_once(\"Found more than one AGENT_GUID setting in #{conf_path}, will use the first one.\")\n end\n\n begin\n @@AgentId = agentid_lines[0].split(\"=\")[1].strip\n rescue => e\n OMS::Log.error_once(\"Error parsing agent id. #{e}\")\n return false\n end\n\n File.open(conf_path).each_line do |line|\n if line =~ /^WORKSPACE_ID/\n @@WorkspaceId = line.sub(\"WORKSPACE_ID=\",\"\").strip\n end\n if line =~ /AZURE_RESOURCE_ID/\n # We have contract with AKS team about how to pass AKS specific resource id.\n # As per contract, AKS team before starting the agent will set environment variable \n # 'customResourceId'\n @@AzureResourceId = ENV['customResourceId']\n \n # Only if environment variable is empty/nil load it from imds and refresh it periodically.\n if @@AzureResourceId.nil? || @@AzureResourceId.empty? \n @@AzureResourceId = line.sub(\"AZURE_RESOURCE_ID=\",\"\").strip\n if @@AzureResourceId.include? \"Microsoft.ContainerService\"\n OMS::Log.info_once(\"Azure resource id in configuration file is for AKS. It will be used\") \n else\n Thread.new(&method(:update_azure_resource_id)) if @@AzureResIDThreadLock.try_lock\n end \n else\n OMS::Log.info_once(\"There is non empty value set for overriden-resourceId environment variable. It will be used\")\n end\n end\n if line =~ /OMSCLOUD_ID/\n @@OmsCloudId = line.sub(\"OMSCLOUD_ID=\",\"\").strip\n end\n if line =~ /^AGENT_GUID/\n @@AgentGUID = line.sub(\"AGENT_GUID=\",\"\").strip\n end\n if line =~ /^URL_TLD/\n @@URLTLD = line.sub(\"URL_TLD=\",\"\").strip\n end\n if line =~ /^LOG_FACILITY/\n @@LogFacility = line.sub(\"LOG_FACILITY=\",\"\").strip\n end\n if line =~ /UUID/\n @@UUID = line.sub(\"UUID=\",\"\").strip\n end\n end\n\n begin\n raw = File.read cert_path\n @@Cert = OpenSSL::X509::Certificate.new raw\n raw = File.read key_path\n @@Key = OpenSSL::PKey::RSA.new raw\n rescue => e\n OMS::Log.error_once(\"Error loading certs: #{e}\")\n return false\n end\n \n @@AzureRegion = get_azure_region_from_imds()\n if @@AzureRegion.nil? || @@AzureRegion.empty?\n OMS::Log.warn_once(\"Azure region value is not set. This must be onpremise machine\")\n @@AzureRegion = \"OnPremise\"\n end\n \n @@ConfigurationLoaded = true\n return true\n end",
"def targeted_managed_app_configurations()\n return MicrosoftGraph::DeviceAppManagement::TargetedManagedAppConfigurations::TargetedManagedAppConfigurationsRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def connect\n if connection_in_info?\n OpenStruct.new(info.ood_connection_info || {})\n else\n OpenStruct.new YAML.safe_load(connect_file.read)\n end\n end",
"def authentication_configuration\n return @authentication_configuration\n end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n end",
"def openid_client_secret; end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n end",
"def config_options\n # config_file_path = File.join(ENV['SHARED_CONFIG_ROOT'] || \"#{Rails.root}/config\", \"college_mapper.yml\")\n # @config_options ||= YAML::load(ERB.new((IO.read(config_file_path))).result)[(Rails.env)].symbolize_keys \n @config_options ||= API_KEYS['collegemapper'][Rails.env].symbolize_keys\n end",
"def configuration\n Rally.provider_configuration[name]\n end",
"def authorize_endpoint_url\n uri = URI(openid_config['authorization_endpoint'])\n uri.query = URI.encode_www_form(client_id: client_id,\n redirect_uri: callback_url,\n response_mode: response_mode,\n response_type: response_type,\n nonce: new_nonce)\n uri.to_s\n end",
"def config(file_name=nil)\n # Authorize.net configuration\n result = YAML.load_file(RAILS_ROOT + \"/config/#{file_name || config_file_name}\")[RAILS_ENV].symbolize_keys\n @@authorize_net_login_id = result[:login_id]\n @@authorize_net_transaction_key = result[:transaction_key]\n if result[:mode] == 'test'\n # Tell ActiveMerchant to use the Authorize.net sandbox\n ActiveMerchant::Billing::Base.mode = :test\n end\n result\n end",
"def config(file_name=nil)\n # Authorize.net configuration\n result = YAML.load_file(RAILS_ROOT + \"/config/#{file_name || config_file_name}\")[RAILS_ENV].symbolize_keys\n @@payflow_pro_login = result[:login]\n @@payflow_pro_password = result[:password]\n @@payflow_pro_partner = result[:partner]\n @@payflow_pro_certification_id = result[:certification_id]\n if result[:mode] == 'test'\n # Tell ActiveMerchant to use the Payflow Pro sandbox\n ActiveMerchant::Billing::Base.mode = :test\n end\n result\n end"
] |
[
"0.6742541",
"0.59611785",
"0.59562093",
"0.59076923",
"0.576962",
"0.56634927",
"0.5581978",
"0.5386093",
"0.5324064",
"0.53184986",
"0.5286447",
"0.52467173",
"0.52033466",
"0.51805925",
"0.5164027",
"0.51012015",
"0.50923127",
"0.50414926",
"0.50340885",
"0.50290364",
"0.49885148",
"0.49809137",
"0.49703917",
"0.49646196",
"0.49469554",
"0.4943232",
"0.4942151",
"0.49413893",
"0.4931331",
"0.4929279",
"0.4914606",
"0.49114832",
"0.49112666",
"0.48803845",
"0.48784247",
"0.4859045",
"0.48344678",
"0.48176908",
"0.4812804",
"0.4807526",
"0.48049548",
"0.48039874",
"0.4803649",
"0.47890225",
"0.47866103",
"0.47861856",
"0.47861856",
"0.476619",
"0.4762564",
"0.47620374",
"0.47586378",
"0.4748744",
"0.47288695",
"0.47213918",
"0.46840137",
"0.4682464",
"0.46821788",
"0.4680604",
"0.46787965",
"0.46786395",
"0.46780193",
"0.4675041",
"0.4668296",
"0.46674335",
"0.4666907",
"0.46562132",
"0.46562132",
"0.46460775",
"0.46439478",
"0.4641641",
"0.4635424",
"0.46338415",
"0.46267587",
"0.46266812",
"0.46247515",
"0.4623852",
"0.46226054",
"0.46195757",
"0.4615038",
"0.46138182",
"0.46133012",
"0.46102354",
"0.46072143",
"0.4606973",
"0.46060473",
"0.46055895",
"0.459565",
"0.45925918",
"0.458891",
"0.45832682",
"0.4576645",
"0.45765048",
"0.45710468",
"0.4565318",
"0.45634738",
"0.455443",
"0.45525852",
"0.45515904",
"0.45484602",
"0.45305339"
] |
0.7441075
|
0
|
Generates a new nonce for one time use. Stores it in the session so multiple users don't share nonces. All nonces should be generated by this method.
|
def new_nonce
session['omniauth-azure-activedirectory.nonce'] = SecureRandom.uuid
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def nonce\n @nonce ||= Digest::SHA1.hexdigest random_string + timestamp\n end",
"def nonce\n @nonce ||= Digest::SHA1.hexdigest random_string + timestamp\n end",
"def nonce\n rand(1_500_000_000)\n end",
"def nonce\n ((Time.now.to_f * 1000000).to_i << 10).to_s\n end",
"def gen_nonce\n Time.now.utc.to_i.to_s\n end",
"def nonce\n Array.new( 5 ) { rand(256) }.pack('C*').unpack('H*').first\n end",
"def generate_cnonce\n\n Digest::MD5.hexdigest(\"%x\" % (Time.now.to_i + rand(65535)))\n end",
"def generate_nonce\n secret_box = RbNaCl::SecretBox.new(key)\n self.nonce = RbNaCl::Random.random_bytes(secret_box.nonce_bytes)\n self.nonce = Base64.encode64(self.nonce)\n end",
"def nonce\n Array.new( 5 ) { rand(256) }.pack('C*').unpack('H*').first\n end",
"def generate_nonce(time = Time.now)\n return Digest::MD5.hexdigest( time )\n end",
"def nonce(time = Time.now)\n t = time.to_i\n hashed = [t, secret_key]\n digest = ::Digest::MD5.hexdigest(hashed.join(\":\"))\n ActiveSupport::Base64.encode64(\"#{t}:#{digest}\").gsub(\"\\n\", '')\n end",
"def cnonce\n SecureRandom.hex 16\n end",
"def generate_token(client_nonce)\n generation_time = time_to_block(Time.now.to_i)\n encryptor(client_nonce).encode(generation_time, 0)\n end",
"def nonce; end",
"def nonce(secret_key, time = T.unsafe(nil)); end",
"def nonce_state\n super\n end",
"def use_nonce(server_url, timestamp, salt)\n return false if any_nonces?(server_url, timestamp, salt) || delta_beyond_skew?(timestamp)\n Nonce.create(:server_url => server_url, :timestamp => timestamp, :salt => salt)\n return true\n end",
"def content_security_policy_nonce_generator=(_arg0); end",
"def content_security_policy_nonce_generator=(_arg0); end",
"def nonce_bytes\n NONCEBYTES\n end",
"def nonce=(_arg0); end",
"def use_nonce(server_url, timestamp, salt)\n return false if (timestamp - Time.now.to_i).abs > Nonce.skew\n params = [timestamp, salt, targetize(server_url)]\n return false if OpenidNonce.exists_by_target?(*params)\n return create_nonce(server_url, timestamp, salt)\n end",
"def generate_token\n self.token = loop do\n random_token = SecureRandom.base58(UID_LENGTH)\n break random_token unless Session.exists?(token: random_token)\n end\n end",
"def use_nonce(server_url, timestamp, salt)\n return false if (timestamp - Time.now.to_i).abs > Nonce.skew\n ts = timestamp.to_s # base 10 seconds since epoch\n nonce_key = key_prefix + 'N' + server_url + '|' + ts + '|' + salt\n result = @cache_client.add(nonce_key, '', expiry(Nonce.skew + 5))\n return !!(result =~ /^STORED/)\n end",
"def nonce\n auth_info[\"nonce\"] || \"\"\n end",
"def content_security_policy_nonce_generator; end",
"def content_security_policy_nonce_generator; end",
"def make_token\n secure_digest(Time.now, (1..10).map{ rand.to_s })\n end",
"def generate_utoken\n self.utoken = loop do\n random_token = SecureRandom.base58(UTOKEN_LENGTH)\n break random_token unless Session.exists?(utoken: random_token)\n end\n end",
"def api_nonce\n\t\t\t8.times.map { [*'0'..'9'].sample }.join\n\t\tend",
"def nonce_timestamp(tolerance = 5)\n Time.now.to_i + tolerance\n end",
"def generate_token\n self.perishable_token = Digest::MD5.hexdigest(\"#{Time.now}\")\n end",
"def generate_token\n self.token = secure_digest(Time.now, candidate_id)\n end",
"def store_nonce(nonce)\n raise NotImplementedError\n end",
"def generate_token\n @token = SecureRandom.base58(10)\n self.update(token: @token)\n end",
"def use_nonce(nonce)\n raise NotImplementedError\n end",
"def generate_cookie\n cookies[:credit_request] = SecureRandom.hex(32)\n end",
"def test_nonce_not_current\n string = \"0123456789ABCDEF\"\n\n nonce1 = OauthNonce.remember(string, Time.now.to_i - 86430)\n assert_equal false, nonce1, \"Nonces over a day in the past should be rejected\"\n\n nonce2 = OauthNonce.remember(string, Time.now.to_i - 86370)\n assert_not_equal false, nonce2, \"Nonces under a day in the past should be rejected\"\n end",
"def cleanup_nonces\n now = Time.now.to_i\n nonces = OpenidNonce.all\n ids = nonces.collect { |n| n.id if (n.timestamp - now).abs > Nonce.skew }\n OpenidNonce.delete ids.compact\n end",
"def create_new_id\n require 'securerandom'\n begin\n # by OpenSSL, or system provided entropy pool\n session_id = SecureRandom.hex(16)\n rescue NotImplementedError\n # never happens on modern systems\n require 'digest'\n d = Digest('SHA512').new\n now = Time::now\n d.update(now.to_s)\n d.update(String(now.usec))\n d.update(String(rand(0)))\n d.update(String($$))\n d.update('foobar')\n session_id = d.hexdigest[0, 32]\n end\n session_id\n end",
"def generate_token\n begin\n self.token = Digest::SHA1.hexdigest([Time.now, rand].join)\n end while Invitation.exists?(:token => self.token)\n end",
"def generate_salt\n return hash(\n Time.now.to_s,\n rand(999_999_999).to_s,\n Time.now.usec\n )\n end",
"def generate_token\n self.token = UniqueToken.generate\n end",
"def create_unique_id\n\t\tself.unique_id = loop do\n\t\t\trandom_token = SecureRandom.urlsafe_base64\n\t\t\tbreak random_token unless User.exists?(unique_id: random_token)\n\t\tend\n\tend",
"def new_account_number\n return rand(99999999)\n end",
"def new_account_number\n return rand(99999999)\n end",
"def generate_secure_id(overwrite = false)\n token = nil\n loop do\n token = SecureRandom.urlsafe_base64\n break unless Algorithm.exists?(secure_id: token)\n end\n self.secure_id = token if (self.secure_id == nil || overwrite)\n end",
"def generate_token\n self.update({:token => SecureRandom.hex})\n end",
"def generate_token!\n self.token = SecureRandom.hex\n save!\n end",
"def generate_salt\n Digest.hexencode(Digest::SHA1.digest(\n \"#{rand(2 ** 128) * ( Time.now.to_i * Process.pid)}\"))\n end",
"def find_nonce(blob)\r\n $status = \"Mining Started\"\r\n puts \"Mining Started\".blue\r\n start_time = Time.now\r\n nonce = \"0\"\r\n loop do\r\n nonce = rand(0..9999999999).to_s\r\n hash = Digest::SHA256.new.hexdigest(blob + nonce)\r\n break if (hash.start_with?(\"0\" * NONCE_ZEROES))\r\n end\r\n end_time = Time.now\r\n $status = \"Mining Ends in #{end_time - start_time} seconds\"\r\n puts \"Mining Ends in #{end_time - start_time} seconds\".blue\r\n return nonce\r\nend",
"def scoped_nonce(nonce)\n \"#{@consumer_key}-#{nonce}\"\n end",
"def private_generate_token\n begin\n #self.access_id = SecureRandom.base64(40)\n\t self.access_id = SecureRandom.hex(40)\n end while self.class.exists?(access_id: access_id)\n end",
"def create_new_salt\n self.salt = Digest::SHA256.hexdigest(Time.now.to_s + rand.to_s)\n end",
"def create_new_salt\n self.salt = Digest::SHA256.hexdigest(Time.now.to_s + rand.to_s)\n end",
"def generate_token\n self.token = Digest::SHA1.hexdigest([self.workplace_id, self.institute.id, Time.now, rand].join)\n end",
"def expired_token_generator(nick_id)\n JsonWebToken.encode({ nick_id: nick_id }, (Time.now.to_i - 10))\n end",
"def generate_identity\n self.uid ||= OpenSSL::Random.random_bytes(16).unpack('H*').first\n self.secret ||= OpenSSL::Random.random_bytes(32).unpack('H*').first\n true\n end",
"def generate_token\n UUIDTools::UUID.random_create.to_s\n end",
"def generate_token\n\t\tself.token = SecureRandom.hex\n end",
"def generate_digest\n Digest::SHA512.hexdigest(\"#{Time.now.usec}#{rand(100)}#{Session.secret}\")\n end",
"def generate_token\n self.token ||= SecureRandom.hex(16)\n end",
"def generate_token\n token_gen = SecureRandom.hex\n self.token = token_gen\n token_gen\n end",
"def generate_single_access_token\n self.single_access_token ||= UUIDTools::UUID.random_create\n end",
"def regenerate\n self.token = UUIDTools::UUID.random_create.to_s\n reset_timer\n self.token\n end",
"def generate_code\n self.code = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{user_id}--#{rand(256)}\")[0,32]\n end",
"def generate_token\n @raw_token = Doorkeeper::OAuth::Helpers::UniqueToken.generate\n secret_strategy.store_secret(self, :token, @raw_token)\n end",
"def generate_token\n self.token ||= loop do\n random_token = SecureRandom.urlsafe_base64(nil, false)\n break random_token unless self.class.exists?(token: random_token)\n end\n end",
"def uniqid\n SecureRandom.hex(32)\n end",
"def uniqid\n SecureRandom.hex(32)\n end",
"def generate_mfa_secret!\n transaction do\n update!(mfa_secret: SecureRandom.hex(16))\n Array.new(10) { nonce_tokens.build.save! }\n end\n end",
"def generate_security_token\n self.security_token = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}--#{email}--#{salt}--\")\n end",
"def generate_csrf_token\n SecureRandom.hex(32)\n end",
"def generate_salt\n @salt = self.object_id.to_s + rand.to_s\n end",
"def generate_token\n\t\tUUIDTools::UUID.timestamp_create.to_s\n\tend",
"def generate_salt\n Digest::SHA1.hexdigest(Time.now.to_f.to_s)\n end",
"def store_nonce(nonce)\n filename = @nonce_dir.join(nonce)\n File.open(filename, \"w\").close\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def generate_access_token\n self.access_token = Digest::SHA1.hexdigest(\"#{random_salt}#{Time.now.to_i}\")\n end",
"def create_share_token\n # Don't update it if you don't need to! We never want this to change\n self.share_token = SecureRandom.hex(13) unless share_token\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def generate_token\n SecureRandom.hex(10)\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end",
"def new_token\n SecureRandom.urlsafe_base64\n end"
] |
[
"0.7854984",
"0.7854984",
"0.7837371",
"0.7607155",
"0.7529376",
"0.7508704",
"0.75055224",
"0.7451894",
"0.7424053",
"0.7258386",
"0.7133276",
"0.70351195",
"0.70284104",
"0.6833875",
"0.66902983",
"0.6578251",
"0.6471142",
"0.64180654",
"0.64180654",
"0.6402287",
"0.63667166",
"0.63228947",
"0.62244254",
"0.61956316",
"0.619112",
"0.6161644",
"0.6161644",
"0.6130915",
"0.6115473",
"0.6051605",
"0.60509044",
"0.6017892",
"0.5968505",
"0.59374905",
"0.5926115",
"0.58704925",
"0.58681905",
"0.57999647",
"0.57910246",
"0.5763185",
"0.57586944",
"0.5730116",
"0.57241946",
"0.57137805",
"0.5708353",
"0.5708353",
"0.57001406",
"0.5696578",
"0.56878656",
"0.5675598",
"0.5674703",
"0.5665782",
"0.5657792",
"0.5651828",
"0.5651828",
"0.5650187",
"0.56477064",
"0.5639572",
"0.56228155",
"0.56164026",
"0.5615005",
"0.5611615",
"0.5610709",
"0.56105036",
"0.56043684",
"0.55914176",
"0.5574928",
"0.5573656",
"0.55549717",
"0.55549717",
"0.55529994",
"0.5550263",
"0.5547876",
"0.5541501",
"0.554079",
"0.55391914",
"0.5527294",
"0.5527058",
"0.5527058",
"0.55262417",
"0.55227363",
"0.55227363",
"0.55227363",
"0.5521712",
"0.55215937",
"0.55212575",
"0.5519516",
"0.5519516",
"0.5519516",
"0.5519516",
"0.5519516",
"0.5519516",
"0.5519516",
"0.5519516",
"0.5519516",
"0.5519516",
"0.5519516",
"0.5519516",
"0.5519516",
"0.5519516"
] |
0.7126692
|
11
|
A memoized version of fetch_openid_config.
|
def openid_config
@openid_config ||= fetch_openid_config
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fetch_openid_config\n JSON.parse(Net::HTTP.get(URI(openid_config_url)))\n rescue JSON::ParserError\n raise StandardError, 'Unable to fetch OpenId configuration for ' \\\n 'AzureAD tenant.'\n end",
"def oidc_configuration\n proxy&.oidc_configuration || OIDCConfiguration.new\n end",
"def config\n @config ||= nil\n return @config unless @config.nil?\n @config = app_config.find_config config_key\n @config.freeze\n @config\n end",
"def fetch_account_config(expiration = 15.minutes)\n key = [\"pipeline_dependencies_fetchappconfig\", @app_id, @account.id, @attribute]\n Rails.cache.fetch(key, expires_in: expiration) do\n config = Apps::AccountConfig.joins(:account).where(\n type: \"Apps::AccountConfig\", account_id: @account.self_and_ancestors.select(:id),\n app_id: @app_id\n ).order(\"accounts.path DESC\").first&.merged_config\n if config.nil?\n app_template = App.find_by(id: @app_id)&.configuration_type\n config = APP_CONFIGS[app_template]\n end\n config = config&.dig(@attribute)\n\n process_app_config(config)\n end\n end",
"def get_configuration(etag = \"\", retries = 0)\n fetch_response = _fetch(etag)\n\n # If there wasn't a config change, we return the response.\n if !fetch_response.is_fetched()\n return fetch_response\n end\n\n preferences = fetch_response.entry.config.fetch(PREFERENCES, nil)\n if preferences === nil\n return fetch_response\n end\n\n base_url = preferences.fetch(BASE_URL, nil)\n\n # If the base_url is the same as the last called one, just return the response.\n if base_url.equal?(nil) || @_base_url == base_url\n return fetch_response\n end\n\n redirect = preferences.fetch(REDIRECT, nil)\n # If the base_url is overridden, and the redirect parameter is not 2 (force),\n # the SDK should not redirect the calls, and it just has to return the response.\n if @_base_url_overridden && redirect != RedirectMode::FORCE_REDIRECT\n return fetch_response\n end\n\n # The next call should use the base_url provided in the config json\n @_base_url = base_url\n\n # If the redirect property == 0 (redirect not needed), return the response\n if redirect == RedirectMode::NO_REDIRECT\n # Return the response\n return fetch_response\n end\n\n # Try to download again with the new url\n\n if redirect == RedirectMode::SHOULD_REDIRECT\n @log.warn(3002, \"The `dataGovernance` parameter specified at the client initialization is not in sync with the preferences on the ConfigCat Dashboard. \" \\\n \"Read more: https://configcat.com/docs/advanced/data-governance/\")\n end\n\n # To prevent loops we check if we retried at least 3 times with the new base_url\n if retries >= 2\n @log.error(1104, \"Redirection loop encountered while trying to fetch config JSON. Please contact us at https://configcat.com/support/\")\n return fetch_response\n end\n\n # Retry the config download with the new base_url\n return get_configuration(etag, retries + 1)\n end",
"def cache_config\n @cached = {}\n\n @lookup.reverse.each do |c|\n c.each {|k, v| @cached[k] = config_merge(@cached[k] || {}, v) }\n end\n end",
"def get_config_data(name)\n logger.debug \"get_config_data(#{name.inspect})\"\n\n name = name.to_s\n unless result = self.cache_hash[name]\n result = self.cache_hash[name] =\n make_indifferent(\n merge_hashes(\n load_config_files(name)\n )\n )\n logger.debug \"get_config_data(#{name.inspect}): reloaded\"\n end\n\n result\n end",
"def credential_config_key\n api_url == DEFAULT_GITHUB_API_BASE_URL ?\n DEFAULT_CREDENTIAL_CONFIG_KEY : (@credential_config_key || DEFAULT_CREDENTIAL_CONFIG_KEY)\n end",
"def get_hash()\n\t\t\treturn @config.clone()\n\t\tend",
"def cache_configurations(on=true)\n @configurations = nil\n @configurations = self.configurations if on\n end",
"def default_config\n data = {\n 'acr_values' => ENV['acr_values'] || 'http://idmanagement.gov/ns/assurance/ial/1',\n 'client_id' => ENV['client_id'] || 'urn:gov:gsa:openidconnect:sp:sinatra',\n 'mock_irs_client_id' => ENV['mock_irs_client_id'] ||\n 'urn:gov:gsa:openidconnect:sp:mock_irs',\n 'redirect_uri' => ENV['redirect_uri'] || 'http://localhost:9292/',\n 'sp_private_key_path' => ENV['sp_private_key_path'] || './config/demo_sp.key',\n 'redact_ssn' => true,\n 'cache_oidc_config' => true,\n }\n\n # EC2 deployment defaults\n\n env = ENV['idp_environment'] || 'int'\n domain = ENV['idp_domain'] || 'identitysandbox.gov'\n\n data['idp_url'] = ENV.fetch('idp_url', nil)\n unless data['idp_url']\n if env == 'prod'\n data['idp_url'] = \"https://secure.#{domain}\"\n else\n data['idp_url'] = \"https://idp.#{env}.#{domain}\"\n end\n end\n data['sp_private_key'] = ENV.fetch('sp_private_key', nil)\n\n data\n end",
"def openid_config_url\n \"https://login.windows.net/#{tenant}/.well-known/openid-configuration\"\n end",
"def get_config\n {}.update(local_config)\nend",
"def config\n @config ||= load_config\n end",
"def default_config\n data = {\n 'acr_values' => 'http://idmanagement.gov/ns/assurance/loa/1',\n 'client_id' => 'urn:gov:gsa:openidconnect:sp:sinatra',\n }\n\n if LoginGov::Hostdata.in_datacenter?\n # EC2 deployment defaults\n\n env = LoginGov::Hostdata.env\n domain = LoginGov::Hostdata.domain\n\n if env == 'prod'\n data['idp_url'] = \"https://secure.#{domain}\"\n else\n data['idp_url'] = \"https://idp.#{env}.#{domain}\"\n end\n data['redirect_uri'] = \"https://sp-oidc-sinatra.#{env}.#{domain}/\"\n data['sp_private_key_path'] = \"aws-secretsmanager:#{env}/sp-oidc-sinatra/oidc.key\"\n data['redact_ssn'] = true\n else\n # local dev defaults\n data['idp_url'] = 'http://localhost:3000'\n data['redirect_uri'] = 'http://localhost:9292/'\n data['sp_private_key_path'] = demo_private_key_path\n data['redact_ssn'] = false\n end\n\n data\n end",
"def config\n @config ||= read_config\n end",
"def reference_book_configurations()\n return Rails.cache.fetch(\"odsa_reference_book_configs\", expires_in: 6.hours) do\n config_dir = File.join(\"public\", \"OpenDSA\", \"config\")\n base_url = request.protocol + request.host_with_port + \"/OpenDSA/config/\"\n configs = []\n Dir.foreach(config_dir) do |entry|\n if entry.include?(\"_generated.json\") or not File.extname(entry) == '.json'\n next\n end\n url = base_url + File.basename(entry)\n begin\n title = JSON.parse(File.read(File.join(config_dir, entry)))[\"title\"]\n configs << {\n title: title,\n name: File.basename(entry, '.json'),\n url: url,\n }\n rescue\n error = Error.new(:class_name => 'book_config_parse_fail',\n :message => \"Failed to parse #{entry}\")\n error.save!\n end\n end\n configs.sort_by! { |x| x[:title] }\n end\n end",
"def config(key, defval=nil, store=config_store)\n return store.transaction { store.fetch(key, defval) }\nend",
"def omniauth\n Hashie::Mash.new auth_hash\n end",
"def facebook_auth_cache\n self.auth_profiles.where(provider: 'facebook').first\n end",
"def config\n \n # loads up config instance_var once if all environment variables are available, otherwise load up from YAML file.\n @config ||= if ENV['fb_client_id'] && ENV['fb_client_secret'] && ENV['fb_scope']\n {\n :client_id => ENV['fb_client_id'],\n :client_secret => ENV['fb_client_secret'],\n :scope => ENV['fb_scope']\n }\n else\n YAML.load_file(\"#{Rails.root}/config/facebook.yml\")[Rails.env].symbolize_keys\n end\n \n rescue Errno::ENOENT => e\n raise StandardError.new(\"config/facebook.yml could not be loaded.\")\n end",
"def openid_oauth(value = nil)\n rw_config(:openid_oauth, value, false)\n end",
"def openid_options(value = nil)\n rw_config(:openid_options, value, {})\n end",
"def configure_oauth!(config)\n [\n { backend: :google_oauth2, id: \"id\", secret: \"secret\" },\n { backend: :open_id },\n { backend: :openid_connect },\n { backend: :github, id: \"client_id\", secret: \"client_secret\" },\n { backend: :gitlab, id: \"application_id\", secret: \"secret\" },\n { backend: :bitbucket, id: \"key\", secret: \"secret\" }\n ].each do |b|\n if b[:id]\n id = APP_CONFIG[\"oauth\"][b[:backend].to_s][b[:id]]\n secret = APP_CONFIG[\"oauth\"][b[:backend].to_s][b[:secret]]\n else\n id = nil\n secret = nil\n end\n\n configure_backend!(config, b[:backend], id, secret)\n end\nend",
"def find_configurations\n @configurations = @user.configurations\n @config_by_key = @configurations.inject({}) do |map, cfg|\n values = map[cfg.api_key] || []\n values << cfg\n map[cfg.api_key] = values\n map\n end\n end",
"def server_config\n \tRails.cache.fetch(\"tmdb/server_config\", expires_in: 24.hours) do\n \t\tget_serv_config\n\t\tend\n\tend",
"def get_config()\n return @api.do_request(\"GET\", get_base_api_path() + \"/config\")\n end",
"def config\n @config ||= {}\n end",
"def config\n @config ||= {}\n end",
"def config\n XConfig::Core.fetch(self)\n end",
"def auto_config\n @auto_config ||= {}\n end",
"def auto_config\n @auto_config ||= {}\n end",
"def cached_access_token(config)\n File.read(config.access_token_filename).chomp\n end",
"def independent_config\n initial_config.deep_merge(persistent_config_hash)\n end",
"def get_idp_metadata\n return false if @settings.idp_metadata.nil?\n # Look up the metdata in cache first\n id = Digest::MD5.hexdigest(@settings.idp_metadata)\n unless @@cache[id].blank?\n Logging.debug \"IdP metadata cache used for #{@settings.idp_metadata}\"\n doc_noko = @@cache[id] \n else #save in cache\n response = fetch(@settings.idp_metadata)\n #meta_text = response.body\n #testo_response = meta_text.sub!(' xmlns:xml=\"http://www.w3.org/XML/1998/namespace\"', '') da errori\n #uso nokogiri per cercare il certificato, uso la funzione che rimuove tutti i namespace \n doc_noko = Nokogiri::XML(response.body.gsub(/\\n/, \"\").gsub(/\\t/, \"\")) #modifica per poste\n doc_noko.remove_namespaces!\n #save\n @@cache[id] = doc_noko\n end\n extract_certificate(doc_noko)\n doc_rexml = REXML::Document.new(doc_noko.to_xml)\n return doc_rexml\n\n \n # USE OF CACHE WITH CERTIFICATE\n # lookup = @cache.read(id)\n # if lookup != nil\n # Logging.debug \"IdP metadata cached lookup for #{@settings.idp_metadata}\"\n # doc = REXML::Document.new( lookup )\n # extract_certificate( doc )\n # return doc\n # end\n \n # Logging.debug \"IdP metadata cache miss on #{@settings.idp_metadata}\"\n # # cache miss\n # if File.exists?(@settings.idp_metadata)\n # fp = File.open( @settings.idp_metadata, \"r\")\n # meta_text = fp.read\n # else\n # uri = URI.parse(@settings.idp_metadata)\n # if uri.scheme == \"http\"\n # response = Net::HTTP.get_response(uri)\n # meta_text = response.body\n # elsif uri.scheme == \"https\"\n # http = Net::HTTP.new(uri.host, uri.port)\n # http.use_ssl = true\n # # Most IdPs will probably use self signed certs\n # #http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n # http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n # get = Net::HTTP::Get.new(uri.request_uri)\n # response = http.request(get)\n # meta_text = response.body\n # end\n # end\n # # Add it to the cache\n # @cache.write(id, meta_text, @settings.idp_metadata_ttl )\n # doc = REXML::Document.new( meta_text )\n # extract_certificate(doc)\n # return doc\n end",
"def config\n (null_config? ? NoConfig.instance : actual_config)\n end",
"def fetch(request_id: self.class.new_req_id)\n # Token base URI may have changed after the class was loaded.\n self.class.base_uri(Token.base_uri)\n public_key = @cache_store.fetch(cache_key, cache_options) do\n opts = { format: :plain, headers: { 'X-Request-Id' => request_id } }\n response = self.class.get('/oauth/keys', opts)\n self.class.handle_response(response)\n end\n OpenSSL::PKey.read(public_key)\n end",
"def git_config\n unless @git_config\n # Read @git_config from local git config.\n @git_config = { }\n config_list = git_call('config --list', false)\n config_list.split(\"\\n\").each do |line|\n key, value = line.split('=')\n @git_config[key] = value\n end\n end\n @git_config\n end",
"def auth_hash\n @auth_hash ||= request.env['omniauth.auth']\n end",
"def fetch!\n cm = @api.api('v1').resource('configmaps', namespace: @ns).get(@name)\n @_current = cm.data[@key]\n end",
"def get_actual_config\n @config\n end",
"def actual_config\n Config.instance\n end",
"def configuration(gem=nil)\n key = gem ? gem.to_s : nil #Dir.pwd\n cache[key] ||= Configuration.load(:from=>gem)\n end",
"def config\n @_config ||= Config.new\n yield @_config if block_given?\n @_config\n end",
"def config\n Simple::OAuth2.config\n end",
"def config_default\n lock(:c) do\n @cache[:c][:default] ||= config_new\n end\n end",
"def config\n @config ||= Config.new\n end",
"def config\n @config ||= Config.new\n end",
"def auth_hash\n @auth_hash ||= request.env['omniauth.auth']\n end",
"def retriable_configuration\n Take2::Configuration::CONFIG_ATTRS.each_with_object({}) do |key, hash|\n hash[key] = send(key)\n end\n end",
"def config_get(id)\n Configuration.get(id)\n end",
"def fetch_config\n Rails.logger.debug \"Loading #{@file}::#{@env}\" if Object.const_defined?('Rails') && Rails.logger.present?\n YAML::load_file(@file)[@env.to_s]\n end",
"def authlogic_ext_config\n @authlogic_ext_config ||= {}\n end",
"def defaults\n return @config if @config\n\n @config = Configatron::Store.new\n file_path = File.expand_path('../../../config/xpaths.yml', __FILE__)\n hash_config = YAML::load_file(file_path)\n\n @config.configure_from_hash(hash_config)\n @config.lock!\n @config\n end",
"def owncloud_config\n @owncloud_config ||= OwncloudCookbook::Config.new(owncloud_config_file)\n end",
"def openid_client_secret; end",
"def config\n independent_config.deep_merge(strong_parent_config).deep_merge(strong_session_config)\n end",
"def config_store; end",
"def get_config\n\t\tend",
"def fetch_entity_config\n @entity_config = GlobalConstant::CmsConfigurator.get_entity_config(@entity_type)\n end",
"def configure_cache; end",
"def config\n @config ||= OpenStruct.new(YAML.load_file(self.config_path))\n end",
"def config(file_name=nil)\n # Authorize.net configuration\n result = YAML.load_file(RAILS_ROOT + \"/config/#{file_name || config_file_name}\")[RAILS_ENV].symbolize_keys\n @@authorize_net_login_id = result[:login_id]\n @@authorize_net_transaction_key = result[:transaction_key]\n if result[:mode] == 'test'\n # Tell ActiveMerchant to use the Authorize.net sandbox\n ActiveMerchant::Billing::Base.mode = :test\n end\n result\n end",
"def openid_consumer\n @openid_consumer ||= OpenID::Consumer.new(session, ActiveRecordStore.new)\n end",
"def identity_hash\n request.env['omniauth.auth']\n end",
"def app_config_key\n return @app_config_key\n end",
"def auth_config\n @authority_config ||= LINKED_DATA_AUTHORITIES_CONFIG[@authority_name]\n raise Qa::InvalidLinkedDataAuthority, \"Unable to initialize linked data authority '#{@authority_name}'\" if @authority_config.nil?\n @authority_config\n end",
"def autofill_from_config\n self.pid ||= Config.credentials[:PID] if self.respond_to?(:pid=)\n self.pak ||= Config.credentials[:PAK] if self.respond_to?(:pak=)\n \n # Note: URLs are optional fields, but prefilling from config anyway\n self.cancel_url ||= Config.endpoints[:cancel] if self.respond_to?(:cancel_url=)\n self.success_url ||= Config.endpoints[:success] if self.respond_to?(:success_url=)\n self.failure_url ||= Config.endpoints[:failure] if self.respond_to?(:failure_url=)\n end",
"def openid_consumer\n @@openid_consumer ||= OpenID::Consumer.new(session, OpenID::Store::Memory.new)\n end",
"def openid_discovery(url)\n ret = @fetcher.get(url)\n return [HTTP_FAILURE, nil] if ret.nil?\n\n consumer_id, data = ret\n server = nil\n delegate = nil\n parse_link_attrs(data) do |attrs|\n rel = attrs[\"rel\"]\n if rel == \"openid.server\" and server.nil?\n href = attrs[\"href\"]\n server = href unless href.nil?\n end\n\n if rel == \"openid.delegate\" and delegate.nil?\n href = attrs[\"href\"]\n delegate = href unless href.nil?\n end\n end\n\n return [PARSE_ERROR, nil] if server.nil?\n\n server_id = delegate.nil? ? consumer_id : delegate\n\n consumer_id = OpenID::Util.normalize_url(consumer_id)\n server_id = OpenID::Util.normalize_url(server_id)\n server_url = OpenID::Util.normalize_url(server)\n\n service = OpenID::FakeOpenIDServiceEndpoint.new(consumer_id,\n server_id,\n server_url)\n return [SUCCESS, service]\n end",
"def ldap_config\n @@ldap_config ||= YAML::load_file(\"#{RAILS_ROOT}/config/ldap.yml\")[RAILS_ENV || 'development']\n end",
"def config\n @config ||= YAML.load_file(BASE_PATH + '/local.config.yml')\nend",
"def load_repo_config; end",
"def load_config!\n cfg_data = begin\n YAML.load(File.open(CONFIG_DIR + GLOBAL_CONFIG))\n rescue Errno::ENOENT\n Hash.new\n end\n __load_config(DEFAULTS.merge(cfg_data))\n end",
"def config\n @config = ActiveSupport::HashWithIndifferentAccess.new(@config) if @config.is_a? Hash\n @config\n end",
"def user_config(key)\n Autoproj.user_config(key)\nend",
"def org_id\n @org_id ||= query_org_id # lazy query org_id when not set by login response\n end",
"def caching\n unless @caching\n conf = Grape::Jwt::Authentication.configuration\n return conf.rsa_public_key_caching\n end\n @caching\n end",
"def get_app_config(config_file)\n\n #logger.debug 'Loading configuration file.'\n\n #look locally, if not there then look in ./config folder/\n if !File.exist?(config_file) then\n config_file = \"./config/#{config_file}\"\n end\n\n config = {}\n config = YAML.load_file(config_file)\n\n #Config details.\n\n #Account details for Search API...\n #... and Rules API when used in 'customer' mode.\n account_name = config['account']['account_name']\n user_name = config['account']['user_name']\n\n #Users can pass in plain text, if they must.\n password_encoded = config[\"account\"][\"password_encoded\"]\n if password_encoded.nil? then #User is passing in plain-text password...\n password = config[\"account\"][\"password\"]\n password_encoded = Base64.encode64(@password)\n end\n\n search_label = config['account']['search_label']\n\n @search_api_creds['account_name'] = account_name\n @search_api_creds['user_name'] = user_name\n @search_api_creds['password_encoded'] = password_encoded\n @search_api_creds['search_label'] = search_label\n\n #App settings.\n begin\n @outbox = checkDirectory(config[\"app\"][\"outbox\"])\n rescue\n @outbox = \"./output\"\n end\n @request_sleep = config['app']['request_sleep']\n\n #Negationator settings!\n @project_name = config['negations']['project_name']\n @saved_results = config['negations']['saved_results']\n @min_threshold = config['negations']['min_threshold']\n @max_number = config['negations']['max_number']\n \n end",
"def config_options\n # config_file_path = File.join(ENV['SHARED_CONFIG_ROOT'] || \"#{Rails.root}/config\", \"college_mapper.yml\")\n # @config_options ||= YAML::load(ERB.new((IO.read(config_file_path))).result)[(Rails.env)].symbolize_keys \n @config_options ||= API_KEYS['collegemapper'][Rails.env].symbolize_keys\n end",
"def activeConfig\n return @active_config\n end",
"def fetch(key)\n config = send(key)\n config = self.class.deep_copy(config) if config.is_a?(Hash)\n config\n end",
"def context_constants_cache; end",
"def get_idp_metadata\n return false if @settings.idp_metadata.nil?\n \n # Look up the metdata in cache first\n id = Digest::MD5.hexdigest(@settings.idp_metadata)\n\n uri = URI.parse(@settings.idp_metadata)\n if uri.scheme == \"http\"\n response = Net::HTTP.get_response(uri)\n meta_text = response.body\n elsif uri.scheme == \"https\"\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n # Most IdPs will probably use self signed certs\n #http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n get = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(get)\n meta_text = response.body\n end\n testo_response = meta_text.sub!(' xmlns:xml=\"http://www.w3.org/XML/1998/namespace\"', '')\n doc = REXML::Document.new(testo_response)\n extract_certificate(doc)\n return doc\n\n # USE OF CACHE WITH CERTIFICATE\n # lookup = @cache.read(id)\n # if lookup != nil\n # Logging.debug \"IdP metadata cached lookup for #{@settings.idp_metadata}\"\n # doc = REXML::Document.new( lookup )\n # extract_certificate( doc )\n # return doc\n # end\n \n # Logging.debug \"IdP metadata cache miss on #{@settings.idp_metadata}\"\n # # cache miss\n # if File.exists?(@settings.idp_metadata)\n # fp = File.open( @settings.idp_metadata, \"r\")\n # meta_text = fp.read\n # else\n # uri = URI.parse(@settings.idp_metadata)\n # if uri.scheme == \"http\"\n # response = Net::HTTP.get_response(uri)\n # meta_text = response.body\n # elsif uri.scheme == \"https\"\n # http = Net::HTTP.new(uri.host, uri.port)\n # http.use_ssl = true\n # # Most IdPs will probably use self signed certs\n # #http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n # http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n # get = Net::HTTP::Get.new(uri.request_uri)\n # response = http.request(get)\n # meta_text = response.body\n # end\n # end\n # # Add it to the cache\n # @cache.write(id, meta_text, @settings.idp_metadata_ttl )\n # doc = REXML::Document.new( meta_text )\n # extract_certificate(doc)\n # return doc\n end",
"def main(opt_h={:cached => false})\n if opt_h[:cached]\n if @mainconfig\n return @mainconfig\n else\n get_main\n end\n else\n get_main\n end\n end",
"def config\n if Config.config.nil? or Config.config.empty?\n begin\n Config.config = Configuration.load_config(Config.config_file,\n Config.config_options)\n rescue Errno::ENOENT\n Config.config = {}\n end\n end\n\n return Config.config\n end",
"def config\n @config ||= Config.create ConfigLoader.new(root, CONFIG_FILE).to_hash, options.merge_config\n end",
"def config\n requester.config \n end",
"def config\n unless @config\n @config = Configuration.new\n @config.reset\n end\n @config\n end",
"def config\n @config ||= Configuration.new\n end",
"def openid_client_secret=(_arg0); end",
"def config\n @config ||= lambda_config? ? @config_value.call(parent.config) : @config_value.clone\n end",
"def openid_store\n ::OpenID::Store::Filesystem.new(\"#{Merb.root}/tmp/openid\")\n end",
"def get_user_conf(name, profile = 'default')\n return @config.find(name, profile) if @config\n @config = make_user_conf\n msg = 'Run the command `configure`'\n raise Idcf::Cli::CliError, msg unless @config\n\n @config.find(name, profile)\n end",
"def current_auth_api_key\n @current_auth_api_key ||= lambda do\n authenticate_knox_api_key!\n api_key\n end.call\n end",
"def get\n Rails.cache.read(session_id, namespace: 'check-in-cache')\n end",
"def config(file_name=nil)\n # Authorize.net configuration\n result = YAML.load_file(RAILS_ROOT + \"/config/#{file_name || config_file_name}\")[RAILS_ENV].symbolize_keys\n @@payflow_pro_login = result[:login]\n @@payflow_pro_password = result[:password]\n @@payflow_pro_partner = result[:partner]\n @@payflow_pro_certification_id = result[:certification_id]\n if result[:mode] == 'test'\n # Tell ActiveMerchant to use the Payflow Pro sandbox\n ActiveMerchant::Billing::Base.mode = :test\n end\n result\n end",
"def google_oauth2_nil_hash\n OmniAuth::Strategies::GoogleOauth2.class_eval do \n ##########\n ##JUST MODIFIED THIS TO RETURN NIL AS AUTH_HASH, SO THAT AN ERROR IS SIMULATED IN THE OMNI_COMMON DEF\n def auth_hash\n nil\n end\n\n ##########\n ##JUST MODIFIED THIS TO RETURN TRUE EVERYWHERE.\n private\n def verify_id_token(id_token)\n puts \"called verify id token.\"\n true\n end\n\n def verify_hd(access_token)\n puts \"Called verify hd.\"\n true\n end \n end\n end",
"def memcache_key_object\n @m_k_o ||= MemcacheKey.new('client.api_credentials')\n end",
"def config\n ensure_config_exists\n @config ||= (YAML.load_file(config_file) || {})\n end"
] |
[
"0.6451237",
"0.60046655",
"0.58545274",
"0.5658704",
"0.56156445",
"0.5569909",
"0.5377054",
"0.53276926",
"0.5305248",
"0.53009343",
"0.5270092",
"0.5235436",
"0.52116513",
"0.52051073",
"0.51936686",
"0.514493",
"0.5139281",
"0.5101577",
"0.5092504",
"0.50496596",
"0.5032941",
"0.4971531",
"0.49655417",
"0.49536687",
"0.49523607",
"0.49385858",
"0.4937836",
"0.49298438",
"0.49298438",
"0.48925912",
"0.48925257",
"0.48925257",
"0.48870188",
"0.48698407",
"0.4855565",
"0.4855514",
"0.48551512",
"0.4847935",
"0.48456493",
"0.48447493",
"0.48399404",
"0.48372152",
"0.48347253",
"0.48123878",
"0.4807614",
"0.4805703",
"0.4794841",
"0.4794841",
"0.4768508",
"0.47622204",
"0.47618937",
"0.4760466",
"0.47504693",
"0.47342634",
"0.47328627",
"0.4725274",
"0.47129774",
"0.47122282",
"0.47107404",
"0.47061354",
"0.46936813",
"0.46928066",
"0.46916908",
"0.46804142",
"0.46737248",
"0.4671487",
"0.46712688",
"0.46647403",
"0.46617734",
"0.46537519",
"0.46499106",
"0.46474546",
"0.4645133",
"0.46441925",
"0.46433058",
"0.4634084",
"0.46324813",
"0.4628814",
"0.46232373",
"0.462137",
"0.4620834",
"0.46169463",
"0.461545",
"0.46151492",
"0.4613381",
"0.46031123",
"0.46011204",
"0.4596931",
"0.45967138",
"0.45955268",
"0.45887527",
"0.45886382",
"0.45873594",
"0.4581382",
"0.4579622",
"0.45780918",
"0.45773232",
"0.45688874",
"0.45676327",
"0.45664242"
] |
0.77671504
|
0
|
The location of the OpenID configuration for the tenant.
|
def openid_config_url
"https://login.windows.net/#{tenant}/.well-known/openid-configuration"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def openid_redirect_uri; end",
"def tenant_path\n @tenant_path ||= '/api/v2/tenants/settings'\n end",
"def base_config_path\n BASE_CONFIG_PATH\n end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n end",
"def openid_config\n @openid_config ||= fetch_openid_config\n end",
"def path\n @configuration.path\n end",
"def app_config_path\n Pathname.new('.').join('config')\n end",
"def openid_store\n ::OpenID::Store::Filesystem.new(\"#{Merb.root}/tmp/openid\")\n end",
"def config_path\n @config_path ||= local_config_path\n end",
"def configuration_file_path; end",
"def openid_client_id; end",
"def openid_file_store_path(value = nil)\n if value.nil?\n read_inheritable_attribute(:openid_file_store_path) || openid_file_store_path((defined?(RAILS_ROOT) && RAILS_ROOT + \"/tmp/openids\") || (defined?(Merb) && Merb.root + \"/tmp/openids\"))\n else\n write_inheritable_attribute(:openid_file_store_path, value)\n end\n end",
"def org_endpoint(organization_id)\n \"#{FABRIC_ORGANIZATIONS_ENDPOINT}/#{organization_id}\"\n end",
"def openid_options(value = nil)\n rw_config(:openid_options, value, {})\n end",
"def openid_callback_url\n \"#{request.protocol}://#{request.host}#{Merb::Router.url(:openid)}\"\n end",
"def openid_endpoint; end",
"def issuer\n openid_config['issuer']\n end",
"def org_endpoint(session)\n \"#{FABRIC_ORGANIZATIONS_ENDPOINT}/#{session.organization_id}\"\n end",
"def openid_oauth(value = nil)\n rw_config(:openid_oauth, value, false)\n end",
"def full_configuration_path\n @full_config_path ||= File.join(self.class.config_base_path, self.class.config_path)\n end",
"def oauth2_client_id(value = nil)\n rw_config(:oauth2_client_id, value, '')\n end",
"def fetch_openid_config\n JSON.parse(Net::HTTP.get(URI(openid_config_url)))\n rescue JSON::ParserError\n raise StandardError, 'Unable to fetch OpenId configuration for ' \\\n 'AzureAD tenant.'\n end",
"def right_agent_cfg_dir\n return pretty_path(File.join(Dir::COMMON_APPDATA, 'RightScale', 'right_agent'))\n end",
"def config_path\n File.join(solr_home, 'conf')\n end",
"def openid_client_secret; end",
"def facebook_app_config_path\n case current_subdomain\n when 'vault'\n FacebookBackup::Vault.config_path\n else\n FacebookBackup.config_path\n end\n end",
"def path\n return ENV['ORBIT_FILE'] if ENV.include? 'ORBIT_FILE'\n\n [ENV.fetch('ORBIT_HOME'), 'config', 'orbit.json'].join(SEP)\n rescue KeyError\n raise 'env ORBIT_HOME not set'\n end",
"def config_path\n NginxStage.pun_config_path(user: user)\n end",
"def path\n @path || File.expand_path(ENV['NEXUS_CONFIG'] || DEFAULT_FILE)\n end",
"def provider_root(lookup_invocation)\n configuration_path(lookup_invocation).parent\n end",
"def url_identifier\n case Roomer.url_routing_strategy\n when :domain\n return request.host\n when :path\n return params[:tenant_identifier]\n end\n end",
"def default_concierge_variables_path\n Hanami.root.join(\"config\", \"environment_variables.yml\").to_s\n end",
"def config_path\n if result = chef_api_config_path\n Pathname(result).expand_path\n else\n Pathname(\"\")\n end\n end",
"def conf_folder\n conf['conf_folder'] || '.'\n end",
"def bare_d\n home.join('bare.conf.d')\n end",
"def base_uri\n \"#{api}/admin/tenants\"\n end",
"def definition_root\n Rails.root.join('data', 'HCA_metadata', self.version)\n end",
"def stored_location_for(resource_or_scope)\n root_url\n end",
"def base_path\n raise NotImplementedError, \"Subclass #{self.class.name} of Configuration must implement base_path\"\n end",
"def get_configuration_file\n file = PREFERENCES_LEGACY\n file = PREFERENCES if File.exists? '/usr/libexec/opendirectoryd'\n file\n end",
"def oauth2_site(value = nil)\n rw_config(:oauth2_site, value, '')\n end",
"def pedant_orgname\n Pedant::Config.use_default_org ? Pedant::Config.default_orgname : Pedant::Config[:org][:name]\n end",
"def environment_location(environment_name)\n File.join(puppet_config(master, 'codedir'), 'environments', environment_name)\n end",
"def root_uri_path\n @options[:root_uri_path]\n end",
"def oauth_url\n @oauth_url || File.join(host, \"oauth20/token\")\n end",
"def location_path\n @grpc.location\n end",
"def org\n client.org(org_id)\n end",
"def org\n client.org(org_id)\n end",
"def vivo_org_uri(id)\n uri = DATA_NAMESPACE + \"/org/#{id}\"\n uri.gsub('//','/')\n end",
"def location\n\t\tif @location\n\t\t\t@location\n\t\telsif File.exists?(default_location)\n\t\t\tdefault_location\n\t\telsif File.exists?(appstore_location)\n\t\t\tappstore_location\n\t\telse\n\t\t\tnil\n\t\tend\n\tend",
"def cfg_dir\n File.join(@full_path, CONFIG_DIR)\n end",
"def default_config\n data = {\n 'acr_values' => 'http://idmanagement.gov/ns/assurance/loa/1',\n 'client_id' => 'urn:gov:gsa:openidconnect:sp:sinatra',\n }\n\n if LoginGov::Hostdata.in_datacenter?\n # EC2 deployment defaults\n\n env = LoginGov::Hostdata.env\n domain = LoginGov::Hostdata.domain\n\n if env == 'prod'\n data['idp_url'] = \"https://secure.#{domain}\"\n else\n data['idp_url'] = \"https://idp.#{env}.#{domain}\"\n end\n data['redirect_uri'] = \"https://sp-oidc-sinatra.#{env}.#{domain}/\"\n data['sp_private_key_path'] = \"aws-secretsmanager:#{env}/sp-oidc-sinatra/oidc.key\"\n data['redact_ssn'] = true\n else\n # local dev defaults\n data['idp_url'] = 'http://localhost:3000'\n data['redirect_uri'] = 'http://localhost:9292/'\n data['sp_private_key_path'] = demo_private_key_path\n data['redact_ssn'] = false\n end\n\n data\n end",
"def signing_keys_url\n return openid_config['jwks_uri'] if openid_config.include? 'jwks_uri'\n fail StandardError, 'No jwks_uri in OpenId config response.'\n end",
"def config_path\n Gym.cache[:config_path] ||= \"/tmp/gym_config_#{Time.now.to_i}.plist\"\n return Gym.cache[:config_path]\n end",
"def config_file\n File.join AppRoot, ConfigFile\n end",
"def subauthorities_path\n if config[:local_path].starts_with?(File::Separator)\n config[:local_path]\n else\n Rails.root.join(config[:local_path]).to_s # TODO: Rails.root.join returns class Pathname, which may be ok. Added to_s because of failing regression test.\n end\n end",
"def config_path\n Gym.cache[:config_path] ||= \"#{Tempfile.new('gym_config').path}.plist\"\n return Gym.cache[:config_path]\n end",
"def config\n root.join('config', 'environment.rb')\n end",
"def default_app_variables_path\n Hanami.root.join(\"apps\", Concierge.app.to_s, \"config\", \"environment_variables.yml\").to_s\n end",
"def get_config_path()\n return ENV['DOCS_CONFIG_PATH'] || CONFIG_PATH_DEFAULT\n end",
"def callback_url\n auth_endpoint_callback_url(org: @organization.id)\n end",
"def oauth_url\n 'https://geoloqi.com/oauth/authorize'\n end",
"def auth_url\n CloudFiles.const_get(\"AUTH_#{self.auth_location.upcase}\")\n end",
"def authorize_endpoint_url\n uri = URI(openid_config['authorization_endpoint'])\n uri.query = URI.encode_www_form(client_id: client_id,\n redirect_uri: callback_url,\n response_mode: response_mode,\n response_type: response_type,\n nonce: new_nonce)\n uri.to_s\n end",
"def core_cfg_path\n File.expand_path(ENV[\"DBS_CFGDIR\"].presence || \"~/.db_sucker\")\n end",
"def configuration_file\n gitpusshuten_root + '/config.rb'\n end",
"def config_dev_path\n File.join test_app_path, 'config', 'deploy', 'dev.rb'\n end",
"def root_path\n RUBYCOCOA_ROOT.to_s\n end",
"def active_configuration_path\n configuration_paths.find do |path|\n File.file? path\n end || theme_configuration_path\n end",
"def paths\n configuration.paths\n end",
"def org_id\n @org_id ||= query_org_id # lazy query org_id when not set by login response\n end",
"def config_file\n CONFIG_FILE\n end",
"def redirect_uri\n @redirect_uri ||= root_url[0..-2] + oauth_callback_path\n end",
"def configuration_identifier\n \"#{self.configuration_namespace}/#{self.configuration_name}/#{self.configuration_snapshot}\"\n end",
"def provider_path\n provider_directory + \"#{@provider}.rb\"\n end",
"def location(object, resource_config, parent_id)\n o = object\n c = resource_config\n path = if c[:parent]\n raise Error, \"expecting parent_id\" unless parent_id\n pc = c[:parent].resource_config\n \"#{pc[:path]}/#{parent_id}/#{c[:path]}/#{o['id']}\"\n else\n \"#{c[:path]}/#{o['id']}\"\n end\n full_uri(path)\n end",
"def path\n @path ||=\n if user_configuration.has_key?('solr')\n \"#{user_configuration['solr']['path'] || '/solr'}\"\n end\n end",
"def root\n settings[:basedir]\n end",
"def lic_path\n @lic_path ||= Pathname.new(configured_lic_path.path).expand_path(root)\n end",
"def config_path\n @config_path ||= 'config/spinach.yml'\n end",
"def root\n\t\tFile.join(options[:root].to_s, user.id.to_s)\n\tend",
"def base\n [location, Puppet[:ldapbase]].join(\",\")\n end",
"def ca_file_location\n ::Ohai::Config[:ca_file]\n end",
"def ca_file_location\n ::Ohai::Config[:ca_file]\n end",
"def client_secrets_path\n path = 'config/clients_secrets.json'\n return path if File.exist? path\n return ENV['GOOGLE_CLIENT_SECRETS'] if ENV.has_key?('GOOGLE_CLIENT_SECRETS')\n return well_known_path_for('clients_secrets.json')\n end",
"def configuration\n Rally.provider_configuration[name]\n end",
"def base_api_uri\n \"#{self.class.base_uri}/#{@account_id}\"\n end",
"def base_uri\n if mode == 'sandbox'\n @base_uri = 'https://sandbox.fundamerica.com/api/'\n else\n @base_uri = 'https://apps.fundamerica.com/api/'\n end\n end",
"def signed_in_root_path(resource_or_scope); end",
"def directory_uri\n template = Addressable::Template.new(\n \"https://{host}/discovery/v1/apis\"\n )\n return template.expand({\"host\" => self.host})\n end",
"def location\n fetch('doraemon.locations')\n end",
"def api_uri\n options.endpoint\n end",
"def config_file\n @config_file ||= File.join( home_dir, TyrantManager.config_file_basename )\n end",
"def configured_uri\n if /https?:/.match?(uri)\n remote = Bundler::URI(uri)\n config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]\n remote.userinfo ||= config_auth\n remote.to_s\n elsif File.exist?(uri)\n \"file://#{uri}\"\n else\n uri.to_s\n end\n end",
"def app_uri\n @app_uri ||=\n @rack_context.getInitParameter('app.root') ||\n @rack_context.getInitParameter('rails.root') ||\n '/WEB-INF'\n end",
"def site_path\n settings.site_path\n end",
"def config_dir\n Wonkavision::Sample::CONFIG_DIR\n end",
"def default_path\n Pathname.pwd.join(*base_config_path, self.class.config_folder)\n end",
"def repo_store_root\n Pathname(Razor.config['repo_store_root'])\n end"
] |
[
"0.6150054",
"0.6099612",
"0.6087325",
"0.6046829",
"0.6045363",
"0.5973581",
"0.5944157",
"0.59106547",
"0.5844534",
"0.5842793",
"0.5826858",
"0.5826581",
"0.580979",
"0.580783",
"0.5764733",
"0.5755689",
"0.57336694",
"0.57314724",
"0.5725653",
"0.56615937",
"0.56566256",
"0.5627583",
"0.56228995",
"0.56146723",
"0.56072986",
"0.5596435",
"0.5566405",
"0.55577445",
"0.55488884",
"0.554327",
"0.5536722",
"0.5488454",
"0.5476261",
"0.54722244",
"0.54667544",
"0.54483396",
"0.54330665",
"0.542944",
"0.5418218",
"0.54152626",
"0.5410385",
"0.54098713",
"0.54003894",
"0.53695506",
"0.5366661",
"0.5362949",
"0.5357198",
"0.5351352",
"0.5351352",
"0.53485316",
"0.5340869",
"0.5333842",
"0.53269637",
"0.5324713",
"0.53129035",
"0.5306854",
"0.53052163",
"0.53032225",
"0.53030455",
"0.5299548",
"0.52927047",
"0.5288939",
"0.5287199",
"0.52805334",
"0.5277472",
"0.5269869",
"0.5268083",
"0.5256458",
"0.5244833",
"0.52363276",
"0.52294993",
"0.5223837",
"0.5222868",
"0.52205014",
"0.52199876",
"0.52091324",
"0.5208198",
"0.5207416",
"0.5205276",
"0.5205052",
"0.520454",
"0.5201013",
"0.51952094",
"0.5190272",
"0.5190272",
"0.5188112",
"0.51797783",
"0.5178953",
"0.51751655",
"0.516858",
"0.5168223",
"0.5163722",
"0.516232",
"0.5154681",
"0.51490116",
"0.5146016",
"0.51361746",
"0.5133471",
"0.5132264",
"0.5128902"
] |
0.7745673
|
0
|
Returns the most recent nonce for the session and deletes it from the session.
|
def read_nonce
session.delete('omniauth-azure-activedirectory.nonce')
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def nonce\n ((Time.now.to_f * 1000000).to_i << 10).to_s\n end",
"def nonce\n @nonce ||= Digest::SHA1.hexdigest random_string + timestamp\n end",
"def nonce\n @nonce ||= Digest::SHA1.hexdigest random_string + timestamp\n end",
"def delete(nonce)\n _resetCount()\n runMbxTransaction(@hpk, 'delete') do\n rds.del msg_tag nonce\n rds.hdel hpk_tag, nonce\n logger.info \"#{INFO} deleting #{dumpHex b64dec nonce} in mbx #{dumpHex b64dec @hpk}\"\n end\n end",
"def nonce\n Array.new( 5 ) { rand(256) }.pack('C*').unpack('H*').first\n end",
"def nonce\n auth_info[\"nonce\"] || \"\"\n end",
"def nonce\n Array.new( 5 ) { rand(256) }.pack('C*').unpack('H*').first\n end",
"def gen_nonce\n Time.now.utc.to_i.to_s\n end",
"def nonce\n rand(1_500_000_000)\n end",
"def destroy_session_token!\n update_attribute(:session_token, nil)\n end",
"def cleanup_nonces\n now = Time.now.to_i\n nonces = OpenidNonce.all\n ids = nonces.collect { |n| n.id if (n.timestamp - now).abs > Nonce.skew }\n OpenidNonce.delete ids.compact\n end",
"def nonce(secret_key, time = T.unsafe(nil)); end",
"def cnonce\n SecureRandom.hex 16\n end",
"def nonce(time = Time.now)\n t = time.to_i\n hashed = [t, secret_key]\n digest = ::Digest::MD5.hexdigest(hashed.join(\":\"))\n ActiveSupport::Base64.encode64(\"#{t}:#{digest}\").gsub(\"\\n\", '')\n end",
"def nonce_bytes\n NONCEBYTES\n end",
"def new_nonce\n session['omniauth-azure-activedirectory.nonce'] = SecureRandom.uuid\n end",
"def use_nonce(nonce)\n filename = @nonce_dir.join(nonce)\n begin\n st = File.stat(filename)\n rescue Errno::ENOENT\n return false\n else\n begin\n File.unlink(filename)\n rescue Errno::ENOENT\n return false\n end \n nonce_age = Time.now.to_f - st.mtime.to_f\n nonce_age <= @max_nonce_age\n end\n end",
"def generate_nonce(time = Time.now)\n return Digest::MD5.hexdigest( time )\n end",
"def destroy_session\n session = Authentication::Session.active_token_session(auth_token)\n session.logout unless session.nil?\n clear_cache(auth_token)\n return {'success' => true}\n end",
"def delete_session(env, sid, options)\n @cache.delete(cache_key(sid.private_id))\n @cache.delete(cache_key(sid.public_id))\n generate_sid\n end",
"def nonce; end",
"def destroy_session2_id\n url = \"https://208.65.111.144/rest/Session/logout/{'session_id':'#{get_session2}'}\"\n begin\n apiRequest(url)\n rescue Restclient::InternalServerError => e\n error_message = e.response[e.response.index('faultstring')+14..-3]\n if error_message != \"Session id is expired or doesn't exist\"\n puts \"Something went wrong trying to logout\"\n end\n end\n @@session_id = nil\n end",
"def delete(session, context = Context.current)\n digest = session.instance_variable_get(\"@digest\")\n @cache.delete(digest)\n super\n end",
"def nonce_timestamp(tolerance = 5)\n Time.now.to_i + tolerance\n end",
"def delete\n GLOBAL_HASH_TABLE.delete(@session_id)\n end",
"def logout\n session_delete\n @token = ''\n @seqid = 0\n auth_header\n end",
"def generate_cnonce\n\n Digest::MD5.hexdigest(\"%x\" % (Time.now.to_i + rand(65535)))\n end",
"def httpdigest_logout\n session.delete(SESSION_NONCE)\n session.delete(SESSION_OPAQUE)\n end",
"def delete\n if @session\n @session.destroy\n @session = nil\n end\n end",
"def destroy \n\t session[:guestaccount_id] = nil \n\t \n\tend",
"def nonce_message(connection)\n Protocol::Query.new(\n auth_database(connection),\n Database::COMMAND,\n Auth::GET_NONCE,\n limit: -1\n )\n end",
"def delete_session\n request.method = :get\n request.uri = '_session'\n Couchdbtools.execute(request)\n end",
"def revoke_token\n request @google + '/accounts/AuthSubRevokeToken'\n\n @session_token = false\n end",
"def box_logout(session)\n session.delete(:box_token)\n session.delete(:box_ticket)\n end",
"def user_logout\n res = http_delete(:uri=>\"/session\", :fields=>x_cookie)\n return res.code\n end",
"def test_nonce_not_current\n string = \"0123456789ABCDEF\"\n\n nonce1 = OauthNonce.remember(string, Time.now.to_i - 86430)\n assert_equal false, nonce1, \"Nonces over a day in the past should be rejected\"\n\n nonce2 = OauthNonce.remember(string, Time.now.to_i - 86370)\n assert_not_equal false, nonce2, \"Nonces under a day in the past should be rejected\"\n end",
"def sign_out\n return unless current_user\n current_user.update_attribute(:session_token, nil)\n session.delete(:token)\n end",
"def destroy\n id = shift_argument ||\n raise(Heroku::Command::CommandFailed, \"Usage: sessions:destroy [ID]\")\n session = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :delete,\n :path => \"/oauth/sessions/#{CGI.escape(id)}\"\n ).body\n end\n puts %{Destroyed \"#{session[\"description\"]}\".}\n end",
"def delete_cookie\n cookies.delete :auth_token\n end",
"def destroy\n # Delete the user access tokens on logout\n User.find(session[:user_id]).delete\n # Delete the session as well\n session = {}\n \n redirect_to root_path\n end",
"def delete(nsc)\n nsc.delete_shared_credential(@id)\n end",
"def delete\n return unless @session\n @session.destroy\n @session = nil\n end",
"def delete_session(req, sid, options)\n @lock.delete_session(req.env, sid)\n generate_sid unless options[:drop]\n end",
"def customer_log_out\n customer_forget(current_customer)\n session.delete(:customer_id)\n @current_customer = nil\n end",
"def deleteSession(sessionID)\n call :deleteSession, :sessionID => sessionID\n end",
"def log_out_customer\n session.delete(:customer_id)\n @current_customer = nil\n end",
"def revoke_authentication_token key\n redis_token = Redis::Value.new(authentication_token_key(id.to_s, key))\n redis_token.delete unless redis_token.nil?\n end",
"def nonce\n oauth_merged_params[:oauth_nonce]\n end",
"def generate_nonce\n secret_box = RbNaCl::SecretBox.new(key)\n self.nonce = RbNaCl::Random.random_bytes(secret_box.nonce_bytes)\n self.nonce = Base64.encode64(self.nonce)\n end",
"def destroy\n current_user.remove_token\n render json: { status: :success, data: 'Successfully signed out' }\n end",
"def sign_out_expired_session\n return unless current_user.present?\n return if current_user.last_sign_in_check.present? && current_user.last_sign_in_check <= 5.minutes.ago\n\n current_user.update last_sign_in_check: Time.now\n\n if UniversumSsoClient.signed_out?(current_user.uid)\n session[:user_id] = nil\n @current_user = nil\n clear_iris_session\n end\n end",
"def remove_mfa_secret!\n transaction do\n update!(mfa_secret: nil)\n nonce_tokens.delete_all\n end\n end",
"def logout\n current_user.reset_session_token\n session[:session_token] = nil\n end",
"def validate_nonce(request, value, seconds_to_timeout=5*60)\n t = ActiveSupport::Base64.decode64(value).split(\":\").first.to_i\n nonce(t) == value && (t - Time.now.to_i).abs <= seconds_to_timeout\n end",
"def invalidate_session\n @sequence = 0\n @session_id = nil\n end",
"def purge_old_tokens\n auth_tokens.desc(:last_used_at).offset(20).destroy_all\n end",
"def disconnect(token)\n # You could reset the state at this point, but as-is it will still stay unique\n # to this user and we're avoiding resetting the client state.\n # session.delete(:state)\n session.delete(:token)\n\n # Send the revocation request and return the result.\n revokePath = 'https://accounts.google.com/o/oauth2/revoke?token=' + token\n uri = URI.parse(revokePath)\n request = Net::HTTP.new(uri.host, uri.port)\n request.use_ssl = true\n status request.get(uri.request_uri).code\nend",
"def revoke!\n self.class.transaction do\n update_attribute :revoked, Time.now\n client.increment! :tokens_revoked\n end\n end",
"def destroy\n\n if(params[:token].nil?)\n response.status = 400\n render json: {msg: \"Token is not defined\"}\n return\n end\n\n session = validate_session(params[:token])\n\n if session.nil?\n response.status = 401\n render json: {}\n return\n end\n\n begin\n obj = User.find(params[:id])\n\n unless session.user.id == obj.id\n response.status = 403\n render json: {}\n return\n end\n\n # This is what slows down the response.\n # Big DB transactions that delete by foreign key.\n obj.time_sessions.destroy_all\n obj.login_sessions.destroy_all\n\n obj.destroy\n response.status = 20\n render json: {msg: obj.time_sessions.methods}\n rescue ActiveRecord::RecordNotFound => e\n response.status = 404\n render json: {}\n rescue Exception => e\n response.status = 500\n render json: {msg: e}\n end\n\n end",
"def logout\n return unless session_token\n\n # Destroy the current session specified in the session token\n begin\n Userbin::Session.destroy_existing('current')\n rescue Userbin::Error; end\n\n # Clear the session token\n self.session_token = nil\n end",
"def remove_session_cookie\n headers['Set-Cookie'] = session_cookie \"x; expires=#{Time.at(0).httpdate}\"\n end",
"def destroy\n session.delete(:user)\n end",
"def destroy\n @token.destroy\n\n head :no_content\n end",
"def nonce=(_arg0); end",
"def logout\n \n # test if session is unauth'd\n (print_error \"invalid nonce\";return @body = \"{ success : true }\") if not @session.valid_nonce?(@request)\n (print_error \"invalid session\";return @body = \"{ success : true }\") if not @session.valid_session?(@request)\n \n @headers['Content-Type']='application/json; charset=UTF-8'\n \n # set the session to be log out\n @session.set_logged_out\n \n # clean up UA and expire the session cookie\n config = BeEF::Core::Configuration.instance\n session_cookie_name = config.get('beef.http.session_cookie_name') # get session cookie name\n Rack::Utils.set_cookie_header!(@headers, session_cookie_name, {:value => \"\", :path => \"/\", :httponly => true, expires: Time.now})\n\n BeEF::Core::Logger.instance.register('Authentication', \"User with ip #{@request.ip} has successfuly logged out.\")\n @body = \"{ success : true }\"\n \n end",
"def destroy\n @session[:user_id] = nil\n @current_user = nil\n end",
"def destroy\n cookies.signed[:current_user_id] = nil\n redirect_to new_session_path\n end",
"def reset_session_token!\n self.session_token = SecureRandom.urlsafe_base64(16)\n self.save!\n self.session_token\n end",
"def scoped_nonce(nonce)\n \"#{@consumer_key}-#{nonce}\"\n end",
"def sign_out\n session[:shop_id] = nil\n end",
"def destroy\n @user=User.where(:authentication_token=>params[:api_key]).first\n @user.reset_authentication_token!\n render :json => { :message => [\"Session deleted.\"] }, :success => true, :status => :ok\n end",
"def logout\n current_user.reset_session_token!\n session[:session_token] = nil\n end",
"def destroy\n begin\n client = DiscourseApi::Client.new(\"https://intranet.cuhappycorner.com\")\n client.api_key = \"1729b13700d45e58d2e3d81c1bee5431a5167244e75389c07bb613fae54777ee\"\n client.api_username = \"ckho\"\n user = client.by_external_id(current_user.id)\n client.log_out(user[\"id\"]) if user\n rescue\n # nothing\n ensure\n super\n end\n end",
"def validate_nonce(secret_key, request, value, seconds_to_timeout = T.unsafe(nil)); end",
"def delete_session(env, sid, options); end",
"def reset_session_token!\n self.session_token = SecureRandom::urlsafe_base64(16)\n self.save!\n self.session_token\n end",
"def log_out\n session.delete(:customer_id)\n @current_user = nil\n end",
"def destroy\n signed_out_user = current_user\n sign_out :user\n session.try(:delete, :_csrf_token)\n # Prevent Token Fixation attacks by generating a new token upon user logout.\n signed_out_user.authentication_token = Devise.friendly_token\n signed_out_user.save\n super\n end",
"def generate_token(client_nonce)\n generation_time = time_to_block(Time.now.to_i)\n encryptor(client_nonce).encode(generation_time, 0)\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n ensure\n # reset auth key to nil\n @auth_key = nil\n end",
"def destroy\n @session.clear\n end",
"def delete_session(session)\n return Seasar::Rack::Session.delete_session(@env, session)\n end",
"def destroy\n destroy = REDIS_LOGIN.del(\"token:#{headers[\"Access-Token\"]}\")\n if destroy == 1\n render json: { status: \"Logged out\" }, status: 200\n else\n render json: { error: \"Trouble logging out. Make sure the user isn't already logged out\" }, status: 200\n end\n end",
"def logout\n session.delete(:user_id)\n end",
"def destroy\n @user = User.user_by_token(request.cookies[\"token\"])\n return if @user != @reservation.user\n\n @reservation.destroy\n head :no_content\n end",
"def reset_sesssion_token!\n self.session_token = SecureRandom.urlsafe_base64\n self.save!\n self.session_token\n end",
"def destroy\n # Remove the user id from the session\n session.clear\n redirect_to root_url\n end",
"def customer_forget(customer)\n customer.forget\n cookies.delete(:customer_id)\n cookies.delete(:remember_token)\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_key = nil\n end",
"def destroy\n self.class.delete_all(\"session_id='#{session_id}'\")\n end",
"def session_token\n refresh_session_token unless token_valid?\n return @session_token\n end",
"def destroy\n @user_session = UserSession.find()\n begin\n @user_session.destroy\n \n # Log the user out of the forums also\n cookies[\"Vanilla\"] = {:value => \"\", :domain => \".worlize.com\"}\n cookies[\"Vanilla-Volatile\"] = {:value => \"\", :domain => \".worlize.com\"}\n session.delete(:signed_request)\n rescue\n end\n\n respond_to do |format|\n format.html { redirect_to(root_url) }\n format.json { render :json => { :success => true } }\n end\n end",
"def logout\n params = {\n 'method' => :delete,\n 'command' => '/session'\n }\n\n response, headers = send_request(params)\n # reset auth key to nil\n @auth_key = nil\n end",
"def destroy\n cookies.delete :web_session_token\n reset_session\n redirect_to root_path\n end",
"def destroy\n cookies.delete :web_session_token\n reset_session\n redirect_to root_path\n end",
"def deletion_id\n SecureRandom.hex(20)\n end",
"def destroy\n @otg_sess.destroy\n respond_to do |format|\n format.html { redirect_to otg_sesses_url, notice: 'Otg sess was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove_token\n update(token: nil)\n end",
"def sign_out\n session.delete(:user_id)\n end",
"def destroy\n @current_session = CurrentSession.find(params[:id])\n @current_session.destroy\n\n head :no_content\n end"
] |
[
"0.6613439",
"0.6550846",
"0.6550846",
"0.6425401",
"0.62723625",
"0.6130543",
"0.61277896",
"0.6019787",
"0.59970516",
"0.59182733",
"0.59108347",
"0.5898751",
"0.58649296",
"0.5835891",
"0.57578737",
"0.5681017",
"0.5672286",
"0.5630954",
"0.5592462",
"0.55843985",
"0.554018",
"0.5497293",
"0.5481055",
"0.5480466",
"0.54662156",
"0.5436223",
"0.5419449",
"0.541699",
"0.53446895",
"0.5340138",
"0.53287977",
"0.53230053",
"0.53135735",
"0.5295877",
"0.5265625",
"0.5261611",
"0.52282053",
"0.5216512",
"0.52163273",
"0.52113",
"0.5175055",
"0.5159614",
"0.5157381",
"0.5154329",
"0.5154089",
"0.51499766",
"0.51460505",
"0.5141284",
"0.51349574",
"0.5132006",
"0.5126233",
"0.51239264",
"0.5121304",
"0.5119256",
"0.5116415",
"0.51087713",
"0.5095001",
"0.5092037",
"0.5091526",
"0.50699836",
"0.50672984",
"0.50615644",
"0.5056969",
"0.5052076",
"0.50508696",
"0.5049351",
"0.50457084",
"0.50428796",
"0.5041419",
"0.5035576",
"0.50350547",
"0.5031812",
"0.50315416",
"0.5029601",
"0.50290656",
"0.5026666",
"0.50152254",
"0.50118524",
"0.50111026",
"0.4994101",
"0.49939072",
"0.49938595",
"0.4990459",
"0.49854687",
"0.49845922",
"0.4979566",
"0.4979186",
"0.49758193",
"0.4964594",
"0.49616253",
"0.49615702",
"0.49609998",
"0.49572077",
"0.49483535",
"0.49483535",
"0.49451715",
"0.49429598",
"0.49426448",
"0.49400032",
"0.49393082"
] |
0.60645604
|
7
|
The response_type that will be set in the authorization request query parameters. Can be overridden by the client, but it shouldn't need to be.
|
def response_type
options[:response_type] || DEFAULT_RESPONSE_TYPE
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def content_type\n self.class.response_content_type\n end",
"def allowed_types\n config.allowed_response_types\n end",
"def response_content_type\n @response_headers[\"Content-Type\"]\n end",
"def content_type\n response.content_type\n end",
"def content_type\n response&.response&.content_type\n end",
"def content_type\n @response_headers[\"Content-Type\"]\n end",
"def requested_type\n return @requested_type if defined?(@requested_type)\n\n opts = @scope.opts[:type_routing]\n @requested_type = accept_response_type if opts[:use_header]\n @requested_type ||= opts[:default_type]\n end",
"def content_type(type)\n @response.content_type == type\n end",
"def type\n response[\"type\"]\n end",
"def type\n response[\"type\"]\n end",
"def content_type\n response_headers[\"Content-Type\"]\n end",
"def content_type\n @response['content-type'].nil? ? 'text/plain' : @response['content-type']\n end",
"def content_type\n ((response.headers.values_at('content-type', 'Content-Type').compact.first || '').split(';').first || '').strip\n end",
"def content_type\n @meta_content_type || response['content-type']\n end",
"def content_type\n @meta_content_type || response['content-type']\n end",
"def grant_type\n @grant_type ||= nil\n return @grant_type if @grant_type\n if code && redirect_uri\n \"authorization_code\"\n elsif refresh_token\n \"refresh_token\"\n elsif username && password\n \"password\"\n elsif issuer && signing_key\n \"urn:ietf:params:oauth:grant-type:jwt-bearer\"\n end\n end",
"def type\n case code\n when 100..199 then :informational_response\n when 200..299 then :success\n when 300..399 then :redirection\n when 400..499 then :client_error\n when 500..599 then :server_error\n else :unknown\n end\n end",
"def content_type\n @content_type ||= @response_impl.entity.content_type.value\n end",
"def calculate_authorization_response_types\n []\n end",
"def setResponseType(type)\n if type == 0\n @audience = Human.new\n elsif type == 1\n @audience = Asura.new\n elsif type == 2\n @audience = Charr.new\n elsif type == 3\n @audience = Norn.new\n elsif type == 4\n @audience = Sylvari.new\n else\n @audience = Skritt.new\n end\n end",
"def response_types\n @response_types ||= ResponseTypesController.new config\n end",
"def content_type=(ctype)\n @response_headers[\"Content-Type\"] = ctype\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def set_ResponseType(value)\n set_input(\"ResponseType\", value)\n end",
"def content_type\n @content_type || MiddlewareAutocomplete.content_type\n end",
"def content_type\n headers[:content_type]\n end",
"def accept_response_type\n mimes = @scope.opts[:type_routing][:mimes]\n\n @env['HTTP_ACCEPT'].to_s.split(/\\s*,\\s*/).map do |part|\n mime, _= part.split(/\\s*;\\s*/, 2)\n if sym = mimes[mime]\n response[RodaResponseHeaders::VARY] = (vary = response[RodaResponseHeaders::VARY]) ? \"#{vary}, Accept\" : 'Accept'\n return sym\n end\n end\n\n nil\n end",
"def get_response_type\n return nil unless self.parsed_response.respond_to?(:xpath)\n response_type = self.parsed_response.xpath(\"//ns:Envelope/ns:Body\", \"ns\" => \"http://schemas.xmlsoap.org/soap/envelope/\").first.elements.first.name\n underscore(response_type.gsub(\"Response\",\"\"))\n end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def content_type; end",
"def response_format\n @response_format || :json\n end",
"def content_type\n @content_type ||= request.content_type\n end",
"def content_type\n end",
"def response_mode\n options[:response_mode] || DEFAULT_RESPONSE_MODE\n end",
"def consent_type\n return @consent_type\n end",
"def content_type\n self[\"Content-Type\"]\n end",
"def type\n @type ||= get_type_from_status_code(code)\n end",
"def response_class(endpoint)\n subject_service.rpcs[endpoint].response_type\n end",
"def consent_type=(value)\n @consent_type = value\n end",
"def content_type! type = nil, charset = nil\n __e__.explicit_charset = charset if charset\n charset ||= (content_type = response['Content-Type']) &&\n content_type.scan(%r[.*;\\s?charset=(.*)]i).flatten.first\n type && (Symbol === type) && (type = '.' << type.to_s)\n content_type = type ?\n (type =~ /\\A\\./ ? '' << mime_type(type) : type.split(';').first) : 'text/html'\n content_type << '; charset=' << charset if charset\n response['Content-Type'] = content_type\n end",
"def content_type\n headers['content-type']\n end",
"def token_type\n \"Bearer\"\n end",
"def fixup_response_content_type( response )\n\n\t\t# Make the error for returning something other than a Response object a little\n\t\t# nicer.\n\t\tunless response.respond_to?( :content_type )\n\t\t\tself.log.error \"expected response (%p, a %p) to respond to #content_type\" %\n\t\t\t\t[ response, response.class ]\n\t\t\tfinish_with( HTTP::SERVER_ERROR, \"malformed response\" )\n\t\tend\n\n\t\trestype = response.content_type\n\n\t\tif !restype\n\t\t\tif (( default = self.class.default_type ))\n\t\t\t\tself.log.debug \"Setting content type of the response to the default: %p\" %\n\t\t\t\t\t[ default ]\n\t\t\t\tresponse.content_type = default\n\t\t\telse\n\t\t\t\tself.log.debug \"No default content type\"\n\t\t\tend\n\t\telse\n\t\t\tself.log.debug \"Content type already set: %p\" % [ restype ]\n\t\tend\n\tend",
"def content_type=( type )\n\t\treturn self.headers[ :content_type ] = type\n\tend",
"def token_type\n 'Bearer'\n end",
"def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend",
"def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend",
"def account_type\n realm_discovery_response['account_type']\n end",
"def set_content_type(response, format)\n raise NotImplementedError\n end",
"def set_content_type(response, format)\n raise NotImplementedError\n end",
"def type_authorization!()\n @type = TAC_PLUS_AUTHOR\n end",
"def content_type=(_arg0); end",
"def content_type=(_arg0); end",
"def content_type=(_arg0); end",
"def result_type\n properties['type']\n end",
"def content_type\n @headers['Content-Type']\n end",
"def content_type\n\t\treturn self.headers[ :content_type ]\n\tend",
"def get_data_type_from_response(response)\n return nil unless response\n return nil unless content_type = response['content-type']\n return nil unless m=content_type.match(/;\\s* type=([0-9A-Za-z:]+)/x)\n m[1]\n end"
] |
[
"0.71298873",
"0.6928073",
"0.6923447",
"0.68637073",
"0.6811482",
"0.67441714",
"0.668171",
"0.66148955",
"0.6610585",
"0.6610585",
"0.6608642",
"0.6582344",
"0.6411907",
"0.63484496",
"0.63484496",
"0.6340048",
"0.6328751",
"0.6318457",
"0.6274402",
"0.62348884",
"0.6215297",
"0.6207863",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.62005776",
"0.61414635",
"0.61313105",
"0.60367745",
"0.60330844",
"0.6029872",
"0.6029872",
"0.6029872",
"0.6029872",
"0.6029872",
"0.6029872",
"0.6029872",
"0.6029872",
"0.6027092",
"0.6019338",
"0.60187304",
"0.60099727",
"0.60038036",
"0.6003511",
"0.5963724",
"0.5937032",
"0.5932686",
"0.5925319",
"0.5923975",
"0.5904166",
"0.5867002",
"0.58581084",
"0.5850952",
"0.5848123",
"0.5848123",
"0.5846401",
"0.5838102",
"0.5838102",
"0.5831677",
"0.58217067",
"0.58217067",
"0.58217067",
"0.5814047",
"0.5788986",
"0.57876706",
"0.57835895"
] |
0.79135305
|
0
|
The response_mode that will be set in the authorization request query parameters. Can be overridden by the client, but it shouldn't need to be.
|
def response_mode
options[:response_mode] || DEFAULT_RESPONSE_MODE
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def authorization_mode=(mode); end",
"def authorization_mode; end",
"def mode=(mode)\n request.mode = mode\n end",
"def response_type\n options[:response_type] || DEFAULT_RESPONSE_TYPE\n end",
"def mode\n request.mode\n end",
"def mode\n options[:mode]\n end",
"def response_format\n @response_format || :json\n end",
"def response_format=(response_format)\n @response_format = response_format.to_sym\n end",
"def get_mode()\n session['mode'] = session['mode'] || 'edit'\n return session['mode']\n end",
"def mode\n\t\t@mode || (proxy_owner.mode if proxy_owner.respond_to?(:mode))\n\tend",
"def get_mode\n send_request(FUNCTION_GET_MODE, [], '', 1, 'C')\n end",
"def mode\n defined? @mode and @mode or @mode='sandbox'\n end",
"def application_mode\n current_user.mdq_user? ? :mdq_mode : :arc_mode\n end",
"def cmd_mode(param)\n send_unauthorised and return unless logged_in?\n send_param_required and return if param.nil?\n if param.upcase.eql?(\"S\")\n send_response \"200 OK\"\n else\n send_response \"504 MODE is an obsolete command\"\n end\n end",
"def mode\n params['mode']\n end",
"def response_format()\n params.has_key?(:format) ? params[:format] : :html\n end",
"def mode\n @mode || (proxy_owner.mode if defined?(proxy_owner) and proxy_owner.respond_to?(:mode))\n end",
"def response\n _options.fetch(:response)\n end",
"def mode\n TflApi::Client::Mode.new(self)\n end",
"def type\n params['mode']\n end",
"def content_type\n self.class.response_content_type\n end",
"def usermode; @user_mode; end",
"def mode_settings\n authorize!(@user)\n end",
"def type\n params['mode']\n end",
"def api_mode; end",
"def options(request, response)\n OK\n end",
"def authentication_type; end",
"def allowed_types\n config.allowed_response_types\n end",
"def mode=(mode)\n @mode = mode ? mode.to_sym : nil\n end",
"def mode\n attributes.fetch(:mode) do\n Ably::Util::Crypto::DEFAULTS.fetch(:mode)\n end.downcase\n end",
"def account_mapping_mode(value=:auto)\n\t\t\t\taccount_mapping_mode_value(value)\n\t\t\tend",
"def mode() @mode ||= detect_mode end",
"def get_mode()\n end",
"def test_mode\n @test_mode || :raw\n end",
"def content_type\n response&.response&.content_type\n end",
"def respond\n\t\tif http_auth?\n\t\t\t\thttp_auth\n\t\telse\n\t\t\t\tredirect\n\t\tend\n\tend",
"def mode\n @mode\n end",
"def response_content_type\n @response_headers[\"Content-Type\"]\n end",
"def process_response(behavior, _)\n behavior[:cookies] == 'none' ?\n 'unset beresp.http.set-cookie;' :\n '# Allow set-cookie responses.'\nend",
"def set_mode(mode)\n send_request(FUNCTION_SET_MODE, [mode], 'C', 0, '')\n end",
"def default_request_options\n {'ha_version' => ha_version, 'ha_format' => ha_format, 'ha_fancylayout' => ha_fancylayout} #, 'strict_oauth_spec_response' => true\n end",
"def get_response_character_mode(question)\n terminal.raw_no_echo_mode_exec do\n response = terminal.get_character\n if question.overwrite\n erase_current_line\n else\n echo = question.get_echo_for_response(response)\n say(\"#{echo}\\n\")\n end\n question.format_answer(response)\n end\n end",
"def respond\n if http_auth?\n http_auth\n else\n redirect\n end\n end",
"def respond\n if http_auth?\n http_auth\n else\n redirect\n end\n end",
"def mode_sym\n (mode || :off).to_sym\n end",
"def modes\n @client.get('/Journey/Meta/Modes')\n end",
"def authorization\n authorization = 'participant'\n authorization = 'reader' if !can_submit && can_review && can_take_quiz\n authorization = 'submitter' if can_submit && !can_review && !can_take_quiz\n authorization = 'reviewer' if !can_submit && can_review && !can_take_quiz\n authorization\n end",
"def human_auth_method\n self[:auth_method].to_human\n end",
"def test_mode=(test_mode)\n Defender.test_mode = test_mode\n end",
"def test_mode\n FlexCommerceApi.config.order_test_mode == true || FlexCommerceApi.config.order_test_mode == \"true\"\n end",
"def content_type\n response.content_type\n end",
"def options_or_mode(oom)\n return fmode(oom) if oom.kind_of? String\n\n if FeatureGuard.enabled? :encoding\n oom\n else\n fmode(oom[:mode] || \"r:utf-8\")\n end\n end",
"def get_response_line_mode(question)\n if question.echo == true && !question.limit\n get_line(question)\n else\n get_line_raw_no_echo_mode(question)\n end\n end",
"def capable_auth_types; end",
"def get_modes\n @_modes\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end",
"def set_ResponseFormat(value)\n set_input(\"ResponseFormat\", value)\n end"
] |
[
"0.7058099",
"0.69902515",
"0.63833284",
"0.62261105",
"0.61667675",
"0.5774501",
"0.5742376",
"0.5668136",
"0.5602177",
"0.55582327",
"0.5524251",
"0.55109984",
"0.54894274",
"0.5480112",
"0.543615",
"0.5395262",
"0.5381375",
"0.53771275",
"0.5370629",
"0.5346698",
"0.53367984",
"0.53261304",
"0.52652985",
"0.5244095",
"0.52341175",
"0.5196549",
"0.5193577",
"0.5187362",
"0.51634276",
"0.51461655",
"0.5144723",
"0.5135687",
"0.51262534",
"0.51241",
"0.5110515",
"0.50999904",
"0.5098991",
"0.5096604",
"0.50756335",
"0.5070188",
"0.507005",
"0.5069788",
"0.50683105",
"0.50683105",
"0.50582445",
"0.5047118",
"0.50374776",
"0.5013822",
"0.4991821",
"0.49895158",
"0.49807498",
"0.49768758",
"0.49761885",
"0.49746597",
"0.49713093",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914",
"0.4964914"
] |
0.80171126
|
0
|
The keys used to sign the id token JWTs. This is just a memoized version of fetch_signing_keys.
|
def signing_keys
@signing_keys ||= fetch_signing_keys
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def key_ids\n @keys.keys\n end",
"def ids\n @keys ||= []\n end",
"def authentication_keys\n @authentication_keys ||= [mapping.to.token_authentication_key]\n end",
"def keys\n # Lock for thread safety\n # Only one thread can write to the hash at a time and prevent partial keys from being returned.\n @thread_lock.synchronize do\n if @keys.nil?\n @keys = {}\n @user_keys.each_pair do |name, rsa_keys|\n # Use the sha256 of the user name as the internal name\n # This is to both avoid naming problems when uploading and to obfuscate the key name\n keys_key = BackupEngine::Checksums::Engines::SHA256.new.block(name.to_s)\n raise('Key name sha collission') if @keys.key?(keys_key)\n\n @keys[keys_key] = rsa_keys.merge(name: name)\n end\n end\n end\n\n raise('No encryption keys') if @keys.empty?\n\n return @keys\n end",
"def get_keys\n @encryption_io.get_keys\n end",
"def ids\n storage.keys\n end",
"def keys\n Results::KeyOccurrences.merge_keys collect_results.flatten(1)\n end",
"def keys\n @keys ||= LicenseField.all.map(&:key)\n end",
"def claimed_keys\n [key]\n end",
"def keys\n memoize(:keys) do\n reversed = structures.reverse_each\n\n final_keyset = reversed.each_with_object({}) do |container, keyset|\n not_deleted = container.keys.reject { |k| keyset.deleted?(k) }\n not_deleted.each do |k|\n keyset[k] = container.deleted?(k) ? Utils::DeletedMarker : true\n end\n end\n\n final_keyset.keys.reject { |key| final_keyset[key].equal?(Utils::DeletedMarker) }\n end\n end",
"def keygens\n @keygens ||= fields.select { |f| f.class == Keygen }\n end",
"def user_keys\n @user_keys ||= begin\n _keys = keys || {}\n ret = Hash[_keys.map { |k, v| [clean_identifier(k), v] }]\n if ret.keys.count != _keys.keys.count\n Logger.warn \\\n \"Duplicate public key identifiers were detected in #keys.\"\n end\n ret\n end\n end",
"def keys\n @hash.keys\n end",
"def keys\n @hash.keys\n end",
"def fetch_signing_keys\n response = JSON.parse(Net::HTTP.get(URI(signing_keys_url)))\n response['keys']\n rescue JSON::ParserError\n raise StandardError, 'Unable to fetch AzureAD signing keys.'\n end",
"def encrypted_keys\n @encrypted_keys ||= encrypted_attributes.keys\n end",
"def keys\n storage_hash.keys\n rescue\n nil\n end",
"def stored_key_associations\n associations.values.select(&:stored_key?)\n end",
"def keys\n @hash.keys\n end",
"def keys\n @hash.keys\n end",
"def keys\n @hash.keys\n end",
"def keys\n\t\t\treturn @storage.keys\n\t\tend",
"def keys\n authorized_keys = []\n if team.present?\n log \"Got Github Team '#{team.name}' for Org '#{@org}'\"\n\n members = team_members(team.id)\n\n members.each do |member|\n log(\"Getting Member...#{member.login}\")\n\n keys = keys_for(member.login)\n\n # Can't get the real email address without logging in as that user\n email = \"#{member.login}@github.com\"\n\n keys.each do |key|\n authorized_keys << [key[:key], email]\n end\n end\n else\n log(\"No '#{@team_name}' team for '#{@org}' found\")\n log(teams.inspect)\n end\n authorized_keys\n end",
"def list_keys\n @keys.keys\n end",
"def list_keys\n @keydict.keys\n end",
"def all_keys\n [\n input_samples.keys,\n input_parameters.keys,\n input_data.keys,\n output_samples.keys,\n output_data.keys,\n operation_data.keys\n ].flatten.uniq.sort\n end",
"def keys(arg = nil)\n if arg.nil?\n storage.keys\n else\n with_interest(arg).map { |key, _, _| key }\n end\n end",
"def keys\n jiak.client.keys(jiak.bucket)\n end",
"def keys(msg_id)\n KEY_SUFFIXES.map{|suffix| key(msg_id, suffix)}\n end",
"def keys\n (content_methods |\n mutations.keys |\n fallback_data.keys).flatten\n end",
"def list_signing_keys(opts = {})\n data, _status_code, _headers = list_signing_keys_with_http_info(opts)\n data\n end",
"def keys\n return [], []\n end",
"def keys\n return @keys if defined?(@keys)\n @keys = all.map do |tone|\n Key.from_index(tone.tone, tone.letter_index)\n end\n end",
"def keys\n map(&:key)\n end",
"def get_key_list\n read(Common::KEY) || Hash.new\n end",
"def keys\n keys = []\n each_pair {|k,v| keys << k}\n keys\n end",
"def keys\n k ||= {}\n @zones ||= load_zones\n return if @zones.nil? || @zones.empty?\n\n # global default keys if they exist\n # TODO: need to work out the namespace on dns stuff here.\n # TODO: be good to support knife-vault/encrypted bags for keys\n if node.key?(:dns) && node['dns'].key?(:rndc_key)\n k[node.normal['dns']['rndc_key']] = get_key node['dns']['rndc_key']\n end\n\n @zones.each { |zone| k[zone['rndc_key']] = get_key zone['rndc_key'] if zone.key? 'rndc_key' }\n k\n end",
"def keys\n map(&:key).uniq\n end",
"def get_all_keys\n keys = Hash.new()\n @packages.each do |key, value|\n keys[key] = value.stringpool_keystrings.values\n end\n\n return keys\n end",
"def keys\n @key\n end",
"def keys\n ::M2X::Client::Key.list(@client, params.merge(device: self[\"id\"]))\n end",
"def keys\n configs.keys | store.keys\n end",
"def keys\n @ledger.keys\n end",
"def identities\n identities = []\n @known_identities = Hash.new\n\n ensure_agent\n if @agent\n @agent.identities.each do |key|\n identities.push key\n @known_identities[ key ] = { :from => :agent }\n end\n end\n\n @key_files.each do |file|\n if @key_existence_tester.readable?( file )\n begin\n key = @keys.load_public_key( file + \".pub\" )\n identities.push key\n @known_identities[ key ] = { :from => :file, :file => file }\n rescue Exception => e\n @log.warn \"could not load public key file \" +\n \"'#{file}.pub' (#{e.message} [#{e.class}])\" if @log.warn?\n end\n end\n end\n\n identities\n end",
"def keys\n @store.keys\n end",
"def get_keys()\n\t\t\treturn @config.keys\n\t\tend",
"def keys\n @keys ||= [column_for_order_by(relation), primary_key].compact.uniq\n end",
"def keys\n configuration.keys\n end",
"def keys\n return self.keySet.to_a\n end",
"def keys\n\n self.to_h.keys\n end",
"def key_files; end",
"def keys\n (@hash.keys + @converted.keys)\n end",
"def credential_keys\n %w(seal certificate) & valid_keys\n end",
"def authentication_keys\n @authentication_keys ||= User.authentication_keys\n end",
"def keys\n @navigable_map.key_set.to_a\n end",
"def keys\n list = []\n each_key{|key| list << key}\n list\n end",
"def keys\n return []\n end",
"def kenim_ids\n @kenim_ids = []\n kenim.each do |k|\n @kenim_ids.push( k._id )\n end\n return @kenim_ids\n end",
"def list_keys()\n # TODO\n end",
"def get_keys(jwt)\n\t\tp 'Setting the keys'\n\t\t@decodedJWT = JWT.decode(jwt.to_s,nil,settings.appSig)\n\t\t@jwtJSON = JSON.parse(@decodedJWT.to_json) \n\t\tsettings.oauthToken = @jwtJSON[\"request\"][\"user\"][\"oauthToken\"]\n\t\tsettings.internalOauthToken = @jwtJSON[\"request\"][\"user\"][\"internalOauthToken\"]\n\t\tsettings.refreshToken = @jwtJSON[\"request\"][\"user\"][\"refreshToken\"]\n\t\tsettings.jwt = jwt\n\t\tsettings.exp = @jwtJSON[\"exp\"]\nend",
"def keys\n prefixed_keys.map { |key|\n Rack::Attack.unprefix_key(key)\n }\n end",
"def keys\n prefixed_keys.map { |key|\n Rack::Attack.unprefix_key(key)\n }\n end",
"def keys\n [Array(hash_keys) + Array(range_keys)].flatten.uniq\n end",
"def keys\n [Array(hash_keys) + Array(range_keys)].flatten.uniq\n end",
"def list\n @keychain.keys\n end",
"def keys\n @monitor.synchronize { @stash.keys }\n end",
"def keys\n entries.keys\n end",
"def signing_key\n @signing_key\n end",
"def keys\n\n (@services.keys + conf.keys).uniq.sort\n end",
"def generate_keys\n\t\tself.token = OAuth::Helper.generate_key(20)[0,20]\n\t\tself.expires_at = 10.minutes.from_now\n\t\tself.authorized_at = Time.now\n\tend",
"def keys\n DoesKeyValue::State.instance.keys[self.to_s]\n end",
"def static_keys\n keys - dynamic_keys\n end",
"def validation_keys_hash(client_id = nil, client_secret = nil)\n hdrs = client_id && client_secret ?\n { \"authorization\" => Http.basic_auth(client_id, client_secret)} : {}\n response = json_get(target, \"/token_keys\", key_style, hdrs)\n\n keys_map = {}\n\n response['keys'].each do |key|\n keys_map[key['kid']] = key\n end\n\n keys_map\n end",
"def sorted_keys\n SORTED_KEYS\n end",
"def encrypted_keys\n Array(config[:encrypted_keys]).concat(\n Array(Chef::Config[:knife][:secure_data_bag][:encrypted_keys])\n ).uniq\n end",
"def identifier_keys\n @identifier_keys ||= [:selected, model_id_key, :id].uniq\n end",
"def signing_key; end",
"def current_keys\n @current_keys ||= []\n end",
"def ssh_keys(env, ids_only = false)\n account = env[:sl_client][\"SoftLayer_Account\"]\n acc_keys = sl_warden { account.object_mask(\"mask[id,label]\").getSshKeys }\n key_ids = []\n Array(env[:machine].provider_config.ssh_key).each do |key|\n pattern = key.is_a?(String) ? \"label\" : \"id\"\n key_hash = acc_keys.find { |acc_key| acc_key[pattern] == key }\n raise Errors::SLSshKeyNotFound, :key => key unless key_hash\n key_ids << key_hash[\"id\"]\n end\n return (ids_only ? key_ids : key_ids.map { |key_id| { :id => key_id } })\n end",
"def keys\n head.commit.tree.contents.map{|blob| deserialize(blob.name) }\n end",
"def keys\n head.commit.tree.contents.map{|blob| deserialize(blob.name) }\n end",
"def to_ary\n @keys\n end",
"def keys\n lookup_map.keys\n end",
"def key_map\r\n hash = {}\r\n hash['adultsAllowed'] = adults_allowed\r\n hash['barcodeTypeUuid'] = barcode_type_uuid\r\n hash['childrenAllowed'] = children_allowed\r\n hash['currencyUuid'] = currency_uuid\r\n hash['pricePerTicket'] = price_per_ticket\r\n hash['productTypesUuid'] = product_types_uuid\r\n hash['tickets'] = tickets ? tickets.map(&:key_map) : nil\r\n hash['ticketsBatchName'] = tickets_batch_name\r\n hash['ticketsBatchReference'] = tickets_batch_reference\r\n hash['ticketsOrderDate'] = tickets_order_date\r\n hash['ticketsPerPerson'] = tickets_per_person\r\n hash['validFrom'] = valid_from\r\n hash['validTo'] = valid_to\r\n hash['ticketsOrderReference'] = tickets_order_reference\r\n hash\r\n end",
"def keys\n IbmCloudRest.get \"#{@uri}/keys\"\n end",
"def signing_key\n [percent_encode(@secret), percent_encode(@token)].join('&')\n end",
"def keys\n config.resolver.keys(_container)\n end",
"def oids\n\t\treturn @storage.keys\n\tend",
"def recovery_keys\n return @recovery_keys\n end",
"def keys\n map { |line| line.key }\n end",
"def all_keys\n map(&:all_keys).flatten.uniq.sort\n end",
"def key_map\n hash = {}\n hash['email'] = self.email\n hash['zip'] = self.zip\n hash['user_id'] = self.user_id\n hash\n end",
"def uniq_keys\n all.to_a.collect {|n| n.key }.uniq\n end",
"def cache_objects_keys\n @object_data[].keys\n end",
"def signature\n Base64.encode64(encryption_key.sign(OpenSSL::Digest::SHA256.new, id_string))\n end",
"def keys\n (original || {}).keys\n end",
"def keys\n @redis.keys(@list + '*').reject { |s| s.end_with? '_MD5' }\n end",
"def signature_key; end",
"def to_key\n key = id\n [key] if key\n end",
"def keygens; end"
] |
[
"0.73901874",
"0.67432755",
"0.67151344",
"0.6658316",
"0.65744984",
"0.65197563",
"0.6444692",
"0.64068615",
"0.6389506",
"0.638078",
"0.6379534",
"0.636936",
"0.6366043",
"0.6366043",
"0.6356948",
"0.63182974",
"0.631239",
"0.6303397",
"0.6273195",
"0.6273195",
"0.6273195",
"0.6263564",
"0.6256563",
"0.62536156",
"0.62518996",
"0.62488073",
"0.62479734",
"0.61996436",
"0.61775136",
"0.61598885",
"0.6159786",
"0.6155842",
"0.6148221",
"0.6139205",
"0.6137889",
"0.6133155",
"0.60864407",
"0.60659444",
"0.60654944",
"0.60618895",
"0.605935",
"0.6056987",
"0.6055893",
"0.6055372",
"0.6052644",
"0.60484314",
"0.6034305",
"0.60317594",
"0.6019294",
"0.60091454",
"0.600828",
"0.6003587",
"0.60009694",
"0.59992975",
"0.5982479",
"0.59792244",
"0.5976945",
"0.5970851",
"0.5965297",
"0.5955596",
"0.5953058",
"0.5953058",
"0.59347814",
"0.59347814",
"0.5929283",
"0.5929265",
"0.5918481",
"0.5908032",
"0.589566",
"0.58875394",
"0.5877041",
"0.58724034",
"0.586569",
"0.5863402",
"0.58590823",
"0.5851035",
"0.58350664",
"0.58331037",
"0.58300585",
"0.58223814",
"0.58223814",
"0.5819852",
"0.5809043",
"0.5808578",
"0.5797171",
"0.5795862",
"0.5794731",
"0.57901305",
"0.57843596",
"0.57843554",
"0.5783907",
"0.5770048",
"0.5765415",
"0.5751132",
"0.5746753",
"0.5734713",
"0.5733118",
"0.57262236",
"0.5722473",
"0.571669"
] |
0.8161365
|
0
|
The location of the public keys of the token signer. This is parsed from the OpenId config response.
|
def signing_keys_url
return openid_config['jwks_uri'] if openid_config.include? 'jwks_uri'
fail StandardError, 'No jwks_uri in OpenId config response.'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def public_keys\n @public_keys\n end",
"def public_key_data\n @public_key\n end",
"def public_key_params\n params[:public_key]\n end",
"def public_key_params\n params[:public_key]\n end",
"def url\n unless @url\n conf = Grape::Jwt::Authentication.configuration\n return conf.rsa_public_key_url\n end\n @url\n end",
"def public_key\n return self.authentication.public_key\n end",
"def public_key\n return self.authentication.public_key\n end",
"def public_key\n @pub\n end",
"def public_key\n return @children['public-key'][:value]\n end",
"def private_keys\n [private_key_path]\n end",
"def public_key\n @priv.public_key\n end",
"def public_key\n @cert.public_key\n end",
"def public_key\n @cert.public_key\n end",
"def public_key\n public_key_object.to_pem\n end",
"def signing_keys\n @signing_keys ||= fetch_signing_keys\n end",
"def public_roots\n roots, publics = [*options.roots], [*options.publics]\n roots.map{|root| publics.map{|public| ::File.join(root, public) }}.flatten\n end",
"def parse_public_keys\n # Convert keys to compressed_hex format for bitcoin-ruby\n @public_keys_hex = @cosigners_nodes.map { |index, key| key.public_key.to_hex }\n end",
"def public_key; end",
"def public_key; end",
"def public_key; end",
"def root_keys; <<~EOS\n . IN DS 19036 8 2 49aac11d7b6f6446702e54a1607371607a1a41855200fd2ce1cdde32f24e8fb5\n . IN DS 20326 8 2 e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d\n EOS\n end",
"def public_key\n require_key\n\n @private_key.public_key.to_pem\n end",
"def key_file_locations\n [\n \".ppkeys\",\n \"#{Base.base_config_directory}/.ppkeys\",\n \"#{Base.storage_directory}/ppkeys\", \n \"~/.ppkeys\",\n \"ppkeys\"\n ]\n end",
"def key_file_locations\n [\n \".ppkeys\",\n \"#{Base.base_config_directory}/.ppkeys\",\n \"#{Base.storage_directory}/ppkeys\", \n \"~/.ppkeys\",\n \"ppkeys\"\n ]\n end",
"def public_key\n @public_key.to_der\n end",
"def public_key\n OpenSSL::PKey.read(public_to_der)\n end",
"def public_key\n OpenSSL::PKey.read(public_to_der)\n end",
"def keys\n JSON.parse get('/users/ssh_keys', :accept => 'json').to_s\n end",
"def keys\n doc = JSON.parse get('/api/v1/ssh_keys')\n doc[\"ssh_keys\"]\n end",
"def public_key\n # Base64 encode without line feeds\n Base64.strict_encode64(public_key_raw)\n end",
"def get_public_key\n return @public_key\n end",
"def public_key\n @public_key ||= load_key(@public_key_file)\n end",
"def public_key=(k)\n return self.authentication.public_key = k\n end",
"def public_key=(k)\n return self.authentication.public_key = k\n end",
"def server_public_key\n raise(\"No ssl_server_public configuration option specified\") unless @config.pluginconf.include?(\"ssl_server_public\")\n return @config.pluginconf[\"ssl_server_public\"]\n end",
"def public_key_file(callerid = nil)\n if @initiated_by == :client\n return server_public_key\n else\n if callerid =~ /cert=([\\w\\.\\-]+)/\n cid = $1\n\n if File.exist?(\"#{client_cert_dir}/#{cid}.pem\")\n return \"#{client_cert_dir}/#{cid}.pem\"\n else\n raise(\"Could not find a public key for #{cid} in #{client_cert_dir}/#{cid}.pem\")\n end\n else\n raise(\"Caller id is not in the expected format\")\n end\n end\n end",
"def signature_key; end",
"def public_key\n Akero.replate(@cert.to_s, Akero::PLATE_CERT)\n end",
"def public_key\n encode_tz(:edpk, 32)\n end",
"def minionList\n self['minions'].transform_values {|v| v.pub_key }\n end",
"def signing_key; end",
"def identities\n identities = []\n @known_identities = Hash.new\n\n ensure_agent\n if @agent\n @agent.identities.each do |key|\n identities.push key\n @known_identities[ key ] = { :from => :agent }\n end\n end\n\n @key_files.each do |file|\n if @key_existence_tester.readable?( file )\n begin\n key = @keys.load_public_key( file + \".pub\" )\n identities.push key\n @known_identities[ key ] = { :from => :file, :file => file }\n rescue Exception => e\n @log.warn \"could not load public key file \" +\n \"'#{file}.pub' (#{e.message} [#{e.class}])\" if @log.warn?\n end\n end\n end\n\n identities\n end",
"def ecdh_public_key_bytes; end",
"def pubkey\n # Split every 2 bytes\n paths = combined_hash.unpack('S>*')\n paths.inject(payment_base) { |key, p| key.derive(p) }\n end",
"def public_key\n as_public_key(rpc(:account_key, _access: :key))\n end",
"def get_public_key(private_key)\n PointG1.from_private_key(private_key)\n end",
"def get_importers_pusher_key\n return @client.raw(\"get\", \"/config/pusher_key\")\n end",
"def public_key\n return @public_key if File.exist?(@agent_file) && File.exist?(@key_file)\n # create the agent and key if at least one file does not exist (anymore)\n create_agent_key_combo\n @public_key\n end",
"def get_working_key_file_locations\n key_file_locations.reject {|f| f unless ::File.file?(f) }.first\n end",
"def get_working_key_file_locations\n key_file_locations.reject {|f| f unless ::File.file?(f) }.first\n end",
"def extract_public_key(options)\n extract_key(options[:public_key] || options[:key_pair] || ENV['PUBLIC_KEY'])\n end",
"def client_public_key\n return ENV[\"MCOLLECTIVE_SSL_PUBLIC\"] if ENV.include?(\"MCOLLECTIVE_SSL_PUBLIC\")\n\n raise(\"No plugin.ssl_client_public configuration option specified\") unless @config.pluginconf.include?(\"ssl_client_public\")\n\n return @config.pluginconf[\"ssl_client_public\"]\n end",
"def public_key\n @data_public_key ||= load_public_key\n end",
"def public_key_hash\n Crypto.hash_public_key(public_key)\n end",
"def host_identities\n identities = []\n @known_host_identities = Hash.new\n\n @host_key_files.each do |file|\n if @key_existence_tester.readable?( file )\n begin\n key = @keys.load_public_key( file + \".pub\" )\n identities.push key\n @known_host_identities[ key ] =\n { :from => :file, :file => file }\n rescue Exception => e\n @log.warn \"could not load public host key file \" +\n \"'#{file}.pub' (#{e.message} [#{e.class}])\" if @log.warn?\n end\n end\n end\n\n identities\n end",
"def key_files; end",
"def public_addresses\n details['addresses']['public'].map { |i| i[\"addr\"] }\n end",
"def public_key_string\n [@public_key.to_s].pack(\"m*\").gsub(\"\\n\", \"\")\n end",
"def signing_key\n @signing_key\n end",
"def public_path\n raise \"An Entry must define a `public_path` in its Spec.\"\n end",
"def jwks\n jwks_uri = URI(@issuer + '.well-known/jwks.json')\n @jwks ||= json_parse(Net::HTTP.get(jwks_uri))\n end",
"def key_path\n\t\t\tFile.join(@root, \"#{@hostname}.key\")\n\t\tend",
"def key_prefix(payload)\n object_key = File.join(\n config.fetch(:bucket_prefix, 'published-repositories'),\n payload.get(:data, :account, :name)\n )\n end",
"def public_key_for_push_header\n trim_encode64(curve.public_key.to_bn.to_s(2))\n end",
"def stored_signature\n result = Overcommit::Utils.execute(\n %w[git config --local --get] + [signature_config_key]\n )\n\n if result.status == 1 # Key doesn't exist\n return ''\n elsif result.status != 0\n raise Overcommit::Exceptions::GitConfigError,\n \"Unable to read from local repo git config: #{result.stderr}\"\n end\n\n result.stdout.chomp\n end",
"def to_bytes\n @public_key\n end",
"def dir\n @keystore\n end",
"def load_public_key(filename); end",
"def public_key\n encode64(curve.public_key.to_bn.to_s(2))\n end",
"def pp_signature headers\n headers['Autorizacion']\n end",
"def sign_key; end",
"def signatures\n parsed {\n @signatures \n }\n end",
"def public_rsa\n @public_rsa ||= OpenSSL::PKey::RSA.new(@public_key)\n end",
"def public_rsa\n @public_rsa ||= OpenSSL::PKey::RSA.new(@public_key)\n end",
"def masterfile_keys\n ['orgzn', 'acct', 'farm']\n end",
"def key_pem; end",
"def index\n @public_keys = PublicKey.all\n end",
"def location_keys\n @@location_keys\n end",
"def public_status\n status_hash.select { |_, v| v[:public] }.keys\n end",
"def public_ips\n hwaddr = self.hwaddr\n Hash[\n Meta.connection do\n Meta.interface(hwaddr, 'ipv4-associations/', not_found: '', cache: false).lines.map do |public_ip|\n public_ip.strip!\n unless private_ip = Meta.interface(hwaddr, \"ipv4-associations/#{public_ip}\", not_found: nil, cache: false)\n raise Errors::MetaBadResponse\n end\n [ private_ip, public_ip ]\n end\n end\n ]\n end",
"def keys\n jiak.client.keys(jiak.bucket)\n end",
"def full_public_id_internal(key)\n public_id = public_id_internal(key)\n\n return public_id unless @options[:folder]\n\n File.join(@options.fetch(:folder), public_id)\n end",
"def keycert_files; end",
"def get_public_key\n # Obtain public key\n pem_cert = Env.instance['RSA_PUBLIC_KEY_PATH']\n begin\n public_key = File.read(pem_cert)\n return public_key\n rescue => err \n $stderr.puts \"ERROR: missing RSA_PUBLIC_KEY_PATH in env.yml'\"\n end\n nil\n end",
"def keys\n return full_path.to_s.split('.') if full_path\n return [key.to_s] unless path&.present?\n\n [path, key].compact.join('.').split('.')\n end",
"def fetch_signing_keys\n response = JSON.parse(Net::HTTP.get(URI(signing_keys_url)))\n response['keys']\n rescue JSON::ParserError\n raise StandardError, 'Unable to fetch AzureAD signing keys.'\n end",
"def keys\n configuration.keys\n end",
"def urls\n keys\n end",
"def keys\n head.commit.tree.contents.map{|blob| deserialize(blob.name) }\n end",
"def keys\n head.commit.tree.contents.map{|blob| deserialize(blob.name) }\n end",
"def public_key\n Base64.encode64(\"conversation_#{id}\").gsub(/(=|\\n)/, '') << id.to_s.last\n end",
"def current_signer\n data['currentSigner']\n end",
"def keys\n\t\tdoc = xml get('/user/keys')\n\t\tdoc.elements.to_a('//keys/key').map do |key|\n\t\t\tkey.elements['contents'].text\n\t\tend\n\tend",
"def keys\n\t\tdoc = xml get('/user/keys')\n\t\tdoc.elements.to_a('//keys/key').map do |key|\n\t\t\tkey.elements['contents'].text\n\t\tend\n\tend",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @public_keys }\n end\n end",
"def get_trusted_keys\n return [] unless File.file?(@trust_path)\n\n # no signature verification\n File.open(@trust_path, 'r').readlines.map(&:chomp).uniq.sort\nend",
"def load_public_key\n @public_rsa = nil\n \n if public_key_file && File.file?(public_key_file)\n @public_key = File.read(public_key_file)\n end\n end",
"def pubkey\n end",
"def keys\n @service_points.keys\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @public_key }\n end\n end"
] |
[
"0.6299287",
"0.5973184",
"0.58965415",
"0.58965415",
"0.58784056",
"0.5847531",
"0.5847531",
"0.5818846",
"0.57765996",
"0.57512957",
"0.57394993",
"0.57181203",
"0.56955385",
"0.56206775",
"0.5607222",
"0.5568036",
"0.55612355",
"0.5544635",
"0.5544635",
"0.5544635",
"0.54851145",
"0.5482549",
"0.5464105",
"0.5464105",
"0.54151386",
"0.53984886",
"0.53984886",
"0.5393076",
"0.539248",
"0.5388413",
"0.5375524",
"0.53547525",
"0.5351255",
"0.5351255",
"0.5331734",
"0.5324822",
"0.53097326",
"0.5253283",
"0.5238177",
"0.52348757",
"0.52346843",
"0.51760954",
"0.5164374",
"0.5147409",
"0.5136852",
"0.5134421",
"0.51295716",
"0.51267284",
"0.50866693",
"0.50866693",
"0.5079661",
"0.5069302",
"0.506015",
"0.505587",
"0.50456065",
"0.504166",
"0.50372434",
"0.50338465",
"0.50325894",
"0.50201195",
"0.5000577",
"0.49966785",
"0.49935827",
"0.49933547",
"0.49744117",
"0.49523184",
"0.49522126",
"0.49519798",
"0.49412826",
"0.49393234",
"0.49357757",
"0.49326763",
"0.49237347",
"0.49237347",
"0.49115214",
"0.48939547",
"0.48870698",
"0.4885263",
"0.4881092",
"0.48744714",
"0.48728508",
"0.48666662",
"0.4863931",
"0.48461288",
"0.48392805",
"0.4837095",
"0.4828424",
"0.4827018",
"0.4808629",
"0.4808629",
"0.4808345",
"0.48048922",
"0.48035532",
"0.48035532",
"0.48015913",
"0.48006013",
"0.4771135",
"0.47693893",
"0.4761338",
"0.4754897"
] |
0.63673264
|
0
|
The tenant of the calling application. Note that this must be explicitly configured when installing the AzureAD OmniAuth strategy.
|
def tenant
return options.tenant if options.tenant
fail StandardError, 'No tenant specified in AzureAD configuration.'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def current_tenant\n ActsAsTenant.current_tenant\n end",
"def current_tenant\n ActsAsTenant.current_tenant\n end",
"def current_tenant\n ActsAsTenant.current_tenant\n end",
"def tenant_id\n return @tenant_id\n end",
"def tenant_id\n return @tenant_id\n end",
"def tenant_id\n return @tenant_id\n end",
"def tenant_id\n return @tenant_id\n end",
"def current_tenant_id\n self.class.current_tenant_id\n end",
"def current_tenant\n MultiTenant.current_tenant\n end",
"def current_tenant\n Tenant.find_by_domain! current_user.email_domain\n end",
"def current_tenant\n @current_tenant ||= Roomer.tenant_model.find_by_url_identifier(url_identifier)\n end",
"def current_tenant\n if params[:tenant_id].present?\n tenant = Tenant.find(params[:tenant_id])\n else\n Tenant.last\n end\n end",
"def tenant_path\n @tenant_path ||= '/api/v2/tenants/settings'\n end",
"def client_application_tenant_ids\n return @client_application_tenant_ids\n end",
"def current_tenant\n\t\t@current_tenant ||= Tenant.find_by(id: session[:tenant_id])\n \tend",
"def client_id\n return options.client_id if options.client_id\n fail StandardError, 'No client_id specified in AzureAD configuration.'\n end",
"def url_identifier\n case Roomer.url_routing_strategy\n when :domain\n return request.host\n when :path\n return params[:tenant_identifier]\n end\n end",
"def tenant\n TenantView.new(space.tenant)\n end",
"def tenant_name\n url_shortcut\n end",
"def rails_cache_id\n Apartment::Tenant.current_tenant\n end",
"def tenant_id=(value)\n @tenant_id = value\n end",
"def tenant_id=(value)\n @tenant_id = value\n end",
"def tenant_id=(value)\n @tenant_id = value\n end",
"def tenant_id=(value)\n @tenant_id = value\n end",
"def azure_ad_user_id\n return @azure_ad_user_id\n end",
"def set_tenant\n if current_user\n current_account = Account.where(id: current_user.current_tenant_id).first\n set_current_tenant(current_account)\n end\n end",
"def app_identifier\n return @app_identifier\n end",
"def client_id\n ENV['AZURE_CLIENT_ID']\n end",
"def tenant_class\n @tenant_class ||= if self.model.respond_to?(:call)\n self.model.call\n elsif self.model.respond_to?(:constantize)\n self.model.constantize\n else\n self.model\n end\n end",
"def active_directory_settings\n MsRestAzure::ActiveDirectoryServiceSettings.get_azure_settings\n end",
"def get_current_tenant \n get(\"/tenants.json/current\")\nend",
"def current_tenant_permissions\n if current_or_guest_user\n current_or_guest_user.tenant_ids\n else\n nil\n end\n end",
"def get_client_customer_id\n adwords.credential_handler.credentials[:client_customer_id]\n end",
"def app_id\n return @app_id\n end",
"def app_id\n return @app_id\n end",
"def app_id\n return @app_id\n end",
"def app_company\n 'BarkerEST'\n end",
"def tenancy_host\n ld_api ? ld_api.tenancy_host : nil\n end",
"def app_scope_id\n return @app_scope_id\n end",
"def current_organisation_id()\n return Thread.current[:organisation_id]\n end",
"def connection_for_application\n oauth_client.client_credentials.get_token\n end",
"def primary_tenant_permission\n if current_or_guest_user\n current_or_guest_user.tenant_ids.first\n else\n nil\n end\n end",
"def set_current_tenant_id\n Tenant.current_id = self.id\n end",
"def client_application_tenant_ids=(value)\n @client_application_tenant_ids = value\n end",
"def application\n # If we have a doorkeeper_token, derive the Application from it.\n # If not, we're in case #1 above and the Application should be nil.\n @application ||= @doorkeeper_token.try(:application)\n end",
"def subscription_id\n ENV['AZURE_SUBSCRIPTION_ID']\n end",
"def subscription_id\n ENV['AZURE_SUBSCRIPTION_ID']\n end",
"def deduce_tenant_host\n if request.host.downcase.start_with?('www.')\n request.host[4..-1]\n else\n request.host\n end\n end",
"def consent_id\n Rails.configuration.x.true_layer.client_id\n end",
"def device_account\n return @device_account\n end",
"def application_id\n return @application_id\n end",
"def comm_template_name\n @@tenant_info[\"comm_template_name\"]\n end",
"def target_id\n user_app_token\n end",
"def tenant_default_timezone\n return @tenant_default_timezone\n end",
"def set_current_tenant!\n # Raise an exception if the current tenant is blank\n raise \"No tenant found for '#{url_identifier}' url identifier\" if current_tenant.blank?\n Roomer.current_tenant = current_tenant\n end",
"def current_organization\n fog_model_interface.current_organization\n end",
"def pp_tenant( tenant, do_flat=true )\n \tloc.pp_tenant( tenant, do_flat );\n end",
"def app_id\n @app.id\n end",
"def set_tenant_of\n @tenant_of = TenantOf.find_by(id: params[:id])\n @tenant = @tenant_of.user\n end",
"def new_tenant()\n Thread.current[:tenant_id] = Factory(:tenant).id\n end",
"def client_guid\n client_id\n end",
"def application_attendee_name(attendee)\n attendee[:Attendee][:ApplicationMetadata][:User][:name]\n end",
"def app_name\n ApplicationService.application_name\n end",
"def base_uri\n \"#{api}/admin/tenants\"\n end",
"def app_name\n c.application\n end",
"def sign_in_audience\n return @sign_in_audience\n end",
"def set_tenant_and_account\n @account = current_user.account\n set_current_tenant @account\n end",
"def application_id\n @application_id || YodleeApi.application_id\n end",
"def rails_cache_id\n Apartment::Tenant.current\n end",
"def application_name\n return @application_name\n end",
"def app\n @options[:app]\n end",
"def parse_tenant_name(request)\n auth_string = request.env['HTTP_AUTHORIZATION']\n return 'public' if auth_string.blank?\n\n @auth_type, @token = auth_string.split(' ')\n auth_type.downcase!\n return 'public' unless auth_is_well_formed\n\n schema_name = send(\"tenant_name_from_#{auth_type}\")\n request.env['X-AccountId'] = schema_name\n schema_name\n end",
"def app_name\n return @app_name\n end",
"def app_name\n return @app_name\n end",
"def app_identifier\n Origen.config.initials || 'Anon App'\n end",
"def tenanted?\n @roomer_scope == :tenanted\n end",
"def application_id\n get_key('ALGOLIA_APPLICATION_ID', 'application_id')\n end",
"def ask\r\n WelcomeClass.select_tenant\r\n end",
"def openid_config_url\n \"https://login.windows.net/#{tenant}/.well-known/openid-configuration\"\n end",
"def account_organization\n get('account/organization')\n end",
"def organization()\n return MicrosoftGraph::Organization::OrganizationRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def app_activity_id\n return @app_activity_id\n end",
"def resource_app_id\n return @resource_app_id\n end",
"def scoped_to_tenant?\n !!scoped_to_tenant_id\n end",
"def orcid_callback\n orcid_choose_tenant_or_login!\n end",
"def get_client_id\n @client_id\n end",
"def app_name\n @app_name || Sapience.app_name\n end",
"def ad_settings\n case environment.downcase\n when \"azureusgovernment\"\n ::MsRestAzure::ActiveDirectoryServiceSettings.get_azure_us_government_settings\n when \"azurechina\"\n ::MsRestAzure::ActiveDirectoryServiceSettings.get_azure_china_settings\n when \"azuregermancloud\"\n ::MsRestAzure::ActiveDirectoryServiceSettings.get_azure_german_settings\n when \"azure\"\n ::MsRestAzure::ActiveDirectoryServiceSettings.get_azure_settings\n end\n end",
"def azure_options\n options = { tenant_id: tenant_id!,\n subscription_id: subscription_id,\n credentials: ::MsRest::TokenCredentials.new(token_provider),\n active_directory_settings: ad_settings,\n base_url: endpoint_settings.resource_manager_endpoint_url }\n options[:client_id] = client_id if client_id\n options[:client_secret] = client_secret if client_secret\n options\n end",
"def client_id\n ENV['KONTENA_CLIENT_ID'] || CLIENT_ID\n end",
"def from?(some_user)\n tenant == some_user\n end",
"def show\n @tenant=Tenant.find(params[:tenant_id])\n end",
"def app_id\n fb_app.id\n end",
"def initiate_tenant( tenant )\n __milia_change_tenant!( tenant.id )\n end",
"def ad_settings\n case environment.downcase\n when \"azureusgovernment\"\n ::MsRestAzure2::ActiveDirectoryServiceSettings.get_azure_us_government_settings\n when \"azurechina\"\n ::MsRestAzure2::ActiveDirectoryServiceSettings.get_azure_china_settings\n when \"azuregermancloud\"\n ::MsRestAzure2::ActiveDirectoryServiceSettings.get_azure_german_settings\n when \"azure\"\n ::MsRestAzure2::ActiveDirectoryServiceSettings.get_azure_settings\n end\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end",
"def set_tenant\n @tenant = Tenant.find(params[:id])\n end"
] |
[
"0.7369286",
"0.7369286",
"0.7369286",
"0.73279285",
"0.73279285",
"0.73279285",
"0.73279285",
"0.73185754",
"0.72746634",
"0.70236903",
"0.69072735",
"0.67408365",
"0.6450725",
"0.6428446",
"0.64179224",
"0.62244296",
"0.6117843",
"0.5986516",
"0.59557384",
"0.59209865",
"0.586825",
"0.586825",
"0.586825",
"0.586825",
"0.5773116",
"0.56674844",
"0.5666502",
"0.56657964",
"0.5611197",
"0.560438",
"0.5590726",
"0.5557925",
"0.5541549",
"0.5535846",
"0.5535846",
"0.5535846",
"0.5522816",
"0.5513952",
"0.54840493",
"0.54754984",
"0.5474503",
"0.544975",
"0.5421339",
"0.54121643",
"0.5401917",
"0.5377773",
"0.5377773",
"0.5371246",
"0.5366229",
"0.5354756",
"0.53539574",
"0.53498477",
"0.53298986",
"0.53183943",
"0.53108656",
"0.5305239",
"0.5295857",
"0.52935165",
"0.5292735",
"0.52921665",
"0.52892536",
"0.52806777",
"0.52566046",
"0.5243591",
"0.522531",
"0.52179724",
"0.52098525",
"0.51958936",
"0.51732093",
"0.516695",
"0.5161669",
"0.51574636",
"0.51574355",
"0.51574355",
"0.514168",
"0.5138755",
"0.51304406",
"0.5126551",
"0.51039594",
"0.50978154",
"0.5094923",
"0.50937",
"0.50905526",
"0.50892144",
"0.5083024",
"0.50755006",
"0.5066836",
"0.50465083",
"0.50442195",
"0.50396246",
"0.5038309",
"0.5036595",
"0.5036509",
"0.503534",
"0.50330806",
"0.50299925",
"0.50299925",
"0.50299925",
"0.50299925",
"0.50299925"
] |
0.8110246
|
0
|
Verifies the signature of the id token as well as the exp, nbf, iat, iss, and aud fields. See OpenId Connect Core 3.1.3.7 and 3.2.2.11.
|
def validate_and_parse_id_token(id_token)
# The second parameter is the public key to verify the signature.
# However, that key is overridden by the value of the executed block
# if one is present.
#
# If you're thinking that this looks ugly with the raw nil and boolean,
# see https://github.com/jwt/ruby-jwt/issues/59.
jwt_claims, jwt_header =
JWT.decode(id_token, nil, false, verify_options) do |header|
# There should always be one key from the discovery endpoint that
# matches the id in the JWT header.
x5c = (signing_keys.find do |key|
key['kid'] == header['kid']
end || {})['x5c']
if x5c.nil? || x5c.empty?
fail JWT::VerificationError,
'No keys from key endpoint match the id token'
end
# The key also contains other fields, such as n and e, that are
# redundant. x5c is sufficient to verify the id token.
OpenSSL::X509::Certificate.new(JWT.base64url_decode(x5c.first)).public_key
end
return jwt_claims, jwt_header if jwt_claims['nonce'] == read_nonce
fail JWT::DecodeError, 'Returned nonce did not match.'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def verify_iat; end",
"def verify_iat; end",
"def verify_signature\n @req.verify(public_key)\n end",
"def valid_signature?\n params['verifier'] == Digest::MD5.hexdigest([ params['id'], params['snuid'], params['currency'], Offerpal.secret_key ].join(':'))\n end",
"def verify_signature(result); end",
"def verify_signature\n #puts \"sing in params: #{@params[\"sign\"]}\" unless @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n #puts Alipay.generate_signature(@params, @key)\n @params[\"sign\"] == Tenpay.generate_signature(@params, @key) #.tap{|sig| puts \"Generated sig #{sig}\"}\n end",
"def verify_signature\n @spki.verify(public_key)\n end",
"def verify_signature\n return_code, response = send_command(\"verify_signature\", token)\n return_code == \"200\"\n end",
"def signature_valid?; end",
"def verify_signature(data)\n Signature.valid?(data.merge('api_key' => api_key))\n end",
"def verify_signatures?; end",
"def signature_is_valid?\n node = @ar.at_css('xmlns|SignedInfo',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#')\n\n node = node.canonicalize\n\n signature = @ar.at_css(\n 'xmlns|SignatureValue',\n 'xmlns' => 'http://www.w3.org/2000/09/xmldsig#'\n ).content\n\n signature = Base64.decode64(signature)\n\n certificate.public_key.verify(OpenSSL::Digest::SHA1.new, signature, node)\n end",
"def verify_signature\n #puts \"sing in params: #{@params[\"sign\"]}\" unless @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n #puts Alipay.generate_signature(@params, @key)\n @params[\"sign\"] == Alipay.generate_signature(@params, @key)\n end",
"def verify_signature\n begin\n signature = OAuth::Signature.build(request) do |token, consumer_key|\n self.current_application = find_application_by_key(consumer_key)\n self.current_token = find_token(token)\n\n token_secret = self.current_token ? self.current_token.secret : nil\n app_secret = self.current_application ? self.current_application.secret : nil\n \n self.oauth_logger.debug \"Signature build: application-secret: #{app_secret}; token-secret: #{token_secret}\"\n \n [token_secret, app_secret]\n end\n # Rescue requests made with unacceptable signature methods. \n # OAuth::Signature.available_methods holds a Hash of acceptable\n # signature methods. Provide a sane error message to the Consumer.\n rescue OAuth::Signature::UnknownSignatureMethod => e\n throw :halt, render(\"Unknown Signature Method: #{e.message}. Accepts: #{OAuth::Signature.available_methods.keys.join(', ')}\", :status => 401, :layout => false)\n end\n \n if signature.verify\n remember_request(signature)\n else\n self.oauth_logger.debug(\"Signature verify fail: Base: #{signature.signature_base_string}. Signature: #{signature.signature}\")\n \n throw :halt, render(\"Invalid OAuth Request. Signature could not be verified. Base: #{signature.signature_base_string}. Signature: #{signature.signature}\", :status => 401, :layout => false)\n end\n end",
"def verify_signature(params = {})\n version = params[:version]\n webhook_secret = params[:webhook_secret]\n stringified_data = params[:stringified_data]\n request_timestamp = params[:request_timestamp]\n signature = params[:signature]\n\n signature_params = \"#{request_timestamp}.#{version}.#{stringified_data}\"\n digest = OpenSSL::Digest.new('sha256')\n signature_to_be_verified = OpenSSL::HMAC.hexdigest(digest, webhook_secret, signature_params)\n\n signature == signature_to_be_verified\n\n end",
"def check(params)\n params = params.dup\n\n signature = params.delete('sig')\n\n ::JWT::SecurityUtils.secure_compare(signature, digest(params))\n end",
"def verify_iat=(_arg0); end",
"def verify_iat=(_arg0); end",
"def validateToken(token)\n if (token.nil? or token.empty?)\n debug(\"Error: validateToken: nil/empty token.\")\n return\n end\n body, sig = token.split(\"&sig=\")\n if (body.nil? or sig.nil?)\n debug(\"Error: validateToken: Invalid token: #{token}\")\n return\n end\n sig = u64(sig)\n return token if (sig == signToken(body))\n debug(\"Error: validateToken: Signature did not match.\")\n return\n end",
"def valid? headers, params\n timestamp = get_timestamp headers\n\n message = create_message params[\"token\"], params[\"trx_id\"], params[\"monto\"], timestamp\n authorization = Authorization.new(@env)\n signature = authorization.sign(message)\n signature == pp_signature(headers)\n\n end",
"def validate!(assertions = {})\n raise Expired if expired?\n\n # TODO: Nonce validation\n\n audiences = assertions[:audiences] || Array(assertions[:audience])\n if audiences.any?\n audience = id_token.aud\n unless audiences.include? audience\n raise InvalidAudience.new(audience)\n end\n end\n\n if assertions[:issuer]\n issuer = id_token.iss\n unless issuer == assertions[:issuer]\n raise InvalidIssuer.new(issuer)\n end\n end\n\n true\n end",
"def verify!\n verify\n rescue InvalidDigest, InvalidSignedValue => e\n raise InvalidSignature, e.message\n end",
"def verify!\n verify\n rescue InvalidDigest, InvalidSignedValue => e\n raise InvalidSignature, e.message\n end",
"def is_validate_signature\n signature = request.headers[\"X-LINE-Signature\"]\n http_request_body = request.raw_post\n hash = OpenSSL::HMAC::digest(OpenSSL::Digest::SHA256.new, CHANNEL_SECRET, http_request_body)\n signature_answer = Base64.strict_encode64(hash)\n signature == signature_answer\n end",
"def is_validate_signature\n signature = request.headers[\"X-LINE-Signature\"]\n http_request_body = request.raw_post\n hash = OpenSSL::HMAC::digest(OpenSSL::Digest::SHA256.new, CHANNEL_SECRET, http_request_body)\n signature_answer = Base64.strict_encode64(hash)\n signature == signature_answer\n end",
"def verify_claim!(jwks)\n legitimate_payload, _legitimate_header = decode_without_verification(@legitimate_id_token)\n\n options = {\n algorithm: ID_TOKEN_DECRYPTION_ALGORITHM,\n jwks: jwks,\n iss: legitimate_payload[:iss],\n verify_iss: true,\n aud: legitimate_payload[:aud],\n verify_aud: true,\n sub: legitimate_payload[:sub],\n verify_sub: true,\n }\n\n # The next method provides validation for *iss*, *aud*, *exp*, *sub* and *jwt_signature*.\n claimed_payload, _claimed_header = JWT.decode(@claimed_id_token, nil, true, options).first.with_indifferent_access\n\n # We assume that non standard jwt keys would be an End-User specific key.\n # Ref: https://openid.net/specs/openid-connect-core-1_0.html#HybridIDToken2\n # > If either ID Token contains Claims about the End-User,\n # > any that are present in both SHOULD have the same values in both.\n claimed_payload.each do |k, v|\n if STANDARD_JWT_KEYS.exclude?(k) && legitimate_payload.key?(k)\n unless v == legitimate_payload[k]\n raise SignInWithAppleErrors::EndUserClaimMismatch, \"End-User claim mismatch detected. Mismatched key: #{k}, Claimed value: #{v}, Apple's value: #{legitimate_payload[k]}.\"\n end\n end\n end\n\n # Check for replay attacks\n unless claimed_payload[:nonce] == legitimate_payload[:nonce]\n raise SignInWithAppleErrors::NonceMismatch, \"Nonce mismatch detected. Claimed nonce: #{claimed_payload[:nonce]}, Apple's nonce: #{legitimate_payload[:nonce]}.\"\n end\n\n claimed_payload\n rescue JWT::InvalidIssuerError\n raise SignInWithAppleErrors::InvalidIssuer, \"Issuer mismatch detected. Claimed iss: #{decode_without_verification(@claimed_id_token)[:iss]}, Apple's iss: #{decode_without_verification(@legitimate_id_token)[:iss]}.\"\n rescue JWT::InvalidAudError\n raise SignInWithAppleErrors::AudienceMismatch, \"Audience mismatch detected. Claimed aud: #{decode_without_verification(@claimed_id_token)[:aud]}, Apple's aud: #{decode_without_verification(@legitimate_id_token)[:aud]}.\"\n rescue JWT::InvalidSubError\n raise SignInWithAppleErrors::SubjectMismatch, \"Subject mismatch detected. Claimed sub: #{decode_without_verification(@claimed_id_token)[:sub]}, Apple's sub: #{decode_without_verification(@legitimate_id_token)[:sub]}.\"\n rescue JWT::ExpiredSignature\n raise SignInWithAppleErrors::ExpiredToken, \"The claimed id token has been expired.\"\n rescue JWT::VerificationError\n raise SignInWithAppleErrors::InvalidSignature, \"JWT Signature is incorrect.\"\n end",
"def has_valid_signature?\n Adyen::HPP::Signature.verify(params, shared_secret)\n end",
"def signature_is_valid?(env)\n return true if html_request?(env)\n\n # grab and compute the X-AUTH-SIG\n signature_sent = env[\"HTTP_X_AUTH_SIG\"]\n actual_signature = compute_signature(env)\n\n # are they the same?\n signature_sent.to_s == actual_signature.to_s\n end",
"def verify(app_id)\n # Chapter 4.3 in\n # http://fidoalliance.org/specs/fido-u2f-raw-message-formats-v1.0-rd-20141008.pdf\n data = [\n \"\\x00\",\n ::U2F::DIGEST.digest(app_id),\n ::U2F::DIGEST.digest(client_data_json),\n key_handle_raw,\n public_key_raw\n ].join\n\n begin\n parsed_certificate.public_key.verify(::U2F::DIGEST.new, signature, data)\n rescue OpenSSL::PKey::PKeyError\n false\n end\n end",
"def verify_hmac(sid)\n return unless sid\n digest, ver_sid = sid.split(\"--\")\n return false unless ver_sid\n digest == generate_hmac(ver_sid, @config.secret_key)\n end",
"def signature_is_valid?\n validate_signature(doc, certificate, :normal)\n end",
"def valid_signature?(params)\n (Time.at(params['ts'].to_i) > 30.minutes.ago) &&\n params['sig'] == signed_request_params(params['ts'])['sig']\n end",
"def valid_signature?(token)\n return false unless token =~ /&HMACSHA256=(.*)$/\n original_signature = CGI.unescape(token[/&HMACSHA256=(.*)$/, 1])\n bare_token = token.gsub(/&HMACSHA256=(.*)$/, '')\n signature = Base64.encode64(HMAC::SHA256.new(Base64.decode64(shared_secret)).update(bare_token.toutf8).digest).strip\n return original_signature == signature\n end",
"def verify_compact_signature(signature, hash)\n raise BTCError, \"Not implemented\"\n end",
"def verify(*args, **options)\n verified(*args, **options) || raise(InvalidSignature)\n end",
"def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), SECRET_TOKEN, payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\n end",
"def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), SECRET_TOKEN, payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\n end",
"def signature_verify( doc )\n # 1. Figure out signature namespace prefix\n sig_ns, prefix = signature_namespace_and_prefix( doc )\n\n # 2.a Signer present?\n @signer_node = doc.xpath( \"//#{ namespace_prefix( doc, doc.root.namespace.href ) }:Signer\" )\n if @signer_node.size != 1\n @messages << \"#{ @signer_node.size == 0 ? 'No' : @signer_node.size } Signer node#{ @signer_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.b Signature present?\n @signature_node = doc.xpath( \"//#{ prefix }:Signature\", sig_ns )\n if @signature_node.size != 1\n @messages << \"#{ @signature_node.size == 0 ? 'No' : @signature_node.size } Signature node#{ @signature_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.c Abort if none or more than 1 Signer or Signature node\n return FALSE if ( @signer_node.size != 1 or @signature_node.size != 1 )\n\n # 3. Extract and check signer certs\n certs = extract_certs( doc, sig_ns, prefix )\n @crypto = DC_Signer_Crypto_Compliance.new( certs )\n\n if ! @crypto.valid?\n if ! @crypto.errors[ :pre_context ].empty?\n @crypto.errors[ :pre_context ].each do |e|\n @messages << e\n end\n return FALSE\n else\n # Compliance issues in the extracted certs.\n # List those errors but then try to continue anyway,\n # thus allowing for inspection of compliance issues and signature in context.\n @crypto.messages.each do |e|\n @messages << e\n end\n end\n else # cc is valid\n @messages << \"Certificate chain is complete and compliant (#{ @crypto.type })\"\n end\n\n # 3.a Might check here whether the signer chain is known, trustworthy etc.\n #\n # See 3 for @crypto validity hop-over\n #\n\n # 4. Get signer's public key\n pub_k = @crypto.context.first.public_key\n\n # 5. Check references and signature value\n @reference_digests_check = check_references( doc, sig_ns, prefix )\n @signature_value_check = check_signature_value( doc, sig_ns, prefix, pub_k )\n\n return TRUE\n end",
"def signature_verify( doc )\n # 1. Figure out signature namespace prefix\n sig_ns, prefix = signature_namespace_and_prefix( doc )\n\n # 2.a Signer present?\n @signer_node = doc.xpath( \"//#{ namespace_prefix( doc, doc.root.namespace.href ) }:Signer\" )\n if @signer_node.size != 1\n @messages << \"#{ @signer_node.size == 0 ? 'No' : @signer_node.size } Signer node#{ @signer_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.b Signature present?\n @signature_node = doc.xpath( \"//#{ prefix }:Signature\", sig_ns )\n if @signature_node.size != 1\n @messages << \"#{ @signature_node.size == 0 ? 'No' : @signature_node.size } Signature node#{ @signature_node.size > 1 ? 's' : '' } found\"\n end\n\n # 2.c Abort if none or more than 1 Signer or Signature node\n return false if ( @signer_node.size != 1 or @signature_node.size != 1 )\n\n # 3. Extract and check signer certs\n certs = extract_certs( doc, sig_ns, prefix )\n @crypto = DC_Signer_Crypto_Compliance.new( certs )\n\n if ! @crypto.valid?\n if ! @crypto.errors[ :pre_context ].empty?\n @crypto.errors[ :pre_context ].each do |e|\n @messages << e\n end\n return false\n else\n # Compliance issues in the extracted certs.\n # List those errors but then try to continue anyway,\n # thus allowing for inspection of compliance issues and signature in context.\n @crypto.messages.each do |e|\n @messages << e\n end\n end\n else # cc is valid\n @messages << \"Certificate chain is complete and compliant (#{ @crypto.type })\"\n end\n\n # 3.a Might check here whether the signer chain is known, trustworthy etc.\n #\n # See 3 for @crypto validity hop-over\n #\n\n # 4. Get signer's public key\n pub_k = @crypto.context.first.public_key\n\n # 5. Check references and signature value\n @reference_digests_check = check_references( doc, sig_ns, prefix )\n @signature_value_check = check_signature_value( doc, sig_ns, prefix, pub_k )\n\n return true\n end",
"def parse_token\n binary_token = get_element('//t:RequestSecurityTokenResponse/t:RequestedSecurityToken/wsse:BinarySecurityToken')\n @validation_errors << \"No binary token exists.\" and return if binary_token.nil?\n \n decoded_token = Base64.decode64(binary_token)\n name_values={}\n decoded_token.split('&').each do |entry|\n puts entry\n pair=entry.split('=') \n name_values[CGI.unescape(pair[0]).chomp] = CGI.unescape(pair[1]).chomp\n end\n puts \"expires on\"\n puts name_values[\"ExpiresOn\"]\n @validation_errors << \"Response token is expired.\" if Time.now.to_i > name_values[\"ExpiresOn\"].to_i\n @validation_errors << \"Invalid token issuer.\" unless name_values[\"Issuer\"]==\"#{self.class.issuer}\"\n @validation_errors << \"Invalid audience.\" unless name_values[\"Audience\"] ==\"#{self.class.realm}\"\n \n # is HMAC valid?\n token_hmac = decoded_token.split(\"&HMACSHA256=\")\n swt=token_hmac[0]\n puts \"====\"\n puts \"incoming hmac is\"\n puts name_values['HMACSHA256']\n puts \"calculated hmac is\"\n puts Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'),Base64.decode64(self.class.token_key),swt)).chomp\n puts \"====\"\n \n @validation_errors << \"HMAC does not match computed value.\" unless name_values['HMACSHA256'] == Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha256'),Base64.decode64(self.class.token_key),swt)).chomp\n \n # remove non-claims from collection and make claims available\n\n @claims = name_values.reject {|key, value| !key.include? '/claims/'}\n end",
"def verify_token\n check_auth_token(request.headers['authtoken'],params[:profile_id])\n end",
"def verify_oauth_signature\n valid = OAuth::Signature.verify(request) do |request_proxy|\n @request_proxy = request_proxy\n @oauth_token = OauthToken.find_by_token(request_proxy.oauth_token, :include => :consumer)\n @oauth_consumer = @oauth_token.consumer\n\n # return the token secret and the consumer secret\n [oauth_token.secret, oauth_consumer.secret]\n end\n\n render :text => \"Invalid OAuth Request\", :status => 401 unless valid\n end",
"def verify(token, is_emulator: false)\n payload = decode(token, is_emulator).first\n sub = payload[\"sub\"]\n raise JWT::InvalidSubError, \"Invalid subject.\" unless sub.is_a?(String) && !sub.empty?\n payload[\"uid\"] = sub\n payload\n rescue JWT::ExpiredSignature => e\n raise expired_error, e.message\n rescue JWT::DecodeError => e\n raise invalid_error, e.message\n end",
"def verify!(config, params)\n sent_signature = params.find { |key, _value| key.to_s.casecmp('BRQ_SIGNATURE').zero? }&.last\n generated_signature = Signature.generate(config, params)\n\n if sent_signature.nil? || generated_signature.nil? || !safe_equals?(sent_signature, generated_signature)\n raise SignatureException.new(sent_signature, generated_signature)\n end\n end",
"def validate_token_hash\n if @token_request_at and\n @token_hash and @token_hash['expires_in'] and\n (Time.now - @token_request_at) > @token_hash['expires_in'].to_i\n @token_hash = nil\n elsif @token_request_at and\n @token_hash and @token_hash['expires_in']\n @token_hash['access_token']\n else\n puts \"start get token ...\"\n end\n end",
"def validate_sig(pkey,sig)\r\n\t\t\t\r\n\t\tend",
"def verify_webhook_signature\n their_signature_header = request.env['HTTP_X_GEOTIX_SIGNATURE'] || 'sha1='\n method, their_digest = their_signature_header.split('=')\n our_digest = OpenSSL::HMAC.hexdigest(method, WEBHOOK_SECRET, \"#{auth_token}#{@payload_raw}\")\n halt [401, \"Signatures don't match.\"] unless their_digest == our_digest\n end",
"def valid_integrity?(body, headers)\n request_signature = headers['X-Hub-Signature']\n signature_parts = request_signature.split('sha1=')\n request_signature = signature_parts[1]\n calculated_signature = OpenSSL::HMAC.hexdigest('sha1', @secret, body)\n calculated_signature == request_signature\n end",
"def _verify\n unless (@_headers['x-allopass-response-signature'] || []).include?(@_signature)\n raise Allorails::ApiFalseResponseSignatureError\n end\n end",
"def verify!(request, secret)\n query = query_string(request, request.params[\"nonce\"])\n unless request.params[\"signature\"] == sign(query, secret)\n raise OauthStateMiddlewareException, \"OAuth state signatures do not match\"\n end\n end",
"def verification_token\n JWT.encode({ iat: Time.now.to_i }, config.secret, JWT_ALG)\n end",
"def valid_signature?\n Rack::Utils.secure_compare(signature, signature_for(body))\n end",
"def verifySignature _args\n \"verifySignature _args;\" \n end",
"def signatures_match?\n expected_signature == api_signature\n end",
"def validate\n token = jwt\n return unless token\n token.validate\n end",
"def validate_token_hash; end",
"def verify(msg)\n \t\t\t\tbegin\n \t\t\t\t\tx,y,z,cmd,sig,iv = msg.split(/\\|/)\n \t\t\t\t\treturn nil unless iv\n \t\t\t\t\tdigest = Digest::MD5.hexdigest(cmd+iv).upcase\n \t\t\t\t\tsb1 = [@signature_block + digest].pack(\"h*\")\n \t\t\t\t\tsb2 = @signingkey_pub.public_decrypt([sig].pack(\"h*\"))\n \t\t\t\t\treturn nil unless sb1 == sb2\n \t\t\t\t\tcmd\n \t\t\t\trescue NoMethodError\n \t\t\t\t\tputs \"verify exception: #{msg}\"\n \t\t\t\tend\n \t\t\tend",
"def verify_authenticity_token; end",
"def verify\n @sigs = []\n @orig_data = request.params['data']\n if @orig_data.nil?\n # XXX: Implement HTTP error here.\n end\n begin\n GPGME::verify(request.params['data'], nil, @plain) do |signature|\n @sigs << signature\n end\n rescue GPGME::Error => e\n @error = \"GPGME Error: #{e.to_s}\"\n #rescue\n # @error = \"Unspecified Error.\"\n end\n end",
"def signature_ok?\n generate_md5 == vps_signature\n end",
"def verify_signature(public_key, payload, signature, timestamp)\n verify_engine\n timestamped_playload = \"#{timestamp}#{payload}\"\n payload_digest = Digest::SHA256.digest(timestamped_playload)\n decoded_signature = Base64.decode64(signature)\n public_key.dsa_verify_asn1(payload_digest, decoded_signature)\n rescue StandardError\n false\n end",
"def correct_signature?\n client = RestClient.where(:api_key => @api_key).first\n sign=client.nil? ? \"\" : client.secret + @request_uri.gsub(/\\?.*/,\"\")+@timestamp\n calculated_sign= (Digest::SHA256.new << sign).to_s\n Digest::SHA1.hexdigest(@signature)==Digest::SHA1.hexdigest(calculated_sign)\n end",
"def validate_signature(test_doc = nil)\n test_doc ||= @prepared_doc\n\n doc_signature = get_document_tag :esigncode, from: test_doc\n doc_salt = get_document_tag :esignuniquecode, from: test_doc\n validate_prepared_doc_digest test_doc\n\n new_pdd = prepared_doc_digest(from: test_doc)\n new_signature = Hashing.sign_with(doc_salt, new_pdd)\n raise ESignatureUserError, 'Document signature is invalid' unless doc_signature == new_signature\n\n true\n end",
"def verify_content(body, signature)\n hmac = HMAC::SHA1.hexdigest(@secret, body)\n check = \"sha1=\" + hmac\n check == signature\n end",
"def token_valid?(expected_id, expected_file_name, expected_user_ip)\n # max_token_age returns a duration. calling `.ago` on it returns a date which we can check against for expiry.\n id == expected_id && file_name == expected_file_name && user_ip == expected_user_ip &&\n (timestamp >= self.class.max_token_age.ago)\n end",
"def verify!(ha)\n passed_signature = ha[:sig] || ha[\"sig\"]\n raise Tampered, \"No signature given\" unless passed_signature\n raise Tampered, \"Checksum differs\" unless compute_checksum(ha) == passed_signature.to_s\n true\n end",
"def validate_signature(key_public, signature, timestamp)\r\n # RSA Decryption (Formula: M = C^e mod n)\r\n timestamp = timestamp.to_i % key_public[1].to_i\r\n signature = signature.to_i\r\n decipher = signature.to_bn.mod_exp(key_public[0].to_i,key_public[1].to_i)\r\n return true if (decipher == timestamp)\r\n return false\r\nend",
"def signature_valid?\n hmac.validate_url_signature(request.url, secret)\n end",
"def validate_assertion\n assertion, assertion_type = server.parameters.values_at(:assertion, :assertion_type)\n\n if assertion_type and assertion_type != 'urn:ietf:params:oauth:grant-type:jwt-bearer'\n raise StandardError.new('Assertion type not valid. Expected urn:ietf:params:oauth:grant-type:jwt-bearer')\n end\n\n if configuration.jwt_use_application_public_key_as_key\n payload, header = JWT.decode(assertion, nil, false)\n raise StandardError.new('App ID is not correct') unless OAuth::Client.find(payload['iss']).present?\n public_key = OAuth::Client.find(payload['iss']).application.public_key\n payload, header = JWT.decode(assertion, OpenSSL::PKey::RSA.new(public_key), true, { algorithm: header['alg'] })\n else\n payload, header = JWT.decode(assertion, configuration.jwt_key)\n end\n server.jwt = payload\n server.jwt_header = header\n\n rescue => error\n @error_description = error.message\n false\n end",
"def verify_key; end",
"def verify_key; end",
"def signature_key; end",
"def check_signature\n signature == \"\\x2a\\x2a\\x00\\x00\"\n end",
"def validrequest?(req)\n digest = makehash(req[:body])\n \n if digest == req[:hash]\n @stats[:validated] += 1\n \n return true\n else\n @stats[:unvalidated] += 1\n \n raise(\"Received an invalid signature in message\")\n end\n end",
"def signature_verification_state\n super\n end",
"def verify_signature(url, params)\n submit VerifySignature.new(:url_end_point => url, :http_parameters => params)\n end",
"def valid_token?\n five_minutes_ago = DateTime.now - 5.minutes\n params[:timestamp].to_i > five_minutes_ago.to_i &&\n params[:token] == Scalingo::SsoController.generate_authentication_token(params[:id], params[:timestamp])\n end",
"def verify_authenticity_token(*args) \n if params[:api_key] && params[:format] == 'xml' \n key = params[:api_key]\n conditions = ['api_key = ? AND (api_key_expires_at < ? OR api_key_expires_at IS NULL)', key, Time.now]\n gateway = Gateway.first(:conditions => conditions) \n raise(ActionController::InvalidAuthenticityToken) unless gateway\n else\n original_verify_authenticity_token(*args) \n end \n end",
"def signed_token(**payload)\n payload = {\n iss: 'The Identity Provider',\n iat: Time.now.to_i,\n exp: 1.hour.from_now.to_i,\n aud: ['example-api', 'user-api', 'calendar-api']\n }.merge(payload)\n private_key = OpenSSL::PKey::RSA.new(file_fixture('rsa1').read)\n JWT.encode(payload.to_h, private_key, 'RS256')\nend",
"def verify(key)\n plaintext = plaintext_sig(body, type, encoding, alg)\n key.public_key.verify(digest, sig, plaintext)\n rescue BadError\n false\n end",
"def verify_signature(payload_body)\n signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['WEBHOOK_SECRET_TOKEN'], payload_body)\n return halt 500, \"Signatures didn't match!\" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_HUB_SIGNATURE'])\nend",
"def payu_verify_params(params)\n pos_id = params['pos_id']\n pos = Payu[pos_id]\n\n Signature.verify!(\n params['sig'],\n params['pos_id'],\n params['session_id'],\n params['ts'],\n pos.key2\n )\n end",
"def signature_ok?(timestamp)\n slack_signature = request.headers['X-Slack-Signature']\n signature = Slack::Utils.signature(\n SLACK_SIGNING_SECRET, timestamp, request.raw_post\n )\n\n return unless slack_signature != signature\n\n raise Unauthorized, \"ERROR: you're not Slack (wrong signature)\"\n end",
"def verify_webhook_signature\n their_signature_header = request.env['HTTP_X_HUB_SIGNATURE'] || 'sha1='\n method, their_digest = their_signature_header.split('=')\n our_digest = OpenSSL::HMAC.hexdigest(method, ENV['GITHUB_WEBHOOK_SECRET'], @payload_raw)\n halt 401 unless their_digest == our_digest\n\n log_action\n end",
"def verify_authenticity_token\n verified_request? || raise(ActionController::InvalidAuthenticityToken)\n end",
"def check_signature(body)\n received_signature = request.env['HTTP_X_HUB_SIGNATURE'] || ''\n signature = 'sha1=' + hmac_sha1(settings.github_secret, body)\n\n if !Rack::Utils.secure_compare(signature, received_signature)\n build_failed('signature mismatch')\n end\nend",
"def check_magic_token\n params[:magic_token] == Rails.application.secrets.salesforce_magic_token\n end",
"def decrypted_token\n Argo.verifier.verified(params[:item_id], purpose: :view_token)\n end",
"def decrypted_token\n Argo.verifier.verified(params[:item_id], purpose: :view_token)\n end",
"def token_validation\n if (!jwt_string.blank? && !(token.all? &:blank?))\n cur_time = Time.now\n iat_time = Time.at(token[0][\"iat\"])\n exp_time = Time.at(token[0][\"exp\"])\n if exp_time < cur_time\n errors.add(:base, I18n.t('token.expired'))\n elsif !(iat_time < cur_time && iat_time < exp_time)\n errors.add(:base, I18n.t('token.invalid'))\n end\n else\n errors.add(:base, I18n.t('token.invalid'))\n end\n rescue JWT::DecodeError\n errors.add(:base, I18n.t('token.invalid'))\n end",
"def verify_token\n token ||= request.env['HTTP_AUTHORIZATION']\n if token.nil?\n error 401, { :error => 'Unauthorized.' }.to_json\n else\n token = token.split(' ').last unless token.nil?\n begin\n @user = verify(token)\n rescue JWT::ExpiredSignature\n error 401, { :error => 'Expired token.' }.to_json\n end\n end\n end",
"def any_authenticity_token_valid?; end",
"def verify_oauth_consumer_signature\n valid = OAuth::Signature.verify(request) do |request_proxy|\n @request_proxy = request_proxy\n @oauth_consumer = OauthConsumer.find_by_key(request_proxy.oauth_consumer_key)\n\n # return the token secret and the consumer secret\n [nil, oauth_consumer.secret]\n end\n \n # TODO catch different tyes of errors\n # rescue OAuth::UnknownSignatureMethod\n\n render :text => \"Invalid OAuth Request\", :status => 401 unless valid\n end",
"def signature(params)\n self.class._hmac(secret, params) if secret.to_s.length > 0\n end",
"def has_signature?\n auth_info.include? \"signature\"\n end",
"def verify_iss; end",
"def verify_iss; end",
"def verify_jti; end",
"def verify_jti; end",
"def verify_token\n associate = Associate.where(id: params[:associate_id])[0] if params[:associate_id]\n #checking signed_in user\n if user_signed_in?\n #checking token is nil or not.\n if params[:token].nil?\n #response in json format\n render :json=> { success: false, message: \"Token is required to proceed further.\" },:status=> 203\n return\n elsif associate && associate.associate_user == true\n return true\n #checking token with the current_user\n elsif current_user.authentication_token != params[:token]\n render :json=> { success: false, message: \"Problem with the authentication token.please check token.\" },:status=> 203\n return\n else\n end\n end\n end"
] |
[
"0.6876629",
"0.6876629",
"0.6694493",
"0.6682686",
"0.6584846",
"0.6544076",
"0.6523213",
"0.64918154",
"0.64861506",
"0.6350312",
"0.6340107",
"0.6310668",
"0.62649673",
"0.6262085",
"0.6227141",
"0.62072355",
"0.6177997",
"0.6177997",
"0.61510044",
"0.6143952",
"0.61392754",
"0.61375594",
"0.61375594",
"0.61082786",
"0.61082786",
"0.60707897",
"0.60526115",
"0.60170394",
"0.60060173",
"0.59966487",
"0.5982574",
"0.59765434",
"0.5960988",
"0.5945579",
"0.59449655",
"0.5933305",
"0.59318495",
"0.5898573",
"0.589438",
"0.588486",
"0.58737576",
"0.5823397",
"0.58148247",
"0.58112925",
"0.5807354",
"0.58026254",
"0.5798928",
"0.57977414",
"0.57714975",
"0.57663715",
"0.57553416",
"0.57534313",
"0.5724272",
"0.5703554",
"0.56834954",
"0.5677809",
"0.5672386",
"0.56640464",
"0.5654389",
"0.56234723",
"0.5623064",
"0.56225604",
"0.5621302",
"0.5615305",
"0.56125814",
"0.5605848",
"0.56035936",
"0.5599241",
"0.5591154",
"0.55896586",
"0.55896586",
"0.5585985",
"0.5571626",
"0.5562778",
"0.555641",
"0.554763",
"0.55394685",
"0.5535487",
"0.5525284",
"0.55127877",
"0.55005527",
"0.54977095",
"0.5495444",
"0.5491302",
"0.54889613",
"0.54885095",
"0.5481812",
"0.54736185",
"0.54736185",
"0.547185",
"0.5466692",
"0.546481",
"0.54507095",
"0.5450111",
"0.5443078",
"0.54417205",
"0.54417205",
"0.5440773",
"0.5440773",
"0.5437149"
] |
0.6661562
|
4
|
GET /posts or /posts.json
|
def index
@posts = Post.all.order("RANDOM()")
@categories = Category.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def get(options = {})\n response= handle_errors { self.class.get('/get', :query => options)}\n if response[\"posts\"][\"post\"].is_a?(Hash)\n Rubycious::Post.new response[\"posts\"][\"post\"]\n elsif response[\"posts\"][\"post\"].is_a?(Array)\n response[\"posts\"][\"post\"].collect{|i| Rubycious::Post.new(i)}\n else\n nil\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n\n # We display the posts be cronological inverted order\n if authenticated?\n @posts = Post.order('created_at DESC').page(params[:page])\n else\n @posts = Post.order('created_at DESC').where(:status => :true).page(params[:page])\n end\n \n respond_to do |format|\n format.html { render html: @posts }\n format.json { render json: @posts }\n end\n end",
"def index\n\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def index\n @posts = Post.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @posts}\n end\n end",
"def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render jsonapi: @post }\n end\n end",
"def get(options = EMPTY_HASH)\n parameters = Specification.new(\n tag: Types::Tags,\n dt: Types::Time,\n url: Types::URL,\n meta: Types::Boolean\n ).parameters(options)\n posts_from client.get(\"/posts/get\", parameters)\n end",
"def index\n @posts = Post.paginate(:page => params[:page], :per_page => 10).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end",
"def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def display_posts\n begin\n response = RestClient.get \"#{@@DOMAIN}/api/posts.json?all\", authorization_hash\n\n puts \"Response code: #{response.code}\"\n puts \"Response cookies:\\n #{response.cookies}\\n\\n\"\n puts \"Response headers:\\n #{response.headers}\\n\\n\"\n puts \"Response content:\\n #{response.to_str}\"\n\n js = JSON response.body\n js.each do |item_hash|\n item_hash.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end",
"def show\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n @posts = Post.order(\"created_at DESC\").includes(:user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n # @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @posts }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n @posts = Post.all.order_by([:date_published, :desc]).page(params[:page]).per(20)\n #authorize! if cannot? :read, @posts\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end",
"def show\n \trender json: Post.find(params[:id])\n end",
"def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n respond_with(@posts) do |format|\n format.html do\n return redirect_to blog_path, :status => 301 if request.path =~ /^\\/posts(\\/?)$/ && flash.empty?\n\n @posts = user_signed_in? ? Post.latest : Post.published.latest\n @posts = @posts.paginate :page => params[:page], :per_page => Post.per_page\n end\n\n format.rss { @posts = Post.published.latest }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n render json: @post\n end",
"def index\n @posts = Post.all\n # Post.all returns all of the posts currently in the \n # database as an array of Post records that we store \n # in an instance variable called @posts.\n # http://guides.rubyonrails.org/active_record_querying.html\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n # The respond_to block handles both HTML and JSON calls \n # to this action. If you browse to \n # http://localhost:3000/posts.json, you’ll see a JSON \n # containing all of the posts. \n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def show\n post = Post.find(params[:id])\n render json: post\n end",
"def index\n @posts = Post.all\n @posts = paginate(@posts)\n authorize @posts\n\n render json: @posts, each_serializer: Api::V1::PostSerializer, meta: meta_attributes(@posts)\n end",
"def show\n @post = Post.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n #@posts = Post.all\n @posts = Post.paginate( :page => params[:page],\n :per_page => 2\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n render json: Post.find(params[\"id\"])\n end",
"def show\n\t \trender json: Post.find(params[:id])\n\t end",
"def show\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n render json: @post\n end",
"def show\n # when you go to http://localhost:3000/posts/1, rails interprets this\n # as a call to the show action for the resource and passes 1 to the \n # :id paramater. Using this blog app you can do that by clicking the \n # show link for a post on the index page.\n\n @post = Post.find(params[:id])\n # The show action uses Post.find to search for a single record \n # in the database by its id value. After finding the record, Rails \n # displays it by using app/views/posts/show.html.erb\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_v2_post }\n end\n end",
"def index\n # TODO: implement listing all posts\n end",
"def index\n\t \tif params[:title]\n\t\t render json: Post.search(params[:title])\n \t\telse\n\t \trender json: Post.all\n \tend\n\t end",
"def index\n unless can?(:manage, Post)\n @posts = @posts.published\n end\n \n respond_with @posts\n end",
"def index\n @truncate_posts = true\n\n if can? :read_drafts, Post\n @posts = @posts.recent\n else\n @posts = @posts.recently_published\n end\n\n respond_to do |format|\n format.html { @posts = @posts.page(params[:page]).per(10) }\n format.json { }\n end\n end",
"def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html { render 'application/index' }\n format.json { render :json => { :post => @post.as_json } }\n end\n end",
"def index\n @posts = Post.all\n respond_with(@posts)\n end",
"def show\n post = Post.find_by(id: params[:id])\n if post \n render json: post\n else\n render json: {errors: 'Not found'}\n end\n end",
"def index\n render json: { posts: Post.all }\n end",
"def index\n @posts = Post.where(nil)\n @posts = @posts.search(params[:search]) if params[:search].present?\n @posts = @category.posts if @category.present?\n @posts = @posts.published\n\n respond_with @posts\n end",
"def show\n @post ||= Mist::Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\r\n @post = root_post_of(Post.find(params[:id]))\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @post }\r\n end\r\n end",
"def index\n @posts = Post.all.order(created_at: :asc)\n json_response(@posts)\n end",
"def show\n @user = User.find(params[:id])\n @posts = @user.posts\n\n respond_to do |format|\n format.json { render json: {user: User._build(@user), posts: Post.build_posts(@posts)}, location: root_path }\n end\n end",
"def index\n render json: Post.all\n end",
"def show\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n\t@posts = list_posts\n end",
"def show\n # @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @post }\n end\n end",
"def index\n @posts = Post.all\n \n render json: @posts\n end",
"def show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end",
"def show\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # format.html # show.html.erb\n #format.json { render json: @post }\n #end\n end",
"def index\n respond_with Post.all\n end",
"def index\n page = params[:page]\n per_page = params[:per_page]\n\n posts = Post.order(published_at: :desc).page(page).per(per_page)\n\n # Передаём в заголовке общее количество страниц и записей.\n response.headers['Total-Pages'] = posts.total_pages\n response.headers['Total-Count'] = posts.total_count\n\n render json: posts\n end",
"def show\n render json: @post, serializer: Api::V1::PostSerializer\n end",
"def index\n @posts = Post.includes(:author, channel: [:posts]).order(created_at: :desc)\n @posts = @posts.where(channel: @channel) if params[:channel_id]\n @posts = @posts.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render jsonapi: @posts }\n end\n end",
"def index\n # Catch old legacy wordpress routing ?p=####\n post = Post.find_by_id params[:p]\n if post.present?\n redirect_to :action => 'show', :seo_url => post.seo_url\n else\n # Most likely this is the way it will always go.. show me the list\n @posts = PostDecorator.decorate(get_posts Post.order)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end\n\n end",
"def index\n\t\t@posts = Post.order('created_at DESC').where(status:true).page(params[:page]).per(10)\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\tend\n\tend",
"def index\n @posts = PostService.getAllPosts\n end",
"def show \n \n #if @post \n render jsonapi: @post, serializer: Api::V1::PostSerializer\n #else\n # render jsonapi: \"User not found\", status: 404\n #end\n end",
"def index\n @page = params[:page] || 1\n @posts = @exchange.posts.page(@page, context: 0).for_view\n respond_to do |format|\n format.json do\n serializer = PostSerializer.new(\n @posts,\n links: { self: paginated_json_path(@posts.current_page),\n next: paginated_json_path(@posts.next_page),\n previous: paginated_json_path(@posts.previous_page) },\n include: %i[user]\n )\n render json: serializer.serialized_json\n end\n end\n end",
"def index\n @posts = Post.all.reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @post }\n format.json do\n render :json => @post.to_json(:only => [:id, :title, :text, :lat, :lng, :created_at, :post_type, :likes], \n :methods => [:image_url, :video_url], \n :include => [:comments])\n end\n end\n end",
"def user_post\n @posts = Post.where(user_id: current_user.id)\n\n if @posts.nil?\n render :json => {message: \"Cannot find post\" }\n end\n\n render :index\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def index \n authorize! :read, Post\n @posts = Post.find(:all, :order => \"created_at DESC\")\n respond_to do |format|\n format.html\n format.atom\n end\n\n end",
"def index\n render 'post'\n respond_to :json\n end",
"def show\n @post = Post.find(params[:id])\n\n if !authenticated? && !@post.status\n redirect_to posts_path\n else\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end\n end",
"def index\n @api_v1_posts = Api::V1::Post.all\n end",
"def index\n per_page = params[:per_page] ? params[:per_page] : Post::PER_PAGE\n @posts = Post.by_published_date.paginate(page: params[:page], per_page: per_page)\n # Set count of posts and count of pages to query headers\n add_headers\n render json: @posts\n end",
"def index\n @postos = Posto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postos }\n end\n end",
"def index\n get_posts_with_filter\n end",
"def show\n render json: @post\n end"
] |
[
"0.6997458",
"0.6996869",
"0.6862507",
"0.68329054",
"0.68329054",
"0.68329054",
"0.6823404",
"0.6819618",
"0.6786192",
"0.6767177",
"0.66757053",
"0.6654793",
"0.6605684",
"0.6579752",
"0.6572869",
"0.65616906",
"0.65600824",
"0.655784",
"0.65495145",
"0.65482247",
"0.6542783",
"0.6542783",
"0.6534357",
"0.65321195",
"0.65308726",
"0.6525457",
"0.6525063",
"0.6525063",
"0.6525063",
"0.6525063",
"0.6525063",
"0.6525063",
"0.6525063",
"0.6525063",
"0.6525063",
"0.6525063",
"0.6525063",
"0.6525063",
"0.6525063",
"0.6525063",
"0.651457",
"0.651307",
"0.6491548",
"0.6490581",
"0.6482257",
"0.6482257",
"0.6474298",
"0.6456305",
"0.644816",
"0.6440691",
"0.6439785",
"0.64387906",
"0.6418343",
"0.6415787",
"0.64099026",
"0.63961345",
"0.6385536",
"0.63837457",
"0.6380149",
"0.6374719",
"0.636379",
"0.6361251",
"0.6349849",
"0.6341257",
"0.6338461",
"0.6326273",
"0.63252014",
"0.63069737",
"0.6285292",
"0.6284339",
"0.6278642",
"0.62697196",
"0.62664235",
"0.626461",
"0.62553644",
"0.6253314",
"0.6252606",
"0.6250423",
"0.6228155",
"0.62137187",
"0.62098056",
"0.62011963",
"0.61990875",
"0.6196612",
"0.6178627",
"0.617838",
"0.61709595",
"0.6167526",
"0.616711",
"0.61644423",
"0.6143045",
"0.61390096",
"0.61267954",
"0.6126342",
"0.61148274",
"0.611425",
"0.6113628",
"0.61098546",
"0.61092734",
"0.6107323",
"0.60986304"
] |
0.0
|
-1
|
GET /posts/1 or /posts/1.json
|
def show
@categories = Category.all
@users = User.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @posts = Post.find(params[:id])\n render json: @posts\n end",
"def show\n @post = Post.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def get(options = {})\n response= handle_errors { self.class.get('/get', :query => options)}\n if response[\"posts\"][\"post\"].is_a?(Hash)\n Rubycious::Post.new response[\"posts\"][\"post\"]\n elsif response[\"posts\"][\"post\"].is_a?(Array)\n response[\"posts\"][\"post\"].collect{|i| Rubycious::Post.new(i)}\n else\n nil\n end\n end",
"def show\n render json: Post.find(params[\"id\"])\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n \trender json: Post.find(params[:id])\n end",
"def index\n\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end",
"def index\n @posts = Post.all\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {render json: @posts}\n end\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def show\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_v2_post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n render json: @post\n end",
"def index\n @posts = Mist::Post.recently_published(20, Mist.authorized?(:view_drafts, self))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @posts }\n end\n end",
"def show\n\t \trender json: Post.find(params[:id])\n\t end",
"def show\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\n # when you go to http://localhost:3000/posts/1, rails interprets this\n # as a call to the show action for the resource and passes 1 to the \n # :id paramater. Using this blog app you can do that by clicking the \n # show link for a post on the index page.\n\n @post = Post.find(params[:id])\n # The show action uses Post.find to search for a single record \n # in the database by its id value. After finding the record, Rails \n # displays it by using app/views/posts/show.html.erb\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n post = Post.find(params[:id])\n render json: post\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n\n # We display the posts be cronological inverted order\n if authenticated?\n @posts = Post.order('created_at DESC').page(params[:page])\n else\n @posts = Post.order('created_at DESC').where(:status => :true).page(params[:page])\n end\n \n respond_to do |format|\n format.html { render html: @posts }\n format.json { render json: @posts }\n end\n end",
"def show\n @post = Post.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n\n @posts = Post.all\n\n render json: @posts, status: 200\n end",
"def show\n @post ||= Mist::Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def get(options = EMPTY_HASH)\n parameters = Specification.new(\n tag: Types::Tags,\n dt: Types::Time,\n url: Types::URL,\n meta: Types::Boolean\n ).parameters(options)\n posts_from client.get(\"/posts/get\", parameters)\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.atom\n end\n end",
"def index\n @posts = Post.paginate(:page => params[:page], :per_page => 10).order('id DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render jsonapi: @post }\n end\n end",
"def show\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n render json: @post\n end",
"def show\n post = Post.find_by(id: params[:id])\n if post \n render json: post\n else\n render json: {errors: 'Not found'}\n end\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @post }\n format.xml { render xml: @posts }\n end\n end",
"def index\n @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml { render xml: @posts }\n end\n end",
"def show\n @post = Post.find(params[:id])\n \n respond_to do |format|\n format.html { render 'application/index' }\n format.json { render :json => { :post => @post.as_json } }\n end\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n\n render json: @posts\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.order(\"created_at DESC\").includes(:user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n #@posts = Post.all\n @posts = Post.paginate( :page => params[:page],\n :per_page => 2\n )\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n # @posts = Post.all\n\n respond_to do |format|\n format.html # index.html.erb\n # format.json { render json: @posts }\n end\n end",
"def show\n if !params[:id]\n @post = Post.find_by_title('Welcome')\n elsif params[:id] =~ /^[a-zA-Z ]+$/\n @post = Post.find_by_title(params[:id])\n else\n @post = Post.find(params[:id].to_i)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n @posts = Post.order(created_at: :desc)\n respond_to do |format|\n format.html { render }\n format.text { render }\n format.xml { render xml: @posts }\n format.json { render json: @posts.to_json }\n end\n end",
"def index\n @api_v1_posts = Api::V1::Post.all\n end",
"def index\n @posts = Post.all\n render json: @posts\n end",
"def index\n @posts = Post.order(\"created_at DESC\").where(:published => true).limit(5)\n @title = \"Home\"\n @description = \"the blog and website of bassist and programmer Johnny Grubb. no baseball information here.\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n format.xml\n end\n end",
"def index\n @posts = Post.all.order_by([:date_published, :desc]).page(params[:page]).per(20)\n #authorize! if cannot? :read, @posts\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def show\r\n @post = root_post_of(Post.find(params[:id]))\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @post }\r\n end\r\n end",
"def display_posts\n begin\n response = RestClient.get \"#{@@DOMAIN}/api/posts.json?all\", authorization_hash\n\n puts \"Response code: #{response.code}\"\n puts \"Response cookies:\\n #{response.cookies}\\n\\n\"\n puts \"Response headers:\\n #{response.headers}\\n\\n\"\n puts \"Response content:\\n #{response.to_str}\"\n\n js = JSON response.body\n js.each do |item_hash|\n item_hash.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def show\n @posts = @game.posts.order(created_at: :desc).paginate(page: params[:page], per_page: 5)\n respond_to do |format|\n format.json { render template: 'api/games/game.json' }\n end\n end",
"def show\n render json: @post, serializer: Api::V1::PostSerializer\n end",
"def index\n @truncate_posts = true\n\n if can? :read_drafts, Post\n @posts = @posts.recent\n else\n @posts = @posts.recently_published\n end\n\n respond_to do |format|\n format.html { @posts = @posts.page(params[:page]).per(10) }\n format.json { }\n end\n end",
"def index\n @posts = Post.all.order(created_at: :asc)\n json_response(@posts)\n end",
"def index\n respond_with(@posts) do |format|\n format.html do\n return redirect_to blog_path, :status => 301 if request.path =~ /^\\/posts(\\/?)$/ && flash.empty?\n\n @posts = user_signed_in? ? Post.latest : Post.published.latest\n @posts = @posts.paginate :page => params[:page], :per_page => Post.per_page\n end\n\n format.rss { @posts = Post.published.latest }\n end\n end",
"def index\n @posts = Post.includes(:author, channel: [:posts]).order(created_at: :desc)\n @posts = @posts.where(channel: @channel) if params[:channel_id]\n @posts = @posts.page(params[:page])\n\n respond_to do |format|\n format.html\n format.json { render jsonapi: @posts }\n end\n end",
"def show\n respond_with Post.find(params[:id])\n end",
"def index\n @posts = Post.all\n # Post.all returns all of the posts currently in the \n # database as an array of Post records that we store \n # in an instance variable called @posts.\n # http://guides.rubyonrails.org/active_record_querying.html\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n # The respond_to block handles both HTML and JSON calls \n # to this action. If you browse to \n # http://localhost:3000/posts.json, you’ll see a JSON \n # containing all of the posts. \n end",
"def show\n @post = PostsService.getPostById(params[:id])\n end",
"def index\n\t@posts = list_posts\n end",
"def index\n render json: Post.all.order(id: :desc), each_serializer: V1::Posts::PostSerializer\n end",
"def index\n @posts = Post.all\n @posts = paginate(@posts)\n authorize @posts\n\n render json: @posts, each_serializer: Api::V1::PostSerializer, meta: meta_attributes(@posts)\n end",
"def show\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # format.html # show.html.erb\n #format.json { render json: @post }\n #end\n end",
"def show\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def index\n render json: { posts: Post.all }\n end",
"def index\n # TODO: implement listing all posts\n end",
"def show\n # @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @post }\n end\n end",
"def index\n render json: Post.all\n end",
"def show\n @post = Post.find(params[:id])\n render json: @post, meta: { status: :ok }, meta_key: 'result'\n end",
"def index\n page = params[:page]\n per_page = params[:per_page]\n\n posts = Post.order(published_at: :desc).page(page).per(per_page)\n\n # Передаём в заголовке общее количество страниц и записей.\n response.headers['Total-Pages'] = posts.total_pages\n response.headers['Total-Count'] = posts.total_count\n\n render json: posts\n end",
"def index\n\t \tif params[:title]\n\t\t render json: Post.search(params[:title])\n \t\telse\n\t \trender json: Post.all\n \tend\n\t end",
"def show\n #GET a single post by ID\n @post = Post.find(params[:id])\n end",
"def show\n @post = Post.find(params[:id])\n @title = @post.title\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @post }\n end\n end",
"def show\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post }\n end \n end",
"def display_post\n begin\n # asks the user for the post id\n print \"Enter the post ID: \"\n id = STDIN.gets.chomp\n response = RestClient.get \"#{@@DOMAIN}/api/posts/#{id}.json\", authorization_hash\n\n js = JSON response.body\n js.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def show \n \n #if @post \n render jsonapi: @post, serializer: Api::V1::PostSerializer\n #else\n # render jsonapi: \"User not found\", status: 404\n #end\n end",
"def index\n @posts = Post.all.reverse\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end",
"def index\n @posts = Post.all\n \n render json: @posts\n end",
"def show\n @feed = Feed.find(params[:id])\n @posts = @feed.posts.order(\"published desc\").paginate(:page => params[:page], :per_page => 20)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def show\n @posto = Posto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @posto }\n end\n end",
"def index\n @posts = Post.all\n respond_with(@posts)\n end",
"def show\n @post = Post.find(params[:id])\n @videos = Video.get_for @post #where([\"post_id = ?\", params[:id]]).all\n @background = get_background_for @post #Background::DEFAULT #Background.where([\"post_id = ?\", params[:id]])\n @nav = get_navigation :for => 'post', :current => @post\n @menu = get_menu :for => 'post'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end",
"def index\n # Catch old legacy wordpress routing ?p=####\n post = Post.find_by_id params[:p]\n if post.present?\n redirect_to :action => 'show', :seo_url => post.seo_url\n else\n # Most likely this is the way it will always go.. show me the list\n @posts = PostDecorator.decorate(get_posts Post.order)\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posts }\n end\n end\n\n end",
"def index\n\t\t@posts = Post.order('created_at DESC').where(status:true).page(params[:page]).per(10)\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\tend\n\tend",
"def index\n @postos = Posto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postos }\n end\n end",
"def recent(options={})\n options.merge!({:basic_auth => @auth})\n self.class.get('/posts/recent', options)\n\n end",
"def show\n @post = Post.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @post }\n format.json do\n render :json => @post.to_json(:only => [:id, :title, :text, :lat, :lng, :created_at, :post_type, :likes], \n :methods => [:image_url, :video_url], \n :include => [:comments])\n end\n end\n end",
"def show\n render json: @post\n end"
] |
[
"0.6976226",
"0.6745518",
"0.6723887",
"0.6702761",
"0.66672957",
"0.66672957",
"0.66672957",
"0.66596746",
"0.66551304",
"0.66492945",
"0.66199887",
"0.6607758",
"0.660037",
"0.658429",
"0.65815914",
"0.6576847",
"0.65718734",
"0.65713036",
"0.6565387",
"0.65360427",
"0.6533739",
"0.6533739",
"0.6533739",
"0.6533739",
"0.6533739",
"0.6533739",
"0.6533739",
"0.6533739",
"0.6533739",
"0.6533739",
"0.6533739",
"0.6533739",
"0.6533739",
"0.6533739",
"0.653273",
"0.65152746",
"0.6500033",
"0.6500033",
"0.6473499",
"0.64730245",
"0.6462032",
"0.6456803",
"0.6452226",
"0.6448192",
"0.64316535",
"0.6398554",
"0.6391378",
"0.63743883",
"0.6370272",
"0.63607067",
"0.63607067",
"0.636051",
"0.6351062",
"0.6346731",
"0.6337328",
"0.6331829",
"0.63280654",
"0.63144016",
"0.6307648",
"0.62807816",
"0.6266667",
"0.62461984",
"0.6240861",
"0.62369555",
"0.62334436",
"0.6232495",
"0.6230313",
"0.6225418",
"0.6221168",
"0.6219367",
"0.62189394",
"0.62069046",
"0.6193753",
"0.6191723",
"0.61897475",
"0.6162628",
"0.6147193",
"0.6146922",
"0.613717",
"0.613085",
"0.6128185",
"0.61257416",
"0.61226755",
"0.61109644",
"0.610802",
"0.61059177",
"0.6105728",
"0.6103759",
"0.61023784",
"0.6097633",
"0.60937923",
"0.60906065",
"0.6089031",
"0.60846144",
"0.60742164",
"0.6073634",
"0.60734266",
"0.6059943",
"0.6054471",
"0.60537535",
"0.60330474"
] |
0.0
|
-1
|
POST /posts or /posts.json
|
def create
@post = Post.new(post_params)
respond_to do |format|
if @post.save
format.html { redirect_to @post, notice: "Post was successfully created." }
format.json { render :show, status: :created, location: @post }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @post.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def post(*args)\n request :post, *args\n end",
"def create\n respond_with Post.create(params[:posts])\n end",
"def post(*args)\n request(:post, *args)\n end",
"def posts(opts)\n response = get(\"posts\", opts)\n response\n end",
"def post(path, **args); end",
"def create\n render json: Post.create(params[\"post\"])\n end",
"def post(id, opts = {})\r\n uri = url_for(\"posts/#{id}\", opts)\r\n response = RestClient.get(uri)\r\n JSON.parse response\r\n end",
"def create\n @post = Post.new(post_params)\n @post.user = current_user\n\n if @post.save\n render json: @post, status: :created, location: api_v1_post_path(@post), serializer: Api::V1::PostSerializer\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def http_post(path, data, content_type = 'application/json')\n http_methods(path, :post, data, content_type)\n end",
"def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end",
"def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"def create_post\n begin\n #asks the user for the title, body, and whether it should be anonymous\n print \"Title: \"\n title = STDIN.gets.chomp\n print \"Body: \"\n body = STDIN.gets.chomp\n print \"Post as Anonymous? (y/n): \"\n anonymous = STDIN.gets.chomp.upcase == 'Y' ? true : false\n # check user information from login\n\n # Rails will reject this unless you configure the cross_forgery_request check to\n # a null_session in the receiving controller. This is because we are not sending\n # an authenticity token. Rails by default will only send the token with forms /users/new and\n # /users/1/edit and REST clients don't get those.\n # We could perhaps arrange to send this on a previous\n # request but we would then have to have an initial call (a kind of login perhaps).\n # This will automatically send as a multi-part request because we are adding a\n # File object.\n response = RestClient.post \"#{@@DOMAIN}/api/posts.json\",\n\n {\n post: {\n title: title,\n body: body,\n anonymous: anonymous\n },\n }, authorization_hash\n\n if (response.code == 201)\n puts \"Created successfully\"\n end\n puts \"URL for new resource: #{response.headers[:location]}\"\n rescue => e\n puts STDERR, \"Error accessing REST service. Error: #{e}\"\n end\n end",
"def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"def post(path, options={})\n request :post, path, options\n end",
"def create\n post = @current_user.posts.create(post_params)\n\n if post.save\n render json: post\n else\n render json: { errors: post.errors.full_messages }, status: :forbidden\n end\n end",
"def create\n title = params[:title]\n body = params[:body]\n\n @post = current_user.posts.create(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end",
"def post(data = {})\n call data, method: :post\n end",
"def post(path, params = {})\n resource(path).post(params)\n end",
"def post(path, params = {})\n\t\trequest(path, :post, params)\n\tend",
"def api_post(path, data = {})\n api_request(:post, path, :data => data)\n end",
"def create\n @post = Post.new(params[:post])\n respond_to do |format|\n if @post.save\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.create(params[:post])\n end",
"def post(path, data={})\n request(:post, path, data)\n end",
"def create\n respond_with Post.create(post_params)\n end",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def create\n @post = current_user.posts.new(post_params)\n\n if @post.save\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end",
"def create\n @user = User.find(params[:user_id])\n @post = @user.posts.new(post_params)\n\n if @post.save\n render json: @post, status: :created, location: [@user, @post]\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def create\n @post = Post.new({ :title => params[:post][:title] })\n \n respond_to do |format|\n if @post.save\n format.json { render :json => { :post => @post.as_json}, :status => :created, :location => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post\n end",
"def post\r\n end",
"def create\n authenticated\n\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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 create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render :show, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, options={})\n send_request 'post', path, options\n end",
"def post(*args)\n execute(:post, *args)\n end",
"def post(path, data=nil)\n request(:post, path, data)\n end",
"def post(*args)\n Request.post(*args)\n end",
"def post(path, options = {})\n request(:post, path, options)\n end",
"def post(path, options = {})\n request(:post, path, options)\n end",
"def post(path, options = {})\n request(:post, path, options)\n end",
"def post options\n rest_request({ method: :post }.merge(options))\n end",
"def post options\n rest_request({ method: :post }.merge(options))\n end",
"def post(path, **options)\n execute :post, path, options\n end",
"def post(path, options = {})\n request(:post, path, options)\n end",
"def post(path, options = {})\n request(:post, path, options)\n end",
"def post(path, options = {})\n request(:post, path, options)\n end",
"def create\n @post = Post.new(post_params)\n\n if @post.save\n render json: {\n message: 'Post was successfully created.'\n }, status: :created\n else\n render json: {\n errors: @post.errors,\n message: 'Post could not be created.'\n }, status: :unprocessable_entity\n end\n end",
"def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end",
"def post\n resource.post(request, response)\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\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 create\n @post = Post.new(params[:post])\n @title = \"Create New Post\"\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, :notice => 'Post was successfully created.' }\n format.json { render :json => @post, :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 create\n\t\tpost = @current_user.posts.create(post_params) \n\t\tif post.save\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id}\n\t else\n\t render json: {success: false, errors: post.errors.full_messages, message: \"Validation failed\"}, status: 422\n\t\tend \n\tend",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post(path, params={})\n request(:post, path, params)\n end",
"def post!\n request! :post\n end",
"def posts\n @url = MYHOST + \"/api/posts/all\"\n\n\n @respuesta = HTTParty.get(\n @url.to_str\n )\n\n @body = @respuesta.body\n if @body \n redirect_to api_resultado_path(:body => @body, :token => @token)\n return\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.json { render json: @post, status: :created, location: @post }\n format.xml { render xml: @post, status: :created, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n\n @post = current_user.posts.build(post_params)\n\n if @post.save\n\n render json: \"Posted successfully\", status: 201\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def post; end",
"def post(*args)\n super(*wrap_for_json_api(*args))\n end",
"def create\n @api_post = Api::Post.new(api_post_params)\n\n if @api_post.save\n render json: @api_post, status: :created, location: @api_post\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def create\n @api_post = current_user.posts.new(api_post_params)\n if @api_post.save\n render :show\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def create\n user_post_param\n respond_to do |format|\n if @post.save\n format.html do\n redirect_to @post, notice:\n \"Post was successfully created.\"\n end\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json do\n render json: @post.errors, status:\n :unprocessable_entity\n end\n end\n end\n end",
"def post(post_data, path)\n response = self.class.post(path, options(post_data, true))\n response.response.body\n end",
"def post(path, options={}, format=format)\n request(:post, path, options, format)\n end",
"def create\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, 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 api\n if params[:company_id] && params[:post_token]\n Post.new_post(params[:company_id], params[:post_token])\n end\n end",
"def create\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, 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 create\n \tif logged_in?\n params[:post][:user_id] = current_user.id\n @post = Post.new(post_params)\n if @post.save\n puts @post.published\n render json: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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 create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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 create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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 create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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 create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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 create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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 create\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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 create\n @post = current_user.posts.new(params[:post])\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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 post(path, params={}, options={})\n request(:post, api_path(path), params, options)\n end",
"def create\n @post = Post.new post_params\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(data = \"\")\n submit :Post, data\n end",
"def create_posts\n end",
"def create_posts\n end",
"def create\n #raise params.inspect\n \n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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 create\n post\n end",
"def create\n puts \"create post: #{post_params.inspect}\"\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, options = nil)\n add(path, options).post\n end",
"def create\n post_service = PostService.new(current_user, params)\n post_service.create_post\n #post_service.create\n respond_to do |format|\n if post_service.save?\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { redirect_to new_post_url, alert: post_service.errors }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @posts = Post.page(params[:page]).order('created_at desc')\n @post = Post.new(post_params)\n @user = User.where('account_id == ?', current_account.id)[0]\n respond_to do |format|\n if @post.save\n format.html { redirect_to '/posts' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :index }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @post = Post.new(params[:post])\r\n\r\n respond_to do |format|\r\n if @post.save\r\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\r\n format.json { render json: @post, status: :created, location: @post }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @post = Post.new(params[:post])\n\t\t\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, 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 create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = Post.new(post_params)\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to posts_path, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_post = Api::V1::Post.new(api_v1_post_params)\n\n respond_to do |format|\n if @api_v1_post.save\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_post }\n else\n format.html { render :new }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(path, payload={})\n request(:post, path, payload)\n end",
"def create\n @post = Post.new(post_params)\n\n if @post.save\n render :show, status: :created, location: @post\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def POST; end"
] |
[
"0.7122229",
"0.70707834",
"0.69825006",
"0.6970939",
"0.68835485",
"0.68292725",
"0.6817987",
"0.68095577",
"0.6733894",
"0.6622669",
"0.66085804",
"0.659331",
"0.658407",
"0.65816855",
"0.6573764",
"0.6571573",
"0.6557903",
"0.6529084",
"0.6528547",
"0.65230095",
"0.65001166",
"0.6492367",
"0.64540434",
"0.6447291",
"0.64337885",
"0.6432201",
"0.64290655",
"0.6398973",
"0.63821524",
"0.63755774",
"0.6374499",
"0.63689685",
"0.63526344",
"0.63422066",
"0.63421535",
"0.6340367",
"0.6340367",
"0.6340367",
"0.6339884",
"0.6339884",
"0.6337287",
"0.63366616",
"0.63366616",
"0.63366616",
"0.6335569",
"0.63211405",
"0.6319832",
"0.63095903",
"0.63008714",
"0.6290972",
"0.6289927",
"0.6289927",
"0.6289927",
"0.6287548",
"0.62765646",
"0.62737876",
"0.6272672",
"0.6271093",
"0.6264002",
"0.6257661",
"0.6257361",
"0.62519383",
"0.62519383",
"0.62519383",
"0.62519383",
"0.62519383",
"0.6247194",
"0.62471133",
"0.62470216",
"0.6244424",
"0.62442356",
"0.6242458",
"0.62364584",
"0.62341166",
"0.62230176",
"0.62230176",
"0.62230176",
"0.62230176",
"0.62230176",
"0.62230176",
"0.62230176",
"0.6222673",
"0.6219257",
"0.62186724",
"0.6203236",
"0.620289",
"0.620289",
"0.6198654",
"0.61984795",
"0.61899287",
"0.6185488",
"0.6184052",
"0.6178204",
"0.6177802",
"0.61759865",
"0.6162015",
"0.6162015",
"0.61540943",
"0.61450785",
"0.6140817",
"0.6140452"
] |
0.0
|
-1
|
PATCH/PUT /posts/1 or /posts/1.json
|
def update
respond_to do |format|
if @post.update(post_params)
format.html { redirect_to @post, notice: "Post was successfully updated." }
format.json { render :show, status: :ok, location: @post }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @post.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_with Post.update(params[:id], params[:posts])\n end",
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update\n respond_with post.update(params[:id], params[:post])\n end",
"def update\n @post = Post.find(params[:id])\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.json { render :json => @post }\n else\n format.json { render :json => @post.errors, :status => :unprocessable_entity}\n end\n end\n #respond_with Post.update(params[:id], params[:post])\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n format.xml { render xml: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_with Post.update(params[:id],post_params)\n end",
"def update\n if @post.update({\n title: post_params[:title],\n content: post_params[:content],\n })\n render json: Post.all.as_json\n else\n render json: {errors: @post.errors.full_messages}, status: :unprocessable_entity\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render json: @post }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n id = Post.find(params[:id])._id\n \n respond_to do |format|\n if ((@post.update_attributes(params[:post])) && (@post._id = id))\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_post.update(api_v1_post_params)\n format.html { redirect_to @api_v1_post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_post }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n @post.update_attributes(params[:post])\n format.html { redirect_to posts_url, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n end \n end",
"def update\n\t\t@post = post.find(params[:id])\n\t\t@post.update_attributes(post_params)\n\t\trespond_to do |format|\n\t\t\tformat.html {redirect_to post_path(@post)}\n\t\t\tformat.json {render json: @post}\n\t\tend\n\tend",
"def update\n authenticated\n\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n @title = \"EDIT\"\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @api_post = Api::Post.find(params[:id])\n\n if @api_post.update(api_post_params)\n head :no_content\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: '' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.json { render :show, status: :ok, location: @post }\n else\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'slam updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @post.update(post_params)\n render json: {\n data: @post\n }\n else\n render json: {\n errors: @post.errors\n }\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @post\n\n if @post.save\n render json: @post\n else\n render json: @post.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\r\n @post = Post.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @post.update_attributes(params[:post])\r\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n\t\tif @post.update(post_params)\n\t\t\trender json: @post, status: :success\n\t\telse\n\t\t\trender json: @post.errors, status: :unprocessable_entity #422\n\t\tend\n\tend",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to :action => 'index', notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post.update_attributes(params[:post])\n respond_with(@post)\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to post_path, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if (@post.update(params.permit(:title, :content)))\n render json: @post, status: :ok\n else\n render json: @post.errors, status: 422\n end\n end",
"def update\n @api_v2_post = Post.find(params[:id])\n\n respond_to do |format|\n if @api_v2_post.update_attributes(params[:api_v2_post])\n format.html { redirect_to @api_v2_post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_v2_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update(post_params)\n render action: \"show.json.jbuilder\"\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update \n #this works largely the same, \n @post = Post.find(params[:id])\n @post.created_at = params[:created_at] if !!params[:created_at]\n if @post.update_attributes(params[:post])\n render \"show\", handlers: [:rabl]\n else\n render :json => @post.errors.full_messages, status: 422\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update?(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #disable edit for now\n redirect_to posts_path\n return\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to post_path(@post), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:user_id])\n @post = @user.posts.find(params[:id])\n\n if @post.update(post_params)\n head :no_content\n else\n render json: @post.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user = current_user\n @post = @user.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to \"/#{session[:username]}\", notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n title = params[:title]\n body = params[:body]\n\n @post.update!(title: title, body: body)\n\n if @post.save!\n json_response(@post)\n else\n json_response(@post.errors)\n end\n end",
"def edit\n\t\t@post = Post.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {render json: @post}\n\t\tend\n\tend",
"def update\n @post = Post.find_by_slug(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to magazine_post_path(@post.short_url), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # if @post.update_attributes(params[:post])\n # format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n # format.json { head :no_content }\n #else\n # format.html { render action: \"edit\" }\n # format.json { render json: @post.errors, status: :unprocessable_entity }\n #end\n #end\n end",
"def update\t\n\t\tpost = @current_user.role == \"admin\" ? Post.find_by(id: params[:id]) : @current_user.posts.find_by(id: params[:id]) \n\t\tif post && post.update_attributes(post_params)\n\t\trender json: {success: true, auth_token: @current_user.authentication_token, post_id: post.id, post_desc: post.description}\n\t else\n\t render json: {success: false, message: \"not found or validation failed\"}, status: 422\n\t\tend \n\tend",
"def update\n redirect_to posts_path and return unless Mist.authorized?(:update_post, self)\n @post = Mist::Post.find(params[:id])\n\n respond_to do |format|\n coerce_date(params[:post], 'published_at')\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @post.update(post_params)\n render json: {status: 1, id: @post.id.to_s, notice: \"修改成功,标题是:#{@post.title.capitalize}\", errors: []}\n else\n render json: {status: -1, notice: \"修改失败\", errors: @post.errors.fall_message}\n end\n end",
"def update\n update_resource_response(@post, blog_post_params)\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to posts_path, notice: 'Post updated successfully.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post]) then\n Feed.update_post(@post)\n format.js { render :action => \"update.rjs\" } if request.xhr?\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @post.update(post_params)\n\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\t@posts = Post.all\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n delete_caches\n end",
"def update\n @update = Update.find(params[:id])\n @post = @update.post\n\n respond_to do |format|\n if @update.update_attributes(params[:update])\n format.html { redirect_to @post, notice: 'Update was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n post = Post.find_by(id: params[:id])\n # byebug\n\n post.assign_attributes(update_params)\n if post.valid?\n post.save\n render json: post, status: :created\n else\n render json: {errors: post.errors.full_messages}, status: 422\n end\n end",
"def update\n render_forbidden and return unless can_edit?\n @post = Post.friendly.find(params[:id])\n \n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n redirect_to root_path\n end\n end\n end",
"def update\n if @api_post.update(api_post_params)\n render :show\n else\n render json: @api_post.errors, status: :unprocessable_entity\n end\n end"
] |
[
"0.7244233",
"0.71808875",
"0.692856",
"0.6877579",
"0.68152857",
"0.67375803",
"0.67343867",
"0.6674573",
"0.6666083",
"0.6659683",
"0.6607322",
"0.65937084",
"0.6586463",
"0.65829575",
"0.65725297",
"0.65613693",
"0.6560171",
"0.6554742",
"0.6554742",
"0.6539801",
"0.65338093",
"0.65322524",
"0.65322524",
"0.65322524",
"0.65322524",
"0.65322524",
"0.65322524",
"0.65322524",
"0.65322524",
"0.65322524",
"0.65322524",
"0.65322524",
"0.65322524",
"0.65322524",
"0.65322524",
"0.65322524",
"0.65322524",
"0.6531915",
"0.65311575",
"0.65270025",
"0.65255636",
"0.6524894",
"0.6498026",
"0.6498026",
"0.6498026",
"0.6498026",
"0.6490703",
"0.6481579",
"0.64481294",
"0.64462173",
"0.6442547",
"0.6441753",
"0.6431331",
"0.6429201",
"0.6426332",
"0.6417937",
"0.6400691",
"0.6384929",
"0.63816166",
"0.6377916",
"0.6377767",
"0.6369113",
"0.6367179",
"0.6367179",
"0.6367179",
"0.6367179",
"0.6367179",
"0.6367179",
"0.6367179",
"0.6367179",
"0.6367179",
"0.6367179",
"0.6365854",
"0.63417584",
"0.633942",
"0.6331856",
"0.63214165",
"0.6315771",
"0.631393",
"0.63019943",
"0.6299947",
"0.6294539",
"0.6278202",
"0.6264435",
"0.62353706",
"0.6232681",
"0.6231764",
"0.6231208",
"0.62210256",
"0.6210871",
"0.6204674",
"0.6202579",
"0.61987734",
"0.61987734",
"0.61987734",
"0.6191598",
"0.6179456",
"0.61755115",
"0.61680365",
"0.6167826",
"0.6165614"
] |
0.0
|
-1
|
DELETE /posts/1 or /posts/1.json
|
def destroy
@post.destroy
respond_to do |format|
format.html { redirect_to dashboard_index_path, notice: "Post was successfully destroyed." }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n post = Post.find(params[:id])\n if post.destroy\n render json: {status: \"success\", data: {id: params[:id]}}, status: :ok\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authenticated\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n r.delete @post\n\n respond_to do |format|\n format.html { redirect_to(posts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"def destroy\n # @post = Post.find(params[:id])\n # @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n respond_with Post.destroy(params[:id])\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @post.destroy\n render json: {\n post: @post\n }, status: :ok\n else\n render status: :bad_request\n end\n end",
"def destroy\n @api_v2_post = Post.find(params[:id])\n @api_v2_post.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v2_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to posts_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n respond_with Post.destroy(params[:id])\n end",
"def destroy\n @post.destroy\n render json: {}, status: :ok\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_path, notice: \"Post removed.\" }\n format.json { render 'destroy' }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/posts' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to blog_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_post.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_posts_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @post = Post.find(params[:id])\n end",
"def destroy\n respond_with post.destroy(params[:id])\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url, notice: \"Anúncio removido com sucesso.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to all_user_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @post = Post.find(params[:id])\r\n @post.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to root_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @post.destroy\n render json: {\n data: {\n post: { key: @post.id },\n status: @post.status,\n }\n }\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path(client_id:current_user.client.id, per_page:5), notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path, notice: 'Post was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find_by_slug(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html {redirect_to posts_url, notice: 'Post was successfully destroyed.'}\n format.json {head 200}\n end\n end",
"def destroy\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to news_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Postagem excluída com sucesso!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n json_response(@post)\n end",
"def destroy\n authorize @post, :update?\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Пост удален' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n\n head :no_content\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Postagem excluida com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\tpost = Post.find(params[:id])\n\t\t# byebug\n \tpost.destroy\n\t posts = Post.all\n \trender json: posts\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: \"Postitus edukalt kustutatud!\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n @title = \"Kill Post\"\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @post = Post.find(params[:id])\n #@post.destroy\n\n #respond_to do |format|\n # format.html { redirect_to posts_url }\n #format.json { head :no_content }\n #end\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.xml { head :ok }\n end\n end",
"def destroy_by_title\n @post = Roxiware::Blog::Post.where(:guid=>request.env['REQUEST_PATH']).first\n raise ActiveRecord::RecordNotFound if @post.nil?\n authorize! :destroy, @post\n @post.destroy\n respond_to do |format|\n if !@post.destroy\n format.json { render :json=>report_error(@post)}\n format.html { redirect_to @post, :alert => 'Failure deleting blog post.' }\n else\n format.json { render :json=>{}}\n end\n end\n end",
"def destroy\n @mural_post.destroy\n respond_to do |format|\n format.html { redirect_to mural_posts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/magazine\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post.destroy\n \n respond_to do |format|\n format.html { redirect_to post_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n redirect_to posts_path and return unless Mist.authorized?(:destroy_post, self)\n @post = Mist::Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @post.destroy\n head :no_content\n end",
"def destroy\n @post = Post.friendly.find(params[:id])\n @post.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Story deleted' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize_user\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url, notice: I18n.t('post_deleted') }\n format.json { head :no_content }\n end\n end"
] |
[
"0.77866316",
"0.7472207",
"0.73706627",
"0.7365725",
"0.7364187",
"0.7364187",
"0.7364187",
"0.7364187",
"0.7364187",
"0.7364187",
"0.7364187",
"0.7364187",
"0.7364187",
"0.7364187",
"0.7364187",
"0.7364187",
"0.7364187",
"0.7364187",
"0.7364081",
"0.73526657",
"0.7321882",
"0.7321882",
"0.7321882",
"0.7321882",
"0.73218524",
"0.7317449",
"0.73167515",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.73153996",
"0.7314443",
"0.72943735",
"0.7272622",
"0.72716063",
"0.7268083",
"0.7264324",
"0.72427493",
"0.72324306",
"0.72251976",
"0.720539",
"0.72006977",
"0.7191207",
"0.71619284",
"0.71583706",
"0.714478",
"0.71400917",
"0.71367794",
"0.71354693",
"0.7130607",
"0.7130044",
"0.71206814",
"0.7111267",
"0.7102933",
"0.70994127",
"0.7099401",
"0.7097326",
"0.70931965",
"0.7086434",
"0.7085881",
"0.70841086",
"0.7078105",
"0.70746607",
"0.70746607",
"0.7061183",
"0.7048803",
"0.7045446",
"0.7043596",
"0.7042255",
"0.70407283",
"0.7035474",
"0.7033783",
"0.70268583",
"0.702362"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_post
@post = Post.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup_handler\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&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 setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def before_action \n end",
"def action\n end",
"def 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 setup_signals; end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def after_set_callback; end",
"def initialize(*args)\n super\n @action = :set\nend",
"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 around_hooks; end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def 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 default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def call\n setup_context\n super\n end",
"def duas1(action)\n action.call\n action.call\nend",
"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.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0.53307265",
"0.5312121",
"0.5298173",
"0.5296388",
"0.52952695",
"0.5258086",
"0.52430934",
"0.5237911",
"0.5237911",
"0.5237911",
"0.5237911",
"0.5237911",
"0.52335346",
"0.5232943",
"0.5226392",
"0.52221715",
"0.5217978",
"0.52136153",
"0.52076435",
"0.52067244",
"0.5175402",
"0.5174649",
"0.5173085",
"0.5165201",
"0.5162052",
"0.5157932",
"0.5152905",
"0.5152353",
"0.5150909",
"0.514719",
"0.5138596",
"0.51333916",
"0.51139015",
"0.5113431",
"0.5113431",
"0.5109581",
"0.51066816",
"0.5091428",
"0.5089407",
"0.5082971",
"0.50822043",
"0.50668514",
"0.5055155",
"0.50525695",
"0.50499475",
"0.50499475",
"0.5034445",
"0.50249445",
"0.5022226",
"0.50167644",
"0.5014211",
"0.4999924",
"0.49996212",
"0.49978727",
"0.4989682",
"0.4989682",
"0.49851838",
"0.49817684",
"0.4979687",
"0.49787104",
"0.49688423",
"0.49664098",
"0.49564412",
"0.49561828",
"0.49547398",
"0.4953481",
"0.4952925",
"0.4946049",
"0.494379",
"0.49319315",
"0.49313048",
"0.49269778",
"0.49263066",
"0.49257493",
"0.4924526",
"0.49212465",
"0.49173486",
"0.4915802",
"0.49151486",
"0.49150333",
"0.49147308"
] |
0.0
|
-1
|
Only allow a list of trusted parameters through.
|
def post_params
params.require(:post).permit(:title, :image, :description, :category, :ingredients, :method, :prep, :cook, :difficult)
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 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 allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\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 may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"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 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.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\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 admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def params(list)\n @declared_params = list\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 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 list_params\n params.require(:list).permit(:name)\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 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 default_param_whitelist\n [\"mode\"]\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def safe_params\n params.except(:host, :port, :protocol).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 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.69485277",
"0.6813547",
"0.6799911",
"0.6796169",
"0.6745757",
"0.6741778",
"0.6527065",
"0.65204644",
"0.64925444",
"0.64314413",
"0.64314413",
"0.64314413",
"0.6398711",
"0.6355623",
"0.6355327",
"0.6345812",
"0.6343951",
"0.6338371",
"0.6327366",
"0.6327366",
"0.6327366",
"0.63136744",
"0.63001245",
"0.6264419",
"0.62613016",
"0.6259317",
"0.623719",
"0.6227251",
"0.6220037",
"0.621864",
"0.620889",
"0.6199145",
"0.61970234",
"0.61728656",
"0.61563927",
"0.6155928",
"0.6152361",
"0.6136508",
"0.6122662",
"0.6109611",
"0.60738647",
"0.6072253",
"0.6058575",
"0.60571283",
"0.6044282",
"0.6033789",
"0.6018841",
"0.601607",
"0.6014327",
"0.6010113",
"0.60086375",
"0.60080284",
"0.60060716",
"0.6004647",
"0.6004647",
"0.5999453",
"0.59945875",
"0.5990942",
"0.5983142",
"0.5969449",
"0.59688187",
"0.5965012",
"0.5964062",
"0.5960668",
"0.59599936",
"0.59338915",
"0.59288186",
"0.5921217",
"0.59072363",
"0.59049433",
"0.58997554",
"0.58917797",
"0.5890338",
"0.5879621",
"0.5879621",
"0.5879621",
"0.5872355",
"0.58605725",
"0.5853338",
"0.58435106",
"0.5842603",
"0.58328134",
"0.5830374",
"0.5829657",
"0.5828463",
"0.5817261",
"0.58149874",
"0.58147764",
"0.5810487",
"0.5801209",
"0.5801009",
"0.5801009",
"0.5794343",
"0.5785498",
"0.57794553",
"0.5778505",
"0.577467",
"0.57682633",
"0.5768243",
"0.57627535",
"0.5757951"
] |
0.0
|
-1
|
Dump back string parseable form
|
def dump
str = if @page
"page=#{@page}"
else
s = "by=#{@by}"
s += ",from=#{@from}" if @from
s
end
str += ",items=#{items}" if @items
str += ',total_count=true' if @total_count
str
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_s\n @parser ||= WikitextParser.new\n @parsed ||= @parser.parse(@string).to_s\n end",
"def dumpAsString\n\t\tmarkup = \"\"\n\t\t@Value.each do |line|\n\t\t\tmarkup += \"#{line}<br />\\n\"\n\t\tend\n\t\treturn markup\n\tend",
"def to_s\r\n dump\r\n end",
"def prettify(str); end",
"def to_s\n PgQuery::Deparse.from ast\n end",
"def dump() end",
"def asPPString\n s = StringIO.new\n s.print \"{\\n :solrField=> \"\n PP.singleline_pp(@solrField, s)\n s.print(\",\\n \")\n s.print \":firstOnly => true,\\n \" if @first\n if @defaultValue\n s.print(\":default => \")\n PP.singleline_pp(@defaultValue, s)\n s.print(\",\\n \")\n end\n if @map\n s.print(\":mapname => \")\n PP.singleline_pp(@map.mapname, s)\n s.print(\",\\n \")\n end\n if @noMapKeyDefault\n s.print(\":noMapKeyDefault => \")\n PP.singleline_pp(@noMapKeyDefault, s)\n s.print(\",\\n \")\n end\n s.print(\":specs => [\\n\")\n @marcfieldspecs.each do |ts|\n s.print ' '\n PP.singleline_pp(ts, s)\n s.print(\",\\n\")\n end\n s.print \" ]\\n}\"\n return s.string\n end",
"def dump\n @value && \"#{tag}=#{@value}\\x01\"\n end",
"def string_to_dump(value)\n parsed_value = Liquid::Template.parse(value)\n Base64.strict_encode64(Marshal.dump(parsed_value))\nend",
"def dumpAsHTML\n\t\tvalue = dumpAsString\n\t\treturn CGI.escapeHTML(value)\n\tend",
"def dump\n @captured.tr \"\\000-\\037\\177-\\377\", \".\"\n end",
"def _dump(depth)\n inject(\"\") { |str, node| str << node.dump_node << self.class.node_sep }\n end",
"def dump\n @dump ||= meta.empty? ? text : {text: text, **meta}\n end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect; to_s; end",
"def inspect\n serialize.to_s\n end",
"def inspect\n serialize.to_s\n end",
"def inspect\n serialize.to_s\n end",
"def inspect\n serialize.to_s\n end",
"def dump(depth = 0)\n print ' ' * depth * 2\n print \"<?#{@value.inspect}?>\\n\"\n end",
"def to_s()\n prettify()\n end",
"def parse(str); end",
"def _dump() end",
"def dump\n @@fields.each { |field| @contents[field] = send(field) } \n @contents\n end",
"def to_s\n valid? ? \"%s%s %s%s%s %s%s%s %s%s%s\" % @abn.split('') : \"\"\n end",
"def asPPString\n s = StringIO.new\n s.print \"{\\n :maptype=>:kv,\\n :mapname=>\"\n PP.singleline_pp(@mapname, s)\n s.print \",\\n :map => \"\n PP.pp(@map, s)\n s.puts \"\\n}\"\n return s.string\n end",
"def get_parse(s);end",
"def to_s\n Psych.dump to_hash\n end",
"def pretty_abstract_form\n if abstract_form_valid?\n abstract_form.pretty_print_me\n else\n # no idea why PP outputs broken newlines\n dbg = PP.pp(abstract_form, \"\").gsub('\\n', \"\\n\")\n \"This is not a valid form. Here's what could be parsed: \\n\\n\\n\" + dbg\n end\n end",
"def to_s\r\n pretty_output\r\n end",
"def dump\n result = \"\"\n result += \"#{id}: from => #{user&.login}, \"\n result += \"to => #{to_user&.login}, flavor => #{flavor}, \"\n result += \"queued => #{queued}\\n\"\n queued_email_integers.each { |i| result += \"\\t#{i.key} => #{i.value}\\n\" }\n queued_email_strings.each { |i| result += \"\\t#{i.key} => #{i.value}\\n\" }\n result += \"\\tNote: #{queued_email_note.value}\\n\" if queued_email_note\n result\n end",
"def to_s\n PrettyPrinter.new.process(to_sexp)\n end",
"def unescape_stringify(str)\n chars = {\n 'a' => \"\\x07\", 'b' => \"\\x08\", 't' => \"\\x09\", 'n' => \"\\x0a\", 'v' => \"\\x0b\", 'f' => \"\\x0c\",\n 'r' => \"\\x0d\", 'e' => \"\\x1b\", \"\\\\\\\\\" => \"\\x5c\", \"\\\"\" => \"\\x22\", \"'\" => \"\\x27\"\n }\n # Escape all the things\n str.gsub(/\\\\(?:([#{chars.keys.join}])|u([\\da-fA-F]{4}))|\\\\0?x([\\da-fA-F]{2})/) {\n if $1\n if $1 == '\\\\'\n then '\\\\'\n else\n chars[$1]\n end\n elsif $2\n [\"#$2\".hex].pack('U*')\n elsif $3\n [$3].pack('H2')\n end\n }\n end",
"def format_value_to_string(value)\n value.dump\n end",
"def to_s() @out.to_s end",
"def inspect\n out = []\n out << string_name\n out << string_mappings\n out << string_data\n out.compact.join(' ') + '>'\n end",
"def dump\n zeroes = ZEROBYTE * 32\n raw = ZEROBYTE * ID3::ID3v1tagSize\n raw[0..2] = 'TAG'\n\n self.each{ |key,value|\n\n range = ID3::Symbol2framename['1.1'][key]\n\n if range.class == Range \n length = range.last - range.first + 1\n paddedstring = value + zeroes\n raw[range] = paddedstring[0..length-1]\n elsif range.class == Fixnum\n raw[range] = value.to_i.chr # supposedly assigning a binary integer value to the location in the string\n else\n # this can't happen the way we defined the hash..\n next\n end\n }\n\n return raw\n end",
"def to_s\n return '' if @printed\n @printed = true\n struct = required_structs\n members = @values.map do |key, value|\n type = RustStruct.type_name(value[0])\n subtype = RustStruct.type_name(value[1])\n # TODO: add option for pub / private\n # Will this be a per field thing that is configurable from\n # within the JSON or will it be configured on the parse command?\n member = \" pub #{key}: #{type}\"\n member << \"<#{subtype}>\" unless value[1].nil?\n member\n end\n struct << \"pub struct #{@name} {\\n\" + members.join(\",\\n\") + \",\\n}\\n\\n\"\n struct = struct.gsub(\"\\n\\n\\n\", \"\\n\\n\")\n reset if @root\n struct\n end",
"def _dump(depth)\n \"\"\n end",
"def _dump(depth)\n \"\"\n end",
"def to_s\n JSON.pretty_generate(raw)\n end",
"def inspect()\n serialize.to_s()\n end",
"def inspect()\n serialize.to_s()\n end",
"def inspect\n self.ast.to_s\n end",
"def structure_dump() end",
"def to_s\n raw\n end",
"def to_s\n\t\treturn self.stringify_nodes( @output )\n\tend",
"def to_ps\n ret = \"#{self.class.name}:\\n\"\n c = 0\n @fields.each_pair do |p|\n field = p[1]\n next if field.nil?\n if field.is_a?(NumField) || field.is_a?(ApduList)|| field.is_a?(VarNumField)\n if field.optfield.nil? || field.optfield.value == 1\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, field.hexstr)\n else\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, \"--\")\n end\n c = 0\n else #only for bitfield\n ret = ret + sprintf(\" %-28s %s\\n\", field.define, \" \" * c + field.bitstr)\n c += field.length\n end\n end\n return ret\n end",
"def parse\n tagify(decommentify(@input)).strip\n end",
"def pretty\n s = \"\"\n self.fields.each do |f|\n unless (f.name == \"payload\")\n s += \"#{f.name}=#{self.send(f.name)} \"\n end\n end\n s.gsub(/ $/, '')\n end",
"def pretty_print pp\n pp.pp eval(self.asPPString)\n end",
"def pretty_print pp\n pp.pp eval(self.asPPString)\n end",
"def to_s ; format ; end",
"def wp_parse_str(string, array = nil)\n array = Railspress::PHP.parse_str string\n # TODO if ( get_magic_quotes_gpc() ) {\n # $array = stripslashes_deep( array );\n # }\n # Filters the array of variables derived from a parsed string.\n Railspress::Plugin.apply_filters('wp_parse_str', array)\n end",
"def to_s\n return @inp\n end",
"def to_s\n raw = \"Raw: #{@raw}\"\n puts raw\n puts\n father = \"Father: #{@father.raw if @father}\"\n puts father\n puts\n left_sentence = \"Left: #{@left_sentence.raw if @left_sentence}\"\n puts left_sentence\n puts\n operator = \"Operator: #{@operator.value if @operator}\"\n puts operator\n puts\n right_sentence = \"Right: #{@right_sentence.raw if @right_sentence}\"\n puts right_sentence\n puts\n level = \"Level: #{@level}\"\n puts level\n puts\n end",
"def string\n case @doc.format\n when 'date' then parse_time(Date)\n when 'date-time' then parse_time(DateTime)\n when 'base64' then @input # Base64.strict_decode64(@input)\n when 'binary' then @input\n else @input.to_s\n end\n end",
"def raw\n repr.raw\n end",
"def to_s\n\t\tmap { |k,v|\n\t\t\tv.to_s + \" ::= \" + v.rules.map { |r| r.map{|e| e.inspect}.join(\" \") }.join(\" | \")\n\t\t}.join(\"\\n\")\n\tend",
"def make_string raw_string\n ParsedString.new raw_string\n end",
"def to_s\n Forme.transform(:serializer, @opts, @form.opts, self)\n end",
"def to_s\r\n clean!\r\n \r\n map do |name|\r\n name.include?(delimiter) ? \"\\\"#{name}\\\"\" : name\r\n end.join(delimiter.ends_with?(\" \") ? delimiter : \"#{delimiter} \")\r\n end",
"def marshal_dump\n format_name_ = Format.canonical_name_for(@_format, true)\n unparsed_data_ = nil\n if @_format.respond_to?(:unparse_for_serialization)\n unparsed_data_ = @_format.unparse_for_serialization(self) rescue nil\n end\n unparsed_data_ ||= @_format.unparse(self) rescue nil\n data_ = [format_name_]\n case unparsed_data_\n when ::Array\n data_ << unparsed_data_[0]\n data_ << unparsed_data_[1] if unparsed_data_[1]\n when ::String\n data_ << unparsed_data_\n else\n data_ << values_array\n data_ << @_unparse_params if @_unparse_params\n end\n data_\n end",
"def dump\n str_array = []\n @children.each_pair { |_, value| str_array << value.dump }\n str_array.join(', ')\n end",
"def pretty_print_me\n sio = PP.pp(self, \"\")\n\n # aber bitte ohne die ids und ohne @\n sio.gsub(/0x[^\\s]*/,'').gsub(/@/,'')\n end",
"def to_s()\n serialize.to_s()\n end",
"def to_s()\n serialize.to_s()\n end",
"def dump\r\n super + to_s\r\n end",
"def to_s\n @option_parser.to_s\n end",
"def to_s\n return serialize.to_s\n end",
"def to_s\n post_string = YAML.dump(post_data)\n post_string += \"---\\x0D\\x0A\"\n post_string += YAML.load(to_yaml)['body']\n post_string\n end",
"def to_s\n %{#{super}\n restore_name: #@restore_name\n track_num: #@track_num\n include_deleted: #@include_deleted\n restore_date: #@restore_date\n restore_type: #@restore_type\n num_files: #@num_files\n partner_id: #@partner_id\n machine_id: #@machine_id\n restore_id: #@restore_id\n use_company_info: #@use_company_info\n dvd_to_biz: #@dvd_to_biz\n #{@address_info.to_s}\n #{@credit_card.to_s}}\n end",
"def to_s\n serialize.to_s\n end",
"def to_s\n serialize.to_s\n end",
"def to_s\n serialize.to_s\n end",
"def token_to_str(t); end",
"def token_to_str(t); end",
"def inspect\n `/* borrowed from json2.js, see file for license */\n var cx = /[\\u0000\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,\n\n escapable = /[\\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,\n\n meta = {\n '\\b': '\\\\b',\n '\\t': '\\\\t',\n '\\n': '\\\\n',\n '\\f': '\\\\f',\n '\\r': '\\\\r',\n '\"' : '\\\\\"',\n '\\\\': '\\\\\\\\'\n };\n\n escapable.lastIndex = 0;\n\n return escapable.test(self) ? '\"' + self.replace(escapable, function (a) {\n var c = meta[a];\n return typeof c === 'string' ? c :\n '\\\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);\n }) + '\"' : '\"' + self + '\"';`\n end",
"def to_s\n\t\t\t\t\t\tstr = @content\n\t\t\t\t\t\tstr.gsub!(/\\t/,' ')\n\t\t\t\t\t\t# rdoc syntax\n\t\t\t\t\t\tstr.gsub!(/^=head(\\d+)/) do\n \t\t\t\t\"=\" * $1.to_i\n \t\t\t\tend\n \t\t\t\tstr.gsub!(/=item\\s+/, '')\n \t\t\t\tstr.gsub!(/C<(.*?)>/, '<tt>\\1</tt>')\n \t\t\t\tstr.gsub!(/I<(.*?)>/, '<i>\\1</i>')\n \t\t\t\tstr.gsub!(/B<(.*?)>/, '<b>\\1</b>')\n\t\t\t\t\t\tstr.gsub!(/^=(over|back)[^\\n]*\\n/m, '')\n\n\t\t\t\t\t\t# yard syntax\n\t\t\t\t\t\t# convert first code block to example\n\t\t\t\t\t\tstr.gsub!(/\\A(\\s+)^(\\t| \\s*\\S)/, \"\\\\1@example\\n\\\\2\")\n\t\t\t\t\t\t# convert links\n \t\t\t\tstr.gsub!(/L<(.*?)>/) do |link|\n\t\t\t\t\t\t\tlink_and_ref = $1.split(/\\|/)\n\t\t\t\t\t\t\tthing = link_and_ref[0]\n\t\t\t\t\t\t\ttext = link_and_ref[1]\n\t\t\t\t\t\t\ttext ? \"{#{thing}|#{text}}\" : \"{#{thing}}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t\tstr\n\t\t\t\t\tend",
"def inspect\n to_s.inspect\n end",
"def debug_str(inspect_method = :inspect)\n \"Current Date: #{self.input_date.readable}\\nCurrent Time: #{self.input_time.readable}\\n\\nQuery: #{self.query}\\nStandardized Query: #{self.nlp_query}\\nQuery changed in: #{self.nlp_query.changed_in.inspect}\\n\\nConstructs Found: #{s = \"\\n\"; self.construct_finder.constructs.each{|x| s << x.send(inspect_method) + \"\\n\"}; s}\\n\\n@construct_interpreter: #{self.construct_interpreter.send(inspect_method)}\"\n end",
"def dump(print_stream, indent)\n puts \"#{indent.to_s} Field Number: #{field_number.to_s} Value: #{value.to_s}\"\n end",
"def to_s\n \"value: #{@value}\\n\"+\n \"options: #{@options.inspect}\\n\"+\n \"encodable: #{@encodable ? @encodable : '#encode not run yet'}\\n\"+\n \"code: #{@code}\\n\"\n end",
"def to_s\n fields = []\n fields << name\n fields << \"\"\n fields << address.to_s\n fields << \"\"\n fields << \"Telefon: #{phonenumber}\"\n fields << \"E-Mail: #{email}\"\n fields << \"WWW: #{www}\"\n fields.join(\"\\n\")\n end",
"def inspect\n\t\t\told_to_s\n\t\tend",
"def sterilize(str)\n str.encode!('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')\n str.gsub!(0x00.chr,'[NUL]')\n str.gsub!(0x01.chr,'[SOH]')\n str.gsub!(0x02.chr,'[STX]')\n str.gsub!(0x03.chr,'[ETX]')\n str.gsub!(0x04.chr,'[EOT]')\n str.gsub!(0x05.chr,'[ENQ]')\n str.gsub!(0x06.chr,'[ACK]')\n str.gsub!(0x07.chr,'[BEL]')\n # 0x08 is backspace\n # 0x09 is TAB\n # 0x10 is line feed\n str.gsub!(0x0B.chr,'[VT]')\n # 0x0c is form feed\n # 0x0d is carriage return\n str.gsub!(0x0E.chr,'[SO]')\n str.gsub!(0x0F.chr,'[SI]')\n str.gsub!(0x10.chr,'[DLE]')\n str.gsub!(0x11.chr,'[DC1]')\n str.gsub!(0x12.chr,'[DC2]')\n str.gsub!(0x13.chr,'[DC3]')\n str.gsub!(0x14.chr,'[DC4]')\n str.gsub!(0x15.chr,'[NAK]')\n str.gsub!(0x16.chr,'[SYN]')\n str.gsub!(0x17.chr,'[ETB]')\n str.gsub!(0x18.chr,'[CAN]')\n str.gsub!(0x19.chr,'[EM]')\n str.gsub!(0x1a.chr,'[SUB]')\n str.gsub!(0x1C.chr,'[FS]')\n str.gsub!(0x1D.chr,'[GS]')\n str.gsub!(0x1E.chr,'[RS]')\n str.gsub!(0x1F.chr,'[US]')\n str\n end",
"def parse input\r\n split_index = input.index(/[{},]/)\r\n stack = []\r\n if split_index ==nil then\r\n\r\n end\r\n pre_string = input[0..split_index-1].strip\r\n post_string = input[split_index+1..input.length].strip\r\n case input[/[{},]/]\r\n when \"{\"\r\n \tstack << parse(post_string) if pre_string==\"\"\r\n \tif pre_string!=\"\" then\r\n \t\tstack = {}\r\n \t\tstack[pre_string] = parse(post_string)\r\n \tend\r\n when \"}\"\r\n \tstack << pre_string\r\n \treturn stack\r\n when \",\"\r\n end\r\n stack\r\n\r\nend",
"def unescape(string)\n \"\\\"#{string}\\\"\".undump\n end",
"def decode_quoted_printable\n self.unpack(\"M*\").first\n end",
"def dump(depth = 0)\n attr = ''\n @attr.each do |a| ## self.attributes do |a|\n attr += a.to_s + \", \"\n end if @attr\n attr.chop!\n attr.chop!\n print ' ' * depth * 2\n print \"#{@name}(#{attr})\\n\"\n @children.each do |child|\n child.dump(depth + 1)\n end if @children\n end",
"def to_s\r\n value.inspect\r\n end",
"def to_parslet; end",
"def to_s\n rv = ''\n write rv\n rv\n end",
"def to_text\n Vpim.decode_text(value)\n end",
"def to_s() end",
"def to_s() end",
"def to_s() end",
"def to_s() end"
] |
[
"0.6329071",
"0.6087414",
"0.6063648",
"0.60239905",
"0.5857265",
"0.5807426",
"0.5720491",
"0.5706091",
"0.5643747",
"0.56033844",
"0.56007695",
"0.55980957",
"0.55793864",
"0.5559918",
"0.5559918",
"0.5559918",
"0.5559918",
"0.5559918",
"0.55581546",
"0.55429876",
"0.55429876",
"0.55429876",
"0.5536914",
"0.55311286",
"0.5528273",
"0.5527216",
"0.55124676",
"0.54821867",
"0.54727787",
"0.5463732",
"0.54517424",
"0.54419893",
"0.54389197",
"0.5434548",
"0.54331493",
"0.54282546",
"0.54121745",
"0.54050916",
"0.539864",
"0.53925514",
"0.5355442",
"0.53481865",
"0.53481865",
"0.53475976",
"0.53427476",
"0.53427476",
"0.53225046",
"0.53210783",
"0.531508",
"0.53060794",
"0.52970856",
"0.5287727",
"0.5283942",
"0.52835476",
"0.52835476",
"0.5282136",
"0.525926",
"0.52420115",
"0.5225353",
"0.5225082",
"0.52188045",
"0.5204705",
"0.5202848",
"0.5199349",
"0.5198581",
"0.51869655",
"0.5185346",
"0.518406",
"0.5174626",
"0.5174626",
"0.51635027",
"0.5154538",
"0.51419735",
"0.5139931",
"0.5130874",
"0.51271886",
"0.51271886",
"0.51271886",
"0.5123722",
"0.5123722",
"0.5122595",
"0.51225746",
"0.5120862",
"0.51176107",
"0.5115862",
"0.51150346",
"0.5113431",
"0.51105785",
"0.51086634",
"0.51054984",
"0.50999343",
"0.50985926",
"0.50979644",
"0.50936615",
"0.50792044",
"0.5078099",
"0.50771964",
"0.5074446",
"0.5074446",
"0.5074446",
"0.5074446"
] |
0.0
|
-1
|
TODO: currently only works when firewall is enabled
|
def rule_exists?
Chef::Log.info("#{new_resource.name} rule_exists?")
# To Action From
# -- ------ ----
# 22 ALLOW Anywhere
# 192.168.0.1 25/tcp DENY 10.0.0.0/8
# 22 ALLOW Anywhere
# 3309 on eth9 ALLOW Anywhere
# Anywhere ALLOW Anywhere
# 80 ALLOW Anywhere (log)
# 8080 DENY 192.168.1.0/24
# 1.2.3.5 5469/udp ALLOW 1.2.3.4 5469/udp
# 3308 ALLOW OUT Anywhere on eth8
to = rule_exists_to? # col 1
action = rule_exists_action? # col 2
from = rule_exists_from? # col 3
# full regex from columns
regex = rule_exists_regex?(to, action, from)
match = shell_out!('ufw', 'status').stdout.lines.find do |line|
# TODO: support IPv6
return false if line =~ /\(v6\)$/
line =~ regex
end
match
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def config_firewall\n\t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p tcp -m tcp --dport 389 -j ACCEPT`\n \t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p udp -m udp --dport 389 -j ACCEPT`\n\t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p tcp -m tcp --dport 636 -j ACCEPT`\n \t\t`iptables -I INPUT 1 -s 10.0.0.0/8 -p udp -m udp --dport 636 -j ACCEPT`\n\t\t`service iptables save`\n\t\t`service iptables restart`\n\t\t\n\tend",
"def remote_connections; end",
"def read_host_only_interfaces\n end",
"def proxy_pass; end",
"def security_server_client\n end",
"def tunnel_local\n\tend",
"def tunnel_local\n\tend",
"def tunnel_peer\n\tend",
"def tunnel_peer\n\tend",
"def private_net_checker; end",
"def loopback?; end",
"def active_remote_destinations; end",
"def connect_through_proxy; end",
"def connected_ports; end",
"def mx_l7_firewall\r\n MXL7FirewallController.instance\r\n end",
"def mx_inbound_firewall\r\n MXInboundFirewallController.instance\r\n end",
"def spoof()\n\t\tlisten()\n\n\t\tlisten()\n\tend",
"def actual_port; end",
"def actual_port; end",
"def remote_the\n\n end",
"def set_firewall\r\n @firewall = Firewall.find(params[:id])\r\n end",
"def connection_status_mcnet_login; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def transport; end",
"def transport; end",
"def transport; end",
"def proxy_set?; end",
"def connection_status_server; end",
"def remote; end",
"def proxy_addr; end",
"def mx_l3_firewall\r\n MXL3FirewallController.instance\r\n end",
"def connect!; end",
"def connect!; end",
"def connect; end",
"def using_proxy?; end",
"def list_firewall_rules project:\n client = ::Google::Cloud::Compute::V1::Firewalls::Rest::Client.new\n firewalls = client.list project: project\n\n firewall_list = []\n firewalls.each do |firewall|\n puts \" - #{firewall.name}: #{firewall.description}\"\n firewall_list << firewall\n end\n\n firewall_list\nend",
"def firewall_exists?(firewall_name)\n firewalls_list.include?(firewall_name)\n end",
"def passive; end",
"def ssl; end",
"def network; end",
"def network; end",
"def network; end",
"def network; end",
"def network; end",
"def network; end",
"def checklocalfw(session,killfw)\n\tprint_status(\"Getting Windows Built in Firewall configuration...\")\n\topmode = \"\"\n\tr = session.sys.process.execute(\"cmd.exe /c netsh firewall show opmode\", nil, {'Hidden' => 'true', 'Channelized' => true})\n\twhile(d = r.channel.read)\n\t\topmode << d\n\tend\n\tr.channel.close\n\tr.close\n\topmode.split(\"\\n\").each do |o|\n\t\tprint_status(\"\\t#{o}\")\n\tend\n\tif (killfw)\n\t\tprint_status(\"Disabling Built in Firewall.....\")\n\t\tf = session.sys.process.execute(\"cmd.exe /c netsh firewall set opmode mode=DISABLE\", nil, {'Hidden' => 'true','Channelized' => true})\n\t\twhile(d = f.channel.read)\n\t\t\tif d =~ /The requested operation requires elevation./\n\t\t\t\tprint_status(\"\\tUAC or Insufficient permissions prevented the disabling of Firewall\")\n\t\t\tend\n\t\tend\n\t\tf.channel.close\n\t\tf.close\n\tend\nend",
"def remote_ip; end",
"def standard_port?; end",
"def preflight; end",
"def firewall_profile_public\n return @firewall_profile_public\n end",
"def mx_vpn_firewall\r\n MXVPNFirewallController.instance\r\n end",
"def reserved_net_checker; end",
"def allow_net_connect?\n allow_net_connect\n end",
"def mx_cellular_firewall\r\n MXCellularFirewallController.instance\r\n end",
"def clear_forwarded_ports\n end",
"def tunnel_local\n\t\tbegin\n\t\t\trstream.localinfo\n\t\trescue ::Exception\n\t\t\t'127.0.0.1'\n\t\tend\n\tend",
"def public_proxy?; end",
"def public_proxy?; end",
"def active_local_sockets; end",
"def allowBastionAccess\n return nil if !@nat or !@nat.is_a?(MU::Cloud::Server)\n\n myFirewallRules.each { |acl|\n if acl.config[\"admin\"]\n acl.addRule(@nat.listIPs, proto: \"tcp\")\n acl.addRule(@nat.listIPs, proto: \"udp\")\n acl.addRule(@nat.listIPs, proto: \"icmp\")\n end\n }\n end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def port; end",
"def legitimate_proxy?; end",
"def allowHost\n end",
"def remote_addr; end",
"def firewalls_list\n return [] unless configured?\n\n @service.fetch_all do |token|\n @service.list_firewalls(@gcp_config['project'], page_token: token)\n end.map(&:name)\n end",
"def connect\n end",
"def try_to_parse_proxy_protocol; end",
"def connect\n\tend",
"def connection_status_login_request; end",
"def protocol; config[:protocol]; end",
"def on_localhost?; true end",
"def mg_port_forwarding_rules\r\n MGPortForwardingRulesController.instance\r\n end",
"def optional_port; end",
"def post_init\n port, ip = Socket.unpack_sockaddr_in(get_peername)\n host = Socket.getaddrinfo(ip, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)[0][2]\n ActiveRecord::Base.logger.info \"-- Collector connection established from #{host}\"\n end",
"def socket; end",
"def socket; end",
"def socket; end",
"def socket; end",
"def socket; end",
"def http_proxy; end",
"def standard_port; end",
"def run\n super\n\n # TODO this won't work once we fix the name regex\n port = _get_entity_detail(\"port\").to_i\n port = 21 if port == 0 # handle empty port\n protocol = _get_entity_detail(\"protocol\") || \"tcp\"\n ip_address = _get_entity_detail(\"ip_address\") || _get_entity_name\n\n # Check to make sure we have a sane target\n if protocol.downcase == \"tcp\" && ip_address && port\n\n begin\n\n ftp = Net::FTP.new\n ftp.connect(ip_address, port)\n ftp.passive = true\n\n out = {}\n begin\n _log \"attempting anonymous login\"\n out[\"anonymous\"] = ftp.login\n rescue Net::FTPPermError => e\n _log_error \"unable to log in, proceeding\"\n rescue EOFError => e\n _log_error \"eof reached when connecting, failing\"\n return\n rescue Errno::ECONNREFUSED => e\n _log_error \"connection refused when connecting, failing\"\n return\n end\n\n begin\n _log \"checking HELP command\"\n out[\"help\"] = \"#{ftp.help}\"\n rescue Net::FTPPermError => e\n _log_error \"unable to run HELP, proceeding\"\n rescue EOFError => e\n _log_error \"eof reached\"\n end\n\n begin\n _log \"checking permissions\"\n ftp.chdir('/')\n out[\"dir\"] = [\n \"root\" => {\n \"listing\" => ftp.list,\n \"facts\" => ftp.mlst.facts\n }\n ]\n rescue Net::FTPPermError => e\n _log_error \"unable to collect directory info, not logged in\"\n rescue Errno::EPIPE => e\n _log_error \"Unable to connect: #{e}\"\n rescue EOFError => e\n _log_error \"eof reached\"\n end\n\n begin\n _log \"checking SYSTEM command\"\n out[\"system\"] = \"#{ftp.system}\"\n rescue Net::FTPPermError => e\n _log_error \"unable to collect system info - not logged in\"\n rescue EOFError => e\n _log_error \"eof reached\"\n end\n\n _set_entity_detail(\"ftp_enumerate\", out)\n _log out\n\n rescue EOFError => e\n _log_error \"Unable to connect: #{e}\"\n rescue Errno::EPIPE => e\n _log_error \"Unable to connect: #{e}\"\n rescue SocketError => e\n _log_error \"Unable to connect: #{e}\"\n rescue Net::FTPPermError=> e\n _log_error \"Unable to connect: #{e}\"\n rescue Net::FTPTempError => e\n _log_error \"Unable to connect: #{e}\"\n rescue Errno::ECONNREFUSED => e\n _log_error \"Unable to connect: #{e}\"\n rescue Errno::ETIMEDOUT => e\n _log_error \"Unable to connect: #{e}\"\n rescue Errno::ECONNRESET => e\n _log_error \"Unable to connect: #{e}\"\n rescue Net::ReadTimeout => e\n _log_error \"Timeout: #{e}\"\n end\n\n end\n\n end",
"def socket_host; end",
"def tunnel_port\n super\n end",
"def proxy; end",
"def proxy; end"
] |
[
"0.6778904",
"0.6127051",
"0.59988374",
"0.5844392",
"0.583598",
"0.57881355",
"0.5787114",
"0.577674",
"0.577674",
"0.5773263",
"0.5759785",
"0.57573324",
"0.57412744",
"0.5726957",
"0.57204473",
"0.571064",
"0.56808496",
"0.56776303",
"0.56776303",
"0.56745845",
"0.56556255",
"0.5637385",
"0.5615231",
"0.5615231",
"0.5615231",
"0.5615231",
"0.5615231",
"0.5615231",
"0.5615231",
"0.5615231",
"0.5615231",
"0.5601024",
"0.5601024",
"0.5601024",
"0.55974853",
"0.5597245",
"0.55897874",
"0.55755264",
"0.5542901",
"0.5539562",
"0.5539562",
"0.55249345",
"0.551345",
"0.55082905",
"0.5506875",
"0.550318",
"0.55013895",
"0.54943204",
"0.54943204",
"0.54943204",
"0.54943204",
"0.54943204",
"0.54943204",
"0.54938656",
"0.54872507",
"0.54851395",
"0.5483482",
"0.548189",
"0.5476714",
"0.54643434",
"0.54522437",
"0.54494786",
"0.54383415",
"0.54247314",
"0.5421838",
"0.5421838",
"0.54129595",
"0.5410005",
"0.5407958",
"0.5407958",
"0.5407958",
"0.5407958",
"0.5407958",
"0.5407958",
"0.5407958",
"0.5407958",
"0.5399281",
"0.5386947",
"0.5377155",
"0.5372053",
"0.5354605",
"0.5348241",
"0.5345255",
"0.5345111",
"0.53423655",
"0.5337348",
"0.5336515",
"0.53346837",
"0.5331581",
"0.5329364",
"0.5329364",
"0.5329364",
"0.5329364",
"0.5329364",
"0.5326208",
"0.53199196",
"0.5319331",
"0.5314069",
"0.52979803",
"0.5284755",
"0.5284755"
] |
0.0
|
-1
|
traverse from [0,0] to the bottom right, only going either right or down. utilize memoization to keep track of paths return all valid paths as output most likely solved with a buttomup approach start at the bottom right and
|
def traverse_grid(rows, cols, dead_zones, paths)
paths ||= Array.new(rows) {Array.new(cols)}
#recursive step
return traverse_grid(rows-1, cols) || traverse_grid(rows, cols-1)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def traverse_maze(maze)\n def get_path(maze, row, col, current_path)\n return false if row.negative? || row >= maze.length || col.negative? || col >= maze[0].length # out of bounds\n return false if maze[row][col] == 1 # impassable\n\n current_path << Point.new(row, col)\n at_end = row == maze.length - 1 && col == maze[0].length - 1\n if at_end || get_path(maze, row, col += 1, current_path) || get_path(maze, row += 1, col, current_path)\n @viable_path = current_path\n return true\n end\n false\n end\n @viable_path = nil\n return nil if maze.nil? || maze.empty?\n\n get_path(maze, 0, 0, [])\n return false if @viable_path.nil?\n\n @viable_path.map { |p| [p.row, p.col].join(',') }.join(' -> ')\nend",
"def traverse_top_right_to_bottom\n num_row = @twod_arr.length\n num_col = @twod_arr[0].length\n top = 0\n bottom = num_row -1\n left = 0\n right = num_col -1\n dir = 0\n\n while top <= bottom && left <= right\n if dir == 0\n for i in top..bottom\n @result << @twod_arr[i][right]\n end\n right -= 1\n dir = 1\n elsif dir == 1\n for i in right.downto(left)\n @result << @twod_arr[bottom][i]\n end\n bottom -= 1\n dir = 2\n elsif dir == 2\n for i in bottom.downto(top)\n @result << @twod_arr[i][left]\n end\n left += 1\n dir = 3\n else\n for i in left..right\n @result << @twod_arr[top][i]\n end\n top += 1\n dir = 0\n end\n end\n @result\n end",
"def traverse(map, right, down)\n bottom = map.count\n x, y, level, trees = 0, 0, 1, 0\n\n while level < bottom do\n x += right\n y += down\n trees += 1 if map[y][x.remainder(map[0].size)] == \"#\"\n level += down\n end\n trees\nend",
"def pathfind begTile, endTile\n @traveled_tiles = [begTile]\n @current_tiles = [begTile]\n @next_tiles = Array.new\n #iterate through the maze one movement at a time, hard stop when all tiles have been exhausted\n while (!@current_tiles.include? endTile) && @traveled_tiles.length < @maze.size\n @current_tiles.each do |tile|\n (get_adjacent_floors tile).each do |next_tile|\n #makes sure no tiles are double counted, the first to hit will always be the shortest\n if (next_tile.is_floor) && (!@next_tiles.include? next_tile) && (!@traveled_tiles.include? next_tile)\n @next_tiles.push next_tile\n next_tile.previous_tile tile\n end\n end\n end\n @traveled_tiles.concat @next_tiles\n @current_tiles = @next_tiles.dup\n @next_tiles.clear\n end\n endTile.get_path\n end",
"def solve_maze\n matrix = @maze[:matrix] # get matrix from maze hash\n exit_found = false # exit not found yet\n room = Room.new(@maze[:start_x], @maze[:start_y], nil) # create new room from start position\n queue = Queue.new # queue to store the current working nodes' children\n queue << room # add the new room to queue\n\n # if path not found and queue not empty\n while !queue.empty? && !exit_found\n room = queue.pop # get the next room to search for a path\n x = room.x\n y = room.y\n if (x == @maze[:stop_x] && y == @maze[:stop_y]) # if found\n exit_found = true\n else # if not found\n matrix[y][x] = '*' # Mark node as visited sto we do not check it again (bfs algorithm)\n\n # push to queue the children of node room. We are pushing the up, down, left or right room if they are not a wall and we\n # we haven't visited them yet\n queue << Room.new(x+1,y,room) if open_room(x+1,y,matrix) and !visited(x+1, y, matrix)\n queue << Room.new(x-1,y,room) if open_room(x-1,y,matrix) and !visited(x-1,y,matrix)\n queue << Room.new(x,y+1,room) if open_room(x,y+1,matrix) and !visited(x, y+1, matrix)\n queue << Room.new(x,y-1,room) if open_room(x,y-1,matrix) and !visited(x, y-1, matrix)\n end\n end\n\n # if goal found store the last room to @maze[:path]. The last room has a reference(:parent) to the previous room. So we can trace the path\n if exit_found\n @status.found = true\n @maze[:path] = room\n else\n @status.found = false\n end\n\n # yields x, y coordinates of path starting from goal to start\n def yield_path\n room = @maze[:path]\n while room.parent\n yield room.x, room.y\n room = room.parent\n end\n end\n\n # get an array of path\n def path_array\n path = []\n yield_path do |x, y|\n path << [x,y]\n end\n path.reverse\n end\n end",
"def robot_paths(x, y, map={})\n if x == 0 && y == 0\n 0\n elsif (x == 0 && y >= 0) || (x >= 0 && y == 0)\n 1\n elsif map[x] && map[x][y]\n map[x][y]\n else\n result = robot_paths(x - 1, y, map) + robot_paths(x, y - 1, map)\n map[x] ? map[x][y] = result : map[x] = {y => result}\n map[x][y]\n end\nend",
"def count_paths(grid, x, y, w, h)\n\tcount = 0\n\n\tputs \"Visiting x:#{x}, y:#{y}\"\n\n\t# if already visited, return so we can do down a different path\n\treturn count if grid[x][y]\n\n\t#puts \"Valid move\"\n\t# mark tile as visited\n\tgrid[x][y] = true\n\n\t# how this works is we only count the path once we have hit our end point\n\t# otherwise keep calling the function\n\n\t# We can go in all directions but we are constrained by the grid and we can't go to a visited\n\t# square\n\t# if x = 0, try to go right\n\n\t# Always prefer to go right\n\tcount += count_paths(grid, x+1, y, w, h) if x < w - 1\n\n\t# Go down, if allowed\n\tcount += count_paths(grid, x, y+1, w, h) if y < h - 1\n\n\t# Go left\n\tcount += count_paths(grid, x-1, y, w, h) if x > 0\n\n\t# Go up\n\tcount += count_paths(grid, x, y-1, w, h) if y > 0\n\n\n\n\n\t#count += count_paths(grid, x, y, w, h) if \n\n\t# if we are on the left, we can only go (down,right, up)\n\t# if we are on top we can only go (down right or up)\n\t# if we have reached the bottom, (up, right or left)\n\t#count += count_paths(grid, x, y, w, h) if \n\n\t# We have reached the destination\n\t#puts \"Reached destination\" if (x == w - 1) && (y == h -1)\n\tcount += 1 if (x == w - 1) && (y == h -1)\n\n\tcount\nend",
"def find_path(source, target, map)\n @main_loop_count = 0\n\n max_y = map.size - 1\n max_x = map[0].size - 1\n target_x = target[0]\n target_y = target[1]\n # target heuristic is 0\n target = [target_x, target_y, 0]\n\n # Sets up the search to begin from the source\n source = source.dup.push((target_x - source[0]).abs + (target_y - source[1]).abs)\n came_from = {}\n came_from[source] = nil\n frontier = [source]\n\n # Until the target is found or there are no more cells to explore from\n until came_from.has_key?(target) || frontier.empty?\n @main_loop_count += 1\n\n # Take the next frontier cell\n new_frontier = frontier.shift\n\n # Find the adjacent neighbors\n adjacent_neighbors = []\n\n # Gets all the valid adjacent_neighbors into the array\n # From southern neighbor, clockwise\n nfx = new_frontier[0]\n nfy = new_frontier[1]\n adjacent_neighbors << [nfx , nfy - 1, (target_x - nfx).abs + (target_y - nfy + 1).abs] unless nfy == 0\n adjacent_neighbors << [nfx - 1, nfy - 1, (target_x - nfx + 1).abs + (target_y - nfy + 1).abs] unless nfx == 0 || nfy == 0\n adjacent_neighbors << [nfx - 1, nfy , (target_x - nfx + 1).abs + (target_y - nfy).abs] unless nfx == 0\n adjacent_neighbors << [nfx - 1, nfy + 1, (target_x - nfx + 1).abs + (target_y - nfy - 1).abs] unless nfx == 0 || nfy == max_y\n adjacent_neighbors << [nfx , nfy + 1, (target_x - nfx).abs + (target_y - nfy - 1).abs] unless nfy == max_y\n adjacent_neighbors << [nfx + 1, nfy + 1, (target_x - nfx - 1).abs + (target_y - nfy - 1).abs] unless nfx == max_x || nfy == max_y\n adjacent_neighbors << [nfx + 1, nfy , (target_x - nfx - 1).abs + (target_y - nfy).abs] unless nfx == max_x\n adjacent_neighbors << [nfx + 1, nfy - 1, (target_x - nfx - 1).abs + (target_y - nfy + 1).abs] unless nfx == max_x || nfy == 0\n\n new_neighbors = adjacent_neighbors.select do |neighbor|\n # That have not been visited and are not walls\n unless came_from.has_key?(neighbor) || map[neighbor[1]][neighbor[0]] != '.'\n # Add them to the frontier and mark them as visited\n # frontier << neighbor\n came_from[neighbor] = new_frontier\n end\n end\n\n # Sort the frontier so cells that are close to the target are then prioritized\n if new_neighbors.length > 0\n new_neighbors = merge_sort(new_neighbors)\n if frontier.length > 0 && new_neighbors[0][2] >= frontier[0][2]\n frontier = merge_sort(new_neighbors.concat(frontier))\n else\n frontier = new_neighbors.concat(frontier)\n end\n end\n end\n\n # If the search found the target\n if came_from.has_key?(target)\n # Calculates the path between the target and star for the greedy search\n # Only called when the greedy search finds the target\n path = []\n next_endpoint = came_from[target]\n while next_endpoint\n path << [next_endpoint[0], next_endpoint[1]]\n next_endpoint = came_from[next_endpoint]\n end\n path\n else\n return nil\n end\n end",
"def get_path(s, e, maze)\n if maze[s[0]][s[1]] == 1 || # found a wall or visited area\n s[0] < 0 || s[1] < 0 || # top or left edge\n s[0] >= maze.length || s[1] >= maze[0].length # bottom or right edge\n\n path = nil\n\n elsif s[0] == e[0] && s[1] == e[1] # exit spot\n\n path = [s]\n\n else\n\n maze[s[0]][s[1]] = 1 # visit current node\n path =\n get_path([s[0] - 1, s[1]], e, maze) ||\n get_path([s[0], s[1] + 1], e, maze) ||\n get_path([s[0], s[1] - 1], e, maze) ||\n get_path([s[0] + 1, s[1]], e, maze)\n\n path << s unless path.nil?\n\n end\n \n return path\nend",
"def steps (x, y, path)\n if x == 0 && y == 0\n then puts (path)\n return\n end\n if x > 0\n then steps(x - 1, y, path + \"R\")\n steps(x - 1, y + 1, path + \"L\")\n end\n if y > 0\n then steps(x, y - 1, path + \"H\")\n end\nend",
"def solve(begX, begY, endX, endY)\n # set solution to false\n solution = false\n # create a temp array that is a copy of the maze\n temp = @maze\n # creates an empty queue\n queue = Queue.new\n # enqueue the beginning coordinates as an array\n queue.enq([begX, begY])\n while !queue.empty? && !solution\n # create a current value that is the array of the currently examined coordinates\n # get x and y separate for simplicity\n current = queue.pop\n x=current[0]\n y=current[1]\n # if x and y are the end coordinates, push them on to the maze trace array\n # and set solution to true to trigger an end to the while loop\n if x == endX && y == endY\n @maze_trace.push(current)\n solution = true\n else\n # else still push the coordinates to the trace array\n # set the corresponding value in the temp array to 1\n # enqueue the coordinates above, below, left and right of current\n # only enqueue the elements that pass the check_path method\n # note that we change the temp value to \"1\" so that previously visited coordinates\n # fail the check_path method. This ensures we don't revisit coordinates\n @maze_trace.push(current)\n temp[x][y] = \"1\"\n queue.enq([x+1,y]) if check_path(x+1,y,temp)\n queue.enq([x-1,y]) if check_path(x-1,y,temp)\n queue.enq([x,y+1]) if check_path(x,y+1,temp)\n queue.enq([x,y-1]) if check_path(x,y-1,temp)\n end\n end\n if solution\n puts \"Path found from point #{begX},#{begY} to point #{endX},#{endY}\"\n else\n puts \"No path exists between given points\"\n # If the path is not found clear the maze_trace array which has elements stored nonetheless\n @maze_trace.clear\n end\n end",
"def find_path\n current_node = @cells_visited.last\n while current_node.parent != nil do\n @solved_path << current_node.cell\n current_node = current_node.parent\n end\n @solved_path << current_node.cell\n end",
"def build_paths(start)\n step = 0\n visited = []\n unvisited = [[board_node_by_location(start),step]]\n \n while !unvisited.empty?\n node = unvisited[0][0]\n step = unvisited[0][1] + 1\n \n node.neighbors.each do |x|\n if not_visited(board_node_by_location(x),visited, unvisited)\n unvisited << [board_node_by_location(x),step]\n end\n end\n visited << unvisited.shift\n end\n return visited\nend",
"def find_path(start, target)\n node = build_path(start, target)\n path = [node]\n until node.next_node.nil? do\n node = node.next_node\n path.push(node)\n end\n path = path.reverse\n puts \"You made it in #{path.length} moves. Here is your path: \"\n path.each do |node|\n puts \"[#{node.x}], [#{node.y}]\"\n end\nend",
"def backtrack\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # current x, y, target x, y and resulting path\n cx, cy, x, y, result = @tx, @ty, 0, 0, []\n # find the way back from destination to start\n loop do\n # change current coordinates\n cx, cy = cx - x, cy - y\n # stop if reached corrected start position\n break if cx == @sx && cy == @sy\n # add movement command\n pix.times {result.unshift(Cache::TDirs[@closed[cx, cy]])}\n # track back next node\n x, y = Cache::DirOffsets[@closed[cx, cy]]\n end\n # modify found path if pixel movement is being used\n modify(result) if pix > 1\n # return result\n return result\n end",
"def find_path_brute_force( board, start_point )\n options = get_options( start_point, board )\n\n # Bottom right corner\n if options.length == 0\n return { points: [start_point], best_value: get_value( start_point, board ) }\n end\n\n # If there's only one option, this works fine still.\n first_result = find_path_brute_force( board, options.first )\n second_result = find_path_brute_force( board, options.last )\n if first_result[:best_value] > second_result[:best_value]\n return {\n points: [start_point] + first_result[:points],\n best_value: first_result[:best_value] + get_value( start_point, board )\n }\n else\n return {\n points: [start_point] + second_result[:points],\n best_value: second_result[:best_value] + get_value( start_point, board )\n }\n end\nend",
"def next_step_from(paths)\n paths.map do |path|\n possible_neighbours(path.most_recent_step.coordinate, @max_x, @max_y) \n .map { |c| coord_to_step_on_path(c, path) }\n .reject { |p| p == nil }\n end\n .flatten\n end",
"def find_path(goal = @maze.find_end)\n path = [goal]\n spot = goal\n until @branching_paths[spot] == nil\n path << @branching_paths[spot]\n spot = @branching_paths[spot]\n end\n path\n end",
"def path_finder \n until queue.empty? \n current_node = queue.shift()\n generate_neighbours(current_node)\n current_node.neighbour_nodes.each do |neighbour|\n track_visited(current_node, neighbour)\n correct_node?(neighbour) ? (return neighbour.visited) : (queue << neighbour)\n end\n end\n end",
"def recurse_top_left_to_bottom_right(x1, y1, x2, y2)\n top_left_to_bottom_right x1, y1, x2, y2\n recurse_bottom_right_to_top_left x1, y1 + 1, x2 - 1, y2 if x2 - x1 > 0\n end",
"def next_path map, h, w\n\n\tlow = map[h][w].to_i\n\tlh = h\n\tlw = w\n\n\tif h - 1 >= 0\n\t\tnh = h - 1\n\t\tnw = w\n\t\tnorth = map[nh][nw].to_i\n\t\tif north < low\n\t\t\tlow = north\n\t\t\tlh = nh\n\t\t\tlw = nw\n\t\tend\n\tend\n\n\tif w - 1 >= 0\n\t\twh = h\n\t\tww = w - 1\n\t\twest = map[wh][ww].to_i\n\t\tif west < low\n\t\t\tlow = west\n\t\t\tlh = wh\n\t\t\tlw = ww\n\t\tend\n\tend\n\t\n\tif w + 1 < map[0].size\n\t\teh = h\n\t\tew = w + 1\n\t\teast = map[eh][ew].to_i\n\t\tif east < low\n\t\t\tlow = east\n\t\t\tlh = eh\n\t\t\tlw = ew\n\t\tend\n\tend\n\n\tif h + 1 < map.size\n\t\tsh = h + 1\n\t\tsw = w\n\t\tsouth = map[sh][sw].to_i\n\t\tif south < low\n\t\t\tlow = south\n\t\t\tlh = sh\n\t\t\tlw = sw\n\t\tend\n\tend\n\n\treturn lh, lw\nend",
"def find_path(start_node, end_node, grid)\n start_node = sanitize(start_node)\n end_node = sanitize(end_node)\n if grid.nil?\n [start_node]\n else\n _max_x = grid.max_x\n _max_y = grid.max_y\n\n @current_grid = grid.inner_grid.clone\n\n raise 'max_x & max_y required' unless _max_x && _max_y\n\n _start_node = start_node.clone\n _end_node = end_node.clone\n\n heuristic = @heuristic.new(_end_node, @weight)\n\n _start_node[:f] = 0 # sum of g and h\n _start_node[:g] = 0 # steps to start node\n _start_node[:h] = nil # steps to end node\n _start_node[:opened] = true\n\n # use heap or tree for better perf\n open = []\n open.push _start_node\n\n while !open.empty? do\n _current_node = open.pop\n\n _current_node[:closed] = true\n @current_grid[node_to_a(_current_node)] = _current_node\n\n if node_to_a(_current_node) == node_to_a(_end_node)\n return final_path(_current_node)\n end\n\n new_g = _current_node[:g] + 1\n\n x = _current_node[:x]\n y = _current_node[:y]\n\n neighbors = []\n\n neighbors << [x-1, y] if x > 0\n neighbors << [x, y-1] if y > 0\n neighbors << [x+1, y] if x < _max_x-1\n neighbors << [x, y+1] if y < _max_y-1\n\n _neighbors = neighbors.map do |position|\n node = @current_grid[position]\n if node.nil? || node[:walkable]\n node ||= {}\n @current_grid[position] = node.merge({\n x: position.first,\n y: position[1],\n closed: false,\n opened: false\n })\n end\n end.compact\n\n _neighbors.each do |neighbor|\n if (!neighbor[:opened] || new_g < neighbor[:g])\n neighbor[:g] = new_g\n neighbor[:h] ||= heuristic.h(neighbor)\n neighbor[:f] = neighbor[:g] + neighbor[:h]\n neighbor[:parent] = node_to_a(_current_node)\n\n if (!neighbor[:opened])\n open.push neighbor\n neighbor[:opened] = true\n else\n # ???\n puts \"got here some how!!!\"\n end\n end\n end\n\n open.sort_by! {|i| [-i[:f], -i[:h]]}\n # grid_p\n end\n end\n end",
"def find_path()\n visited = Array.new(8) {Array.new(8)}\n return [] if @destination == @currentPosition\n paths = [[@currentPosition]]\n visited[@currentPosition[0]][@currentPosition[1]] = true\n\n until paths.empty?\n new_paths = []\n paths.each do |path|\n next_positions = possibleMoves(path.last, visited)\n next_positions.each do |move|\n newpath = path.dup << move\n if move == @destination #if we reached our destination stop and return the path\n return newpath\n end\n visited[move[0]][move[1]] = true\n new_paths.push(newpath)\n end\n end\n paths = new_paths\n end\n end",
"def trace_path(direction)\n result = []\n current_position = position\n while valid_position?(current_position)\n current_position = current_position.zip(direction).map(&:sum)\n break if valid_position?(current_position)\n\n result << current_position\n \n break unless board.empty?(current_position)\n end\n result\n end",
"def traverse_spiral(matrix)\n l = 0\n r = matrix[0].length - 1\n b = matrix.length - 1\n t = 0\n dir = 0\n\n # loop until top bound equals bottom bounds and left bounds equals right\n while (t <= b && l <= r)\n\n if dir == 0\n (l..r).each{ |left_index| puts matrix[t][left_index] }\n t += 1\n end\n\n if dir == 1\n (t..b).each{ |top_col_ind| puts matrix[top_col_ind][r] }\n r -= 1\n end\n\n if dir == 2\n (r).downto(l) { |right_index| puts matrix[b][right_index] }\n b -= 1\n end\n\n if dir == 3\n (b).downto(t) { |bot_col_index| puts matrix[bot_col_index][l] }\n l += 1\n end\n\n dir = (dir + 1) % 4\n end\nend",
"def next_direction #:nodoc:\n loop do\n direction = @tries.pop\n nx, ny = @maze.move(@x, @y, direction)\n\n if @maze.valid?(nx, ny) && (@maze[@x, @y] & (direction | (direction << Maze::UNDER_SHIFT)) == 0)\n if @maze[nx, ny] == 0\n return direction\n elsif !@maze.dead?(@maze[nx, ny]) && @maze.weave > 0 && rand(100) < @maze.weave\n # see if we can weave over/under the cell at (nx,ny)\n return direction if @maze.weave_allowed?(@x, @y, nx, ny, direction)\n end\n end\n\n while @tries.empty?\n if @stack.empty?\n @pending = false\n return nil\n else\n @x, @y, @tries = @stack.pop\n end\n end\n end\n end",
"def ways_traverse_brute(map)\n visited = Array.new(map.length) { Array.new(map[0].length, false) }\n saved = Array.new(map.length) { Array.new(map[0].length, 0) }\n\n visited[0][0] = true\n ways_traverse_brute_rec(0, 0, visited, map)\nend",
"def pathfinder(maze, counter=0, unexplored_territory=true, starting_cell=[])\n\n # This while loop goes over the maze once, looking for a 'F' in a cell (maze[row][col]), and adding 0 to ENWS if possible\n while counter==0\n maze.each_with_index do |array, row|\n array.each_with_index do |cell, col|\n if cell == 'F' # Looking for the first starter cell\n [[0,1],[-1,0],[0,-1],[1,0]].each do |mod|# east, north, west, south checked one at a time\n maze[row+mod[0]][col+mod[1]] = counter if maze[row+mod[0]][col+mod[1]] == ' '\n end\n end\n end\n end\n counter+=1\n end\n\n print_maze(maze).inspect if $debug\n no_solution = false\n\n\n # This while loop goes through and looks for either blank spaces adjacent to numbers, or 'S' in a cell.\n while unexplored_territory\n dig_dug = true\n maze.each_with_index do |array, row|\n array.each_with_index do |cell, col|\n if cell == (counter-1) # mapping out the maze, one by one\n [[0,1],[-1,0],[0,-1],[1,0]].each do |mod|# east, north, west, south checked one at a time\n if maze[row+mod[0]][col+mod[1]] == 'S'\n unexplored_territory, starting_cell, dig_dug = false, [row, col], false\n elsif maze[row+mod[0]][col+mod[1]] == ' '\n maze[row+mod[0]][col+mod[1]], dig_dug = counter, false\n end\n end\n end\n end\n end\n unexplored_territory, no_solution = false, true if dig_dug # check for progress, no solutions found if true\n counter+=1\n if $debug\n system('clear') or system('cls')\n print_maze(maze)\n sleep(1.0/4.0) if $slow\n end\n end\n\n counter = counter - 3 # Getting the counter ready for reverse mapping\n return [['No Solution']] if no_solution # 5.\tIF there is no solution, then print an appropriate message and re-display the menu\n unless no_solution\n\n\n # This while loop goes and looks for the route back following descending numbers.\n while counter >= 0\n maze[starting_cell[0]][starting_cell[1]] = '*'\n [[0,1],[-1,0],[0,-1],[1,0]].each do |mod|# east, north, west, south checked one at a time\n if maze[starting_cell[0]+mod[0]][starting_cell[1]+mod[1]].is_a?(Integer) && maze[starting_cell[0]+mod[0]][starting_cell[1]+mod[1]] == counter\n starting_cell = [starting_cell[0]+mod[0],starting_cell[1]+mod[1]]\n end\n end\n counter -= 1\n end\n\n maze[starting_cell[0]][starting_cell[1]] = '*' # Sets the last cell to *\n\n\n # This set of loops goes through and clears out integers from the maze\n maze.each_with_index do |row, r|\n row.each_with_index do |col, c|\n if col.is_a?(Integer)\n maze[r][c] = ' '\n end\n end\n end\n\n # Return the finished product\n maze\n end\nend",
"def solve\n @second > @first ? right_hand_solve : left_hand_solve\n if @path.length > 10\n \"#{@path[0..3]}, ... #{@path[-3..-1]} steps: #{@path.length}\"\n else\n @path\n end\n end",
"def find_bottom_path(cell)\n find_path(cell) { | cell | bottom_cell(cell) }\n end",
"def get_path(node, root)\r\n path = []\r\n until path.last == root.current_case\r\n path << node.current_case\r\n node = node.parent\r\n end\r\n\r\n puts \"You made it in #{path.size - 1} moves! Here's your path:\"\r\n path.reverse.each { |c| puts c.inspect }\r\n end",
"def trace_path_back(end_pos)\n last_node = self.find_path(end_pos)\n return \"we can't find the end pos\" if last_node == nil\n path_arr = [last_node.pos]\n\n until last_node.parent == nil\n path_arr << last_node.parent.pos\n last_node = last_node.parent\n end\n\n path_arr.reverse\n end",
"def right_hand_solve\n until @buckets[1] == @target\n fill_right\n until @buckets[1].zero?\n right_to_left\n break if @buckets.include?(@target)\n empty_left\n break if @buckets.include?(@target)\n right_to_left\n break if @buckets.include?(@target)\n end\n end\n end",
"def find_right_path(cell)\n find_path(cell) { | cell | right_cell(cell) }\n end",
"def solve(args)\n @seen_stack, @need_to_check, solved = [], [], false\n current_cell, finish = map[args[:begX]][args[:begY]], map[args[:endX]][args[:endY]]\n @seen_stack.push(current_cell)\n @need_to_check.push(current_cell)\n\n until @need_to_check.empty? || solved\n current_cell = @need_to_check.shift\n @seen_stack.push(current_cell)\n check_possible_paths(current_cell, finish)\n solved = true if current_cell == finish\n end\n solved\n end",
"def find_path(x, y, path = [])\n if x.zero? && y.zero?\n @results << path\n return 1\n elsif x < 0 || y < 0\n return 0\n elsif @grid[x][y] == 1\n return 0\n end\n\n new_path = path.dup\n new_path.insert(0, [y, x])\n\n @cache[[x - 1 , y]] ||= find_path(x - 1, y, new_path)\n @cache[[x, y - 1]] ||= find_path(x, y - 1, new_path)\n end",
"def path_finder(start_node=START_NODE, goal_node=GOAL_NODE)\n\t\n\t# INITIALIZE\n\tvalid = valid_nodes # largest set\n\treachable = [start_node] # nodes we can reach from current node\n\texplored = [] # nodes we've already considered\n\t# nodes reachable, valid, and not explored\n\topen_nodes = valid.select{|node| reachable.include?(node)}.select{|node| !explored.include?(node)} \n\t# record node path {node => previous_node}\n\tnodes_path = {start_node => nil} \n\t\n\twhile !open_nodes.empty?\n # node = choose_node(reachable)\n\t\tnode = open_nodes.sample # random node in open_nodes\n\t\t\n\t\treturn build_path(goal_node, nodes_path) if node==goal_node # STOP if reached goal! \n \n # Don't repeat ourselves.\n reachable.delete(node) # remove current node from reachable\n explored.push(node) # add node to explored\n \n # What nodes are now open from this node?\n # Adjacent, not in explored, and valid (not an obstacle and in maze)\n new_reachable = (get_adjacent_nodes(node) - explored) & valid\n\t\t# ADD new nodes to reachable\n new_reachable.each do |adj_node|\n if !reachable.include?(adj_node)\n # adjacent.previous = node # Remember how we got there.\n nodes_path[adj_node] = node # {[0,3] => [0,2]}\n reachable << adj_node\n end\n end\n \n\t\t# REFRESH OPEN NODES\n open_nodes = valid.select{|node| reachable.include?(node)}.select{|node| !explored.include?(node)} \n \n end\n \n\treturn nil # open_nodes empty - no path found\nend",
"def backtrack!(nodes)\n while true\n return nil if nodes.empty? # backtracked back to 0, so we are done\n \n # We tried nodes.last and it didn't work, so\n # pop it off and uncover the corresponding columns.\n node = nodes.pop\n node.unchoose_except_self_column\n \n # Try the next node in this column.\n x = node.down\n\n return x unless x.is_a? Column\n \n # Our downwards iteration has gone full-circle\n # back to the column object where it started.\n x.uncover # Uncover the column.\n end\n end",
"def solve( start, finish )\n return [start] if start == finish\n \n seen = {start => true}\n paths = [[start]]\n \n until paths.first.last == finish\n path = paths.shift\n \n new_paths = [path.dup << path.last * 2, path.dup << path.last + 2]\n new_paths << (path.dup << path.last / 2) if path.last.even?\n \n new_paths.each do |new_path|\n unless seen[new_path.last]\n paths << new_path\n seen[new_path.last] = true\n end\n end\n end\n \n paths.shift\nend",
"def move_right(beginning)\n\t\tbeg = beginning\n\t\tpath = []\t\n\t\tbeg[1].upto(7) do |x|\n\t\t\tpath << beg\n\t\t\tbeg = [(beg[0]), (beg[1] + 1)]\n\t\tend\n\t\tpath\n\tend",
"def move_path\n\t\t## Find current or next cell\n\t\t#cell = find_cell by: :pos, x: @x, y: @y, return_on_found: true\n\t\tcell = find_closest_cell by: :pos, x: @x, y: @y unless (@path.nil?)\n\t\tif (cell.nil? || @path.nil?)\n\t\t\tdecr_vel [:x,:y]\n\t\t\treturn\n\t\tend\n\n\t\t## Move towards point\n\t\tvels = []\n\t\t# Move up\n\t\tif (cell.pos(:y) < @y)\n\t\t\tvels << :up\n\n\t\t# Move down\n\t\telsif (cell.pos(:y) > @y)\n\t\t\tvels << :down\n\t\tend\n\n\t\t# Move left\n\t\tif (cell.pos(:x) < @x)\n\t\t\tvels << :left\n\n\t\t# Move right\n\t\telsif (cell.pos(:x) > @x)\n\t\t\tvels << :right\n\t\tend\n\n\t\tincr_vel vels\n\t\t@path.delete cell if (((@x-8)..(@x+8)).include?(cell.pos(:x)) && ((@y-8)..(@y+8)).include?(cell.pos(:y)))\n\tend",
"def path_search(x, y, direction, bit_board, traversed = visited_board)\n return false if out_of_bounds?(x,y) || traversed[x][y]\n\n piece_value = bit_board[x][y]\n return false if piece_value == 0 # Non-road piece\n return true if road_end?(direction, x, y)\n\n traversed[x][y] = true\n\n # Recurse in all four directions. While this may retrace steps it is\n # necessary as roads in Tak can curve wildly.\n path_search(x + 1, y, direction, bit_board, traversed) ||\n path_search(x - 1, y, direction, bit_board, traversed) ||\n path_search(x, y + 1, direction, bit_board, traversed) ||\n path_search(x, y - 1, direction, bit_board, traversed)\n end",
"def last_exercise_minimal_path_correctly_done \n pos = ((self.user_sequence.size() - 1)/STEP_SIZE)*STEP_SIZE #ultimo multiplo de STEP_SIZE\n if self.user_sequence[self.user_sequence.size() - 1][3]\n return self.user_sequence[self.user_sequence.size() - 1][0] # the last one\n else\n pos = ((self.user_sequence.size() - 1)/STEP_SIZE)*STEP_SIZE\n while pos >= 0 && !self.user_sequence[pos][3] do\n pos = pos - STEP_SIZE\n end\n if pos >= 0\n return self.user_sequence[pos][0]\n else\n return nil\n end\n end\n end",
"def explore_downwards(node)\n node = node.left until node.left.nil?\n node.data\nend",
"def find_end_of_node_path(i)\n left_index = left_child_index(i)\n right_index = right_child_index(i)\n \n if left_index > @heap_size && right_index > @heap_size\n i\n elsif right_index > @heap_size\n left_index\n else\n max_child_index = -1\n left_child_value = self[left_index - 1]\n right_child_value = self[right_index - 1]\n if right_child_value && left_child_value > right_child_value\n max_child_index = left_index\n else\n max_child_index = right_index\n end\n find_end_of_node_path max_child_index\n end\n end",
"def knight_moves(start, finish)\n tree = MoveTree.new(start)\n queue = [tree]\n result = nil\n visited_points = Set.new()\n while queue.length > 0\n current_node = queue.shift\n visited_points.add(current_node.point)\n if current_node.point == finish\n result = get_path(current_node)\n break\n else\n propagate_tree(current_node)\n queue += current_node.children.reject { |n| visited_points.include?(n.point) }\n end\n end\n result\nend",
"def astar(maze, start, last)\n\n #Cria node inicial\n start_node = Node.new(parent = nil, position = start)\n\n start_node.g = 0\n start_node.h = 0\n start_node.f = 0\n\n #Cria node final\n end_node = Node.new(parent =nil, position =last)\n\n end_node.g = 0\n end_node.h = 0\n end_node.f = 0\n\n #Inicializa lista de nodes visitados\n open_list = []\n\n #inicializa lista closed\n closed_list = []\n\n # Adiciona o node inicial na open list\n open_list.push(start_node)\n\n #Loop enquando nao encontra no final\n while open_list.length > 0\n\n #Pega node sendo analizado no momento, tem que ser o node com o menor f\n current_node = open_list[0]\n current_index = 0\n\n open_list.each_with_index do |item, index|\n if item.f < current_node.f\n current_node = item\n current_index = index\n end\n end\n\n #Retira node analizado no momento da open list\n open_list.delete_at(current_index)\n #Retira node analizado no momento da closed list\n closed_list.push(current_node)\n\n #Verifica se encontrou o no final\n if current_node.position == end_node.position\n path = []\n current = current_node\n\n while current != nil\n path.push(current.position)\n current = current.parent\n end\n\n return path.reverse\n\n end\n\n #Gera os vizinhos do node atual\n children = []\n\n [[0, -1], [0, 1], [-1, 0], [1, 0]].each { |new_position|\n #percorre uma coluna OU uma linha por vez\n node_position = [current_node.position[0] + new_position[0], current_node.position[1] + new_position[1]]\n\n #verifica se o vizinho nao ultrapassa a borda da matriz\n if node_position[0] > (maze.length - 1) || node_position[0] < 0 || node_position[1] > (maze[maze.length - 1].length - 1) || node_position[1] < 0\n next\n end\n\n #verifica se o vizinho se encontra na rua\n if maze[node_position[0]][node_position[1]] != 0\n next\n end\n\n\n new_node = Node.new(current_node, node_position)\n children.push(new_node)\n\n }\n\n #Loop entre os vizinhos\n children.each { |child|\n #Verifica se o vizinho esta na closed list\n closed_list.each { |closed_child|\n if child.position == closed_child.position\n next\n end\n }\n\n #Cria os valores f, g e h para a funcao f = g + h, sendo h a heuristica\n child.g = current_node.g + 1\n child.h = ((child.position[0] - end_node.position[0]) ** 2) + ((child.position[1] - end_node.position[1]) ** 2)\n child.f = child.g + child.h\n\n #Se o vizinho ja esta na open list\n open_list.each { |open_node|\n if child.position == open_node.position && child.g > open_node.g\n next\n end\n }\n\n #Adiciona o vizinho na open list\n open_list.push(child)\n }\n\n end\n\nend",
"def calculate_route\n\t\t@cl = init_loc\n\t\t@steps << cl\n\n\t\twhile not at_rightmost_side?\n\t\t\t@cl = next_step\n\t\t\t@steps << cl\n\t\tend \t\t\n\tend",
"def get_to_the_end two_d_array\n index1 = 0\n index2 = 0\n position = [0, 0]\n\n return nil if position == 1\n return nil if two_d_array.last.pop == 1\n \n # check right\n if two_d_array[index1][index2 + 1] == 0\n index2 += 1\n position = [index1, index2]\n # check down\n elsif two_d_array[index1 + 1][index2] == 0\n index1 += 1\n position = [index1, index2]\n end\n \nend",
"def unique_paths_iterative(m, n)\n return 0 if m == 0 || n == 0\n\n grid = Array.new(m) { Array.new(n) {0} }\n grid[0][0] = 1\n\n row = 0\n column = 0\n\n while row < m\n while column < n\n # check top\n if row > 0\n grid[row][column] += grid[row - 1][column]\n end\n # check left\n if column > 0\n grid[row][column] += grid[row][column - 1]\n end\n\n column += 1\n end\n column = 0\n row += 1\n end\n\n grid[row - 1][column - 1]\nend",
"def knights_moves(start, finish)\n board = create_board\n\n path = []\n queue = []\n\n queue << start\n\n loop do\n \tcurrent_node = board[queue[0][0]][queue[0][1]]\n\n current_node.moves.each do |node|\n unless node == start || board[node[0]][node[1]].parent != nil\n board[node[0]][node[1]].parent = queue[0] \n queue << node\n end\t\n end\n\n if queue.include? finish\n\n parent = board[finish[0]][finish[1]].parent\n path << parent\n\n loop do\n \tparent = board[parent[0]][parent[1]].parent\n \tbreak if parent == nil\n \tpath.unshift(parent)\n end\n\n path << finish\n break\n end\n\n \tqueue.shift\n end\n puts \"You can make it in #{path.length-1} steps!\"\n path\nend",
"def find_path(positions, start, finish)\n # Will hold MoveTiles that form a path from start to finish\n path = [finish]\n # Get finish tile first so that we can work backwards in making the path\n chosen = finish\n movetile = chosen\n # Endless loop ZOMG\n while true\n t_x, t_y = movetile.x, movetile.y\n # Generate list of tiles surrounding this tile\n surrounding = []\n surrounding.push(positions[t_x][t_y+1]) if valid?(t_x, t_y+1)\n surrounding.push(positions[t_x][t_y-1]) if valid?(t_x, t_y-1)\n surrounding.push(positions[t_x+1][t_y]) if valid?(t_x+1, t_y)\n surrounding.push(positions[t_x-1][t_y]) if valid?(t_x-1, t_y)\n \n surrounding.compact!\n surrounding.delete(0)\n consider = []\n lowest_cost = 99\n # Evaluate surrounding tiles to find lowest cost\n surrounding.each{|tile|\n # If tile has a total move cost that is at least equal to the current best\n if tile.total_cost <= lowest_cost\n # If even lower, remove previous considerations and set new best\n if tile.total_cost < lowest_cost\n consider.clear\n lowest_cost = tile.total_cost\n end\n # Add this tile to be considered\n consider.push(tile)\n end\n }\n # Choose a tile from list\n chosen = consider[rand(consider.size)]\n # Return path if that last tile was the final one\n return path.reverse! if [chosen.x, chosen.y] == [start.x, start.y]\n # Add chosen tile to path\n path.push(chosen)\n # Evaluate this tile next\n movetile = chosen\n end\n end",
"def find_path(positions, start, finish)\n # Will hold MoveTiles that form a path from start to finish\n path = [finish]\n # Get finish tile first so that we can work backwards in making the path\n chosen = finish\n movetile = chosen\n # Endless loop ZOMG\n while true\n t_x, t_y = movetile.x, movetile.y\n # Generate list of tiles surrounding this tile\n surrounding = []\n surrounding.push(positions[t_x][t_y+1]) if valid?(t_x, t_y+1)\n surrounding.push(positions[t_x][t_y-1]) if valid?(t_x, t_y-1)\n surrounding.push(positions[t_x+1][t_y]) if valid?(t_x+1, t_y)\n surrounding.push(positions[t_x-1][t_y]) if valid?(t_x-1, t_y)\n \n surrounding.compact!\n surrounding.delete(0)\n consider = []\n lowest_cost = 99\n # Evaluate surrounding tiles to find lowest cost\n surrounding.each{|tile|\n # If tile has a total move cost that is at least equal to the current best\n if tile.total_cost <= lowest_cost\n # If even lower, remove previous considerations and set new best\n if tile.total_cost < lowest_cost\n consider.clear\n lowest_cost = tile.total_cost\n end\n # Add this tile to be considered\n consider.push(tile)\n end\n }\n # Choose a tile from list\n chosen = consider[rand(consider.size)]\n # Return path if that last tile was the final one\n return path.reverse! if [chosen.x, chosen.y] == [start.x, start.y]\n # Add chosen tile to path\n path.push(chosen)\n # Evaluate this tile next\n movetile = chosen\n end\n end",
"def find_path(end_pos)\n end_node = self.root_node.dfs(end_pos)\n final_arr = trace_back(end_node).map{ |el| el.value }\n final_arr.reverse\n end",
"def traverse room, direction\n case direction.to_sym\n when :right\n return @graph[room.coords[:y]][room.coords[:x] + 1] unless room.is_right?\n when :left\n return @graph[room.coords[:y]][room.coords[:x] - 1] unless room.is_left?\n when :up\n return @graph[room.coords[:y] - 1][room.coords[:x]] unless room.is_top?\n when :down\n return @graph[room.coords[:y] + 1][room.coords[:x]] unless room.is_bottom?\n end\n\n return false\n end",
"def seek_from_node(starting_node)\n puts \"seek started from node #{starting_node.inspect}...\"\n \n # -- PART I -- (starting from one node for now...) \n visited_nodes = grow_basic_path([ starting_node ])\n \n puts \"got basic path of length #{visited_nodes.length}, moving on to IIa)...\"\n \n # -- PART II a) --\n if visited_nodes.length < nodes.length\n target_nodes = extract_target_nodes_from_path(visited_nodes)\n \n while target_nodes.length > 0\n puts \"TNL: #{target_nodes.length}\"\n visited_nodes = restructure_path(visited_nodes, target_nodes)\n target_nodes = extract_target_nodes_from_path(visited_nodes)\n end\n end\n \n puts \"...done, moving on to IIb)...\"\n \n # -- PART II b) --\n if visited_nodes.length < nodes.length\n visited_nodes = trim_and_extend_path(visited_nodes)\n end\n \n puts \"...done, moving on to IIc)...\"\n \n # -- PART II c) --\n if visited_nodes.length < nodes.length\n visited_nodes = trim_and_extend_path(visited_nodes.reverse)\n end\n \n # -- PART III --\n results = {}\n \n if visited_nodes.length < nodes.length \n results[:path] = visited_nodes\n else\n results[:tour] = visited_nodes\n \n cycle_starts = connected_to(visited_nodes.first).map do |node|\n visited_nodes[visited_nodes.index(node) - 1]\n end\n cycle_ends = connected_to(visited_nodes.last)\n \n (cycle_starts & cycle_ends).each do |node|\n index = visited_nodes.index(node)\n \n circuit = visited_nodes[0..index] + [ visited_nodes.last ]\n circuit += visited_nodes[(index + 1 - visited_nodes.length)..-2].reverse\n \n results[:cycles] ||= []\n results[:cycles] << circuit\n end\n end\n \n results\n end",
"def solve_visit_cell\n # Get the next path.\n path = @queue.shift\n # The cell to visit is the last entry in the path.\n x, y = path.last\n \n # Have we reached the end yet?\n return path if x == @end_x && y == @end_y\n \n # Mark cell as visited.\n @visited[x][y] = true\n \n for dx, dy in DIRECTIONS\n if dx.nonzero?\n # Left / Right\n new_x = x + dx\n if move_valid?(new_x, y) && !@vertical_walls[ [x, new_x].min ][y]\n enqueue_cell(path, new_x, y)\n end\n else\n # Top / Bottom\n new_y = y + dy\n if move_valid?(x, new_y) && !@horizontal_walls[x][ [y, new_y].min ]\n enqueue_cell(path, x, new_y)\n end\n end\n end\n puts \"QUEUE #{@queue}\"\n nil # No solution yet.\n end",
"def path(start, goals, mode=:move_to, ignore={})\n start = start.map(&:to_i)\n goals = goals.flatten.size == 3 ? [goals.flatten] : goals\n\n if goals.reject { |goal| (start[0] - goal[0]).abs + (start[1] - goal[1]).abs + (start[2] - goal[2]).abs > MAX_PATH_SIZE }.empty?\n puts \"target too far away\"\n return nil\n elsif mode == :move_to && goals.select { |g| allowed?(*g) }.empty?\n puts \"can't go there...\"\n return nil\n # elsif mode == :next_to && goals.map { |g| available(*g, :next_to).any? { |l| allowed?(*l) } }.empty?\n # puts \"nothing to move next to anymore...\"\n # return nil\n end\n visited = {}\n next_to = {}\n examined = 0\n\n heap = Heap.new { |a, b| a.cost <=> b.cost }\n heap.add Path.new(start, goals, [])\n\n while !heap.empty?\n point = heap.next\n\n if point.path.size > MAX_PATH_SIZE\n puts \"examined #{examined} paths before giving up\"\n return nil\n end\n\n next if visited[point.point]\n visited[point.point] = point\n\n examined += 1\n\n case mode\n when :move_to\n if goals.include?(point.point)\n final_path = point.path + [point.point]\n final_path.shift # don't need the start point, we're already there\n # puts \"examined #{examined} paths\"\n return final_path\n end\n\n when :away_from\n above = point.point.dup\n above[1] += 1\n if !goals.include?(point.point) && !goals.include?(above)\n final_path = point.path + [point.point]\n return final_path\n end\n\n when :next_to\n next_to[point.point] ||= available(*point.point, :build)\n available_for_building = next_to[point.point]\n if available_for_building.any? { |a| goals.include? a }\n final_path = point.path + [point.point]\n final_path.shift # don't need the start point, we're already there\n # puts \"examined #{examined} paths\"\n return final_path\n end\n\n else\n raise \"unknown pathfinding mode: #{mode.inspect}\"\n end\n\n next_available = available(*point.point, :move, ignore).each do |test|\n next if visited[test]\n heap.add Path.new(test, goals, point.path + [point.point])\n end\n end\n nil\n end",
"def find_path(end_pos)\n # self.dfs(target)\n end_node = root_node.bfs(end_pos)\n trace_path_back(end_node).map { |node| node.value }.reverse!\n end",
"def ROOK_long_path(position, target)\n now = getposition(position)\n moves = ['move_down', 'move_up', 'move_right', 'move_left']\n\n steps = 0\n long_position = ''\n for i in moves do\n path = inpath(position, i)\n # print path\n long_tile = path_len_tile(path, target)\n # print long_tile\n if long_tile.any? && long_tile[1] > steps\n steps = long_tile[1]\n long_position = long_tile[0]\n end\n end\n return [long_position, steps + 1]\n # print ROOK_long_path('h5')\n end",
"def unique_paths_recursive(m, n, store = {})\n return store[[m, n]] if store[[m, n]]\n\n if m == 1 && n == 1\n store[[m, n]] = 1\n return 1\n end\n\n above = m > 1 ? unique_paths_recursive(m - 1, n, store) : 0\n left = n > 1 ? unique_paths_recursive(m, n - 1, store) : 0\n\n store[[m - 1, n]] = above\n store[[m, n - 1]] = left\n total = above + left\nend",
"def dfs_rec(target,current,array_length,stack,visited)\n left = current.find_left_child[0]\n right = current.find_right_child[0]\n parent = current.find_parent[0]\n if current.value == target\n return current\n elsif visited.length == array_length\n return nil\n elsif !left.nil? && !visited.include?(left)\n stack.push(left)\n visited.push(left)\n dfs_rec(target,left,array_length,stack,visited)\n elsif !right.nil? && !visited.include?(right)\n stack.push(right)\n visited.push(right)\n dfs_rec(target,right,array_length,stack,visited)\n else\n stack.pop\n dfs_rec(target,parent,array_length,stack,visited)\n end\nend",
"def calculate_backward_path_tree(parent_Tnode, from_node, root_node)\n \tcur_Tnode = TreeNode.new(from_node)\n\tparent_Tnode.addChildren(cur_Tnode)\n\t$path_tracker.push(cur_Tnode)\n from_node.getBackwardEdges.each do |e|\n\t\tif e.getFromNode != nil\n\t\t\tif $path_tracker.include?(e.getFromNode)\n\t\t\telse\n\t\t\t\tif root_node.getIndex > e.getFromNode.getIndex\n\t\t\t\t\tcalculate_backward_path_tree(cur_Tnode, e.getFromNode, root_node)\n\t\t\t\tend\n\t\t\tend\n\t\telsif e.getFromNode == nil\n\t\t\t#do nothing\n\t\tend\n\tend\n\t$path_tracker.pop\nend",
"def right_side_view(root)\n return [] unless root\n queue = [[root, 0]]\n results_arr = []\n\n until queue.empty?\n current_node, current_depth = queue.shift\n queue.push([current_node.left, current_depth + 1]) if current_node.left\n queue.push([current_node.right, current_depth + 1]) if current_node.right\n\n # if queue.empty?\n # results_arr.push(current_node.val)\n # elsif queue[0][1] != current_depth\n # results_arr.push(current_node.val)\n # end\n results_arr[current_depth] = current_node.val\n end\n results_arr\nend",
"def find_path(end_pos)\n end_node = root_node.dfs(end_pos)\n trace_path_back(end_node)\n .reverse\n .map(&:value)\n end",
"def esxlRecurse i, j\n esxlStraightRecurse(i, j) + esxlDiagonalRecurse(i, j)\nend",
"def build_path(start, end_pos)\n node = Node.new(start[0], start[1])\n target = Node.new(end_pos[0], end_pos[1])\n visited_nodes = []\n next_moves = [node]\n until next_moves.empty? do\n node = next_moves.shift\n puts \"Current node: #{node.x}, #{node.y}\"\n if node.x == target.x && node.y == target.y \n return node\n end\n visited_nodes.push(node)\n node.moves = get_moves(node)\n node.moves.reject do |square|\n visited_nodes.include?(square)\n end\n node.moves.each do |move| \n next_moves.push(move)\n end\n end\n return node\nend",
"def walk_maze(the_maze, floor, position, steps=Hamster.vector) \r\n if found_exit?(the_maze, floor, position)\r\n #When we have found an exit, we wrap the steps vector in another vector and return it.\r\n #This extra wrapping will ensure that each path is in it's own vector when we do the concatenation below.\r\n return Hamster.vector.unshift(steps.push([floor, position]))\r\n end\r\n\r\n go_right(the_maze, floor, position, steps) + go_up(the_maze, floor, position, steps) +\r\n go_left(the_maze, floor, position, steps) + go_down(the_maze, floor, position, steps)\r\nend",
"def path(k)\n x = k\n y = 1 - k\n path = []\n direction = 1\n (k*8).times do |i|\n path.push(x.to_s + ';' + y.to_s)\n if direction == 1\n y += 1\n direction = 2 if y == k\n elsif direction == 2\n x -= 1\n direction = 3 if x * (-1) == k\n elsif direction == 3\n y -= 1\n direction = 4 if y * (-1) == k\n elsif direction == 4\n x += 1\n end\n end\n path\nend",
"def solve(begX, begY, endX, endY)\n\t\tstart = [begX, begY]\n\t\tstack = []\n\t\tmove_trace = []\n\t\t#checks to see if start or end have \"wall\" value\n\t\tif get_value(begX, begY) == 1 || get_value(endX, endY) == 1\n\t\t\tputs \"Invalid start or finish location\"\n\t\t\treturn false\n\t\tend\n\t\tstack.push(start)\n\t\tmove_trace.push(start)\n\t\twhile !stack.empty?\n\t\t\tcurrent = stack.pop()\n\t\t\tif current == [endX, endY]\n\t\t\t\tputs \"The maze is solved\"\n\t\t\t\tputs \"The cells you visited are: \"\n\t\t\t\treturn move_trace\n\t\t\tend\t\t\n\n\t\t\ttrace(current).each do |node|\n\t\t\t\tif !move_trace.include? node\n\t\t\t\t\tstack.push(node)\n\t\t\t\t\tmove_trace.push(node)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tputs \"Cannot be solved\"\n\t\treturn false\n\tend",
"def walk(grid, x, y)\n [N, S, E, W].shuffle.each do |dir|\n nx, ny = x + DX[dir], y + DY[dir]\n if nx >= 0 && ny >= 0 && ny < grid.length && nx < grid[ny].length && grid[ny][nx] == 0\n grid[y][x] |= dir\n grid[ny][nx] |= OPPOSITE[dir]\n \n return [nx, ny]\n end\n end\n \n nil\nend",
"def recurse_bottom_right_to_top_left(x1, y1, x2, y2)\n bottom_right_to_top_left x1, y1, x2, y2\n recurse_top_left_to_bottom_right x1 + 1, y1, x2, y2 - 1 if x2 - x1 > 0\n end",
"def path_to(goal)\n current = goal\n breadcrumbs = Distances.new(@root)\n breadcrumbs[current] = self[current]\n until current == @root\n puts @cells\n current.links.each do |neighbor|\n begin\n if self[neighbor] < self[current]\n breadcrumbs[neighbor] = self[neighbor]\n current = neighbor\n break\n end\n rescue => e\n binding.pry\n end\n end\n end\n breadcrumbs\n end",
"def find_breadth_traversal_tree(in_order,post_order,level, h)\n # level => 0F 0T 1F 1T etc\n if in_order.size == nil || in_order.size == 0\n puts \"finish\"\n elsif in_order.size == 1\n # finish\n yield(level, in_order[0])\n puts \"#{level} \\t #{in_order[0]}\"\n else \n # this is not finished yet\n max_index_in_post = 0\n max_index_in_in = 0\n in_order.each_with_index do |in_ele,in_index|\n post_index = post_order.index(in_ele)\n\n if post_index > max_index_in_post\n max_index_in_post = post_index\n max_index_in_in = in_index\n end\n\n end\n current_root = in_order[max_index_in_in]\n yield(level, current_root)\n puts \"#{level} \\t #{current_root}\"\n\n level[0] = (Integer(level[0])+1).to_s\n next_level_f = level+\"F\"\n next_level_t = level+\"T\"\n front_of_in = in_order[0...max_index_in_in]\n tail_of_in = in_order[(max_index_in_in+1)...in_order.size]\n \n #\n find_breadth_traversal_tree(front_of_in,post_order,next_level_f, h) {|level,ele| h[level] = ele}\n find_breadth_traversal_tree(tail_of_in,post_order,next_level_t, h) {|level,ele| h[level] = ele}\n\n #\n end # end of else\n\n\nend",
"def solve(begX, begY, endX, endY)\n #first create two points object as starting point and destination\n start = Point.new(begX,begY)\n @final = Point.new(endX,endY)\n #first initialize these objects in case that there are\n #data left after last iteration of solve\n @tnode = nil\n @traceSet = Set.new\n @traceArray = Array.new\n if start.isEqual(@final)\n @tnode = start\n true\n else\n @traceSet.add(start.to_S)\n @traceArray.push(start)\n\n #start sloving\n newp = @traceArray.shift\n #we don't stop until all the possible pathes are tested\n\n while newp != nil && @tnode == nil do\n #test each route and if we reach the destination, immediately break\n #the while loop\n\n #test if we can move upward\n move(2*newp.x+1,2*newp.y,newp.x,newp.y-1,newp)\n\n #test if we can move downward\n move(2*newp.x+1,2*newp.y+2,newp.x,newp.y+1,newp)\n\n #test if we can move leftward\n move(2*newp.x,2*newp.y+1,newp.x-1,newp.y,newp)\n\n #test if we can move rightward\n move(2*newp.x+2,2*newp.y+1,newp.x+1,newp.y,newp)\n\n #move to the next cell\n newp = @traceArray.shift\n end\n\n #if the current cell is nil, it means we have no solution for this maze puzzle\n if newp == nil\n false\n else #else return true\n true\n end\n end\n end",
"def trace_path_back(end_node)\n path = []\n\n current_node = end_node\n until current_node.nil?\n path << current_node\n current_node = current_node.parent\n end\n\n path\n end",
"def find_path(end_pos)\n end_node = root_node.dfs(end_pos)\n\n trace_path_back(end_node)\n .reverse\n .map(&:value)\n end",
"def navigate\n if @route.size == 0\n return [@phi, 0]\n elsif @route.size == 1\n return [@phi, 0]\n end\n\n facing, other = get_facing [@curr.n0, @curr.n1]\n if @mode == STRAIGHT_MODE\n # check if we should transition\n if facing.pos.dist(@pos) < ROAD_WIDTH\n @route.pop\n self.mode = TURN_MODE\n @turn_from_node = facing\n @turn_to_node = @route[-1]\n return turn_navigate\n else\n return straight_navigate\n end\n elsif @mode == TURN_MODE\n closest = @map.closest_node @pos\n \n # sometimes the current node fails to get removed from the\n # route, which leads to issues when we next get to TURN_MODE\n # and the old node hasn't yet been popped\n @route.delete closest\n \n if closest.pos.dist(@pos) > ROAD_WIDTH * 2\n self.mode = STRAIGHT_MODE\n return straight_navigate\n else\n return turn_navigate\n end\n elsif @mode == START_MODE\n if @start_node.pos.dist(@pos) > ROAD_WIDTH * 2\n self.mode = STRAIGHT_MODE\n @route.pop if @route[-1] == @start_node\n end\n return [@phi, 2]\n end\n end",
"def check_path_open (from, to, board)\n #refine\n\n #Check if diagonal\n if (to[1]-from[1]).abs == (to[0]-from[0]).abs\n iterations_y = (to[1]-from[1])\n iterations_x = (to[0]-from[0])\n\n if (iterations_x > 0) && (iterations_y > 0)\n iterations_x.times do |x|\n if !is_spot_open([from[0]+x,from[1]+x],board)\n return false\n end\n end\n\n elsif (iterations_x > 0) && (iterations_y < 0)\n iterations_x.times do |x|\n if !is_spot_open([from[0]+x,from[1]-x],board)\n return false\n end\n end\n\n elsif (iterations_x < 0) && (iterations_y > 0)\n iterations_x.times do |x|\n if !is_spot_open([from[0]-x,from[1]+x],board)\n return false\n end\n end\n\n elsif (iterations_x < 0) && (iterations_y < 0)\n iterations_x.times do |x|\n if !is_spot_open([from[0]-x,from[1]-x],board)\n return false\n end\n end\n end\n\n return true\n\n\n\n #check if it moves vertical\n elsif ((to[0]==from[0])&&(to[1]!=from[1]))\n\n iterations = (to[1]-from[1])\n if iterations > 0\n iterations.times do |x|\n if !is_spot_open([from[0],from[1]+x],board)\n return false\n end\n end\n elsif iterations < 0\n iterations.times do |x|\n if !is_spot_open([from[0],from[1]-x],board)\n return false\n end\n end\n end\n\n return true\n\n #check if it moves horizontal\n elsif ((to[1]==from[1])&&(to[0]!=from[0]))\n iterations = (to[0]-from[0])\n if iterations > 0\n iterations.times do |x|\n if !is_spot_open([from[0]+x,from[1]],board)\n return false\n end\n end\n elsif iterations < 0\n iterations.times do |x|\n if !is_spot_open([from[0]-x,from[1]],board)\n return false\n end\n end\n end\n\n return true\n\n end\n\n end",
"def traverse (from, to, points_visited_so_far = [])\n \n return points_visited_so_far if from.eql?(to)\n\n # Select those adjacent points that that has not been already traversed\n # and that do not represent walls\n possible_steps = adjacent_traversible_points(from).select { |point| \n (not points_visited_so_far.include?(point))\n }\n\n # For each possible step, take that step, and find out the list of points\n # that need to be traversed to reach \"to\" point. In case there were more\n # than one possible steps, pick the one that has smaller number of steps\n # to destination\n points_to_destination_from_here = []\n possible_steps.each do |point|\n traversal_result = traverse(point, to, points_visited_so_far + [point])\n if not traversal_result.empty?\n points_to_destination_from_here = traversal_result if \n (points_to_destination_from_here.empty? or\n traversal_result.size < points_to_destination_from_here.size)\n end\n end\n \n return points_to_destination_from_here\n\n end",
"def find_min_path(i, j)\n return 1 if i == 0 || j == 0\n return find_min_path(i-1, j) + find_min_path(i, j-1)\nend",
"def find_path(end_pos)\n node = root_node.dfs(end_pos)\n\n self.trace_path_back(node)\n end",
"def trips_dfs(start, finish, stops, visited, path, paths, cycles)\n adj_vertices(visited.last, adj_lists).each do |vertex|\n print \"Visited stack: #{visited}, Next vertex: #{vertex}\\n\"\n s = visited.size # stops, including added vertex\n\n if visited.last == finish && cycles != \"NO CYCLES EXIST\"\n\n # try adding cycles if we hit finish vertex too early\n\n visited_before_cycles = visited\n # picks expanded cycles that begin with finish vertex\n ec = expanded_cycles(cycles).select{|c| c.first == finish}\n\n # keep adding cycles till we reach stops\n ec.each do |cycle1|\n visited, paths, break_loop = try_cycles(visited, cycle1, paths, stops, 0)\n visited1 = visited\n\n ec.each do |cycle2|\n begin\n visited, paths, break_loop = try_cycles(visited, cycle2, paths, stops, 0)\n end until break_loop\n visited = visited1\n end\n\n visited = visited_before_cycles\n end\n\n elsif !visited.include?(vertex) && dist(visited.last, vertex) != \"NO SUCH ROUTE\" && s <= stops\n visited << vertex\n path = visited\n\n if vertex == finish && s == stops\n paths << path\n print \"\\n*** Path: #{path}, Stops: #{s}, Length: #{path_length(path)}\\n\\n\"\n visited.pop\n break\n end\n\n trips_dfs(start, finish, stops, visited, path, paths, cycles)\n visited.pop\n visited.pop if visited.size.between?(2, 3) && stops <= 1\n visited = [start] if visited == []\n end\n end\n paths.size\n end",
"def find_paths(grid_size)\n # array/list sums records the sum of paths in a grid of size sums[i+1]\n sums = [1] * 20\n for i in 0...grid_size\n for j in 0...i do\n sums[j] = (sums[j] + sums[j-1])\n end\n sums[i] = 2 * sums[i-1]\n end\n sums[grid_size - 1]\nend",
"def go_right(the_maze, floor, position, steps)\r\n if can_go_right?(the_maze, floor, position)\r\n the_maze = the_maze.set(floor, the_maze[floor].set(position, \"m\"))\r\n walk_maze(the_maze, floor, position + 1, steps.push([floor, position]))\r\n else\r\n return Hamster.vector\r\n end\r\nend",
"def traverse_road(next_field,vt=Set.new,solution)\n @visited_tiles = vt\n avail_pos = available_ways_to_go_to(next_field,solution).to_set - @visited_tiles\n\n @visited_tiles << next_field\n avail_pos.each do |nf|\n if ((solution[nf[0],nf[1]] == 0) && (!@visited_tiles.include? nf))\n # print_board create_solution_board @visited_tiles\n traverse_road(nf,@visited_tiles,solution)\n end\n end\n @visited_tiles\n end",
"def knight_moves(initial, final)\n @board.check_impossible_move(initial, final)\n\n search_queue = [Vertex.new(initial)]\n\n until search_queue.empty?\n test_vertex = search_queue.shift\n\n return show_path(make_path(test_vertex)) if test_vertex.value == final\n \n @board.possible_moves(test_vertex.value).each do |move|\n new_vertex = Vertex.new(move)\n new_vertex.parent = test_vertex\n test_vertex.children << move\n search_queue << new_vertex\n end \n\n end\n \"No path was found :(\"\n end",
"def right_to_left\n @buckets[0] = @buckets[0] + @buckets[1]\n @buckets[1] = if @buckets[0] > @first\n @buckets[0] - @first\n else\n @buckets[1] = 0\n end\n @buckets[0] = @first if @buckets[0] > @first\n @path.push([@buckets[0], @buckets[1]])\n end",
"def number_of_paths_to_end_from_point(start_point)\n \n tabs = \"\\t\" * ([start_point.x, start_point.y].max)\n puts \"#{tabs} (#{start_point.x}, #{start_point.y})\"\n \n # only 1 path to end from the edges\n return 1 if (start_point.y == 2 || start_point.x == 2)\n \n # last point\n return 0 if (start_point.x == 2 && start_point.y == 2)\n \n # otherwise, it's the sum of the paths that can be taken when adding the ones from right and the ones from below\n right_point = Point.new(start_point.x + 1, start_point.y)\n down_point = Point.new(start_point.x, start_point.y + 1)\n \n right = number_of_paths_to_end_from_point(right_point)\n down = number_of_paths_to_end_from_point(down_point)\n \n # puts \"From: (#{start_point.x}, #{start_point.y}) -> #{right + down} \"\n \n return right + down\nend",
"def construct_solution\n path = [@root]\n tabu_list = [@root]\n until @ends.include?(last = path.last)\n step = next_step last, tabu_list\n path << step\n end\n path\n end",
"def knight_path(from, to)\r\n\topen_queue = [PositionPath.new( from, [copy(from)] )]\r\n\tputs open_queue.inspect\r\n\tputs open_queue.empty?\r\n\tdiscovered = [from]\r\n\r\n\tuntil open_queue.empty?\r\n\t\tcurrent = open_queue.shift\r\n\t\tputs current.inspect\r\n\r\n\t\treturn current.path if current.position == to\r\n\t\tvalid_moves(current.position).each do |move|\r\n\t\t\tputs \"ruch #{move} jest ok\"\r\n\t\t\tunless discovered.include?(move)\r\n\t\t\t\tputs \"tego ruchu jeszce nie bylo = #{move}\"\r\n\t\t\t\tdiscovered << move\r\n\t\t\t\topen_queue.push(make_position_path(current, move)) \r\n\t\t\t\tputs \"open_queue = #{open_queue.size}\"\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\t\r\nend",
"def unique_paths(m, n, cache = {})\n return 0 if m < 0 || n < 0\n return 1 if m == 1 || n == 1\n\n result = (cache[[m - 1, n]] || unique_paths(m - 1, n, cache)) + (cache[[m, n - 1]] || unique_paths(m, n -1, cache))\n cache[[m, n]] = result\n result\nend",
"def find_path(end_pos)\n path = [@root_node]\n valid_moves = KnightPathFinder.valid_moves(@root_node)\n valid_moves.each do |move|\n @move_tree.add_child(move)\n end\n \n if @move_tree.bfs(end_pos) == end_pos\n path << end_pos\n else \n end\n\n end",
"def find_shortest_path(rolling_node)\n\n @backtrack = []\n @backtrack << @goal_node\n\n # iterate until we arrive at the start node\n while rolling_node[:prev] != nil do\n temp_node = @node_list.find { |hash| hash[:id] == rolling_node[:prev] }\n @backtrack << temp_node[:id]\n rolling_node = temp_node\n end\n\n # create a table with the 1d and the 2d array node values\n @shortest_path = []\n\n @backtrack.each do |p|\n @shortest_path << [p, @table_convert[p]]\n @shortest_path_coords << @table_convert[p][1]\n end\n end",
"def paths(arr, s, d)\n if invalid?(arr, s, d)\n return\n end\n\n if s == d\n $path_count = $path_count + 1\n return\n end\n\n cells = valid_cells(arr, s)\n cells.each do |cell|\n paths(arr, cell, d)\n end\nend",
"def paths(i,j)\n\t\t#decidir donde moverse\n \t\tpossible_path = []\n\t \tpath = false\n \t\t\n \t\t#arriba\n \t\tif i-1 > -1\n\t\t\tpath = can_move(i-1,j)\n \t\t\tif path == true\n \t\t\t\tpossible_path.push([i-1,j])\n \t\t\tend\n \t\tend\n \t\t#abajo\n\t\tif i+1 < @laberinto.column_count\n \t\t\tpath = can_move(i+1,j)\n\t\t\tif path == true\n\t\t\t\tpossible_path.push([i+1,j])\n\t\t\tend\n\t\tend \t\n\t\t#izquierda\n\t\tif j-1 > -1\n\t\t\tpath = can_move(i,j-1)\n \t\t\tif path == true\n \t\t\t\tpossible_path.push([i,j-1])\n \t\t\tend\n \t\tend \t\n \t\t#derecha\n\t \tif j+1 < @laberinto.column_count\n \t\t\tpath = can_move(i,j+1)\n \t\t\tif path == true\n \t\t\t\tpossible_path.push([i,j+1])\n\t \t\tend\n \t\tend \t\n\n \t\treturn possible_path\n\tend",
"def find_path(char)\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # use request\n request = @request[char]\n # if no nodes to test\n if request.open.size == 0\n # abort testing for this character\n @request.delete(char)\n # resets state\n char.ai.state = (char.ai.state == Invalid ? Return : Ready)\n # stop execution\n return []\n end\n # found\n found = false\n # find minimal key\n key = request.open.keys.min {|a, b|\n Math.hypot(a[0] - request.tx, a[1] - request.ty) <=>\n Math.hypot(b[0] - request.tx, b[1] - request.ty)}\n # this node is now logged as checked\n request.closed[key[0], key[1]] = request.open[key]\n # remove this node from the pending array\n request.open.delete(key)\n # iterate through all possible directions with relative offsets\n Cache::PathDirs.each {|dir|\n # coordinates of new position\n kx, ky = key[0] + dir[0], key[1] + dir[1]\n # if new coordinates are destination\n if kx == request.tx && ky == request.ty\n # the new node was checked\n request.closed[kx, ky] = dir[2]\n # path was found\n found = true\n # stop checking\n break\n # if new node not checked yet and coordinates are passable\n elsif request.closed[kx, ky] == 0 &&\n char.passable?(key[0] * pix, key[1] * pix, dir[2])\n # add new node to be checked\n request.open[[kx, ky]] = dir[2]\n end}\n # stop execution except if found path\n return nil unless found\n # backtrack the path\n result = request.backtrack\n # finish testing for this character\n @request.delete(char)\n # resets state\n char.ai.state = (char.ai.state == Invalid ? Return : Ready)\n # return movement command array\n return result\n end",
"def bfs(mansion)\n open_set = []\n solution_paths = []\n root = [0,0,mansion.passcode]\n open_set.push(root)\n\n until open_set.empty?\n subtree_root = open_set.shift\n room = subtree_root[0,2]\n code = subtree_root[2]\n hash = Digest::MD5.hexdigest(code)[0,4]\n mansion.rooms[room[0]][room[1]].set_doors(hash)\n if room == [3,3]\n solution_paths.push(code)\n next\n end\n\n directions = mansion.rooms[room[0]][room[1]].find_moves\n directions.each do |i|\n nextcode = code + i.to_s.upcase[0]\n nextroom = room.clone\n if i == :up\n nextroom[0] -= 1\n elsif i == :down\n nextroom[0] += 1\n elsif i == :left\n nextroom[1] -= 1\n elsif i == :right\n nextroom[1] += 1\n end\n open_set.push(nextroom + [nextcode])\n end\n end\n return solution_paths\nend",
"def next\r\n # if the path is empty attempt create the first path element \r\n if @path.empty?\r\n ords = get_data @base\r\n if ords.empty?\r\n # if the base ordering has no related orderings to traverse\r\n # return false \r\n return nil\r\n else\r\n #otherwise create the path element \r\n @path << IteratorPathElement.new(ords[0])\r\n return ords[0] \r\n end \r\n else\r\n # The path is not empty, we have to advance to the next element\r\n cur_elem = @path[-1]\r\n # We use the depth-first algorithm, check whether we can deepen first\r\n ords = get_data(cur_elem.cur_ordering)\r\n unless ords.empty?\r\n # deepen the path\r\n @path << IteratorPathElement.new(ords[0])\r\n return ords[0]\r\n else\r\n # move to next element\r\n \r\n # remove path elements which have enumerated already all their children \r\n until cur_elem.has_more?\r\n @path.pop\r\n if @path.empty?\r\n return nil\r\n end\r\n cur_elem = @path[-1]\r\n end\r\n \r\n #actually move to the next sibling element\r\n return cur_element.next\r\n end\r\n end\r\n end",
"def binary_serach_all_zero_row(top, bottom)\n mid_index = top + (bottom - top) / 2\n all_zeros = true\n\n if bottom < top\n bottom = top\n end\n\n if top > bottom\n top = bottom\n end\n\n if top == bottom\n mid_index = top\n end\n\n if @not_all_zero_row_index[mid_index]\n all_zeros = false\n else\n unless @all_zero_row_index[mid_index]\n lower, upper = get_optimized_col_bounds\n (lower..upper).each do |i|\n cell = @matrix[mid_index][i]\n\n if cell != 0\n all_zeros = false\n @not_all_zero_col_index[i] = true\n @not_all_zero_row_index[mid_index] = true\n @number_of_cell_visited += 1\n break\n end\n\n @number_of_cell_visited += 1\n end\n\n @all_zero_row_index[mid_index] = true\n end\n end\n\n if all_zeros\n return mid_index\n elsif top == bottom\n return nil\n else\n new_top = mid_index + 1\n new_bottom = bottom\n result = binary_serach_all_zero_row(new_top, new_bottom)\n return result if result\n\n new_top = top\n new_bottom = mid_index - 1\n return binary_serach_all_zero_row(new_top, new_bottom)\n end\n end"
] |
[
"0.6807247",
"0.65691304",
"0.65212065",
"0.64520216",
"0.64417267",
"0.6413669",
"0.6358529",
"0.6348295",
"0.6342767",
"0.6327104",
"0.62927175",
"0.62846357",
"0.62400264",
"0.6235159",
"0.6219467",
"0.6213232",
"0.6210251",
"0.62053925",
"0.61970735",
"0.61876786",
"0.6150243",
"0.61397576",
"0.613667",
"0.6125998",
"0.6124233",
"0.61115825",
"0.6108248",
"0.61024076",
"0.6098086",
"0.609521",
"0.60916644",
"0.60697025",
"0.606931",
"0.6064444",
"0.6051098",
"0.60486025",
"0.60451305",
"0.6020243",
"0.601781",
"0.6010814",
"0.6007389",
"0.59876084",
"0.5978042",
"0.5977474",
"0.59673035",
"0.5953389",
"0.59496987",
"0.59381765",
"0.59358805",
"0.59126824",
"0.59027344",
"0.5901703",
"0.5901703",
"0.5900823",
"0.58963907",
"0.58927846",
"0.5883468",
"0.5877797",
"0.5873094",
"0.5871567",
"0.5870533",
"0.5869073",
"0.5861222",
"0.5854299",
"0.5846421",
"0.5845309",
"0.5842398",
"0.58398575",
"0.58382523",
"0.58284044",
"0.58220965",
"0.58196783",
"0.58174336",
"0.5814132",
"0.5806316",
"0.5797423",
"0.5780821",
"0.57797134",
"0.57790685",
"0.5775496",
"0.57753986",
"0.57744473",
"0.57689834",
"0.57678825",
"0.5765408",
"0.57614696",
"0.5759484",
"0.5722713",
"0.571501",
"0.57140374",
"0.5711491",
"0.5707124",
"0.5701442",
"0.5688747",
"0.5682148",
"0.5677471",
"0.56771785",
"0.5674487",
"0.56727767",
"0.56718886"
] |
0.66384906
|
1
|
pass a commaseparated list of groups in a single string for execution
|
def initialize(target_groups, target_priority, options = {})
init_start_time = Time.now
# this is the directory we'll recursively index for candidate tests
@dir_to_index = File.expand_path(File.dirname(__FILE__) + '/../../tests/' + $test_module_path)
@groups_not_to_run = ["deprecated"]
@framework_utils = FrameworkUtils.new
# check markers.
@groups = target_groups.split(/[,\+]/).collect { |group| group.downcase.strip }
# and initialize some other containers we'll be using to store various values during indexing
init_containers(target_priority)
# now find all of the test files in specified directory
test_file_map = create_test_file_map()
# build a hash of test files => groups (don't include the tests which are restricted from the current environment)
test_file_to_group(test_file_map, false)
# display associated tcid at the end of each test script file
display_test_ids()
# get expected test count
@expected_test_count = @framework_utils.get_test_count(@files_to_run)
init_end_time = Time.now
puts "Time taken for analysis by test runner: #{(init_end_time - init_start_time)*1000}"
if ! @duplicate_class_files.empty? and $find_duplicate_classes == "true"
puts "These files has the duplicate class in the repository", @duplicate_class_files
@duplicate_class_files.each do |f|
if @files_to_run.include? f
raise " ******** Terminating the execution since file: #{f} has the duplicate class ***************"
end
end
end
unless options[:dry_run] == 'true'
MultiThreadedTestRunner.new($max_concurrent_tests, @files_to_run, $results_dir, :xml)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def group _args\n \"group _args;\" \n end",
"def discover_groups_string\n discover_groups.join(', ')\n end",
"def groups(*groups); end",
"def groups(*groups); end",
"def groupID _args\n \"groupID _args;\" \n end",
"def discover_groups_string=(groups)\n self.discover_groups = groups.split(/[\\s,]+/)\n end",
"def get_group(string); end",
"def read_groups_string\n read_groups.join(', ')\n end",
"def groups=(_arg0); end",
"def groups(*args)\n end",
"def edit_groups_string\n edit_groups.join(', ')\n end",
"def groupFromNetId _args\n \"groupFromNetId _args;\" \n end",
"def group_greeting (name1, name2, name3, name4, name5)\n puts \"hello group, #{name1} and #{name2} and #{name3} and #{name4} and #{name5}\"\nend",
"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 edit_groups_string=(groups)\n self.edit_groups = groups.split(/[\\s,]+/)\n end",
"def get_groups\n `id -nG #{name}`.split(' ')\n end",
"def groups\n if groups_last_update.blank? || ((Time.now - groups_last_update) > 24 * 60 * 60)\n return groups!\n end\n group_list.split(\";?;\")\n end",
"def group_list\n execute('dscacheutil -q group') do |result|\n groups = []\n result.stdout.each_line do |line|\n groups << line.split(': ')[1].strip if /^name:/.match?(line)\n end\n\n yield result if block_given?\n\n groups\n end\n end",
"def generate_multi_cmd(multi_def,multi_samples)\n\t\t\t\tmulti_cmd = []\t\n\t\t\t\tmulti_samples.each do |sample_name|\n\t\t\t\t\tif sample_name.include? \",\"\n\t\t\t\t\t\tmulti_cmd << split_and_sub(\",\",multi_def,sample_name)\n\t\t\t\t\telsif sample_name.include? \";\"\n\t\t\t\t\t\tmulti_cmd << split_and_sub(\";\",multi_def,sample_name)\n\t\t\t\t\telse\n\t\t\t\t\t\tmulti_cmd << sub_placeholders(multi_def,self.samples_obj[sample_name])\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\treturn multi_cmd.join(\"\\s\")\n\t\t\tend",
"def group(arg=nil)\n arg.nil? ? @group : @group = arg.to_s\n end",
"def list_servers(data, group)\n groups = group.split(',')\n servers = []\n groups.each { |g| servers.push(data[g.to_sym]) }\n puts servers.uniq.sort.join(\" \")\nend",
"def print_groups(groups)\n\tx = 0\n\t3.times do\n\tputs \"Unit #{x + 1} Groups\"\n\tgroups[x].each { |group| puts \"#{group} \\n\" }\n\tx += 1\nend\nend",
"def hcAllGroups _args\n \"hcAllGroups _args;\" \n end",
"def group_by(*args)\n args.each do |arg|\n if arg.is_a?(String)\n self.groups = self.groups.concat(SkyDB::Query::Selection.parse_groups(arg))\n elsif arg.is_a?(Symbol)\n self.groups << SelectionGroup.new(:expression => arg.to_s)\n else\n raise \"Invalid group by argument: #{arg} (#{arg.class})\"\n end\n end\n \n return self\n end",
"def groups\n match(/Groups\\s+:\\s+(.+)$/).split rescue []\n end",
"def output_groups(names_array, size_of_group)\n\tgroup_id = 1\n\tuntil names_array.size == 0 do\n\t\tputs \"Group \" + group_id.to_s\n\t\tputs \"=================\"\n\t\tputs names_array.shift(size_of_group)\n\t\tputs\n\t\tgroup_id += 1\n\tend\nend",
"def groupSelectedUnits _args\n \"groupSelectedUnits _args;\" \n end",
"def read_groups_string=(groups)\n self.read_groups = groups.split(/[\\s,]+/)\n end",
"def groups\n @groups ||= STDIN.read.split(\"\\n\\n\").map { |e| e.split.map { |f| f.chars } }\nend",
"def split_and_sub(sep,multi_def,multi)\t\n\t\t\t\tcmd_line = []\n\t\t\t\tmulti.split(sep).each do |sample_name|\n\t\t\t\t\tcmd_line << sub_placeholders(multi_def,self.samples_obj[sample_name])\n\t\t\t\tend\n\t\t\t\tcmd_line.join(sep)\n\t\t\tend",
"def postprocess(groups)\n end",
"def importAllGroups _args\n \"importAllGroups _args;\" \n end",
"def getAntList(group)\n cmd = \"/home/obs/ruby/bin/fxconf.rb sals #{group}\";\n return `#{cmd}`.chomp.gsub(\" \", \",\");\nend",
"def groups; end",
"def groups; end",
"def groups; end",
"def group_param_values\n @group_param_values ||= group_param_string.split(/[#{FacetTerm::OPERATOR_MAPPING.values.join}]/)\n end",
"def group(*) end",
"def group_name(param)\n \"groupName=#{param}\"\n end",
"def write_groups(groups, f)\n groups.each do |key, array|\n f.write(\"\\n[#{key}]\\n\")\n if array.count > 1\n array.each do |value|\n f.write(\"#{value}\\n\")\n end\n else\n f.write(\"#{array.join('')}\\n\")\n end\n end\n end",
"def groups\n if (groups_last_update.blank? || ((Time.now-groups_last_update) > 24*60*60 ))\n return groups!\n end\n return self.group_list.split(\";?;\")\n end",
"def groups\n if (groups_last_update.blank? || ((Time.now-groups_last_update) > 24*60*60 ))\n return groups!\n end\n return self.group_list.split(\";?;\")\n end",
"def createGroup _args\n \"createGroup _args;\" \n end",
"def hyrax_group_names\n groups\n end",
"def send_group_list\n I3.server.send_object(I3.directory.find_all_groups)\n end",
"def add_group(*args)\n end",
"def group(*groups)\n @current_groups = groups\n\n yield\n\n ensure\n @current_groups = nil\n end",
"def enable_groups_from_env!\n return if ENV['SQUIB_BUILD'].nil?\n ENV['SQUIB_BUILD'].split(',').each do |grp|\n enable_build grp.strip.to_sym\n end\n end",
"def start\n init()\n set_sending_patterns()\n\n membership_str = \"\"\n $groups.each do |g|\n str = \"Member of Group #{g}: \"\n $members[g].each { |n| str << (n.to_s + \" \") }\n membership_str << str << \"\\n\"\n end\n\n all_runs()\n\n puts membership_str\n $patterns_file.close\nend",
"def build_grouping_body\n arr = []\n data.each do |_,group| \n arr << render_group(group, options)\n end\n output << arr.join(\",\\n\")\n end",
"def group(arg = nil)\n set_or_return(\n :group,\n arg,\n kind_of: String,\n regex: Chef::Config[:group_valid_regex],\n )\n end",
"def ungroup proc\n args = []\n proc.pop #ignore :group\n groupsize = proc.pop\n endgroup = proc.pc+groupsize\n while (proc.pc < endgroup)\n arg = proc.exec\n args << arg unless arg == :comma\n end\n return args\n end",
"def align_group(input_strings, type)\n\tp = LR_parser.new(type)\n\tmetas = []\n\tinput_strings.each { |str| metas.push(p.parse_meta(str)); }\n\tmetas.each {|m| m.separate_first!}\n\tmatcher = DPMatcher.new\n\tpairs_array = [];\n\tfor i in 0..metas.size-2 do \n\t\tpairs_array.push(matcher.generate_pairs(metas[i].value, metas[i+1].value));\n\tend\n\tr = Recreator.new(type)\n\tchains = r.generate_chains(pairs_array);\n\tlines = r.multiline_reconstruction(metas, chains)\n\treturn lines\nend",
"def arg_groups(args)\n result = []\n buf = []\n\n # No dir was passed, use default\n if args.empty? || args.first.start_with?('-')\n result << [ Notes.root ]\n end\n\n args.each do |arg|\n if ALL_FLAGS.include?(arg)\n result << buf unless buf.empty?\n buf = []\n end\n buf << arg\n end\n\n result << buf\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 acc_group(names)\n\tnames.shuffle!\n\tgroups = names.each_slice(4).to_a\n\tif names.length % 4 == 1\n\t\tgroups[0] << groups.last[0]\n\t\tgroups.pop\n\telsif names.length % 4 == 2\n\t\tgroups[0] << groups.last[0]\n\t\tgroups[1] << groups.last[1]\n\t\tgroups.pop\n\telsif names.length % 4 == 3\n\t\tgroups[0] << groups.last[0]\n\t\tgroups[1] << groups.last[1]\n\t\tgroups[2] << groups.last[2]\n\t\tgroups.pop\n\tend\n\ti = 1\n\twhile i <= groups.length\n\t\tputs \"Group \" + i.to_s\n\t\tputs groups[i-1]\n\t\ti += 1\n\tend\nend",
"def acct_group(list)\n groups=[]\n if list.length<=5 \n groups = list \n else\n i=0\n while i <=list.length-3\n groups = groups << list[i..i+2]\n i+=3\n end \n groups[0] = groups[0]+list[i..list.length-1] \n end\n p groups\nend",
"def add_groups(host, groups=[])\n for group in groups\n if !GROUPS.key?(group) then\n GROUPS[group] = []\n end\n GROUPS[group].push(host)\n end\nend",
"def i_groups; 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 assigned_devices_to_group_insert_query_format(assigned_devices)\n devices = []\n devices = assigned_devices.split(',')\n for i in 0..devices.size - 1\n devices[i] = devices[i].to_s.gsub(':', '\\' : \\'').insert(0, '\\'').insert(-1, '\\'')\n end\n assigned_devices = devices.join(\", \")\n return assigned_devices\nend",
"def priv_groups(domain,username,password,dc_ip)\n groupArr = [\"Domain Admins\",\"Enterprise Admins\",\"Administrators\"]\n groupArr.each {|group| enum_group_membership(domain,username,password,dc_ip,group)}\n\n priv_groups = Array.new\n\n groupArr.each do |group|\n groupFormatted = group.gsub(' ','-')\n file = \"#{domain}-#{groupFormatted}.txt\"\n r = File.open(file)\n r.each_line {|line| priv_groups.push line.split(\"\\\\\")[1].chomp}\n end\n\n priv_groups.sort!.uniq!\n\n for i in 0 .. priv_groups.length-1 do\n group = priv_groups[i].to_s\n puts \"\"\n puts \"[+] Searching for users in the group #{group}\"\n enum_group_membership(domain,username,password,dc_ip,group)\n end\nend",
"def run_list(list, componentrole, component)\n list.join(',') + (componentrole ? ',' + componentrole.gsub('#', component) : '')\n end",
"def deleteGroup _args\n \"deleteGroup _args;\" \n end",
"def preprocess(groups)\n end",
"def create_groups(people)\n number_people = people.length\n if number_people < 3\n group_quantity = 1\n else\n group_quantity = number_people / 3\n end\n group_number = 1\n groups_names = Hash.new(\"\")\n people.each do |name|\n if group_number <= group_quantity\n groups_names[group_number] += (name + \", \")\n group_number += 1\n else\n groups_names[1] += (name + \", \")\n group_number = 2\n end\n end\n groups_names.each do |group, name|\n print \"\\n\", \"Group \", group, \"\\n\"\n print name, \"\\n\"\n end\nend",
"def do_list_groups()\n I18n.t(\"sms.some_groups\") + \": \" + Group.primary_group_abbrevs\n end",
"def align_group(input_strings, type)\n\tp \"start align_group\" if $DEBUG_project > 0\n\tp = LR_parser.new(type)\n\tmetas = [] # tree of meta-expressions\n # meta expression example for default grammar:\n # const int a = (1 + 1);\n #\n # M[ M[ T(const), T(int), T(a) ], T(=), M[ T('('), M[T(1), T(+), T(1)], T(')') ], T(;) ]\n #\n # where\n # M = meta expression\n # T = Token\n #\n #Or in formatted view:\n #\n # =\n # const int a\n # (\n # 1 + 1\n # )\n # ;\n #\n #\n #\n\tinput_strings.each { |str| metas.push(p.parse_meta(str)) }\n\tmetas.each {|m| m.separate_first!} # do not align first token\n\tmatcher = DPMatcher.new\n\tpairs_array = [] # matched pairs of tokenks for each sequential pair\n\t\n # pair:\n #\n # [<first_meta_idx>, <second_meta_idx>, [optional submatch pair] ]\n\n for i in 0..metas.size-2 do \n\t\tpairs_array.push(matcher.generate_pairs(metas[i].value, metas[i+1].value))\n end\n\n\n\tmetas.each{|x| x.print_tree } if $DEBUG_project > 1\n\tr = Recreator.new(type)\n\tchains = r.generate_chains(pairs_array) # chain of tokens throw lines to allign\n\tlines = r.multiline_reconstruction(metas, chains) # reconstruct aligned lines from tokens and chains\n\treturn lines\nend",
"def listgroups(msg, ent, ii, depth)\r\n ent.each do |bit|\r\n next unless bit.is_a?(Sketchup::Group)\r\n bname = bit.name.empty? ? 'no name' : bit.name\r\n spacer = ' ' * depth\r\n msg += spacer + ii.to_s + ' - ' + bname + \"\\n\"\r\n msg = listgroups(msg, bit.entities, ii, depth + 1)\r\n end\r\n msg\r\n end",
"def perform_group( position, action, estream, new_branch_info = nil )\n return perform_tokenize( position, action, estream, new_branch_info )\n end",
"def collect_groups(line)\n\t\tGroup.add_group(line.split(\"#{line.split(' ')[1]}\")[1].strip.split(\"=\")[0], line.split(\"#{line.split(' ')[1]}\")[1].strip.split(\"=\")[1], @system)\n\t\treturn line.split(\"#{line.split(' ')[1]}\")[1].strip.split(\"=\")[0].to_a\n\tend",
"def groups_in_pairs\n\t #@group_locate = Group.instantiator(params[:id])\n @groups = [['[None]', nil]] + Group.in_pairs(groups = [], parent_name = \"\", list = [], params[:id])\n end",
"def parse_group\n @s.scan(/\\(/)\n special = @s.scan(/\\?:|\\?=|\\?!|\\?<=|\\?<!|\\?>/)\n branches = parse_branches\n if !@s.scan(/\\)/)\n raise \"expect ')': #{@s.inspect}\"\n end\n Group.new Token.new(\"group.special\", special || ''), branches\n end",
"def group_through_identifier\n \"#{name.downcase}_groups\".to_sym\n end",
"def make_groups(list_of_names)\n result = []\n num_people = list_of_names.length\n cur_group = []\n list_of_names.each do |name|\n cur_group.push(name)\n if cur_group.length == 4 || (cur_group.length == 3 && num_people == 3)\n result.push(cur_group)\n cur_group=[]\n end\n end\n # Right now the solution doesn't gracefully handle 6 people.\n # I should write a find_available function to find an open group to stick someone\n # in.\n if cur_group.length == 2\n name = cur_group.pop\n result[1].push(name)\n end\n if cur_group.length == 1\n name = cur_group.pop\n result[0].push(name)\n end\n return result\nend",
"def set_groups(user, grouplist)\n\t\t\tend",
"def user_groups_operation(user, groups, operation)\n params = {\n :first => user['first'],\n :last => user['last'],\n :username => user['username'],\n :uid => user['uid']\n }\n \n groups.each do |group|\n params[:groupname] = group\n group_op = JSON.parse(\n @config[:templates][:group].result(binding),\n :symbolize_names => true\n )\n \n group_op[:ops].each do |op|\n op[0] = operation\n op[1] = op[1].to_sym\n end\n \n ret = modify({:name => \"localuser\", :ip => \"127.0.0.1\"}, group_op[:dn], group_op[:ops])\n end\n end",
"def xgroup(subcommand, key, group, id_or_consumer = T.unsafe(nil), mkstream: T.unsafe(nil)); end",
"def groups\n quads\n end",
"def groupadd(group)\n # XXX I don't like specifying the path to groupadd - need to sort out paths before long\n send(run_method, \"grep '#{group}:' /etc/group || sudo /usr/sbin/groupadd #{group}\")\n end",
"def group_divider (array_of_names)\n\tcounter = 0\n\tgroup_num = 0\n\tgroup_storage = []\n\tif array_of_names == nil\n\t\treturn nil\n\telsif\n\t\tarray_of_names.length < 3\n\t\tp \"It's no fun in a group less than 3 people.\"\n\telsif array_of_names.length == 3\n\t\tp \"Group 1: \" + array_of_names.join(\", \")\n\telsif array_of_names.length % 4 != 0\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\t\tif group_storage[group_num].length == 2\n\t\t\t\tgroup_storage.last << group_storage.first.pop\n\t\t\telsif group_storage[group_num].length == 1\n\t\t\t\tgroup_storage.first << group_storage.pop.pop\n\t\t\tend\n\t\t\tgroup_num += 1\n\t\tend\n\telse\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\tend\n\t\t\n\tend\n\t\n\tgroup_name_assign = 1\n\twhile group_name_assign <= group_storage.length\n\t\tp \"Group #{group_name_assign}: \" + group_storage[group_name_assign - 1].join(\", \")\n\t\tgroup_name_assign += 1\n\tend\t\nend",
"def group_by\n ActiveSupport::StringInquirer.new(@params[:group_by]) unless @params[:group_by].nil?\n end",
"def group_selectors(seq)\n newseq = []\n tail = seq.dup\n until tail.empty?\n head = []\n begin\n head << tail.shift\n end while !tail.empty? && head.last.is_a?(String) || tail.first.is_a?(String)\n newseq << head\n end\n newseq\n end",
"def get_groups_a\n\n return [] if self.groups.nil? or self.groups.empty?\n\n array = self.groups.split('|')\n array.compact!\n array.delete('')\n\n return array\n end",
"def part2 groups\n yeses = groups.map { | g |\n members = g.split(\"\\n\")\n shared_answers = members.reduce(\"abcdefghijklmnopqrstuvwxyz\".chars) { |m,v |\n m & v.chars\n }.uniq.length\n }.reduce(0){ |m,v|\n m+v\n }\nend",
"def print_groups(count:, groups:, **_kwargs)\n @stream.puts({ count: count, groups: groups }.to_json)\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 hcRemoveAllGroups _args\n \"hcRemoveAllGroups _args;\" \n end",
"def assigned_statistics_to_group_insert_query_format(group_expected_readrates,assigned_statistics)\n statistics = []\n statnames = []\n statistics = assigned_statistics.split(',')\n for i in 0..statistics.size - 1\n statnames[i] = statistics[i].split(':').last\n exp_rr_val = group_expected_readrates[statnames[i]]\n statistics[i] = statistics[i].to_s.gsub(':', '\\' : {\\'').insert(0, '\\'').insert(-1, '\\' : ').insert(-1, exp_rr_val).insert(-1, ' }')\n end\n assigned_statistics = statistics.join(\", \")\nend",
"def group(group: 'group_A')\n fetch(\"world_cup.groups.#{group}\")\n end",
"def group(group_name_or_gid)\n @commands_and_opts.push \"#{OPTIONAL_OPTS[:group]}=#{group_name_or_gid}\"\n self\n end",
"def group_for_grouped_select(items)\n items.group_by { |entry| entry.first.split(\": \").first }\n end",
"def ii_groups; end",
"def groups=(value)\n @groups = value\n end",
"def test_chgrp_sets_up_chgrp\n assert_recipe_matches %q{\n chgrp \"group\" \"file\"\n } do\n chgrp 'group', 'file'\n end\n end",
"def find_groups(text, options = {})\n get('find/groups', options.merge(text: text))\n end",
"def group_creator(name_list)\n\n\taccountability_groups = []\n\trandomized_names = name_list.shuffle #Used non-destructive shuffle so that I can call on list again for unit 2/3\n\n\twhile (randomized_names.length > 4)\n\t\taccountability_groups << randomized_names.pop(4)\t\n\tend\n\n\tcounter = 0\n\tuntil (randomized_names.length == 0)\n\t\taccountability_groups[counter] << randomized_names.pop\n\t\tcounter\t+= 1\n\tend\n\t\t\n\tcounter = 0\n\tuntil accountability_groups[counter] == nil\n\t\tputs \"Group \" + (counter + 1).to_s + \":\" ; puts accountability_groups[counter]\n\t\tputs\n\t\tcounter += 1 \n\tend\nend",
"def usage()\n dotted_line=\".................................................................................................\";\n\nputs \"#{dotted_line}\n USAGE: listagg <input_column_delimiter>\n <col_condense_by>\n\t\t <col_list_to_condense>\n\t\t [<output_column_delimiter>]\n\t\t [<condense_string_delim>]\n\t\t [<condense_string_set_delim>]\n#{dotted_line}\n - 'input_column_delimiter' is the field delimiter of the input records.\n - 'col_condense_by' is the index of the columns you want to condense by. Index starts from 1\n - 'output_column_delimiter' defaults to tab\n - 'condense_string_delim' defaults to ,\n - 'condense_string_set_delim' default to |\n#{dotted_line}\n This script reads a delimited stream for data from STDIN and behaves like Oracle's listagg function. \n It writes to STDOUT. See the examples to understand the behavior\n#{dotted_line}\n EXAMPLE: echo -e \\\"20120613,Aman,13\\\\n20120313,Tintin,14\\\\n20120613,Tikka,13\\\" | listagg \\\",\\\" \\\"1\\\" \\\"2\\\"\n EXAMPLE: echo -e \\\"20120613,Aman,13\\\\n20120313,Tintin,14\\\\n20120613,Tikka,13\\\" | listagg \\\",\\\" \\\"3\\\" \\\"1\\\"\n EXAMPLE: echo -e \\\"20120613,Aman,13\\\\n20120313,Tintin,14\\\\n20120613,Tikka,13\\\" | listagg \\\",\\\" \\\"1,3\\\" \\\"2\\\" \\\"|\\\" \\\"-\\\" \\\"#\\\"\n EXAMPLE: echo -e \\\"20120613,Aman,13\\\\n20120313,Tintin,14\\\\n20120613,Tikka,13\\\" | listagg \\\",\\\" \\\"1,3\\\" \\\"2\\\"\n\";\n exit\nend",
"def accord_all_groups\n gr3+gr4+gr5+gr6+gr7+gr8+gr9\n end",
"def group_call(params)\n path = @version + '/Call/Group/'\n method = 'POST'\n return request(path, method, params)\n end",
"def graphitemagicer( g , cmd , metricsandregexps )\n\n # Little inefficient doing this each time, but it needs to be available\n # to the ERB here.\n hostname = Socket.gethostname.split( '.' ).first\n\n raise ArgumentError, 'metricsandregexps is not an Array' unless metricsandregexps.is_a? Array\n\n metricsandregexps.each do |mar|\n\n raise TypeError, 'metrics and regexps is not made of hashes' unless mar.is_a? Hash\n\n IO.popen( \"#{cmd} 2>/dev/null </dev/null\" , 'r' ) do |c|\n c.each do |line|\n\n mar.each do |metric,regex|\n\n unless regex.class == Regexp\n regex = Regexp.new regex\n end\n\n if line =~ regex\n metric = ERB.new( metric ).result(binding)\n g.push_to_graphite { |gg| gg.pee( metric , $1 ) }\n # puts \"Metric of #{metric} with value of #{$1}\"\n end\n\n end\n end\n end\n end\n\nend"
] |
[
"0.71024776",
"0.69310397",
"0.67895716",
"0.67895716",
"0.6497885",
"0.64975536",
"0.6366717",
"0.6274625",
"0.62680227",
"0.62539524",
"0.622766",
"0.61533713",
"0.61265945",
"0.6117943",
"0.60436445",
"0.60068107",
"0.59884447",
"0.5883977",
"0.58780754",
"0.5871837",
"0.5858239",
"0.5857881",
"0.5849927",
"0.5837385",
"0.5794868",
"0.5794522",
"0.578744",
"0.5775913",
"0.5765728",
"0.57657003",
"0.5729722",
"0.57217973",
"0.5693335",
"0.5634129",
"0.5634129",
"0.5634129",
"0.55995315",
"0.5584856",
"0.557885",
"0.5560353",
"0.55496794",
"0.55496794",
"0.55388856",
"0.5534822",
"0.5534271",
"0.5525614",
"0.551862",
"0.549458",
"0.5465995",
"0.54590505",
"0.54562944",
"0.5446989",
"0.5433021",
"0.5392861",
"0.53875",
"0.538356",
"0.5375114",
"0.53744984",
"0.5362777",
"0.5360932",
"0.5356603",
"0.53523356",
"0.53332293",
"0.53330857",
"0.53159857",
"0.5314359",
"0.5308925",
"0.5303775",
"0.52847093",
"0.52768266",
"0.52633893",
"0.5262136",
"0.52608377",
"0.5244394",
"0.5238563",
"0.52163494",
"0.5211589",
"0.52111894",
"0.5204138",
"0.51702845",
"0.5160359",
"0.5157684",
"0.515645",
"0.51387197",
"0.5135306",
"0.5135144",
"0.51228034",
"0.51044023",
"0.5099818",
"0.50913703",
"0.5087867",
"0.5086251",
"0.50844544",
"0.50714374",
"0.5068053",
"0.50626475",
"0.5057902",
"0.50556177",
"0.5052737",
"0.504948",
"0.5048167"
] |
0.0
|
-1
|
This method takes 2 inputs . one is the hash map of test_file => class name and the other is output of check_marker() i.e using_or is 'true / false' And then builds the file groups that need to run.
|
def test_file_to_group(test_file_map, using_or)
puts "\nAnalyzing #{@test_files.length} test files... Stand by."
@test_files.each do |tf|
@skip = false
################
test_class = Kernel.const_get(test_file_map[tf])
# Lower cases the group only if each element in the grouping array is a string.
# Note: The check is there to work around cases like below.
# @properties[:grouping] = [CAD, CONNECT_AWLI, CONNECT], JOBS, JOBS_GRP5
test_class.properties[:grouping].map!{|g| g.downcase if g.kind_of?(String)}
## Check if the test has any group that we need not run.
@skip = false
test_class.properties[:grouping].each do |g|
if @groups_not_to_run.include?(g)
@skip = true
end
end
## check if tcid is present in the file. if not then skip the file
next if (test_class.properties[:tcid].nil? || test_class.properties[:tcid].length < 1)
# If tcid is present, then ensure that they are numbers only!
@skip_tcid = false
test_class.properties[:tcid].each do |tc|
@skip_tcid = true if !is_a_number?(tc)
end
# Check for priority
if test_class.properties[:priority].nil?
# If not defined or if not as per argument 'priority' then skip this test class
puts "PRIORITY property not defined. Skipping file: #{tf}" if $debug_mode == "true"
next
end
# If @priority_to_run is equal to MASTER PRIORITY then do not check if priority to run exists in the test class.
# If @priority_to_run is not equal to MASTER PRIORITY then check if priority to run matches @priority_to_run in
# the test class; skip test if it does not match.
# puts "@priority_to_run = #{@priority_to_run}"
@check_priority = (@priority_to_run.eql?("") or @priority_to_run.eql?(MASTER_PRIORITY.downcase))
if @check_priority == false
@target_priority_present = test_class.properties[:priority].include?(@priority_to_run)
if @target_priority_present == false
next
end
end
##########################
# Get the grouping and service property from the file and add it to the @file_group hash
# Basically file_groups is a hash with file name as key and an array of all groups
# present in the file as the value
@file_groups[tf] = [] if test_class.properties[:grouping].length > 0
test_class.properties[:grouping].each { |group| @file_groups[tf] << group }
##########################
# Get the tcid property from the file and add it to the @file_tcids hash
# Basically @file_tcids is a hash with file name as key and an array of all tcid
# present in the file as the value
tcids = test_class.properties[:tcid]
@file_tcids[tf] = tcids unless tcids.empty?
end
# "and" operator is default
# for each file, compare the intersection of groups vs groups to run.
# if the intersection exactly matches groups to run, lets see about running it.
@file_groups.each_pair { |f, g| @files_to_run << f if (@groups_to_run & g) == @groups_to_run and !(@groups_not_to_run & g).any? }
if @priority_to_run.eql?("")
puts "\nFound #{@files_to_run.length} tests grouped for execution. Priority was not defined, so taking as ALL."
else
puts "\nFound #{@files_to_run.length} tests grouped for execution which have the desired priority = #{@priority_to_run} to run:"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def group_files file_data, output_path, options = {:prefix => \"L\", :suffix => \".fastq.gz\", :exclude_undetermined => true}\n\t\t\t\t# alternatively inherit the parent class and call super???? \n\t\t\t\t# super \n\t\t\t\t# \t\n groups = {}\n file_data.each do |data|\n if data[:barcode] == \"Undetermined\" and options[:exclude_undetermined]\n log \"# Undetermined sample lane: #{data[:lane]} - name: #{data[:sample_name]}. Skipping\"\n next\n end\n \n group_key = name_for_data data, options\n \n if groups.include? group_key\n if groups[group_key][:sample_name] != data[:sample_name]\n raise \"ERROR: sample names not matching #{group_key} - #{data[:path]}:#{data[:sample_name]}vs#{groups[group_key][:sample_name]}\"\n end\n if groups[group_key][:lane] != data[:lane]\n raise \"ERROR: lanes not matching #{group_key} - #{data[:path]}\"\n end\n groups[group_key][:files] << data\n else\n group_path = File.join(output_path, group_key)\n groups[group_key] = {:group_name => group_key,\n :path => group_path,\n :sample_name => data[:sample_name],\n :read => data[:read],\n :lane => data[:lane],\n :files => [data]\n }\n end\n end\n \n # sort based on read set\n groups.each do |key, group|\n group[:files] = group[:files].sort {|x,y| x[:set] <=> y[:set]}\n group[:paths] = group[:files].collect {|data| data[:path]}\n end\n groups.values\n end",
"def initialize(target_groups, target_priority, options = {})\n init_start_time = Time.now\n # this is the directory we'll recursively index for candidate tests\n @dir_to_index = File.expand_path(File.dirname(__FILE__) + '/../../tests/' + $test_module_path)\n @groups_not_to_run = [\"deprecated\"]\n @framework_utils = FrameworkUtils.new\n \n # check markers.\n @groups = target_groups.split(/[,\\+]/).collect { |group| group.downcase.strip }\n \n # and initialize some other containers we'll be using to store various values during indexing\n init_containers(target_priority)\n \n # now find all of the test files in specified directory\n test_file_map = create_test_file_map()\n \n # build a hash of test files => groups (don't include the tests which are restricted from the current environment)\n test_file_to_group(test_file_map, false)\n \n # display associated tcid at the end of each test script file\n display_test_ids()\n \n # get expected test count\n @expected_test_count = @framework_utils.get_test_count(@files_to_run)\n \n init_end_time = Time.now\n puts \"Time taken for analysis by test runner: #{(init_end_time - init_start_time)*1000}\"\n \n if ! @duplicate_class_files.empty? and $find_duplicate_classes == \"true\"\n puts \"These files has the duplicate class in the repository\", @duplicate_class_files\n @duplicate_class_files.each do |f|\n if @files_to_run.include? f\n raise \" ******** Terminating the execution since file: #{f} has the duplicate class ***************\"\n end\n end\n end\n unless options[:dry_run] == 'true'\n MultiThreadedTestRunner.new($max_concurrent_tests, @files_to_run, $results_dir, :xml)\n end\n \n end",
"def grouped(files); end",
"def initialize\n #get a list of all folders, then get a list of all\n #test files for each folder\n @base_dir = __FILE__ + '../../../test/functional/'\n \n @func_areas = Hash.new\n test_dir = Dir.new(@base_dir)\n \n folders = test_dir.entries\n \n folders.each do |folder|\n \n if !File.basename(@base_dir + folder).index(\".\") \n if File.ftype(@base_dir + folder)== \"directory\"\n @func_areas[File.basename(folder)]= get_test_files_for_dir(folder)\n end\n end\n end\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 define_tests\n @ours.each do |pkg|\n their = @theirs.find { |x| x.name == pkg.name }\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(ours: pkg, theirs: their).run\n end\n end\n end\n end",
"def test_file(group)\n if options[:group] == :file\n file = group\n else\n file = group.gsub('::', '/').downcase\n end\n\n dirname, basename = File.split(file)\n\n if i = dirname.index('/')\n dirname = dirname[i+1..-1]\n file = File.join(dirname, output, \"case_#{basename}\")\n else\n file = File.join(output, \"case_#{basename}\")\n end\n end",
"def start_tests(files)\n end",
"def generate_data_files\n files = {}\n\n # extracted data\n @classes.each do |category|\n files[category] = {}\n folder = File.join(@res, 'data', category.to_s, 'extracted')\n\n files[category][:extracted] = File.join(folder, \"#{category}.json\")\n end\n\n # divided data\n @classes.each do |category|\n files[category][:divided] = {}\n folder = File.join(@res, 'data', category.to_s, 'divided')\n\n @subsets.each do |subset|\n files[category][:divided][subset] = File.join(folder,\n \"#{category}_#{subset}.json\")\n end\n end\n\n # preprocessed data\n @classes.each do |category|\n files[category][:preprocessed] = {}\n\n @preproc.each do |preprocess|\n folder = File.join(\n @res, 'data', category.to_s, 'preprocessed', preprocess.to_s)\n\n files[category][:preprocessed][preprocess] = {}\n\n @subsets.each do |subset|\n files[category][:preprocessed][preprocess][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n\n # transformed data\n if @trans.size > 0\n @classes.each do |category|\n files[category][:transformed] = {}\n\n @trans.each do |transformation|\n @preproc.each do |preprocess|\n ctrans = :\"#{transformation}_#{preprocess}\"\n\n folder = File.join(\n @res, 'data', category.to_s, 'transformed', ctrans.to_s)\n\n files[category][:transformed][ctrans] = {}\n\n @subsets.each do |subset|\n files[category][:transformed][ctrans][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n end\n end\n\n # classified data\n if @classifs.size > 0\n @classes.each do |category|\n files[category][:classified] = {}\n\n @classifs.each do |classifier|\n @trans.each do |transformation|\n @preproc.each do |preprocess|\n ctrans = :\"#{classifier}_#{transformation}_#{preprocess}\"\n\n folder = File.join(\n @res, 'data', category.to_s, 'classified', ctrans.to_s)\n\n files[category][:classified][ctrans] = {}\n\n @subsets.each do |subset|\n files[category][:classified][ctrans][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n end\n end\n end\n files\n end",
"def group_fastq_files starting_path, output_path, options = {:prefix => \"L\", :suffix => \".fastq.gz\", :exclude_undetermined => true}\n execute \"mkdir -p #{output_path}\"\n fastq_groups = []\n \n fastq_files = Dir.glob(File.join(starting_path, fastq_search_path))\n if fastq_files.empty?\n log \"# ERROR: no fastq files found in #{starting_path}\" if fastq_files.empty?\n else\n log \"# #{fastq_files.size} fastq files found in #{starting_path}\"\n fastq_file_data = get_file_data fastq_files, \"\\.fastq\\.gz\"\n fastq_groups = group_files fastq_file_data, output_path, options\n end\n fastq_groups\n end",
"def grep_files_by_properties\n # I - filter on @properties[:grouping] keywords.\n property_filter = \"@properties[:grouping]\"\n \n # @services_to_run ||= []\n @groups_to_run ||= []\n \n # groups to run may contain something like [\"g1,g2,g3\",\"g4,g5,g6\"]\n groups_to_run_filter = @groups_to_run.map {|g| g.split(',')}.flatten.uniq\n \n # adding services and groups to filter\n group_filter = groups_to_run_filter.join('|')\n \n # grep -rw '@properties[:grouping]|@properties[:services] ../tests'\n grep_cmd1 = \"grep -rw '#{property_filter.shellescape}' #{@dir_to_index} \"\n \n # grep -rw 'service1|service2|group1|group2'\n grep_cmd2 = \"grep -iw \\\"#{group_filter.shellescape}\\\"\"\n \n # Command to apply both the grep filters\n # = grep_cmd1 | grep_cmd2\n grep_cmd = \"#{grep_cmd1}|#{grep_cmd2}\"\n \n cmd_result = %x[ #{grep_cmd} ]\n \n grep_result_list = cmd_result.nil? ? [] : cmd_result.split(\"\\n\")\n \n end",
"def process(files) #called at end of script\n if files.class==Array \n files.each {|f| \n puts \"\\n\\n--------------------\\n#{f}:\\n\\n\"\n result=system(\"#{$PROGRAM_NAME} #{f} #{ARGV}\")\n puts \"\\n\\nERRORS IN TEST #{f}!!!\\n\\n\" unless result\n }\n else\n test_name=File.basename(files).sub(/\\..*?$/,'')\n test_case=Class.new(Test::Unit::TestCase)\n Object.const_set(:\"Test#{test_name.capitalize}\", test_case)\n mk_test_context(files, test_case)\n end\nend",
"def generate_test_class(data: [], linkstatus_url_log: {}, w_pipe: {})\n test_cond = @test_cond\n # Common proccessing\n # e.g.) TestSampleAppPcE2e1, TestSampleAppPcHttpstatus1\n test_class_name = make_test_class_name(data)\n # Select super class by test category\n super_suite_class = eval format('Bucky::TestEquipment::TestCase::%<test_category>sTestCase', test_category: data[:test_category].capitalize)\n # Define test suite class\n test_classes.const_set(test_class_name.to_sym, Class.new(super_suite_class) do |_klass|\n extend TestClassGeneratorHelper\n include TestClassGeneratorHelper\n define_method(:suite_data, proc { data[:suite] })\n define_method(:suite_id, proc { data[:test_suite_id] })\n define_method(:simple_test_class_name) do |original_name|\n match_obj = /\\Atest_(.+)\\(.+::(Test.+)\\)\\z/.match(original_name)\n \"#{match_obj[1]}(#{match_obj[2]})\"\n end\n define_method(:w_pipe, proc { w_pipe })\n\n # Class structure is different for each test category\n case data[:test_category]\n when 'linkstatus' then\n data[:suite][:cases].each_with_index do |t_case, i|\n method_name = make_test_method_name(data, t_case, i)\n description(\n t_case[:case_name],\n define_method(method_name) do\n puts \"\\n#{simple_test_class_name(name)}\"\n t_case[:urls].each do |url|\n linkstatus_check_args = { url: url, device: data[:suite][:device], exclude_urls: data[:suite][:exclude_urls], link_check_max_times: test_cond[:link_check_max_times], url_log: linkstatus_url_log }\n linkstatus_check(linkstatus_check_args)\n end\n end\n )\n end\n\n when 'e2e' then\n if data[:suite][:setup_each]\n def setup\n super\n puts \"[setup]#{simple_test_class_name(name)}\"\n add_test_procedure(suite_data[:setup_each][:procs])\n end\n end\n\n if data[:suite][:teardown_each]\n def teardown\n puts \"[teardown]#{simple_test_class_name(name)}\"\n add_test_procedure(suite_data[:teardown_each][:procs])\n super\n end\n end\n\n # Generate test case method\n data[:suite][:cases].each_with_index do |t_case, i|\n # e.g.) test_sample_app_pc_e2e_1_2\n method_name = make_test_method_name(data, t_case, i)\n method_obj = proc do\n puts \"\\n#{simple_test_class_name(name)}\\n #{t_case[:desc]} ....\"\n add_test_procedure(t_case[:procs])\n end\n description(t_case[:case_name], define_method(method_name, method_obj))\n end\n end\n end)\n end",
"def tests_in_groups(tests, num_groups, options={})\n tests = find_tests(tests, options)\n\n case options[:group_by]\n when :found\n tests.map! { |t| [t, 1] }\n when :filesize\n sort_by_filesize(tests)\n when nil\n sort_by_filesize(tests)\n else\n raise ArgumentError, \"Unsupported option #{options[:group_by]}\"\n end\n\n Grouper.in_even_groups_by_size(tests, num_groups, options)\n end",
"def setup\n @gbif = Pathname.new(__FILE__).dirname.join('gbif_genbank_linker_test.gbif.txt')\n @genbank = Pathname.new(__FILE__).dirname.join('gbif_genbank_linker_test.genbank.txt')\n\n # the sample gbif test file above has these accessions:\n @gbif_accessions = %w(\n 80720161\n AY099992\n AY099996\n AY099996\n AY100002\n AY100003\n AY308770\n AY308771\n AY308771\n AY308773\n AY308778\n )\n\n # the example genbank file has these:\n @genbank_accessions = %w(\n AY099992\n AY099996\n AY308768\n AY308769\n AY308770\n AY308771\n AY308772\n AY308773\n )\n\n # tests that rely on the actual downloads will be skipped unless these are\n # manually supplied\n # TODO: add how we get this\n @gbif_all = Rails.root.join('test/data/pipeline/input/0147211-200613084148143.filtered.txt.expanded')\n end",
"def test_scenario2\n data = [{'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e.csv',\n 'params' => {\"combiner\" => 0}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_c1.csv',\n 'params' => {\"combiner\" => 1, \"confidence\" => true}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_c2.csv',\n 'params' => {\"combiner\" => 2, \"confidence\" => true}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_o_k_v.csv',\n 'params' => {\"operating_kind\" => \"votes\", \"confidence\" => true}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_o_k_p.csv',\n 'params' => {\"operating_kind\" => \"probability\", \"probability\" => true}},\n {'filename' => File.dirname(__FILE__)+'/data/iris.csv',\n 'number_of_models' => 5,\n 'tlp' => 1,\n 'local_file' => File.dirname(__FILE__)+'/tmp/batch_predictions.csv',\n 'predictions_file' => File.dirname(__FILE__)+'/data/batch_predictions_e_o_k_c.csv',\n 'params' => {\"operating_kind\" => \"confidence\", \"confidence\" => true}}\n ]\n\n puts\n puts \"Scenario: Successfully creating a batch prediction for an ensemble\"\n\n data.each do |item|\n puts\n puts \"Given I create a data source uploading a #{item['filename']} file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create an ensemble of #{item['number_of_models']} models and #{item['tlp']} tlp\"\n # \"tlp\"=> item[\"tlp\"]\n ensemble = @api.create_ensemble(dataset, {\"number_of_models\"=> item[\"number_of_models\"], \"seed\" => 'BigML', 'ensemble_sample'=>{'rate' => 0.7, 'seed' => 'BigML'}, 'missing_splits' => false})\n\n puts \"And I wait until the ensemble is ready\"\n assert_equal(BigML::HTTP_CREATED, ensemble[\"code\"])\n assert_equal(@api.ok(ensemble), true)\n\n puts \"When I create a batch prediction for the dataset with the ensemble and params <%s>\" % JSON.generate(item['params'])\n batch_prediction = @api.create_batch_prediction(ensemble, dataset, item['params'])\n\n puts \"And I wait until the batch prediction is ready\"\n assert_equal(BigML::HTTP_CREATED, batch_prediction[\"code\"])\n assert_equal(@api.ok(batch_prediction), true) \n\n puts \"And I download the created predictions file to #{item['local_file']}\"\n filename = @api.download_batch_prediction(batch_prediction, item[\"local_file\"])\n assert_not_nil(filename)\n\n puts \"Then the batch prediction file is like #{item['predictions_file']}\"\n assert_equal(FileUtils.compare_file(item[\"local_file\"], item[\"predictions_file\"]), true)\n\n\n end\n\n end",
"def get_execution_set(collect_hash,group)\n if group\n execution_cases=Hash.new\n collect_hash.each do |resclass,testcases|\n tests=[]\n for test in testcases\n for i in group\n if test.constants.include?(:GROUP) and test::GROUP.include?i\n tests.push(test)\n break\n end\n end\n end\n if not tests.empty?\n execution_cases[resclass]=tests\n end\n end\n return execution_cases\n else\n return collect_hash\n end\n end",
"def define_tests\n Apt.update if Process.uid.zero? # update if root\n @lister.packages.each do |pkg|\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(pkg).run\n end\n end\n end\n end",
"def get_classes_from_groups(group_names)\n # expect that each group file\n if group_names\n group_dir = File.join(data_dir, 'class_groups')\n group_names.reduce([]) do |result, name|\n group_file = File.join(group_dir, \"#{name}.yaml\")\n unless File.exists?(group_file)\n raise(Exception, \"Group file #{group_file} does not exist\")\n end\n result + YAML.load_file(group_file)\n end\n else\n []\n end\n end",
"def setup\n alpha_1_string = File.open('./test/unit/lib/hl7_test_data/discovery_alpha_1.csv').read\n alpha_2_string = File.open('./test/unit/lib/hl7_test_data/discovery_alpha_2.csv').read\n beta_1_string = File.open('./test/unit/lib/hl7_test_data/discovery_beta_1.csv').read\n beta_2_string = File.open('./test/unit/lib/hl7_test_data/discovery_beta_2.csv').read\n @alpha_1 = DiscoveryCsv.new(hl7_csv_string: alpha_1_string)\n @alpha_2 = DiscoveryCsv.new(hl7_csv_string: alpha_2_string)\n @beta_1 = DiscoveryCsv.new(hl7_csv_string: beta_1_string)\n @beta_2 = DiscoveryCsv.new(hl7_csv_string: beta_2_string)\n @same_one = DiscoveryCsv.new(hl7_csv_string: File.open('./test/unit/lib/hl7_test_data/discovery_same_1.csv').read)\n @same_two = DiscoveryCsv.new(hl7_csv_string: File.open('./test/unit/lib/hl7_test_data/discovery_same_2.csv').read)\n end",
"def test_generate_with_varied_class_entries\n forms = ['classtest.utils.MathUtil', \n 'classtest.utils.MathUtil.as', \n 'classtest/utils/MathUtil', \n 'classtest/utils/MathUtil.as'\n ]\n forms.each do |form|\n run_generator(form)\n assert_generated_class(form, @src_dir)\n remove_file(@src_dir)\n FileUtils.mkdir_p(@src_dir)\n remove_file(@test_dir)\n FileUtils.mkdir_p(@test_dir)\n end\n end",
"def add_done_files_for_plagiarism_check_of(td, tmp_path, force, to_check)\n tasks = tasks_for_definition(td)\n tasks_with_files = tasks.select { |t| t.has_pdf }\n\n if td.group_set\n # group task so only select one member of each group\n seen_groups = []\n\n tasks_with_files = tasks_with_files.select do |t|\n if t.group.nil?\n result = false\n else\n result = ! seen_groups.include?(t.group)\n if result\n seen_groups << t.group\n end\n end\n result\n end\n end\n\n # check number of files, and they are new\n if tasks_with_files.count > 1 && (tasks.where(\"tasks.file_uploaded_at > ?\", last_plagarism_scan ).select { |t| t.has_pdf }.count > 0 || force )\n td.plagiarism_checks.each do |check|\n next if check[\"type\"].nil?\n\n type_data = check[\"type\"].split(\" \")\n next if type_data.nil? or type_data.length != 2 or type_data[0] != \"moss\"\n\n # extract files matching each pattern\n # -- each pattern\n check[\"pattern\"].split(\"|\").each do |pattern|\n tasks_with_files.each do |t|\n FileHelper.extract_file_from_done(t, tmp_path, pattern, lambda { | task, to_path, name | File.join(\"#{to_path}\", \"#{t.student.username}\", \"#{name}\") } )\n end\n MossRuby.add_file(to_check, \"**/#{pattern}\")\n end\n end\n end\n\n self\n end",
"def run\n self.get_params\n @target ||= self.get_target_file_name\n @top ||= self.get_criteria\n\n unless @top == nil\n result = true\n if @target.kind_of? String\n puts \"Processing file: #{@target}\"\n lines = Util.get_file_as_array( @target )\n @top.run lines\n result = @top.result\n else\n @target.each do |file|\n print \"Processing file: #{file}... \"\n lines = Util.get_file_as_array( file )\n @top.reset_rule_results\n @top.run lines\n result = false unless @top.result == true\n if @top.result\n puts \"[Pass]\"\n else\n puts \"[Fail]\"\n end\n end\n end\n\n if result == true\n puts \"PASS\"\n else\n puts \"FAIL\"\n end\n else\n puts \"Error loading verification criteria from: #{@options.criteria_file}\"\n end\n end",
"def process(name)\n @test_flag = false\n @array_list = []\n\n detect_os\n\n puts 'Parsing file: ' + name\n\n test_pass = 0\n test_fail = 0\n test_ignore = 0\n puts ''\n puts '=================== RESULTS ====================='\n puts ''\n File.open(name).each do |line|\n # Typical test lines look like this:\n # <path>/<test_file>.c:36:test_tc1000_opsys:FAIL: Expected 1 Was 0\n # <path>/<test_file>.c:112:test_tc5004_initCanChannel:IGNORE: Not Yet Implemented\n # <path>/<test_file>.c:115:test_tc5100_initCanVoidPtrs:PASS\n #\n # where path is different on Unix vs Windows devices (Windows leads with a drive letter)\n line_array = line.split(':')\n\n # If we were able to split the line then we can look to see if any of our target words\n # were found. Case is important.\n if (line_array.size >= 4) || (line.start_with? 'TEST(')\n # Determine if this test passed\n if line.include? ':PASS'\n test_passed(line_array)\n test_pass += 1\n elsif line.include? ':FAIL:'\n test_failed(line_array)\n test_fail += 1\n elsif line.include? ':IGNORE:'\n test_ignored(line_array)\n test_ignore += 1\n elsif line.start_with? 'TEST('\n if line.include? ' PASS'\n line_array = line.split(' ')\n test_passed_unity_fixture(line_array)\n test_pass += 1\n end\n # If none of the keywords are found there are no more tests for this suite so clear\n # the test flag\n else\n @test_flag = false\n end\n else\n @test_flag = false\n end\n end\n puts ''\n puts '=================== SUMMARY ====================='\n puts ''\n puts 'Tests Passed : ' + test_pass.to_s\n puts 'Tests Failed : ' + test_fail.to_s\n puts 'Tests Ignored : ' + test_ignore.to_s\n @total_tests = test_pass + test_fail + test_ignore\n\n return unless @xml_out\n\n heading = '<testsuite tests=\"' + @total_tests.to_s + '\" failures=\"' + test_fail.to_s + '\"' + ' skips=\"' + test_ignore.to_s + '\">'\n @array_list.insert(0, heading)\n write_xml_output\n end",
"def initialize(folder1, folder2, options)\n \t @folder1 = folder1\n \t @folder2 = folder2\n \t @format = options['output']\n \t @filehash = Hash.new\n\t\t\t validate\n\t\tend",
"def groups\n @groups ||= SimpleCov.grouped(files)\n end",
"def groups\n @groups ||= SimpleCov.grouped(files)\n end",
"def groups\n @groups ||= SimpleCov.grouped(files)\n end",
"def test_cases\n @test_cases ||= Dir.glob(test_glob)\n end",
"def generate\n\t\tputs '####### Generation of TestClasses begins'\n\t\t@java_map.each { |key, value|\n\t\t\tif @java_map.has_key?(key +'Test') || key.end_with?('Test')\n\t\t\t\tputs key + ' already has a Test (Test will not be generated)'\n\t\t\telsif value.is_a? JavaClass\n\t\t\t\tif value.abstract\n\t\t\t\t\tputs key + ' is abstract (Test will not be generated)'\n\t\t\t\telse\n\t\t\t\t\tgenerate_test_class value\n\t\t\t\tend\n\t\t\tend\n\t\t}\n\tend",
"def load_test(tc)\n data = Hash.new\n File.open(tc, \"r\") do |infile|\n while (line = infile.gets)\n #test = /^.*\\/(.*\\.rb)/.match(tc)[1]\n test = /^.*\\/([A-Za-z0-9_-]*[T|t]est.*)/.match(tc)[1]\n data['execute_class'] = /^([A-Za-z0-9_-]*[T|t]est.*)/.match(tc)[1]\n data['path'] = /(.*)\\/#{test}/.match(tc)[1]\n data['execute_args'] = /^#[\\s]*@executeArgs[\\s]*(.*)/.match(line)[1] if /^#[\\s]*@executeArgs/.match(line)\n data['author'] = /^#[\\s]*@author[\\s]*(.*)/.match(line)[1] if /^#[\\s]*@author/.match(line)\n data['keywords'] = /^#[\\s]*@keywords[\\s]*(.*)/.match(line)[1].gsub(/,/,'').split if /^#[\\s]*@keywords/.match(line)\n data['description'] = /^#[\\s]*@description[\\s]*(.*)/.match(line)[1] if /^#[\\s]*@description/.match(line)\n end\n end\n @tests << Test.new(data, @test_data) if data['keywords'] != nil and data['keywords'] != \"\"\nend",
"def get_classes_from_groups(group_names, scope={})\n # expect that each group file\n if group_names\n group_dir = File.join(data_dir, 'class_groups')\n group_names.reduce([]) do |result, name|\n group_file = get_data_file(group_dir, \"#{name}.yaml\")\n unless File.exists?(group_file)\n raise(Exception, \"Group file #{group_file} does not exist\")\n end\n class_group = YAML.load_file(group_file)\n result + process_classes(class_group, scope)\n end.uniq\n else\n []\n end\n end",
"def parse_directories(files, diffs)\n files.sort!\n\n # Initialize those hashes, where each key will map to hash, in wich\n # each key maps to an array:\n # {\n # key1: {\n # },\n # key2: {\n # },\n # }\n #\n without_diffs = Hash.new { |h,k| h[k] = {} }\n with_diffs = Hash.new { |h,k| h[k] = {} }\n\n directories = files.map { |f| f.split('/').first }.uniq\n groups = directories.map { |dir| dir.split('_').first }.uniq\n\n\n # Fill in the files as variants\n directories.each do |directory|\n group = directory.split('_')[0]\n test_name = test_name_from_dir(directory)\n\n # Determines the type of test by the presence of the diff.png\n # file in the folder.\n # Ideally the manifest file format would be different and\n # include the test type with\n if files.select { |file_name| file_name.start_with?(directory) }.any? { |file_name| file_name.include?('diff.png') }\n variants = variants_for_page(directory, diffs)\n else\n variants = variants_for_api_endpoint(directory, diffs, files)\n end\n\n if diffs[directory]\n with_diffs[group][test_name] = variants\n else\n without_diffs[group][test_name] = variants\n end\n end\n\n return groups, without_diffs, with_diffs\n\n # For reference\n # gallery_format = {\n # \"1080\" => {\n # \"name\" => [\n # {\n # image: \"full_img_src\",\n # thumb: \"thumb_src\",\n # domain: \"production\"\n # }, {\n # image: \"foo_src\",\n # thumb: \"thumb_src\",\n # domain: \"test\"\n # }, {\n # image: \"diff_src\",\n # thumb: \"diff_thumb_src\",\n # domain: \"diff\",\n # diff_amt: 0.1\n # }\n # }\n # }\n # }\n end",
"def prepare_pod_groups\n file_accessors.each do |file_accessor|\n pod_name = file_accessor.spec.name\n next unless sandbox.local?(pod_name)\n root_name = Specification.root_name(pod_name)\n path = file_accessor.root\n group = pods_project.group_for_spec(root_name)\n group.set_path(path) unless group.path == path\n end\n end",
"def get_test_results(fn)\n results = { :pass => [], :fail => [], :error => [], :test_method_file => [] }\n\n if File.directory? fn\n files = Dir.entries(fn)\n files.each do |f|\n if f =~ /TEST-.*\\.xml/\n these_results = get_test_results_from_file(File.join(fn, f))\n results[:pass].concat these_results[:pass]\n results[:fail].concat these_results[:fail]\n results[:error].concat these_results[:error]\n results[:test_method_file].concat these_results[:test_method_file]\n end\n end \n else\n return get_test_results_from_file(fn)\n end\n return results\n end",
"def run_tests_under(config, options, root)\n summary = {}\n test_list(File.join($work_dir,root)).each do |path|\n name = path.sub(\"#{$work_dir}/\", '')\n puts \"\", \"\", \"#{name} executing...\"\n result = TestWrapper.new(config,options,path).run_test\n puts \"#{name} returned: #{result.fail_flag}\"\n summary[name] = result.fail_flag\n end\n return summary\nend",
"def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.flatten!\n results\n end",
"def initialize(split_groups, min_successes=10.0, yates=:on)\n raise \"GTest expects a hash of split groups\" unless split_groups.is_a? Hash\n raise GTestException.new(\"need at least two split tests\") if split_groups.size < 2\n @min_successes = min_successes\n @split_groups = split_groups\n @yates = yates\n end",
"def test_classes\n if(@fiber && @input_classes.size == 0)\n @fiber.transfer [:error, \"Could not find any classes\"]\n end\n @input_classes.each do |c|\n if @regression_file.nil?\n single_class_test(c)\n else\n double_class_test(c,@regression_file)\n end\n end\n end",
"def ntest_output_generator_group\n assert_equal(\"SHEPHERD EYE SURGICENTER\", Output835.output_generator_group(facilities(:facility_211)))\n assert_equal(facilities(:facility_24).name, Output835.output_generator_group(facilities(:facility_24)))\n end",
"def test_reuse_single_file\n CheckFile @writer, @ioservice, @adlers, 'test tests test ', ['test ', 'tests', ' ', 'test ']\n end",
"def test_system_1()\n name = String.new\n output_folder = \"#{File.dirname(__FILE__)}/output/system_1\"\n FileUtils.rm_rf( output_folder )\n FileUtils::mkdir_p( output_folder )\n File.open(\"#{output_folder}/test.log\", 'w') do |test_log| \n #all permutation and combinations. \n boiler_fueltypes = [\"NaturalGas\",\"Electricity\",\"FuelOil#2\"]\n mau_types = [true, false]\n mau_heating_coil_types = [\"Hot Water\", \"Electric\"]\n baseboard_types = [\"Hot Water\" , \"Electric\"]\n model = BTAP::FileIO::load_osm(\"#{File.dirname(__FILE__)}/5ZoneNoHVAC.osm\")\n BTAP::Environment::WeatherFile.new(\"#{File.dirname(__FILE__)}/../../../weather/CAN_ON_Toronto.716240_CWEC.epw\").set_weather_file(model)\n #save baseline\n BTAP::FileIO::save_osm(model, \"#{output_folder}/baseline.osm\")\n #interate through combinations. \n \n boiler_fueltypes.each do |boiler_fueltype|\n baseboard_types.each do |baseboard_type|\n mau_types.each do |mau_type|\n if mau_type == true\n mau_heating_coil_types.each do |mau_heating_coil_type|\n name = \"sys1_Boiler~#{boiler_fueltype}_Mau~#{mau_type}_MauCoil~#{mau_heating_coil_type}_Baseboard~#{baseboard_type}\"\n puts \"***************************************#{name}*******************************************************\\n\"\n model = BTAP::FileIO::load_osm(\"#{File.dirname(__FILE__)}/5ZoneNoHVAC.osm\")\n BTAP::Environment::WeatherFile.new(\"#{File.dirname(__FILE__)}/../../../weather/CAN_ON_Toronto.716240_CWEC.epw\").set_weather_file(model)\n BTAP::Resources::HVAC::HVACTemplates::NECB2011::assign_zones_sys1(\n model, \n model.getThermalZones, \n boiler_fueltype, \n mau_type, \n mau_heating_coil_type, \n baseboard_type)\n #Save the model after btap hvac. \n BTAP::FileIO::save_osm(model, \"#{output_folder}/#{name}.hvacrb\")\n #run the standards\n result = run_the_measure(model,\"#{output_folder}/#{name}/sizing\")\n #Save the model\n BTAP::FileIO::save_osm(model, \"#{output_folder}/#{name}.osm\")\n assert_equal(true, result,\"Failure in Standards for #{name}\")\n end\n else\n name = \"sys1_Boiler~#{boiler_fueltype}_Mau~#{mau_type}_MauCoil~None_Baseboard~#{baseboard_type}\"\n puts \"***************************************#{name}*******************************************************\\n\"\n model = BTAP::FileIO::load_osm(\"#{File.dirname(__FILE__)}/5ZoneNoHVAC.osm\")\n BTAP::Environment::WeatherFile.new(\"#{File.dirname(__FILE__)}/../../../weather/CAN_ON_Toronto.716240_CWEC.epw\").set_weather_file(model)\n \n BTAP::Resources::HVAC::HVACTemplates::NECB2011::assign_zones_sys1(\n model, \n model.getThermalZones, \n boiler_fueltype, \n mau_type, \n \"Electric\", #value will not be used. \n baseboard_type)\n #Save the model after btap hvac. \n BTAP::FileIO::save_osm(model, \"#{output_folder}/#{name}.hvacrb\")\n \n result = run_the_measure(model,\"#{output_folder}/#{name}/sizing\")\n \n #Save model after standards\n BTAP::FileIO::save_osm(model, \"#{output_folder}/#{name}.osm\")\n assert_equal(true, result,\"Failure in Standards for #{name}\")\n \n end\n end\n end\n end\n self.run_simulations(output_folder)\n end\n end",
"def build_groups # rubocop:disable Metrics/AbcSize\n group_array = []\n @data['controls'].each do |control|\n group = HappyMapperTools::Benchmark::Group.new\n group.id = control['id']\n group.title = control['gtitle']\n group.description = \"<GroupDescription>#{control['gdescription']}</GroupDescription>\" if control['gdescription']\n\n group.rule = HappyMapperTools::Benchmark::Rule.new\n group.rule.id = control['rid']\n group.rule.severity = control['severity']\n group.rule.weight = control['rweight']\n group.rule.version = control['rversion']\n group.rule.title = control['title'].tr(\"\\n\", ' ') if control['title']\n group.rule.description = \"<VulnDiscussion>#{control['desc'].tr(\"\\n\", ' ')}</VulnDiscussion><FalsePositives></FalsePositives><FalseNegatives></FalseNegatives><Documentable>false</Documentable><Mitigations></Mitigations><SeverityOverrideGuidance></SeverityOverrideGuidance><PotentialImpacts></PotentialImpacts><ThirdPartyTools></ThirdPartyTools><MitigationControl></MitigationControl><Responsibility></Responsibility><IAControls></IAControls>\"\n\n if ['reference.dc.publisher', 'reference.dc.title', 'reference.dc.subject', 'reference.dc.type', 'reference.dc.identifier'].any? { |a| @attribute.key?(a) }\n group.rule.reference = build_rule_reference\n end\n\n group.rule.ident = build_rule_idents(control['cci']) if control['cci']\n\n group.rule.fixtext = HappyMapperTools::Benchmark::Fixtext.new\n group.rule.fixtext.fixref = control['fix_id']\n group.rule.fixtext.fixtext = control['fix']\n\n group.rule.fix = build_rule_fix(control['fix_id']) if control['fix_id']\n\n group.rule.check = HappyMapperTools::Benchmark::Check.new\n group.rule.check.system = control['checkref']\n\n # content_ref is optional for schema compliance\n if @attribute['content_ref.name'] || @attribute['content_ref.href']\n group.rule.check.content_ref = HappyMapperTools::Benchmark::ContentRef.new\n group.rule.check.content_ref.name = @attribute['content_ref.name']\n group.rule.check.content_ref.href = @attribute['content_ref.href']\n end\n\n group.rule.check.content = control['check']\n\n group_array << group\n end\n @benchmark.group = group_array\n end",
"def build_lookups!\n @class_and_method_to_file ||= {}\n # Build a mapping from [class,method] => filename\n # (and make sure the mapping is unique)\n table.each do |row|\n # We know that Saikuro provides the wrong data\n # TODO inject Saikuro reference\n next if row[\"metric\"] == :saikuro\n key = [row[\"class_name\"], row[\"method_name\"]]\n file_path = row[\"file_path\"]\n @class_and_method_to_file[key] ||= file_path\n end\n end",
"def testProcessSource\n execute_Mix_WithConf({\n :WaveFiles => {\n :FilesList => [\n {\n :Name => 'Wave.wav'\n }\n ]\n },\n :Mix => {\n 'Final' => {\n :Tracks => {\n 'Wave.wav' => {\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n }\n }\n }\n }\n },\n :PrepareFiles => [\n [ 'Wave/Empty.wav', 'Wave.wav' ]\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Wave.0.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => 'Wave.wav',\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam1'\n }\n }\n ], 'Process_Test.rb'\n assert_wave_lnk 'Empty', '05_Mix/Final/Final.wav'\n end\n end",
"def initialize(group_name, file_path) # overriding the default initialize with a positional arguement group name\n @name = group_name # setting instance variable @name\n @path = file_path\n @names_array = self.path_to_array\n end",
"def grouper\n @generate_batch_summary = false\n\n if ((@config.primary_group == \"payer\" && @config.without_batch_grouping) ||\n @config.by_nextgen)\n @all_checks = get_operation_log_checks(@config.job_status_grouping, @batches.collect(&:id))\n \n if @config.primary_group == \"payer\" && @config.without_batch_grouping\n chk_grps = @all_checks.group_by{|b| get_payer_criteria(b).to_s}\n elsif @config.by_nextgen\n Output835.oplog_log.info \"Grouping is By NextGen\"\n groups = segregate_checks(@all_checks)\n chk_grps = {}\n \n groups.each_with_index do |checks, index|\n @nextgen_insurance = (index == 0)\n if index == 0\n chk_grps = (checks.group_by{|check| payer_type(check).to_s})\n else\n chk_grps.merge!(checks.group_by{|check| payer_type(check).to_s})\n end\n end\n end\n\n group_keys = chk_grps.keys\n ideal_insurance = {}\n patpay = {}\n nextgen_insurance = {}\n nextgen_patpay = {}\n rejected = {}\n\n ideal_insurance = chk_grps.select {| key, value | key.include?(\"actual_insurance\")}\n patpay = chk_grps.select {| key, value | key.include?(\"patpay\")}\n nextgen_insurance = chk_grps.select {| key, value | key.include?(\"queue_goodman_nextgen\")}\n nextgen_patpay = chk_grps.select {| key, value | key.include?(\"queue_nextgen\")}\n rejected = chk_grps.select {| key, value | key.include?(\"rejected\")}\n \n ideal_insurance_sorted = ideal_insurance.sort_by{|key,value| payer_name_for_check(value.first)}\n nextgen_insurance_sorted = nextgen_insurance.sort_by{|key,value| payer_name_for_check(value.first)}\n\n ideal_insu_sorted_array = []\n patpay_array = []\n nextgen_insu_sorted_array = []\n nextgen_patpay_array = []\n rejected_array = []\n for i in 0..ideal_insurance_sorted.length - 1\n for j in 1..ideal_insurance_sorted[0].length - 1\n ideal_insu_sorted_array << ideal_insurance_sorted[i][j]\n end\n end\n\n for k in 0..nextgen_insurance_sorted.length - 1\n for l in 1..nextgen_insurance_sorted[0].length - 1\n nextgen_insu_sorted_array << nextgen_insurance_sorted[k][l]\n end\n end\n patpay_array = patpay.values\n nextgen_patpay_array = nextgen_patpay.values\n rejected_array = rejected.values\n\n if config.by_cpid || config.by_nextgen\n @checks_array = []\n @sub_grp_indx_hash = Hash.new{|h, k| h[k] = []}\n @sorted_checks_hash = Hash.new{|h, k| h[k] = []}\n\n if !ideal_insu_sorted_array.blank?\n split_by_ten_checks(ideal_insu_sorted_array, 'ideal_insurance')\n end\n\n if !patpay_array.blank?\n split_by_ten_checks(patpay_array, 'patpay')\n end\n\n if !nextgen_insu_sorted_array.blank?\n split_by_ten_checks(nextgen_insu_sorted_array, 'nextgen_insurance')\n end\n\n if !nextgen_patpay_array.blank?\n key = 'nextgen_patpay'\n @checks_array << nextgen_patpay_array.flatten\n @sub_grp_indx_hash[key] << 0\n @sorted_checks_hash[key] << nextgen_patpay_array.flatten\n\n end\n if !rejected_array.blank?\n key = 'rejected'\n @checks_array << rejected_array.flatten\n @sub_grp_indx_hash[key] << 0\n @sorted_checks_hash[key] << rejected_array.flatten\n end\n\n ordered_group_keys = @sorted_checks_hash.keys\n \n ordered_group_keys.each do |group_key|\n \n @nextgen_patpay = false\n @nextgen_insurance = false\n @ideal_patpay = false\n @ideal_insurance = false\n @rejected = false\n \n group_checks = @sorted_checks_hash[group_key]\n sub_grp_indx_ary = @sub_grp_indx_hash[group_key]\n @nextgen_patpay = group_key.include?(\"nextgen_patpay\")\n @nextgen_insurance = group_key.include?(\"nextgen_insurance\")\n @ideal_patpay = group_key.include?(\"patpay\")\n @ideal_insurance = group_key.include?(\"ideal_insurance\")\n @rejected = group_key.include?(\"rejected\")\n\n @all_check_groups = group_checks\n \n @all_check_groups.each_with_index do |checks, index|\n @sub_group_index = sub_grp_indx_ary[index]\n @checks = checks\n if @sub_group_index == 0\n @payer_name = get_payer_name_in_subtotal_header\n end\n yield\n end\n end\n else\n @checks = chk_grps[group_key]\n yield\n end\n \n else\n @batches.each do |btch| \n @counter = 0\n @current_batch = btch\n if @config.primary_group == \"payer\"\n @all_checks = get_operation_log_checks(@config.job_status_grouping, btch.id)\n groups = @all_checks.group_by{|b| get_payer_criteria(b).to_s}\n if config.by_cpid || config.by_nextgen\n groups.keys.each do |k|\n groups[k] = groups[k].sort{|a,b| payer_name_for_check(a) <=> payer_name_for_check(b)} \n end\n group_keys = groups.keys.sort{|a,b| payer_name_for_check(groups[a].first) <=> payer_name_for_check(groups[b].first)}\n else\n group_keys = groups.keys.sort\n end \n \n group_keys.each_with_index do |k,i|\n @checks = groups[k] \n @generate_batch_summary = true if i == (group_keys.size - 1)\n yield\n end \n \n else\n @checks = get_operation_log_checks(@config.job_status_grouping, btch.id)\n yield\n end\n end\n end\n end",
"def ruby_class_personnel\n # find group in group.txt\n ruby_group = ruby_group_raw_data.find { |line| line.start_with?('c74686')}\n\n # clean up group.txt file data\n members = ruby_group.split(':').slice(3).strip\n\n # turn data into array of member names\n members = members.split(',')\n end",
"def run_these_cases(current_task_files)\n\n \n $RunResults = Hash.new \n $choicefiles = Array.new\n $PIDS = Array.new\n $FinishedTheseFiles = Hash.new \n $RunNumbers = Array.new\n \n $CompletedRunCount = 0 \n $FailedRunCount = 0 \n \n ## Create working directories \n \n $headerline = \"\" \n $outputHeaderPrinted = false \n \n \n current_task_files.each do |choicefile|\n $FinishedTheseFiles[choicefile] = false \n end \n \n $choicefileIndex = 0 \n numberOfFiles = $FinishedTheseFiles.count {|k| k.include?(false)}\n\n \n stream_out (\" - HTAP-prm: begin runs ----------------------------\\n\\n\")\n \n $choicefileIndex = 0 \n $RunsDone = false \n \n $csvColumns = Array.new \n \n # Loop until all files have been processed. \n $GiveUp = false \n \n while ! $RunsDone \n\n $batchCount = $batchCount + 1 \n\n \n stream_out (\" + Batch #{$batchCount} ( #{$choicefileIndex}/#{numberOfFiles} files processed so far...) \\n\" )\n if ( $batchCount == 1 && $snailStart ) then \n \n stream_out (\" |\\n\") \n stream_out (\" +-> NOTE: \\\"SnailStart\\\" is active. Waiting for #{$snailStartWait} seconds between threads (on first batch ONLY!) \\n\\n\")\n \n end \n\n # Empty arrays for current batch. \n $choicefiles.clear\n $PIDS.clear \n $SaveDirs.clear\n \n \n # Compute the number of threads we will start: lesser of a) files remaining, or b) threads allowed.\n $ThreadsNeeded = [$FinishedTheseFiles.count {|k| k.include?(false)}, $gNumberOfThreads].min \n \n #=====================================================================================\n # Multi-threaded runs - Step 1: Spawn threads. \n for thread in 0..$ThreadsNeeded-1 \n \n # For this thread: Get the next choice file in the batch. \n $choicefiles[thread] = current_task_files[$choicefileIndex] \n \n # Get the name of the .h2k file for this thread. \n $H2kFile = $gArchetypeHash[$choicefiles[thread]]\n $Ruleset = $gRulesetHash[$choicefiles[thread]]\n $Location = $gLocationHash[$choicefiles[thread]]\n \n count = thread + 1 \n #stream_out (\" - Starting thread : #{count}/#{$ThreadsNeeded} for file #{$choicefiles[thread]} \")\n stream_out (\" - Starting thread #{count}/#{$ThreadsNeeded} for sim ##{$choicefileIndex+1} \")\n \n \n # For this thread: Get the next choice file in the batch. \n #$choicefiles[thread] = $RunTheseFiles[$choicefileIndex] \n \n \n # Make sure that's a real choice file ( this just duplicates a test above )\n if ( $choicefiles[thread] =~ /.*choices$/ )\n \n # Increment run number and create name for unique simulation directory\n $RunNumber = $RunNumber + 1 \n $RunDirectory = $RunDirs[thread]\n \n \n $SaveDirectory = \"#{$SaveDirectoryRoot}-#{$RunNumber}\"\n \n # Store run number and directory for this thread \n $RunNumbers[thread] = $RunNumber\n $SaveDirs[thread] = $SaveDirectory \n\n # create empty run directory\n if ( ! Dir.exist?($RunDirectory) )\n if ( ! Dir.mkdir($RunDirectory) )\n fatalerror( \" Fatal Error! Could not create #{$RunDirectory} below #{$gMasterPath}!\\n MKDir Return code: #{$?}\\n\" )\n end \n \n else \n # Delete contents, but not H2K folder\n FileUtils.rm_r Dir.glob(\"#{$RunDirectory}/*.*\") \n end \n \n \n \n \n # Copy choice and options file into intended run directory...\n if $choicesInMemory\n choicefile = File.open(\"#{$RunDirectory}/#{$choicefiles[thread]}\", 'w')\n choicefile.write ($ChoiceFileContents[$choicefiles[thread]])\n choicefile.close\n else \n FileUtils.cp($choicefiles[thread],$RunDirectory)\n end \n \n \n FileUtils.cp($gOptionFile,$RunDirectory) \n FileUtils.cp(\"#{$gArchetypeDir}\\\\#{$H2kFile}\",$RunDirectory)\n \n if ( $gComputeCosts ) then \n # Think about error handling. \n FileUtils.cp($gCostingFile,$RunDirectory)\n end \n # ... And get base file names for insertion into the substitute-h2k.rb command.\n $LocalChoiceFile = File.basename $choicefiles[thread] \n $LocalOptionsFile = File.basename $gOptionFile\n \n\n \n # CD to run directory, spawn substitute-h2k thread and save PID \n Dir.chdir($RunDirectory)\n\n if ( $gDebug ) \n FileUtils.cp(\"#{$H2kFile}\",\"#{$H2kFile}-p0\")\n end \n \n \n\n # Possibly call another script to modify the .h2k and .choice files \n \n case $Ruleset\n when /936_2015_AW_HRV/\n subcall = \"perl C:\\\\HTAP\\\\NRC-scripts\\\\apply936-AW.pl #{$H2kFile} #{$LocalChoiceFile} #{$LocalOptionsFile} #{$Location} 1 \"\n system (subcall) \n when /936_2015_AW_noHRV/\n subcall = \"perl C:\\\\HTAP\\\\NRC-scripts\\\\apply936-AW.pl #{$H2kFile} #{$LocalChoiceFile} #{$LocalOptionsFile} #{$Location} 0 \"\n system (subcall) \n end \n\n if ( $gDebug ) \n FileUtils.cp(\"#{$H2kFile}\",\"#{$H2kFile}-p1\")\n end \n \n $SubCostFlag = \"\"\n if ($gComputeCosts ) then \n $SubCostFlag = \"--auto_cost_options\"\n end \n cmdscript = \"ruby #{$gSubstitutePath} -o #{$LocalOptionsFile} -c #{$LocalChoiceFile} -b #{$H2kFile} --report-choices --prm #{$gExtendedOutputFlag} #{$SubCostFlag}\"\n \n # Save command for invoking substitute [ useful in debugging ] \n $cmdtxt = File.open(\"cmd.txt\", 'w') \n $cmdtxt.write cmdscript\n $cmdtxt.close\n \n #debug_out(\" ( cmd: #{cmdscript} | \\n\") \n \n \n pid = Process.spawn( cmdscript, :out => File::NULL, :err => \"substitute-h2k-errors.txt\" ) \n \n\n \n\n $PIDS[thread] = pid \n \n stream_out(\"(PID #{$PIDS[thread]})...\")\n \n \n \n \n # Cd to root, move to next choice file. \n Dir.chdir($gMasterPath)\n \n end \n\n # Snail-Start: \n # This patch is a workaround for instability observed with highly-thread (20+) runs on machines with slow I/O. \n # On the first batch, the substitute script copies the contents of the h2k folder into the working directories (HTAP-work-X),\n # and these folders are subsequently re-used on the following batches. I suspect that windows struggles when 40+ threads are all \n # trying to copy 80+ MB simultaneously to a slow disk; some folders are not created correctly, some files are missing. The \n # result is a bunch of failed runs. \n #\n # Specifying command line option '--snailStart X' causes prm to pause for X seconds after spawning a thread - * on the first batch only *\n # It seems to give a magnetic disk a fighting chance of keeping up with the copy requests. It doesn't appear to slow the simulation \n # down too much, because it only affects the first batch, the H2K folder copy operation appears to be the most expensive part of that first run.\n\n # In tests with 40 threads writing to a magnetic disk, `-- snailStart 6` produces stable runs. \n # A future improvement might modify substitute-h2k.rb to take a hash of the h2k directory content, and verify its integrity before proceeding. \n \n if ( $batchCount == 1 && $snailStart ) then \n \n stream_out (\" *SS-Wait\")\n for wait in 1..5\n \n stream_out (\".\")\n \n sleep($snailStartWait/5)\n \n end \n \n stream_out( \"*\")\n \n end \n \n \n stream_out (\" done. \\n\")\n $choicefileIndex = $choicefileIndex + 1\n \n # Create hash to hold results \n $RunResults[\"run-#{thread}\"] = Hash.new \n \n end \n \n \n # Multi-threaded runs - Step 2: Monitor thread progress\n \n #=====================================================================================\n # Wait for threads to complete \n \n for thread2 in 0..$ThreadsNeeded-1 \n \n count = thread2 + 1 \n \n stream_out (\" - Waiting on PID: #{$PIDS[thread2]} (#{count}/#{$ThreadsNeeded})...\")\n \n Process.wait($PIDS[thread2], 0)\n \n status = $?.exitstatus \n \n if ( status == 0 ) \n \n stream_out (\" done.\\n\")\n \n else \n \n stream_out (\" FAILED! (Exit status: #{status})\\n\")\n \n $RunResults[\"run-#{thread2}\"][\"s.success\"] = \"false\"\n $RunResults[\"run-#{thread2}\"][\"s.errors@99\"] = \" Run failed - substitute-h2k.rb returned status #{status}\"\n \n end \n \n end \n \n #=====================================================================================\n # Multi-threaded runs - Step 3: Post-process and clean up. \n \n \n \n for thread3 in 0..$ThreadsNeeded-1 \n count = thread3 + 1 \n stream_out (\" - Reading results files from PID: #{$PIDS[thread3]} (#{count}/#{$ThreadsNeeded})...\")\n \n Dir.chdir($RunDirs[thread3])\n \n\n $RunResults[\"run-#{thread3}\"][\"c.RunNumber\"] = \"#{$RunNumbers[thread3].to_s}\"\n $RunResults[\"run-#{thread3}\"][\"c.RunDirectory\"] = \"#{$RunDirs[thread3].to_s}\"\n $RunResults[\"run-#{thread3}\"][\"c.SaveDirectory\"] = \"#{$SaveDirs[thread3].to_s}\"\n $RunResults[\"run-#{thread3}\"][\"c.ChoiceFile\"] = \"#{$choicefiles[thread3].to_s}\"\n \n $runFailed = false\n \n # Parse contents of substitute-h2k-errors.txt, which may contain ruby errors if substitute-h2k.rb did \n # not execute correctly. \n $RunResults[\"run-#{thread3}\"][\"s.substitute-h2k-err-msgs\"] = \"nil\"\n \n if ( File.exist?(\"substitute-h2k-errors.txt\") )\n $errmsgs= File.read(\"substitute-h2k-errors.txt\")\n $errmsgs_chk = $errmsgs\n if ( ! $errmsgs_chk.gsub(/\\n*/,\"\").gsub( / */, \"\").empty? ) \n $RunResults[\"run-#{thread3}\"][\"s.substitute-h2k-err-msgs\"] = $errmsgs \n end \n \n end \n \n \n if ( File.exist?($RunResultFilename) ) \n \n contents = File.open($RunResultFilename, 'r') \n \n \n ec=0\n wc=0 \n \n \n \n lineCount = 0\n contents.each do |line|\n lineCount = lineCount + 1\n line_clean = line.gsub(/ /, '')\n line_clean = line.gsub(/\\n/, '')\n if ( ! line_clean.to_s.empty? ) \n $contents = Array.new \n $contents = line_clean.split('=')\n token = $contents[0].gsub(/\\s*/,'') \n value = $contents[1].gsub(/^\\s*/,'') \n value = $contents[1].gsub(/^ /,'')\n value = $contents[1].gsub(/ +$/,'')\n \n \n # add prefix to \n case token \n when /s.error/ \n token.concat(\"@#{ec}\")\n ec = ec + 1\n when /s.warning/\n token.concat(\"@#{wc}\")\n wc=wc+1 \n end \n $RunResults[\"run-#{thread3}\"][token] = value\n end \n \n end \n contents.close\n\n if $RunResults[\"run-#{thread3}\"][\"s.success\"] =~ /false/ then \n $runFailed = true\n stream_out (\" done (with errors).\\n\")\n else\n stream_out (\" done.\\n\")\n end \n \n \n \n \n\n \n else \n \n stream_out (\" Output couldn't be found! \\n\")\n $runFailed = true \n \n #stream_out (\" RUN FAILED! (see dir: #{$SaveDirs[thread3]}) \\n\")\n $failures.write \"#{$choicefiles[thread3]} (dir: #{$SaveDirs[thread3]}) - no output from substitute-h2k.rb\\n\"\n $FailedRuns.push \"#{$choicefiles[thread3]} (dir: #{$SaveDirs[thread3]}) - no output from substitute-h2k.rb\"\n $FailedRunCount = $FailedRunCount + 1\n \n $RunResults[\"run-#{thread3}\"][\"s.success\"] = \"false\"\n $RunResults[\"run-#{thread3}\"][\"s.errors@99\"] = \" Run failed - no output generated\"\n \n $LocalChoiceFile = File.basename $gOptionFile\n if ( ! FileUtils.rm_rf(\"#{$RunDirs[thread3]}/#{$LocalChoiceFile}\") )\n warn_out(\" Warning! Could delete #{$RunDirs[thread3]} rm_fr Return code: #{$?}\\n\" )\n end \n \n \n end \n \n Dir.chdir($gMasterPath) \n \n # Save files from runs that failed, or possibly all runs. \n if ( $gSaveAllRuns || $runFailed ) \n \n if ( ! Dir.exist?($SaveDirs[thread3]) ) \n \n Dir.mkdir($SaveDirs[thread3]) \n \n else \n \n FileUtils.rm_rf Dir.glob(\"#{$SaveDirs[thread3]}/*.*\") \n \n end \n \n FileUtils.mv( Dir.glob(\"#{$RunDirs[thread3]}/*.*\") , \"#{$SaveDirs[thread3]}\" ) \n FileUtils.rm_rf (\"#{$RunDirs[thread3]}/sim-output\")\n end \n \n #Update status of this thread. \n $FinishedTheseFiles[$choicefiles[thread3]] = true \n \n \n end \n \n errs = \"\" \n stream_out (\" - Post-processing results... \") \n\n $outputlines = \"\"\n \n row = 0 \n \n \n # Alternative output in JSON format. Can be memory-intensive\n if ( $gJSONize ) \n \n \n $RunResults.each do |run,data|\n \n $gJSONAllData[$gHashLoc] = Hash.new\n $gJSONAllData[$gHashLoc] = { \"result-number\" => $gHashLoc+1, \n \"status\" => Hash.new,\n \"archetype\" => Hash.new, \n \"input\" => Hash.new, \n \"output\" => Hash.new, \n \"configuration\" => Hash.new,\n \"miscellaneous_info\" => Hash.new } \n \n # Storage for arrays. \n $gJSONAllData[$gHashLoc][\"status\"] = { \"warnings\" => Array.new, \"errors\" => Array.new } \n \n # Storage for binned data\n if ( $gExtendedOutputFlag =~ /-e/ ) \n $gJSONAllData[$gHashLoc][\"output\"] = { \"BinnedData\" => Hash.new } \n $gJSONAllData[$gHashLoc][\"output\"][\"BinnedData\"] = Array.new \n for counter in 0..31\n $gJSONAllData[$gHashLoc][\"output\"][\"BinnedData\"][counter] = Hash.new \n $gJSONAllData[$gHashLoc][\"output\"][\"BinnedData\"][counter][\"bin\"] = counter+1\n end\n else \n $gJSONAllData[$gHashLoc][\"output\"] = { \"BinnedData\" => \"No binned data to report for run ##{$gHashLoc}. Run htap-prm with '-e' to enable\" } \n end \n\n data.each do |token,value|\n \n \n #Detect the type of this token from prefix\n $col_tmp = token.to_s.gsub(/\\s*/, '') \n \n case $col_tmp\n when /^input\\./ , /^i\\./ \n $col_type = \"input\"\n when /^output\\./ , /^o\\./ \n $col_type = \"output\"\n when /^arch\\./ , /^a\\./ \n $col_type = \"archetype\" \n when /^config\\./ , /^c\\./ \n $col_type = \"configuration\" \n when /^status\\./ , /^s\\./ \n $col_type = \"status\" \n else \n $col_type = \"miscellaneous_info\"\n end \n \n # And get remaining text after the '.'\n $col_txt = $col_tmp.to_s.gsub(/^[^\\.]+\\./,'')\n \n # Then store data in the appropriate location \n case $col_txt \n when /error/ \n \n $gJSONAllData[$gHashLoc][\"status\"][\"errors\"].push( value.to_s.gsub(/\"/,'') )\n \n when /warning/ \n \n $gJSONAllData[$gHashLoc][\"status\"][\"warnings\"].push( value.to_s.gsub(/\"/,'') ) \n \n when /BIN-data/\n # format is 'BIN-data-TYPE-##'; Split out TYPE and ##\n $bin_type = Array.new\n $bin_type = $col_txt.gsub(/BIN-data-/, '').split(\"-\") \n $bin_row = $bin_type[1].to_i - 1 \n # Store data in array, based on type.\n \n case $bin_type[0].to_s\n when /HRS/ \n $gJSONAllData[$gHashLoc][\"output\"][\"BinnedData\"][$bin_row][\"CumulativeHrs\"] = value.to_f\n \n when /TMP/ \n $gJSONAllData[$gHashLoc][\"output\"][\"BinnedData\"][$bin_row][\"Temperature_oC\"] = value.to_f\n \n when /HLR/ \n $gJSONAllData[$gHashLoc][\"output\"][\"BinnedData\"][$bin_row][\"HeatLossRateW\"] = value.to_f\n \n when /T2cap/ \n $gJSONAllData[$gHashLoc][\"output\"][\"BinnedData\"][$bin_row][\"Type2Capacity\"] = value.to_f\n \n when /T2PLR/ \n $gJSONAllData[$gHashLoc][\"output\"][\"BinnedData\"][$bin_row][\"Type2PartLoadRatio\"] = value.to_f \n \n when /T1PLR/ \n $gJSONAllData[$gHashLoc][\"output\"][\"BinnedData\"][$bin_row][\"Type1PartLoadRatio\"] = value.to_f \n end \n \n else \n \n \n # format according to data type \n case value.to_s.gsub(/\\s*/, '') \n when /^[0-9\\-]+$/ \n $gJSONAllData[$gHashLoc][\"#{$col_type}\"][\"#{$col_txt}\"] = value.to_i\n \n when /^[0-9\\.\\-E]+$/ \n $gJSONAllData[$gHashLoc][\"#{$col_type}\"][\"#{$col_txt}\"] = value.to_f\n \n else \n $gJSONAllData[$gHashLoc][\"#{$col_type}\"][\"#{$col_txt}\"] = value.to_s.gsub(/^\\s*/, '').gsub( /\\s*$/,'')\n\n end\n \n \n \n end \n \n \n end # ends data.each do \n \n # Arr err/warn empty? if so, put 'nil'\n if ( $gJSONAllData[$gHashLoc][\"status\"][\"errors\"].empty? ) \n \n $gJSONAllData[$gHashLoc][\"status\"][\"errors\"].push \"nil\"\n \n end \n \n if ( $gJSONAllData[$gHashLoc][\"status\"][\"warnings\"].empty? ) \n \n $gJSONAllData[$gHashLoc][\"status\"][\"warnings\"].push \"nil\"\n \n end \n \n \n \n # Test to see if the run was successful. Flag if not, otherwise increment completed counter. \n \n if ( $gJSONAllData[$gHashLoc][\"status\"][\"success\"] == \"false\" ) then \n \n $runFailed = true \n errs=\" *** simulation errors found ***\"\n $msg = \"#{$gJSONAllData[$gHashLoc][\"configuration\"][\"ChoiceFile\"]} (dir: #{$gJSONAllData[$gHashLoc][\"configuration\"][\"SaveDirectory\"]}) - substitute-h2k.rb reports errors\"\n $failures.write \"$msg\\n\"\n $FailedRuns.push $msg \n $FailedRunCount = $FailedRunCount + 1\n\n else \n \n $CompletedRunCount = $CompletedRunCount + 1 \n \n end \n\n \n # Increment hash increment too. \n $gHashLoc = $gHashLoc + 1 \n\n if ( $runFailed && $StopOnError ) then \n $RunsDone = true \n $GiveUp = true \n end \n\n\n \n \n end # ends $RunResults.each do\n \n \n end # Ends if JSON.\n \n \n $RunResults.each do |run,data|\n \n # Only write out data from successful runs - this helps prevent corrupted databae \n \n \n if ( data['s.success'] =~ /true/ ) then\n \n if ( ! $outputHeaderPrinted ) then \n # Deal with header first \n data.sort.to_h \n data.each do |column,value|\n \n case column \n when /s\\.error/, /s\\.warning/, /BIN-data/\n # Do nothing \n else \n \n $csvColumns.push column\n $headerline.concat(\"#{column.to_s},\")\n end \n end \n $outputHeaderPrinted = true \n $headerline.concat(\"\\n\")\n $outputCSV.write($headerline) \n end \n \n $csvColumns.each do |key|\n \n $outputlines.concat(\"#{data[key]},\")\n \n end\n \n $outputlines.concat(\"\\n\")\n \n end \n \n end \n \n $outputCSV.write($outputlines) \n $outputCSV.flush\n $failures.flush \n \n $RunResults.clear\n \n stream_out (\"done.#{errs}\\n\\n\")\n\n if ( ! $FinishedTheseFiles.has_value?(false) ) \n \n $RunsDone = true \n \n end \n \n\n end \n \n \n if ( $GiveUp ) then \n stream_out(\" - HTAP-prm: runs terminated due to error ----------\\n\\n\")\n else \n stream_out(\" - HTAP-prm: runs finished -------------------------\\n\\n\")\n end \n \n if ($gJSONize )\n stream_out(\" - Writing JSON output to HTAP-prm-output.json... \")\n $JSONoutput = File.open($gOutputJSON, 'w') \n $JSONoutput.write(JSON.pretty_generate($gJSONAllData))\n $JSONoutput.close \n stream_out(\"done.\\n\\n\")\n end \n \n \n if ( ! $gDebug ) then \n stream_out (\" - Deleting working directories... \") \n FileUtils.rm_rf Dir.glob(\"HTAP-work-*\") \n stream_out(\"done.\\n\\n\")\n end\n \nend",
"def test_cases\n @test_cases ||= Dir.glob(model.spec_dir + '**/**/?*Spec.as')\n end",
"def run_it\n run_through_directory\n file_array_parser\n remove_initial_and_format_change\n array_to_hash\n final_name_info\n create_goal_file\nend",
"def testing_begin(files)\n end",
"def testReuseMixWithSourceFilesProcessed\n lProcessID = {\n :Param1 => 'TestParam1'\n }.unique_id\n execute_Mix_WithConf({\n :WaveFiles => {\n :FilesList => [\n {\n :Name => 'Wave.wav'\n }\n ]\n },\n :Mix => {\n 'Mix1' => {\n :Tracks => {\n 'Wave.wav' => {\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n }\n }\n },\n 'Final' => {\n :Tracks => {\n 'Mix1' => {\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam2'\n }\n ]\n }\n }\n }\n }\n },\n :PrepareFiles => [\n [ 'Wave/Empty.wav', 'Wave.wav' ],\n [ 'Wave/Noise1s.wav', \"05_Mix/Wave.0.Test.#{lProcessID}.wav\" ]\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Wave.0.Test.0.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => \"05_Mix/Wave.0.Test.#{lProcessID}.wav\",\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam2'\n }\n }\n ], 'Process_Test.rb'\n assert_wave_lnk 'Noise1s', '05_Mix/Final/Mix1.wav'\n assert_wave_lnk 'Noise1s', '05_Mix/Final/Final.wav'\n end\n end",
"def single_class_test(testing_class)\n cur_testing_class = Generator.new(testing_class, @traversal)\n TestFile.open(testing_class,[],@output_dir) do |file|\n cur_testing_class.test_class do |test|\n file << test << \"\\n\"\n end\n end\n end",
"def testProcessesOrder1Track\n execute_Mix_WithConf({\n :WaveFiles => {\n :FilesList => [\n {\n :Name => 'Wave.wav'\n }\n ]\n },\n :Mix => {\n 'Final' => {\n :Tracks => {\n 'Wave.wav' => {\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n }\n },\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam2'\n }\n ]\n }\n }\n },\n :PrepareFiles => [\n [ 'Wave/Empty.wav', 'Wave.wav' ]\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Wave.0.Test.????????????????????????????????.wav')\n lWave1FileName = getFileFromGlob('05_Mix/Wave.1.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => 'Wave.wav',\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam1'\n }\n },\n {\n :InputFileName => lWave0FileName,\n :OutputFileName => lWave1FileName,\n :Params => {\n :Param1 => 'TestParam2'\n }\n }\n ], 'Process_Test.rb'\n assert_wave_lnk 'Empty', '05_Mix/Final/Final.wav'\n end\n end",
"def run(files)\n file = files.first\n puts \"** Running #{file}\"\n \n class_filename = file.sub(self.class::CLASS_MAP, '')\n \n # get the class\n test_class = resolve_classname(class_filename)\n \n # create dummy wrapper modules if test is in subfolder\n test_class.split('::').each do |part|\n eval \"module ::#{part}; end\" if !part.match('Test')\n end\n \n begin \n clear_class(test_class.constantize) \n rescue NameError \n \n end\n \n # TODO: make this reload use load_file\n $\".delete(file)\n \n begin\n require file\n rescue LoadError\n notifier.error(\"Error in #{file}\", $!)\n puts $!\n return\n rescue ArgumentError\n notifier.error(\"Error in #{file}\", $!)\n puts $!\n return\n rescue SyntaxError\n notifier.error(\"Error in #{file}\", $!)\n puts $!\n return\n end\n \n # TODO: change that to run multiple suites\n #klass = Kernel.const_get(test_class) - this threw errors\n klass = eval(test_class)\n \n Test::Unit::UI::Console::TestRunner.run(klass)\n Test::Unit.run = false\n \n # Invoke method to test that writes to stdout.\n result = test_io.string.to_s.dup\n\n # clear the buffer \n test_io.truncate(0)\n \n # sent result to notifier\n notifier.result(file, result.split(\"\\n\").compact.last)\n\n # sent result to stdio\n puts result\n \n end",
"def evaluation_with_tests_directory\n @tests_names = tests_names_building(@evaluation_value)\n end",
"def run\n runner = self\n @test_cases.each do |path|\n next if ENV['TEST_CASE'] && !File.basename(path).match(ENV['TEST_CASE'])\n\n Aws::ModelValidators.load_json(path).tap do |test_case|\n\n models = test_case.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }\n errors = models.delete(:errors)\n\n @group.it(File.basename(path[0..-6])) do\n pending unless errors\n results = described_class.new.validate(models, apply_schema: false)\n unless runner.results_match?(results, errors)\n expect(results).to eq(errors)\n end\n end\n\n end\n end\n end",
"def start\n init()\n set_sending_patterns()\n\n membership_str = \"\"\n $groups.each do |g|\n str = \"Member of Group #{g}: \"\n $members[g].each { |n| str << (n.to_s + \" \") }\n membership_str << str << \"\\n\"\n end\n\n all_runs()\n\n puts membership_str\n $patterns_file.close\nend",
"def test_reuse_single_file2\n CheckFile @writer, @ioservice, @adlers, 'try with try with', ['try w', 'ith ', 'try w', 'ith']\n end",
"def analyzer(logs_folder='log/bdsp_logs/all')\n @classes = { \"models\" => { 'mtds' => {} }, \"controllers\" => { 'mtds' => {} }, \"other\" => { 'mtds' => {} } }\n @methods = { \"models\" => {}, \"controllers\" => {}, \"other\" => {} }\n @features = {}\n logfiles = Dir[logs_folder+\"/*\"]\n logfiles.each do |logfile|\n logfile_name = logfile.split('/')[-1]\n puts \"Starting on #{logfile_name}\"\n @story_classes = { \"models\" => { 'mtds' => {} }, \"controllers\" => { 'mtds' => {} }, \"other\" => { 'mtds' => {} } }\n @story_methods = { \"models\" => {}, \"controllers\" => {}, \"other\" => {} }\n File.open(logfile, 'r') do |tp_log|\n tp_log.each_line do |logline|\n log_entry = logline.split(',').each {|l| l.strip! }\n kinds = ['models','controllers'] ; kind = 'other'\n kinds.each { |k| kind = log_entry[0].include?(k) ? k : kind} \n klasses = log_entry[1].split(':').reject(&:empty?)\n if kind == 'models'\n eval_klass = \"@classes['#{kind}']\"\n eval_story_klass = \"@story_classes['#{kind}']\"\n klasses.each.with_index(1) do |klass, idx|\n if idx == klasses.length\n eval(\"#{eval_klass}['mtds']['#{klass}'] = #{eval_klass}['mtds'][#{'klass'}].try(:next) || 1\")\n eval(\"#{eval_story_klass}['mtds']['#{klass}'] = #{eval_story_klass}['mtds']['#{klass}'].try(:next) || 1\")\n @methods[\"#{kind}\"][\"#{klasses[idx-2]}:#{klass}\"] ||= Set.new\n @story_methods[\"#{kind}\"][\"#{klasses[idx-2]}:#{klass}\"] ||= Set.new\n @methods[\"#{kind}\"][\"#{klasses[idx-2]}:#{klass}\"].add(log_entry[3])\n @story_methods[\"#{kind}\"][\"#{klasses[idx-2]}:#{klass}\"].add(log_entry[3])\n elsif idx == 1\n eval(eval_klass+\"['#{klass}'] ||= {'mtds' => {}, 'bdt_scenarios' => Set.new}\")\n eval(eval_klass+\"['#{klass}']['bdt_scenarios'].add(log_entry[3])\")\n eval(eval_story_klass+\"['#{klass}'] ||= {'mtds' => {}, 'bdt_scenarios' => Set.new}\")\n eval(eval_story_klass+\"['#{klass}']['bdt_scenarios'].add(log_entry[3])\")\n else\n eval(eval_klass+\"['#{klass}'] ||= {'mtds' => {} }\")\n eval(eval_story_klass+\"['#{klass}'] ||= {'mtds' => {} }\")\n end\n eval_klass += \"['#{klass}']\"\n eval_story_klass += \"['#{klass}']\"\n end\n end\n end\n end\n @features[logfile_name] = {\"classes\" => @story_classes, \"methods\" => @story_methods}\n end\n return @classes, @methods, @features\n # return [@classes, @user_stories, @scenarios, @steps]\n end",
"def generate_alltest\n\n end",
"def <<(example_group_map)\n example_groups[example_group_map.uid] = example_group_map.used_files.uniq\n end",
"def get_test_results_from_file(fn)\n results = { :pass => [], :fail => [], :error => [], :test_method_file => [] }\n\n if fn =~ /^http/\n content = open(fn).read\n else\n content = File.read(fn)\n end\n\n doc = REXML::Document.new content\n root = doc.root\n\n REXML::XPath.each(root, \"//testcase\") do |tc|\n\n name = tc.attributes['name']\n classname = tc.attributes['classname']\n fullname = classname + \":\" + name\n\n # mapping between file and method.\n test_method_file_map = { name => tc.attributes['file_path']}\n\n if child = tc.elements[1]\n case child.name\n when \"error\"\n results[:error] << fullname\n results[:test_method_file] << test_method_file_map\n when \"failure\"\n results[:fail] << fullname\n results[:test_method_file] << test_method_file_map\n else\n results[:pass] << fullname\n end\n end\n end\n results\n end",
"def test_class_label\n Allure::ResultUtils.test_class_label(File.basename(example.file_path, \".rb\"))\n end",
"def main\n\n\tOptionParser.accept(Range, /(\\d+)\\.\\.(\\d+)/) do |range,start,finish|\n\t\tRange.new(start.to_i,finish.to_i)\n\tend\n\n\tOptionParser.accept(Magick::Pixel,/(\\d+),(\\d+),(\\d+),(\\d+)/) do |pixel, r,g,b,a|\n\t\tMagick::Pixel.new(r.to_f,g.to_f,b.to_f,a.to_f)\n\tend\n\n\toptions = {}\n\n\topts = OptionParser.new do |opts|\n\t\topts.banner = \"Image Tiler for Google Maps\\nUsage: tile_image.rb [options] IMAGE_FILE \\nExample: tile_image.rb -o ./tiles -z 11..12 -p 602,768,11,78,112,1.91827348 ./input_files/map.jpg\"\n\t\topts.separator \"\" \n\t\topts.on(\"-o\",\"--output OUTPUT_DIR\",\"Directory where the tiles will be created\") do |dir| \n\t\t\toptions[:output_dir] = dir\n\t\tend\n\t\topts.on(\"-f\",\"--format FORMAT\",\"Image format in which to get the file (gif, jpeg, png...). Is jpg by default\") do |format|\n\t\t\toptions[:format] = format\n\t\tend\n\t\topts.on(\"-z\",\"--zoom_levels ZOOM_RANGE\",Range,\"Range of zoom values at which the tiles must be generated. Is 0..4 by default\") do |range|\n\t\t\toptions[:zoom_levels] = range\n\t\tend\n\t\topts.on(\"-b\",\"--background COLOR\",Magick::Pixel,\"Background color components. Is fully transparent par default\") do |bg|\n\t\t\toptions[:bg_color] = bg\n\t\tend\n\t\topts.on(\"-p\",\"--prefix PREFIX\",\"Prefix to file output. Is 'tile' by default\") do |prefix|\n\t\t\toptions[:prefix] = prefix\n\t\tend\n\t\topts.on_tail(\"-h\", \"--help\", \"Show this message\") do\n\t\t\tputs opts\n\t\t\texit\n\t\tend\n\tend\n\n\topts.parse!(ARGV)\n\n\t#test the presence of all the options and exit with an error message\n\terror = []\n\terror << \"No output directory defined (-o,--output)\" if options[:output_dir].nil?\n\terror << \"No input files defined\" if ARGV.empty?\n\n\tunless error.empty?\n\t\tputs error * \"\\n\" + \"\\n\\n\"\n\t\tputs opts\n\t\texit\n\tend\n\n\tt = Tiler.new\n\tt.make_tiles(ARGV[0], options) # ignore all input files but first\n\nend",
"def tests_for_file(filename)\n super.select { |f| @files.has_key? f }\n end",
"def create_test_output_file(test_output_file_path)\n mark_file_content = collect_mark_file_content\n\n test_file_content = mark_file_content.map do | element |\n if element.kind_of?(Array)\n element.map! { |array_content| array_content.to_s.gsub(/::.*\\z/,'::') }\n else\n element\n end\n end\n\n # Write test output contents to file.\n File.open(test_output_file_path, \"w+\") do |file|\n file.puts(test_file_content)\n end\n end",
"def run_find_missing_keys\n @key_hash = Hash.new\n @missing_keys = Array.new\n @white_list = Hash.new\n get_args\n get_files_directory(@file_to_check)\n check_missing_keys\nend",
"def compare_results(bldg_types, vintages, climate_zones, file_ext=\"\")\n \n #### Compare results against legacy idf results \n acceptable_error_percentage = 10 # Max 5% error for any end use/fuel type combo\n failures = []\n \n # Load the legacy idf results JSON file into a ruby hash\n temp = File.read(\"#{Dir.pwd}/legacy_idf_results.json\")\n legacy_idf_results = JSON.parse(temp) \n \n # List of all fuel types\n fuel_types = ['Electricity', 'Natural Gas', 'Additional Fuel', 'District Cooling', 'District Heating', 'Water']\n\n # List of all end uses\n end_uses = ['Heating', 'Cooling', 'Interior Lighting', 'Exterior Lighting', 'Interior Equipment', 'Exterior Equipment', 'Fans', 'Pumps', 'Heat Rejection','Humidification', 'Heat Recovery', 'Water Systems', 'Refrigeration', 'Generators']\n\n # Create a hash of hashes to store all the results from each file\n all_results_hash = Hash.new{|h,k| h[k]=Hash.new(&h.default_proc) }\n \n # Create a hash of hashes to store the results from each file\n results_total_hash = Hash.new{|h,k| h[k]=Hash.new(&h.default_proc) }\n\n # Loop through all of the given combinations\n bldg_types.sort.each do |building_type|\n vintages.sort.each do |building_vintage|\n climate_zones.sort.each do |climate_zone|\n puts \"**********#{building_type}-#{building_vintage}-#{climate_zone}******************\"\n # Open the sql file, skipping if not found\n model_name = \"#{building_type}-#{building_vintage}-#{climate_zone}\"\n sql_path_string = \"#{Dir.pwd}/build/#{model_name}/ModelToIdf/ExpandObjects-0/EnergyPlusPreProcess-0/EnergyPlus-0/eplusout.sql\"\n sql_path = OpenStudio::Path.new(sql_path_string)\n sql = nil\n if OpenStudio.exists(sql_path)\n puts \"Found SQL file.\"\n sql = OpenStudio::SqlFile.new(sql_path)\n else\n failures << \"****Error - #{model_name} - Could not find sql file\"\n puts \"**********no sql here #{sql_path}******************\"\n next\n end\n\n # Create a hash of hashes to store the results from each file\n results_hash = Hash.new{|h,k| h[k]=Hash.new(&h.default_proc) }\n\n # Get the osm values for all fuel type/end use pairs\n # and compare to the legacy idf results\n total_legacy_energy_val = 0\n total_osm_energy_val = 0\n total_legacy_water_val = 0\n total_osm_water_val = 0\n fuel_types.each do |fuel_type|\n end_uses.each do |end_use|\n next if end_use == 'Exterior Equipment'\n # Get the legacy results number\n legacy_val = legacy_idf_results.dig(building_type, building_vintage, climate_zone, fuel_type, end_use)\n # Combine the exterior lighting and exterior equipment\n if end_use == 'Exterior Lighting'\n legacy_exterior_equipment = legacy_idf_results.dig(building_type, building_vintage, climate_zone, fuel_type, 'Exterior Equipment')\n unless legacy_exterior_equipment.nil?\n legacy_val += legacy_exterior_equipment\n end\n end\n\n #legacy_val = legacy_idf_results[building_type][building_vintage][climate_zone][fuel_type][end_use]\n if legacy_val.nil?\n failures << \"Error - #{model_name} - #{fuel_type} #{end_use} legacy idf value not found\"\n next\n end\n\n # Add the energy to the total\n if fuel_type == 'Water'\n total_legacy_water_val += legacy_val\n else\n total_legacy_energy_val += legacy_val\n end\n\n # Select the correct units based on fuel type\n units = 'GJ'\n if fuel_type == 'Water'\n units = 'm3'\n end\n\n # End use breakdown query\n energy_query = \"SELECT Value FROM TabularDataWithStrings WHERE (ReportName='AnnualBuildingUtilityPerformanceSummary') AND (ReportForString='Entire Facility') AND (TableName='End Uses') AND (ColumnName='#{fuel_type}') AND (RowName = '#{end_use}') AND (Units='#{units}')\"\n\n # Get the end use value\n osm_val = sql.execAndReturnFirstDouble(energy_query)\n if osm_val.is_initialized\n osm_val = osm_val.get\n else\n failures << \"Error - #{model_name} - No sql value found for #{fuel_type}-#{end_use} via #{energy_query}\"\n osm_val = 0\n end\n\n # Combine the exterior lighting and exterior equipment\n if end_use == 'Exterior Lighting'\n # End use breakdown query\n energy_query = \"SELECT Value FROM TabularDataWithStrings WHERE (ReportName='AnnualBuildingUtilityPerformanceSummary') AND (ReportForString='Entire Facility') AND (TableName='End Uses') AND (ColumnName='#{fuel_type}') AND (RowName = 'Exterior Equipment') AND (Units='#{units}')\"\n\n # Get the end use value\n osm_val_2 = sql.execAndReturnFirstDouble(energy_query)\n if osm_val_2.is_initialized\n osm_val_2 = osm_val_2.get\n else\n failures << \"Error - #{model_name} - No sql value found for #{fuel_type}-Exterior Equipment via #{energy_query}\"\n osm_val_2 = 0\n end\n osm_val += osm_val_2\n end\n\n # Add the energy to the total\n if fuel_type == 'Water'\n total_osm_water_val += osm_val\n else\n total_osm_energy_val += osm_val\n end\n\n # Calculate the error and check if less than\n # acceptable_error_percentage\n percent_error = nil\n add_to_all_results = true\n if osm_val > 0 && legacy_val > 0\n # If both\n percent_error = ((osm_val - legacy_val)/legacy_val) * 100\n if percent_error.abs > acceptable_error_percentage\n failures << \"#{building_type}-#{building_vintage}-#{climate_zone}-#{fuel_type}-#{end_use} Error = #{percent_error.round}% (#{osm_val}, #{legacy_val})\"\n end\n elsif osm_val > 0 && legacy_val.abs < 1e-6\n # The osm has a fuel/end use that the legacy idf does not\n percent_error = 1000\n failures << \"#{building_type}-#{building_vintage}-#{climate_zone}-#{fuel_type}-#{end_use} Error = osm has extra fuel/end use that legacy idf does not (#{osm_val})\"\n elsif osm_val.abs < 1e-6 && legacy_val > 0\n # The osm has a fuel/end use that the legacy idf does not\n percent_error = 1000\n failures << \"#{building_type}-#{building_vintage}-#{climate_zone}-#{fuel_type}-#{end_use} Error = osm is missing a fuel/end use that legacy idf has (#{legacy_val})\"\n else\n # Both osm and legacy are == 0 for this fuel/end use, no error\n percent_error = 0\n add_to_all_results = false\n end\n\n results_hash[building_type][building_vintage][climate_zone][fuel_type][end_use]['Legacy Val'] = legacy_val.round(2)\n results_hash[building_type][building_vintage][climate_zone][fuel_type][end_use]['OpenStudio Val'] = osm_val.round(2)\n results_hash[building_type][building_vintage][climate_zone][fuel_type][end_use]['Percent Error'] = percent_error.round(2)\n results_hash[building_type][building_vintage][climate_zone][fuel_type][end_use]['Absolute Error'] = (legacy_val-osm_val).abs.round(2)\n\n if add_to_all_results\n all_results_hash[building_type][building_vintage][climate_zone][fuel_type][end_use]['Legacy Val'] = legacy_val.round(2)\n all_results_hash[building_type][building_vintage][climate_zone][fuel_type][end_use]['OpenStudio Val'] = osm_val.round(2)\n all_results_hash[building_type][building_vintage][climate_zone][fuel_type][end_use]['Percent Error'] = percent_error.round(2)\n all_results_hash[building_type][building_vintage][climate_zone][fuel_type][end_use]['Absolute Error'] = (legacy_val-osm_val).abs.round(2)\n end\n\n end # Next end use\n end # Next fuel type\n\n # Calculate the overall energy error\n total_percent_error = nil\n if total_osm_energy_val > 0 && total_legacy_energy_val > 0\n # If both\n total_percent_error = ((total_osm_energy_val - total_legacy_energy_val)/total_legacy_energy_val) * 100\n failures << \"#{building_type}-#{building_vintage}-#{climate_zone} *** Total Energy Error = #{total_percent_error.round}% ***\"\n elsif total_osm_energy_val > 0 && total_legacy_energy_val == 0\n # The osm has a fuel/end use that the legacy idf does not\n total_percent_error = 1000\n failures << \"#{building_type}-#{building_vintage}-#{climate_zone} *** Total Energy Error = osm has extra fuel/end use that legacy idf does not (#{total_osm_energy_val})\"\n elsif total_osm_energy_val == 0 && total_legacy_energy_val > 0\n # The osm has a fuel/end use that the legacy idf does not\n total_percent_error = 1000\n failures << \"#{building_type}-#{building_vintage}-#{climate_zone} *** Total Energy Error = osm is missing a fuel/end use that legacy idf has (#{total_legacy_energy_val})\"\n else\n # Both osm and legacy are == 0 for, no error\n total_percent_error = 0\n failures << \"#{building_type}-#{building_vintage}-#{climate_zone} *** Total Energy Error = both idf and osm don't use any energy.\"\n end\n \n results_total_hash[building_type][building_vintage][climate_zone] = total_percent_error\n\n # Save the results to JSON\n File.open(\"#{Dir.pwd}/build/#{model_name}/comparison#{file_ext}.json\", 'w') do |file|\n file << JSON::pretty_generate(results_hash)\n end\n end\n end\n end\n\n # Get all the fuel type and end user combination\n all_fuel_end_user_hash = Hash.new{|h,k| h[k]=Hash.new(&h.default_proc) }\n all_results_hash.each_pair do |building_type, value1|\n value1.each_pair do |building_vintage, value2|\n value2.each_pair do |climate_zone, value3|\n value3.each_pair do |fuel_type, value4|# fuel type\n value4.each_pair do |end_use, value5| # end use\n all_fuel_end_user_hash[fuel_type][end_use] = true\n end\n end\n end\n end\n end\n\n # Fill in the missing value with 0,0,0\n all_results_hash.each_pair do |building_type, value1|\n value1.each_pair do |building_vintage, value2|\n value2.each_pair do |climate_zone, value3|\n all_fuel_end_user_hash.each_pair do |fuel_type, end_users|\n end_users.each_pair do |end_use, value|\n if value3[fuel_type][end_use].empty?\n value3[fuel_type][end_use]['Legacy Val'] = 0\n value3[fuel_type][end_use]['OpenStudio Val'] = 0\n value3[fuel_type][end_use]['Percent Error'] = 0\n value3[fuel_type][end_use]['Absolute Error'] = 0\n end\n end\n end\n end\n end\n end\n\n fuel_type_names = []\n end_uses_names =[]\n\n all_fuel_end_user_hash.each_pair do |fuel_type, end_users|\n end_users.each_pair do |end_use, value|\n fuel_type_names.push(fuel_type)\n end_uses_names.push(end_use)\n end\n end\n \n #######\n # results_total_hash[building_type][building_vintage][climate_zone]\n csv_file_total = File.open(\"#{Dir.pwd}/build/comparison_total#{file_ext}.csv\", 'w')\n # Write the header\n csv_file_total.write(\"building_type,building_vintage,climate_zone,\")\n line2_str =\",,,\"\n #results_hash=Hash[building_type][building_vintage][climate_zone][fuel_type][end_use]['Legacy Val']\n results_total_hash.values[0].values[0].each_pair do |climate_zone, total_error|\n csv_file_total.write(\"#{total_error},\")\n end\n csv_file_total.write(\"\\n\")\n # Save the results to CSV\n results_total_hash.each_pair do |building_type, value1|\n value1.each_pair do |building_vintage, value2|\n value2.each_pair do |climate_zone, value3|\n csv_file_total.write(\"#{building_type},#{building_vintage},#{climate_zone},#{value3}\")\n csv_file_total.write(\"\\n\")\n end\n end\n end\n\n csv_file_total.close \n \n \n\n # Create a CSV to store the results\n csv_file = File.open(\"#{Dir.pwd}/build/comparison#{file_ext}.csv\", 'w')\n csv_file_simple = File.open(\"#{Dir.pwd}/build/comparison_simple#{file_ext}.csv\", 'w')\n\n # Write the header\n csv_file.write(\"building_type,building_vintage,climate_zone,\")\n csv_file_simple.write(\"building type,building vintage,climate zone,fuel type,end use,legacy val,openstudio val,percent error,absolute error\\n\")\n line2_str =\",,,\"\n #results_hash=Hash[building_type][building_vintage][climate_zone][fuel_type][end_use]['Legacy Val']\n all_results_hash.values[0].values[0].values[0].each_pair do |fuel_type, end_users|\n end_users.keys.each do |end_user|\n csv_file.write(\"#{fuel_type}-#{end_user},,,,\")\n line2_str+= \"Legacy Val,OSM Val,Diff (%),Absolute Diff,\"\n end\n end\n csv_file.write(\"\\n\")\n csv_file.write(line2_str + \"\\n\")\n\n # Save the results to CSV\n all_results_hash.each_pair do |building_type, value1|\n value1.each_pair do |building_vintage, value2|\n value2.each_pair do |climate_zone, value3|\n csv_file.write(\"#{building_type},#{building_vintage},#{climate_zone},\")\n for fuel_end_use_index in 0...fuel_type_names.count\n fuel_type = fuel_type_names[fuel_end_use_index]\n end_use = end_uses_names[fuel_end_use_index]\n value5 = value3[fuel_type][end_use]\n csv_file.write(\"#{value5['Legacy Val']},#{value5['OpenStudio Val']},#{value5['Percent Error']},#{value5['Absolute Error']},\")\n # if value5['Percent Error'].abs > 0.1\n unless value5['Legacy Val'].nil?\n csv_file_simple.write(\"#{building_type},#{building_vintage},#{climate_zone},#{fuel_type},#{end_use},#{value5['Legacy Val']},#{value5['OpenStudio Val']},#{value5['Percent Error']},#{value5['Absolute Error']}\\n\")\n end\n end\n csv_file.write(\"\\n\")\n end\n end\n end\n\n csv_file.close\n csv_file_simple.close\n #### Return the list of failures\n return failures\n end",
"def compute_validation_file_specs(input_file_specs)\n input_file_specs.inject({}) { |m,(fs_name, fs_string)|\n base_dir, file_pattern = fs_string.split(Repositext::Cli::FILE_SPEC_DELIMITER).compact\n if base_dir.nil? || file_pattern.nil?\n raise ArgumentError.new(\"file_spec requires both base_dir and file_pattern: #{ fs_string.inspect } in #{ input_file_specs.inspect }\")\n end\n if base_dir !~ BASE_DIR_NAME_REGEX\n raise ArgumentError.new(\"base_dir is not valid: #{ base_dir.inspect }\")\n end\n if file_pattern !~ FILE_PATTERN_NAME_REGEX\n raise ArgumentError.new(\"file_pattern is not valid: #{ file_pattern.inspect }\")\n end\n m[fs_name] = [base_dir(base_dir), file_pattern(file_pattern)]\n m\n }\n end",
"def spec_tests(&block)\n require 'onceover/testconfig'\n\n # Load up all of the tests and deduplicate them\n testconfig = Onceover::TestConfig.new(@onceover_yaml, @opts)\n testconfig.spec_tests.each { |tst| testconfig.verify_spec_test(self, tst) }\n tests = testconfig.run_filters(Onceover::Test.deduplicate(testconfig.spec_tests))\n\n # Loop over each test, executing the user's block on each\n tests.each do |tst|\n block.call(tst.classes[0].name, tst.nodes[0].name, tst.nodes[0].fact_set, tst.nodes[0].trusted_set, tst.nodes[0].trusted_external_set, testconfig.pre_condition)\n end\n end",
"def build_tests_list\n if ! @test_list.nil?\n return @test_list\n end\n @test_list = []\n Find.find(@ruby_tests_location) do |path|\n if FileTest.directory?(path)\n if File.basename(path)[0] == \".\"\n Find.prune # ignore . .. and .svn\n else\n next\n end\n elsif File.extname(path) == \".test\"\n puts \"Processing: \" + path\n @test_list << path\n end\n end\n\n if @test_list.size == 0\n raise MissingRubyTestFiles, \"Can't find any rubySelenium tests in directory #{@ruby_tests_location}\"\n else\n return @test_list.sort!\n end\n end",
"def build_results\n # Which files can we ignore?\n @files_to_ignore = Set.new\n @diffs.each do |diff|\n next unless diff.change? && diff.type == 'File' && diff.structure == %w(parameters ensure)\n next unless ['absent', 'false', false].include?(diff.new_value)\n @files_to_ignore.add diff.title\n end\n\n # Based on that, which diffs can we ignore?\n @results = Set.new @diffs.reject { |diff| keep_diff?(diff) }\n end",
"def parse_spec_file(task_spec)\n task_spec_metadata = {}\n\n begin\n text = task_spec.read\n text.split(\"\\n\").each do |line|\n line = line.downcase\n\n if line =~ /^\\s*#\\s*(?:yamls|hiera):\\s*(.*)/\n task_spec_metadata[:hiera] = [] unless task_spec_metadata[:hiera].is_a? Array\n task_spec_metadata[:hiera] += get_list_of_yamls $1\n end\n\n if line =~ /^\\s*#\\s*facts:\\s*(.*)/\n task_spec_metadata[:facts] = [] unless task_spec_metadata[:facts].is_a? Array\n task_spec_metadata[:facts] += get_list_of_yamls $1\n end\n\n if line =~ /^\\s*#\\s*(?:skip_yamls|skip_hiera):\\s(.*)/\n task_spec_metadata[:skip_hiera] = [] unless task_spec_metadata[:skip_hiera].is_a? Array\n task_spec_metadata[:skip_hiera] += get_list_of_yamls $1\n end\n\n if line =~ /^\\s*#\\s*skip_facts:\\s(.*)/\n task_spec_metadata[:skip_facts] = [] unless task_spec_metadata[:skip_facts].is_a? Array\n task_spec_metadata[:skip_facts] += get_list_of_yamls $1\n end\n\n if line =~ /^\\s*#\\s*disable_spec/\n task_spec_metadata[:disable] = true\n end\n\n if line =~ /^\\s*#\\s*role:\\s*(.*)/\n task_spec_metadata[:roles] = [] unless task_spec_metadata[:roles].is_a? Array\n roles = line.split /\\s*,\\s*|\\s+/\n task_spec_metadata[:roles] += roles\n end\n\n if line =~ /^\\s*#\\s*run:\\s*(.*)/\n run_record = get_list_of_yamls $1\n if run_record.length >= 2\n run_record = {\n :hiera => run_record[0],\n :facts => run_record[1],\n }\n task_spec_metadata[:runs] = [] unless task_spec_metadata[:runs].is_a? Array\n task_spec_metadata[:runs] << run_record\n end\n end\n end\n rescue\n return task_spec_metadata\n end\n task_spec_metadata\n end",
"def create_files\n tests.each do |test|\n FileUtils.mkdir(test.id.to_s) unless Dir.exist?(test.id.to_s) if test.option[:dir]\n files = []\n files << test.action.split('?').first\n files += test.option[:implicit]\n files << test.result_rdf if test.result_rdf\n files << test.result_json if test.result_json\n files.compact.select {|f| !File.exist?(f)}.each do |f|\n File.open(f, \"w\") {|io| io.puts( f.end_with?('.json') ? \"{}\" : \"\")}\n end\n end\n end",
"def solutions(args)\n book = require_arg(args,'book')\n hw = get_hw_from_file_or_die(require_arg(args,'in_file'))\n sets = hw_to_sets(hw,book)\n stream_labels = assign_starts_of_streams_to_sets(sets,hw)\n out_file = require_arg(args,'out_file')\n class_title = require_arg(args,'class_title')\n sets = require_arg(args,'sets')\n gb_file = require_arg(args,'gb_file')\n sample = (args.has_key?('sample') && args['sample'].to_i==1)\n roster = get_roster_from_opengrade(gb_file) # roster[\"blow_joe\"]={last, first, class, id_string, and id_int}\n solution_in_book = {} # [label]=boolean\n sources_parent_dir = File.expand_path(require_arg(args,'sources_parent_dir'))\n subdir_list = []\n Dir.chdir(sources_parent_dir) do # do block so we chdir back afterward\n subdir_list=Dir[\"*\"].reject{|o| not File.directory?(o)}.sort\n end\n probs = {}\n n_hw_defined=0\n header = true\n students_encountered = {}\n problem_labels_encountered = []\n File.readlines(sets).each { |line|\n if header then\n header = false\n else\n # set,book,ch,num,parts,flags,chunk,student\n unless line=~/(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*)/ then fatal_error(\"illegal line in #{sets}: #{line}\") end\n hw,ch,num,student = [$1.to_i,$3.to_i,$4,$8] # no to_i on num, could be \"g7\"\n if hw>n_hw_defined then n_hw_defined=hw end\n students_encountered[student] = true\n if probs[student].nil? then probs[student] = {} end\n if probs[student][hw].nil? then probs[student][hw] = [] end\n l = $num_to_label[[ch,num]]\n if l.nil? then fatal_error(\"no label found for ch. #{ch}, problem #{num}\") end\n problem_labels_encountered.push(l)\n probs[student][hw].push(l)\n end\n }\n students_encountered.keys.each { |k|\n unless roster.has_key?(k) then fatal_error(\"student #{k} occurs in #{sets}, but not in #{gb_file}\") end\n }\n roster.keys.each { |k|\n unless students_encountered.has_key?(k) then fatal_error(\"student #{k} occurs in #{gb_file}, but not in #{sets}\") end\n }\n label_to_source_file = {}\n problem_labels_encountered.each { |l|\n p = $label_to_num[l]\n solution_in_book[l] = $has_solution[p]\n subdir_list.each { |d|\n t = sources_parent_dir+\"/\"+d+\"/\"+l+\".tex\"\n if File.exists?(t) then label_to_source_file[l] = t; next end\n }\n if !solution_in_book[l] && label_to_source_file[l].nil? then $stderr.print \"warning: no solution found for #{l} in any subdirectory of #{sources_parent_dir}\\n\" end\n }\n head = <<-\"HEAD\"\n \\\\documentclass{simplesolns}\n \\\\begin{document}\n {\\\\Huge\\\\textbf{Solutions for #{class_title}}}\\\\\\\\\\n\n HEAD\n tail = <<-'TAIL'\n \\end{document}\n TAIL\n toc = ''\n tex = ''\n 1.upto(n_hw_defined) { |hw|\n toc = toc + \"\\\\noindent Homework #{hw} ... \\\\pageref{set#{hw}}\\\\\\\\\\n\"\n first_student = true\n roster.keys.sort.each { |student|\n label_for_toc = ''\n if sample && !first_student then break end\n if first_student then label_for_toc = \"\\\\label{set#{hw}}\" end\n tex = tex + <<-\"TEX\"\n\n \\\\pagebreak\n\n \\\\noindent%\n {\\\\large\\\\textbf{Solutions to Homework #{hw}, #{class_title},\n #{roster[student][\"first\"]} #{roster[student][\"last\"]} }}#{label_for_toc}\\\\\\\\\\n\n TEX\n first_student = false\n probs[student][hw].each { |label|\n p = $label_to_num[label]\n if solution_in_book[label] then\n tex = tex+solution_helper(p,'solution in the back of the book')\n else\n source_file = label_to_source_file[label]\n missing = false\n if source_file.nil?\n missing = true\n else\n s,err = slurp_file_with_detailed_error_reporting(source_file)\n if s.nil? then \n missing=true \n $stderr.print \"warning: error reading file #{source_file}, #{err}\"\n else\n tex = tex+solution_helper(p,s)\n end\n end\n if missing then\n tex = tex+solution_helper(p,'!!!!!!!!!!! missing solution !!!!!!!!!!!!!!')\n end\n end\n }\n }\n }\n File.open(out_file,'w') { |f|\n f.print head+toc + \"\\\\pagebreak\" + tex+tail\n }\nend",
"def create_files\n tests.each do |test|\n files = [test.action, test.urgna2012, test.urdna2015].compact\n files.compact.select {|f| !File.exist?(f)}.each do |f|\n File.open(f, \"w\") {|io| io.puts( f.end_with?('.json') ? \"{}\" : \"\")}\n end\n end\n end",
"def process(files, parallel, test, output_path)\n\n summaries = []\n files.each do |file|\n\n mediainfo = mediainfo(file)\n\n results = []\n tx_files = duplicate(file, output_path, parallel - 1)\n tx_files << file\n\n start_time = Time.now\n tx(tx_files, results, test, mediainfo, output_path)\n wait_for_completion\n end_time = Time.now\n\n summary = TestSummary.new(File.basename(file), results, start_time, end_time, mediainfo[:duration])\n summaries << summary\n end\n\n summaries\nend",
"def generate_fastq\n\n # Generate FASTQ file list, expanding patterns if found.\n fastq_input_file_list = []\n fastq_output_prefix_list = []\n fastq_output_group_list = []\n ARGV.each do |fastq_input_file|\n if fastq_input_file =~ /[\\+\\?\\*]/\n # File is regexp: use it to do our own \"glob\".\n # If the regexp has at least one group in it, save the group match\n # in a corresponding list to use in making the output files.\n fastq_input_dir = File.dirname(fastq_input_file)\n fastq_input_patt = File.basename(fastq_input_file)\n\n Dir.entries(fastq_input_dir).sort().each do |entry|\n if entry =~ /#{fastq_input_patt}()/o\n fastq_input_file_list << entry\n if not @out_prefix.nil?\n fastq_output_prefix_list << @out_prefix\n else\n fastq_output_prefix_list << entry[0..Regexp.last_match.begin(1)-1-1] # Second -1 is for underline.\n end\n fastq_output_group_list << $1\n end\n end\n else\n if File.file? fastq_input_file\n fastq_input_file_list << fastq_input_file\n fastq_output_prefix_list << @out_prefix\n end\n end\n end\n\n die \"no FASTQ files found\" if fastq_input_file_list.length == 0\n\n STDERR.puts(\"Input files: #{fastq_input_file_list}\") if @verbose\n\n fastq_list = fastq_input_file_list.zip(fastq_output_prefix_list, fastq_output_group_list)\n fastq_list.each do |fastq_input_file, fastq_output_prefix, fastq_output_group|\n\n # If we are splitting to subfiles, reset the output sub filenames to\n # the new destination for the new input file; also reset statistics.\n if @save_subfiles\n if fastq_output_group == \"\"\n fastq_output_group_mod = fastq_output_group\n else\n fastq_output_group_mod = \"_#{fastq_output_group}\"\n end\n @pass_sub_filename = File.join(@pass_dir, \"#{fastq_output_prefix}_pf#{fastq_output_group_mod}.fastq\")\n @pass_sub_filename += \".gz\" if @compress\n @reject_sub_filename = File.join(@reject_dir, \"#{fastq_output_prefix}_reject#{fastq_output_group_mod}.fastq\")\n @reject_sub_filename += \".gz\" if @compress\n\n @stats_sub_filename = File.join(@stats_dir, \"#{fastq_output_prefix}_seq_stats#{fastq_output_group_mod}.txt\")\n @pass_sub_read_cnt = @reject_sub_read_cnt = @total_sub_read_cnt = 0\n end\n\n if @save_subfiles\n open_fastq_sub_output_files\n end\n\n # split one FASTQ file into post-filter and reject FASTQ\n STDERR.puts \"Processing #{fastq_input_file}...\" if @verbose\n fastq_input_fp = open_fastq_input(fastq_input_file)\n if fastq_input_fp.nil?\n warn \"#{fastq_input_file} is empty...skipping\"\n next\n end\n begin\n while fastq_input_fp.readline\n header_line = $_\n if header_line !~ /^@/\n STDERR.puts \"Missing header line (#{header_line})...exiting\"\n exit(-1)\n end\n\n header_fields = header_line.split(/[ _]/)\n die \"header parse error at #{fastq_input_file}:#{$INPUT_LINE_NUMBER} [#{header_fields.join(\"!\")}]\" if header_fields.size != 2\n\n sub_header_fields = header_fields[1].split(\":\",-1)\n die \"sub header parse error at #{fastq_input_file}:#{$INPUT_LINE_NUMBER} [#{header_fields.join(\":\")}(#{sub_header_fields.join(\":\")})]\" if sub_header_fields.size != 4\n\n @total_read_cnt += 1\n @total_sub_read_cnt += 1\n\n if sub_header_fields[1] == \"N\"\n out = @pass\n @pass_read_cnt += 1\n out_sub = @pass_sub\n @pass_sub_read_cnt += 1\n elsif sub_header_fields[1] == \"Y\"\n out = @reject\n @reject_read_cnt += 1\n out_sub = @reject_sub\n @reject_sub_read_cnt += 1\n else\n die \"filter field value error at #{fastq_input_file}:#{$INPUT_LINE_NUMBER}...skipping read\"\n out = nil\n end\n\n # Read the rest of the sequence.\n seq_line = fastq_input_fp.readline\n plus_line = fastq_input_fp.readline\n if plus_line !~ /^\\+/\n STDERR.puts \"Malformed FASTQ +line (#{plus_line})\"\n end\n qual_line = fastq_input_fp.readline\n\n # Output the sequence to whatever file was chosen above.\n if !out.nil?\n if not @remove_spaces\n out.print \"#{header_line}\"\n out_sub.print \"#{header_line}\" if not out_sub.nil?\n else\n out.puts header_fields.join(\"_\")\n out_sub.puts header_fields.join(\"_\") if not out_sub.nil?\n end\n out.print \"#{seq_line}\"\n out.print \"#{plus_line}\"\n out.print \"#{qual_line}\"\n if not out_sub.nil?\n out_sub.print \"#{seq_line}\"\n out_sub.print \"#{plus_line}\"\n out_sub.print \"#{qual_line}\"\n end\n end\n end # while\n\n rescue EOFError\n\n end\n\n fastq_input_fp.close()\n\n if @save_subfiles\n close_fastq_sub_output_files\n store_stats @stats_sub_filename, @pass_sub_read_cnt, @reject_sub_read_cnt, @total_sub_read_cnt\n end\n\n end # fastq_list.each\n end",
"def consolidate_failures(failed)\n filters = new_hash_of_arrays\n\n class_map = Hash[*self.find_order.grep(/^spec/).map { |f| # TODO: ugly\n [path_to_classname(f), f]\n }.flatten]\n class_map.merge!(self.extra_class_map)\n\n failed.each do |method, klass|\n if class_map.has_key? klass then\n filters[class_map[klass]] << method\n else\n output.puts \"Unable to map class #{klass} to a file\"\n end\n end\n\n return filters\n end",
"def generate_examples_section\n @catalog['resources'].each do |r|\n\n type = r['type']\n title = r['title'].gsub /'/, \"\\\\\\\\'\"\n parameters = r['parameters']\n\n if parameters.nil?\n @content +=\n \" it 'is expected to contain #{type.downcase} #{title}' do\\n\" +\n \" is_expected.to #{matcher(type)}('#{title}')\\n\" +\n \" end\\n\\n\"\n next\n end\n\n @content +=\n \" it 'is expected to contain #{type.downcase} #{title}' do\\n\" +\n \" is_expected.to #{matcher(type)}('#{title}').with({\\n\"\n\n parameters.each do |k, v|\n unless type == 'File' and k == 'content'\n if v.class == String\n v.gsub! /'/, \"\\\\\\\\'\"\n @content += \" '#{k}' => '#{v}',\\n\"\n elsif [Integer, TrueClass, FalseClass].include?(v.class)\n @content += \" '#{k}' => '#{v}',\\n\"\n elsif [Array, Hash].include?(v.class)\n @content += \" '#{k}' => #{v},\\n\"\n else\n raise \"Unhandled input at #{type}[#{title}] of class #{v.class}\"\n end\n end\n end\n\n @content += \" })\\n end\\n\\n\"\n\n ensr = parameters['ensure']\n cont = parameters['content']\n\n if type == 'File' and\n not cont.nil? and\n (ensr == 'file' or ensr == 'present' or\n not parameters.has_key?('ensure'))\n\n mod = cont.clone\n\n if parameters.has_key?('content')\n begin\n mod.gsub!('\\\\') { '\\\\\\\\' }\n mod.gsub! /\"/, '\\\"'\n mod.gsub! /\\@/, '\\@'\n mod.gsub! /\\$;/, '\\\\$;'\n rescue\n end\n end\n\n if not cont.nil?\n if @options[:md5sums]\n generate_md5sum_check(title, cont)\n else\n generate_content_check(title, mod)\n end\n end\n end\n end\n end",
"def run_loop(path, report, actionfilter = nil, testcasefilter = nil)\n\n result = begin\n mList = File.file?(path) ? path : path+'.rb'\n mList = Dir.entries(path).select do |x|\n x[0..0] != '.' && ( (x=~ /\\.rb$/) || File.directory?(File.join(path,x)))\n end.map do |x|\n File.join(path,x)\n end if File.directory?(path)\n [*mList].sort! do |a, b|\n case a <=> b\n when -1,1\n case File.file?(a) && File.file?(b)\n when true\n case File.basename(a)\n when /setup/\n -1\n when /teardown/\n 1\n else\n case File.basename(b)\n when /setup/\n 1\n when /teardown/\n -1\n else\n a<=>b\n end\n end\n when false\n if(File.file?(a))\n -1\n else\n 1\n end\n end\n when 0\n 0\n end\n end\n rescue\n result = [path]\n end\n\n #llogger = CLogger.new(path)\n result.each do |x|\n begin\n if(File.directory?(x))\n report = run_loop(x, report, actionfilter, testcasefilter)\n else\n next if (not File.exist?(x))\n next if (testcasefilter && (not testcasefilter.include?(x)))\n puts \"Executing testcase: #{x}\"\n report.testcase += 1\n llogger = CLogger.new(x)\n report = processor(x, report, llogger, actionfilter)\n end\n rescue\n puts $!\n end\n end\n\n if block_given?\n yield report\n else\n report\n end\nend",
"def initialize(test_glob = DEFAULT_TEST_GLOB)\n @total_test_files = 0\n @total_source_files = 0\n @test_glob = test_glob\n end",
"def import test_cases\n raise TypeError, \"File list must be an Array, got #{test_cases.class}\" unless test_cases.is_a? Array\n test_cases.each do |test_case|\n puts \"%20s : %s\" % ['Adding ' + self.class.type, test_case] if RubyUnit.debug\n require test_case\n end\n end",
"def testSeveralWith2Specified\n execute_binary_with_conf('Deliver', [ '--name', 'Deliverable3', '--name', 'Deliverable2' ], {\n :WaveFiles => {\n :FilesList => [\n { :Name => 'Wave1.wav' },\n { :Name => 'Wave2.wav' },\n { :Name => 'Wave3.wav' }\n ] },\n :Mix => {\n 'Mix1' => { :Tracks => { 'Wave1.wav' => {} } },\n 'Mix2' => { :Tracks => { 'Wave2.wav' => {} } },\n 'Mix3' => { :Tracks => { 'Wave3.wav' => {} } }\n },\n :Deliver => {\n :Formats => {\n 'Test' => {\n :FileFormat => 'Test'\n }\n },\n :Deliverables => {\n 'Deliverable1' => {\n :Mix => 'Mix1',\n :Format => 'Test'\n },\n 'Deliverable2' => {\n :Mix => 'Mix2',\n :Format => 'Test'\n },\n 'Deliverable3' => {\n :Mix => 'Mix3',\n :Format => 'Test'\n }\n }\n }\n },\n :PrepareFiles => getPreparedFiles(:Mixed_Wave1, :Mixed_Wave2, :Mixed_Wave3)\n ) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n assert !File.exists?('06_Deliver/Deliverable1')\n assert_rb_content({\n :SrcFileName => 'Wave2.wav',\n :DstFileName => '06_Deliver/Deliverable2/Track.test.rb',\n :FormatConf => {},\n :Metadata => { :FileName => 'Track' }\n }, '06_Deliver/Deliverable2/Track.test.rb')\n assert_rb_content({\n :SrcFileName => 'Wave3.wav',\n :DstFileName => '06_Deliver/Deliverable3/Track.test.rb',\n :FormatConf => {},\n :Metadata => { :FileName => 'Track' }\n }, '06_Deliver/Deliverable3/Track.test.rb')\n end\n end",
"def count_tests\n Dir.entries(@path.to_s + \"sandbox\").each do |currFile|\n isFile = currFile.to_s =~ /\\.java$|\\.py$|\\.c$|\\.cpp$|\\.js$|\\.php$|\\.rb$|\\.hs$|\\.clj$|\\.go$|\\.scala$|\\.coffee$|\\.cs$|\\.groovy$\\.erl$/i\n\n unless isFile.nil?\n file = @path.to_s + \"sandbox/\" + currFile.to_s\n begin\n case @language.to_s\n when \"Java-1.8_JUnit\"\n if File.open(file).read.scan(/junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Mockito\"\n if File.open(file).read.scan(/org\\.mockito/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Powermockito\"\n if File.open(file).read.scan(/org\\.powermock/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Java-1.8_Approval\"\n if File.open(file).read.scan(/org\\.approvaltests/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Python-unittest\"\n if File.open(file).read.scan(/unittest/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Python-pytest\"\n if file.include?\"test\"\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-TestUnit\"\n if File.open(file).read.scan(/test\\/unit/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count\n end\n when \"Ruby-Rspec\"\n if File.open(file).read.scan(/describe/).count > 0\n @totaltests += File.open(file).read.scan(/it /).count\n end\n when \"C++-assert\"\n if File.open(file).read.scan(/cassert/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"C++-GoogleTest\"\n if File.open(file).read.scan(/gtest\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-CppUTest\"\n if File.open(file).read.scan(/CppUTest/).count > 0\n @totaltests += File.open(file).read.scan(/TEST\\(/).count\n end\n when \"C++-Catch\"\n if File.open(file).read.scan(/catch\\.hpp/).count > 0\n @totaltests += File.open(file).read.scan(/TEST_CASE\\(/).count\n end\n when \"C-assert\"\n if File.open(file).read.scan(/assert\\.h/).count > 0\n @totaltests += File.open(file).read.scan(/static void /).count\n end\n when \"Go-testing\"\n if File.open(file).read.scan(/testing/).count > 0\n @totaltests += File.open(file).read.scan(/func /).count\n end\n when \"Javascript-assert\"\n if File.open(file).read.scan(/assert/).count > 0\n @totaltests += File.open(file).read.scan(/assert/).count - 2 #2 extra because of library include line\n end\n when \"C#-NUnit\"\n if File.open(file).read.scan(/NUnit\\.Framework/).count > 0\n @totaltests += File.open(file).read.scan(/\\[Test\\]/).count\n end\n when \"PHP-PHPUnit\"\n if File.open(file).read.scan(/PHPUnit_Framework_TestCase/).count > 0\n @totaltests += File.open(file).read.scan(/function /).count\n end\n when \"Perl-TestSimple\"\n if File.open(file).read.scan(/use Test/).count > 0\n @totaltests += File.open(file).read.scan(/is/).count\n end\n when \"CoffeeScript-jasmine\"\n if File.open(file).read.scan(/jasmine-node/).count > 0\n @totaltests += File.open(file).read.scan(/it/).count\n end\n when \"Erlang-eunit\"\n if File.open(file).read.scan(/eunit\\.hrl/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(\\)/).count\n end\n when \"Haskell-hunit\"\n if File.open(file).read.scan(/Test\\.HUnit/).count > 0\n @totaltests += File.open(file).read.scan(/TestCase/).count\n end\n when \"Scala-scalatest\"\n if File.open(file).read.scan(/org\\.scalatest/).count > 0\n @totaltests += File.open(file).read.scan(/test\\(/).count\n end\n when \"Clojure-.test\"\n if File.open(file).read.scan(/clojure\\.test/).count > 0\n @totaltests += File.open(file).read.scan(/deftest/).count\n end\n when \"Groovy-JUnit\"\n if File.open(file).read.scan(/org\\.junit/).count > 0\n @totaltests += File.open(file).read.scan(/@Test/).count\n end\n when \"Groovy-Spock\"\n if File.open(file).read.scan(/spock\\.lang/).count > 0\n @totaltests += File.open(file).read.scan(/def /).count - 1 #1 extra because of object def\n end\n else\n @totaltests = \"NA\"\n end\n rescue\n puts \"Error: Reading in count_tests\"\n end\n end\n end\nend",
"def create_group_map(options={})\n\n\tleague_id = options[:league_id]\n\tfixtures_xml = options[:xml]\n\n\tgroup_hash = Hash.new\n\n\tfixtures_xml.xpath(\"//Match\").each do |node|\n if [16, 17].include? league_id\n home_team_id = node.xpath(\"HomeTeam_Id\").text\n away_team_id = node.xpath(\"AwayTeam_Id\").text\n if group_hash[home_team_id].nil?\n group_hash[home_team_id] = Array.new\n group_hash[home_team_id] << home_team_id\n group_hash[home_team_id] << away_team_id\n elsif !group_hash[home_team_id].include? away_team_id\n group_hash[home_team_id] << away_team_id\n end\n end\n\tend\n\n groups = Array.new\n team_has_group = Hash.new\n group_hash.each do |k,v|\n if team_has_group[k].nil?\n groups << v\n v.each do |t|\n team_has_group[t] = true\n end\n end\n end\n\n # Group name order hard-coded for 2013 (due to xmlsoccer fixture order)\n if league_id == 16\n group_names = [ 'A', 'D', 'B', 'C', 'H', 'F', 'E', 'G', ]\n elsif league_id == 17\n group_names = [ 'A', 'E', 'F', 'B', 'C', 'D', 'J', 'H', 'I', 'K', 'G', 'L' ]\n end\n \n unsorted_groups = Hash.new\n groups.each do |group|\n group_name = group_names.shift\n unsorted_groups[group_name] = Array.new\n group.each do |team_id|\n unsorted_groups[group_name] << team_id\n group_hash[team_id.to_s] = group_name\n end\n end\n\n # @groups = Hash.new\n # unsorted_groups.keys.sort.each do |key|\n # @groups[key] = unsorted_groups[key]\n # end\n\n group_hash\n\nend",
"def test_ownprovidergroups\n groupnames.each { |group|\n gobj = nil\n comp = nil\n fakeresource = fakeresource(:group, group)\n assert_nothing_raised {\n gobj = @provider.new(fakeresource)\n }\n\n assert(gobj.gid, \"Failed to retrieve gid\")\n }\n end",
"def run_namelist_tests(namelist, hash, enum = nil)\n ext = enum ? \"_#{enum}\" : \"\"\n hash[:must_pass].each do |tst|\n error(namelist_test_failed(namelist, tst)) unless instance_eval(tst[:test])\n end if hash[:must_pass]\n hash[:should_pass].each do |tst|\n warning(namelist_test_failed(namelist, tst)) unless instance_eval(tst[:test])\n end if hash[:should_pass]\n hash[:variables].each do |var, var_hash|\n #gs2_var = (var_hash[:gs2_name] or var)\n cr_var = var+ext.to_sym\n value = send(cr_var)\n if value.kind_of? Array\n value.each{|v| test_variable(namelist, var, var_hash, ext, v)}\n else\n test_variable(namelist, var, var_hash, ext, value)\n end\n end\nend",
"def get_test_classified_files(classification, transformation, preprocess)\n files = []\n @classes.each do |category|\n filename = get_classified_file(category, :test,\n classification, transformation, preprocess)\n\n Xi::ML::Tools::Utils.check_file_readable!(filename)\n files << filename\n end\n\n raise Xi::ML::Error::DataError, 'Empty list of files' if files.size == 0\n files\n end",
"def prepare_test_env(test_type)\n curr_dir = Dir.pwd\n time = Time.new \n run_name = generate_run_name(test_type)\n spot_name = run_name.slice(/0312_\\d+_1_SP/)\n lib_name = run_name.slice(/ANG_TEST_1_1\\wA_\\d+_1$/)\n\n analysis_dir = \"./tmp/snfs4/next-gen/solid/analysis/solid0312/\" +\n time.strftime(\"%Y\") + \"/\" + time.strftime(\"%m\") # + \"/\" + run_name\n\n result_dir = \"./tmp/snfs4/next-gen/solid/results/solid0312/\" + spot_name + \n \"/\" + lib_name + \"/results.F1B1/primary/reads\" \n\n sea_dir = analysis_dir + \"/\" + run_name\n\n # Create necessary directories\n FileUtils.mkdir_p(analysis_dir)\n FileUtils.mkdir_p(result_dir)\n FileUtils.mkdir_p(\"./tmp/snfs1/next-gen/solid/analysis/solid0312\")\n FileUtils.mkdir_p(\"./tmp/snfs1/next-gen/solid/results/solid0312\")\n FileUtils.mkdir_p(\"./tmp/snfs5/next-gen/solid/analysis/solid0312\")\n FileUtils.mkdir_p(\"./tmp/snfs5/next-gen/solid/results/solid0312\")\n\n # copy data to these directories\n copy_data(analysis_dir, result_dir, run_name, test_type)\n\n # build analysis driver command\n analysis_driver_cmd = \"ruby19 ../bin/analysis_driver.rb -a sea_create \" +\n \" -r \" + run_name\n\n # for capture test, add chip design parameter \n if test_type.eql?(\"cap\")\n analysis_driver_cmd = analysis_driver_cmd + \" -c \" + $chip_design\n end \n \n puts analysis_driver_cmd \n # Execute the command to start analysis_driver\n output = `#{analysis_driver_cmd}`\n\n # Copy data from result directory to analysis directory. This is \n # required as creation of soft links to data from the analysis directory\n # to the result directory does not work in the test mode\n `cp #{result_dir}/* #{analysis_dir}/#{run_name}/input`\n\n # Modify the yaml for testing purpose\n modify_yaml_for_testing(sea_dir)\n #return output\n \n return sea_dir\nend",
"def parse_def_file(filepath)\n\n $runParamsOpen = false; \n $runScopeOpen = false; \n $UpgradesOpen = false; \n \n $WildCardsInUse = false; \n \n rundefs = File.open(filepath, 'r') \n \n rundefs.each do | line |\n \n $defline = line\n $defline.strip! \n $defline.gsub!(/\\!.*$/, '')\n $defline.gsub!(/\\s*/, '')\n $defline.gsub!(/\\^/, '')\n \n if ( $defline !~ /^\\s*$/ ) \n\n case \n # Section star/end in the file \n when $defline.match(/RunParameters_START/i)\n $RunParamsOpen = true; \n \n when $defline.match(/RunParameters_END/i)\n $RunParamsOpen = false; \n \n when $defline.match(/RunScope_START/i)\n $RunScopeOpen = true; \n \n when $defline.match(/RunScope_END/i)\n $RunScopeOpen = false; \n \n when $defline.match(/Upgrades_START/i)\n $UpgradesOpen = true; \n \n when $defline.match(/Upgrades_END/i)\n $UpgradesOpen = false; \n \n else \n \n # definitions \n $token_values = Array.new\n $token_values = $defline.split(\"=\")\n \n\n \n if ( $RunParamsOpen && $token_values[0] =~ /archetype-dir/i ) \n # Where are our .h2k files located?\n \n $gArchetypeDir = $token_values[1] \n \n \n end\n \n \n if ( $RunParamsOpen && $token_values[0] =~ /run-mode/i ) \n # This does nothing only 'mesh' supported for now!!!\n $gRunDefMode = $token_values[1] \n \n if ( ! ( $gRunDefMode =~ /mesh/ || $gRunDefMode =~ /parametric/ ) ) then \n fatalerror (\" Run mode #{$gRunDefMode} is not supported!\") \n end \n \n end \n \n if ( $RunScopeOpen && $token_values[0] =~ /rulesets/i ) \n # Rulesets that can be applied. \n $gRulesets = $token_values[1].to_s.split(\",\")\n end \n \n if ( $RunScopeOpen && $token_values[0] =~ /archetypes/i ) \n \n # archetypes - \n $gArchetypes = $token_values[1].to_s.split(\",\")\n \n \n end \n \n if ( $RunScopeOpen && $token_values[0] =~ /locations/i ) \n \n # locations - \n $gLocations = $token_values[1].to_s.split(\",\")\n \n end \n \n if ( $UpgradesOpen ) \n \n option = $token_values[0]\n choices = $token_values[1].to_s.split(\",\")\n \n debug_out \" #{option} len = #{choices.grep(/\\*/).length} \\n\" \n \n if ( choices.grep(/\\*/).length > 0 ) then \n \n $WildCardsInUse = true \n \n end \n \n $gRunUpgrades[option] = choices\n\n $gOptionList.push option \n \n \n end \n \n\n end #Case \n \n end # if ( $defline !~ /^\\s*$/ ) \n \n end # rundefs.each do | line |\n\n \n # Check to see if run options contians wildcards \n \n \n if ( $WildCardsInUse ) then \n \n if ( ! $gOptionFile =~ /\\.json/i ) then \n fatalerror (\"Wildcard matching is only supported with .json option files\") \n end \n \n fOPTIONS = File.new($gOptionFile, \"r\") \n if fOPTIONS == nil then\n fatalerror(\" Could not read #{filename}.\\n\")\n end\n \n $OptionsContents = fOPTIONS.read\n fOPTIONS.close \n \n $JSONRawOptions = JSON.parse($OptionsContents)\n $OptionsContents = nil\n \n $gRunUpgrades.keys.each do |key| \n debug_out( \" Wildcard search for #{key} => \\n\" )\n \n \n \n \n $gRunUpgrades[key].clone.each do |choice| \n \n debug_out (\" ? #{choice} \\n\") \n \n if ( choice =~ /\\*/ ) then \n \n $pattern = choice.gsub(/\\*/, \".*\") \n \n debug_out \" Wildcard matching on #{key}=#{$pattern}\\n\" \n \n # Matching \n \n $SuperSet = $JSONRawOptions[key][\"options\"].keys\n \n $gRunUpgrades[key].delete(choice) \n\n $gRunUpgrades[key].concat $SuperSet.grep(/#{$pattern}/)\n \n \n end \n \n end \n \n \n end \n \n $JSONRawOptions = nil \n \n end \n\n \n \n \n # What if archetypes are defined using a wildcard? \n \n \n \n \n \n\nend",
"def get_tests(file:, lineno:)\n tests = Set.new\n read_mapping.each do |test, spectra|\n lines = spectra[file]\n next unless lines\n n = lines.bsearch { |x| x >= lineno }\n if n == lineno\n tests << test\n end\n end\n tests\n end",
"def testUselessProcessesSourceFiles\n execute_Mix_WithConf({\n :WaveFiles => {\n :FilesList => [\n {\n :Name => 'Wave.wav'\n }\n ]\n },\n :Mix => {\n 'Final' => {\n :Tracks => {\n 'Wave.wav' => {\n :Processes => [\n {\n :Name => 'VolCorrection',\n :Factor => '2db'\n },\n {\n :Name => 'VolCorrection',\n :Factor => '-2db'\n }\n ]\n }\n }\n }\n }\n },\n :PrepareFiles => [\n [ 'Wave/Empty.wav', 'Wave.wav' ]\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n assert Dir.glob('05_Mix/*.wav').empty?\n assert_wave_lnk 'Empty', '05_Mix/Final/Final.wav'\n end\n end",
"def check_file\n @files.each do |file|\n case \n when file.fnmatch(\"*Verbale autorizzativo*\") then check_verbale(estrai_allegato(file))\n when file.fnmatch(\"*Prezzi_Offerte*\") then check_controllo_offerte(file)\n when file.fnmatch(\"*Validate_Eni*\") then check_offerte(file)\n when file.fnmatch(\"*Esitate_Eni*\") then check_offerte(file)\n when file.fnmatch(\"*ProgrFisica*\") then check_offerte_pce(file)\n when file.fnmatch(\"*Scheduling & Bilateral Program*\") then check_scheduling_bilateral(file)\n when file.fnmatch(\"*tool autorizzazione offerte belpex*\") then check_tool_belgio(file)\n when file.fnmatch(\"*Export E-prog46_ita.xls\") then check_tool_olanda(file) \n when file.fnmatch(\"*Validate_*_*.docx\") then check_validate_epex(file) \n when file.fnmatch(\"*Esitate_Francia_*.csv\") then check_esitate_epex(file)\n when file.fnmatch(\"*Esitate_Germania_*.csv\") then check_esitate_epex(file) \n when file.fnmatch(\"*Esitate_Svizzera_*.csv\") then check_esitate_epex(file) \n else\n\n end\n end\n end",
"def set_required_imports file_content\n imports = file_content.scan(every_defined_class_reg_exp)\n\n required_imports = {:packages => [],\n :classes => [],\n :unknowns => []\n }\n\n imports.each do |import|\n if import.match(package_seperator_reg_exp)\n required_imports[:packages] << \"import #{import};\"\n elsif import.match(new_class_reg_exp)\n required_imports[:classes] << import.split(\" \")[1]\n else\n required_imports[:unknowns] << {:import => import,\n :class => @class_name,\n :method => @method_name\n }\n end\n end\n\n if required_imports[:unknowns].size > 0\n puts \"Unknown Classes found\\r\\n\"\n puts required_imports[:unknowns].inspect\n exit\n end\n\n required_imports.each { |key,value| value.uniq! }\n\n required_imports\n end",
"def process_group_data( node, loop_detection = [] )\n result = []\n \n case node.type.name\n when \"group_spec\"\n node.specifications.each do |spec|\n if elements = process_group_data(spec, loop_detection) then\n result.concat elements\n else\n nyi( \"what happens here?\" )\n end\n end\n \n when \"rule_spec\"\n result << Reference.new(create_name(node.name))\n \n when \"spec_reference\"\n name = node.name.text\n if @specifications.member?(name) then\n spec = @specifications[name]\n \n case spec.type.name\n when \"group_spec\"\n if @group_defs.member?(name) then\n result.concat @group_defs[name].member_references.collect{|r| r.clone()}\n else\n \n #\n # If we have to process a :group_spec directly, we don't store the result. This is because\n # we flatten groups via transitive closure, and shortcut out if we detect a loop (ie. somebody\n # \"above us\" is already processing it). We don't want to store such partial results.\n \n unless loop_detection.member?(name)\n result.concat process_group_data(spec, loop_detection + [name])\n end\n end\n \n when \"rule_spec\"\n result << Reference.new( create_name(node.name) )\n else\n nyi( \"error handling for group reference to macro or other ineligible name [#{name}]\" )\n end\n else\n nyi( \"error handling for missing rule/word/character reference in group [#{name}]\", node )\n end\n else\n nyi( \"support for node type [#{node.type}]\", node )\n end\n \n return result\n end",
"def test_grouping\n make_dummy_source(\"http://groupme/source1\", N::FOAFX.Goat, N::FOAFX.Bee)\n make_dummy_source(\"http://groupme/source2\", N::FOAFX.Goat)\n make_dummy_source(\"http://groupme/source3\", N::FOAFX.Bee)\n results = Source.groups_by_property(:type, [ N::FOAFX.Goat, N::FOAFX.Bee ])\n assert_equal(2, results.size)\n assert_equal(2, results[N::FOAFX.Goat].size)\n assert_equal(2, results[N::FOAFX.Bee].size)\n end",
"def fast_and_slow_test_files_to_run\n test_files_to_run = all_test_files_to_run\n\n if adapter_class == KnapsackPro::Adapters::RSpecAdapter && KnapsackPro::Config::Env.rspec_split_by_test_examples?\n require 'rspec/core/version'\n unless Gem::Version.new(::RSpec::Core::Version::STRING) >= Gem::Version.new('3.3.0')\n raise 'RSpec >= 3.3.0 is required to split test files by test examples. Learn more: https://github.com/KnapsackPro/knapsack_pro-ruby#split-test-files-by-test-cases'\n end\n\n slow_test_files = get_slow_test_files\n\n KnapsackPro.logger.info(\"Generating RSpec test examples JSON report for slow test files to prepare it to be split by test examples (by individual 'it's. Thanks to that a single slow test file can be split across parallel CI nodes). Analyzing #{slow_test_files.size} slow test files.\")\n\n # generate RSpec JSON report in separate process to not pollute RSpec state\n cmd = [\n 'RACK_ENV=test',\n 'RAILS_ENV=test',\n KnapsackPro::Config::Env.rspec_test_example_detector_prefix,\n 'rake knapsack_pro:rspec_test_example_detector',\n ].join(' ')\n unless Kernel.system(cmd)\n raise \"Could not generate JSON report for RSpec. Rake task failed when running #{cmd}\"\n end\n\n # read JSON report\n detector = KnapsackPro::TestCaseDetectors::RSpecTestExampleDetector.new\n test_file_example_paths = detector.test_file_example_paths\n\n KnapsackPro::TestFilesWithTestCasesComposer.call(test_files_to_run, slow_test_files, test_file_example_paths)\n else\n test_files_to_run\n end\n end"
] |
[
"0.658735",
"0.64436924",
"0.5670412",
"0.5511844",
"0.54880655",
"0.54867905",
"0.5483683",
"0.5472347",
"0.54495555",
"0.5445706",
"0.54409313",
"0.54379886",
"0.543119",
"0.53868425",
"0.53652334",
"0.5347009",
"0.53015405",
"0.528167",
"0.52768904",
"0.52686846",
"0.5260276",
"0.52444816",
"0.52413785",
"0.52094835",
"0.5207032",
"0.5182226",
"0.5182226",
"0.5182226",
"0.51661193",
"0.5146694",
"0.5140243",
"0.51386005",
"0.5134816",
"0.5130288",
"0.5129431",
"0.51261747",
"0.5122933",
"0.511696",
"0.5109898",
"0.51017594",
"0.5100117",
"0.50976425",
"0.5081108",
"0.50705564",
"0.50688505",
"0.50588566",
"0.50560814",
"0.5048296",
"0.5035287",
"0.5033318",
"0.50299686",
"0.5013504",
"0.5011422",
"0.50094324",
"0.50062346",
"0.5004074",
"0.49949667",
"0.49916643",
"0.49916148",
"0.49902984",
"0.49852687",
"0.49713954",
"0.49630812",
"0.49540135",
"0.49440372",
"0.49362206",
"0.49298656",
"0.492912",
"0.4928931",
"0.49227777",
"0.49202627",
"0.49071285",
"0.48990688",
"0.48965707",
"0.48934242",
"0.4891879",
"0.4885575",
"0.4885363",
"0.48712412",
"0.48640898",
"0.4860892",
"0.48598132",
"0.48579335",
"0.48577738",
"0.48550802",
"0.48539856",
"0.48517594",
"0.48469386",
"0.48453978",
"0.48434338",
"0.48408106",
"0.48322746",
"0.4830414",
"0.48278496",
"0.48256814",
"0.48123345",
"0.4811337",
"0.4807803",
"0.48051557",
"0.47971418"
] |
0.80679685
|
0
|
This method finds all the files with the mentioned groups and services
|
def grep_files_by_properties
# I - filter on @properties[:grouping] keywords.
property_filter = "@properties[:grouping]"
# @services_to_run ||= []
@groups_to_run ||= []
# groups to run may contain something like ["g1,g2,g3","g4,g5,g6"]
groups_to_run_filter = @groups_to_run.map {|g| g.split(',')}.flatten.uniq
# adding services and groups to filter
group_filter = groups_to_run_filter.join('|')
# grep -rw '@properties[:grouping]|@properties[:services] ../tests'
grep_cmd1 = "grep -rw '#{property_filter.shellescape}' #{@dir_to_index} "
# grep -rw 'service1|service2|group1|group2'
grep_cmd2 = "grep -iw \"#{group_filter.shellescape}\""
# Command to apply both the grep filters
# = grep_cmd1 | grep_cmd2
grep_cmd = "#{grep_cmd1}|#{grep_cmd2}"
cmd_result = %x[ #{grep_cmd} ]
grep_result_list = cmd_result.nil? ? [] : cmd_result.split("\n")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_services(params, serviceDir)\n service_files = []\n if ((services = params[:services]) != nil)\n services.each do |name|\n s = {}\n s[:name] = name\n s[:require] = \"omf-aggmgr/ogs_#{name}/#{name}\"\n s[:config] = \"#{name}.yaml\"\n service_files << s\n end\n else\n MObject.debug('gridservices', \"Loading all available services from #{serviceDir}\")\n Dir.foreach(serviceDir) do |filename|\n if (filename =~ /\\.yaml$/) then\n s = {}\n s[:name] = name = filename.split('.')[0]\n s[:require] = \"omf-aggmgr/ogs_#{name}/#{name}\"\n s[:config] = filename\n service_files << s\n end\n end\n end\n service_files\nend",
"def find_files(base_dir, flags); end",
"def find_files\n find_files_recursive(@build_result_dir, '')\n end",
"def sapi_files_found(sapi, priority = '*')\n ::Dir.glob(sapi_file_path(sapi, priority)) + ::Dir.glob(sapi_file_path(sapi))\n end",
"def _build_file_index(services)\n services.flat_map do |service|\n service.gemspec.files.map { |f| ::File.expand_path(f, service.path) }\n end\n end",
"def find(dirs); end",
"def find_docker_files\n current_path = Dir.pwd\n matched_root = \"\"\n matched_services = []\n matched_docker_sync_pwd = \"\"\n matched_docker_compose_pwd = \"\"\n (config[\"workspaces\"] || {}).each_pair do |_workspace_name, value|\n root = value[\"root\"]\n next unless current_path.start_with?(root) && root.length >= matched_root.length\n matched_root = root\n matched_services = value[\"services\"]\n matched_docker_sync_pwd = value[\"docker-sync\"]\n matched_docker_compose_pwd = value[\"docker-compose\"]\n end\n if matched_docker_sync_pwd.empty? || matched_docker_compose_pwd.empty?\n raise \"Cannot find the workspace for #{current_path}\"\n end\n @root = matched_root\n @service = \"\"\n matched_service = \"\"\n matched_services.each_pair do |service_name, service_path|\n path = File.expand_path(File.join(@root, service_path))\n if current_path.start_with?(path) && path.length >= matched_service.length\n matched_service = path\n @service = service_name\n end\n end\n @docker_sync_file = matched_docker_sync_pwd.gsub(matched_root, \".\")\n @docker_compose_file = matched_docker_compose_pwd.gsub(matched_root, \".\")\n end",
"def search_in(files, host, options = T.unsafe(nil)); end",
"def grouped(files); end",
"def find_files(search_pattern, opts = {})\n raise \"Missing implementation\"\n end",
"def find_files(search_pattern, opts = {})\n raise \"Missing implementation\"\n end",
"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 get_remote_files\n manager = @current_source.file_manager\n manager.start do \n @current_source.folders.each do |folder|\n @files[folder] = manager.find_files folder\n @files[folder] = @files[folder].take(@take) if @take\n Logger.<<(__FILE__,\"INFO\",\"Found #{@files[folder].size} files for #{@current_source.base_dir}/#{folder} at #{@current_source.host.address}\")\n SignalHandler.check\n end\n end\n end",
"def list_files_from (path,opts = {})\n safe_fetch do\n list_files = Set.new\n var = \"Search in #{path} at #{@host}... \"\n cmd = \"find #{path}\"\n cmd = \"(cd #{path} && ls \" ### dont know why cd alone doesn't work\n cmd << \"-td */\" if opts[:directories]\n cmd << opts[:regexp] if opts[:regexp]\n cmd << \" 2>/dev/null)\"\n out = @ssh.exec!(cmd)\n list_files = out.split\n list_files = out.split(\"/\\n\") if opts[:directories]\n\n var << \"Found #{list_files.size} entries\\n\"\n Logger.<<(__FILE__,\"INFO\",var)\n list_files\n end\n end",
"def find_files\n @files = []\n\n Dir.foreach(configured_file_path) do |file_name|\n next if file_name == '.' || file_name == '..'\n next if file_name =~ /^\\./ && Ferver.configuration.serve_hidden == false\n\n found_file = FoundFile.new(configured_file_path, file_name)\n @files << found_file if found_file.valid?\n end\n end",
"def all_matching_files\n @all_matching_files ||= find_files\n end",
"def all_matching_files\n @all_matching_files ||= find_files\n end",
"def find_files(*file_patterns)\n FileFinder.new.version(self).files(file_patterns)\n end",
"def find_files( dirs, lang, name, exts )\n results = []\n glob_files( dirs, lang, name, exts ) { |file,base,ext| results << file }\n results\n end",
"def get_pet_files(p_sp_id, p_tracer_id, p_vgroup_id)\n # ???? '1_asthana.adrc-clinical-core.visit1'=>'', '2_bendlin.tami.visit1'=>'', '1_bendlin.wmad.visit1'=>'','1_bendlin.mets.visit1'=> '', '2_bendlin.mets.visit1'=> ''\n # 2_ries.mosaic.visit1 3_ries.mosaic.visit1\n # tracer 1=pib, 2=fdg, 3=way, 4=015\n v_base_path = Shared.get_base_path()\n v_sp = ScanProcedure.find(p_sp_id)\n v_pet_target_path = \"\"\n if !v_sp.petscan_tracer_path.blank?\n v_tracer_path_array = v_sp.petscan_tracer_path.split(\"|\")\n v_tracer_path_array.each do |tr|\n v_tracer_path = tr.split(\":\")\n if v_tracer_path[0] == p_tracer_id.to_s\n v_pet_target_path = v_tracer_path[1]\n end\n end\n end\n #v_key = p_tracer_id.to_s+\"_\"+v_sp.codename\n v_file_names = []\n if !v_pet_target_path.blank? #v_pet_target_hash[v_key].blank?\n v_path = v_base_path+\"/raw/\"+v_pet_target_path+\"/\" #v_pet_target_hash[v_key]+\"/\"\n # check for file with enum \n vgroup = Vgroup.find(p_vgroup_id)\n (vgroup.enrollments).each do |e| # need case insensitive match \n if !Dir.glob(v_path+e.enumber+\"*\", File::FNM_CASEFOLD).empty? or !Dir.glob(v_path+\"*\"+e.enumber[1..-1]+\"*.img\", File::FNM_CASEFOLD).empty?\n v_cnt = 0\n Dir.glob(v_path+e.enumber+\"*\", File::FNM_CASEFOLD).each do |f|\n v_file_names.push(f.gsub(v_path,\"\"))\n v_cnt = v_cnt + 1\n end \n if v_cnt < 1\n Dir.glob(v_path+\"*\"+e.enumber[1..-1]+\"*.img\", File::FNM_CASEFOLD).each do |f|\n v_file_names.push(f.gsub(v_path,\"\"))\n v_cnt = v_cnt + 1\n end\n end\n #elsif (!Dir.glob(v_path+e.enumber.upcase+\"*\").empty? or !Dir.glob(v_path+\"*\"+e.enumber[1..-1].upcase+\"*.img\").empty?) and 1==2\n # v_cnt = 0\n # Dir.glob(v_path+e.enumber.upcase+\"*\").each do |f|\n # v_file_names.push(f.gsub(v_path,\"\"))\n # v_cnt = v_cnt + 1\n # end \n # if v_cnt < 1\n # Dir.glob(v_path+\"*\"+e.enumber[1..-1].upcase+\"*.img\").each do |f|\n # v_file_names.push(f.gsub(v_path,\"\"))\n # v_cnt = v_cnt + 1\n # end\n # end\n # else \n end\n end\n else\n #puts \"AAAAAAAAA \"+v_key+\" no path for sp in hash\"\n end\n return v_file_names\n end",
"def find_files dir = test_dir\n glob file_pattern(dir)\n end",
"def search_in(files, host, options = {})\n files.flat_map { |file| KnownHosts.new(file).keys_for(host, options) }\n end",
"def find_files folder\n unless @started\n Logger.<<(__FILE__,\"ERROR\",\"FileManager is not started yet !\")\n abort\n end\n if @subfolders\n files = sub_listing folder\n else\n path = ::File.join(@source.base_dir,folder)\n files = files_listing path\n end\n files = files_filtering files\n files = files.take(@take) if @take\n to_file(files)\n end",
"def check_services(first_file)\n if first_file.start_with?('service:')\n service = first_file.sub(/service:/, '')\n SERVICES.each do |k,v|\n if k == service\n @files = v\n end\n end\n end\n end",
"def find\r\n scanner = DirectoryScanner.new\r\n scanner.setBasedir(@context.root)\r\n scanner.setCaseSensitive(false)\r\n scanner.setIncludes(@includes.to_java :String) unless @includes.empty?\r\n scanner.setExcludes(@excludes.to_java :String) unless @excludes.empty?\r\n scanner.scan\r\n scanner.included_files.collect{|f| @context.filepath_from_root(f) }\r\n end",
"def find_group(onms_home, name)\n file_name = nil\n Dir.foreach(\"#{onms_home}/etc/datacollection\") do |group|\n next if group !~ /.*\\.xml$/\n file = ::File.new(\"#{onms_home}/etc/datacollection/#{group}\", 'r')\n doc = REXML::Document.new file\n file.close\n exists = !doc.elements[\"/datacollection-group[@name='#{name}']\"].nil?\n if exists\n file_name = \"#{onms_home}/etc/datacollection/#{group}\"\n break\n end\n end\n file_name\n end",
"def groups\n g = File.join(@root,'groups')\n FileUtils.mkdir_p g\n Dir.chdir(File.join(@root,'groups')) do\n Dir['*']\n end\n end",
"def file_list(group)\n return Dir[File.join(@dir, group, FILE_EXT)].sort\nend",
"def find_by_group(group)\n service_list.select { |_, metadata| metadata[:groups].include?(group) }.keys\n end",
"def files_listing path\n cmd = \"find #{path} -type f \"\n cmd += \"-regextype posix-extended \"\n cmd += \"-regex \\\"#{@file_regexp}\\\" \" if @file_regexp\n out = exec_cmd(cmd)\n end",
"def find_files()\n require 'find'\n directory = File.dirname(__FILE__) + '/../templates/' + @template\n @files = Array.new()\n Find.find(directory) do |f|\n if FileTest.file?f\n @files.push(f)\n end\n end\n @files\n end",
"def find_vmx_files(ds, output_directory) # rubocop:disable Metrics/MethodLength\n datastore_path = \"[#{ds.name}] /#{output_directory}\"\n puts datastore_path\n search_spec = {\n details: { fileOwner: false, fileSize: false, fileType: true,\n modification: false },\n query: [\n RbVmomi::VIM::VmConfigFileQuery(), RbVmomi::VIM::TemplateConfigFileQuery()\n ]\n }\n task = ds.browser.SearchDatastoreSubFolders_Task(datastorePath: datastore_path,\n searchSpec: search_spec)\n\n results = task.wait_for_completion\n\n files = []\n results.each do |result|\n result.file.each do |file|\n files << \"#{result.folderPath}/#{file.path}\"\n end\n end\n\n files\nend",
"def cat_files file_groups\n file_groups.each do |group|\n check_exists(group[:paths])\n # this is the Illumina recommended approach to combining these fastq files.\n # See the Casava 1.8 Users Guide for proof\n files_list = group[:paths].join(\" \")\n command = \"cat #{files_list} > #{group[:path]}\"\n execute command\n end\n end",
"def find_files(search_pattern, opts = {})\n fetch!\n search_pattern = Regexp.new(search_pattern)\n res = []\n unless @repo.empty?\n tree = @repo.head.target.tree\n _find_files(search_pattern, tree, nil, res)\n end\n res\n end",
"def find_files\n result = {}\n targets = ['app'] # start simple\n targets.each do |target|\n order = []\n Find.find(target) do |f|\n next if test ?d, f\n next if f =~ /(swp|~|rej|orig)$/ # temporary/patch files\n next if f =~ /(\\.svn|\\.git)$/ # subversion/git\n next if f =~ /\\/\\.?#/ # Emacs autosave/cvs merge files\n filename = f.sub(/^\\.\\//, '')\n\n result[filename] = File.stat(filename).mtime rescue next\n end\n end\n \n self.files = result\n end",
"def search_in(options)\n files = options[:for_files]\n directory = options[:directory]\n if directory\n dir_files = files_in_directory(directory)\n files.select { |file| dir_files.include?(file) }\n else\n files\n end\n end",
"def prepare_pod_groups\n file_accessors.each do |file_accessor|\n pod_name = file_accessor.spec.name\n next unless sandbox.local?(pod_name)\n root_name = Specification.root_name(pod_name)\n path = file_accessor.root\n group = pods_project.group_for_spec(root_name)\n group.set_path(path) unless group.path == path\n end\n end",
"def determine_services(specified_groups = []) \n services = {}\n\n activated_service_groups = self.config.select do |group_id, group_definition|\n ((group_id == \"default\" || group_definition[\"default\"] == true) ||\n specified_groups.include?(group_id)) &&\n ! specified_groups.include?(\"-#{group_id}\")\n end\n\n activated_service_groups.each_pair do |group_id, group_definition|\n services.merge! (group_definition[\"services\"] || {})\n end\n\n # Remove any disabled services\n services.reject! {|service_id, hash| hash && hash[\"disabled\"] == true}\n\n return services\n end",
"def repo_files\n @vault.sys.auths.select { |_,v| v.type == 'ldap' }\n .keys\n .inject([]) { |acc, elem| acc + group_files(elem) }\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 control_files(node)\n files = []\n [Path.provider_base, @provider_dir].each do |provider_dir|\n [['services', :service_config], ['tags', :tag_config]].each do |attribute, path_sym|\n node[attribute].each do |attr_value|\n path = Path.named_path([path_sym, \"#{attr_value}.rb\"], provider_dir).sub(/\\.json$/,'')\n if File.exists?(path)\n files << path\n end\n end\n end\n end\n return files\n end",
"def find_files(recusive,sort)\n ext_list = $config[\"series\"][\"media_extentions\"].gsub(/,/,\"|\")\n files = [] \n if File.directory? sort\n Find.find(sort) do |path|\n next if File.dirname(path) != sort and not recusive\n next if File.directory? path\n next if File.basename(path) =~ /^\\./\n next if path !~ /#{ext_list}$/\n files << path\n end\n else\n log(\"error: source directory of \\\"#{sort}\\\" does not exist!\")\n exit 2\n end\n files\nend",
"def option_search_all(options)\n if(directory = options[:in_dir])\n search_in(:directory => directory, :for_files => search_all_files)\n else\n search_all_files\n end\n end",
"def findPaths (conf)\n puts aktTime()+' collecting files...'\n STDOUT.flush #write out immediately\n\tconf[:saveDirs].each do |d|\n\t\tif File.directory?(d)\n\t\t\tDir.chdir(d)\n\t\t\tgetFiles(conf)\n\t\telse\n\t\t\tputs \"\\nWarning: Directory: \\n\"+d+\" **not** found !\"\n\t\tend\n\tend\nend",
"def scan\n results = []\n dirs.each do |dir|\n files_in_dir = Dir.glob(File.join(dir,'**','*'))\n results.concat(files_in_dir)\n end\n @known_files = results\n end",
"def find_files(search_pattern, opts = {})\n Dir.chdir(@top_dir)\n Dir.glob(\"**/*#{search_pattern}*\").map do |path|\n next if File.directory?(path)\n next unless File.readable?(path)\n begin\n mt = mime_type_for_file(path)\n {\n name: path,\n url: get_url_for_path(path),\n mime_type: mt,\n size: File.size(path)\n }\n rescue\n debug \"Can't seem to look at '#{path}'\"\n nil\n end\n end.compact\n end",
"def get_files\n fields = \"next_page_token, files(id, name, owners, parents, mime_type, sharedWithMeTime, modifiedTime, createdTime)\"\n\n folders = []\n @files = []\n\n #Go through pages of files and save files and folders\n next_token = nil\n first_page = true\n while first_page || (!next_token.nil? && !next_token.empty?)\n results = @service.list_files(q: \"not trashed\", fields: fields, page_token: next_token)\n folders += results.files.select{|file| file.mime_type == DRIVE_FOLDER_TYPE and belongs_to_me?(file)}\n @files += results.files.select{|file| !file.mime_type.include?(DRIVE_FILES_TYPE) and belongs_to_me?(file)}\n next_token = results.next_page_token\n first_page = false\n end\n\n #Cache folders\n folders.each {|folder| @folder_cache[folder.id] = folder}\n\n #Resolve file paths and apply ignore list\n @files.each {|file| file.path = resolve_path file}\n @files.reject!{|file| Helper.file_ignored? file.path, @config}\n\n Log.log_notice \"Counted #{@files.count} remote files in #{folders.count} folders\"\n end",
"def system_services\n find_by_group(SYSTEM_GROUP)\n end",
"def find_assembly_files\n start_dir = self.location\n #logger.debug(\"self is #{self.inspect}\")\n #logger.debug(\"checking in location #{start_dir}\")\n files = Hash.new\n if ! File.directory? start_dir then\n errors.add(:location, \"Directory #{start_dir} does not exist on the system.\")\n #abort(\"Directory #{start_dir} does not exist on the system for #{self.inspect}\")\n return []\n end\n #logger.error(\"start dir is #{start_dir}\")\n Find.find(start_dir) do |path|\n filename = File.basename(path).split(\"/\").last\n skip_flag = 0\n FILE_SKIPS.each { |filepart, filehash| \n type = filehash[\"type\"]\n category = filehash[\"category\"]\n if category == 'suffix' then\n if (filename.match(\"#{filepart}$\")) then\n skip_flag = 1\n end\n else \n if (filename.match(\"#{filepart}\")) then\n skip_flag = 1\n end\n end\n\n }\n if (skip_flag == 1) then\n logger.error(\"Skipping file #{filename} because it matches a file skip\")\n next\n end\n FILE_TYPES.each { |filepart, filehash| \n\t type = filehash[\"type\"]\n\t vendor = filehash[\"vendor\"]\n if filename.match(filepart) then \n #logger.error(\"filename is #{filename}\")\n files[type] = Hash.new\n\t files[type][\"path\"] = path\n\t files[type][\"vendor\"] = vendor\n end\n }\n end\n return files\n end",
"def inspect_service_dir_for_metrics_files(dir_path, service)\n service_dir = Dir.open dir_path\n service_dir.each do |path|\n next if path =~ /^\\.$|^\\.\\.$/\n\n absolute_path = \"#{service_dir.path}/#{path}\"\n if File.directory?(absolute_path)\n inspect_service_dir_for_metrics_files(absolute_path, service)\n next\n end\n if path =~ /.json$/\n consider_json_for_inclusion(absolute_path)\n elsif path =~ /.tar.gz$/\n consider_tarfile_contents_for_inclusion(absolute_path, service)\n end\n end\n end",
"def deployable_services\n Dir.glob(\"#{@repository_path}/policyfiles/*.rb\").map { |file| File.basename(file, '.rb') }\n end",
"def loadservices\n yml = YAML::load(File.open('services.yml'))\n yml.each do |el| \n puts \"grabbing info for #{el[1]['name']}\"\n yml = infoFor(el[1]['regex'])\n logyml(el[1]['name'], yml)\n\n puts \"sending info for #{el[1]['name']}\"\n sendreport(el[1]['name'])\n end\n end",
"def process_images(pat, sp_name)\n sp = ServicePack.find_or_create_by_name(sp_name)\n images = ImagePath.find(:all, :conditions => \"path like '#{pat}'\")\n length = images.length\n images.each_with_index do |image, index|\n # puts \"processing image #{index} of #{length}\"\n image.package.filesets.each do |fileset|\n ServicePackFilesetMap.find_or_create_by_service_pack_id_and_fileset_id(sp.id, fileset.id)\n end\n end\nend",
"def files( starts_with: )\n msg_handler.bold_debug [ msg_handler.here,\n msg_handler.called_from,\n \"starts_with=#{starts_with}\",\n \"\" ] if msg_handler.debug_verbose\n rv = Dir.glob( \"#{starts_with}*\", File::FNM_DOTMATCH )\n msg_handler.bold_debug [ msg_handler.here,\n msg_handler.called_from,\n \"files.size=#{rv.size}\",\n \"\" ] if msg_handler.debug_verbose\n return rv\n end",
"def get_files (path, files_found) \n\t\tif File.directory? path\n\t\t\tDir.foreach path do |file| \n\t\t\t\tif (!EXCLUDED_FILES.include? file)\n\t\t\t\t\tget_files(path+file, files_found) \n\t\t\t\tend\n\t\t\tend\n\t\telsif File.file? path\n\t\t\tfiles_found << path\n\t\tend\n\tend",
"def findFilesCommand(baseDir)\n #N Without path prefix, wouldn't work if 'find' is not on path, without baseDir, wouldn't know which directory to start, without '-type f' would list more than just directories, without -print, would not print out the values found (or is that the default anyway?)\n return [\"#{@pathPrefix}find\", baseDir, \"-type\", \"f\", \"-print\"]\n end",
"def find_files(block)\n files = []\n block.scan(URL_PATTERN).each do |attribute, path|\n if !URI.parse(path).absolute?\n resource = create_resource_file(attribute, path)\n files << resource if resource\n end\n end\n files\n end",
"def traverse_files\n result = []\n paths = config[:paths].select { |p| File.exist?(p) }\n if paths.empty?\n log_warn \"search.paths #{config[:paths].inspect} do not exist\"\n return result\n end\n Find.find(*paths) do |path|\n is_dir = File.directory?(path)\n hidden = File.basename(path).start_with?('.')\n not_incl = config[:include] && !path_fnmatch_any?(path, config[:include])\n excl = path_fnmatch_any?(path, config[:exclude])\n if is_dir || hidden || not_incl || excl\n Find.prune if is_dir && (hidden || excl)\n else\n result << yield(path)\n end\n end\n result\n end",
"def file_get_files(directories) \n directory = \"\"\n files = []\n directories.each do |directory| \n unless directory == \"/root\"\n Dir.chdir(\"#{directory}\") \n Dir.foreach(\"#{directory}\") do |d| \n files.push(d) unless d == \".\" || d == \"..\" \n end\n @file_information.store(directory, files)\n files = []\n end\n end\n return @file_information\n end",
"def find_files(file_set:)\n if file_set.respond_to?(:file_ids)\n return [] unless file_set.file_ids.present?\n query_service.custom_queries.find_many_file_metadata_by_ids(ids: file_set.file_ids)\n else\n raise ::Valkyrie::Persistence::ObjectNotFoundError,\n \"#{file_set.internal_resource} is not a `Hydra::FileSet` implementer\"\n end\n end",
"def locate\n processes = includes.reduce(all_processes, &by_inclusion_patterns)\n processes = excludes.reduce(processes, &by_exclusion_patterns)\n processes = filters.reduce(processes, &by_filter)\n end",
"def find_files( directory, pattern='*')\n `find -H '#{directory}' -name \"#{pattern}\"`.split(\"\\n\").reject{|f| f==directory}\n end",
"def find_files(file_set:)\n if file_set.respond_to?(:file_ids)\n return [] if file_set.file_ids.blank?\n query_service.custom_queries.find_many_file_metadata_by_ids(ids: file_set.file_ids)\n else\n raise ::Valkyrie::Persistence::ObjectNotFoundError,\n \"#{file_set.internal_resource} is not a `Hydra::FileSet` implementer\"\n end\n end",
"def _find_files(*paths)\n paths.flatten.map do |path|\n path = Pathname.new(path)\n path.file? ? [path.to_s] : _find_files(path.children)\n end.flatten\n end",
"def find_files(*paths)\n Find.find(*paths).select do |path|\n File.file?(path)\n end\n end",
"def find_files(base_dir, flags)\n # get all wanted directories first to improve speed of finding all files\n exclude_pattern = combined_exclude_glob_patterns(base_dir)\n dir_flags = flags | File::FNM_PATHNAME | File::FNM_EXTGLOB\n patterns = wanted_dir_patterns(base_dir, exclude_pattern, dir_flags)\n patterns.map! { |dir| File.join(dir, '*') }\n # We need this special case to avoid creating the pattern\n # /**/* which searches the entire file system.\n patterns = [File.join(dir, '**/*')] if patterns.empty?\n\n Dir.glob(patterns, flags).select { |path| FileTest.file?(path) }\n end",
"def test_files\n get_folder_files(TESTS_PATH)\n end",
"def files_in_folder(folder, options={})\n pattern = \"**{,/*/**}/*\"\n # modify by Hub\n # add method glod : Dir.glob\n #Dir[File.join(folder, pattern)].uniq\n Dir.glob(File.join(folder, pattern)).uniq\n end",
"def list_fs_files\n all_files = []\n current_user_role_names.each do |role_name|\n next unless Filesystem.test_dir role_name, self, :read\n\n p = path_for role_name: role_name\n # Don't use Regex - it breaks if there are special characters\n paths = Dir.glob(\"#{p}/**/*\").reject do |f|\n Pathname.new(f).directory?\n end\n\n all_files += paths.map { |f| f.sub(\"#{p}/\", '').sub(p, '') }\n end\n\n all_files.uniq\n end",
"def files() = files_path.glob('**/*')",
"def list\n\t\t\tbegin\n\n\t\t\t\t# Prepare result, array of absolute paths for found files\n # within given directory. Also empty cache\n\t\t\t\tresult = []\n @scan_history = {}\n\n\t\t\t\t# Recursively scan current folder for files\n\t\t\t\tFind.find(@scan_path) do |current_full_path|\n\n\t\t\t\t\t# Get filename, prune if dot\n\t\t\t\t\tfilename = File.basename(current_full_path)\n Find.prune if filename[0] == ?.\n\n # Get extension\n extension = File.extname(current_full_path)\n\n\t\t\t\t\t# Check for file extension, if provided\n\t\t\t\t\tif @scan_extension && extension.eql?(@scan_extension)\n\n # Get foldername\n folder_name = File.dirname(current_full_path)\n\n # Get number of files parsed in current folder, default 0\n folder_depth = @scan_history.fetch(folder_name, nil) || 0\n Logging[self].debug \"At #{folder_name}\" if folder_depth == 0\n\n # If the desired depth hasn't been reached\n unless folder_depth == @scan_depth\n\n # Increase current depth\n folder_depth += 1\n\n # Add and log result\n Logging[self].warn \"Result: '#{current_full_path}'\"\n result << current_full_path\n\n # Update cache, proceed no further in this folder\n @scan_history[folder_name] = folder_depth\n Find.prune\n end\n\t\t\t\t\telse\n\t\t\t\t\t\n\t\t\t\t\t\t# Either move beyond this file, if we're searching\n\t\t\t\t\t\t# for specific files (filtered by extension), or add\n # the path to the result (since no filter applied)\n\t\t\t\t\t\t@scan_extension ? next : (result << current_full_path)\n\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\n end # find block\n\n # Log final result length\n Logging[self].info \"Retrieved #{result.length} results\"\n\n\t\t\t\t# Return result\n\t\t\t\tresult\n\n\t\t\t# Rescue any exceptions\n\t\t\trescue Exception => e\n\t\t\t\tLogging[self].error e\n nil\n\t\t\tend\n\t\tend",
"def process_files(sync_database)\n # Files to be copied\n copy_onedconf\n\n FILES.each do |file|\n copy_and_check(file[:name], file[:service])\n end\n\n # Folders to be copied\n FOLDERS.each do |folder|\n copy_folder(folder[:name], folder[:service])\n end\n\n restart_services\n\n # Sync database\n sync_db if sync_database\n end",
"def find(root, params)\n FileSearcher.call(root, params)\nend",
"def index\n @service_groups = ServiceGroup.all\n end",
"def get_associated_files(source_file_or_package)\n if package = pool.packages.detect {|pkg| pkg.name == source_file_or_package}\n pool.compile_package(package).to_a\n elsif source_file = pool.lookup(source_file_or_package)\n pool.lookup_dependencies(source_file).to_a << source_file\n else\n # Try using arg as mask\n mask = source_file_or_package.to_s\n if !(mask =~ /^\\s*$/) && !(source_files = pool.provides_tree.glob(mask).compact).empty?\n source_files.map {|source| get_associated_files(source) }.flatten\n else\n # No dice\n []\n end\n end\n end",
"def group_fastq_files starting_path, output_path, options = {:prefix => \"L\", :suffix => \".fastq.gz\", :exclude_undetermined => true}\n execute \"mkdir -p #{output_path}\"\n fastq_groups = []\n \n fastq_files = Dir.glob(File.join(starting_path, fastq_search_path))\n if fastq_files.empty?\n log \"# ERROR: no fastq files found in #{starting_path}\" if fastq_files.empty?\n else\n log \"# #{fastq_files.size} fastq files found in #{starting_path}\"\n fastq_file_data = get_file_data fastq_files, \"\\.fastq\\.gz\"\n fastq_groups = group_files fastq_file_data, output_path, options\n end\n fastq_groups\n end",
"def search(group, items)\n # Creates an Array of [String, RSS item] for all combinations.\n group.requests.product(items).each do |request, item|\n if match?(group, request, item)\n download(group.path, item)\n Notification.send(item.title)\n end\n end\n end",
"def search(group, items)\n # Creates an Array of [String, RSS item] for all combinations.\n group.requests.product(items).each do |request, item|\n if match?(group, request, item)\n download(group.path, item)\n Notification.send(item.title)\n end\n end\n end",
"def search\n puts \"\\nprocurando arquivos...\\n\"\n\n paths = []\n @apks.each do |apk|\n paths << apk.path\n end\n @apks.clear\n\n paths.each do |path|\n verify(path)\n end\n\n @apks.compact!\n apk_pri\n\n puts \"\\t#{@apks.count} arquivo(s) encontrado(s).\\n\"\n end",
"def get_files\n\tstart_dir = C_start_dir\n\tstart_dir += \"/\" if start_dir[-1..-1] != \"/\"\n\n\t# collect all file names recursively\n\tres = Dir.glob(\"#{start_dir}**/*\", File::FNM_DOTMATCH)\n\n\t# remove excluded dirs\n\tC_exclude_dir.each{|d| res = res.select{|x| not x[/^#{start_dir}#{d}\\//]} }\n\n\t# get db mod time for compare\n\tt = test_file(db_name) ? File.mtime(db_name).to_s[/[0-9]+\\-[0-9]+\\-[0-9]+\\ *[0-9]+\\:[0-9]+\\:[0-9]+/] : \"\"\n\n\t# remove files from os update\n\n\t# -------------------\n\t# --- dpkg plugin ---\n\t# -------------------\n\t# collect package names changed by os update from dpkg.log\n\td1 = Dir[\"/var/log/dpkg.log*.gz\"]\n\td2 = Dir[\"/var/log/dpkg.log*\"] - d1\n\tlog = \"\"\n\td1.each{|f| log += gunzip(f) }\n\td2.each{|f| log += File.read(f) }\n\t# find package name entries more recent than our db\n\tpkg = log.split(\"\\n\").sort.select{|x|x > t}.select{|x| x[/status *installed/]}.map{|x|x[/status *installed *[^\\:]+/].split[2]} - [\"man-db\"]\n\t# collect file names of all these package names\n\tlist = []\n\tpkg.sort.uniq.each {|x|\n\t\tDir.glob(\"/var/lib/dpkg/info/#{x}*.list\") {|y|\n\t\t\tlist << File.read(y).split(\"\\n\").select{|z| test_file(z)}\n\t\t}\n\t}\n\t# remove list to recursive dir list\n\tres -= list.sort.uniq\n\n\treturn [res, pkg]\nend",
"def grep_multiple(folder, search)\n\n folder = File.expand_path(folder)\n return nil if folder.nil? || search.nil? || !File.directory?(folder)\n folder = folder[0..-2] if folder =~ %r{/$} #remove trailing slash if present\n \n data, benchmark = safe_utf8_exec(options.grep_folder, search, folder)\n \n hash = {}\n \n #convert data from \n # file:line\n #into \n # file => [lines]\n data.each_line do |line|\n file, str = line.split(\":\", 2)\n file = url_from_file(file)\n hash[file] ||= []\n hash[file] << str\n end\n \n [hash, benchmark]\nend",
"def find_modules\n find_engine\n find_storage\n find_pod\n end",
"def listFiles()\n #N Without this the files won't get listed\n contentHost.listFiles(baseDir)\n end",
"def scan(dir,match=/\\.cha$/)\n files = []\n if not dir.split('/').pop =~ /^\\./ and File.directory?(dir)\n Dir.foreach(dir) do |file|\n path = File.join(dir,file)\n \n if File.directory?(path)\n# puts \"SCANNING #{path}\"\n scan(path,match).each { |pair| files.push pair }\n elsif file =~ match\n files.push path\n end\n end\n end\n\n return files\nend",
"def find_includes include_dirs, src\r\n includes = Rake::CParser.parse_file_includes src\r\n res = includes.collect { |inc|\r\n search_includes include_dirs, src, inc\r\n }\r\n res.compact\r\n end",
"def all_apf_finder( path_and_file = self.file_name_and_contents.path_and_file, all_apf_arr = [] )\n apf_files = find_apf( path_and_file )\n if apf_files.count > 0\n all_apf_arr << apf_files\n apf_files.each do |apf_file|\n if File.exists? apf_file\n path_and_file = apf_file\n all_apf_finder( path_and_file, all_apf_arr )\n else\n if self.hints_hash['file_does_not_exist']\n self.hints_hash['file_does_not_exist'] << apf_file\n else\n self.hints_hash = self.hints_hash.merge( 'file_does_not_exist' => [ apf_file ] )\n end\n end\n end\n end\n all_apf_arr\n end",
"def find_in(dir); end",
"def sync_many_files(files, user, api)\n files.group_by(&:project).each do |project, project_files|\n project_files.each_slice(FILES_CHUNK_SIZE) do |files_chunk|\n results = find_files_on_platform(files_chunk.map(&:dxid), project, api)\n\n files_chunk.each do |file|\n res = results.find { |r| r[:id] == file.dxid }\n # means that file doesn't exist on the platform anymore\n remove_local_file(file, user) unless res\n sync_file_state(res, file, user)\n end\n end\n end\n end",
"def all_files; end",
"def all_files; end",
"def find\n results = [] unless block_given?\n # paths = @path.is_a?(String) ? [@path] : @path\n\n begin\n exclude_dir_regex = @exclude_dir\n rescue => ex\n puts \"--exclude_dir regex Skipping, #{ex.message}\"\n exit\n end\n\n begin\n file_regex = (Regexp.new(@regex) if @regex)\n rescue => ex\n puts \"--rname regex : Skipping, #{ex.message}\"\n exit\n end\n\n recursively_find_file(exclude_dir_regex, path, results, file_regex)\n\n block_given? ? nil : results\n end",
"def find_password_files(output_file, verbose)\r\n #try to write timestamp to file\r\n begin\r\n file_local_write(output_file,\"#Started at #{Time.now}:\")\r\n rescue ::Exception => e\r\n print_error(\"Error opening file #{output_file}:\\n #{e.class} #{e}\")\r\n raise e\r\n end\r\n begin\r\n count = 0\r\n count_view = 0\r\n print_status(\"Starting search. #{Time.now}:\")\r\n print_status(\"Printing output to #{output_file}\")\r\n #search filesystems for /pass/\r\n results = client.fs.file.search(nil,'*pass*',true)\r\n\r\n #for each result - echo to output file, show output by verbosity\r\n results.each do |file|\r\n file_local_write(output_file,\"#{file['path']}\\\\#{file['name']}\")\r\n count += 1\r\n #if quiet - no output.\r\n next if verbose == 'q'\r\n #if NOT verbose - prune windir\r\n next if verbose != 'v' and (file['path'].to_s)[4..12] =~ /windows\\\\/i\r\n #if minimal - only show txt, doc, xml, csv files\r\n next if verbose == 'm' and file['name'] !~ /\\.txt|\\.doc|\\.xml|\\.csv|\\.xls/i\r\n print_status(\"\\t#{file['path']}\\\\#{file['name']} (#{file['size']} bytes)\")\r\n count_view += 1\r\n end\r\n print_status(\"End Search. #{Time.now}:\")\r\n print_status(\"Found #{count} files. Showing #{count_view} files\")\r\n rescue ::Exception => e\r\n print_error(\"Error searching:\\n #{e.class} #{e}\")\r\n raise e\r\n end\r\nend",
"def list_files\n Find.find(path) do |element| yield element end\n end",
"def local_files(definition, packages: [])\n files = []\n validator, downloader = setup_os(definition.os)\n\n packages.each do |package|\n path = downloader.destination_for(package, definition)\n if File.file?(path)\n if validator.validate(package, path, definition)\n files << [package, path, definition[package]]\n else\n UI.important \"File present at #{path} is not correct, will not be used. Skipping #{package}\"\n end\n else\n UI.error \"No file has been downloaded for #{package}, or it has been moved from #{path}\"\n end\n end\n\n files\n end",
"def getFiles (conf)\n # include even .xxx ( dotted ) files \n\t(Dir.glob(\"*\", File::FNM_DOTMATCH) - %w[. ..]).each do |f|\n\t\tf=File.expand_path(f)\t\t\t# get complete path for file\n ts = File.mtime(f)\n\t\tif File.directory?(f)\n conf[:fsize] += 1 #count dirs as size 1\n conf[:zipFiles]<< f #add even excluded dir as empty folder only\n\t\t\tnext if exclude(f,conf[:exDirs])\n conf[:modTS] = ts if ts > conf[:modTS]\n\t\t\tDir.chdir(f)\n\t\t\tgetFiles(conf)\t# recursively explore subdir\n\t\t\tDir.chdir(\"..\")\n\t\telse\n next if exclude(f,conf[:exFiles])\n\t\t\tconf[:zipFiles]<< f \n conf[:fsize] += File.size(f)\n conf[:modTS] = ts if ts > conf[:modTS]\n\n\t\tend\n\tend\nend",
"def diff_project_files(group)\n find_fs_files(group.real_path)\n\n group.groups.each do |child|\n diff_project_files(child)\n end\n\n group.files.each do |file_ref|\n path = file_ref.real_path\n entry = track_file(path)\n entry.in_target = true\n entry.ref = file_ref\n\n if path.file?\n entry.in_source = true\n end\n end\n end",
"def list_files\n User.sync_files!(@context)\n files = user_real_files(params, @context)\n\n if unsafe_params[:limit] && unsafe_params[:offset]\n files = files.limit(unsafe_params[:limit]).offset(unsafe_params[:offset])\n end\n\n search_string = params[:search_string].presence || \"\"\n\n result = files.eager_load(:license, user: :org).\n where(\"nodes.name LIKE ?\", \"%#{search_string}%\").\n order(id: :desc).map do |file|\n describe_for_api(file, unsafe_params[:describe])\n end.compact\n\n render json: unsafe_params[:offset]&.zero? ? { objects: result, count: result.length } : result\n end",
"def files\n return get_result('files')\n end",
"def search(command)\n resp = @client.files.search('/', clean_up(command[1]))\n\n for item in resp\n puts item.path\n end\n end",
"def _find_files(*paths)\n paths.flatten!\n paths.map! { |p| Pathname.new(p) }\n files = paths.select(&:file?)\n\n (paths - files).each do |dir|\n files << _find_files(dir.children)\n end\n\n files.flatten.map(&:to_s)\n end"
] |
[
"0.6939348",
"0.6546415",
"0.630141",
"0.62237555",
"0.61721474",
"0.6061502",
"0.6047479",
"0.6020904",
"0.5992923",
"0.59679884",
"0.59679884",
"0.59627223",
"0.5959475",
"0.5917015",
"0.5891461",
"0.58693886",
"0.58693886",
"0.5856694",
"0.58457494",
"0.58281225",
"0.58099383",
"0.58023155",
"0.58013684",
"0.57804006",
"0.57732946",
"0.57722145",
"0.57270354",
"0.5706333",
"0.5706057",
"0.5679584",
"0.5667721",
"0.5660465",
"0.56500643",
"0.5645815",
"0.56431717",
"0.56153375",
"0.5609025",
"0.56045467",
"0.55650043",
"0.55506426",
"0.5546643",
"0.554544",
"0.55371463",
"0.5525326",
"0.5476446",
"0.5468948",
"0.5464051",
"0.54610264",
"0.5451255",
"0.5448361",
"0.5446755",
"0.54281867",
"0.54257154",
"0.54148513",
"0.5407409",
"0.5396327",
"0.5394934",
"0.53838754",
"0.5382811",
"0.5380978",
"0.5376677",
"0.5365389",
"0.53616065",
"0.5355326",
"0.53309065",
"0.5328988",
"0.53258485",
"0.53220314",
"0.5315118",
"0.53141946",
"0.5302736",
"0.5290621",
"0.528747",
"0.5279481",
"0.5269829",
"0.5254175",
"0.52506965",
"0.52506965",
"0.52434707",
"0.52303296",
"0.52300864",
"0.52208155",
"0.5216252",
"0.5215038",
"0.52135116",
"0.52093506",
"0.5207279",
"0.5206138",
"0.52020156",
"0.52020156",
"0.5198052",
"0.5188162",
"0.51847273",
"0.5182352",
"0.5181971",
"0.5177257",
"0.5176077",
"0.5173441",
"0.517209",
"0.51673216"
] |
0.6285783
|
3
|
Method to test if a given string is a number
|
def is_a_number?(s)
s.to_s.match(/\A[+-]?\d+?(\.\d+)?\Z/) == nil ? false : true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_number? string\n true if Float(string) rescue false\n end",
"def is_number?(string)\n true if Integer(string) && Integer(string) >= 0 rescue false\n end",
"def number?(string)\n string.to_i.to_s == string\n end",
"def is_number? string\n true if Float(string) rescue false\n end",
"def is_number? string\n true if Float(string) rescue false\n end",
"def is_number? string\n true if Float(string) rescue false\n end",
"def is_number?(string)\n true if Float(string) rescue false\n end",
"def is_number?(str)\n true if Float(str) rescue false\n end",
"def is_num(str)\n\treturn true if str =~ /^\\d+$/\n true if Int(str) rescue false\nend",
"def is_number?(string)\n true if Float(string) rescue false\n end",
"def is_number(str)\n str.to_f.to_s == str.to_s || str.to_i.to_s == str.to_s\n end",
"def is_number? string\n \t\ttrue if Float(string) rescue false\n\tend",
"def is_a_number?(str)\n str.match(/\\d/)\nend",
"def is_a_number?(s)\n \ts.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true\n\tend",
"def is_numeric?(s)\n # input -> s: a string\n # output -> true if the string is a number value, false otherwise\n begin\n if Float(s)\n return true\n end\n rescue\n return false\n end\n end",
"def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true \n end",
"def is_a_number?(s)\n s.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? false : true \n end",
"def is_number?(str)\n return str == str.to_f.to_s || str == str.to_i.to_s\nend",
"def numeric?(str)\n !str.to_s.match(/^-?[\\d.]+$/).nil?\n # str.to_i.to_s == str\nend",
"def value_is_integer?(string)\n return string.strip.numeric?\n end",
"def numeric?(string)\n !!(string =~ /\\A\\d+\\Z/)\nend",
"def is_numeric(str)\n true if Integer(str) rescue false\nend",
"def is_number?(string)\n # catch and return false if it isn't an integer\n true if Float(string) rescue false \nend",
"def is_numeric?(s)\n !!Float(s) rescue false\n end",
"def is_number? string\n true if Float(string) rescue false\nend",
"def is_numeric?\n self.match(/^[0-9]+$/)\n end",
"def _is_numeric?(str)\n Float(str) != nil rescue false\n end",
"def is_number(string)\r\n\ttrue if Float(string) rescue false\r\nend",
"def can_be_number(string)\n forced_as_f = string.to_f # force string to be a float\n forced_as_i = string.to_i # force string to be an integer\n return string == forced_as_f.to_s || string == forced_as_i.to_s # see if either of the forced strings equal the original\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\n end",
"def ValidNumber? (string)\t\t\t\t\t\t\t\t\n\t### Check if a non-numeric character ever appears in the string using /\\D/\n\t### If so, we know it's not a 'NUMBER' as defined\n\t### Also check if string is empty\n\treturn ( not(/\\D/ =~ string) && not(string.length.zero?) ), string.to_i\nend",
"def is_numeric?(s)\n !!Float(s) rescue false\n end",
"def number?(str)\n !!Integer(str)\nrescue ArgumentError, TypeError\n false\nend",
"def contains_number (str)\n\n\treturn str =~ /\\d/\n\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string\nend",
"def is_numeric(str)\n Float(str) != nil rescue false\n end",
"def is_a_number?(word)\n Integer(word) rescue false\nend",
"def is_number(input)\n input.to_s == input.to_i.to_s\nend",
"def is_numeric?(s)\n begin\n Float(s)\n rescue\n false # not numeric\n else\n true # numeric\n end\nend",
"def number?\n !!strip.match(/^-?\\d\\.?\\d*$/)\n end",
"def isNumeric(s)\n\t\tbegin\n\t\t\tFloat(s)\n\t\trescue\n\t\t\tfalse # not numeric\n\t\telse\n\t\t\ttrue # numeric\n\t\tend\n\tend",
"def numeric?(character)\n (character =~ /[0-9]/) == 0\n end",
"def is_number?(input)\n true if Float(input) rescue false\n end",
"def is_numeric?(num)\n num == num.to_i.to_s || num == num.to_f.to_s\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\n end",
"def is_number?(string)\n true if Float(string) rescue false #need to understand this\nend",
"def is_number(str)\n true if Float(str)\nrescue StandardError\n false\nend",
"def check_for_number(s)\r\n #check for number. real numbers either have . or , separators\r\n index = s =~ /[^-\\d\\.,]/ \r\n return index == nil\r\n end",
"def is_number? expr\n return false if expr.nil?\n expr = \"#{expr}\" # we need this condition in case the expr is a number\n expr.match /^(\\d+|\\d+\\.\\d+)$/ # since match() is defined only for strings\nend",
"def numeric?(string)\n Float(string) != nil rescue false\n end",
"def isNum?(num)\n /[0-9]/.match(num.to_s) != nil\nend",
"def is_numeric?\n for c in self.gsub('.', '').gsub('-', '').scan(/./)\n return false unless (0..9).to_a.map { |n| n.to_s }.include?(c)\n end\n return true\n end",
"def is_numeric?(i)\n # check if i is a number\n i.to_i.to_s == i || i.to_f.to_s == i\n end",
"def not_a_number?(n)\n \tn.to_s.match(/\\A[+-]?\\d+?(\\.\\d+)?\\Z/) == nil ? true : false\n end",
"def is_num?(input_value)\n (input_value =~ /^-?[0-9]+$/) == 0 ? true : false\nend",
"def is_integer(string)\n /\\A[+-]?\\d+\\Z/ === string\n end",
"def integer?(str)\n /\\A[+-]?\\d+\\z/ === str\n end",
"def is_number(input)\n \t\tinput.to_f == input\n\tend",
"def valid_looking_string?(str)\n str =~ /\\d/\n end",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string.to_i != 0\nend",
"def is_integer? string\n true if Integer(string) rescue false\n end",
"def valid_number?(num)\n num.to_s unless num.is_a? String\n /\\A[+-]?\\d+(\\.[\\d]+)?\\z/.match num\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string != 0\nend",
"def valid_number?(number_string)\n number_string.to_i.to_s == number_string && number_string != 0\nend"
] |
[
"0.86003387",
"0.8599222",
"0.8599198",
"0.85716003",
"0.8518382",
"0.8518382",
"0.84963095",
"0.8489259",
"0.84880173",
"0.84496814",
"0.84259415",
"0.83837295",
"0.8361107",
"0.8277064",
"0.8276294",
"0.8238891",
"0.8238891",
"0.82079613",
"0.8188625",
"0.8137609",
"0.8122267",
"0.81011575",
"0.7998128",
"0.7978025",
"0.7938493",
"0.7908775",
"0.7891361",
"0.7882886",
"0.7872255",
"0.78710955",
"0.7865244",
"0.7859486",
"0.7855181",
"0.7853693",
"0.7850093",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.78493875",
"0.7837284",
"0.77929294",
"0.7790903",
"0.7778947",
"0.7756739",
"0.77561224",
"0.7743651",
"0.7715132",
"0.76562876",
"0.76471674",
"0.7645632",
"0.7644076",
"0.76047003",
"0.758598",
"0.7582122",
"0.7579448",
"0.7578207",
"0.7543803",
"0.7526911",
"0.7510415",
"0.75078654",
"0.7503168",
"0.7501463",
"0.74975073",
"0.7486599",
"0.7486599",
"0.7486599",
"0.7486599",
"0.7486599",
"0.7486599",
"0.7486599",
"0.7486599",
"0.7486599",
"0.7486599",
"0.7486599",
"0.7486599",
"0.7486599",
"0.7486599",
"0.7486599",
"0.7486599",
"0.7485598",
"0.7461106",
"0.74531764",
"0.74531764"
] |
0.8405007
|
12
|
GET /lead_entries GET /lead_entries.json
|
def index
@lead_entries = LeadEntry.where(:lead_id => params[:lead_id]).paginate(:page => params[:page])
respond_to do |format|
format.html { render action: 'index' }
format.json {
render :json => {
:amount => @lead_entries.length,
:success => true,
:html => (render_to_string partial: 'list.html.haml')
}
}
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end",
"def index\n @leads = Lead.upcoming\n .includes(:updates, :agents, :agent)\n .order(created_at: :desc)\n .page(params[:page])\n .per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leads }\n end\n end",
"def index\n @entries = Entry.desc(:created_at).page(params[:page] || 1).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index\n @leads = Lead.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leads }\n end\n end",
"def index\n @entries = list_entries\n respond_with @entries\n end",
"def entries\n trace 'entries'\n $data['entries']\n end",
"def show\n @ledger_entry = LedgerEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ledger_entry }\n end\n end",
"def index\n @entries = Entry\n .paginate(:page => params[:page], :per_page => 10)\n .find_all_by_entry_type(params[:entry_type].presence || 'post', :include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index\n @entries = @time_sheet.entries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index\n @user = User.find(params[:user_id])\n @entries = @user.entries.paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index_entries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EntriesApi.index_entries ...'\n end\n # resource path\n local_var_path = '/api/v1/entries'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'dataset_id'] = opts[:'dataset_id'] if !opts[:'dataset_id'].nil?\n query_params[:'person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil?\n query_params[:'from_date'] = opts[:'from_date'] if !opts[:'from_date'].nil?\n query_params[:'to_date'] = opts[:'to_date'] if !opts[:'to_date'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<Entry>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['authToken']\n\n new_options = opts.merge(\n :operation => :\"EntriesApi.index_entries\",\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: EntriesApi#index_entries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def entries\n params[:return_entries] = true\n self\n end",
"def index\n @ldap_entries = LdapEntry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ldap_entries }\n end\n end",
"def entries(options={})\n return @entries if @entries and options == {} \n validate_options(options)\n @entries = Harvest::Resources::Entry.find(:all, :conditions => {:person_id => self.id}, :params => format_params(options))\n end",
"def get_entries\n @page.all(input_elements[:entries])\n end",
"def index\n @leads = Lead.all.page params[:page]\n end",
"def index\n @journal_entries = JournalEntry.desc(:entry_date).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n # [{\"name\":\"temperature\",\"type\":\"areaspline\",\"data\":[[1327213807000,0],[1327214100000,0],[1327214403000,0],[1327214700000,0],[1327215000000,24],[1327215301000,59.8],[1327215603000,95.4],[1327215901000,120.8],[1327216202000,131.6]]}]\n format.json { render json: JournalEntry.all.as_json(only: [:purity, :fitness, :devotional, :chrissy, :relational, :discipline, :facepicking, :stress]) }\n end\n end",
"def entries\n trace 'entries'\n @data['entries']\n end",
"def index\n @diary_entries = DiaryEntry.all\n end",
"def index\n @diary_entries = DiaryEntry.all\n end",
"def list_entries\n\nend",
"def ledger_entry(ledger_entry_id)\n API::request(:get, \"ledger_entries/#{ledger_entry_id}\")\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def show\n\t\t@lead = Lead.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t format.html # show.html.erb\n\t\t format.json { render json: @lead }\n\t\tend\n\tend",
"def entries\n data[:entries]\n end",
"def entries\n AllEntries.new(Page.new(latest_events_path, @mingle_access))\n end",
"def index\n @title = \"医药招商\"\n @entries = Entry.recent.includes(:user).page(params[:page] || 1).per(30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def show\n @entry = @time_sheet.entries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def getLeads\n\n\t\tlead_class=@client.materialize(\"Lead\")\n\t\tleads=Lead.all\n\t\treturn leads\n\tend",
"def index\n @entries = Entry.order(\"created_at DESC\").includes(:user)\n @days_left = ( Date.new( 2013, 06, 23 ) - Date.today ).to_i\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index\n @leads = Lead.all()\n end",
"def index\n @gl_account=params[:gl_account]\n if params[:gl_account]\n\n @gl_entries = GlEntry.where(:gl_account_id => params[:gl_account])\n else\n @gl_entries = GlEntry.all\n end\n respond_to do |format|\n format.html # index.html.erb\n @gl_entris = Array.new\n format.json {\n @gl_entries.select{|gl_entry|\n gl_entri = Hash.new\n gl_entry.attributes.each do |key, value|\n gl_entri[key] = value\n end\n if can? :edit, GlEntry\n gl_entri[:links] = CommonActions.object_crud_paths(nil, edit_gl_entry_path(gl_entry), gl_entry_path(gl_entry))\n else\n gl_entri[:links] = \"\"\n end\n gl_entri[:gl_entry_identifier] = CommonActions.linkable(gl_entry_path(gl_entry), gl_entry.gl_entry_identifier)\n gl_entri[:gl_account_name] = CommonActions.linkable(gl_account_path(gl_entry.gl_account), gl_entry.gl_account.gl_account_title)\n gl_entri[:gl_entry_description] = gl_entry.get_description_link\n @gl_entris.push(gl_entri)\n }\n render json: {:aaData => @gl_entris}\n }\n end\n end",
"def entries(query = {})\n resp =\n _instrument 'entries', type: 'Entry', query: query do\n get('entries', query)\n end\n resp.assert_ok!\n end",
"def show\n @lead_step = LeadStep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lead_step }\n end\n end",
"def show\n @ledger_entries = @invoice.ledger_entries.page(params[:page])\n respond_with @organization, @invoice\n end",
"def index\n @finance_leads = FinanceLead.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @finance_leads }\n end\n end",
"def index\n @leads = Lead.all\n end",
"def index\n @leads = Lead.all\n end",
"def index\n if params[:dictionary_id]\n @dictionary = Dictionary.find(params[:dictionary_id])\n @entries = @dictionary.entries\n else\n @entries = Entry.all\n end\n end",
"def get_entries(json: nil, ld: nil)\n entries = []\n data = ld ? ld[self.uri] : nil\n if data\n data.each do |key, value|\n prefix, index = key.split('_')\n entries[index.to_i - 1] = self.factory.get(value[0]['value'], self, ld: ld) if prefix == KEY_PREFIX\n end\n end\n entries\n end",
"def index\n @entries = @wall.entries.limit(15)\n end",
"def index\n @days = @trip.days.order(trip_day: :asc)\n render json: @days, include: [:activities]\n end",
"def index\n @entries = Entry.where(:blog_id => params[:blog_id])\n end",
"def entries\n Entry.where(:feed_id => pk)\n end",
"def show\n @agents = Agent.employees.order('created_at ASC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lead }\n end\n end",
"def all\n @timesheet_entries = TimesheetEntry.all\n\n respond_to do |format|\n format.html { render json: @timesheet_entries }\n format.json { render json: @timesheet_entries }\n end\n end",
"def entries\n @entries ||= Scraper.instance.get_all(Entry, @path, [\n [:reflex, 'td[2]/text()'],\n [:description, 'td[3]/text()'],\n [:language_name, 'td[1]/a/text()'],\n [:language_path, 'td[1]/a/@href'],\n [:source_code, 'td[4]/a/text()'],\n [:source_path, 'td[4]/a/@href'],\n [:reconstruction_name, nil, lambda {|x| @protoform}],\n [:reconstruction_path, nil, lambda {|x| @path}],\n [:flag, \"td[3]/span[@class='flag']/text()\"]\n ], 1)\n end",
"def index\r\n @leads = Lead.all\r\n end",
"def __entries__\n @entries\n end",
"def index\n @goal_entries = GoalEntry.all\n end",
"def index\n @r_entries = REntry.all\n end",
"def entries\n @entries ||= Scraper.instance.get_all(Entry, @path, [\n [:reflex, 'td[2]/text()'],\n [:description, 'td[3]/text()'],\n [:language_name, nil, lambda {|x| @name}],\n [:language_path, nil, lambda {|x| @path}],\n [:source_code, 'td[4]/a/text()'],\n [:source_path, 'td[4]/a/@href'],\n [:flag, \"td[3]/span[@class='flag']/text()\"]\n ])\n end",
"def index\n @entries = Entry.all.first(100)\n end",
"def show\n @feed = Feed.find(params[:id])\n @related_feeds = @feed.list_related_feeds(current_user)\n @feed_entries = Entry.where(feed_id: @feed.id).order(\"updated_at DESC\").page(params[:page]).per(10)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def days\n @trainings = Training.all\n @activities = Activity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trainings }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n render json: @entry\n end",
"def index\n @absences = Absence.where(\"member_id = ?\",params[:member_id]).order(\"start_date DESC\").page(params[:page]).per(7)\n @member = Member.find(params[:member_id])\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @absences }\n end\n end",
"def create\n @lead_entry = LeadEntry.new lead_entry_params\n\n respond_to do |format|\n if @lead_entry.save\n format.html { redirect_to @lead_entry, notice: 'Lead entry was successfully created.' }\n format.json { render :json => {\n :success => true,\n :html => (render_to_string partial: 'list_item.html.haml', :lead_entry => @lead_entry)\n }\n }\n else\n format.html { render action: 'new' }\n format.json { render json: @lead_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @ledger_entry = @organization.ledger_entries.find(params[:id])\n respond_with @organization, @ledger_entry\n end",
"def get_leads(opts = {})\n data, status_code, headers = get_leads_with_http_info(opts)\n return data\n end",
"def entries(options = {})\n query = {}\n\n if options[:filters]\n query['match'] = options[:filter_match] || 'AND'\n options[:filters].each_with_index do |filter, index|\n query[\"Filter#{index + 1}\"] = filter.join(' ')\n end\n end\n\n query[:pageSize] = options[:limit] if options[:limit]\n\n query[:pageStart] = options[:pageStart] if options[:pageStart]\n\n query[:system] = true if options[:system]\n\n if options[:sort]\n field, direction = options[:sort].split(' ')\n query[:sort] = field\n query[:sortDirection] = direction || 'ASC'\n end\n\n @party.get(\"forms/#{@id}/entries\", query: query)['Entries']\n end",
"def index\n @entries = Entry.all.order(:created_at).page params[:page]\n\n\n end",
"def entries(options={})\n validate_entries_options(options)\n entry_class = Harvest::Resources::Entry.clone\n entry_class.project_id = self.id\n entry_class.find :all, :params => format_params(options)\n end",
"def index\n @homepageentries = Homepageentry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @homepageentries }\n end\n end",
"def index\n @entry_logs = EntryLog.all\n end",
"def deals_timeline(**args)\n params = parameters(args) do\n required_params :start_date, :interval, :amount, :field_key\n optional_params :start_date, :interval, :amount, :field_key, :user_id, :pipeline_id, :filter_id, :exclude_deals, :totals_convert_currency\n end\n request(:get, 'deals/timeline', params)\n end",
"def index\n @journal_entries = current_user.journal_entries\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @journal_entries }\n end\n end",
"def where(options = {})\n _, _, root = @client.get(\"/leads\", options)\n\n root[:items].map{ |item| Lead.new(item[:data]) }\n end",
"def index\n @leases = Lease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @leases }\n end\n end",
"def index\n @entries = Entry.order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def get_user_entries\n user_entry = Entry.where(user_id: params[:user])\n render json: EntrySerializer.new(user_entry).to_serialized_json\n end",
"def index\n @entries = Entry.find_all_by_time(params[:date], :order => :created_at)\n @entry ||= Entry.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def rest_lead_stream url, list_id\n\n response = self.get url\n json = JSON.parse(response.body, :symbolize_names => true)\n results = json[:result]\n\n if results\n results.each { |result| @csv << [result[:id]] }\n @csv.flush\n puts \"#{Time.now} => REST:leadList:#{list_id}:Results:#{results.length}\" if GoodDataMarketo.logging\n end\n\n next_page_token = json[:nextPageToken]\n\n # If there is another page, remember it and then attempt the next load.\n if next_page_token\n\n self.remember_next_page :token => token, :list => list_id\n domain = @marketo_domain\n parameters = \"&fields=#{@fields}\"\n endpoint= \"/rest/v1/list/#{list_id}/leads.json\"\n url = domain + endpoint + @token_uri + parameters + \"&nextPageToken=\" + next_page_token\n rest_lead_stream url, list_id\n\n else\n\n # Update the local and remote lead lists\n File.open('lead_list_ids.json','w'){ |f| JSON.dump(@lead_list_ids, f) }\n @webdav.upload('lead_list_ids.json')\n\n end\n\n end",
"def index\n #body, ok = SuperfeedrEngine::Engine.retrieve(Feed.first) \n @entries = Entry.all\n end",
"def index\n\t\t@leads = Lead.all\n\t\t\n\t\t\n\n\t\tlogger.info params[:status]\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @leads }\n\t\tend\n\tend",
"def entries(options={})\n return @entries if @entries and options == {}\n validate_entries_options(options)\n @entries = Harvest::Resources::Entry.find(:all, :include => options[:include], :conditions => {:project_id => self.id}, :params => format_params(options))\n end",
"def index\n @entries = Entry.all;\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @entries = Entry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def get_leads_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LeadsApi#get_leads ...\"\n end\n \n # resource path\n path = \"/Leads\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'include_converted'] = opts[:'include_converted'] if opts[:'include_converted']\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n query_params[:'skip'] = opts[:'skip'] if opts[:'skip']\n query_params[:'top'] = opts[:'top'] if opts[:'top']\n query_params[:'count_total'] = opts[:'count_total'] if opts[:'count_total']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<APILead>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LeadsApi#get_leads\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @lead = current_user.leads.find(params[:id])\n # \n # respond_to do |format|\n # format.html render :show, :layout => 'lead_show'\n # format.json { render :json => @lead }\n # end\n end",
"def index\n @feed_entries = FeedEntry.all\n end",
"def show\n @feed = Feed.find(params[:id])\n @entries = EntryFeed.where(:feed_id => @feed.id)\n\n if @entries.blank?\n EntryFeed.create_from_feed(@feed)\n @entries = EntryFeed.where(:feed_id => @feed.id)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @feed }\n end\n end",
"def show\n @category = Category.find(params[:id])\n @feeds = @category.feeds\n @entries = @category.entries.includes([:feed, :clip]).page params[:page]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => {\n :category => @category,\n :feeds => @feeds,\n :entries => @entries # TODO entryごとのclipがjsonに含まれてない\n }}\n end\n end",
"def show\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @journal_entry }\n end\n end",
"def show\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @journal_entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n respond_to do |format|\n format.html {}\n format.json { render json: @entry }\n end\n end",
"def entries\n require_initialized_entry_class do \n Array.load(self[:@entries_url])\n end\n end",
"def get_lead_stages\n if params[:page].present?\n @page = params[:page]\n else\n @page = \"lead_listing\"\n end\n @lead = @current_organization.deals.find(params[:id])\n render partial: \"get_stages\"\n end",
"def index\n @journal_entries = JournalEntry.order(\"entry_date desc\").page(params[:page])\n end",
"def get\n puts \"In entries#get, params=#{params}\"\n context = params\n context[:entry_id] = params[:id]\n context[:mode] = 'display'\n context[:view_type] = \"table\"\n\n @entryHtml = getEntryHtml(context)\n if request.xhr? \n render :json => {:html => @entryHtml, :context => context}\n else\n render :template => \"/entries/get.html.erb\"\n\n end\n\n end",
"def entries\n STDOUT.puts db.entries(@params[:domain]).map{|row| row.to_parsed_h}.to_json\n end",
"def index\n @attendees = Attendees.all\n render json: @attendees\n end",
"def set_lead_entry\n @lead_entry = LeadEntry.find(params[:id])\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def new\n @ledger_entry = LedgerEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ledger_entry }\n end\n end"
] |
[
"0.66127133",
"0.63569206",
"0.6349944",
"0.6346621",
"0.6329326",
"0.627506",
"0.6217444",
"0.61875",
"0.6157041",
"0.60316324",
"0.60303825",
"0.60194683",
"0.6015344",
"0.5992507",
"0.5970858",
"0.59628105",
"0.5953543",
"0.5945469",
"0.5926073",
"0.5926073",
"0.5912297",
"0.59088093",
"0.5908721",
"0.5908721",
"0.5908721",
"0.5908721",
"0.5908721",
"0.5908721",
"0.5897465",
"0.5892035",
"0.58913916",
"0.5888717",
"0.58847696",
"0.586019",
"0.58320665",
"0.5831699",
"0.58200777",
"0.5806806",
"0.58029705",
"0.57984304",
"0.5798071",
"0.57905614",
"0.57905614",
"0.5772136",
"0.5761417",
"0.5755309",
"0.57426727",
"0.57297105",
"0.57216895",
"0.5711174",
"0.5683443",
"0.5680385",
"0.5676821",
"0.5674246",
"0.56697315",
"0.5665472",
"0.56458086",
"0.56242406",
"0.5623153",
"0.56148446",
"0.5608314",
"0.5607094",
"0.56036884",
"0.56026417",
"0.55982584",
"0.55920696",
"0.55896294",
"0.5574902",
"0.55734384",
"0.55695915",
"0.5565505",
"0.5558897",
"0.55579567",
"0.55535156",
"0.555339",
"0.555325",
"0.5538848",
"0.5536757",
"0.5533164",
"0.55326104",
"0.5520105",
"0.551944",
"0.5517051",
"0.550873",
"0.5506951",
"0.5501542",
"0.5501363",
"0.5492744",
"0.54909766",
"0.54909766",
"0.54891986",
"0.5486817",
"0.5476471",
"0.54748416",
"0.54730916",
"0.5467404",
"0.54580325",
"0.54568344",
"0.5443171",
"0.54354304"
] |
0.7180695
|
0
|
GET /lead_entries/1 GET /lead_entries/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @lead_entries = LeadEntry.where(:lead_id => params[:lead_id]).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html { render action: 'index' }\n format.json {\n render :json => {\n :amount => @lead_entries.length,\n :success => true,\n :html => (render_to_string partial: 'list.html.haml')\n }\n }\n end\n end",
"def show\n @ledger_entry = LedgerEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ledger_entry }\n end\n end",
"def show\n @lead_step = LeadStep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lead_step }\n end\n end",
"def show\n\t\t@lead = Lead.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t format.html # show.html.erb\n\t\t format.json { render json: @lead }\n\t\tend\n\tend",
"def show\n @entry = @time_sheet.entries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def index\n @leads = Lead.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leads }\n end\n end",
"def index\n @entries = Entry.desc(:created_at).page(params[:page] || 1).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n render json: @entry\n end",
"def index\n @entries = @time_sheet.entries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index\n @leads = Lead.upcoming\n .includes(:updates, :agents, :agent)\n .order(created_at: :desc)\n .page(params[:page])\n .per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leads }\n end\n end",
"def ledger_entry(ledger_entry_id)\n API::request(:get, \"ledger_entries/#{ledger_entry_id}\")\n end",
"def set_lead_entry\n @lead_entry = LeadEntry.find(params[:id])\n end",
"def index\n @entries = list_entries\n respond_with @entries\n end",
"def index\n @entries = Entry\n .paginate(:page => params[:page], :per_page => 10)\n .find_all_by_entry_type(params[:entry_type].presence || 'post', :include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def index_entries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EntriesApi.index_entries ...'\n end\n # resource path\n local_var_path = '/api/v1/entries'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'dataset_id'] = opts[:'dataset_id'] if !opts[:'dataset_id'].nil?\n query_params[:'person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil?\n query_params[:'from_date'] = opts[:'from_date'] if !opts[:'from_date'].nil?\n query_params[:'to_date'] = opts[:'to_date'] if !opts[:'to_date'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<Entry>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['authToken']\n\n new_options = opts.merge(\n :operation => :\"EntriesApi.index_entries\",\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: EntriesApi#index_entries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @entry = Entry.find(params[:id])\n respond_to do |format|\n format.html {}\n format.json { render json: @entry }\n end\n end",
"def show\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @journal_entry }\n end\n end",
"def show\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @journal_entry }\n end\n end",
"def create\n @lead_entry = LeadEntry.new lead_entry_params\n\n respond_to do |format|\n if @lead_entry.save\n format.html { redirect_to @lead_entry, notice: 'Lead entry was successfully created.' }\n format.json { render :json => {\n :success => true,\n :html => (render_to_string partial: 'list_item.html.haml', :lead_entry => @lead_entry)\n }\n }\n else\n format.html { render action: 'new' }\n format.json { render json: @lead_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @lead = Lead.new\n respond_to do |format|\n format.html #index.html.erb\n format.json {render json: @lead}\n end\n end",
"def index\n @ldap_entries = LdapEntry.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ldap_entries }\n end\n end",
"def new\n @lead = Lead.new\n respond_to do |format|\n format.html #index.html.erb\n format.json {render json: @lead}\n end\n end",
"def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end",
"def get_lead_by_idnum(idnum)\n @client.get_lead_by_idnum(idnum)\n end",
"def index\n @user = User.find(params[:user_id])\n @entries = @user.entries.paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def show\n @moment_entry = MomentEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moment_entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @lead = current_user.leads.find(params[:id])\n # \n # respond_to do |format|\n # format.html render :show, :layout => 'lead_show'\n # format.json { render :json => @lead }\n # end\n end",
"def show\n @ldap_entry = LdapEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ldap_entry }\n end\n end",
"def show\n @activity = Activity.find(params[:id])\n # @entry = @activity.entries.find (params[:id])\n\n end",
"def index\n @journal_entries = JournalEntry.desc(:entry_date).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n # [{\"name\":\"temperature\",\"type\":\"areaspline\",\"data\":[[1327213807000,0],[1327214100000,0],[1327214403000,0],[1327214700000,0],[1327215000000,24],[1327215301000,59.8],[1327215603000,95.4],[1327215901000,120.8],[1327216202000,131.6]]}]\n format.json { render json: JournalEntry.all.as_json(only: [:purity, :fitness, :devotional, :chrissy, :relational, :discipline, :facepicking, :stress]) }\n end\n end",
"def new\n @ledger_entry = LedgerEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ledger_entry }\n end\n end",
"def new\n @lead = Lead.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lead }\n end\n end",
"def entries\n trace 'entries'\n $data['entries']\n end",
"def show\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @entry }\n end\n end",
"def new_lead\n @lead = Lead.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lead }\n end\n end",
"def show\n @blog = EntryFeed.where(:id => params[:id]).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @blog }\n end\n end",
"def index\n @title = \"医药招商\"\n @entries = Entry.recent.includes(:user).page(params[:page] || 1).per(30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def show\n @lead = Lead.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lead }\n format.js\n end\n end",
"def show\n @log_entry = LogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @log_entry }\n end\n end",
"def index\n @diary_entries = DiaryEntry.all\n end",
"def index\n @diary_entries = DiaryEntry.all\n end",
"def show\n @agents = Agent.employees.order('created_at ASC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lead }\n end\n end",
"def time_entry(id)\n object_from_response(:get, \"time_entries/#{id}\", \"time-entry\")\n end",
"def show\n @ledger_entry = @organization.ledger_entries.find(params[:id])\n respond_with @organization, @ledger_entry\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @journal_entry }\n end\n end",
"def index\n @finance_leads = FinanceLead.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @finance_leads }\n end\n end",
"def entries(options={})\n return @entries if @entries and options == {} \n validate_options(options)\n @entries = Harvest::Resources::Entry.find(:all, :conditions => {:person_id => self.id}, :params => format_params(options))\n end",
"def index\n @leads = Lead.all.page params[:page]\n end",
"def show\n @timeentry = Timeentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timeentry }\n end\n end",
"def index\n @gl_account=params[:gl_account]\n if params[:gl_account]\n\n @gl_entries = GlEntry.where(:gl_account_id => params[:gl_account])\n else\n @gl_entries = GlEntry.all\n end\n respond_to do |format|\n format.html # index.html.erb\n @gl_entris = Array.new\n format.json {\n @gl_entries.select{|gl_entry|\n gl_entri = Hash.new\n gl_entry.attributes.each do |key, value|\n gl_entri[key] = value\n end\n if can? :edit, GlEntry\n gl_entri[:links] = CommonActions.object_crud_paths(nil, edit_gl_entry_path(gl_entry), gl_entry_path(gl_entry))\n else\n gl_entri[:links] = \"\"\n end\n gl_entri[:gl_entry_identifier] = CommonActions.linkable(gl_entry_path(gl_entry), gl_entry.gl_entry_identifier)\n gl_entri[:gl_account_name] = CommonActions.linkable(gl_account_path(gl_entry.gl_account), gl_entry.gl_account.gl_account_title)\n gl_entri[:gl_entry_description] = gl_entry.get_description_link\n @gl_entris.push(gl_entri)\n }\n render json: {:aaData => @gl_entris}\n }\n end\n end",
"def index\n if params[:dictionary_id]\n @dictionary = Dictionary.find(params[:dictionary_id])\n @entries = @dictionary.entries\n else\n @entries = Entry.all\n end\n end",
"def index\n @entries = Entry.all.first(100)\n end",
"def show\n @feed = Feed.find(params[:id])\n @entries = EntryFeed.where(:feed_id => @feed.id)\n\n if @entries.blank?\n EntryFeed.create_from_feed(@feed)\n @entries = EntryFeed.where(:feed_id => @feed.id)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @feed }\n end\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def index\n @entries = Entry.all\n end",
"def get\n puts \"In entries#get, params=#{params}\"\n context = params\n context[:entry_id] = params[:id]\n context[:mode] = 'display'\n context[:view_type] = \"table\"\n\n @entryHtml = getEntryHtml(context)\n if request.xhr? \n render :json => {:html => @entryHtml, :context => context}\n else\n render :template => \"/entries/get.html.erb\"\n\n end\n\n end",
"def index\n @entries = Entry.where(:blog_id => params[:blog_id])\n end",
"def show\n @feed = Feed.find(params[:id])\n @related_feeds = @feed.list_related_feeds(current_user)\n @feed_entries = Entry.where(feed_id: @feed.id).order(\"updated_at DESC\").page(params[:page]).per(10)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end",
"def show\n @case_entry = CaseEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_entry }\n end\n end",
"def new\n @lead_step = LeadStep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lead_step }\n end\n end",
"def show\n @gl_entry = GlEntry.find(params[:id])\n @attachable = @gl_entry\n @notes = @gl_entry.comments.where(:comment_type => \"note\").order(\"created_at desc\") if @gl_entry\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gl_entry }\n end\n end",
"def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end",
"def show\n @time_entry = TimeEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_entry }\n end\n end",
"def show\n @ledger_entries = @invoice.ledger_entries.page(params[:page])\n respond_with @organization, @invoice\n end",
"def index\n @absences = Absence.where(\"member_id = ?\",params[:member_id]).order(\"start_date DESC\").page(params[:page]).per(7)\n @member = Member.find(params[:member_id])\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @absences }\n end\n end",
"def index\n @days = @trip.days.order(trip_day: :asc)\n render json: @days, include: [:activities]\n end",
"def show\n @entry_view = EntryView.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry_view }\n end\n end",
"def entries\n params[:return_entries] = true\n self\n end",
"def index\n @entries = Entry.order(\"created_at DESC\").includes(:user)\n @days_left = ( Date.new( 2013, 06, 23 ) - Date.today ).to_i\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entries }\n end\n end",
"def show\n @entry = Entry.where(:numid => params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @finance_lead = FinanceLead.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance_lead }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lead }\n end\n end",
"def show\n @english_entry = EnglishEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @english_entry }\n end\n end",
"def rest_lead_stream url, list_id\n\n response = self.get url\n json = JSON.parse(response.body, :symbolize_names => true)\n results = json[:result]\n\n if results\n results.each { |result| @csv << [result[:id]] }\n @csv.flush\n puts \"#{Time.now} => REST:leadList:#{list_id}:Results:#{results.length}\" if GoodDataMarketo.logging\n end\n\n next_page_token = json[:nextPageToken]\n\n # If there is another page, remember it and then attempt the next load.\n if next_page_token\n\n self.remember_next_page :token => token, :list => list_id\n domain = @marketo_domain\n parameters = \"&fields=#{@fields}\"\n endpoint= \"/rest/v1/list/#{list_id}/leads.json\"\n url = domain + endpoint + @token_uri + parameters + \"&nextPageToken=\" + next_page_token\n rest_lead_stream url, list_id\n\n else\n\n # Update the local and remote lead lists\n File.open('lead_list_ids.json','w'){ |f| JSON.dump(@lead_list_ids, f) }\n @webdav.upload('lead_list_ids.json')\n\n end\n\n end",
"def show\n @timesheet_entry = TimesheetEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timesheet_entry }\n end\n end",
"def show\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @journal_entry }\n format.xml { render :xml => @journal_entry }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_demand_breakdowns }\n end\n end",
"def index\n @leads = Lead.all()\n end",
"def get_entries(json: nil, ld: nil)\n entries = []\n data = ld ? ld[self.uri] : nil\n if data\n data.each do |key, value|\n prefix, index = key.split('_')\n entries[index.to_i - 1] = self.factory.get(value[0]['value'], self, ld: ld) if prefix == KEY_PREFIX\n end\n end\n entries\n end",
"def index\n @r_entries = REntry.all\n end",
"def show\n @work_entry = WorkEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_entry }\n end\n end",
"def find_by_id id, destruct: false, return_array: false\n verify_credentials!\n\n request do\n destruct_response? destruct\n operation :get_lead\n authenticate? true\n message lead_id: id\n transform do |resp|\n if return_array\n arrayify resp[:leads][:lead]\n else\n resp\n end\n end\n end\n end",
"def list_entries\n\nend",
"def index\n @leads = Lead.all\n end",
"def index\n @leads = Lead.all\n end",
"def show\n @text_entry = TextEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_entry }\n end\n end",
"def show\n @feed_entry = FeedEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed_entry }\n end\n end",
"def index\n @leases = Lease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @leases }\n end\n end"
] |
[
"0.6975558",
"0.6437789",
"0.628868",
"0.6252577",
"0.6233732",
"0.61927164",
"0.61784846",
"0.6030111",
"0.60056496",
"0.59966236",
"0.5975805",
"0.5946085",
"0.5945465",
"0.5922962",
"0.5909163",
"0.58990026",
"0.5894583",
"0.5894583",
"0.58519703",
"0.5847465",
"0.5846977",
"0.58462936",
"0.5829694",
"0.58138484",
"0.5781984",
"0.5769642",
"0.57493854",
"0.57493854",
"0.57493854",
"0.57493854",
"0.57493854",
"0.57493854",
"0.57493854",
"0.57493854",
"0.57493854",
"0.5740666",
"0.5738999",
"0.57339984",
"0.5730279",
"0.5726426",
"0.57245827",
"0.5723222",
"0.5721214",
"0.57095927",
"0.57028776",
"0.56851447",
"0.5674733",
"0.56746477",
"0.5673115",
"0.5673115",
"0.5663409",
"0.5661744",
"0.56559515",
"0.5654375",
"0.5647968",
"0.5645218",
"0.5642869",
"0.56403095",
"0.5637915",
"0.5632523",
"0.56296706",
"0.5628702",
"0.5620068",
"0.5620068",
"0.5620068",
"0.5620068",
"0.5620068",
"0.5620068",
"0.5619045",
"0.56135565",
"0.5612185",
"0.56074387",
"0.5606424",
"0.5606235",
"0.56033057",
"0.56033057",
"0.5594841",
"0.5587085",
"0.55820364",
"0.55745196",
"0.55741215",
"0.5571624",
"0.55702513",
"0.5568417",
"0.55667907",
"0.5546912",
"0.55456823",
"0.5544232",
"0.5539838",
"0.5538362",
"0.5533491",
"0.5532322",
"0.5530225",
"0.55267763",
"0.55096185",
"0.55071473",
"0.549794",
"0.549794",
"0.5496264",
"0.5494698",
"0.5488551"
] |
0.0
|
-1
|
POST /lead_entries POST /lead_entries.json
|
def create
@lead_entry = LeadEntry.new lead_entry_params
respond_to do |format|
if @lead_entry.save
format.html { redirect_to @lead_entry, notice: 'Lead entry was successfully created.' }
format.json { render :json => {
:success => true,
:html => (render_to_string partial: 'list_item.html.haml', :lead_entry => @lead_entry)
}
}
else
format.html { render action: 'new' }
format.json { render json: @lead_entry.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def lead_entry_params\n params.require(:lead_entry).permit(:text, :date, :relation, :lead_id)\n end",
"def create_entries(opts = {})\n data, _status_code, _headers = create_entries_with_http_info(opts)\n data\n end",
"def create\n @ledger_entry = LedgerEntry.new(params[:ledger_entry])\n\n respond_to do |format|\n if @ledger_entry.save\n format.html { redirect_to @ledger_entry, :notice => 'Ledger entry was successfully created.' }\n format.json { render :json => @ledger_entry, :status => :created, :location => @ledger_entry }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @ledger_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n if @entry.valid?\n @entry.save\n render json: @entry, status: :created\n # , location: @entry\n else\n render json: @entry.errors, status: :unprocessable_entity\n end\n end",
"def create_entries_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EntriesApi.create_entries ...'\n end\n # resource path\n local_var_path = '/api/v1/entries'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_entries_input'] || opts[:body])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Entry'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['authToken']\n\n new_options = opts.merge(\n :operation => :\"EntriesApi.create_entries\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EntriesApi#create_entries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @entry = Entry.new({\n content: params[:entry][:content],\n journal_id: params[:entry][:journal_id]\n })\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to \"/entries/#{@entry.id}\" }\n format.json { render :show }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @data_entry = DataEntry.new(data_entry_params)\n\n respond_to do |format|\n if @data_entry.save\n format.html { redirect_to @data_entry, notice: 'Data entry was successfully created.' }\n format.json { render :show, status: :created, location: @data_entry }\n else\n format.html { render :new }\n format.json { render json: @data_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lead = Lead.new(lead_params)\n\n if @lead.save\n render :show, status: :created, location: @lead\n else\n render json: @lead.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n @entry = Entry.new(entry_params)\n\n respond_to do |format|\n\n if @entry.save\n format.html { redirect_to entries_path, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n @today_entries = Entry.where(\"date = ?\", Date.today)\n @yesterday_entries = Entry.where(\"date = ?\", Date.yesterday)\n format.html { render :action => :index }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = @time_sheet.entries.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n # [@user, @time_sheet, @entry]\n # user_time_sheet_entries_path(@user, @time_sheet)\n format.html { redirect_to user_time_sheet_entries_path(@user, @time_sheet), notice: 'Hours were successfully added.' }\n format.json { render json: [@user, @time_sheet, @entry], status: :created, location: [@user, @time_sheet, @entry] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @lead_entries = LeadEntry.where(:lead_id => params[:lead_id]).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html { render action: 'index' }\n format.json {\n render :json => {\n :amount => @lead_entries.length,\n :success => true,\n :html => (render_to_string partial: 'list.html.haml')\n }\n }\n end\n end",
"def create\n @entry = current_user.entries.build(entry_params)\n if @entry.save\n render json: EntrySerializer.new(@entry), status: :created\n else\n render json: { error: @entry.errors.full_messages.to_sentence}, status: :unprocessable_entity\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n #binding.pry\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lead_step = LeadStep.new(params[:lead_step])\n\n respond_to do |format|\n if @lead_step.save\n format.html { redirect_to @lead_step, notice: 'Lead step was successfully created.' }\n format.json { render json: @lead_step, status: :created, location: @lead_step }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lead_step.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to entries_path, notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @diary_entry = DiaryEntry.new(diary_entry_params)\n\n respond_to do |format|\n if @diary_entry.save\n format.html { redirect_to @diary_entry, notice: 'Diary entry was successfully created.' }\n format.json { render :show, status: :created, location: @diary_entry }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @diary_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @diary_entry = DiaryEntry.new(diary_entry_params)\n current_user.diary_entries << @diary_entry\n\n respond_to do |format|\n if @diary_entry.save\n format.html { redirect_to @diary_entry, notice: 'Diary entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @diary_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @diary_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_lead\n @lead = Lead.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lead }\n end\n end",
"def create\n @diary_entry = DiaryEntry.new(diary_entry_params)\n\n respond_to do |format|\n if @diary_entry.save\n format.html { redirect_to @diary_entry, notice: 'Diary entry was successfully created.' }\n format.json { render :show, status: :created, location: @diary_entry }\n else\n format.html { render :new }\n format.json { render json: @diary_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @journal_entry = JournalEntry.new(journal_entry_params)\n\n respond_to do |format|\n if @journal_entry.save\n format.html { redirect_to @journal_entry, notice: 'Journal entry was successfully created.' }\n format.json { render :show, status: :created, location: @journal_entry }\n else\n format.html { render :new }\n format.json { render json: @journal_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @journal_entry = JournalEntry.new(params[:journal_entry])\n\n respond_to do |format|\n if @journal_entry.save\n format.html { redirect_to @journal_entry, notice: 'Journal entry was successfully created.' }\n format.json { render json: @journal_entry, status: :created, location: @journal_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @journal_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@lead = Lead.new(params[:lead])\n\n\t\trespond_to do |format|\n\t\t if @lead.save\n\t\t\tformat.html { redirect_to @lead, notice: 'Lead was successfully created.' }\n\t\t\tformat.json { render json: @lead, status: :created, location: @lead }\n\t\t else\n\t\t\tformat.html { render action: \"new\" }\n\t\t\tformat.json { render json: @lead.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\tend",
"def create\n @entry = Entry.new(entry_params)\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def leadCreateSfBulk()\n Salesforce.createRecords(@salesforceBulk, 'Lead', @testDataJSON[\"AccountAssignment\"][\"GenerateLeadFromWeb\"][0][\"BuildingName\"])\n end",
"def create\n @entry = Entry.new(entry_params)\n respond_to do |format|\n if @entry.save\n format.html { redirect_to [@blog, @entry], notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: [@blog, @entry] }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lesson_entryset = LessonEntryset.new(lesson_entryset_params)\n\n respond_to do |format|\n if @lesson_entryset.save\n format.html { redirect_to @lesson_entryset, notice: 'Lesson entryset was successfully created.' }\n format.json { render action: 'show', status: :created, location: @lesson_entryset }\n else\n format.html { render action: 'new' }\n format.json { render json: @lesson_entryset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @study_set = StudySet.new(user_id: current_user.id, link_id: params[:study_set][:link_id])\n @study_set.entries << Entry.find(params[:study_set][:entry_id])\n\n respond_to do |format|\n if @study_set.save\n if params.has_key? 'save-return'\n format.html { redirect_to current_user, notice: 'Study set was successfully created.' }\n else\n format.html { redirect_to @study_set, notice: 'Study set was successfully created.' }\n format.json { render json: @study_set.entries }\n end\n else\n format.html { render :new }\n format.json { render json: @study_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @journal_entry = JournalEntry.new(params[:journal_entry])\n @last_entry = JournalEntry.last\n\n respond_to do |format|\n if @journal_entry.save\n format.html { redirect_to @journal_entry, notice: 'Journal entry was successfully created.' }\n format.json { render json: @journal_entry, status: :created, location: @journal_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @journal_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n @entry.goal_id = @goal.id\n @entry.user_id = current_user.id\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @goal, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_lead_entry\n @lead_entry = LeadEntry.find(params[:id])\n end",
"def create\n @entry = Entry.new(params[:entry])\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, :notice => 'Entry was successfully created.' }\n format.json { render :json => @entry, :status => :created, :location => @entry }\n else\n @clients = Client.all.collect{ |c| [c.name, c.id] }\n @aircraft_types = AircraftType.all(:order => :name).collect{|c| [c.name, c.id]}\n \n format.html { render :action => \"new\" }\n format.json { render :json => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n @dictionary = Dictionary.find(params[:dictionary_id])\n respond_to do |format|\n if @entry.save\n format.html { redirect_to dictionary_entry_path(@dictionary, @entry),\n notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(lead)\n validate_type!(lead)\n\n attributes = sanitize(lead)\n _, _, root = @client.post(\"/leads\", attributes)\n\n Lead.new(root[:data])\n end",
"def create\n model = params[:model]\n #NOTE: Pay attention how the data is passed as a hash. This is how locomotive expects it. Not obvious.\n # req.set_form_data('content_entry[name]' => data['name'], 'content_entry[summary]' => data['summary'], 'model' => model)\n form_data = {}\n params[:content_entry].each do |key,val|\n form_data[\"content_entry[#{key}]\"] = val\n end\n #data = params[:content_entry]\n\n uri = URI(\"#{@cms_url}/locomotive/api/content_types/#{model}/entries.json?auth_token=#{APP_CONFIG['locomotive']['auth_token']}\")\n\n req = Net::HTTP::Post.new(uri)\n req.set_form_data(form_data)\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(req)\n end\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n render :json => res.body\n else\n # examine response code and generate appropriate error message\n render :json => res.value\n end\n\n end",
"def create\n #assign unpermitted parameter 'entries' to a variable\n entries = params[\"entries\"]\n @invoice = @user.invoices.build(invoice_params)\n #save entries\n @invoice.entries = entries\n if @invoice.save\n render json: @invoice, status: :created, location: api_v1_user_invoice_url(@user, @invoice)\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @current_user.entries << @entry\n format.html { redirect_to user_entries_path, notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_entries(doc)\n return nil\n end",
"def create\n puts \"In entries#create, params=#{params}\"\n entity_id = params[:entity_id]\n=begin\n @entity = Entity.find(entity_id)\n template_name = @entity.template.name\n\n @entry = EntryManager.initialize_entry(@entity)\n=end\n @entity = Entity.find(entity_id)\n @entry = Entry.new({:entity_id => entity_id})\n \n @context = {:display_mode => 'new' \n }\n \n template = \"/templates/predefined/#{@entity.template.name}.html.erb\"\n entry_html = render_to_string(:template=>template, \n :layout=>false,\n )\n\n \n @entry[:html] = entry_html\n @entry[:attr_values] = @entry.attr_values\n @entry[:attrs] = @entity.attrs\n\n render :json => {\n :entry => @entry\n\n }\n end",
"def create\n @event = Event.find(params[:event_id])\n @event_entry = @event.event_entries.build(params[:event_entry])\n\n respond_to do |format|\n if @event_entry.save\n format.html { redirect_to @event, :notice => 'Event entry was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event_entry }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_can_post_valid_entry\n valid_entry = SEED_ENTRIES.first\n post_json '/api/entries', valid_entry.except(:slug)\n\n assert last_response.created?\n\n location = \"/api/entries/#{valid_entry[:slug]}\"\n assert last_response.headers['Location'] = location\n assert last_response.headers['Content-Location'] = location\n\n parsed_resp = parse_json_resp(last_response)\n assert_instance_of Hash, parsed_resp\n assert_equal valid_entry[:word], parsed_resp['word']\n assert_equal valid_entry[:definition], parsed_resp['definition']\n assert_equal location, parsed_resp['location']\n end",
"def create\n @goal_entry = GoalEntry.new(goal_entry_params)\n\n respond_to do |format|\n if @goal_entry.save\n format.html { redirect_to @goal_entry, notice: 'Goal entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @goal_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @goal_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n\n @entry.user_id = current_user.id\n @entry.challenge_id = current_open_challenge.id\n\n submission = Entry.find_by_challenge_id_and_user_id(@entry.challenge_id, @entry.user_id)\n \n if submission.blank?\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to submission }\n format.json { render json: submission }\n end\n end\n end",
"def create\n # Code refactoring that use the relationship between person and Entry Sets\n @entry_set = @current_user.person.entry_sets.build(params[:entry_set])\n\n respond_to do |format|\n if @entry_set.save\n format.json { render json: @entry_set, status: :created, location: @entry_set }\n else\n format.json { render json: @entry_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_entry = TaskEntry.new(task_entry_params)\n\n respond_to do |format|\n if @task_entry.save\n format.json { render action: 'show', status: :created, location: @task_entry }\n else\n format.json { render json: @task_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lead = current_user.leads.build(params[:lead])\n\n respond_to do |format|\n if @lead.save\n format.html { redirect_to @lead, :notice => 'Lead was successfully created.' }\n format.json { render :json => @lead, :status => :created, :location => @lead }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @lead.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @tracker = Tracker.new()\n @tracker.period = params[:period]\n @tracker.user_id = current_user.id\n @user = User.find(current_user.id)\n\n respond_to do |format|\n if @tracker.save\n \n @fields = [Field.new(), Field.new(), Field.new()]\n\n @lastfields = Field.all.order(\"id desc\").limit(3).reverse\n\n if not @lastfields.any? \n @fields[0].title = \"Progress\" \n @fields[1].title = \"Plan\"\n @fields[2].title = \"Problems\"\n else\n @fields[0].title = @lastfields[0].title \n @fields[1].title = @lastfields[1].title\n @fields[2].title = @lastfields[2].title\n end\n\n @fields.each do |f|\n f.tracker_id = @tracker.id\n f.save\n\n @entries = [Entry.new(), Entry.new(), Entry.new()]\n @entries.each do |e|\n e.field_id = f.id\n e.task = \"Click here to edit goal\"\n e.save\n\n end\n\n \n end\n\n format.html { redirect_to @user, notice: 'Tracker was successfully created.' }\n format.json { render :show, status: :created, location: @tracker }\n else\n format.html { render :new }\n format.json { render json: @tracker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createLead\n #@testDataJSON['CreateOpportunity'][0]['lead'][0]['email'] = \"test_johnsmith#{rand(99999999999999)}@example.com\"\n\n #puts @driver.current_url()\n #puts @leadsTestData\n #@result= @helper.createSalesforceRecord('Lead',@leadsTestData)\n #puts @result\n #url = @driver.current_url();\n #newUrl = url.split('/')\n #@driver.get \"#{newUrl[0]}//#{newUrl[2]}/#{@result[0]['Id']}\"\n #puts \"Lead created suceessfully\\n \"\n end",
"def create\n @journal_entry = JournalEntry.new(params[:journal_entry])\n\n respond_to do |format|\n if @journal_entry.save\n format.html { redirect_to(@journal_entry, :notice => 'Journal entry was successfully created.') }\n format.json { render :json => @journal_entry, :status => :created, :location => @journal_entry }\n format.xml { render :xml => @journal_entry, :status => :created, :location => @journal_entry }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @journal_entry.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @journal_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n attachment = params[:kyu_entry].delete :attachment\n params[:kyu_entry].merge!(user_id: current_user.id)\n params[:kyu_entry].merge!(publish_at: Time.now)\n kyu_entry = KyuEntry.new(params[:kyu_entry])\n # kyu_entry.set_user_and_publish_date(current_user)\n respond_to do |format|\n if kyu_entry.save\n attachments = params[:attachments_field].split(\",\")\n unless attachments.blank?\n attachments.each do |attachment|\n kyu_entry.attachments << Attachment.find(attachment)\n end\n end\n new_entry = render_to_string(partial: \"entries\",\n locals: { kyu_entry: kyu_entry })\n sidebar = render_to_string( partial: \"sidebar\",\n locals: { tag_cloud_hash: tag_cloud, users: @users})\n format.json { render json: { new_entry: new_entry, sidebar: sidebar } }\n else\n format.json { render json: kyu_entry.errors,\n status: :unprocessable_entity}\n end\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n format.html { render :new }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ldap_entry = LdapEntry.new(ldap_entry_params)\n\n respond_to do |format|\n if @ldap_entry.save\n format.html { redirect_to ldap_entries_path, notice: 'Ldap entry was successfully created.' }\n format.json { render json: @ldap_entry, status: :created, location: @ldap_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ldap_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_entry(payload_array, scaffold)\n api_url = \"#{@device_address}/admin/scaffolds/#{scaffold}/create.json?api_key=#{@device_api_key}\"\n api_connection = Excon.new(api_url, persistent: true)\n\n payload_array.map do |payload|\n Thread.new do\n api_connection.post(\n body: JSON[record: payload],\n headers: { 'Content-Type' => 'application/json' },\n persistent: true\n )\n end\n end.each(&:join)\n end",
"def create\n @entry = current_user.entries.new(entry_params)\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Your entry has been posted!' }\n format.json { render action: 'show', status: :created, location: @entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @journal_entry = current_user.journal_entries.new(journal_entry_params)\n\n respond_to do |format|\n if @journal_entry.save\n format.html { redirect_to journal_entries_url, notice: 'journal_entry was successfully created.' }\n format.json { render json: @journal_entry, status: :created, location: @journal_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @journal_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @entry = Entry.new(entry_params)\n @entry.blog_id = params[:blog_id]\n @entry.save\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to blog_entries_url, notice: 'Entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: blog_entries_url }\n else\n format.html { render action: 'new' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @timetable_entry = TimetableEntry.new(timetable_entry_params)\n\n respond_to do |format|\n if @timetable_entry.save\n format.html { redirect_to @timetable_entry, notice: 'Timetable entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @timetable_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @timetable_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lead = Lead.new(lead_params)\n\n respond_to do |format|\n if @lead.save\n flash[:notice] = success_message(controller_name, action_name)\n format.html { redirect_to @lead }\n format.json { render :show, status: :created, location: @lead }\n else\n format.html { render :new }\n format.json { render json: @lead.errors, status: :unprocessable_entity }\n end\n end\n end",
"def entry_params\n params.require(:entry).permit(\n :name,\n :description,\n :start_date,\n :end_date,\n :created_at,\n :updated_at,\n :imp_quantity,\n :advertiser_rate,\n :states,\n :zip_codes,\n :address,\n :agency_name,\n :advertiser_name,\n :advertiser_url,\n :geofence_poi,\n :audiences_prem => [],\n :platforms => [],\n :audiences => [],\n :metros => [],\n :carriers => [],\n :content_cats => [],\n :operating_sys => [],\n :creative_types => [],\n )\n end",
"def create\n @sales_entry = SalesEntry.new(sales_entry_params)\n\n respond_to do |format|\n if @sales_entry.save\n format.html { redirect_to @sales_entry, notice: 'Sales entry was successfully created.' }\n format.json { render :show, status: :created, location: @sales_entry }\n else\n format.html { render :new }\n format.json { render json: @sales_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n redirect_to event_attendance_entries_path(@event)\n # respond_to do |format|\n # if @attendance_entry.save\n # format.html { redirect_to event_attendance_entries_path(@attendance_entry.event), notice: 'Event attendance entry was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @attendance_entry }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @attendance_entry.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @entry = current_user.entries.build(entry_params)\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to entries_path, notice: 'Entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @log_entry = LogEntry.new(params[:log_entry])\n\n respond_to do |format|\n if @log_entry.save\n format.html { redirect_to log_entries_path, :notice => 'Log entry was successfully created.' }\n format.json { render :json => @log_entry, :status => :created, :location => @log_entry }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @log_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @app_dictionary_entry = AppDictionaryEntry.new(app_dictionary_entry_params)\n\n respond_to do |format|\n if @app_dictionary_entry.save\n format.html { redirect_to @app_dictionary_entry, notice: 'App dictionary entry was successfully created.' }\n format.json { render :show, status: :created, location: @app_dictionary_entry }\n else\n format.html { render :new }\n format.json { render json: @app_dictionary_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def entries\n uri = URI(BASE_URL + ENTRIES_ENDPOINT + days_query)\n\n make_request(uri)\n end",
"def create\n @english_entry = EnglishEntry.new(params[:english_entry])\n\n respond_to do |format|\n if @english_entry.save\n format.html { redirect_to @english_entry, notice: 'English entry was successfully created.' }\n format.json { render json: @english_entry, status: :created, location: @english_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @english_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @task_entry = TaskEntry.new(task_entry_params)\n\n respond_to do |format|\n if @task_entry.save\n format.html { redirect_to @task_entry, notice: 'Task entry was successfully created.' }\n format.json { render :show, status: :created, location: @task_entry }\n else\n format.html { render :new }\n format.json { render json: @task_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @timeentry = Timeentry.new(params[:timeentry])\n\n respond_to do |format|\n if @timeentry.save\n format.html { redirect_to @timeentry, notice: 'Timeentry was successfully created.' }\n format.json { render json: @timeentry, status: :created, location: @timeentry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @timeentry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n saved = false\n begin\n Entry.transaction do\n if(@entry.save)\n update_related_stories(:yesterday, @entry, params[:yesterdays_related_stories_ids])\n update_related_stories(:today, @entry, params[:todays_related_stories_ids])\n update_related_stories(:show_stopper, @entry, params[:show_stopper_related_stories_ids])\n saved = true\n end\n end\n\n rescue Exception => e\n Rails.logger.warn \"Unable to save entry and related stories: #{e.message}\"\n Rails.logger.debug e.backtrace\n end\n\n respond_to do |format|\n # if @entry.save\n if saved\n format.html { redirect_to [@project, @entry], notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @content_entry = Content::Entry.new(content_entry_params)\n\n respond_to do |format|\n if @content_entry.save\n format.html { redirect_to @content_entry, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @content_entry }\n else\n format.html { render :new }\n format.json { render json: @content_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feed_entry = FeedEntry.new(feed_entry_params)\n\n respond_to do |format|\n if @feed_entry.save\n format.html { redirect_to @feed_entry, notice: 'Feed entry was successfully created.' }\n format.json { render :show, status: :created, location: @feed_entry }\n else\n format.html { render :new }\n format.json { render json: @feed_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to [:admin, @entry], notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n @entry['user_id'] = current_user.id\n respond_to do |format|\n if @entry.save\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n format.html { render :new }\n format.json { render json: @entry.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @entry = Entry.new(params[:entry])\n @entry.date = Date.strptime(params[:entry][:date], '%m/%d/%Y')\n \n respond_to do |format|\n if @entry.save\n format.html { redirect_to manage_entry_path( @entry ), notice: 'Entry was successfully created.' }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n @feed_entry = FeedEntry.new(params[:feed_entry])\n\n respond_to do |format|\n if @feed_entry.save\n format.html { redirect_to @feed_entry, notice: 'Feed entry was successfully created.' }\n format.json { render json: @feed_entry, status: :created, location: @feed_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feed_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(entry_params)\n\n flash[:notice] = 'Entry was successfully created.' if @entry.save\n respond_with(@entry)\n end",
"def create\n cite_key = params['entry']['cite_key']\n category = params['entry']['category']\n clean_params = EntryValidator.clean_params category, params\n @entry = Entry.new(category:category, cite_key:cite_key)\n entry_valid = EntryValidator.validate @entry, clean_params\n\n respond_to do |format|\n if entry_valid and @entry.save and create_fields(clean_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully created.' }\n format.json { render :show, status: :created, location: @entry }\n else\n @fields = get_fields\n format.html { render :new_thing }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry = Entry.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to new_entry_path, notice: \"Entry #{@entry} was successfully created.\" }\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.html { get_events\n render action: \"new\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_entry = TimeEntry.new(time_entry_params)\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render :show, status: :created, location: @time_entry }\n else\n format.html { render :new }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entry_log = EntryLog.new(entry_log_params)\n\n respond_to do |format|\n if @entry_log.save\n format.html { redirect_to @entry_log, notice: 'Entry log was successfully created.' }\n format.json { render :show, status: :created, location: @entry_log }\n else\n format.html { render :new }\n format.json { render json: @entry_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feed = Feed.find(params[:feed_id])\n @entry = @feed.entries.new(params[:entry])\n\n respond_to do |format|\n if @entry.save\n @entry.author.save\n format.html { redirect_to feed_entry_path(@feed,@entry), notice: 'Entry was successfully created.' }\n format.json { render json: feed_entry_path(@feed, @entry), status: :created, location: feed_entry_path(@feed, @entry) }\n else\n format.html { render action: \"new\" }\n format.json { render json: feed_entry_path(@feed,@entry).errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_dictionary_entries(dictionary, dictionary_entries, opts = {})\n response = @transporter.write(\n :POST,\n path_encode('/1/dictionaries/%s/batch', dictionary),\n { clearExistingDictionaryEntries: false, requests: chunk('addEntry', dictionary_entries) },\n opts\n )\n\n DictionaryResponse.new(self, response)\n end",
"def create\n @diary = DiaryEntry.new(diary_params)\n\n respond_to do |format|\n if @diary.save\n format.html { redirect_to @diary, notice: 'Diary entry was successfully created.' }\n format.json { render :show, status: :created, location: @diary }\n else\n format.html { render :new }\n format.json { render json: @diary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_entry = TimeEntry.new(params[:time_entry])\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_entry = TimeEntry.new(params[:time_entry])\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @time_entry = TimeEntry.new(params[:time_entry])\n\n respond_to do |format|\n if @time_entry.save\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully created.' }\n format.json { render json: @time_entry, status: :created, location: @time_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @department_entry = DepartmentEntry.new(department_entry_params)\n\n respond_to do |format|\n if @department_entry.save\n format.html { redirect_to :back, notice: 'Department entry was successfully created.' }\n format.json { render :show, status: :created, location: @department_entry }\n else\n format.html { render :new }\n format.json { render json: @department_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createLeadFromStdSalesforce(email)\n puts @testDataJSON['Lead']\n records_to_insert = Hash.new\n records_to_insert.store('Name','Kishor_shinde')\n record = @helper.createRecords(sObject,records_to_insert)\n puts record\n return record \n end",
"def create\n logger.info \"Creating Entry\"\n @entry = Entry.new(params[:entry])\n logger.info \"Entry Created\"\n\n respond_to do |format|\n if @entry.save\n format.html { redirect_to(entries_url, :notice => 'Entry was successfully created.') }\n format.xml { render :xml => @entry, :status => :created, :location => @entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @press_kit_entry = @press_kit.press_kit_entries.new(press_kit_entry_params)\n\n respond_to do |format|\n if @press_kit_entry.save\n format.html { redirect_to backstage_press_kit_entries_url, notice: 'press_kit_entry was successfully created.' }\n # format.json { render :show, status: :created, location: @press_kit_entry }\n else\n format.html { render :new }\n # format.json { render json: @press_kit_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def entries\n params[:return_entries] = true\n self\n end",
"def test_create_lead\n client.expects(:request).with(:post, 'https://api.com/rest/sites/site-123/leads',\n '{\"email\":\"lead@gmail.com\"}', nil)\n\n client.create_lead(\"site-123\", {email: \"lead@gmail.com\"})\n end",
"def create\n @trainees = TraineeBatch.new(params[:participants][:ids], params[:training_calendar_id])\n respond_to do |format|\n if @trainees.save\n format.html { redirect_to training_calendar_path(params[:training_calendar_id]), :notice => 'The participant(s) were successfully added.' }\n format.json { render :json => @trainees, :status => :created, :location => @trainees }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @trainees.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_entry_to_buffer(key_words,key_lang,xlated,entry)\n\t\tdict_id=entry['dict_id']\n\t\t##debug(sprintf(\"add_entry id(%s),lang(%s),[%s]\\n\",dict_id,key_lang,key_words))\n\t\t##\n\t\t## parse json-data\n\t\t##\n\t\tbegin\n\t\t\tentry_data=JSON.parse(entry['data'])\n\t\trescue\n\t\t\t##printf(\"Data Error![%s]\\n\",entry['data'])\n\t\t\treturn \n\t\tend\n\t\t##debug(sprintf(\"ENTRYDATA [%s]\\n\",entry_data.inspect()))\n\t\tgrammar=entry_data[\"#GRAMMAR\"]\n\t\tgrammar=\"\" if grammar==nil\n\t\tcategory=entry_data[\"#CATEGORY\"]\n\t\tcategory=\"\" if category==nil\n\t\tentry_num=entry_data[\"#ENTRY_NUM\"]\n\t\tentry_num=\"\" if entry_num==nil\n\t\thash_key= dict_id + key_words + key_lang + grammar + category\n\t\t@entries[hash_key]=Hash.new if @entries[hash_key]==nil\n\t\t@entries[hash_key][entry_num]=\n\t\t\t\t{\"dict_id\"=>dict_id,\n\t\t\t\t\"key_words\"=>key_words,\n\t\t\t\t\"grammar\"=>grammar,\n\t\t\t\t\"category\"=>category,\n\t\t\t\t\"key_lang\"=>key_lang,\n\t\t\t\t\"xlated_word\"=>xlated,\n\t\t\t\t\"entry_data\"=>entry_data}\n\tend",
"def create\n @big_time_entry = BigTimeEntry.new(big_time_entry_params)\n\n respond_to do |format|\n if @big_time_entry.save\n format.html { redirect_to @big_time_entry, notice: 'Big time entry was successfully created.' }\n format.json { render :show, status: :created, location: @big_time_entry }\n else\n format.html { render :new }\n format.json { render json: @big_time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @education_entry = EducationEntry.new(education_entry_params)\n\n respond_to do |format|\n if @education_entry.save\n format.html { redirect_to @education_entry, notice: 'Education entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @education_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @education_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end"
] |
[
"0.6288483",
"0.62158364",
"0.6212585",
"0.60418546",
"0.60225666",
"0.5972873",
"0.59220743",
"0.5875825",
"0.58663094",
"0.58401173",
"0.580174",
"0.57681125",
"0.57657146",
"0.5756865",
"0.5749872",
"0.574979",
"0.5740562",
"0.5732084",
"0.57118815",
"0.5709951",
"0.570878",
"0.56855154",
"0.5680793",
"0.5680793",
"0.5680793",
"0.56720275",
"0.5663371",
"0.56486285",
"0.56417686",
"0.5635441",
"0.56326985",
"0.56282574",
"0.561275",
"0.5609363",
"0.5604394",
"0.5584591",
"0.5578192",
"0.55774486",
"0.55748636",
"0.5572073",
"0.556714",
"0.5560439",
"0.5559384",
"0.5546204",
"0.55408794",
"0.55228317",
"0.55186534",
"0.5516779",
"0.55123997",
"0.55035436",
"0.5501869",
"0.5497396",
"0.549588",
"0.5494228",
"0.5492469",
"0.54852265",
"0.5475077",
"0.54746455",
"0.5470668",
"0.5451778",
"0.5451567",
"0.5449837",
"0.5449418",
"0.5436703",
"0.54359037",
"0.54347885",
"0.5412756",
"0.5411134",
"0.5409711",
"0.5404175",
"0.54023606",
"0.5400848",
"0.5395122",
"0.53918535",
"0.53876245",
"0.53841597",
"0.53776604",
"0.53768283",
"0.5370253",
"0.53668624",
"0.5366724",
"0.5355404",
"0.53551525",
"0.5353661",
"0.5352692",
"0.5352207",
"0.53505856",
"0.53505856",
"0.53505856",
"0.5349962",
"0.5346069",
"0.53449166",
"0.5336651",
"0.5335389",
"0.53318197",
"0.5327005",
"0.5318734",
"0.53078544",
"0.53039414",
"0.53035665"
] |
0.6596009
|
0
|
PATCH/PUT /lead_entries/1 PATCH/PUT /lead_entries/1.json
|
def update
respond_to do |format|
if @lead_entry.update(lead_entry_params)
format.html { redirect_to @lead_entry, notice: 'Lead entry was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @lead_entry.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @lead = Lead.find(params[:id])\n\n respond_to do |format|\n if @lead.update_attributes(params[:lead])\n @lead.lead_notes.create(:notes =>\n \"Lead information changed by user: #{current_user.name} at #{Time.now}.\", \n :user_id => current_user.id, :lead_step_id => @lead.lead_step_id)\n \n format.html { redirect_to @lead, notice: 'Lead was successfully updated.' }\n format.json { head :no_content }\n format.js \n else\n format.html { render action: \"edit\" }\n format.json { render json: @lead.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lead = Lead.find(params[:id])\n\n respond_to do |format|\n if @lead.update_attributes(params[:lead])\n format.html { redirect_to @lead, notice: 'Lead was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lead.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lead_step = LeadStep.find(params[:id])\n\n respond_to do |format|\n if @lead_step.update_attributes(params[:lead_step])\n format.html { redirect_to @lead_step, notice: 'Lead step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lead_step.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lead = Salesforce::Lead.find(params[:id])\n # if params[\"salesforce_lead\"] && params[\"salesforce_lead\"].class == Hash\n params[\"salesforce_lead\"].each do |key, value|\n method = key + \"=\"\n @lead.send method, value\n end\n # end\n # @lead = Salesforce::Lead.new(params[:salesforce_lead])\n \n respond_to do |format|\n # if @lead.update_attributes(params[:lead])\n if @lead.save\n format.html { redirect_to(@lead, :notice => 'Salesforce::Lead was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lead.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lead.update_attributes(lead_params)\n format.html { redirect_to @lead, notice: 'Lead was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lead.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lead = Lead.find(params[:id])\n\n respond_to do |format|\n if @lead.update_attributes(params[:lead])\n flash[:notice] = 'Lead was successfully updated.'\n format.html { redirect_to(@lead) }\n format.xml { head :ok }\n format.json { render :json => @lead }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lead.errors, :status => :unprocessable_entity }\n format.json { render :json => @lead.errors }\n end\n end\n end",
"def update\n if @lead.update(lead_params)\n render :show, status: :ok, location: @lead\n else\n render json: @lead.errors, status: :unprocessable_entity\n end\n end",
"def update\n #TODO implement the update at salesforce\n respond_to do |format|\n if @lead.update(lead_params)\n format.html { redirect_to campaign_lead_url(@campaign, @lead), notice: 'Lead was successfully updated.' }\n format.json { render :show, status: :ok, location: @lead }\n else\n format.html { render :edit }\n format.json { render json: @lead.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ledger_entry = LedgerEntry.find(params[:id])\n\n respond_to do |format|\n if @ledger_entry.update_attributes(params[:ledger_entry])\n format.html { redirect_to @ledger_entry, :notice => 'Ledger entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ledger_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lead.update(lead_params)\n format.html { redirect_to @lead, notice: 'Lead was successfully updated.' }\n format.json { render :show, status: :ok, location: @lead }\n else\n format.html { render :edit }\n format.json { render json: @lead.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lead = current_user.leads.find(params[:id])\n\n respond_to do |format|\n if @lead.update_attributes(params[:lead])\n format.html { redirect_to @lead, :notice => 'Lead was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @lead.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@lead = Lead.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t if @lead.update_attributes(params[:lead])\n\t\t\tformat.html { redirect_to @lead, notice: 'Lead was successfully updated.' }\n\t\t\tformat.json { head :ok }\n\t\t else\n\t\t\tformat.html { render action: \"edit\" }\n\t\t\tformat.json { render json: @lead.errors, status: :unprocessable_entity }\n\t\t end\n\t\tend\n\tend",
"def update\n @type = 'edit'\n respond_to do |format|\n if @lead.update(lead_params)\n format.html { redirect_to @lead, notice: 'Lead was successfully updated.' }\n format.json { render :show, status: :ok, location: @lead }\n else\n format.html { render :edit }\n format.json { render json: @lead.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @lead.update(lead_params)\r\n format.html { redirect_to @lead, notice: 'Lead was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @lead }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @lead.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @entry = Entry.find(params[:id])\n\n if @entry.update_attributes(params[:entry])\n head :no_content\n else\n render json: @entry.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @task_entry.update(task_entry_params)\n format.json { head :no_content }\n else\n format.json { render json: @task_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def set_lead_entry\n @lead_entry = LeadEntry.find(params[:id])\n end",
"def update\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n if @journal_entry.update_attributes(params[:journal_entry])\n format.html { redirect_to(@journal_entry, :notice => 'Journal entry was successfully updated.') }\n format.json { render :json => [] }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @journal_entry.errors, :status => :uncprocessable_entity }\n format.xml { render :xml => @journal_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @step = TaskrequestsStep.find(params[:taskrequests_step_id])\n @absence_request = @step.absence_requests.find(params[:id])\n\n respond_to do |format|\n if @absence_request.update_attributes(params[:absence_request])\n format.html { redirect_to(@absence_request, :notice => 'Absence request was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @absence_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @email_lead.update(email_lead_params)\n format.html { redirect_to @email_lead, notice: 'Email lead was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @email_lead.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lead.update(lead_params)\n format.html { redirect_to @lead, notice: \"Lead was successfully updated.\" }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @finance_lead = FinanceLead.find(params[:id])\n\n respond_to do |format|\n if @finance_lead.update_attributes(params[:finance_lead])\n format.html { redirect_to @finance_lead, notice: 'Finance lead was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finance_lead.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @residential_lead.update(residential_lead_params)\n format.html { redirect_to @residential_lead, notice: 'Residential lead was successfully updated.' }\n format.json { render :show, status: :ok, location: @residential_lead }\n else\n format.html { render :edit }\n format.json { render json: @residential_lead.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_entries_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EntriesApi.update_entries ...'\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 EntriesApi.update_entries\"\n end\n # resource path\n local_var_path = '/api/v1/entries/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_entries_input'] || opts[:body])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Entry'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['authToken']\n\n new_options = opts.merge(\n :operation => :\"EntriesApi.update_entries\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EntriesApi#update_entries\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n @entry = Entry.find(params[:id])\n respond_to do |format|\n if @entry.update({\n content: params[:entry][:content],\n journal_id: params[:entry][:journal_id]\n })\n format.html { redirect_to @entry }\n format.json { render :show }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lead.update(lead_params)\n flash[:notice] = success_message(controller_name, action_name)\n format.html { redirect_to @lead }\n format.json { render :show, status: :ok, location: @lead }\n else\n format.html { render :edit }\n format.json { render json: @lead.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_answer = EntryAnswer.find(params[:id])\n\n respond_to do |format|\n if @entry_answer.update_attributes(params[:entry_answer])\n flash[:notice] = 'EntryAnswer was successfully updated.'\n format.html { redirect_to(@entry_answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_answer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n organization_timeline_entry.update_attributes(organization_timeline_entry_params)\n respond_with(@organization_timeline_entry, location: params[:url])\n end",
"def update\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n if @journal_entry.update_attributes(params[:journal_entry])\n format.html { redirect_to @journal_entry, notice: 'Journal entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @journal_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @journal_entry = JournalEntry.find(params[:id])\n\n respond_to do |format|\n if @journal_entry.update_attributes(params[:journal_entry])\n format.html { redirect_to @journal_entry, notice: 'Journal entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @journal_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to entries_path, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, :notice => 'Entry was successfully updated.' }\n format.json { head :ok }\n else\n @clients = Client.all.collect{ |c| [c.name, c.id] }\n @aircraft_types = AircraftType.all(:order => :name).collect{|c| [c.name, c.id]}\n\n format.html { render :action => \"edit\" }\n format.json { render :json => @entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n params[:entry][:status] = 'publish' if params[:entry][:status] == 'update'\n \n if params[:entry][:entry_metas_attributes].present?\n params[:entry][:entry_metas_attributes].replace(convert_entry_metas_attributes(params[:entry][:entry_metas_attributes]))\n end\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to edit_admin_entry_path(@entry), notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to blog_entries_url, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person = Person.find(params[:id])\n\n populate_attributes(@person, params[:person])\n respond_to do |format|\n \n if @person.save && @person.identifiable_entries.each(&:save!)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to edit_entry_path(@entry), notice: 'Entry updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update\n @entry = @time_sheet.entries.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to [@user, @time_sheet, @entry], notice: 'Hours were successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @journal_entry.update(journal_entry_params)\n format.html { redirect_to journal_entries_url, notice: 'journal_entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @journal_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lesson_entryset.update(lesson_entryset_params)\n format.html { redirect_to @lesson_entryset, notice: 'Lesson entryset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lesson_entryset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lead.update(lead_params)\n if current_user.is_admin\n format.html { redirect_to admin_leads_path, notice: 'Lead was successfully created.' }\n else\n format.html { redirect_to @lead, notice: 'Lead was successfully updated.' }\n format.json { render :show, status: :ok, location: @lead }\n end\n else\n format.html { render :edit }\n format.json { render json: @lead.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @data_entry.update(data_entry_params)\n format.html { redirect_to @data_entry, notice: 'Data entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_entry }\n else\n format.html { render :edit }\n format.json { render json: @data_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end",
"def update\n respond_to do |format|\n if @diary_entry.update(diary_entry_params)\n format.html { redirect_to @diary_entry, notice: 'Diary entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @diary_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Your entry was successfully updated sir.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n # format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @r_entry.update(r_entry_params)\n format.html { redirect_to @r_entry, notice: 'R entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @r_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to entries_path, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to entries_path, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @moment_entry = MomentEntry.find(params[:id])\n\n respond_to do |format|\n if @moment_entry.update_attributes(params[:moment_entry])\n format.html { redirect_to @moment_entry.aircraft, notice: 'Moment entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moment_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @opportunity = Opportunity.find(params[:id])\n\n if @opportunity.update(opportunity_params)\n head :no_content\n else\n render json: @opportunity.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to @entry, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n record = InvoiceLineItem.find(params[:id])\n print record.to_json\n record.update_attributes(params[:record]) \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"def update\n respond_to do |format|\n if @journal_entry.update(journal_entry_params)\n format.html { redirect_to @journal_entry, notice: 'Journal entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @journal_entry }\n else\n format.html { render :edit }\n format.json { render json: @journal_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to :back, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_entry = current_firm.all_time_entries.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to firm_time_entry_path(current_firm, @time_entry), notice: 'Time entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { index }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @request_meeting = RequestMeeting.find(params[:id])\n\n respond_to do |format|\n if @request_meeting.update_attributes(params[:request_meeting])\n format.html { redirect_to @request_meeting, notice: 'Request meeting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request_meeting.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n # workflow_attributes = workflow_params\n # step_definitions_attributes = workflow_attributes.delete(\"step_definitions\")\n\n # StepDefinition.updateStepDefinitions(step_definitions_attributes)\n\n respond_to do |format|\n if @workflow.update(workflow_params)\n format.html { redirect_to @workflow, notice: 'Workflow was successfully updated.' }\n format.json { render :show, status: :ok, location: @workflow }\n else\n format.html { render :edit }\n format.json { render json: @workflow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_resource_response(@headline, headline_params)\n end",
"def update!(**args)\n @lead = args[:lead] if args.key?(:lead)\n @recaptcha_status = args[:recaptcha_status] if args.key?(:recaptcha_status)\n @response_metadata = args[:response_metadata] if args.key?(:response_metadata)\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to root_url, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \trespond_to do |format|\n\t\tformat.html {\n\t\t\tgatherEntries\n\t\t\terrorMsg = nil\n\t\t\tTimeEntry.transaction do\n\t\t\t\tbegin\n\t\t\t\terrorMsg = l(:error_wktime_save_nothing) if @entries.blank?\n\t\t\t\t@entries.each do |entry|\n\t\t\t\t\t\tif entry.hours.blank?\n\t\t\t\t\t\t\t# delete the time_entry\n\t\t\t\t\t\t\t# if the hours is empty but id is valid\n\t\t\t\t\t\t\t# entry.destroy() unless ids[i].blank?\n\t\t\t\t\t\t\tif !entry.id.blank?\n\t\t\t\t\t\t\t\tif !entry.destroy()\n\t\t\t\t\t\t\t\t\terrorMsg = entry.errors.full_messages.join('\\n')\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t#if id is there it should be update otherwise create\n\t\t\t\t\t\t\tif !entry.save()\n\t\t\t\t\t\t\t\terrorMsg = entry.errors.full_messages.join('\\n')\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tend\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\trescue Exception => e\n\t\t\t\t\terrorMsg = e.message\n\t\t\t\tend\n\t\t\t\tif errorMsg.nil?\n\t\t\t\t\tflash[:notice] = l(:notice_successful_update)\n\t\t\t\t\tredirect_back_or_default :action => 'index'\n\t\t\t\telse\n\t\t\t\t\tflash[:error] = l(:error_wktime_save_failed, errorMsg)\n\t\t\t\t\trender_edit\n\t\t\t\t\traise ActiveRecord::Rollback\n\t\t\t\tend\n\t\t\tend\n\t\t} \n\t\tformat.api {\n\t\t}\n\tend \n end",
"def update_lead_with_http_info(api_lead, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LeadsApi#update_lead ...\"\n end\n \n # verify the required parameter 'api_lead' is set\n fail \"Missing the required parameter 'api_lead' when calling update_lead\" if api_lead.nil?\n \n # resource path\n path = \"/Leads\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'brief'] = opts[:'brief'] if opts[:'brief']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'text/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(api_lead)\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, 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 => 'APILead')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LeadsApi#update_lead\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def update\n respond_to do |format|\n if @attendance_entry.update(attendance_entry_params)\n format.html { redirect_to @attendance_entry, notice: 'Event attendance entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attendance_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @setbreak.update(setbreak_params)\n format.json { respond_with_bip @setbreak }\n else\n format.json { respond_with_bip @setbreak }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @goal_entry.update(goal_entry_params)\n format.html { redirect_to @goal_entry, notice: 'Goal entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @goal_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @step_activity = StepActivity.find(params[:id])\n\n respond_to do |format|\n if @step_activity.update_attributes(params[:step_activity])\n format.html { redirect_to @step_activity, notice: 'Step activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @step_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.html { redirect_to [@blog, @entry], notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: [@blog, @entry] }\n else\n format.html { render :edit }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end",
"def update\n @ldap_entry = LdapEntry.find(params[:id])\n\n respond_to do |format|\n if @ldap_entry.update_attributes(ldap_entry_params)\n format.html { redirect_to ldap_entries_path, notice: 'Ldap entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ldap_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @big_time_entry.update(big_time_entry_params)\n format.html { redirect_to @big_time_entry, notice: 'Big time entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @big_time_entry }\n else\n format.html { render :edit }\n format.json { render json: @big_time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @education_entry.update(education_entry_params)\n format.html { redirect_to @education_entry, notice: 'Education entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @education_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @time_entry = TimeEntry.with_deleted.find(params[:id])\n\n respond_to do |format|\n if @time_entry.update_attributes(params[:time_entry])\n format.html { redirect_to @time_entry, notice: 'Time entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @time_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to [:admin, @entry], notice: 'Entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @diary_entry.update(diary_entry_params)\n format.html { redirect_to root_path, notice: 'Dagbogsnotatet er redigeret.' }\n format.json { render :show, status: :ok, location: @diary_entry }\n else\n format.html { render :edit }\n format.json { render json: @diary_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n error = []\n attachment = params[:kyu_entry].delete :attachment\n respond_to do |format|\n if @kyu_entry.update_attributes(params[:kyu_entry])\n update_entry = render_to_string(partial: \"kyu_entry\",\n locals:{kyu_entry: @kyu_entry})\n format.json { render json: update_entry.to_json}\n else\n format.json { render json: @kyu_entry.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @diary_entry.update(diary_entry_params)\n format.html { redirect_to @diary_entry, notice: 'Diary entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @diary_entry }\n else\n format.html { render :edit }\n format.json { render json: @diary_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n render locals: { lead: lead, lead_data: lead.data, collection: lead.collection }, layout: 'lead_show'\n end",
"def update\n @event_entry = EventEntry.find(params[:id])\n\n respond_to do |format|\n if @event_entry.update_attributes(params[:event_entry])\n format.html { redirect_to @event_entry, :notice => 'Event entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @entry = @current_user.entries.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.html { redirect_to user_entries_path, notice: 'Entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.65401703",
"0.6457846",
"0.64387363",
"0.641881",
"0.64170223",
"0.6315538",
"0.6313723",
"0.62933874",
"0.6258026",
"0.62256646",
"0.6223613",
"0.6210328",
"0.6163048",
"0.6143663",
"0.6134204",
"0.61236674",
"0.6119816",
"0.6065085",
"0.60411793",
"0.6030078",
"0.60297626",
"0.60267854",
"0.60091025",
"0.60000664",
"0.59927064",
"0.5989909",
"0.59648687",
"0.5958318",
"0.59295815",
"0.59241724",
"0.59184074",
"0.5905974",
"0.5905974",
"0.58812827",
"0.5874908",
"0.5874727",
"0.5874355",
"0.5874223",
"0.5873086",
"0.58719194",
"0.5868965",
"0.58601695",
"0.5843586",
"0.58425254",
"0.58425254",
"0.58425254",
"0.58407223",
"0.5830065",
"0.5813387",
"0.5811483",
"0.58102447",
"0.58102447",
"0.580885",
"0.57956594",
"0.57884705",
"0.57870066",
"0.5780456",
"0.57678205",
"0.57615227",
"0.57575226",
"0.5751232",
"0.5751232",
"0.5748416",
"0.57455164",
"0.5742893",
"0.5742893",
"0.5742893",
"0.5742893",
"0.5742893",
"0.5742893",
"0.5736076",
"0.57223976",
"0.5721268",
"0.57201827",
"0.57090616",
"0.5704107",
"0.5701823",
"0.569376",
"0.5692994",
"0.5689314",
"0.5686781",
"0.5675656",
"0.5672103",
"0.56704235",
"0.5669159",
"0.56631005",
"0.5661684",
"0.56551784",
"0.5650527",
"0.56349874",
"0.5632572",
"0.5631607",
"0.56283665",
"0.5628215",
"0.5624844",
"0.56227905",
"0.56196463",
"0.5617785",
"0.56167805",
"0.56158906"
] |
0.7025225
|
0
|
DELETE /lead_entries/1 DELETE /lead_entries/1.json
|
def destroy
@lead_entry.destroy
respond_to do |format|
format.html { redirect_to lead_entries_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @lead = Lead.find(params[:id])\n @lead.destroy\n\n respond_to do |format|\n format.html { redirect_to leads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lead = Lead.find(params[:id])\n @lead.destroy\n\n respond_to do |format|\n format.html { redirect_to leads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lead_step = LeadStep.find(params[:id])\n @lead_step.destroy\n\n respond_to do |format|\n format.html { redirect_to lead_steps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lead.destroy\n\n respond_to do |format|\n format.html { redirect_to leads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ledger_entry = LedgerEntry.find(params[:id])\n @ledger_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to ledger_entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n debugger\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end",
"def destroy\n @diary_entry.destroy\n respond_to do |format|\n format.html { redirect_to diary_entries_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @journal_entry = JournalEntry.find(params[:id])\n @journal_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to journal_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal_entry = JournalEntry.find(params[:id])\n @journal_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to journal_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lead.destroy\n respond_to do |format|\n format.html { redirect_to leads_url, notice: 'Lead was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lead.destroy\n respond_to do |format|\n format.html { redirect_to leads_url, notice: 'Lead was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lead.destroy\n respond_to do |format|\n format.html { redirect_to leads_url, notice: 'Lead was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lead.destroy\n respond_to do |format|\n format.html { redirect_to leads_url, notice: 'Lead was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal_entry = JournalEntry.find(params[:id])\n @journal_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(journal_entries_url) }\n format.json { render :json => [] }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lead = current_user.leads.find(params[:id])\n @lead.destroy\n\n respond_to do |format|\n format.html { redirect_to leads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @r_entry.destroy\n respond_to do |format|\n format.html { redirect_to r_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lead = Lead.find(params[:id])\n @lead.destroy\n\n respond_to do |format|\n format.html { redirect_to(leads_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lead = Salesforce::Lead.find(params[:id])\n @lead.destroy\n\n respond_to do |format|\n format.html { redirect_to(salesforce_leads_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @logentry.destroy\n respond_to do |format|\n format.html { redirect_to logentries_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lesson_entryset.destroy\n respond_to do |format|\n format.html { redirect_to lesson_entrysets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @lead.destroy\r\n respond_to do |format|\r\n format.html { redirect_to leads_url, notice: 'Lead was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @residential_lead.destroy\n respond_to do |format|\n format.html { redirect_to residential_leads_url, notice: 'Residential lead was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_entry = TimeEntry.with_deleted.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_lead.destroy\n respond_to do |format|\n format.html { redirect_to email_leads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ldap_entry = LdapEntry.find(params[:id])\n @ldap_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to ldap_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@lead = Lead.find(params[:id])\n\t\t@lead.destroy\n\n\t\trespond_to do |format|\n\t\t format.html { redirect_to leads_url }\n\t\t format.json { head :ok }\n\t\tend\n\tend",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to blog_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goal_entry.destroy\n respond_to do |format|\n format.html { redirect_to goal_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_entries_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lead.destroy\n respond_to do |format|\n format.html { redirect_to campaign_url(@campaign), notice: 'Lead was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @record = FeaturedEntry.where('id = ?',params[:id]).take\n if @record.present?\n @record.update_attribute('removed', true)\n respond_with :blog, :v1, @record\n else\n render :json => {errors: @record.errors}, :status => 424\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to [@project, :entries] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find_by_id(params[:id])\n @entry.destroy if @entry\n\n respond_to do |format|\n format.html { redirect_to entries_url }\n format.json { head :ok }\n end\n end",
"def destroy_rest\n @entry_item = EntryItem.find(params[:id])\n @entry_item.destroy\n\n respond_to do |format|\n #format.html { redirect_to(entry_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @education_entry.destroy\n respond_to do |format|\n format.html { redirect_to education_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to @goal, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to '/entries' }\n format.json { render json: @entry }\n end\n end",
"def destroy\n @diary_entry.destroy\n respond_to do |format|\n format.html { redirect_to diary_entries_url, notice: 'Diary entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diary_entry.destroy\n respond_to do |format|\n format.html { redirect_to diary_entries_url, notice: 'Dagbogsnotatet er slettet' }\n format.json { head :no_content }\n end\n end",
"def test_valid_delete_returns_204\n db = DB.get\n\n valid_entry = SEED_ENTRIES.first\n insert_entry(db, valid_entry)\n\n assert_equal 1, db.execute('select * from entries').count\n\n delete \"/api/entries/#{valid_entry[:slug]}\"\n assert last_response.no_content?\n\n assert_equal 0, db.execute('select * from entries').count\n end",
"def destroy\n @finance_lead = FinanceLead.find(params[:id])\n @finance_lead.destroy\n\n respond_to do |format|\n format.html { redirect_to finance_leads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @log_entry = LogEntry.find(params[:id])\n @log_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to log_entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_entry = TimeEntry.find(params[:id])\n @time_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to time_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timeentry = Timeentry.find(params[:id])\n @timeentry.destroy\n\n respond_to do |format|\n format.html { redirect_to timeentries_url }\n format.json { head :no_content }\n end\n end",
"def delete_row(row_id); rest_delete(\"#{link('rows')}/#{row_id}\"); nil; end",
"def destroy\n @journal_entry = JournalEntry.find(params[:id])\n @journal_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(journal_entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @step_activity = StepActivity.find(params[:id])\n @step_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to step_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_entry.destroy\n respond_to do |format|\n format.html { redirect_to post_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kyu_entry.destroy\n respond_to do |format|\n format.html { redirect_to kyu_entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @journal_entry.destroy\n respond_to do |format|\n format.html { redirect_to journal_entries_url, notice: 'journal_entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry_set = EntrySet.find(params[:id])\n @entry_set.destroy\n\n respond_to do |format|\n format.html { redirect_to entry_sets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_entry.destroy\n respond_to do |format|\n format.html { redirect_to data_entries_url, notice: 'Data entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy_rest\n @entry_answer = EntryAnswer.find(params[:id])\n @entry_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_answers_url) }\n format.xml { head :ok }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @task_entry.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal_entry.destroy\n respond_to do |format|\n format.html { redirect_to journal_entries_url, notice: 'Journal entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n collection = Collection.find(@mlog_entry[:collection_id])\n @mlog_entry.destroy\n respond_to do |format|\n format.html { redirect_to collection}\n format.json { head :no_content }\n end\n end",
"def destroy\n @accounting_entry.destroy\n respond_to do |format|\n format.html { redirect_to accounting_entries_url, notice: 'Se ha eliminado con exito!.' }\n format.json { head :no_content }\n end\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def destroy\n @attendance_entry.destroy\n respond_to do |format|\n format.html { redirect_to event_attendance_entries_path(@attendance_entry.event) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timetable_entry.destroy\n respond_to do |format|\n format.html { redirect_to timetable_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n head :no_content\n end",
"def destroy\n @journalentry = Journalentry.find(params[:id])\n @journalentry.destroy\n\n respond_to do |format|\n format.html { redirect_to(journalentries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entry = @time_sheet.entries.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to user_time_sheet_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction_entry = TransactionEntry.find(params[:id])\n @transaction_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to transaction_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fud_entry.destroy\n respond_to do |format|\n format.html { redirect_to fud_entries_url, notice: 'Fud entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @big_time_entry.destroy\n respond_to do |format|\n format.html { redirect_to big_time_entries_url, notice: 'Big time entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lead.destroy\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end",
"def destroy\n @tgl_row = TglRow.find(params[:id])\n @tgl_row.destroy\n\n respond_to do |format|\n format.html { redirect_to tgl_rows_url }\n format.json { head :no_content }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n 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 @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @entry = Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lead.destroy\n respond_to do |format|\n format.html { redirect_to leads_url, notice: \"Lead was successfully destroyed.\" }\n end\n end",
"def destroy\n @entry ||= Entry.find(params[:id])\n @entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(entries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @line_detail.destroy\n respond_to do |format|\n format.html { redirect_to line_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n @entry_instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_instruments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invent_journal_line = InventJournalLine.find(params[:id])\n @invent_journal_line.destroy\n\n respond_to do |format|\n format.html { redirect_to invent_journal_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_entry = EventEntry.find(params[:id])\n @event_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to event_entries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry.destroy\n respond_to do |format|\n format.html { redirect_to entries_url, notice: 'Entry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.70858055",
"0.70858055",
"0.705",
"0.7037913",
"0.70199305",
"0.6945926",
"0.6927681",
"0.67897886",
"0.67679244",
"0.67352366",
"0.67352366",
"0.6733046",
"0.6733046",
"0.6733046",
"0.6733046",
"0.6729303",
"0.6729033",
"0.6705907",
"0.669804",
"0.66964895",
"0.66925347",
"0.6685555",
"0.66625565",
"0.6651142",
"0.66476655",
"0.66413534",
"0.66413534",
"0.66404146",
"0.66337013",
"0.6626047",
"0.6624632",
"0.66165227",
"0.6611761",
"0.660872",
"0.660872",
"0.660872",
"0.6590782",
"0.6585429",
"0.6584521",
"0.65833545",
"0.6567576",
"0.6566959",
"0.65654683",
"0.65654683",
"0.6564483",
"0.6551004",
"0.6548922",
"0.65477854",
"0.65382713",
"0.65297174",
"0.6526434",
"0.6521901",
"0.6512486",
"0.64988375",
"0.64915144",
"0.64915144",
"0.6487921",
"0.6487353",
"0.6480577",
"0.64794236",
"0.647773",
"0.64764804",
"0.647546",
"0.64753735",
"0.64732087",
"0.6465516",
"0.64653116",
"0.6463058",
"0.64608294",
"0.6459411",
"0.6458463",
"0.64542246",
"0.6451128",
"0.645077",
"0.6446235",
"0.64458686",
"0.6445206",
"0.6440543",
"0.6437769",
"0.64374745",
"0.6427933",
"0.6420798",
"0.64150697",
"0.6414029",
"0.64081967",
"0.6402771",
"0.6401717",
"0.6397619",
"0.6397619",
"0.6397619",
"0.6397619",
"0.6397619",
"0.63926303",
"0.6392394",
"0.63900304",
"0.6384123",
"0.63829845",
"0.63822657",
"0.6381271",
"0.6381271"
] |
0.7746231
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_lead_entry
@lead_entry = LeadEntry.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 lead_entry_params
params.require(:lead_entry).permit(:text, :date, :relation, :lead_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.