query
stringlengths 7
9.55k
| document
stringlengths 10
363k
| metadata
dict | negatives
sequencelengths 0
101
| negative_scores
sequencelengths 0
101
| document_score
stringlengths 3
10
| document_rank
stringclasses 102
values |
---|---|---|---|---|---|---|
Extract a hash with attributes:values from the http params. source://devise//lib/devise/strategies/authenticatable.rb98 | def http_auth_hash; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def params_auth_hash; end",
"def auth_info\n params[auth_param] || {}\n end",
"def user_params\n allowedParamsKey = [:email, :password, :uid, :name, :nickname, :image]\n resultData = {}\n for key in allowedParamsKey\n resultData[key] = params.fetch(key, \"\")\n end\n \n return resultData\n end",
"def raw_params(auth); end",
"def user_params(params_hash)\n {first_name: params_hash[\"first_name\"], last_name: params_hash[\"last_name\"], login: params_hash[\"login\"], email: params_hash[\"email\"], age: params_hash[\"age\"], gender: params_hash[\"gender\"], mobile_number: params_hash[\"mobile_number\"], home_number: params_hash[\"home_number\"], work_number: params_hash[\"work_number\"], address: params_hash[\"address\"], city: params_hash[\"city\"], state: params_hash[\"state\"], country: params_hash[\"country\"], pin_code: params_hash[\"pin_code\"], crypted_password: params_hash[\"crypted_password\"]}\n end",
"def omniauth_params\n request.env['omniauth.auth'].to_hash\n end",
"def omniauth_params\n request.env['omniauth.auth'].to_hash\n end",
"def user_params\n user = RailsFixes::Util.hash_keys_to_sym(JSON.parse(params.require(:user)))\n return {name:user[:name], username:user[:username], email:user[:email], locale:user[:locale], password:user[:password], role:user[:role]}\n end",
"def params_auth_hash\n if params[scope].kind_of?(Hash) && params[scope].has_key?(authentication_keys.first)\n params[scope]\n else\n params\n end\n end",
"def parse(authorization)\n auth_params = {}\n authorization.split.each do |param|\n parts = param.split('=', 2)\n auth_params[parts[0]] = parts[1]\n end\n auth_params\nend",
"def raw_params(auth)\n auth.sub(TOKEN_REGEX, '').split(/\"\\s*#{AUTHN_PAIR_DELIMITERS}\\s*/)\n end",
"def auth_params\n params = ActionController::Parameters.new(env[\"omniauth.auth\"])\n Hashie::Mash.new params.permit(:uid, :provider, info: [:name, :email])\n end",
"def userauth_params\n params.fetch(:userauth, {})\n end",
"def params_auth_hash\n params[scope]\n end",
"def params_auth_hash\n params[scope]\n end",
"def auth_hash\n request.env['omniauth.auth'].symbolize_keys!\n end",
"def extract_params()\n param = extract_params_pm()\n param[:dureeCours] = @dureeCours\n param[:dureeTP] = @dureeTP\n param[:quadri] = @quadri\n param[:professeur] = @professeur\n return param\n end",
"def auth_hash\n # raise request.env['omniauth.auth'].to_yaml\n request.env[\"omniauth.auth\"]\n end",
"def params() request.params end",
"def user_params\n {\n state: 'active',\n email: \"#{set_phone}@nu0.one\",\n password: params[:password],\n referral_id: (parse_refid! unless params[:refid].nil?)\n }.compact\n end",
"def http_auth_hash\n keys = [http_authentication_key, :password]\n Hash[*keys.zip(decode_credentials).flatten]\n end",
"def http_auth_hash\n keys = [http_authentication_key, :password]\n Hash[*keys.zip(decode_credentials).flatten]\n end",
"def jsonapi_fields\n return {} unless params[:fields].respond_to?(:each_pair)\n\n if defined?(ActiveSupport::HashWithIndifferentAccess)\n extracted = ActiveSupport::HashWithIndifferentAccess.new\n else\n extracted = Hash.new\n end\n\n params[:fields].each do |k, v|\n extracted[k] = v.to_s.split(',').map(&:strip).compact\n end\n\n extracted\n end",
"def user_information_params\n params[:user_information]\n end",
"def get_auth_data \n auth_data = nil\n [\n 'REDIRECT_REDIRECT_X_HTTP_AUTHORIZATION',\n 'REDIRECT_X_HTTP_AUTHORIZATION',\n 'X-HTTP_AUTHORIZATION', \n 'HTTP_AUTHORIZATION'\n ].each do |key|\n if request.env.has_key?(key)\n auth_data = request.env[key].to_s.split\n break\n end\n end\n if auth_data && auth_data[0] == 'Basic' \n return Base64.decode64(auth_data[1]).split(':')[0..1] \n end \n end",
"def login_attributes\n attrs = {}\n\n attr_pairs = [\n {\"userName\" => @user_name},\n {\"suspended\" => @suspended},\n {\"ipWhitelisted\" => @ip_whitelisted},\n {\"admin\" => @admin},\n {\"changePasswordAtNextLogin\" => @change_password_at_next_login},\n {\"agreedToTerms\" => @agreed_to_terms},\n {'password' => @password},\n {'hashFunctionName' => @hash_function_name},\n ]\n\n attr_pairs.each do |pair|\n key = pair.keys.first\n attrs.merge!(pair) unless pair[key].nil?\n end\n\n attrs\n end",
"def user_params\n respond_to do |format|\n format.jsonapi { ActiveModelSerializers::Deserialization.jsonapi_parse(params, only: [:email, :password, :role, :first_name, :last_name, :municipality, :request_verified_status]) }\n end\n end",
"def collect_parameters\n @device_id = params[:device_id]\n @email = params[:email]\n @latitude = params[:latitude]\n @longitude = params[:longitude] \n @status = params[:status]\n @user_name = params[:user_name]\n @auth_token = params[:auth_token]\n @user\n end",
"def params\n # Normal cases\n # raise @params.values.inspect\n # return @params.values.length.inspect\n if %w{ready accesses list_subscribe list_unsubscribe}.include?(@action)\n @params\n elsif @params.values.first.is_a? Hash\n {@params.keys.first => @params.values.first.select{|k,v| v.present? }}\n elsif @params.values.first.is_a? Array\n {@params.keys.first => @params.values.first.select(&:present?)} rescue {}\n end\n # rescue => e\n # {}\n end",
"def get_auth_data\n auth_key = @@http_auth_headers.find { |h| request.env.key?(h) }\n auth_data = request.env[auth_key].to_s.split unless auth_key.blank?\n auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil]\n end",
"def get_auth_data\n user, pass = nil, nil\n # extract authorisation credentials \n if request.env.has_key? 'X-HTTP_AUTHORIZATION' \n # try to get it where mod_rewrite might have put it \n authdata = request.env['X-HTTP_AUTHORIZATION'].to_s.split \n elsif request.env.has_key? 'HTTP_AUTHORIZATION' \n # this is the regular location \n authdata = request.env['HTTP_AUTHORIZATION'].to_s.split \n end \n \n # at the moment we only support basic authentication \n if authdata && authdata[0] == 'Basic' \n user, pass = Base64.decode64(authdata[1]).split(':')[0..1] \n end \n return [user, pass] \n end",
"def get_auth_params_from_login_response_headers(response)\n client = response.headers['client']\n token = response.headers['access-token']\n expiry = response.headers['expiry']\n token_type = response.headers['token-type']\n uid = response.headers['uid']\n\n auth_params = {\n 'access-token' => token,\n 'client' => client,\n 'uid' => uid,\n 'expiry' => expiry,\n 'token_type' => token_type\n }\n return auth_params\n end",
"def get_auth_data\n auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) }\n auth_data = request.env[auth_key].to_s.split unless auth_key.blank?\n return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil] \n end",
"def authentication_params(type:)\n case type&.to_sym\n when :sign_up\n [:accept_terms, :email, :firstname, :language_id, :org_id, :password, :surname,\n { org_attributes: %i[abbreviation contact_email contact_name is_other\n managed name org_type target_url links] }]\n when :sign_in\n %i[email org_id password]\n else\n %i[email]\n end\n end",
"def extract_request_parameters\n flow_name = env['REQUEST_PATH'][1..-1].to_s\n\n # Use dup to preserve original env.\n params = env['params'].dup.to_options\n msisdn = params.delete(:msisdn).to_s\n session_id = params.delete(:session_id).to_s\n input = params.delete(:input).to_s\n\n {\n flow_name: flow_name,\n params: params,\n msisdn: msisdn,\n session_id: session_id,\n input: input\n }\n end",
"def http_auth_hash\n keys = [http_authentication_key, :ip_address]\n Hash[*keys.zip(decode_credentials).flatten]\n end",
"def authentication_information\n password.nil? ?\n { :method => :anonymous } :\n { :method => :simple, :username => username, :password => password }\n end",
"def get_auth_data\n auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) }\n auth_data = request.env[auth_key].to_s.split unless auth_key.blank?\n return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil] \n end",
"def set_params_from_omniauth_hash_to_pass_it_to_transfer_to_guest_cmpsr\n @params_from_omniauth_for_transfer_to_guest_cmpsr = pick_fields_from_omniauth_hash_that_will_be_passed_to_transfer_guest_cmpsr_as_params\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def user_params\n ActiveModelSerializers::Deserialization.jsonapi_parse(params)\n end",
"def with_authentication_hash(auth_type, auth_values); end",
"def get_reqd_params_and_values \n# logger.info \"get_reqd_params_and_values----------------------\"\n values = {}\n i = 1\n while !params[:rparams_.to_s + \"#{i}\"].nil?\n if(!params[:rparams_.to_s + \"#{i}\"].empty?)\n value = params[:rparam_values_.to_s + \"#{i}\"].map!{|i| CGI::unescape(i).gsub(\"\\\"\", \"'\")}\n # logger.info \"--------------\"+params[:rparam_values_.to_s + \"#{i}\"].to_s\n values[params[:rparams_.to_s + \"#{i}\"]] = value \n end \n i += 1\n end\n # logger.info \"--------------\"+values.to_s\n values\nend",
"def get_auth_data\n auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) }\n auth_data = request.env[auth_key].to_s.split unless auth_key.blank?\n return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil] \n end",
"def parsed_params\n \n end",
"def params\n { username: 'admin', password: 'admin' }\n end",
"def user_params(params={})\n {\n password: \"hello55\",\n email: \"[email protected]\",\n name: \"Jard\",\n phone_number: \"6195559090\",\n country_code: \"+1\"\n }.merge(params)\n end",
"def params\n self.class.const_get(\"REQUEST_PARAMETERS\").inject({}) do |parameters, parameter|\n parameters[parameter] = instance_variable_get(\"@#{parameter}\") unless instance_variable_get(\"@#{parameter}\").nil?\n parameters\n end\n end",
"def authentication\n {:username => @username, :password => @password}\n end",
"def identity_hash\n request.env['omniauth.auth']\n end",
"def get_auth_data\n auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) }\n auth_data = request.env[auth_key].to_s.split unless auth_key.blank?\n return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil]\n end",
"def attributes_from_user\n return {} unless @current_user&.loa3?\n\n {\n 'first_name' => @current_user.first_name,\n 'last_name' => @current_user.last_name,\n 'birth_date' => @current_user.birth_date,\n 'ssn' => @current_user.ssn,\n 'icn' => @current_user.icn\n }\n end",
"def fetch_facebook_params\n\n @fb_details = request.env['omniauth.auth']\n redirect_to main_app.root_path if @fb_details.nil?\n\n @fb_data = Hash.new\n @fb_data[:email] = @fb_details[:info][:email]\n @fb_data[:firstname] = @fb_details[:info][:first_name]\n @fb_data[:lastname] = @fb_details[:info][:last_name]\n @fb_data[:fb_token] = @fb_details[:credentials][:token]\n @fb_data[:image] = @fb_details[:info][:image].concat(\"?type=#{SIZE}\")\n\n return @fb_data\n end",
"def params_auth_hash\n params[scope].merge(ip_address: remote_ip)\n end",
"def params(request)\n result = decode_params(request.params)\n result.merge(extract_client_info(request))\n end",
"def query_values\n CGI.parse(parsed_url.query || \"\").inject({}) do |hash, (key, values)|\n hash.merge!(key.to_sym => values.first)\n end\n end",
"def session_params\n params.fetch(:session, :email, :password)\n end",
"def http_params\n {}\n end",
"def extract_authorization(authorization, parameters)\n id, pass = authorization.split('-')\n parameters[:AccessID] = id\n parameters[:AccessPass] = pass\n parameters\n end",
"def parse_params\n params_str.empty? ? BLANK_HASH : CGI::parse(params_str).inject({}) do |hash, (param, value)|\n hash[param] = if value.is_a?(Array) and value.size == 1 and param !~ /\\[\\d*\\]$/\n value[0]\n else\n value\n end\n hash\n end\n end",
"def get_opt_params_and_values \n values = {}\n i = 1\n while !params[:oparams_.to_s + \"#{i}\"].nil?\n\t if(!params[:oparams_.to_s + \"#{i}\"].empty?)\n value = params[:oparam_values_.to_s + \"#{i}\"].map!{|i| CGI::unescape(i).gsub(\"\\\"\", \"'\")}\n values[params[:oparams_.to_s + \"#{i}\"]] = value\n end\n i += 1\n end\n values\nend",
"def user_params\r\n params.fetch(:user, {})\r\n end",
"def credentials\n params.values_at('username', 'password')\n end",
"def to_h\n @params.dup.with_indifferent_access\n end",
"def raw_params(auth)\n _raw_params = auth.sub(TOKEN_REGEX, '').split(/\\s*#{AUTHN_PAIR_DELIMITERS}\\s*/)\n\n if !(_raw_params.first =~ %r{\\A#{TOKEN_KEY}})\n _raw_params[0] = \"#{TOKEN_KEY}#{_raw_params.first}\"\n end\n\n _raw_params\n end",
"def authentication_params\n {\n api_user: @api_user,\n api_key: @api_key\n }\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 authorization_params\n {\n :jsonrpc => \"2.0\",\n :id => request_id,\n :method => \"user.login\",\n :params => {\n :user => username,\n :password => password\n }\n }\n end",
"def patient_params\n {\n email: @body[\"email\"],\n password: @body[\"password\"],\n password_confirmation: @body[\"password_confirmation\"],\n first_name: @body[\"first_name\"],\n last_name: @body[\"last_name\"],\n sex: @body[\"sex\"],\n height: @body[\"height\"],\n weight: @body[\"weight\"],\n birthday: @body[\"birthday\"],\n }\n end",
"def params\n @symbolised_params ||= @rack_request.params.inject({}) { |p, (k,v)| p[k.to_sym] = v; p }\n end",
"def params\n\t\t\trequest.params.symbolize_keys(deep: true)\n\t\trescue ArgumentError => e\n\t\t\traise unless e.message.include?('invalid %-encoding')\n\n\t\t\t{}\n\t\tend",
"def raw_params(auth)\n _raw_params = auth.sub(TOKEN_REGEX, '').split(/\\s*#{AUTHN_PAIR_DELIMITERS}\\s*/)\n\n if !(_raw_params.first =~ %r{\\A#{TOKEN_KEY}})\n _raw_params[0] = \"#{TOKEN_KEY}#{_raw_params.first}\"\n end\n\n _raw_params\n end",
"def attributes_for(params)\n if params.kind_of?(Hash)\n attrs = OpenStruct.new\n attrs.refresh_token = params[:refresh_token] || params['refresh_token']\n attrs.access_token = params[:access_token] || params['token']\n attrs.expires_at = params[:expires_at] || params['expires_at']\n\n params = attrs\n end\n params\n end",
"def oauth_hash_params(param)\n case param[:provider]\n when \"twitter\"\n {\n email: \"\",\n name: param[:info][:nickname]\n }\n when \"google_oauth2\"\n {\n email: param[:info][:email],\n name: param[:info][:name]\n }\n when \"facebook\"\n {\n email: param[:info][:email],\n name: param[:info][:name]\n }\n end\n end",
"def params_for_user\n {}\n end",
"def params_for_user\n {}\n end",
"def get_params()\n return self.params.keys\n end",
"def authorize_params\n super.tap do |params|\n %w[ state ].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n\n # to support omniauth-oauth2's auto csrf protection\n session['omniauth.state'] = params[:state] if v == 'state'\n end\n end\n end\n end",
"def basic_params\n { username: @id, password: @secret }\n end",
"def extract_hash_tags_from_params\n ((params[:custom_tags] || []) + (params[:tags] || [])).delete_empty.each do |tag|\n current_user.hash_tags << HashTag.get_tag(tag)\n end\n end",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def params\n { :only => self.attrs, :methods => self.methds }\n end",
"def auth_options\n params.require(:email)\n params.require(:password)\n end",
"def params\n\t if method == :post\n#\t\t @post_params.instance_variable_get(\"@hash\")\n\t\t @post_params\n\t else\n#\t\t @get_params.instance_variable_get(\"@hash\")\n\t\t @get_params\n\t end\n end",
"def profile_hash(details, creds)\n params = {}\n params[:api_type] = details[:api_type]\n params[:license_key] = creds[:license_key]\n params[:login_id] = creds[:login_id]\n params[:version] = details[:version]\n params\n end",
"def params\n { :only => self.attrs, :methods => self.methds }\n end",
"def valid_attributes\n { email: valid_user.email, password: valid_user.password }\n end",
"def user_params\n\t\tparams.fetch(:user, {})\n\tend",
"def make_authentication_details(details)\n self.vendor_code = details['vendor_code']\n self.sync_applicable = details['sync_applicable']\n self.integration_id = details['integration_id']\n self.integration_vector = details['integration_vector']\n end",
"def authorize_params\n super.tap do |params|\n %w(scope team redirect_uri).each do |v|\n if !request.params[v].to_s.empty?\n params[v.to_sym] = request.params[v]\n end\n end\n log(:debug, \"Authorize_params #{params.to_h}\")\n end\n end",
"def authentication_params\n\t\t\tparams.require(:authentication).permit(:user_id, :provider, :uid, :access_token)\n\t\tend",
"def user_params\n {username: params[:username], email: params[:email], password: params[:password], admin: false }\n end",
"def resource_params\n user_params = params[:user] || {}\n user_params.merge!(uv_login: params[:uv_login]) if params[:uv_login].present?\n user_params\n end",
"def user_attributes\n {\n email: \"[email protected]\",\n username: \"Test\",\n bio: \"bio\",\n url: \"https://example.com\",\n twitter: \"djensenius\",\n portrait: \"head.jpg\"\n }\nend",
"def params\n { :only => attrs, :methods => methds }\n end"
] | [
"0.681905",
"0.6648172",
"0.65387404",
"0.6493386",
"0.6427471",
"0.6361943",
"0.6361943",
"0.6321627",
"0.63036513",
"0.6277582",
"0.62652564",
"0.6228455",
"0.6191444",
"0.61628705",
"0.61628705",
"0.6162765",
"0.6117268",
"0.60296255",
"0.6018161",
"0.5999668",
"0.598125",
"0.598125",
"0.5951822",
"0.59490216",
"0.5946252",
"0.5942909",
"0.59408724",
"0.593735",
"0.59330434",
"0.59299195",
"0.59274256",
"0.592716",
"0.5922132",
"0.59220946",
"0.5912765",
"0.5907017",
"0.5904086",
"0.59033686",
"0.58991486",
"0.58913684",
"0.58913684",
"0.58913684",
"0.58913684",
"0.58913684",
"0.58913684",
"0.5878197",
"0.5849141",
"0.5836404",
"0.5803625",
"0.5776754",
"0.5776003",
"0.5770717",
"0.57661754",
"0.57648945",
"0.5740289",
"0.57329524",
"0.57211685",
"0.57199514",
"0.571225",
"0.570902",
"0.5708798",
"0.57015103",
"0.5700281",
"0.5677336",
"0.56715274",
"0.56655866",
"0.5659603",
"0.56590194",
"0.565828",
"0.56540895",
"0.563418",
"0.5633472",
"0.5630133",
"0.5628129",
"0.5624687",
"0.56224096",
"0.5621296",
"0.5620733",
"0.56112677",
"0.5607151",
"0.5607151",
"0.5599393",
"0.5597839",
"0.55836487",
"0.5582552",
"0.5579168",
"0.5576839",
"0.5576715",
"0.5563794",
"0.55567306",
"0.5556722",
"0.5550239",
"0.55496657",
"0.55488425",
"0.5544159",
"0.553801",
"0.55354464",
"0.55331683",
"0.5531396",
"0.55268055"
] | 0.5952069 | 22 |
Check if the model accepts this strategy as http authenticatable. | def http_authenticatable?; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def http_authenticatable?\n mapping.to.http_authenticatable?(authenticatable_name)\n end",
"def http_authenticatable?\n mapping.to.http_authenticatable?(authenticatable_name)\n end",
"def valid_for_http_auth?\n http_authenticatable? && request.authorization && with_authentication_hash(:http_auth, http_auth_hash)\n end",
"def valid_for_http_auth?\n http_authenticatable? && request.authorization && with_authentication_hash(:http_auth, http_auth_hash)\n end",
"def http_auth_header?\n scope_class.http_authenticatable && !request.xhr?\n end",
"def authenticatable?\n self.class.included_modules.include?(Authenticatable)\n end",
"def http_auth_header?\n Oath.config.http_authenticatable && !request.xhr?\n end",
"def http_auth?\n if request.xhr?\n Oath.config.http_authenticatable_on_xhr\n else\n !Oath::Lockdown.navigational_format?(request)\n end\n end",
"def token_authenticatable?\n mapping.to.http_authenticatable?(:token_options)\n end",
"def http_auth?\n if request.xhr?\n Devise.http_authenticatable_on_xhr\n else\n !(request_format && is_navigational_format?)\n end\n end",
"def authenticate?\n @authentication_required\n end",
"def authenticating_with_oauth?\n correct_request_class? && using_oauth?\n end",
"def params_authenticatable?\n User.params_authenticatable?(authenticatable_name)\n end",
"def authenticate\n klass.new(request).authenticate == true\n end",
"def valid_for_http_auth?; end",
"def proof_of_authenticity\n valid_asset_definition? ? @asset_definition.proof_of_authenticity : false\n end",
"def params_authenticatable?\n mapping.to.params_authenticatable?(authenticatable_name)\n end",
"def valid_for_token_auth?\n token_authenticatable? && auth_token.present? && with_authentication_hash(:token_auth, token_auth_hash)\n end",
"def http?\n type == :basic || type == :digest\n end",
"def valid_for_params_auth?\n params_authenticatable? && valid_params_request? &&\n valid_params? && with_authentication_hash(:params_auth, params_auth_hash)\n end",
"def resource_active_for_authentication?\n [email protected]_to?(:active_for_authentication?) || @resource.active_for_authentication?\n end",
"def valid_http_auth?\n controller.authenticate_with_http_basic do |login, password|\n if !login.blank? && !password.blank?\n send(\"#{login_field}=\", login)\n send(\"#{password_field}=\", password)\n return valid?\n end\n end\n \n false\n end",
"def valid?\n valid_user?(request.headers)\n end",
"def valid_for_authentication?; end",
"def valid_for_authentication?; end",
"def params_authenticatable?; end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN']) || api_operator.present?\n end",
"def authenticating_via_oauth_server?\n attempted_record.nil? && errors.empty? && super\n end",
"def active_for_authentication?\n self.active?\n end",
"def check_header\n if ['POST', 'PUT', 'PATCH'].include? request.method\n head :not_acceptable and return unless request.content_type == 'application/vnd.api+json'\n end\n end",
"def active_for_authentication?\n super\n end",
"def resource_valid_for_authentication?\n @resource.respond_to?(:valid_for_authentication?) && @resource.valid_for_authentication? { valid_password? }\n end",
"def active_for_authentication?; end",
"def active_for_authentication?; end",
"def connectable?\n ssl_context = OpenSSL::SSL::SSLContext.new\n ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n @http.head(URL_TO_CHECK, ssl_context: ssl_context).status.success?\n rescue StandardError\n false\n end",
"def active_for_authentication?\n super && self.enabled? && self.is_allowed_in?\n end",
"def request_should_auth?( request )\n\t\tself.log.debug \"Checking to see if Auth(entication/orization) should be applied for app_path: %p\" %\n\t\t\t[ request.app_path ]\n\n\t\t# If there are positive criteria, return true if the request matches any of them,\n\t\t# or false if they don't\n\t\tif self.class.has_positive_auth_criteria?\n\t\t\tcriteria = self.class.positive_auth_criteria\n\t\t\tself.log.debug \" checking %d positive auth criteria\" % [ criteria.length ]\n\t\t\treturn criteria.any? do |pattern, block|\n\t\t\t\tself.request_matches_criteria( request, pattern, &block )\n\t\t\tend\n\t\t\treturn false\n\n\t\t# If there are negative criteria, return false if the request matches any of them,\n\t\t# or true if they don't\n\t\telsif self.class.has_negative_auth_criteria?\n\t\t\tcriteria = self.class.negative_auth_criteria\n\t\t\tself.log.debug \" checking %d negative auth criteria\" % [ criteria.length ]\n\t\t\treturn false if criteria.any? do |pattern, block|\n\t\t\t\trval = self.request_matches_criteria( request, pattern, &block )\n\t\t\t\tself.log.debug \" matched: %p -> %p\" % [ pattern, block ] if rval\n\t\t\t\trval\n\t\t\tend\n\t\t\treturn true\n\n\t\telse\n\t\t\tself.log.debug \" no auth criteria; default to requiring auth\"\n\t\t\treturn true\n\t\tend\n\tend",
"def authentication?\n @capabilities and @capabilities.include? 'auth'\n end",
"def should_authenticate?(env)\n @config['should_authenticate_check'] ? @config['should_authenticate_check'].call(env) : true\n end",
"def authenticate\n self.get && true\n end",
"def auth_present?\n !!request.headers['HTTP_AUTHORIZATION'].present?\n end",
"def correct_request_class?\n return false unless auth_params?\n \n if is_auth_session?\n auth_type.to_s == \"session\"\n else\n auth_type.to_s == \"user\"\n end\n end",
"def authenticate?\n @api_options.has_key?(:authenticate?) ? @api_options[:authenticate?] : !Fleakr.token.blank?\n end",
"def authorized?\n auth_config = settings.config['authentication']\n @auth ||= Rack::Auth::Basic::Request.new(request.env)\n @auth.provided? and @auth.basic? and @auth.credentials and @auth.credentials == [auth_config['username'], auth_config['password']]\n end",
"def active_for_authentication?\n super and self.enabled?\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def authenticates?\n !!@authenticates\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def valid?\n\n auth_params = params[scope]\n return false if !auth_params\n\n (nimbus_auth(auth_params)&.code == 200) ? true : false\n end",
"def verified_request?\n\t\tsuper || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n\tend",
"def active_for_authentication?\n super && self.is_active?\n end",
"def valid?\n authorization_header.present? && authorization_header.match(BEARER_PATTERN) && authentication_token.present?\n end",
"def active_for_authentication?\r\n super && active_status?\r\n end",
"def active_for_authentication?\n active? && super\n end",
"def active_for_authentication?\n super and self.disponible?\n end",
"def validates?\n # include the params to validate our request\n request_params = denormalize params.merge({\n :Comando => \"validar\",\n :Token => @token || PagSeguro.config[\"authenticity_token\"]\n }).dup\n\n return true if PagSeguro.developer?\n\n # do the request\n uri = URI.parse(API_URL)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(uri.path)\n request.set_form_data request_params\n response = http.start {|r| r.request request }\n (response.body =~ /VERIFICADO/) != nil\n end",
"def client_has_valid_token?\n request.headers[\"Authorization\"] == Rails.application.credentials.guessing_access_token\n end",
"def active_for_authentication?\n super && self.approved?\n end",
"def authorized?\n @auth ||= Rack::Auth::Basic::Request.new(request.env)\n @auth.provided? &&\n @auth.basic? &&\n @auth.credentials &&\n check(@auth.credentials)\n end",
"def auth?\n true\n end",
"def ssl_allowed?\n (self.class.read_inheritable_attribute(:ssl_allowed_actions) || []).include?(action_name.to_sym) ||\n request.path.index(\"/zz_api/\") == 0\n end",
"def needs_authorization?\n true\n end",
"def active_for_authentication?\n super && !self.blocked\n end",
"def active_for_authentication?\n super && !self.blocked\n end",
"def active_for_authentication?\n super && active?\n end",
"def active_for_authentication?\n super && active?\n end",
"def active_for_authentication?\n super && active?\n end",
"def verified_request?\n !protect_against_forgery? ||\n request.method == :get ||\n !verifiable_request_format? ||\n form_authenticity_token == params[request_forgery_protection_token]\n end",
"def verified_request?\r\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\r\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def authenticate_if_needed\n # Disable this extra authentication in test mode\n return true if Rails.env.test?\n if (is_hidden || is_staging) && !is_api_or_pdf\n authenticate_or_request_with_http_basic do |username, password|\n username == \"samvera\" && password == \"hyku\"\n end\n end\n end",
"def active_for_authentication?\n super && approved?\n end",
"def authentication_in_progress?\n request.path_info =~ /^\\/oauth/\n end",
"def authentication_in_progress?\n request.path_info =~ /^\\/oauth/\n end",
"def use_authentication?\n auth = _get_option('use_authentication')\n if auth && _get_entity_detail('belongs_to_api_key')\n _log 'Cannot use authentication if bucket belongs to API key as false positives will occur.'\n _log 'Defaulting to using unauthenticated techniques.'\n auth = false\n end\n auth\n end",
"def verified_request?\n !protect_against_forgery? ||\n request.method == :get ||\n request.xhr? ||\n !verifiable_request_format? ||\n form_authenticity_token == params[request_forgery_protection_token]\n end",
"def verified_request?\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\n end",
"def verified_request?\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\n end",
"def verified_request?\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\n end",
"def verified_request?\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\n end"
] | [
"0.7714816",
"0.7714816",
"0.7639098",
"0.7639098",
"0.70799583",
"0.705905",
"0.69898516",
"0.6965629",
"0.6963274",
"0.6873079",
"0.66216296",
"0.66195005",
"0.6605249",
"0.6597048",
"0.65659785",
"0.6422227",
"0.6373206",
"0.6340653",
"0.63324374",
"0.6297192",
"0.6296414",
"0.6272226",
"0.62350726",
"0.62321234",
"0.62321234",
"0.621931",
"0.61823",
"0.61744124",
"0.6093536",
"0.6074679",
"0.60259235",
"0.6021709",
"0.60182816",
"0.60182816",
"0.6007856",
"0.59796655",
"0.59778064",
"0.59575945",
"0.5954577",
"0.59498125",
"0.5948388",
"0.59402204",
"0.59340495",
"0.59233993",
"0.59173936",
"0.59019655",
"0.59019655",
"0.59019655",
"0.589091",
"0.58865523",
"0.58865523",
"0.58865523",
"0.58865523",
"0.58865523",
"0.58865523",
"0.58865523",
"0.58865523",
"0.58865523",
"0.58865523",
"0.58865523",
"0.58865523",
"0.58865523",
"0.58863086",
"0.5880523",
"0.58776784",
"0.58606166",
"0.5856255",
"0.5843753",
"0.5842919",
"0.58381176",
"0.5837167",
"0.5828713",
"0.58229196",
"0.5803885",
"0.5802787",
"0.57902366",
"0.5788788",
"0.5788788",
"0.57802397",
"0.57802397",
"0.57802397",
"0.57787716",
"0.5778422",
"0.5770502",
"0.5770502",
"0.5770502",
"0.5770502",
"0.5770502",
"0.5770502",
"0.5770502",
"0.57681507",
"0.5757981",
"0.5756809",
"0.5756809",
"0.5750793",
"0.57361454",
"0.57360387",
"0.57360387",
"0.57360387",
"0.57360387"
] | 0.7320356 | 4 |
Extract the appropriate subhash for authentication from params. source://devise//lib/devise/strategies/authenticatable.rb93 | def params_auth_hash; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth_info\n params[auth_param] || {}\n end",
"def params_auth_hash\n if params[scope].kind_of?(Hash) && params[scope].has_key?(authentication_keys.first)\n params[scope]\n else\n params\n end\n end",
"def userauth_params\n params.fetch(:userauth, {})\n end",
"def with_authentication_hash(auth_type, auth_values); end",
"def raw_params(auth); end",
"def params_auth_hash\n params[scope]\n end",
"def params_auth_hash\n params[scope]\n end",
"def user_params(params_hash)\n {first_name: params_hash[\"first_name\"], last_name: params_hash[\"last_name\"], login: params_hash[\"login\"], email: params_hash[\"email\"], age: params_hash[\"age\"], gender: params_hash[\"gender\"], mobile_number: params_hash[\"mobile_number\"], home_number: params_hash[\"home_number\"], work_number: params_hash[\"work_number\"], address: params_hash[\"address\"], city: params_hash[\"city\"], state: params_hash[\"state\"], country: params_hash[\"country\"], pin_code: params_hash[\"pin_code\"], crypted_password: params_hash[\"crypted_password\"]}\n end",
"def authentication_params(type:)\n case type&.to_sym\n when :sign_up\n [:accept_terms, :email, :firstname, :language_id, :org_id, :password, :surname,\n { org_attributes: %i[abbreviation contact_email contact_name is_other\n managed name org_type target_url links] }]\n when :sign_in\n %i[email org_id password]\n else\n %i[email]\n end\n end",
"def authentication_hash=(_arg0); end",
"def auth_param; end",
"def auth_hash\n request.env['omniauth.auth'].symbolize_keys!\n end",
"def authentication_params\n {\n api_user: @api_user,\n api_key: @api_key\n }\n end",
"def auth_params\n params = ActionController::Parameters.new(env[\"omniauth.auth\"])\n Hashie::Mash.new params.permit(:uid, :provider, info: [:name, :email])\n end",
"def authentication_params\n params.require(:authentication).permit(:user_id, :provider, :uid)\n end",
"def raw_params(auth)\n auth.sub(TOKEN_REGEX, '').split(/\"\\s*#{AUTHN_PAIR_DELIMITERS}\\s*/)\n end",
"def authentication_params\n\t\t\tparams.require(:authentication).permit(:user_id, :provider, :uid, :access_token)\n\t\tend",
"def extract_authorization(authorization, parameters)\n id, pass = authorization.split('-')\n parameters[:AccessID] = id\n parameters[:AccessPass] = pass\n parameters\n end",
"def parse(authorization)\n auth_params = {}\n authorization.split.each do |param|\n parts = param.split('=', 2)\n auth_params[parts[0]] = parts[1]\n end\n auth_params\nend",
"def authentication_information\n password.nil? ?\n { :method => :anonymous } :\n { :method => :simple, :username => username, :password => password }\n end",
"def valid_for_params_auth?; end",
"def authentication_params\n if params[:provider]\n params.permit(:provider, :error, :error_description, :state)\n else\n params.require(:authentication).permit(:type, :user_email, :password)\n end\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 auth_hash\n # raise request.env['omniauth.auth'].to_yaml\n request.env[\"omniauth.auth\"]\n end",
"def http_auth_hash; end",
"def set_params_from_omniauth_hash_to_pass_it_to_transfer_to_guest_cmpsr\n @params_from_omniauth_for_transfer_to_guest_cmpsr = pick_fields_from_omniauth_hash_that_will_be_passed_to_transfer_guest_cmpsr_as_params\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth_hash\n request.env['omniauth.auth']\n end",
"def auth\n Hash['type' => @auth_type,\n 'username' => @user,\n 'password' => @password]\n end",
"def authentication_params\n params.require(:authentication).permit(:provider, :uid, :token, :token_secret, :user_id)\n end",
"def user_params\n {\n state: 'active',\n email: \"#{set_phone}@nu0.one\",\n password: params[:password],\n referral_id: (parse_refid! unless params[:refid].nil?)\n }.compact\n end",
"def to_h\n super.select {|k, v| k != 'hashed_password'}\n end",
"def authentication\n {:username => @username, :password => @password}\n end",
"def hash_decoder\n hash_params = current_resource.info['rep:password'].match(\n /^\\{(?<algo>.+)\\}(?<salt>\\w+)-(?<iter>(\\d+)-)?(?<hash>\\w+)$/\n )\n\n raise('Unsupported hash format!') unless hash_params\n\n hash_params\n end",
"def parse_auth_keys\n tuples = config.scan(AUTH_KEY_REGEXP)\n hsh = {}\n tuples.map do |(key, algorithm, mode, password)|\n hsh[key] = {\n algorithm: algorithm,\n mode: mode,\n password: password\n }\n hsh[key]\n end\n\n { auth_keys: hsh }\n end",
"def process_basic_auth(auth)\n case auth\n when String\n self.login, self.password = auth.split(':', 2)\n when Hash\n self.login = auth[:login]\n self.password = auth[:password]\n end\n end",
"def omniauth_params\n request.env['omniauth.auth'].to_hash\n end",
"def omniauth_params\n request.env['omniauth.auth'].to_hash\n end",
"def raw_params(auth)\n _raw_params = auth.sub(TOKEN_REGEX, '').split(/\\s*#{AUTHN_PAIR_DELIMITERS}\\s*/)\n\n if !(_raw_params.first =~ %r{\\A#{TOKEN_KEY}})\n _raw_params[0] = \"#{TOKEN_KEY}#{_raw_params.first}\"\n end\n\n _raw_params\n end",
"def user_params\n user = RailsFixes::Util.hash_keys_to_sym(JSON.parse(params.require(:user)))\n return {name:user[:name], username:user[:username], email:user[:email], locale:user[:locale], password:user[:password], role:user[:role]}\n end",
"def raw_params(auth)\n _raw_params = auth.sub(TOKEN_REGEX, '').split(/\\s*#{AUTHN_PAIR_DELIMITERS}\\s*/)\n\n if !(_raw_params.first =~ %r{\\A#{TOKEN_KEY}})\n _raw_params[0] = \"#{TOKEN_KEY}#{_raw_params.first}\"\n end\n\n _raw_params\n end",
"def auth_options\n params.require(:email)\n params.require(:password)\n end",
"def to_h\n super.select {|k, v| k != 'hashed_password'}\n end",
"def authentication(h)\n build_authentication(h) unless key_value(h[:k]) == \"official seal\"\n end",
"def authorization_params\n {\n :jsonrpc => \"2.0\",\n :id => request_id,\n :method => \"user.login\",\n :params => {\n :user => username,\n :password => password\n }\n }\n end",
"def allow_params_authentication!; end",
"def user_params(params={})\n {\n password: \"hello55\",\n email: \"[email protected]\",\n name: \"Jard\",\n phone_number: \"6195559090\",\n country_code: \"+1\"\n }.merge(params)\n end",
"def login_from_params\n authenticate(params[:password])\n end",
"def profile_hash(details, creds)\n params = {}\n params[:api_type] = details[:api_type]\n params[:license_key] = creds[:license_key]\n params[:login_id] = creds[:login_id]\n params[:version] = details[:version]\n params\n end",
"def authentication_params\n params.require(:authentication).permit(:user_id, :token, :password_digest)\n end",
"def oauth_hash_params(param)\n case param[:provider]\n when \"twitter\"\n {\n email: \"\",\n name: param[:info][:nickname]\n }\n when \"google_oauth2\"\n {\n email: param[:info][:email],\n name: param[:info][:name]\n }\n when \"facebook\"\n {\n email: param[:info][:email],\n name: param[:info][:name]\n }\n end\n end",
"def user_params\n allowedParamsKey = [:email, :password, :uid, :name, :nickname, :image]\n resultData = {}\n for key in allowedParamsKey\n resultData[key] = params.fetch(key, \"\")\n end\n \n return resultData\n end",
"def auth_hash\n OmniAuth::Utils.deep_merge(super(), {\n 'uid' => @uid,\n 'user_info' => {\n 'name' => @username\n }\n })\n end",
"def get_auth_data\n auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) }\n auth_data = request.env[auth_key].to_s.split unless auth_key.blank?\n return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil] \n end",
"def process_basic_auth(auth)\n case auth\n when String\n self.username, self.password = auth.split(':', 2)\n when Hash\n self.username = auth[:username]\n self.password = auth[:password]\n end\n end",
"def auth_hash\n @auth_hash ||= request.env['omniauth.auth']\n end",
"def secure_hash\r\n params['secureHash']\r\n end",
"def auth_hash\n @auth_hash ||= request.env['omniauth.auth']\n end",
"def authentication_params\n params.require(:authentication).permit(:user_id)\n end",
"def make_authentication_details(details)\n self.vendor_code = details['vendor_code']\n self.sync_applicable = details['sync_applicable']\n self.integration_id = details['integration_id']\n self.integration_vector = details['integration_vector']\n end",
"def get_auth_data\n auth_key = @@http_auth_headers.find { |h| request.env.key?(h) }\n auth_data = request.env[auth_key].to_s.split unless auth_key.blank?\n auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil]\n end",
"def get_auth_data\n auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) }\n auth_data = request.env[auth_key].to_s.split unless auth_key.blank?\n return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil] \n end",
"def get_auth_data \n auth_data = nil\n [\n 'REDIRECT_REDIRECT_X_HTTP_AUTHORIZATION',\n 'REDIRECT_X_HTTP_AUTHORIZATION',\n 'X-HTTP_AUTHORIZATION', \n 'HTTP_AUTHORIZATION'\n ].each do |key|\n if request.env.has_key?(key)\n auth_data = request.env[key].to_s.split\n break\n end\n end\n if auth_data && auth_data[0] == 'Basic' \n return Base64.decode64(auth_data[1]).split(':')[0..1] \n end \n end",
"def convert_auth_info(auth_info)\n {\n :provider => 'OpenStack',\n :openstack_api_key => auth_info.password,\n :openstack_username => auth_info.user_name,\n :openstack_auth_url => \"#{auth_info.auth_url}/tokens\",\n :openstack_tenant => auth_info.tenant_name\n }\n end",
"def http_auth_hash\n keys = [http_authentication_key, :password]\n Hash[*keys.zip(decode_credentials).flatten]\n end",
"def http_auth_hash\n keys = [http_authentication_key, :password]\n Hash[*keys.zip(decode_credentials).flatten]\n end",
"def authenticate(_)\n super(session_params)\n end",
"def user_info\n auth_hash['user_info']\n end",
"def get_auth_data\n user, pass = nil, nil\n # extract authorisation credentials \n if request.env.has_key? 'X-HTTP_AUTHORIZATION' \n # try to get it where mod_rewrite might have put it \n authdata = request.env['X-HTTP_AUTHORIZATION'].to_s.split \n elsif request.env.has_key? 'HTTP_AUTHORIZATION' \n # this is the regular location \n authdata = request.env['HTTP_AUTHORIZATION'].to_s.split \n end \n \n # at the moment we only support basic authentication \n if authdata && authdata[0] == 'Basic' \n user, pass = Base64.decode64(authdata[1]).split(':')[0..1] \n end \n return [user, pass] \n end",
"def pubsub_auth_msg_2_auth_info(msg)\n msg_split = msg.split(/(?<!\\\\),/)\n service_id = msg_split.first.sub('service_id:'.freeze, ''.freeze)\n creds = Credentials.from(\n msg_split[1..-2].join(',').sub('credentials:'.freeze, ''.freeze))\n metric = msg_split.last.sub('metric:'.freeze, ''.freeze)\n\n res = { service_id: service_id, credentials: creds, metric: metric }\n res.map do |k, v|\n # Credentials are already unescaped\n [k, v.is_a?(Credentials) ? v : v.gsub(\"\\\\,\", ','.freeze)\n .gsub(\"\\\\:\", ':'.freeze)]\n end.to_h\n end",
"def symbolize_password_keys!(authentications)\n auth_type = authentications.keys.first\n # symbolize userid, password\n authentications[auth_type].symbolize_keys!\n\n return authentications, auth_type\n end",
"def token_auth_hash\n request.env['devise.token_options'] = auth_token.last\n { authentication_keys.first => auth_token.first }\n end",
"def get_auth_data\n auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) }\n auth_data = request.env[auth_key].to_s.split unless auth_key.blank?\n return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil] \n end",
"def decode_credentials; end",
"def auth_params\n params.permit(:email, :password)\n end",
"def extract_parameters( queryhash, key=nil )\n\t\tprofile = @applet.signature.validator_profiles[ @action ] ||\n\t\t\[email protected]_profiles[ :__default__ ]\n\t\tvalidator = Arrow::FormValidator.new( profile )\n\t\t\n\t\tvalidator.validate( queryhash )\n\n\t\tif key\n\t\t\treturn validator.valid[ key ]\n\t\telse\n\t\t\treturn validator.valid\n\t\tend\n\tend",
"def authorize_params\n super.tap do |params|\n provider = session['omniauth.params'].delete('provider') rescue nil\n params[:provider] = provider if provider\n\n service = session['omniauth.params'].delete('service') rescue nil\n params[:service] = service if service\n\n context = session['omniauth.params'].delete('context') rescue nil\n params[:context] = context if context\n end\n end",
"def authorization_hash\n {Authorization: \"Basic #{Base64.strict_encode64(\"#{@login}:#{@password}\")}\"}\n end",
"def authorize_params\n super.tap do |params|\n %w[ state ].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n\n # to support omniauth-oauth2's auto csrf protection\n session['omniauth.state'] = params[:state] if v == 'state'\n end\n end\n end\n end",
"def authn_authenticate_local username, account, expiration, cidr, &block\n { account: account, sub: username }.tap do |params|\n params[:exp] = expiration if expiration\n params[:cidr] = cidr if cidr\n end.to_json\n end",
"def with_authentication_hash(auth_type, auth_values)\n self.authentication_hash, self.authentication_type = {}, auth_type\n self.password = auth_values[:password]\n\n parse_authentication_key_values(auth_values, authentication_keys) &&\n parse_authentication_key_values(request_values, request_keys)\n end",
"def auth_params\n if !current_user.is_admin?\n params[:person].delete(:is_pal) if params[:person]\n end\n end",
"def configure_sign_in_params\n devise_parameter_sanitizer.permit(:sign_in, keys: authentication_params(type: :sign_in))\n end",
"def get_auth_data\n auth_key = @@http_auth_headers.detect { |h| request.env.has_key?(h) }\n auth_data = request.env[auth_key].to_s.split unless auth_key.blank?\n return auth_data && auth_data[0] == 'Basic' ? Base64.decode64(auth_data[1]).split(':')[0..1] : [nil, nil]\n end",
"def authenticate()\n\tuser_env = @env[\"Authorization\"] || @env[\"HTTP_AUTHORIZATION\"]\n if user_env\n user = Base64.decode64(user_env[6,user_env.length-6])[/\\w+/]\n\t\treturn user\n else\n \treturn nil\n\tend\nend",
"def named_user login\n user_params = {\n 'admin' => {'id' => 1, 'login' => 'addie', 'password' => '1234addie', 'email' => '[email protected]', },\n 'oona' => { 'login' => 'oona', 'password' => '1234oona', 'email' => '[email protected]'},\n 'reggie' => { 'login' => 'reggie', 'password' => 'monkey', 'email' => '[email protected]' },\n }\n user_params[login.downcase]\nend",
"def with_authentication_hash(hash)\n self.authentication_hash = {:email => hash[:username]}\n self.password = hash[:password]\n end",
"def identity_hash\n request.env['omniauth.auth']\n end",
"def get_auth_params_from_login_response_headers(response)\n client = response.headers['client']\n token = response.headers['access-token']\n expiry = response.headers['expiry']\n token_type = response.headers['token-type']\n uid = response.headers['uid']\n\n auth_params = {\n 'access-token' => token,\n 'client' => client,\n 'uid' => uid,\n 'expiry' => expiry,\n 'token_type' => token_type\n }\n return auth_params\n end",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def auth_params_exist\n auth.key?(:user_id) && auth.key?(:api_key)\n end",
"def session_params\n params.fetch(:session, :email, :password)\n end",
"def auth_hash\n OmniAuth::Utils.deep_merge(super(), {\n 'uid' => @client_id,\n 'user_info' => {\n 'user_hash' => user_data,\n }\n })\n end",
"def authorize_params\n super.tap do |params|\n %w(scope team redirect_uri).each do |v|\n if !request.params[v].to_s.empty?\n params[v.to_sym] = request.params[v]\n end\n end\n log(:debug, \"Authorize_params #{params.to_h}\")\n end\n end",
"def user_param_keys(include_virtual_attributes = true)\n include_virtual_attributes ? [:first_name, :last_name, :email, :password, :role] : [:first_name, :last_name, :email, :role]\n end",
"def params_auth_hash\n params[scope].merge(ip_address: remote_ip)\n end"
] | [
"0.69534653",
"0.6643797",
"0.64488006",
"0.63779515",
"0.63649166",
"0.62913465",
"0.62913465",
"0.6256124",
"0.6223255",
"0.6201131",
"0.6151858",
"0.60834897",
"0.60197103",
"0.60024333",
"0.59675354",
"0.59362644",
"0.5932256",
"0.58914053",
"0.5891037",
"0.5861723",
"0.58575237",
"0.5847869",
"0.58303636",
"0.581828",
"0.5817645",
"0.58120894",
"0.5794896",
"0.5794896",
"0.5794896",
"0.5794896",
"0.5794896",
"0.5794896",
"0.5787216",
"0.57822114",
"0.57339215",
"0.57303673",
"0.5725463",
"0.5704248",
"0.5698985",
"0.56886387",
"0.5678639",
"0.5678639",
"0.5677618",
"0.5674568",
"0.5668877",
"0.5665182",
"0.5661131",
"0.565274",
"0.56316453",
"0.56276906",
"0.5581219",
"0.5580695",
"0.5572111",
"0.55710226",
"0.5559251",
"0.55487335",
"0.5545654",
"0.55271804",
"0.55237794",
"0.55233353",
"0.5523215",
"0.55222327",
"0.5518714",
"0.5516049",
"0.5509015",
"0.55078775",
"0.55020756",
"0.5494949",
"0.5492306",
"0.5492306",
"0.5488791",
"0.54752475",
"0.5472394",
"0.5471488",
"0.54402727",
"0.5437316",
"0.5416385",
"0.54114145",
"0.5395161",
"0.5389883",
"0.53860646",
"0.53703874",
"0.53638667",
"0.53573185",
"0.53493077",
"0.534809",
"0.53460455",
"0.53455454",
"0.5344847",
"0.5337956",
"0.5334766",
"0.53319895",
"0.5325236",
"0.53237414",
"0.53218067",
"0.5321249",
"0.53171897",
"0.53157645",
"0.5315321",
"0.5312942"
] | 0.7018044 | 0 |
Check if the model accepts this strategy as params authenticatable. | def params_authenticatable?; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_for_params_auth?\n params_authenticatable? && valid_params_request? &&\n valid_params? && with_authentication_hash(:params_auth, params_auth_hash)\n end",
"def params_authenticatable?\n mapping.to.params_authenticatable?(authenticatable_name)\n end",
"def params_authenticatable?\n User.params_authenticatable?(authenticatable_name)\n end",
"def valid_params_request?\n !!env[\"devise.allow_params_authentication\"]\n end",
"def valid_params?\n params_auth_hash.is_a?(Hash)\n end",
"def valid_for_params_auth?; end",
"def token_authenticatable?\n mapping.to.http_authenticatable?(:token_options)\n end",
"def valid_params_request?\n true\n end",
"def valid_params_request?\n true\n end",
"def user_authorized_for_capability?(user, params = {}, binding = self.binding)\n return true unless Array === self.capability_requirements\n self.capability_requirements.each{| capability_requirement|\n capabilities = capability_requirement[:capabilities]\n options = capability_requirement[:options]\n # do the options match the params?\n \n controller = (params[:controller] || self.class.name.sub(/Controller$/).underscore).to_sym\n action = (params[:action] || :index).to_sym\n\n # check the action\n if options.has_key?(:only)\n next unless options[:only].include?( action )\n end\n \n if options.has_key?(:except)\n next if options[:except].include?( action )\n end\n \n if options.has_key?(:if)\n # execute the proc. if the procedure returns false, we don't need to authenticate these capabilities\n next unless ( String===options[:if] ? eval(options[:if], binding) : options[:if].call(params) )\n end\n \n if options.has_key?(:unless)\n # execute the proc. if the procedure returns true, we don't need to authenticate these capabilities\n next if ( String===options[:unless] ? eval(options[:unless], binding) : options[:unless].call(params) )\n end\n \n # check to see if they have one of the required capabilities\n @capability_pattern = nil\n passed = false\n capabilities.each { |capability|\n capability = capability.gsub(/:controller\\b/, controller.to_s) if controller\n capability = capability.gsub(/:action\\b/, action.to_s) if action\n @capability_pattern = capability\n if user.has_capability?(capability)\n passed = true\n break\n end\n } unless (! user || user==:false)\n \n return false unless passed\n }\n \n return true\n end",
"def validate_params?\n true # TODO: add validation\n end",
"def http_authenticatable?\n mapping.to.http_authenticatable?(authenticatable_name)\n end",
"def http_authenticatable?\n mapping.to.http_authenticatable?(authenticatable_name)\n end",
"def authenticatable?\n self.class.included_modules.include?(Authenticatable)\n end",
"def allow_params_authentication!; end",
"def url_options_authenticate?(params = {})\n params = params.symbolize_keys\n if params[:controller]\n # find the controller class\n klass = eval(\"#{params[:controller]}_controller\".classify)\n else\n klass = self.class\n end\n klass.user_authorized_for?(current_visitor, params, binding)\n end",
"def user_authorized_for?(user, params = {}, binding = self.binding)\n return true unless Array===self.role_requirements\n self.role_requirements.each{| role_requirement|\n roles = role_requirement[:roles]\n options = role_requirement[:options]\n # do the options match the params?\n\n # check the action\n if options.has_key?(:only)\n next unless options[:only].include?( (params[:action]||\"index\").to_sym )\n end\n\n if options.has_key?(:except)\n next if options[:except].include?( (params[:action]||\"index\").to_sym)\n end\n\n if options.has_key?(:if)\n # execute the proc. if the procedure returns false, we don't need to authenticate these roles\n next unless ( String===options[:if] ? eval(options[:if], binding) : options[:if].call(params) )\n end\n\n if options.has_key?(:unless)\n # execute the proc. if the procedure returns true, we don't need to authenticate these roles\n next if ( String===options[:unless] ? eval(options[:unless], binding) : options[:unless].call(params) )\n end\n\n # check to see if they have one of the required roles\n passed = false\n roles.each { |role|\n passed = true if user.has_role?(role)\n } unless (! user || user==:false)\n\n return false unless passed\n }\n\n return true\n end",
"def url_options_authenticate?(params = {})\n params = params.symbolize_keys\n if params[:controller]\n # find the controller class\n klass = eval(\"#{params[:controller]}_controller\".classify)\n else\n klass = self.class\n end\n klass.user_authorized_for?(current_user, params, binding)\n end",
"def authenticate?\n @authentication_required\n end",
"def valid_for_token_auth?\n token_authenticatable? && auth_token.present? && with_authentication_hash(:token_auth, token_auth_hash)\n end",
"def authenticate\n klass.new(request).authenticate == true\n end",
"def valid?\n @params_definition.each { |pd| return false unless @params.has_key?(pd) }\n true\n end",
"def valid_params?\n params.is_a?(Hash)\n end",
"def params_valid?\n \n #if the user isn't signed in or there aren't any parameters, the params \n #aren't valid\n if !user_signed_in? || !params_present? \n return false\n end\n \n #Check whether a submission for the given language exists and whether it\n #belongs to the current user.\n submission = Submission.where(id: params[:submission_id], language_id: params[:language_id])\n \n submission.present? && current_user.id == submission.first.user_id\n end",
"def valid_params?(params)\n params_id_set = params[:enabled_component_ids].select(&:present?).to_set\n params_id_set.subset?(disableable_components_ids.to_set)\n end",
"def param_present?(obj)\n @config_params.value?(obj)\n end",
"def validate?(params)\n _validate?(params)\n end",
"def valid?(params)\n true\n end",
"def user_authorized_for?(user, params = {}, binding = self.binding)\n return true unless Array===@role_requirements\n @role_requirements.each{| role_requirement|\n roles = role_requirement[:roles]\n options = role_requirement[:options]\n # do the options match the params?\n\n # check the action\n if options.has_key?(:only)\n next unless options[:only].include?( (params[:action]||\"index\").to_sym )\n end\n\n if options.has_key?(:except)\n next if options[:except].include?( (params[:action]||\"index\").to_sym)\n end\n\n if options.has_key?(:if)\n # execute the proc. if the procedure returns false, we don't need to authenticate these roles\n next unless ( String===options[:if] ? eval(options[:if], binding) : options[:if].call(params) )\n end\n\n if options.has_key?(:unless)\n # execute the proc. if the procedure returns true, we don't need to authenticate these roles\n next if ( String===options[:unless] ? eval(options[:unless], binding) : options[:unless].call(params) )\n end\n\n # check to see if they have one of the required roles\n passed = false\n roles.each { |role|\n passed = true if user.has_role?(role)\n } unless (! user || user==:false)\n\n return false unless passed\n }\n\n return true\n end",
"def check_params\n true\n end",
"def authorized?(user, request, params)\n true\n end",
"def param_is_valid?\n robot_facings = @robot.class.const_get(:AVAIABLE_FACING).map(&:to_s)\n\n !(@args =~ /^\\d+,\\d+,(#{robot_facings.join('|').upcase})+$/).nil?\n end",
"def active_for_authentication?\n super && self.enabled? && self.is_allowed_in?\n end",
"def params?\n !(params.input_filters.required_inputs.empty? && params.input_filters.optional_inputs.empty?)\n end",
"def proof_of_authenticity\n valid_asset_definition? ? @asset_definition.proof_of_authenticity : false\n end",
"def allowed?\n raise NotImplementedError, 'please implement #allowed? '\\\n \"for #{self.class.name} which should decide if the action is allowed, \"\\\n 'based on the given attributes'\n end",
"def param_checker?(v)\n v.is_a?(Class) && v.new.is_a?(ParamChecker)\n end",
"def valid_params_request?; end",
"def valid_params?(params)\n params.keys.each do |key|\n unless RealPush::API::App.params_accept.include? key.to_sym\n raise ConfigurationError, \"Invalid parameter! ( #{RealPush::API::App.params_accept.join(', ')} )\"\n end\n end\n true\n end",
"def auth_params_exist\n auth.key?(:user_id) && auth.key?(:api_key)\n end",
"def allows?\n return positive? unless @attributes.empty?\n protected_attributes.nil? || protected_attributes.empty?\n end",
"def valid_for_http_auth?\n http_authenticatable? && request.authorization && with_authentication_hash(:http_auth, http_auth_hash)\n end",
"def valid_for_http_auth?\n http_authenticatable? && request.authorization && with_authentication_hash(:http_auth, http_auth_hash)\n end",
"def check_params\n # For each key,value in GLOBAL VAR **PARAMS**.\n PARAMS.each do |param, method|\n # Next if there isn't param in the request of client\n next unless params[param]\n # Check the *param* with *method*\n unless send(method, params[param])\n @error_object = \"Param #{param} is wrong, #{method} failed\"\n return false\n end\n end\n true\n end",
"def valid_for_authentication?; end",
"def valid_for_authentication?; end",
"def should_authenticate?(env)\n @config['should_authenticate_check'] ? @config['should_authenticate_check'].call(env) : true\n end",
"def active_for_authentication?\n super && self.approved?\n end",
"def resource_valid_for_authentication?\n @resource.respond_to?(:valid_for_authentication?) && @resource.valid_for_authentication? { valid_password? }\n end",
"def user_authorizes_token?\n params[:authorize] == '1'\n end",
"def user_authorizes_token?\n params[:authorize] == '1'\n end",
"def user_authorizes_token?\n params[:authorize] == '1'\n end",
"def can_safely_access_request_parameters?\n @request.request_parameters\n end",
"def valid?\n params['user'] && params['user']['username'] && params['user']['password']\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN']) || api_operator.present?\n end",
"def valid?(required_params)\n required_params.each do |p|\n return false unless @params_map.key?(p)\n end\n true\n end",
"def routing_params?\n routing_params.any?\n end",
"def authenticate?\n @api_options.has_key?(:authenticate?) ? @api_options[:authenticate?] : !Fleakr.token.blank?\n end",
"def active_for_authentication?\n self.active?\n end",
"def action_controller_parameters_in?(attributes)\n return false unless [Hash, ActionController::Parameters].include?(attributes.class)\n ActionController::Parameters === attributes || attributes.any?{|_k,v| ActionController::Parameters === v }\n end",
"def active_for_authentication?\n super && (!confirmation_required? || confirmed? || confirmation_period_valid?)\n end",
"def http_authenticatable?; end",
"def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"iam.EndPointPrivilege\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type.nil?\n object_type_validator = EnumAttributeValidator.new('String', [\"iam.EndPointPrivilege\"])\n return false unless object_type_validator.valid?(@object_type)\n type_validator = EnumAttributeValidator.new('String', [\"\", \"APIC\", \"DCNM\", \"UCSFI\", \"UCSFIISM\", \"IMC\", \"IMCM4\", \"IMCM5\", \"IMCRack\", \"UCSIOM\", \"HX\", \"HyperFlexAP\", \"IWE\", \"UCSD\", \"IntersightAppliance\", \"IntersightAssist\", \"PureStorageFlashArray\", \"UCSC890\", \"NetAppOntap\", \"NetAppActiveIqUnifiedManager\", \"EmcScaleIo\", \"EmcVmax\", \"EmcVplex\", \"EmcXtremIo\", \"VmwareVcenter\", \"MicrosoftHyperV\", \"AppDynamics\", \"Dynatrace\", \"NewRelic\", \"ServiceNow\", \"ReadHatOpenStack\", \"CloudFoundry\", \"MicrosoftAzureApplicationInsights\", \"OpenStack\", \"MicrosoftSqlServer\", \"Kubernetes\", \"AmazonWebService\", \"AmazonWebServiceBilling\", \"MicrosoftAzureServicePrincipal\", \"MicrosoftAzureEnterpriseAgreement\", \"DellCompellent\", \"HPE3Par\", \"RedHatEnterpriseVirtualization\", \"NutanixAcropolis\", \"HPEOneView\", \"ServiceEngine\", \"HitachiVirtualStoragePlatform\", \"IMCBlade\", \"TerraformCloud\", \"TerraformAgent\", \"CustomTarget\", \"AnsibleEndpoint\", \"HTTPEndpoint\", \"SSHEndpoint\", \"CiscoCatalyst\"])\n return false unless type_validator.valid?(@type)\n true\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def active_for_authentication?\n super && approved?\n end",
"def routing_params?\n routing_params.any?\n end",
"def valid?\n\t\tparams['user'] && params['user']['username'] && params['user']['password']\n\tend",
"def has_auth_criteria?\n\t\t\treturn self.has_positive_auth_criteria? || self.has_negative_auth_criteria?\n\t\tend",
"def resource_active_for_authentication?\n [email protected]_to?(:active_for_authentication?) || @resource.active_for_authentication?\n end",
"def authentication?\n @capabilities and @capabilities.include? 'auth'\n end",
"def valid?\n valid_user?(request.headers)\n end",
"def allowed_to_save\n method_list = self.class.authenticates_saves_method_list\n if method_list.nil?\n # No method list, so it's allowed\n true\n elsif method_list.check :accessor => accessor, :model => self\n # Method list passed, so allowed\n true\n else\n # Method list failed, so denied\n false\n end\n end",
"def parameters_match?(obj)\r\n # if parameters are not specified, let's assume that the rule is always relevant\r\n if @parameters.size == 0\r\n logger.debug \"no parameters defined for rule: #{self}\" if logger\r\n return true\r\n end\r\n \r\n @parameters.each do |params|\r\n match = false\r\n \r\n params.each do |p|\r\n logger.debug( \"#{self} match p:#{p} obj:#{obj}\") if logger\r\n \r\n if p.is_a?(Symbol) \r\n if obj.respond_to?(p)\r\n match = true\r\n else\r\n return false\r\n end\r\n elsif obj.is_a?(p)\r\n match = true\r\n end\r\n end\r\n return true if match\r\n end\r\n \r\n return false\r\n end",
"def valid_params?; end",
"def active_for_authentication?\n super\n end",
"def allowed?\n if params[:environment]\n Ability.allowed?(current_user, :read_environment, project)\n elsif params[:cluster]\n true # Authorization handled at controller level\n else\n false\n end\n end",
"def valid?\n unless @json.class == Hash\n return false\n end\n\n unless @json['method'].class == String\n return false\n end\n\n unless @json['params'].class == Array\n return false\n end\n\n return true\n end",
"def authenticating_with_oauth?\n correct_request_class? && using_oauth?\n end",
"def check_params; true; end",
"def active_for_authentication?\n super and self.enabled?\n end",
"def authenticates?\n !!@authenticates\n end",
"def active_for_authentication?\n # User is approved when harp_id is assigned.\n # Approved flag is set programmatically when harp_id is set by an admin.\n super && is_approved?\n end",
"def active_for_authentication? \n super && approved? \n end",
"def active_for_authentication?\n super && self.is_active?\n end",
"def active_for_authentication?\n super && isActive\n end",
"def param_column?\n self.class.param_column?\n end",
"def param_column?\n self.class.param_column?\n end",
"def authorized_for?(options = {})\n current_user && current_user.authorized_for?(options)\n end",
"def active_for_authentication?\n active? && super\n end",
"def active_for_authentication?\n super && active?\n end",
"def active_for_authentication?\n super && active?\n end",
"def active_for_authentication?\n super && active?\n end",
"def user_authorizes_token?\n return true if params[:authorize]\n\n end",
"def requires!\n @required_params.each do |param| \n key = (param.is_a?(Array) ? param.first : param)\n verify_required_param(key)\n end\n end"
] | [
"0.78356254",
"0.77617234",
"0.7754954",
"0.71521574",
"0.6824922",
"0.6763126",
"0.66278446",
"0.66224223",
"0.66224223",
"0.64362466",
"0.6386827",
"0.63631034",
"0.63631034",
"0.6335494",
"0.632491",
"0.6299852",
"0.6249548",
"0.62475795",
"0.624461",
"0.6227692",
"0.6186179",
"0.6177415",
"0.6142354",
"0.61409736",
"0.6127327",
"0.610559",
"0.6104323",
"0.6084181",
"0.60723346",
"0.607164",
"0.60632104",
"0.5981962",
"0.59654903",
"0.5940486",
"0.5935759",
"0.59168357",
"0.5886573",
"0.5883853",
"0.58564097",
"0.58512753",
"0.58200485",
"0.5811312",
"0.5811312",
"0.58044785",
"0.57872367",
"0.57872367",
"0.5786662",
"0.57814455",
"0.57775486",
"0.5774369",
"0.5774369",
"0.5774369",
"0.5762568",
"0.5758559",
"0.57579553",
"0.575497",
"0.5746964",
"0.5743851",
"0.57425123",
"0.5741099",
"0.5737392",
"0.57312584",
"0.57155704",
"0.5714397",
"0.57114357",
"0.57114357",
"0.57114357",
"0.57114357",
"0.57114357",
"0.57114357",
"0.57114357",
"0.5702943",
"0.5701469",
"0.57008785",
"0.56961715",
"0.5692555",
"0.56879556",
"0.5687587",
"0.56864405",
"0.56821346",
"0.5681981",
"0.5675486",
"0.56552833",
"0.5654921",
"0.5651853",
"0.5648663",
"0.56390893",
"0.56390035",
"0.563621",
"0.56333905",
"0.56254256",
"0.5617124",
"0.5617124",
"0.5613716",
"0.56051207",
"0.56006825",
"0.56006825",
"0.56006825",
"0.5599719",
"0.55975723"
] | 0.72778606 | 3 |
Get values from params and set in the resource. source://devise//lib/devise/strategies/authenticatable.rb51 | def remember_me(resource); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_params\n user_params = params[:user] || {}\n user_params.merge!(uv_login: params[:uv_login]) if params[:uv_login].present?\n user_params\n end",
"def user_params\r\n end",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def user_params\n end",
"def params\n { username: 'admin', password: 'admin' }\n end",
"def resource_params\n strong_params = params.require(resource_name.to_sym).permit(*permit_attributes)\n strong_params.merge(user_id: current_user.id) if user_signed_in?\n end",
"def allow_params_authentication!; end",
"def resource_params\n params.permit(devise_parameter_sanitizer.for(:sign_in))\n end",
"def set_params\n params[:user] = params[:account]\n end",
"def authorize_params\n super.tap do |params|\n %w(scope team redirect_uri).each do |v|\n if !request.params[v].to_s.empty?\n params[v.to_sym] = request.params[v]\n end\n end\n log(:debug, \"Authorize_params #{params.to_h}\")\n end\n end",
"def initialize_vars\n \n @auth_user_class = Auth.configuration.user_class.constantize\n\n @auth_user_params = permitted_params.fetch(:user,{}) \n\n @auth_user = params[:id] ? @auth_user_class.find_self(params[:id],current_signed_in_resource) : @auth_user_class.new(@auth_user_params)\n \n end",
"def user_params\nend",
"def authorize_params\n super.tap do |params|\n %w[ state ].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n\n # to support omniauth-oauth2's auto csrf protection\n session['omniauth.state'] = params[:state] if v == 'state'\n end\n end\n end\n end",
"def params_authenticatable?; end",
"def raw_params(auth); end",
"def usuario_params\n \n end",
"def authorize_params\n super.tap do |params|\n provider = session['omniauth.params'].delete('provider') rescue nil\n params[:provider] = provider if provider\n\n service = session['omniauth.params'].delete('service') rescue nil\n params[:service] = service if service\n\n context = session['omniauth.params'].delete('context') rescue nil\n params[:context] = context if context\n end\n end",
"def params_auth_hash; end",
"def collect_parameters\n @device_id = params[:device_id]\n @email = params[:email]\n @latitude = params[:latitude]\n @longitude = params[:longitude] \n @status = params[:status]\n @user_name = params[:user_name]\n @auth_token = params[:auth_token]\n @user\n end",
"def user_params\n\t\t\t\t\tparams.require(RicAuth.user_model.model_name.param_key).permit(\n\t\t\t\t\t\t:current_password, \n\t\t\t\t\t\t:password, \n\t\t\t\t\t\t:password_confirmation\n\t\t\t\t\t)\n\t\t\t\tend",
"def resource_params\n @resource_params ||= current_model_service.permit params\n end",
"def set_params_from_omniauth_hash_to_pass_it_to_transfer_to_guest_cmpsr\n @params_from_omniauth_for_transfer_to_guest_cmpsr = pick_fields_from_omniauth_hash_that_will_be_passed_to_transfer_guest_cmpsr_as_params\n end",
"def valid_for_params_auth?; end",
"def auth_param; end",
"def set_attributes(email,password,first_name,last_name)#called by sign_in api in apis controller\n self.email = email\n self.password = password\n self.first_name = first_name\n self.last_name = last_name\n self.save\n end",
"def user_params(params={})\n {\n password: \"hello55\",\n email: \"[email protected]\",\n name: \"Jard\",\n phone_number: \"6195559090\",\n country_code: \"+1\"\n }.merge(params)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def set_user_info\n @user_info = UserInfo.find(params[:id])\n authorize @user_info\n end",
"def authentication_params\n\t\t\tparams.require(:authentication).permit(:user_id, :provider, :uid, :access_token)\n\t\tend",
"def resource_params\n deserialized_params.permit!\n end",
"def user_params\n respond_to do |format|\n format.jsonapi { ActiveModelSerializers::Deserialization.jsonapi_parse(params, only: [:email, :password, :role, :first_name, :last_name, :municipality, :request_verified_status]) }\n end\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 auth_params\n params = ActionController::Parameters.new(env[\"omniauth.auth\"])\n Hashie::Mash.new params.permit(:uid, :provider, info: [:name, :email])\n end",
"def params_for_user\n {}\n end",
"def params_for_user\n {}\n end",
"def basic_params\n { username: @id, password: @secret }\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 auth_info\n params[auth_param] || {}\n end",
"def supplier_params\n base = [:email, :tin, :street_and_number, :postal_code, :city, :state, :country,\n :entreprise_name, :telephone_number1, :telephone_number2,\n :unit_type, :currency]\n current_password = params[:supplier][:current_password]\n if current_broker\n if params[:password].blank?\n base.push(:identifier, :approved)\n else\n base.push(:identifier, :approved, :password, :password_confirmation)\n end\n elsif !current_password.blank? && @supplier.valid_password?(current_password)\n base.push(:password, :password_confirmation)\n end\n params.require(:supplier).permit(base)\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 authorize_params\n super.tap do |params|\n options[:authorize_options].each do |k|\n params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])\n end\n end\n end",
"def user_params\n {\n state: 'active',\n email: \"#{set_phone}@nu0.one\",\n password: params[:password],\n referral_id: (parse_refid! unless params[:refid].nil?)\n }.compact\n end",
"def context_params(data=nil)\n set_get __method__, data\n end",
"def authorize_params\n\n # Trick shamelessly borrowed from the omniauth-facebook gem!\n super.tap do |params|\n %w[scope].each { |v| params[v.to_sym] = request.params[v] if request.params[v] }\n params[:scope] ||= DEFAULT_SCOPE # ensure that we're always request *some* default scope\n end\n end",
"def user_params\n params.require(:user).permit(:username, :email, :age, :political_affiliation, :password)\n # this is saying go into params look for a key of what is in the require() method and look inside that object for the keys included in permit()\n end",
"def authorize_params\n super.tap do |params|\n %w[auth_type display revoke scope state].each do |v|\n next unless request.params[v]\n params[v.to_sym] = request.params[v]\n\n session[\"omniauth.state\"] = params[:state] if v == \"state\"\n # to support omniauth-oauth2’s auto csrf protection\n end\n\n params[:scope] ||= DEFAULT_SCOPE\n end\n end",
"def authentication_params\n params.require(:authentication).permit(:user_id, :provider, :uid)\n end",
"def auth_params\n params.require(:auth).permit Knock.handle_attr, :password\n end",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n\n params[:scope] ||= DEFAULT_SCOPE\n params[:approval_prompt] ||= 'force'\n end\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def with_authentication_hash(auth_type, auth_values); end",
"def user_params\n params.require(:user).\n permit(:name, :password, :password_confirmation, :email, :role, :active, service_ids: [])\n end",
"def process_params!(params)\n #params.dup.update(user: current_user)\n params.merge!(current_user: current_user)\n end",
"def authentication_params\n params.require(:authentication).permit(:provider, :uid, :token, :token_secret, :user_id)\n end",
"def params() request.params end",
"def user_params\n allowed_params = ActiveModelSerializers::Deserialization.jsonapi_parse(params, only: [:email, :password, :role])\n if(allowed_params[:role])\n allowed_params[:role] = [allowed_params[:role].to_i, current_user.role].min\n end\n\n allowed_params\n end",
"def resource_params\n registry_patient_params\n end",
"def resource_params\n params.require($resource.downcase.to_sym).permit(input_fields($new_resource).map{|pi| pi.to_sym})\n # MAY WORK WITHOUT \".to_sym\" METHOD\n end",
"def respond_with(resource, *ignored)\n # We lose this info from devise. DON'T SAVE!\n resource.password = params[:password]\n\n if resource.valid?\n render json: resource, serializer: UserSerializer\n else\n render json: { errors: resource.errors.full_messages }\n end\n end",
"def get_resource_params\n \traise NotImplementedError\n end",
"def user_params\n ActiveModelSerializers::Deserialization.jsonapi_parse(params)\n end",
"def auth_params\n params.permit(:email, :password)\n end",
"def initialize(params)\n @first_name = params[:user][:first_name]\n @last_name = params[:user][:last_name]\n @company_name = params[:user][:company][:company_name]\n @email = params[:user][:email]\n @password = params[:user][:password]\n end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def rewrite_param_names\n request.params[:user] = {email: request.params[:email], password: request.params[:password]}\n end",
"def resource_params\n raise NotImplementedError\n end",
"def parametrizr_user\n current_user\n end",
"def assign_resource(value = nil)\n value ||= authorize(resource_class.find(params[:id]))\n instance_variable_set(\"@#{resource_name}\", value)\n end",
"def authentication_params\n if params[:provider]\n params.permit(:provider, :error, :error_description, :state)\n else\n params.require(:authentication).permit(:type, :user_email, :password)\n end\n end",
"def get_params\n @set_params\n end",
"def set_attrs_from_params\n sanitize_params\n @transaction.updated_by_user = current_user\n @transaction.user = User.yr(@year).where(email: params[:user_email]).first\n end",
"def permitted_params\n \t@permitted_params ||= PermittedParams.new(params, current_user)\n end",
"def register_user_params\n filtered_params = {}\n if params[:account] && params[:account][:current_user]\n filtered_params.merge!(params.require(:account)\n .require(:current_user).permit(User.attribute_list))\n end\n filtered_params\n end",
"def userauth_params\n params.fetch(:userauth, {})\n end",
"def initialize(params, current_user = nil)\n @params = ActionController::Parameters.new(params)\n @provider = @params[:provider]\n @user = current_user\n @authorization = nil\n end",
"def register(params)\n @field = params[\"field\"]\nend",
"def user_params\n params[:user]\n end",
"def authentication_params(type:)\n case type&.to_sym\n when :sign_up\n [:accept_terms, :email, :firstname, :language_id, :org_id, :password, :surname,\n { org_attributes: %i[abbreviation contact_email contact_name is_other\n managed name org_type target_url links] }]\n when :sign_in\n %i[email org_id password]\n else\n %i[email]\n end\n end",
"def resource_attributes\n request.format.html? ? params[user_resource_class.to_s.downcase] : params\n end",
"def user_params\n {username: params[:username], email: params[:email], password: params[:password], admin: false }\n end",
"def authorize\n params[:access_token] ||= params[:oauth_token]\n super\n end",
"def user_params\n params[:user]\n end",
"def user_params\n params[:user]\n end",
"def authentication_params\n params.require(:authentication).permit(:user_id)\n end",
"def update_sanitized_params\n\t\t\tif \"#{resource_name}\" == \"lecturer\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department,\n\t\t\t\t\t\t:profile_image, :profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"student\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|student| student.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|student| student.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"teaching_assistant\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:email, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:current_password, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\tend\n\t\tend",
"def pundit_params_for(record); end",
"def user_params\n new_hash = {}\n params[:data][:attributes].each do |key, value|\n new_hash[key.to_s.gsub(\"-\",\"_\")] = value\n end\n if !params[:data][:relationships].nil?\n params[:data][:relationships].each do |key, value|\n if value[:data].kind_of?(Array)\n new_hash[(key.to_s.gsub(\"-\",\"_\").singularize) + \"_id\"] = value[:data].map {|i| i[:id]}\n else\n new_hash[(key.to_s.gsub(\"-\",\"_\").singularize) + \"_id\"] = value[:data][:id]\n end\n end\n end\n new_params = ActionController::Parameters.new(new_hash)\n new_params.permit(\n :name,\n :email,\n :user_type,\n :user_id,\n :books_id,\n :password\n )\n end",
"def user_params\r\n params[:user]\r\n end",
"def user_params\n params.permit(\"name\", \"email_id\", \"password\", \"password_confirmation\",\"id\",\"remember\")\n end",
"def set_user\n @user = User.find_by(user_name: auth_params[:user_name])\nend",
"def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n attrs = session[\"devise.user_attributes\"]\n self.resource.first_name = attrs[\"first_name\"]\n self.resource.last_name = attrs[\"last_name\"]\n self.resource.picture = attrs[\"picture\"]\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def auth_params\n params.permit(:email, :password)\n end",
"def resource_params\n @resource_params ||= self.send(\"#{resource_name}_params\")\n end",
"def initialize(params, current_user = nil)\n @params = params.to_h.with_indifferent_access\n @provider = @params[:provider]\n @user = current_user\n @authorization = nil\n 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 configure_sign_in_params\n # devise_parameter_sanitizer.for(:sign_in) << :attribute\n devise_parameter_sanitizer.permit(:sign_in, keys: [:user, :password])\n end",
"def auth(value); end",
"def user_params\n # params is a hashtable. It should have in it a key of :user.\n # The value for the :user key is another hash.\n # If params does not contain the key :user, an exception is raised. \n # Only the \"user\" hash is returned and only with the permitted key(s).\n # So we get back { :name => someName, :email => someEmail}\n params.require(:user).permit(:name, :email)\n end",
"def backend_user_params\n params.permit!\n end",
"def set_parameters_in_session\n [:start_date, :end_date, :persons].each do |parameter|\n session[parameter] = params[parameter]\n end\n end"
] | [
"0.6429193",
"0.6329016",
"0.6291739",
"0.62904036",
"0.6256918",
"0.61908996",
"0.61770904",
"0.61507064",
"0.6110684",
"0.61086357",
"0.610245",
"0.6100688",
"0.6069364",
"0.60428405",
"0.6020636",
"0.60164106",
"0.6005251",
"0.59937537",
"0.59812367",
"0.59417033",
"0.59410566",
"0.59292805",
"0.59236455",
"0.5921171",
"0.59004104",
"0.5886394",
"0.58458567",
"0.584563",
"0.5845313",
"0.5837353",
"0.5824422",
"0.5813186",
"0.5802205",
"0.5800857",
"0.5800857",
"0.5780514",
"0.5779895",
"0.56989324",
"0.5697316",
"0.56928456",
"0.56849813",
"0.5684132",
"0.5683503",
"0.567897",
"0.56752086",
"0.5672324",
"0.56557494",
"0.56551516",
"0.5637454",
"0.562631",
"0.5620064",
"0.56119764",
"0.5609399",
"0.5608877",
"0.5602802",
"0.56017923",
"0.5593761",
"0.55875826",
"0.55763304",
"0.5568454",
"0.5568354",
"0.55664855",
"0.5565486",
"0.5561417",
"0.5559088",
"0.5554275",
"0.5549532",
"0.55489177",
"0.554609",
"0.5533777",
"0.55309856",
"0.5525477",
"0.5522971",
"0.5520778",
"0.5519535",
"0.5518464",
"0.55111575",
"0.5508438",
"0.54985553",
"0.5496441",
"0.54940313",
"0.54881513",
"0.54881513",
"0.5471117",
"0.5467738",
"0.54637736",
"0.54623544",
"0.5462071",
"0.54611415",
"0.5460593",
"0.54557115",
"0.54534733",
"0.54507273",
"0.54424167",
"0.5437298",
"0.5433537",
"0.54266727",
"0.54264194",
"0.54228455",
"0.5419761",
"0.5419537"
] | 0.0 | -1 |
Should this resource be marked to be remembered? | def remember_me?; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_yet?\n !!@resource_lock.synchronize { defined? @resource }\n end",
"def sharded?; false; end",
"def remember_me(resource); end",
"def remember_me(resource); end",
"def sharded?; true; end",
"def remember_me(resource)\n resource.remember_me = remember_me? if resource.respond_to?(:remember_me=)\n end",
"def resource_saved?\n resource.save unless resource.validation_attempted?\n resource.saved?\n end",
"def able_to_save?\n unlocked? or state_was == 'pending'\n end",
"def cached?; end",
"def access_locked?; end",
"def remember\n @remember\n end",
"def remember_me(resource)\n resource.remember_me = remember_me? if resource.respond_to?(:remember_me=)\n end",
"def remember_me(resource)\n resource.remember_me = remember_me? if resource.respond_to?(:remember_me=)\n end",
"def store?\n false\n end",
"def transient?; end",
"def transient?\n !always_on?\n end",
"def load_new_resource_state\n r.exist = @current_resource.exist if r.exist.nil?\n end",
"def resident_key?; end",
"def cached?\n !(!@cached)\n end",
"def using_cache\n\t\t(@modcache_invalidated != true)\n\tend",
"def dirty?\n false\n end",
"def remember_me() return true; end",
"def fresh?\n @fresh\n end",
"def can_expire?\n false\n end",
"def cache?\n persisted?\n end",
"def transient?\n not RubyContext.persistence_mode\n end",
"def previously_existed?\n true\n end",
"def store?\n false\n end",
"def store?\n false\n end",
"def active\n !discarded?\n end",
"def mark_as_restored\n @restored = true\n end",
"def set_expired\n self.expired = false\n true\n end",
"def dirty?\n !!culprit\n end",
"def persistent?\n false\n end",
"def fresh?\n !stale?\n end",
"def should_cache?\n false\n end",
"def active?\n self.expires_at > Time.now\n end",
"def autosaved?\n Threaded.autosaved?(self)\n end",
"def after_remembered; end",
"def cache?\n false\n end",
"def good?\n unlocked? && (self.expires_on ? DateTime.current < self.expires_on : true)\n end",
"def cached_write?\n [email protected]?\n end",
"def needs_new_cookie!\n @_new_cookie = true\n end",
"def needs_new_cookie!\n @_new_cookie = true\n end",
"def needs_new_cookie!\n @_new_cookie = true\n end",
"def persistent?\n !!expires_at\n end",
"def fresh?\n not stale?\n end",
"def cached?(key)\n false\n end",
"def transient?\n !persistent?\n end",
"def restore?\n @restore || false\n end",
"def mark_as_read\n return @mark_as_read\n end",
"def active?\n !expired? && !revoked?\n end",
"def active?; end",
"def sharded?\n @sharded\n end",
"def dirty?\n @dirty == true\n end",
"def bookable; false end",
"def dirty; end",
"def load_new_resource_state\n if new_resource.exist.nil?\n new_resource.exist = @current_resource.exist\n end\n end",
"def cache_on?; end",
"def cache_on?; end",
"def needs_new_cookie?\n @_new_cookie\n end",
"def already_stored?\n !file_uniqueness\n end",
"def update_resource_cache!(force = false)\n if person_resource? && (resource_cache_expired? || force)\n return true if self.update_attributes(\n :display_name => person_resource.attributes[\"DisplayName\"],\n :firstname => person_resource.attributes[\"RegisteredFirstMiddleName\"],\n :lastname => person_resource.attributes[\"RegisteredSurname\"],\n :uw_net_id => person_resource.attributes[\"UWNetID\"],\n :email => person_resource.attributes[\"UWNetID\"] + \"@uw.edu\",\n :birthdate => (Date.parse(student_person_resource.attributes[\"BirthDate\"]) rescue nil),\n :sex => student_person_resource.attribute(:gender),\n :uw_student_no => student_person_resource.attribute(:student_number).to_s.rjust(7, \"0\"),\n :resource_cache_updated_at => Time.now\n )\n end\n false\n end",
"def persistent?\n !transient?\n end",
"def move_to_cache\n false\n end",
"def remember_attachments? #:doc:\n @remember_attachments ? true : false\n end",
"def remember_properties\n property(:remember_properties, :object)\n end",
"def stored?\n !@_id.nil?\n end",
"def stale?\n !fresh?\n end",
"def stale?\n !fresh?\n end",
"def stale?\n !fresh?\n end",
"def resource?\n !reference?\n end",
"def is_set?(resource)\n value_is_set?(resource)\n end",
"def store?\n true\n end",
"def active?; @active; end",
"def active?; @active; end",
"def if_access_locked; end",
"def persistent?\n true\n end",
"def autosaved?\n Threaded.autosaved?(self)\n end",
"def persisted?\n !new?\n end",
"def pending?\r\n @activated\r\n end",
"def needs_rekey?; end",
"def bypass_valid\r\n self.persisted? #and self.bypass\r\n end",
"def pending?\n @activated\n end",
"def cache?\n caching && true\n end",
"def distracted?\n false\n end",
"def fresh?\n ttl && ttl > 0\n end",
"def recently_activated?\n return false\n @activated\n end",
"def remember_me?\n self.remember_me ==\"1\"\n end",
"def lock_expired?; end",
"def used?; end",
"def can_set_write_concern?\n !sharded? || !scram_sha_256_enabled?\nend",
"def mark_used\n self.update_attributes is_used: true, used_at: DateTime.now\n end",
"def aquired?\n acquired?\n end",
"def edible?\n#true \n !expired\n \nend",
"def protected?\n !removable?\n end",
"def resource?\n true\n end",
"def previously_persisted?\n !new_record? && destroyed?\n end",
"def dirty?\n session.dirty?\n end",
"def locked?\n self.released?\n end",
"def store?\n true\n end"
] | [
"0.69278425",
"0.6366755",
"0.6306729",
"0.6306729",
"0.6277261",
"0.6248432",
"0.62062776",
"0.6161842",
"0.6149734",
"0.6043669",
"0.59742296",
"0.59714526",
"0.59713286",
"0.5950257",
"0.59452564",
"0.5932927",
"0.5920795",
"0.590915",
"0.5903682",
"0.58998346",
"0.5892761",
"0.58835125",
"0.5881459",
"0.5867704",
"0.586733",
"0.5866708",
"0.5857295",
"0.5848732",
"0.5848732",
"0.5848497",
"0.58454883",
"0.5841888",
"0.58373666",
"0.58145565",
"0.5800074",
"0.57905394",
"0.57877195",
"0.57871336",
"0.5786875",
"0.57723016",
"0.5767584",
"0.57660455",
"0.57634985",
"0.57634985",
"0.57634985",
"0.57603174",
"0.5756883",
"0.574207",
"0.5742006",
"0.5732266",
"0.5726031",
"0.57258195",
"0.57160383",
"0.57103354",
"0.57022643",
"0.569852",
"0.569614",
"0.5695256",
"0.569335",
"0.569335",
"0.56826085",
"0.5677765",
"0.5676482",
"0.5672782",
"0.5671083",
"0.5670736",
"0.56702137",
"0.56614995",
"0.5660413",
"0.5660413",
"0.5660413",
"0.5652971",
"0.5650489",
"0.5638842",
"0.56296724",
"0.56296724",
"0.5629229",
"0.5624666",
"0.5622887",
"0.5622316",
"0.5613911",
"0.56116086",
"0.56092453",
"0.56074625",
"0.5605666",
"0.5604381",
"0.56038815",
"0.56024396",
"0.5598062",
"0.5591898",
"0.55887157",
"0.55845916",
"0.5579739",
"0.55791414",
"0.5569813",
"0.55691963",
"0.55662763",
"0.5566202",
"0.55644673",
"0.556395",
"0.5559832"
] | 0.0 | -1 |
Check if this is a valid strategy for http authentication by: Validating if the model allows http authentication; If any of the authorization headers were sent; If all authentication keys are present; | def valid_for_http_auth?; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_for_http_auth?\n http_authenticatable? && request.authorization && with_authentication_hash(:http_auth, http_auth_hash)\n end",
"def valid_for_http_auth?\n http_authenticatable? && request.authorization && with_authentication_hash(:http_auth, http_auth_hash)\n end",
"def valid_http_auth?\n controller.authenticate_with_http_basic do |login, password|\n if !login.blank? && !password.blank?\n send(\"#{login_field}=\", login)\n send(\"#{password_field}=\", password)\n return valid?\n end\n end\n \n false\n end",
"def http_auth?\n if request.xhr?\n Oath.config.http_authenticatable_on_xhr\n else\n !Oath::Lockdown.navigational_format?(request)\n end\n end",
"def require_http_auth\n if `hostname` =~ /soykaf|lanpartei/i \n if auth = APP_CONFIG['http_auth']\n authenticate_or_request_with_http_basic do |user_name, password|\n user_name == auth['name'] && password == auth['password']\n end \n end\n end\n end",
"def http_auth_header?\n Oath.config.http_authenticatable && !request.xhr?\n end",
"def http_auth?\n if request.xhr?\n Devise.http_authenticatable_on_xhr\n else\n !(request_format && is_navigational_format?)\n end\n end",
"def http_auth_header?\n scope_class.http_authenticatable && !request.xhr?\n end",
"def http_authenticatable?; end",
"def check_auth(request, response)\n # Get the value of the authorization header, and reject the request if it isn't present:\n authorization = request['Authorization']\n if authorization.nil?\n response.status = 401\n response.body = \"The 'Authorization' header is required\"\n return false\n end\n\n # Extract the authorization scheme and token from the authorization header:\n match = /^(?<scheme>Basic|Bearer)\\s+(?<token>.*)$/i.match(authorization)\n unless match\n response.status = 401\n response.body = \"The 'Authorization' doesn't match the expected regular expression\"\n return false\n end\n scheme = match[:scheme]\n token = match[:token]\n\n # Check the token:\n case scheme.downcase\n when 'basic'\n return false unless check_basic_token(response, token)\n when 'bearer'\n return false unless check_bearer_token(response, token)\n else\n response.status = 401\n response.body = \"The authentication scheme '#{scheme} isn't supported\"\n return false\n end\n\n # If we are here then authentication was successful:\n true\n end",
"def authenticate_if_needed\n # Disable this extra authentication in test mode\n return true if Rails.env.test?\n if (is_hidden || is_staging) && !is_api_or_pdf\n authenticate_or_request_with_http_basic do |username, password|\n username == \"samvera\" && password == \"hyku\"\n end\n end\n end",
"def http_auth?; end",
"def auth_present?\n !!request.headers['HTTP_AUTHORIZATION'].present?\n end",
"def authorized?\n @auth ||= Rack::Auth::Basic::Request.new(request.env)\n @auth.provided? &&\n @auth.basic? &&\n @auth.credentials &&\n check(@auth.credentials)\n end",
"def http_authenticate\n if Rails.env.staging?\n authenticate_or_request_with_http_basic do |username, password|\n (username == Brevidy::Application::HTTP_AUTH_USERNAME && password == Brevidy::Application::HTTP_AUTH_PASSWORD) ||\n (username == Brevidy::Application::HTTP_AUTH_ZEN_USERNAME && password == Brevidy::Application::HTTP_AUTH_ZEN_PASSWORD)\n end\n end\n end",
"def check_authorization\n return head :unauthorized if request.env['HTTP_CAPKEY'].nil?\n\n head :forbidden unless request.env['HTTP_CAPKEY'] == Settings.API_KEY\n end",
"def authenticate\n # logger.debug(\"APP: authorization: #{temp_debug(request)}\")\n set_last_uri\n return true unless application_user.nil?\n # logger.info(\"Header NOT-SET = #{request.headers['NOT-SET'].inspect}\")\n if request.env.has_key? \"REMOTE_USER\"\n logger.info(\"REMOTE_USER = #{request.env[\"REMOTE_USER\"]}\")\n apache_authenticate\n elsif request.headers.has_key?('HTTP_X_FORWARDED_USER')\n logger.info(\"Header HTTP_X_FORWARDED_USER = #{request.headers['HTTP_X_FORWARDED_USER']}\")\n proxy_apache_authenticate\n elsif Rails.env == \"test\"\n logger.info(\"Authenticate via test\")\n testing_authenticate\n elsif NONE_AUTHENTICATE\n logger.info(\"Authenticate via none\")\n none_authenticate\n else\n ldap_authenticate\n end\n end",
"def valid_for_authentication?; end",
"def valid_for_authentication?; end",
"def http_auth_header?; end",
"def authorized?\n auth_config = settings.config['authentication']\n @auth ||= Rack::Auth::Basic::Request.new(request.env)\n @auth.provided? and @auth.basic? and @auth.credentials and @auth.credentials == [auth_config['username'], auth_config['password']]\n end",
"def request_should_auth?( request )\n\t\tself.log.debug \"Checking to see if Auth(entication/orization) should be applied for app_path: %p\" %\n\t\t\t[ request.app_path ]\n\n\t\t# If there are positive criteria, return true if the request matches any of them,\n\t\t# or false if they don't\n\t\tif self.class.has_positive_auth_criteria?\n\t\t\tcriteria = self.class.positive_auth_criteria\n\t\t\tself.log.debug \" checking %d positive auth criteria\" % [ criteria.length ]\n\t\t\treturn criteria.any? do |pattern, block|\n\t\t\t\tself.request_matches_criteria( request, pattern, &block )\n\t\t\tend\n\t\t\treturn false\n\n\t\t# If there are negative criteria, return false if the request matches any of them,\n\t\t# or true if they don't\n\t\telsif self.class.has_negative_auth_criteria?\n\t\t\tcriteria = self.class.negative_auth_criteria\n\t\t\tself.log.debug \" checking %d negative auth criteria\" % [ criteria.length ]\n\t\t\treturn false if criteria.any? do |pattern, block|\n\t\t\t\trval = self.request_matches_criteria( request, pattern, &block )\n\t\t\t\tself.log.debug \" matched: %p -> %p\" % [ pattern, block ] if rval\n\t\t\t\trval\n\t\t\tend\n\t\t\treturn true\n\n\t\telse\n\t\t\tself.log.debug \" no auth criteria; default to requiring auth\"\n\t\t\treturn true\n\t\tend\n\tend",
"def authorized?\n @auth ||= Rack::Auth::Basic::Request.new(request.env)\n user = ENV[\"HTTP_USER\"]\n pass = ENV[\"HTTP_PASS\"]\n @auth.provided? && @auth.basic? && @auth.credentials && @auth.credentials == [user, pass]\n end",
"def check_authn\n response = self.class.head @endpoint\n\n return true if response.success?\n\n if response.code == 401 && response.headers[\"www-authenticate\"]\n if response.headers[\"www-authenticate\"].start_with? \"Keystone\"\n keystone_uri = /^Keystone uri='(.+)'$/.match(response.headers[\"www-authenticate\"])[1]\n\n if keystone_uri\n if @auth_options[:type] == \"x509\"\n body = { \"auth\" => { \"voms\" => true } }\n else\n body = {\n \"auth\" => {\n \"passwordCredentials\" => {\n \"username\" => @auth_options[:username],\n \"password\" => @auth_options[:password]\n }\n }\n }\n end\n\n headers = self.class.headers.clone\n headers['Content-Type'] = \"application/json\"\n headers['Accept'] = headers['Content-Type']\n\n response = self.class.post(keystone_uri + \"/v2.0/tokens\", :body => body.to_json, :headers => headers)\n\n if response.success?\n self.class.headers['X-Auth-Token'] = response['access']['token']['id']\n return true\n end\n end\n end\n end\n\n false\n end",
"def require_auth\n (authorized? && authenticated?) || halt(401)\n end",
"def valid?\n authorization_header.present? && authorization_header.match(BEARER_PATTERN) && authentication_token.present?\n end",
"def authorized?\n @auth ||= Rack::Auth::Basic::Request.new(request.env)\n\n @auth.provided? && @auth.basic? && @auth.credentials && @auth.credentials == [\n ENV[\"HTTP_USER\"],\n ENV[\"HTTP_PASS\"]\n ]\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 valid_for_params_auth?; end",
"def http?\n type == :basic || type == :digest\n end",
"def authenticate\n self.get && true\n end",
"def check_authentication\n case self.controller_name\n when /^clients/i, /^ingredients/i, /^orders/i, /^pages/i, /^productpresentations/i, /^products/i, /^companies/i\n authenticate\n end\n end",
"def authorized?\n @auth ||= Rack::Auth::Basic::Request.new(request.env)\n \n # read credentials from file\n credentials = open(\"credentials.txt\").read.split(\"\\n\").map{|c| c !~ /^#/ ? c : nil}.compact\n \n @auth.provided? && @auth.basic? && @auth.credentials && @auth.credentials == credentials\n end",
"def authenticating_with_oauth?\n correct_request_class? && using_oauth?\n end",
"def authenticate_client_access!\n return if api_key_from_params.nil?\n\n return require_api_client if access_from_localhost?\n return require_api_client if access_from_preview_hosting? && restricted_api_access_mode?\n return require_api_client if access_from_production_hosting?\n return require_api_client if access_from_public_hosting?\n\n true # Do not halt otherwise\n end",
"def require_http_basic_auth\n if APP_CONFIG['perform_authentication']\n authenticate_or_request_with_http_basic do |login, password|\n login==APP_CONFIG['username'] and password == APP_CONFIG['password']\n end\n end\n end",
"def http_authenticatable?\n mapping.to.http_authenticatable?(authenticatable_name)\n end",
"def http_authenticatable?\n mapping.to.http_authenticatable?(authenticatable_name)\n end",
"def authorization_header?\n return true if request.headers['Authorization'] && request.headers['Authorization'] != 'null'\n\n false\n end",
"def require_api_user_or_token\n case auth_mechanism\n when :system\n authenticate_with_system_token(request.headers[HttpHeaders::MIQ_TOKEN])\n when :token\n authenticate_with_user_token(request.headers[HttpHeaders::AUTH_TOKEN])\n when :ui_session\n raise AuthenticationError unless valid_ui_session?\n auth_user(session[:userid])\n when :jwt\n authenticate_with_jwt(jwt_token)\n when :basic, :basic_async, nil\n success = authenticate_with_http_basic do |u, p|\n begin\n timeout = ::Settings.api.authentication_timeout.to_i_with_method\n\n if oidc_configuration?\n # Basic auth, user/password but configured against OpenIDC.\n # Let's authenticate as such and get a JWT for that user.\n #\n user_jwt = get_jwt_token(u, p)\n token_info = validate_jwt_token(user_jwt)\n user_data, membership = user_details_from_jwt(token_info)\n define_jwt_request_headers(user_data, membership)\n end\n user = User.authenticate(u, p, request, :require_user => true, :timeout => timeout)\n auth_user(user.userid)\n rescue MiqException::MiqEVMLoginError => e\n raise AuthenticationError, e.message\n end\n end\n raise AuthenticationError unless success\n end\n log_api_auth\n rescue AuthenticationError => e\n api_log_error(\"AuthenticationError: #{e.message}\")\n response.headers[\"Content-Type\"] = \"application/json\"\n case auth_mechanism\n when :jwt, :system, :token, :ui_session, :basic_async\n render :status => 401, :json => ErrorSerializer.new(:unauthorized, e).serialize(true).to_json\n when :basic, nil\n request_http_basic_authentication(\"Application\", ErrorSerializer.new(:unauthorized, e).serialize(true).to_json)\n end\n log_api_response\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 authorization_required\n authorized? || authorization_denied\n end",
"def oauth_handshake\r\n request_proxy = OAuth::RequestProxy.proxy request\r\n\r\n if request_proxy.signature.present?\r\n if request_proxy.token.present?\r\n oauth_required\r\n # 3-legged. Authorized user is current_token.user...\r\n else\r\n verify_oauth_consumer_signature\r\n # 2-legged. Authorized current_client_application?\r\n if @current_client_application\r\n @allow_private_access = @current_client_application.allow_private_access?\r\n @allow_write_access = @current_client_application.allow_write_access?\r\n end\r\n end\r\n elsif request_proxy.consumer_key.present?\r\n if @current_client_application = ClientApplication.\r\n find_by_key(request_proxy.consumer_key)\r\n # 1-legged. For JavaScript widgetry.\r\n @allow_private_access = false\r\n else\r\n invalid_oauth_response :unauthorized, \"Using Invalid Consumer Key\"\r\n false\r\n end\r\n else\r\n invalid_oauth_response :bad_request, \"Missing Required Consumer Key\"\r\n false\r\n end\r\n end",
"def auth\n if request.get?\n show_auth\n elsif request.post?\n check_auth\n end\n end",
"def require_login\n qop = ''\n case @qop\n when QOP_AUTH\n qop = 'auth'\n when QOP_AUTHINT\n qop = 'auth-int'\n when QOP_AUTH | QOP_AUTHINT\n qop = 'auth,auth-int'\n end\n\n @response.add_header('WWW-Authenticate', \"Digest realm=\\\"#{@realm}\\\",qop=\\\"#{qop}\\\",nonce=\\\"#{@nonce}\\\",opaque=\\\"#{@opaque}\\\"\")\n @response.status = 401\n end",
"def authorized?\n @auth ||= Rack::Auth::Basic::Request.new(request.env)\n return @auth.provided? && @auth.basic? && @auth.credentials && @auth.credentials == [@@username, @@password]\n end",
"def authenticate\n authorize || unauthorized\n end",
"def auth_provided?\n !username.nil? && !password.nil?\n end",
"def header_login\n auth_key = %w(X-HTTP_AUTHORIZATION HTTP_AUTHORIZATION Authorization).detect { |h| request.env.has_key?(h) }\n unless auth_key.blank?\n auth_data = request.env[auth_key].to_s.split\n if auth_data and auth_data[0] == 'Basic'\n email, password = Base64.decode64(auth_data[1]).split(':')[0..1]\n current_user = User.authenticate(email, password)\n return true unless user.nil?\n end\n end\n return false\n end",
"def check_missing_authentication\n $abst_states.each do |n, s|\n if s.type == 'controller' && !s.req_policies[0].nil? && s.routed\n if s.req_policies[0].is_authenticated # A_\n if s.code_policy.is_authenticated\n # Good\n else\n # No PEP\n s.req_error = true\n type = 'Missing authentication'\n msg = \"[Req:O, Code:X] No authentication for #{s.domain}\" # TODO: get URL also\n end\n else # pub, __\n if s.code_policy.is_authenticated\n # No Req\n s.req_error = true\n type = 'Missing authentication'\n msg = \"[Req:X, Code:O] No authentication for #{s.domain}\" # TODO: get URL also\n else\n # Good, both req and code are public\n end\n end\n end\n\n if s.req_error\n w = Hash.new\n w['warning_type'] = type\n w['message'] = msg\n w['file'] = s.filename\n w['line'] = nil\n w['code'] = nil\n w['location'] = nil\n w['user_input'] = nil\n w['confidence'] = 'High' # Weak Medium High\n $warning.add(w)\n print_pep_error(s, 'authentication') if $enable_stdout\n end\n end\n end",
"def authenticate?\n @authentication_required\n end",
"def require_basic_auth_maybe\n if Rails.env.staging?\n authenticate_or_request_with_http_basic do |user, password|\n user == \"mamajamas\" && (password == \"mamab1rd\" || password == \"welcome\")\n end\n end\n end",
"def capable_login_auth?; end",
"def client_has_valid_token?\n request.headers[\"Authorization\"] == Rails.application.credentials.guessing_access_token\n end",
"def valid_for_params_auth?\n params_authenticatable? && valid_params_request? &&\n valid_params? && with_authentication_hash(:params_auth, params_auth_hash)\n end",
"def check(request, response)\n auth = Http::Auth::Bearer.new(\n @realm,\n request,\n response\n )\n\n bearer_token = auth.token\n if bearer_token.blank?\n return [false, \"No 'Authorization: Bearer' header found. Either the client didn't send one, or the server is mis-configured\"]\n end\n\n principal_url = validate_bearer_token(bearer_token)\n if principal_url.blank?\n return [false, \"Bearer token was incorrect\"]\n end\n\n return [true, principal_url]\n end",
"def login_required\n username, passwd = get_auth_data\n logged_in? && authorized? ? true : access_denied\n end",
"def login_required\n authorized? || access_denied\n end",
"def login_required\n authorized? || access_denied\n end",
"def login_required\n authorized? || access_denied\n end",
"def authenticate\n klass.new(request).authenticate == true\n end",
"def authenticate!\n # if the authentication header is an acceptible value\n if @env['HTTP_X_MY_API'] == 'foobar'\n user = { :id => 1, :name => \"some user\" }\n # warden doesn't care what the user is, so long as it's not nil.\n success! user, \"success\"\n end\n end",
"def capable_plain_auth?; end",
"def api_auth\n api_response(403, \"Invalid Authorization header\") unless api_user\n end",
"def authenticate\n# byebug\n return true if public_action?\n if request.format.json?\n authenticate_token || render_json_unauthorized\n else\n authenticate_user!\n end\n end",
"def valid_for_token_auth?\n token_authenticatable? && auth_token.present? && with_authentication_hash(:token_auth, token_auth_hash)\n end",
"def authentication_in_progress?\n request.path_info =~ /^\\/oauth/\n end",
"def authentication_in_progress?\n request.path_info =~ /^\\/oauth/\n end",
"def authorization\r\n@env['HTTP_AUTHORIZATION'] ||\r\n@env['X-HTTP_AUTHORIZATION'] ||\r\n@env['X_HTTP_AUTHORIZATION'] ||\r\n@env['REDIRECT_X_HTTP_AUTHORIZATION']\r\nend",
"def authenticate_json_request\n #return true unless Rails.env.production?\n\n # TODO Turn this back after making it correctly check for API requests\n if false && APIKeysActive == true && Rails.env.production?\n # Is it safe to suppose that ALL JSON requests will be API requests?? -SR\n #we'll check the mime types once 1.0 is deprecated, and 2.0 servers both html and json - RJ\n\n #case request.format\n #when Mime::JSON\n #/^Token token=\"(.+?)\"$/ - This should be integrated in the near future because we want\n # to check for the Token token portion of the header value.\n regex = /^.*\\\"([\\w]+)\\\"$/.match(request.authorization)\n regex ||= Array.new #guarantees the array accessor works on the next line\n key = regex[1]\n render :json => OldApi.error(403, \"Invalid Api Key\"), :status => 403 and return unless ApiKey.exists?(key: key)\n #end\n end\n end",
"def authenticate\n logged_in? || access_denied\n end",
"def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end",
"def authenticate\n logged_in? || access_denied\n end",
"def must_authenticate \n if @authenticated_user && (@user_is_viewing_themselves != false)\n return true\n else\n request_http_basic_authentication(\"Social bookmarking service\") \n return false\n end \n end",
"def authenticated_master?\n checker = RestfulApiAuthentication::Checker.new(request.headers, request.fullpath)\n if checker.authorized?({:require_master => true})\n return true\n else\n if checker.verbose_errors\n respond_with(checker.errors, :status => 401, :location => nil)\n else\n respond_with([\"not authorized\"], :status => 401, :location => nil)\n end\n end\n end",
"def require_authentication\n render_failed_auth_response unless authentication_successful? # render a 401 error\n end",
"def active_for_authentication?; end",
"def active_for_authentication?; end",
"def credentials?(uri, challenges); end",
"def test_authentication\n status = false\n\n Net::HTTP.start(\"#{@subdomain}.#{@options[:host]}\", 80) do |http|\n req = Net::HTTP::Get.new(@options[:pathname])\n\n if authentication_set?\n req.ntlm_auth(@username, @options[:domain], @password)\n end\n\n response = http.request(req)\n\n if response.code.to_i.between?(200,399)\n status = true\n else\n status = false\n end\n end\n\n return status\n end",
"def api_authentication_required\n unauthorized unless current_user?\n end",
"def check_authorization\n # Decode Basic Auth, future jwt?\n require 'base64'\n\n credentials = request.headers['Authorization']\n\n if credentials.nil?\n render json: { error: 'Missing credentials, Authorization: Basic Auth ([email protected]:usertwo)'}, status: :forbidden\n else\n # Split > decode > split\n credentials = Base64.decode64(credentials.split[1]).split(':')\n\n # Get the creator by email\n @current_creator = Creator.find_by(email: credentials[0].downcase)\n\n # If nil and not able to authenticate with the password, return forbidden 403\n unless @current_creator && @current_creator.authenticate(credentials[1])\n render json: { error: 'Not authorized! Wrong credentials!'}, status: :forbidden\n end\n end\n end",
"def needs_authorization?\n true\n end",
"def allowed_auth_methods; end",
"def authenticate_user!\n # check for API/signed requests\n if request.headers.env[\"HTTP_AUTHORIZATION\"] || request.headers.env[\"Authorization\"] then\n agent = Agent.where(:access_key => ApiAuth.access_id(request)).first\n begin\n if not(agent and ApiAuth.authentic?(request, agent.secret_key)) then\n return render :text => Bixby::JsonResponse.new(\"fail\", \"authentication failed\", nil, 401).to_json, :status => 401\n end\n rescue ApiAuth::ApiAuthError => ex\n return render :text => Bixby::JsonResponse.new(\"fail\", ex.message, nil, 401).to_json, :status => 401\n end\n @current_user = agent # TODO hrm.. hack much?\n return false\n end\n\n # authenticate a request from a browser session\n super\n end",
"def auth?\n true\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 authenticate\n \t\tlogged_in? || access_denied\n \tend",
"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 requesting_auth?(authorization_header)\n authorization_header || !authorization_cookie.blank?\n end",
"def authenticate!\n error!(\"401 Unauthorized\", 401) unless check_auth_token \n end",
"def authentication?\n @capabilities and @capabilities.include? 'auth'\n end",
"def authenticate\n \t# get token from header\n \tauthentication_token = request.headers['token']\n \t@user = User.find_by_authentication_token authentication_token if authentication_token\n \t\n \tunless @user\n \t\trender json: {success: false, message: I18n.t('unauthorized'), data: {}}, status: :unauthorized\n \t\treturn false\n \tend\n end",
"def authenticate\n return true if public_action?\n if request.format.json?\n render_json_unauthorized unless authenticate_token\n else\n authenticate_user!\n end\n end",
"def http_auth_login\n # FIXME: Implement\n end",
"def check_authenticate_user\n if request.headers[:token].present?\n @auth_token = AuthToken.find_by(token: request.headers[:token])\n @current_user = auth_token.user if @auth_token.present?\n unless @auth_token && @current_user\n error_response_with_obj(HTTP_UNAUTHORIZED[:code], \"Invalid Authentication token\")\n end\n else\n error_response_with_obj(HTTP_UNAUTHORIZED[:code], \"Invalid Authentication token\")\n end\n end",
"def valid?\n\n auth_params = params[scope]\n return false if !auth_params\n\n (nimbus_auth(auth_params)&.code == 200) ? true : false\n end",
"def has_auth_criteria?\n\t\t\treturn self.has_positive_auth_criteria? || self.has_negative_auth_criteria?\n\t\tend",
"def authenticate\n case request.format\n when Mime::XML, Mime::JSON\n unless logged_in? && admin?\n authenticate_or_request_with_http_basic do |user_name, password|\n user_name == USER_NAME && password == PASSWORD\n end\n end\n else\n render_404 and return unless logged_in? && admin?\n end\n end"
] | [
"0.78484124",
"0.78484124",
"0.70997375",
"0.70390296",
"0.70184547",
"0.6895594",
"0.6806776",
"0.6793163",
"0.67798525",
"0.67351013",
"0.6707533",
"0.6693844",
"0.6539398",
"0.6508352",
"0.6503394",
"0.64716375",
"0.6468599",
"0.64320695",
"0.64320695",
"0.637331",
"0.63691026",
"0.6362929",
"0.633035",
"0.6329763",
"0.6326735",
"0.63260746",
"0.63207954",
"0.63137114",
"0.6300756",
"0.6289408",
"0.627156",
"0.6266896",
"0.6258524",
"0.6218082",
"0.62130433",
"0.6209035",
"0.6178484",
"0.6178484",
"0.6143091",
"0.6135286",
"0.6119971",
"0.6119971",
"0.61008364",
"0.6082319",
"0.6080693",
"0.60768247",
"0.60658205",
"0.6061343",
"0.6060937",
"0.60529995",
"0.60498655",
"0.6045872",
"0.60380024",
"0.6032752",
"0.6030975",
"0.6006354",
"0.59755987",
"0.5973792",
"0.59708184",
"0.59708184",
"0.59708184",
"0.59660727",
"0.5959183",
"0.5948634",
"0.5943627",
"0.5941326",
"0.59353435",
"0.59316516",
"0.59316516",
"0.59119177",
"0.59042746",
"0.5898646",
"0.58906364",
"0.58892715",
"0.5868036",
"0.5866939",
"0.5862151",
"0.5857772",
"0.5857772",
"0.5852404",
"0.5848555",
"0.5847297",
"0.5846474",
"0.5845571",
"0.5845158",
"0.58405685",
"0.58403414",
"0.5834095",
"0.5832892",
"0.5832877",
"0.58308876",
"0.58214885",
"0.582139",
"0.58205533",
"0.5815983",
"0.58047646",
"0.5802504",
"0.57882214",
"0.5787921",
"0.57810247"
] | 0.76214534 | 2 |
Check if this is a valid strategy for params authentication by: Validating if the model allows params authentication; If the request hits the sessions controller through POST; If the params[scope] returns a hash with credentials; If all authentication keys are present; | def valid_for_params_auth?; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_for_params_auth?\n params_authenticatable? && valid_params_request? &&\n valid_params? && with_authentication_hash(:params_auth, params_auth_hash)\n end",
"def allow_params_authentication!; end",
"def params_authenticatable?; end",
"def valid_params?\n params_auth_hash.is_a?(Hash)\n end",
"def params_auth_hash\n if params[scope].kind_of?(Hash) && params[scope].has_key?(authentication_keys.first)\n params[scope]\n else\n params\n end\n end",
"def valid_params_request?\n !!env[\"devise.allow_params_authentication\"]\n end",
"def auth_params_exist\n auth.key?(:user_id) && auth.key?(:api_key)\n end",
"def params_auth_hash\n params[scope]\n end",
"def params_auth_hash\n params[scope]\n end",
"def params_authenticatable?\n User.params_authenticatable?(authenticatable_name)\n end",
"def params_authenticatable?\n mapping.to.params_authenticatable?(authenticatable_name)\n end",
"def url_options_authenticate?(params = {})\n params = params.symbolize_keys\n if params[:controller]\n # find the controller class\n klass = eval(\"#{params[:controller]}_controller\".classify)\n else\n klass = self.class\n end\n klass.user_authorized_for?(current_visitor, params, binding)\n end",
"def params_valid?\n \n #if the user isn't signed in or there aren't any parameters, the params \n #aren't valid\n if !user_signed_in? || !params_present? \n return false\n end\n \n #Check whether a submission for the given language exists and whether it\n #belongs to the current user.\n submission = Submission.where(id: params[:submission_id], language_id: params[:language_id])\n \n submission.present? && current_user.id == submission.first.user_id\n end",
"def url_options_authenticate?(params = {})\n params = params.symbolize_keys\n if params[:controller]\n # find the controller class\n klass = eval(\"#{params[:controller]}_controller\".classify)\n else\n klass = self.class\n end\n klass.user_authorized_for?(current_user, params, binding)\n end",
"def params_auth_hash; end",
"def valid_for_authentication?; end",
"def valid_for_authentication?; end",
"def auth_info\n params[auth_param] || {}\n end",
"def valid?\n\t\tparams['user'] && params['user']['username'] && params['user']['password']\n\tend",
"def valid_params_request?; end",
"def valid?\n params['user'] && params['user']['username'] && params['user']['password']\n end",
"def auth_options\n params.require(:email)\n params.require(:password)\n end",
"def valid_for_http_auth?; end",
"def valid_params_request?\n true\n end",
"def valid_params_request?\n true\n end",
"def oAuthValidate\r\n logger.info(\"UserController::oAuthValidate::Params:----#{params}\")\r\n \r\n end",
"def user_authorized_for_capability?(user, params = {}, binding = self.binding)\n return true unless Array === self.capability_requirements\n self.capability_requirements.each{| capability_requirement|\n capabilities = capability_requirement[:capabilities]\n options = capability_requirement[:options]\n # do the options match the params?\n \n controller = (params[:controller] || self.class.name.sub(/Controller$/).underscore).to_sym\n action = (params[:action] || :index).to_sym\n\n # check the action\n if options.has_key?(:only)\n next unless options[:only].include?( action )\n end\n \n if options.has_key?(:except)\n next if options[:except].include?( action )\n end\n \n if options.has_key?(:if)\n # execute the proc. if the procedure returns false, we don't need to authenticate these capabilities\n next unless ( String===options[:if] ? eval(options[:if], binding) : options[:if].call(params) )\n end\n \n if options.has_key?(:unless)\n # execute the proc. if the procedure returns true, we don't need to authenticate these capabilities\n next if ( String===options[:unless] ? eval(options[:unless], binding) : options[:unless].call(params) )\n end\n \n # check to see if they have one of the required capabilities\n @capability_pattern = nil\n passed = false\n capabilities.each { |capability|\n capability = capability.gsub(/:controller\\b/, controller.to_s) if controller\n capability = capability.gsub(/:action\\b/, action.to_s) if action\n @capability_pattern = capability\n if user.has_capability?(capability)\n passed = true\n break\n end\n } unless (! user || user==:false)\n \n return false unless passed\n }\n \n return true\n end",
"def user_authorized_for?(user, params = {}, binding = self.binding)\n return true unless Array===self.role_requirements\n self.role_requirements.each{| role_requirement|\n roles = role_requirement[:roles]\n options = role_requirement[:options]\n # do the options match the params?\n\n # check the action\n if options.has_key?(:only)\n next unless options[:only].include?( (params[:action]||\"index\").to_sym )\n end\n\n if options.has_key?(:except)\n next if options[:except].include?( (params[:action]||\"index\").to_sym)\n end\n\n if options.has_key?(:if)\n # execute the proc. if the procedure returns false, we don't need to authenticate these roles\n next unless ( String===options[:if] ? eval(options[:if], binding) : options[:if].call(params) )\n end\n\n if options.has_key?(:unless)\n # execute the proc. if the procedure returns true, we don't need to authenticate these roles\n next if ( String===options[:unless] ? eval(options[:unless], binding) : options[:unless].call(params) )\n end\n\n # check to see if they have one of the required roles\n passed = false\n roles.each { |role|\n passed = true if user.has_role?(role)\n } unless (! user || user==:false)\n\n return false unless passed\n }\n\n return true\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 authenticate\n klass.new(request).authenticate == true\n end",
"def valid_for_http_auth?\n http_authenticatable? && request.authorization && with_authentication_hash(:http_auth, http_auth_hash)\n end",
"def valid_for_http_auth?\n http_authenticatable? && request.authorization && with_authentication_hash(:http_auth, http_auth_hash)\n end",
"def authentication_params\n if params[:provider]\n params.permit(:provider, :error, :error_description, :state)\n else\n params.require(:authentication).permit(:type, :user_email, :password)\n end\n end",
"def auth_params\n if !current_user.is_admin?\n params[:person].delete(:is_pal) if params[:person]\n end\n end",
"def check_params\n # For each key,value in GLOBAL VAR **PARAMS**.\n PARAMS.each do |param, method|\n # Next if there isn't param in the request of client\n next unless params[param]\n # Check the *param* with *method*\n unless send(method, params[param])\n @error_object = \"Param #{param} is wrong, #{method} failed\"\n return false\n end\n end\n true\n end",
"def user_params\n allowed_params = ActiveModelSerializers::Deserialization.jsonapi_parse(params, only: [:email, :password, :role])\n if(allowed_params[:role])\n allowed_params[:role] = [allowed_params[:role].to_i, current_user.role].min\n end\n\n allowed_params\n end",
"def valid_params?\n params.is_a?(Hash)\n end",
"def authenticate\n# byebug\n return true if public_action?\n if request.format.json?\n authenticate_token || render_json_unauthorized\n else\n authenticate_user!\n end\n end",
"def valid_for_token_auth?\n token_authenticatable? && auth_token.present? && with_authentication_hash(:token_auth, token_auth_hash)\n end",
"def user_authorized_for?(user, params = {}, binding = self.binding)\n return true unless Array===@role_requirements\n @role_requirements.each{| role_requirement|\n roles = role_requirement[:roles]\n options = role_requirement[:options]\n # do the options match the params?\n\n # check the action\n if options.has_key?(:only)\n next unless options[:only].include?( (params[:action]||\"index\").to_sym )\n end\n\n if options.has_key?(:except)\n next if options[:except].include?( (params[:action]||\"index\").to_sym)\n end\n\n if options.has_key?(:if)\n # execute the proc. if the procedure returns false, we don't need to authenticate these roles\n next unless ( String===options[:if] ? eval(options[:if], binding) : options[:if].call(params) )\n end\n\n if options.has_key?(:unless)\n # execute the proc. if the procedure returns true, we don't need to authenticate these roles\n next if ( String===options[:unless] ? eval(options[:unless], binding) : options[:unless].call(params) )\n end\n\n # check to see if they have one of the required roles\n passed = false\n roles.each { |role|\n passed = true if user.has_role?(role)\n } unless (! user || user==:false)\n\n return false unless passed\n }\n\n return true\n end",
"def authorize_params\n super.tap do |params|\n %w(scope team redirect_uri).each do |v|\n if !request.params[v].to_s.empty?\n params[v.to_sym] = request.params[v]\n end\n end\n log(:debug, \"Authorize_params #{params.to_h}\")\n end\n end",
"def valid_user?\n params['username'] && params['password']\n end",
"def authenticate\n self.get && true\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 valid?\n @params_definition.each { |pd| return false unless @params.has_key?(pd) }\n true\n end",
"def http_authenticatable?; end",
"def authorize_params\n\n # Trick shamelessly borrowed from the omniauth-facebook gem!\n super.tap do |params|\n %w[scope].each { |v| params[v.to_sym] = request.params[v] if request.params[v] }\n params[:scope] ||= DEFAULT_SCOPE # ensure that we're always request *some* default scope\n end\n end",
"def authenticate_scope!\n \n \n do_before_request \n\n end",
"def check_params\n true\n end",
"def valid_session(params = {})\n {}.merge!(params)\n end",
"def valid_session(params = {})\n {}.merge!(params)\n end",
"def valid_session(params = {})\n {}.merge!(params)\n end",
"def any_authenticity_token_valid?; end",
"def authenticate\n # logger.debug(\"APP: authorization: #{temp_debug(request)}\")\n set_last_uri\n return true unless application_user.nil?\n # logger.info(\"Header NOT-SET = #{request.headers['NOT-SET'].inspect}\")\n if request.env.has_key? \"REMOTE_USER\"\n logger.info(\"REMOTE_USER = #{request.env[\"REMOTE_USER\"]}\")\n apache_authenticate\n elsif request.headers.has_key?('HTTP_X_FORWARDED_USER')\n logger.info(\"Header HTTP_X_FORWARDED_USER = #{request.headers['HTTP_X_FORWARDED_USER']}\")\n proxy_apache_authenticate\n elsif Rails.env == \"test\"\n logger.info(\"Authenticate via test\")\n testing_authenticate\n elsif NONE_AUTHENTICATE\n logger.info(\"Authenticate via none\")\n none_authenticate\n else\n ldap_authenticate\n end\n end",
"def valid_http_auth?\n controller.authenticate_with_http_basic do |login, password|\n if !login.blank? && !password.blank?\n send(\"#{login_field}=\", login)\n send(\"#{password_field}=\", password)\n return valid?\n end\n end\n \n false\n end",
"def require_login\n unless current_user\n session[:last_params] = params\n redirect_to login_url_for_this_controller\n return\n end\n\n validate_user(current_user)\n end",
"def check_authentication\n case self.controller_name\n when /^clients/i, /^ingredients/i, /^orders/i, /^pages/i, /^productpresentations/i, /^products/i, /^companies/i\n authenticate\n end\n end",
"def authenticate(attributes={})\n return unless authentication_keys.all? { |k| attributes[k].present? }\n conditions = attributes.slice(*authentication_keys)\n resource = find_for_authentication(conditions)\n resource if resource.try(:valid_for_authentication?, attributes)\n end",
"def authenticate(_)\n super(session_params)\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!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end",
"def valid?\n\n auth_params = params[scope]\n return false if !auth_params\n\n (nimbus_auth(auth_params)&.code == 200) ? true : false\n end",
"def validate_params?\n true # TODO: add validation\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 correct_request_class?\n return false unless auth_params?\n \n if is_auth_session?\n auth_type.to_s == \"session\"\n else\n auth_type.to_s == \"user\"\n end\n end",
"def login_param_validation(params)\n model = params.keys[1]\n model_key = model.to_sym\n model_class = model.classify.constantize\n obj = model_class.new\n\n obj.errors.add(\"email\", \"is required\") if params[model_key][:email] == \"\"\n obj.errors.add(\"password\", \"is required\") if params[model_key][:password] == \"\"\n obj.errors.add(\"email\", \"is invalid\") if !params[model_key][:email].match(/\\A([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/i)\n\n return obj\n end",
"def authorize_params\n super.tap do |params|\n %w[ state ].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n\n # to support omniauth-oauth2's auto csrf protection\n session['omniauth.state'] = params[:state] if v == 'state'\n end\n end\n end\n end",
"def check_required_scope_args(scope, params)\n # make sure we have a hash and it has values\n return false unless params.is_a?(Hash) && params.present?\n # find required values\n required = scope.select{ |k,v| v.to_sym == :req }.keys\n # make sure we have all of the required values, we allow false\n required.all? { |key|\n params[key].present? || params[key] == false\n }\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 authorize_params\n super.tap do |params|\n %w[auth_type display revoke scope state].each do |v|\n next unless request.params[v]\n params[v.to_sym] = request.params[v]\n\n session[\"omniauth.state\"] = params[:state] if v == \"state\"\n # to support omniauth-oauth2’s auto csrf protection\n end\n\n params[:scope] ||= DEFAULT_SCOPE\n end\n end",
"def capable_login_auth?; end",
"def valid_params?; end",
"def active_for_authentication?; end",
"def active_for_authentication?; end",
"def authorized?\n auth_config = settings.config['authentication']\n @auth ||= Rack::Auth::Basic::Request.new(request.env)\n @auth.provided? and @auth.basic? and @auth.credentials and @auth.credentials == [auth_config['username'], auth_config['password']]\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def request_should_auth?( request )\n\t\tself.log.debug \"Checking to see if Auth(entication/orization) should be applied for app_path: %p\" %\n\t\t\t[ request.app_path ]\n\n\t\t# If there are positive criteria, return true if the request matches any of them,\n\t\t# or false if they don't\n\t\tif self.class.has_positive_auth_criteria?\n\t\t\tcriteria = self.class.positive_auth_criteria\n\t\t\tself.log.debug \" checking %d positive auth criteria\" % [ criteria.length ]\n\t\t\treturn criteria.any? do |pattern, block|\n\t\t\t\tself.request_matches_criteria( request, pattern, &block )\n\t\t\tend\n\t\t\treturn false\n\n\t\t# If there are negative criteria, return false if the request matches any of them,\n\t\t# or true if they don't\n\t\telsif self.class.has_negative_auth_criteria?\n\t\t\tcriteria = self.class.negative_auth_criteria\n\t\t\tself.log.debug \" checking %d negative auth criteria\" % [ criteria.length ]\n\t\t\treturn false if criteria.any? do |pattern, block|\n\t\t\t\trval = self.request_matches_criteria( request, pattern, &block )\n\t\t\t\tself.log.debug \" matched: %p -> %p\" % [ pattern, block ] if rval\n\t\t\t\trval\n\t\t\tend\n\t\t\treturn true\n\n\t\telse\n\t\t\tself.log.debug \" no auth criteria; default to requiring auth\"\n\t\t\treturn true\n\t\tend\n\tend",
"def authenticate\n \t@settings = Setting.first\n \treturn true if @settings.access_token.blank?\n\n \tsession[:valid] = true if @settings.access_token == BCrypt::Engine.hash_secret(params[:access_token], @settings.access_token_digest)\n \treturn true if session[:valid]\n \t\n \t# Redirect to login unless logging in\n \t@suppress_navbar = true\n \tredirect_to login_path unless request.path == login_path\n end",
"def auth_params\n params.require(:auth).permit Knock.handle_attr, :password\n end",
"def authenticate?\n @authentication_required\n end",
"def username_and_password?\n params[:username].present? && params[:password].present?\n end",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def auth_provided?\n !username.nil? && !password.nil?\n end",
"def authentication_params\n {\n api_user: @api_user,\n api_key: @api_key\n }\n end",
"def authentication_params\n\t\t\tparams.require(:authentication).permit(:user_id, :provider, :uid, :access_token)\n\t\tend",
"def authenticate_if_needed\n # Disable this extra authentication in test mode\n return true if Rails.env.test?\n if (is_hidden || is_staging) && !is_api_or_pdf\n authenticate_or_request_with_http_basic do |username, password|\n username == \"samvera\" && password == \"hyku\"\n end\n end\n end",
"def authenticate!\n if resource = mapping.to.authenticate_with_crowd(params[scope])\n success!(resource)\n else\n fail(:invalid)\n end\n end",
"def auth_param; end",
"def authenticate\n # puts _process_action_callbacks.map(&:filter)\n # if current_user\n # session['user_id'] = current_user.id\n # true\n # else\n # session[:return_to] = request.original_url\n # respond_to do |format|\n # format.html { redirect_to login_url }\n # format.any(:xml,:json) { request_http_basic_authentication }\n # end\n # false\n # end\n true\n end",
"def find_for_authentication(tainted_conditions); end",
"def authenticate\n authorize || unauthorized\n end",
"def params_auth_hash\n params[scope].merge(ip_address: remote_ip)\n end",
"def authenticate_scope!\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 check_params; true; end",
"def authenticate\n return true if public_action?\n if request.format.json?\n render_json_unauthorized unless authenticate_token\n else\n authenticate_user!\n end\n end",
"def validateParams \r\n\t \r\n\t \tif [email protected]? && [email protected]? && [email protected]?\r\n\t\t\treturn true\r\n\t \telse\r\n\t\t\treturn false \t\r\n\t \tend\r\n\t \t\r\n\t end",
"def authorized?(user, request, params)\n true\n end",
"def require_token_or_user\n if params[:token].present? && params[:salt].present?\n require_token\n else\n require_user\n end\n end",
"def authorize_params\n super.tap do |params|\n options[:authorize_options].each do |k|\n params[k] = request.params[k.to_s] unless [nil, ''].include?(request.params[k.to_s])\n end\n end\n end"
] | [
"0.7716821",
"0.71465135",
"0.69334435",
"0.6900779",
"0.6868475",
"0.67344296",
"0.65492487",
"0.64993685",
"0.64993685",
"0.6453783",
"0.6416946",
"0.63743716",
"0.6353567",
"0.63052016",
"0.6257188",
"0.62166584",
"0.62166584",
"0.6121203",
"0.61169297",
"0.60684705",
"0.60668474",
"0.6054319",
"0.5993323",
"0.59743017",
"0.59743017",
"0.59611225",
"0.59136397",
"0.58402365",
"0.582506",
"0.5819459",
"0.58104193",
"0.58104193",
"0.5790261",
"0.5789497",
"0.5781257",
"0.57735556",
"0.5750144",
"0.5746648",
"0.57454646",
"0.5730162",
"0.5729012",
"0.5693971",
"0.56544757",
"0.56346065",
"0.5633821",
"0.563206",
"0.5631779",
"0.5622111",
"0.5617935",
"0.5617494",
"0.56139946",
"0.56139946",
"0.5607464",
"0.55962414",
"0.5583973",
"0.55818284",
"0.55805886",
"0.557798",
"0.55720335",
"0.55630505",
"0.5562838",
"0.5558499",
"0.55580586",
"0.55573416",
"0.55569774",
"0.55532324",
"0.5545897",
"0.5539557",
"0.5531955",
"0.55301493",
"0.55247426",
"0.552222",
"0.5521449",
"0.5521449",
"0.55142087",
"0.55110246",
"0.55100226",
"0.5509736",
"0.5503124",
"0.5498114",
"0.54946876",
"0.5494568",
"0.54943395",
"0.5480171",
"0.5478043",
"0.5476692",
"0.5472548",
"0.5470444",
"0.5467574",
"0.5466279",
"0.54596376",
"0.54587966",
"0.5458006",
"0.5457199",
"0.5454394",
"0.54486775",
"0.5442928",
"0.54370844",
"0.5431336",
"0.5430253"
] | 0.7624465 | 1 |
If the request is valid, finally check if params_auth_hash returns a hash. | def valid_params?; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_params?\n params_auth_hash.is_a?(Hash)\n end",
"def valid_for_params_auth?\n params_authenticatable? && valid_params_request? &&\n valid_params? && with_authentication_hash(:params_auth, params_auth_hash)\n end",
"def valid_for_params_auth?; end",
"def validate\n return false unless @digest_parts.any? # RUBY\n\n a2 = @request.method + ':' + @digest_parts['uri']\n\n if @digest_parts['qop'] == 'auth-int'\n # Making sure we support this qop value\n return false unless @qop & QOP_AUTHINT\n\n # We need to add an md5 of the entire request body to the A2 part of the hash\n body = @request.body_as_string\n @request.body = body\n\n a2 << ':' + ::Digest::MD5.hexdigest(body)\n else\n # We need to make sure we support this qop value\n return false unless @qop & QOP_AUTH\n end\n\n a2 = ::Digest::MD5.hexdigest(a2)\n valid_response = ::Digest::MD5.hexdigest(\"#{@a1}:#{@digest_parts['nonce']}:#{@digest_parts['nc']}:#{@digest_parts['cnonce']}:#{@digest_parts['qop']}:#{a2}\")\n\n @digest_parts['response'] == valid_response\n end",
"def auth_params_exist\n auth.key?(:user_id) && auth.key?(:api_key)\n end",
"def valid_for_http_auth?; end",
"def valid_AmazonMarketplace_request?(request_hash)\n hash = request_hash.symbolize_keys\n signature = hash.delete(:signature) || ''\n AmazonMarketplace::SignatureUtils.authentic?(hash, signature)\n end",
"def valid_params?\n params.is_a?(Hash)\n end",
"def valid_for_http_auth?\n http_authenticatable? && request.authorization && with_authentication_hash(:http_auth, http_auth_hash)\n end",
"def valid_for_http_auth?\n http_authenticatable? && request.authorization && with_authentication_hash(:http_auth, http_auth_hash)\n end",
"def valid?\n utils = Amazon::FPS::SignatureUtilsForOutbound.new(@access_key, @secret_key);\n utils.validate_request(:parameters => @params, :url_end_point => @url_end_point, :http_method => \"GET\")\n end",
"def params_auth_hash; end",
"def valid?\n params['user'] && params['user']['username'] && params['user']['password']\n end",
"def valid_params_request?\n !!env[\"devise.allow_params_authentication\"]\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 valid_to_proceed?\r\n decoded_auth_token.present? && decoded_auth_token[:user_id].present? && valid_token?\r\n end",
"def valid_request?\n signature = github_signature\n my_signature = 'sha1=' + OpenSSL::HMAC.hexdigest(\n OpenSSL::Digest.new('sha1'),\n ENV['GITHUB_WEBHOOK_SECRET'],\n github_payload_raw\n )\n\n json_response(json_access_denied, :unauthorized) unless Rack::Utils.secure_compare(my_signature, signature)\n rescue StandardError => e\n msg = \"#{self.class}##{__method__} An error occurred while determine if request is valid\"\n Rails.logger.error(\n message: msg,\n exception: e\n )\n\n json_response(json_access_denied(errors: { message: \"#{msg}, exception: #{e.message}\" }), :unauthorized)\n end",
"def valid?\n\t\tparams['user'] && params['user']['username'] && params['user']['password']\n\tend",
"def valid?\n\n auth_params = params[scope]\n return false if !auth_params\n\n (nimbus_auth(auth_params)&.code == 200) ? true : false\n end",
"def oAuthValidate\r\n logger.info(\"UserController::oAuthValidate::Params:----#{params}\")\r\n \r\n end",
"def valid_params_request?\n true\n end",
"def valid_params_request?\n true\n end",
"def valid_hash?(digest)\n Argon2::HashFormat.valid_hash?(digest)\n end",
"def validate_digest_response(request, realm, &password_procedure); end",
"def valid_params_request?; end",
"def valid?(env)\n request = Rack::Request.new(env)\n unless (access_id = request.params['AccessKeyID'])\n #puts \"AccessKeyID not found in Params\"\n return false\n end\n unless (secret_key = @accounts[access_id])\n #puts \"No SecretKey found for AccessKeyID #{access_id.inspect}\"\n return false\n end\n AuthenticatedApi::Server.valid_signature?(request, secret_key)\n end",
"def check_authentication_info(res, opts)\n\n return if no_digest_auth\n # not using digest authentication\n\n return unless @challenge\n # not yet authenticated\n\n authinfo = AuthInfo.new res\n @challenge.nonce = authinfo.nextnonce\n end",
"def valid_http_auth?\n controller.authenticate_with_http_basic do |login, password|\n if !login.blank? && !password.blank?\n send(\"#{login_field}=\", login)\n send(\"#{password_field}=\", password)\n return valid?\n end\n end\n \n false\n end",
"def validate_digest_response(request, realm, &password_procedure)\n credentials = decode_credentials_header(request)\n valid_nonce = validate_nonce(request, credentials[:nonce])\n\n if valid_nonce && realm == credentials[:realm] && opaque == credentials[:opaque]\n password = password_procedure.call(credentials[:username])\n method = request.env['rack.methodoverride.original_method'] || request.env['REQUEST_METHOD']\n\n [true, false].any? do |password_is_ha1|\n expected = expected_response(method, request.env['REQUEST_URI'], credentials, password, password_is_ha1)\n expected == credentials[:response]\n end\n end\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 check_params\n # For each key,value in GLOBAL VAR **PARAMS**.\n PARAMS.each do |param, method|\n # Next if there isn't param in the request of client\n next unless params[param]\n # Check the *param* with *method*\n unless send(method, params[param])\n @error_object = \"Param #{param} is wrong, #{method} failed\"\n return false\n end\n end\n true\n end",
"def signature_valid?\n hmac.validate_url_signature(request.url, secret)\n end",
"def valid_signature?\n params['verifier'] == Digest::MD5.hexdigest([ params['id'], params['snuid'], params['currency'], Offerpal.secret_key ].join(':'))\n end",
"def valid?\n authorization_header.present? && authorization_header.match(BEARER_PATTERN) && authentication_token.present?\n end",
"def auth_present?\n !!request.headers['HTTP_AUTHORIZATION'].present?\n end",
"def has_required_http_params?(param_hash)\n # Note: The blank? method is a Rails extension.\n # Specific keys have to be present, and their values\n # must not be blank.\n if !param_hash[:filename].blank? &&\n !param_hash[:assignment].blank? &&\n !param_hash[:group_name].blank?\n return true\n else\n return false\n end\n end",
"def valid_hash?(digest)\n self.class.valid_hash?(digest)\n end",
"def valid?\n\t\t\t\t((request.format.symbol == :json) || (params[\"format\"] != nil && params[\"format\"] == \"json\")) && params[\"email\"]\n\t\t\tend",
"def verify_authenticity_token\n if auth_token_param.present?\n verify_valid_auth_token!\n else\n super\n end\n end",
"def valid?\n @omniauth_hash.present? && @omniauth_hash.is_a?(OmniAuth::AuthHash) && @omniauth_hash.provider == @provider\n end",
"def auth_info\n params[auth_param] || {}\n end",
"def is_invalid_request?(params) # :nodoc:\n # Minimal test: ensure signature exists.\n if not params[:signature]\n return api_response(:invalid_signature)\n end\n\n # Validate package, and get secret\n if not params[:package_id]\n return api_response(:not_authorized)\n end\n\n packages = Package.where(:package_id => params[:package_id])\n if packages.length != 1\n return api_response(:not_authorized)\n end\n\n secret = packages[0].secret\n\n # Clone parameters for creating the signature. Then remove stuff we don't\n # want to see in the signature.\n cloned = Marshal::load(Marshal.dump(params))\n cloned.delete(:controller)\n cloned.delete(:action)\n cloned.delete(:signature)\n\n # Check signature\n signature = create_signature(cloned, secret)\n if not signature == params[:signature]\n return api_response(:invalid_signature, { :signature => 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 validrequest?(req)\n ssl = SSL.new(\"/home/rip/.mcollective.d/rip.pem\")\n\n ssl.verify_signature(req[:hash], SSL.md5(req[:body]), true)\n\n req[:callerid] = \"webuser=%s\" % ssl.rsa_decrypt_with_public(ssl.base64_decode(req[:callerid]))\n req[:body] = deserialize(req[:body])\n\n @stats.validated\n\n true\n rescue\n @stats.unvalidated\n raise(SecurityValidationFailed, \"Received an invalid signature in message\")\n end",
"def is_empty_params\n\t\tif user_params[:email].blank? || user_params[:password].blank?\n\t\t\treturn error_log errors:{unauthenticated:[\"Please Provide Proper Parameters\"]}\n\t\tend\n\tend",
"def authenticate_shopify_request\n unless hmac_valid?()\n unauthorized() and return\n end\n end",
"def check_auth(request, response)\n # Get the value of the authorization header, and reject the request if it isn't present:\n authorization = request['Authorization']\n if authorization.nil?\n response.status = 401\n response.body = \"The 'Authorization' header is required\"\n return false\n end\n\n # Extract the authorization scheme and token from the authorization header:\n match = /^(?<scheme>Basic|Bearer)\\s+(?<token>.*)$/i.match(authorization)\n unless match\n response.status = 401\n response.body = \"The 'Authorization' doesn't match the expected regular expression\"\n return false\n end\n scheme = match[:scheme]\n token = match[:token]\n\n # Check the token:\n case scheme.downcase\n when 'basic'\n return false unless check_basic_token(response, token)\n when 'bearer'\n return false unless check_bearer_token(response, token)\n else\n response.status = 401\n response.body = \"The authentication scheme '#{scheme} isn't supported\"\n return false\n end\n\n # If we are here then authentication was successful:\n true\n end",
"def verify!(request, secret)\n query = OauthStateMiddleware.query_string(request.params, request.params[\"nonce\"])\n unless request.params[\"oauth_redirect_signature\"] == OauthStateMiddleware.sign(query, secret)\n raise OauthStateMiddlewareException, \"OAuth state signatures do not match\"\n end\n end",
"def validate(ctx, params:, **)\n is_valid =\n params.is_a?(Hash) &&\n params[\"info\"].is_a?(Hash) &&\n params[\"info\"][\"email\"]\n\n is_valid # return value matters!\n end",
"def validrequest?(req)\n message = req[:body]\n signature = req[:hash]\n\n Log.debug(\"Validating request from #{req[:callerid]}\")\n\n if verify(public_key_file(req[:callerid]), signature, message.to_s)\n @stats.validated\n return true\n else\n @stats.unvalidated\n raise(SecurityValidationFailed, \"Received an invalid signature in message\")\n end\n end",
"def valid_user?\n params['username'] && params['password']\n end",
"def validate_authentication_token\n \n @user = User.find_by_services_authentification_token(params[:auth_token])\n bad_request if @user.nil?\n end",
"def authenticate?(params)\n user = get_user(params['AWSAccessKeyId'])\n return false if !user\n \n signature_params = params.reject { |key,value| \n key=='Signature' or key=='file' }\n\n signature = AWS.encode(\n user[:password], \n AWS.canonical_string(signature_params, @server_host),\n false)\n \n return params['Signature']==signature\n end",
"def rc_facebook_check_params_signed_request\n return if rc_facebook.authorized? || !params[:signed_request]\n\n rc_facebook.parse_signed_request!(params[:signed_request])\n logger.debug(\"DEBUG: Facebook: detected signed_request,\" \\\n \" parsed: #{rc_facebook.data.inspect}\")\n\n if rc_facebook.authorized?\n rc_facebook_write_rg_fbs\n else\n logger.warn(\n \"WARN: Facebook: bad signed_request: #{params[:signed_request]}\")\n end\n end",
"def is_checksum_valid?(received_params)\n paytmparams = Hash.new\n\n keys = received_params.keys\n keys.each do |k|\n paytmparams[k] = received_params[k]\n end\n\n checksum_hash = paytmparams[\"CHECKSUMHASH\"]\n paytmparams.delete(\"CHECKSUMHASH\")\n\n Rails.logger.debug \"HERE\"\n Rails.logger.debug \"paytmparams #{paytmparams}\"\n Rails.logger.debug \"checksum_hash #{checksum_hash}\"\n Rails.logger.debug \"PAYTM_MERCHANT_KEY #{ENV[\"PAYTM_MERCHANT_KEY\"]}\" \n \n return new_pg_verify_checksum(paytmparams, checksum_hash, ENV[\"PAYTM_MERCHANT_KEY\"])\n end",
"def validate_proxy\n\t\t\t# Remove and save the \"signature\" entry\n\t\t\tsignature = @query.delete(\"signature\")\n\t\t\tsorted_params = @query.collect{ |k, v| \"#{k}=#{Array(v).join(',')}\" }.sort.join\n\t\t\t\n\t\t\tcalculated_signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), shared_secret, sorted_params)\n\n\t\t\traise 'Invalid signature' if signature != calculated_signature\n\t\tend",
"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 validate(ctx, params:, **)\n is_valid =\n params.is_a?(Hash) &&\n params[\"info\"].is_a?(Hash) &&\n params[\"info\"][\"email\"]\n \n is_valid # return value matters!\n end",
"def verify_authenticity_token\n verified_request? || raise(ActionController::InvalidAuthenticityToken)\n end",
"def any_authenticity_token_valid?; end",
"def verify_auth_token\n halt 401 unless valid_user?(extracted_token)\n end",
"def valid?\n valid_user?(request.headers)\n end",
"def has_required_http_params?(param_hash)\n # Note: The blank? method is a Rails extension.\n # Specific keys have to be present, and their values\n # must not be blank.\n if !param_hash[:assignment].blank? &&\n !param_hash[:group_name].blank?\n return true\n else\n return false\n end\n end",
"def key_check\n logger.debug \"checking authorization key \"\n unauthorized \"No authorization key provided. Please pass the API token as GET parameter named 'key'. Example: ?key=abcdef\" if params[:key].nil?\n logger.debug \"token is \" + params[:key] unless params[:key].nil?\n end",
"def verify_request(verb, path, params, key, signature_param = nil)\n params ||= {}\n _path = path.dup\n _params = params.dup\n sign_request(verb, _path, _params, key, signature_param)\n return (path == _path and params == _params)\n end",
"def authok?\n @authok\n end",
"def authok?\n @authok\n end",
"def authok?\n @authok\n end",
"def authok?\n @authok\n end",
"def validrequest?(req)\n Log.info \"Caller id: #{req[:callerid]}\"\n Log.info \"Sender id: #{req[:senderid]}\"\n message = req[:body]\n\n #@log.info req.awesome_inspect\n identity = (req[:callerid] or req[:senderid])\n verifier = SSH::Key::Verifier.new(identity)\n\n Log.info \"Using name '#{identity}'\"\n\n # If no callerid, this is a 'response' message and we should\n # attempt to authenticate using the senderid (hostname, usually)\n # and that ssh key in known_hosts.\n if !req[:callerid]\n # Search known_hosts for the senderid hostname\n verifier.add_key_from_host(identity)\n verifier.use_agent = false\n verifier.use_authorized_keys = false\n end\n\n signatures = Marshal.load(req[:hash])\n if verifier.verify?(signatures, req[:body])\n @stats.validated\n return true\n else\n @stats.unvalidated\n raise(SecurityValidationFailed, \"Received an invalid signature in message\")\n end\n end",
"def params_valid?\n \n #if the user isn't signed in or there aren't any parameters, the params \n #aren't valid\n if !user_signed_in? || !params_present? \n return false\n end\n \n #Check whether a submission for the given language exists and whether it\n #belongs to the current user.\n submission = Submission.where(id: params[:submission_id], language_id: params[:language_id])\n \n submission.present? && current_user.id == submission.first.user_id\n end",
"def valid_for_token_auth?\n token_authenticatable? && auth_token.present? && with_authentication_hash(:token_auth, token_auth_hash)\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 check_authentication( req )\n\t\tusername = req.params[:username]\n\t\tpassword = req.params[:password]\n\n\t\tunless hmac = self.class.users[ username ]\n\t\t\tself.log.error \"Auth failure: no such user %p\" % [ username ]\n\t\t\tfinish_with( HTTP::AUTH_REQUIRED, \"authentication failure\" )\n\t\tend\n\n\t\tpw_hmac = OpenSSL::HMAC.hexdigest( 'sha1', self.class.key, password )\n\t\tself.log.debug \" hash of 'demo' is: %p\" % [ OpenSSL::HMAC.hexdigest('sha1', self.class.key, 'demo') ]\n\n\t\tunless hmac == pw_hmac\n\t\t\tself.log.error \"Auth failure: password digests don't match: expected %p, got %p\" %\n\t\t\t\t[ hmac, pw_hmac ]\n\t\t\tfinish_with( HTTP::AUTH_REQUIRED, \"authentication failure\" )\n\t\tend\n\n\t\t# Tell the auth provider that the user provided valid credentials\n\t\tself.auth_provider.auth_succeeded( req, username )\n\n\t\treturn username\n\tend",
"def authorized?\n @auth ||= Rack::Auth::Basic::Request.new(request.env)\n @auth.provided? &&\n @auth.basic? &&\n @auth.credentials &&\n check(@auth.credentials)\n end",
"def has_valid_signature?\n Adyen::HPP::Signature.verify(params, shared_secret)\n end",
"def valid?(auth_hash)\n return false if auth_hash[:email].blank? || auth_hash[:password].blank?\n user_dn = user_exists?(auth_hash[:email])\n ldap = auth_user user_dn, auth_hash[:password]\n ldap.bind\n rescue Net::LDAP::BindingInformationInvalidError\n false\n rescue Net::LDAP::LdapError\n false\n end",
"def has_signature?\n auth_info.include? \"signature\"\n end",
"def validate_hash(info)\r\n\t\t# passes in the parsed info\r\n\t\tstring_to_hash = get_string_to_hash(info)\r\n\t\tcorrect_hash = get_hash(string_to_hash)\r\n\t\t#puts string_to_hash\r\n\t\treturn correct_hash.strip == info['self_hash'].strip\r\n\tend",
"def check_params; true; end",
"def valid_response?\n return false unless response\n\n valid_hmac? && valid_amount? && valid_account?\n end",
"def check_params\n true\n end",
"def verify_authenticity_token; end",
"def authentication_ok?(token_verify_path)\n return false unless token\n return false unless token['access_token']\n return false unless token_verify_path\n\n final_path = token_verify_path.gsub(/\\:access\\_token/, token['access_token'])\n debug { \"Requesting user info from #{final_path}\" }\n request(path: final_path)\n true\n rescue => ex\n error { \"Authentication verification exception\" }\n error { ex }\n false\n end",
"def _verify\n unless (@_headers['x-allopass-response-signature'] || []).include?(@_signature)\n raise Allorails::ApiFalseResponseSignatureError\n end\n end",
"def verify_signature(data)\n Signature.valid?(data.merge('api_key' => api_key))\n end",
"def test_login\n if @auth!='' then\n result = do_request(json_obj('user.checkauth',\n {'sessionid'=>@auth}))\n if !result['result'] then\n @auth=''\n return false #auth hash bad\n end\n return true #auth hash good\n else\n return false\n end\n end",
"def valid_for_authentication?; end",
"def valid_for_authentication?; 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 validate_request(request)\n raise Errors::InvalidRequestError.new(\"Improperly formatted Request (expected `Hash', got `#{request.class}')\") unless request && request.is_a?(Hash)\n raise Errors::InvalidRequestError.new(\"Missing `method' Request object member\") unless request['method']\n end",
"def http_auth_hash; end",
"def validate_token_hash; end",
"def verification_hash_verified\n verified = false\n hash = VerificationHash.where(hash_value: params[:hash]).last\n verified = hash.verified if hash\n render json: { verified: verified }, status: 200\n end",
"def valid?\n unless @json.class == Hash\n return false\n end\n\n unless @json['method'].class == String\n return false\n end\n\n unless @json['params'].class == Array\n return false\n end\n\n return true\n end",
"def authorized?\n @auth ||= Rack::Auth::Basic::Request.new(request.env)\n user = ENV[\"HTTP_USER\"]\n pass = ENV[\"HTTP_PASS\"]\n @auth.provided? && @auth.basic? && @auth.credentials && @auth.credentials == [user, pass]\n end",
"def allow_params_authentication!; end",
"def require_hash!\n @obj.is_a?(Hash) || handle_error(nil, :invalid_type, \"expected hash object in #{param_name(nil)} but received array object\")\n end",
"def valid_hash?(h)\n self.class.valid_hash?(h)\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 verify_request(request)\n verify_signature(\n # url without query string\n request.protocol + request.host_with_port + request.path,\n # raw parameters\n request.get? ? request.query_string : request.raw_post\n )\n end"
] | [
"0.80493057",
"0.7553411",
"0.75525796",
"0.7208551",
"0.6998181",
"0.69931287",
"0.6787177",
"0.67319065",
"0.66606",
"0.66606",
"0.6657574",
"0.6556658",
"0.65482056",
"0.6526344",
"0.65260243",
"0.6518387",
"0.6516572",
"0.6493215",
"0.64548695",
"0.64542687",
"0.6447076",
"0.6447076",
"0.6439299",
"0.64162445",
"0.64136183",
"0.63989526",
"0.63629043",
"0.6356024",
"0.6345079",
"0.634395",
"0.63400537",
"0.63101137",
"0.62725747",
"0.6255463",
"0.6253767",
"0.62348884",
"0.62300926",
"0.6227625",
"0.6224638",
"0.619929",
"0.61832315",
"0.61828697",
"0.6168655",
"0.6160358",
"0.6132957",
"0.61190593",
"0.6111386",
"0.6101803",
"0.6090743",
"0.6063971",
"0.6048488",
"0.6043165",
"0.60308665",
"0.60261923",
"0.60192215",
"0.6018741",
"0.60099876",
"0.60065335",
"0.5984262",
"0.59805083",
"0.5967884",
"0.596618",
"0.59639716",
"0.594749",
"0.5941182",
"0.5937039",
"0.5937039",
"0.5937039",
"0.5937039",
"0.5936149",
"0.5930922",
"0.59263",
"0.59250456",
"0.59173495",
"0.5909713",
"0.5907857",
"0.58933145",
"0.5890582",
"0.58873236",
"0.5883625",
"0.58822715",
"0.5881898",
"0.5878989",
"0.5870967",
"0.586129",
"0.5855473",
"0.58458334",
"0.5843514",
"0.5843514",
"0.58320194",
"0.5830006",
"0.58242863",
"0.5823738",
"0.5816426",
"0.5815775",
"0.57981694",
"0.57914555",
"0.57831174",
"0.57796925",
"0.57774365",
"0.57765263"
] | 0.0 | -1 |
By default, a request is valid if the controller set the proper env variable. | def valid_params_request?; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?(request_env)\n\t\t\treturn false unless valid_fields?(request_env)\n\t\t\ttrue\n\t\tend",
"def valid_params_request?\n true\n end",
"def valid_params_request?\n true\n end",
"def validate_env!\n raise Kiwi::NotAcceptable,\n \"Invalid request format `#{@env['kiwi.mime']}'\" unless\n accept?(@env['kiwi.mime'])\n\n raise Kiwi::ResourceNotFound,\n \"No resource for `#{@env['kiwi.path']}'\" unless @env['kiwi.resource']\n end",
"def valid_params_request?\n !!env[\"devise.allow_params_authentication\"]\n end",
"def validate_source_of_request\n LogWrapper.log('DEBUG', {\n 'message' => \"Request sent to #{params['controller']}Controller#validate_source_of_request\",\n 'method' => 'validate_source_of_request',\n 'status' => \"start, Rails.env=#{Rails.env}, (Rails.env.test? || Rails.env.local?)=#{Rails.env.test? || Rails.env.local?}\",\n 'dataSent' => \"request.headers['X-API-Key']:#{request.headers['X-API-Key']}\"\n })\n\n redirect_to '/api/unauthorized' unless Rails.env.test? || Rails.env.local? || request.headers['X-API-Key'] == ENV['API_GATEWAY_HEADER_KEY']\n end",
"def request_allowed?(request)\n true\n end",
"def validate_request(env)\n parameters = extract_request_parameters\n\n validate_flow_presence!(parameters)\n validate_msisdn!(parameters)\n validate_session_id!(parameters)\n\n parameters\n end",
"def acceptable_request!(env)\n case Halcyon.config[:allow_from].to_sym\n when :all\n # allow every request to go through\n when :halcyon_clients\n # only allow Halcyon clients\n raise Exception::Forbidden.new unless env['USER_AGENT'] =~ /JSON\\/1\\.1\\.\\d+ Compatible \\(en-US\\) Halcyon::Client\\(\\d+\\.\\d+\\.\\d+\\)/\n when :local\n # do not allow for requests from an outside host\n raise Exceptions::Forbidden.new unless ['localhost', '127.0.0.1', '0.0.0.0'].member? env[\"REMOTE_ADDR\"]\n else\n logger.warn \"Unrecognized allow_from configuration value (#{Halcyon.config[:allow_from].to_s}); use all, halcyon_clients, or local. Allowing all requests.\"\n end\n end",
"def can_safely_access_request_parameters?\n @request.request_parameters\n end",
"def validate_request(request, session)\n unless @settings[:ssl_enabled] == false or ENV['RACK_ENV'] == 'development'\n if @settings[:ssl]\n # explicitly said :ssl => true\n raise SslRequired unless request.secure?\n elsif @settings.has_key?(:ssl)\n # explicitly said :ssl => false or :ssl => nil, so skip\n else\n # require SSL on anything non-GET\n raise SslRequired unless request.get?\n end\n end\n \n # Same thing for login_required, minus global flag\n if @settings[:login]\n # explicitly said :login => true\n raise LoginRequired unless session[:username]\n elsif @settings.has_key?(:login)\n # explicitly said :login => false or :login => nil, so skip\n else\n # require login on anything non-GET\n raise LoginRequired unless session[:username] || request.get?\n end\n end",
"def validrequest?(req)\n @stats.validated\n return true\n end",
"def env\n return super unless anycabled?\n\n request.env\n end",
"def local_request?\n true\n end",
"def validate_request\n binding.pry if $debug\n rejected_error = validate_method || validate_arguments\n if rejected_error\n reject\n #if public mode\n #kill\n #else\n respond_with_rejected_error(rejected_error)\n #end\n return false\n end\n accept\n true\n end",
"def routable_request?(env)\n return true unless defined?(Rails) # If not running on a Rails app, we can't verify if it is invalid\n Rails.application.routes.recognize_path(env['PATH_INFO'])\n true\n rescue ActionController::RoutingError\n false\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN']) || api_operator.present?\n end",
"def valid?(env)\n request = Rack::Request.new(env)\n unless (access_id = request.params['AccessKeyID'])\n #puts \"AccessKeyID not found in Params\"\n return false\n end\n unless (secret_key = @accounts[access_id])\n #puts \"No SecretKey found for AccessKeyID #{access_id.inspect}\"\n return false\n end\n AuthenticatedApi::Server.valid_signature?(request, secret_key)\n end",
"def valid_request?(request)\n request.post? && request.path == NOTIFY_PATH\n end",
"def local_request?\n true\n end",
"def request?\n !!request\n end",
"def transform_request?(env)\n @transform_request &&\n json_content_type?(env) &&\n env[ENV_RACK_INPUT_KEY] &&\n true # so the return value is true if all prior conditions are true\n end",
"def valid_request(h = {})\n h.merge!({:use_route => :sensit_api, :format => \"json\", :api_version => \"1\"})\n end",
"def local_request?\n false\n end",
"def local_request?\n false\n end",
"def local_request?\n false\n end",
"def validate_env\n validate_keys :circle_customer_session_token, :circle_cookie, :circle_customer_id, :circle_bank_account_id\n end",
"def setup_request\n @resource_name = params[:resource].singularize.camelize\n @resource_klass_name = \"Entity::#{@resource_name}\"\n \n begin \n # Check that resource is managed by this controller\n unless ACCEPTED_RESOURCES[@resource_name]\n raise NameError\n end\n \n # Get resource arity\n @resource_arity = ACCEPTED_RESOURCES[@resource_name][:arity] || 'collection'\n \n rescue NameError => e\n render json: { errors: process_errors([\"Unknown Resource\"], 400) }, status: :bad_request\n return false\n end\n \n true\n end",
"def valid?\n !Kontagent.configuration.base_url.nil? && !Kontagent.configuration.api_key.nil? && !Kontagent.configuration.secret_key.nil? \n end",
"def setup_request\n @resource_name = params[:resource]\n @resource_klass_name = \"Entity::#{@resource_name}\"\n \n begin \n # Check that resource is managed by this controller\n unless ACCEPTED_RESOURCES.include? @resource_name\n raise NameError\n end\n\n rescue NameError => e\n logger.info(\"ressource-name:\"+@resource_name)\n render json: { errors: process_errors([\"Unknown Resource\"], 400) }, status: :bad_request\n return false\n end\n \n true\n end",
"def validate_request(call)\n call.validate_request\n end",
"def valid_request_origin?; end",
"def verified_request?\r\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\r\n end",
"def valid_client?(request)\n (request.env[\"HTTP_X_FORWARDED_FOR\"] == \"127.0.0.1\") ||\n (request.env[\"HTTP_X_CLIENT_IDENTIFIER\"] == \"<< Client Identifier Here >>\") &&\n (request.env[\"HTTP_X_CLIENT_SECRET_KEY\"] == \"<< Secret Token Here >>\")\n end",
"def verified_request?\n\t\tsuper || form_authenticity_token == request.headers['X-XSRF-TOKEN']\n\tend",
"def rails_verify_authenticity_token\n controller = rails_controller.new\n controller.set_request! ActionDispatch::Request.new(scope.env)\n controller.send(:verify_authenticity_token)\n end",
"def verified_request?\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\n end",
"def verified_request?\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\n end",
"def verified_request?\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\n end",
"def verified_request?\n super || form_authenticity_token == request.headers['X-XSRF-TOKEN']\n end",
"def can_serve_request?(req)\n false\n end",
"def validate_request(request, request_resource_prefix)\n method = (request_resource_prefix + '_request').to_sym\n return send(method, request[0])\nend",
"def restrict_to_development\n head(:bad_request) unless ENV['RAILS_ENV'] == \"development\"\n end",
"def request_method\r\n@request_method ||= check_method(env[\"REQUEST_METHOD\"])\r\nend",
"def verified_request?\n\t\tsuper || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n\tend",
"def validate_keys\n return if Util::Configuration.is_valid?\n logger.error('==== Please set all environment variables before starting the server ====')\n exit\n end",
"def set_request\n @request = Request.find(params[:id])\n authorize @request\n end",
"def configure_environment\n\n=begin\n :: Expected Params ::\n \n Constants::REQUEST_PARAM_TEST => Server Mode (Is Production or Staging?) \n\n=end \n\n if params[Constants::REQUEST_PARAM_TEST].present?\n\n if params[Constants::REQUEST_PARAM_TEST] == \"1\"\n\n ENV[Constants::ENVIRONMENT_VAR_FOR_STAGING] = '1'\n\n else\n \n ENV.delete(Constants::ENVIRONMENT_VAR_FOR_STAGING) \n\n end \n\n end \n\n render json: {status: status_code(:ok), message: \"\", data: {:is_staging => (ENV[Constants::ENVIRONMENT_VAR_FOR_STAGING].present? ? 1 : 0)}}\n\n end",
"def local_request?\n LOCAL_REQUEST_ERROR\n end",
"def apply_request(request_env); end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def verified_request?\n super || valid_authenticity_token?(session, request.headers['X-XSRF-TOKEN'])\n end",
"def valid_request?\n if env.include_all?(['SSH_CLIENT', 'SSH_CONNECTION', 'SSH_ORIGINAL_COMMAND'])\n if valid_command?(env['SSH_ORIGINAL_COMMAND'])\n return true\n end\n end\n false\n end",
"def custom_get_request_with_params?\n request.method =~ /get/i && !%w(index show).include?(params[:action]) && !params.nil?\n end",
"def real_request?\n @real_request\n end",
"def allowed?(request)\n case\n when allow_path?(request) then true\n when allow_agent?(request) then true\n when whitelisted?(request) then true\n when blacklisted?(request) then false\n else nil # override in subclasses\n end\n end",
"def match!(env)\n return false unless @http_methods.include?(env[\"REQUEST_METHOD\"])\n return false unless @path =~ env[\"PATH_INFO\"]\n return false unless @host.nil? || @host =~ env[\"HTTP_HOST\"]\n\n true\n end",
"def development?\n @request.development?\n end",
"def verified_request?\n !protect_against_forgery? ||\n request.method == :get ||\n !verifiable_request_format? ||\n form_authenticity_token == params[request_forgery_protection_token]\n end",
"def matches?(request)\n check_headers(request.headers) || default\n end",
"def need_protection?(request)\n request.params.has_key?('access_token')\n end",
"def call(request)\n @constraints.all? { |key, val| request.send(key).include? val }\n end",
"def env\n @_request.env\n end",
"def setup_env_params\n {\n url: @request.respond_to?(:original_url) ? @request.original_url : @request.path_info,\n referrer: @request.referer,\n http_method: action_dispatch? ? @request.method : @request.request_method,\n ip_address: @request.respond_to?(:remote_ip) ? @request.remote_ip : @request.ip,\n user_agent: @request.user_agent\n }\n end",
"def request # :doc:\n @request ||= begin\n environment = Rails.application.env_config.merge(env) if defined?(Rails.application) && Rails.application\n ActionDispatch::Request.new(environment || env)\n end\n end",
"def request_from_pdfkit?\n request.env[\"Rack-Middleware-PDFKit\"] == \"true\"\n end",
"def valid_api_key?(api_header_val, api_key_lookup_val, env)\n !api_header_val.nil? && api_header_val != '' &&\n !api_key_lookup_val.nil? && api_key_lookup_val != ''\n end",
"def default_auth_request?\n @parser.http_method == \"POST\" && @parser.request_url == \"/zimbra/\" && @headers[\"Cookie\"] = \"ZM_TEST=true\" && auth_request_params?\n end",
"def fulfill_params\n params.fetch(:request, {}).permit(:status)\n end",
"def valid_token?\n env['HTTP_TOKEN']\n end",
"def verified_request?\n !protect_against_forgery? ||\n request.method == :get ||\n request.xhr? ||\n !verifiable_request_format? ||\n form_authenticity_token == params[request_forgery_protection_token]\n end",
"def missing_csrf_token?(req, *)\n Hanami::Utils::Blank.blank?(req.params[CSRF_TOKEN])\n end",
"def setup_request_environment(controller_class)\n controller_class.class_eval do\n def rescue_action(e)\n raise e\n end\n end\n @controller = controller_class.new\n @controller.request = @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n \n @controller.params = {}\n @controller.send(:initialize_current_url)\n end",
"def from_env\n ENV_VARS.any? { |key| @env.key?(key) } || NoValue\n end",
"def set_request\n @request = Request.accessible_by(current_ability).find(params[:id])\n end",
"def valid?\n env_keys.all? { |k| env.key?(k) }\n end",
"def local_request?()\n return true if %w( development test ).include?(Rails.env)\n local = %w( 0.0.0.0 127.0.0.1 localhost localhost.localdomain )\n local.include?(request.remote_addr) and local.include?(request.remote_ip)\n end",
"def local_request?()\n return true if %w( development test ).include?(Rails.env)\n local = %w( 0.0.0.0 127.0.0.1 localhost localhost.localdomain )\n local.include?(request.remote_addr) and local.include?(request.remote_ip)\n end",
"def test( request )\n constraints.all? do | key, val |\n if val.nil? or val == true\n true\n else\n if val.respond_to? :call\n val.call( request )\n else\n val == request.send( key ) or val === request.send( key ) or request.send( key ) === val\n end\n end\n end\n end",
"def check_env(env)\n expect(env.url.scheme).to eq('https')\n expect(env.url.host).to eq('api.com')\n expect(env.request.open_timeout).to eq(5)\n expect(env.request.timeout).to eq(10)\n expect(env.request_headers).to eq(\"Authorization\"=>\"Bearer secret\", \"User-Agent\"=>\"Rspec Tests\")\n end",
"def valid_request?\n signature = github_signature\n my_signature = 'sha1=' + OpenSSL::HMAC.hexdigest(\n OpenSSL::Digest.new('sha1'),\n ENV['GITHUB_WEBHOOK_SECRET'],\n github_payload_raw\n )\n\n json_response(json_access_denied, :unauthorized) unless Rack::Utils.secure_compare(my_signature, signature)\n rescue StandardError => e\n msg = \"#{self.class}##{__method__} An error occurred while determine if request is valid\"\n Rails.logger.error(\n message: msg,\n exception: e\n )\n\n json_response(json_access_denied(errors: { message: \"#{msg}, exception: #{e.message}\" }), :unauthorized)\n end",
"def valid_for_params_auth?; end",
"def cannot_use_subdomain?\n (Rails.env.test? or Rails.env.development?) and request.host == '127.0.0.1'\n end",
"def preconditions_met?\n # tracked_request.root_layer is nil for Rack apps ... unsure why.\n return false unless tracked_request.root_layer\n\n Auth.permitted?\n end",
"def verified_request?\n\t\t!protect_against_forgery? || request.get? ||\n\t\t\tform_authenticity_token == params[request_forgery_protection_token] || form_authenticity_token == request.headers['X-CSRF-Token'] ||\n\t\t\trequest.headers['X-XSRF-Token'] && form_authenticity_token == request.headers['X-XSRF-Token'].gsub!(/\\A\"|\"\\Z/, '')\n\tend",
"def test_environment_valid?\n return true unless @environment == \"test\"\n !!@test_url\n end"
] | [
"0.69372934",
"0.68201685",
"0.68201685",
"0.67595947",
"0.6556469",
"0.64326775",
"0.640171",
"0.6392905",
"0.6386403",
"0.62606514",
"0.61949664",
"0.60908777",
"0.6041075",
"0.59896564",
"0.59839994",
"0.5976279",
"0.59422946",
"0.59338856",
"0.5909128",
"0.5905597",
"0.5878537",
"0.5861024",
"0.5858699",
"0.5853269",
"0.5853269",
"0.5853269",
"0.58427846",
"0.5823869",
"0.5817704",
"0.58160025",
"0.5814573",
"0.5814543",
"0.5810636",
"0.58066106",
"0.5787245",
"0.5774397",
"0.5769532",
"0.5769532",
"0.5769532",
"0.5769532",
"0.5757254",
"0.5754652",
"0.57529414",
"0.57526463",
"0.57526106",
"0.57457113",
"0.57438713",
"0.57362926",
"0.57288253",
"0.57071316",
"0.5705741",
"0.5705741",
"0.5705741",
"0.5679458",
"0.5679458",
"0.5679458",
"0.5679458",
"0.5679458",
"0.5679458",
"0.5679458",
"0.5679458",
"0.5679458",
"0.5679458",
"0.5679458",
"0.5679458",
"0.5679458",
"0.5656474",
"0.56448686",
"0.56294787",
"0.56251657",
"0.5622154",
"0.5608838",
"0.5604797",
"0.55956465",
"0.55931383",
"0.55871993",
"0.5584207",
"0.5573531",
"0.5569061",
"0.55586666",
"0.55577314",
"0.5555701",
"0.5551538",
"0.5544954",
"0.55369824",
"0.5527808",
"0.5518788",
"0.55177385",
"0.5515975",
"0.5514154",
"0.5505714",
"0.5505714",
"0.54969734",
"0.5494514",
"0.548927",
"0.5487618",
"0.5480396",
"0.54795545",
"0.54719734",
"0.5471776"
] | 0.6477198 | 5 |
Note: unlike `Model.valid_password?`, this method does not actually ensure that the password in the params matches the password stored in the database. It only checks if the password is present. Do not rely on this method for validating that a given password is correct. | def valid_password?; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def valid_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def valid_password?(password)\n true\n end",
"def valid_password?(password); end",
"def valid_password?\n password.present?\n end",
"def valid_password?\n password.present?\n end",
"def validate_password?\n password.present?\n end",
"def valid_password?(password)\n if self.legacy_password_hash.present?\n if ::Digest::MD5.hexdigest(password).upcase == self.legacy_password_hash.upcase\n self.password = password\n self.legacy_password_hash = nil\n self.save!\n true\n else\n false\n end\n else\n super\n end\n end",
"def needs_password?(_user, params)\n params[:password].present?\n end",
"def is_valid_password?(password)\n\t\tself.password == BCrypt::Engine.hash_secret(password, self.password)\n\tend",
"def valid_password?(password)\n if self.respond_to?('legacy_password_hash') && self.legacy_password_hash.present?\n if BCrypt::Password.new(self.legacy_password_hash) == password\n self.password = password\n self.legacy_password_hash = nil\n self.save!\n true\n else\n false\n end\n else\n super\n end\n end",
"def correct_password?(params)\n current_password = params[:user][:current_password]\n password == current_password\n end",
"def correct_password?(params)\n current_password = params[:user][:current_password]\n password == current_password\n end",
"def correct_password?(params)\n self.current_password = params[:user][:current_password]\n self.password == self.current_password\n end",
"def valid_password? password\r\n self.password === Digest::MD5.hexdigest(password)[0..19]\r\n end",
"def valid_password?(password)\n begin\n super(password)\n rescue BCrypt::Errors::InvalidHash\n type, salt, enc_pass = encrypted_password.split('$')\n Digest::SHA1.hexdigest(\"#{salt}#{password}\") == enc_pass\n end\n end",
"def correct_password?(params)\n current_password=params[:user][:current_password]\n password == current_password\n end",
"def is_password?(password)\n BCrypt::Password.new(self.password_digest) == password\n end",
"def valid_password?(plain)\n password == hash_crypt(plain.to_s) \n end",
"def is_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def is_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def validate_password?(plain_password)\n unless salt.nil?\n encrypt(plain_password, salt) == self.password\n else\n false\n end\n end",
"def valid_password?\r\n self.errors.push [:password, \"cannot be blank\"] if plain_password.blank?\r\n self.errors.push [:password, \"does not match\"] if plain_password != confirm_password\r\n \r\n if self.errors.present?\r\n false\r\n else\r\n require 'digest'\r\n self.password = Digest::MD5.hexdigest(plain_password)\r\n true\r\n end\r\n end",
"def check_create_user_password_is_valid\n return self.password != \"\" ? true : false\n end",
"def password_match? password\n\t\tBCrypt::Password.new(@password) == password\n\tend",
"def has_password?(submitted_password)\n self.password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n password == encrypt(submitted_password)\n end",
"def is_password?(password)\n BCrypt::Password.new(password_digest).is_password?(password)\n end",
"def should_validate_password?\n self.encrypted_password.nil? || !self.password.nil?\n end",
"def valid_password?(password)\n return false if encrypted_password.blank?\n bcrypt = ::BCrypt::Password.new(encrypted_password)\n password = ::BCrypt::Engine.hash_secret(\"#{password}#{self.class.pepper}\", bcrypt.salt)\n Devise.secure_compare(password, encrypted_password)\n end",
"def valid_pass?(test_pass)\n Encrypt::Password.validatePassword test_pass, password\n end",
"def check_password(password_provided)\n BCrypt::Engine.hash_secret(password_provided, self.password_salt) == self.password\n end",
"def correct_password?(params)\n current_password = params[:pd_user][:current_password]\n return (password == current_password)\n end",
"def has_password?(password)\n user_password = self.password_digest\n encrpyted_password = BCrypt::Password.new(user_password)\n encrpyted_password.is_password?(password)\n end",
"def valid_for_authentication?(attributes)\n valid_password?(attributes[:password])\n end",
"def has_password? (submitted_password)\n password_digest == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n valid_password?(submitted_password)\n end",
"def check_password(password, hash)\n BCrypt::Password.new(hash) == password\n end",
"def needs_password?(user, params)\n if params[:user][:password]\n !params[:user][:password].blank?\n end\n end",
"def matching_password?(pass)\n self.password_hash == encrypt_password(pass)\n end",
"def valid_password?(password)\n bcrypt = BCrypt::Password.new(encrypted_password)\n password = BCrypt::Engine.hash_secret(\"#{password}#{PEPPER}\", bcrypt.salt)\n self.class.secure_compare(password, encrypted_password)\n end",
"def needs_password?(user, params)\n params[:user][:password].present?\n end",
"def valid_password?(password)\n return false if encrypted_password.blank?\n bcrypt = ::BCrypt::Password.new(encrypted_password)\n password = ::BCrypt::Engine.hash_secret(password, bcrypt.salt)\n secure_compare(password, encrypted_password)\n end",
"def password_valid?\n\t\tif self.password == nil\n\t\t\treturn false\n\t\telsif self.password.length < MIN_PW_LENGTH || self.password.length > MAX_CREDENTIAL_LENGTH\n\t\t\treturn false\n\t\tend\n\t\ttrue\n\tend",
"def is_password?(password)\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def is_password(password)\n BCrypt::Password.new(password_digest).is_password?(password)\n end",
"def valid_password?(password)\n V1::Auth::Encryptor.compare(encrypted_password, password)\n end",
"def needs_password?(user, params)\n user.email != params[:email] ||\n params[:password].present?\n end",
"def is_password?(password)\n obj = Password.new(self.password_digest)\n obj.is_password?(password)\n end",
"def valid_password?(password)\n begin\n super(password)\n rescue BCrypt::Errors::InvalidHash\n sha1_password = Digest::SHA1.hexdigest(\"--#{password_salt}--#{password}--\")\n return false unless sha1_password == encrypted_password\n logger.info \"User #{email} is using the old password hashing method, updating attribute.\"\n self.password = password # = BCrypt::Password.create(sha1_password)\n true\n end\n end",
"def validates_password\n if user_password.blank? && password.blank?\n errors.add(:user_password, 'empty.password')\n elsif user_password.blank? && !password.blank? && password != password_verify\n errors.add(:user_password, 'invalid.password')\n elsif user_password.blank? && !password.blank? && password == password_verify\n self['user_password'] = password\n end\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?( submitted_password )\n encrypted_password == encrypt( submitted_password )\n end",
"def is_password?(password)\n # is_password? is a BCrypt method\n BCrypt::Password.new(self.password_digest).is_password?(password)\n end",
"def valid_password?(pass)\n crypted = send(sorcery_config.crypted_password_attribute_name)\n return crypted == pass if sorcery_config.encryption_provider.nil?\n\n # Ensure encryption provider is using configured values\n self.class.set_encryption_attributes\n\n salt = send(sorcery_config.salt_attribute_name) unless sorcery_config.salt_attribute_name.nil?\n\n sorcery_config.encryption_provider.matches?(crypted, pass, salt)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n #compare encrypted_password with the encrypted version of submitted password.\n password == submitted_password\n end",
"def password_required?\n self.crypted_password.blank? || !self.password.blank?\n end",
"def validate_password?\n password.present? || password_confirmation.present?\n end",
"def validate_password?\n new_record? || password.present? || password_confirmation.present?\n end",
"def has_password?(submitted_password)\r\n encrypted_password == encrypt(submitted_password)\r\n end",
"def valid_password?(unhashed_password)\n\t # Note: BCryptHash \"overloads\" the == operator, so we're actually\n\t # comparing a BCrypt-hashed copy of unhashed_password to the hashed\n \t # copy stored in our database.\n \tself.password == unhashed_password\n end",
"def validate_password?\n active? && (password_hash.blank? || password.present? || password_required)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(password)\n encrypted_password == encrypt(password)\n end",
"def match_password(login_password=\"\")\n password == BCrypt::Engine.hash_secret(login_password, salt)\n end",
"def verify_password(password)\n hash_password(password) == @password_hash\n end",
"def valid_password?(password)\n Authentication::Encryptor.compare(self.encrypted_password, password)\n end",
"def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end",
"def password_match?(password=\"\")\n hashed_password == User.hash_with_salt(password, salt)\n end",
"def has_password?(submitted_password)\n self.encrypted_password == encrypt(submitted_password)\n end",
"def is_password?(password_attempt)\n BCrypt::Password.new(password_digest).is_password?(password_attempt)\n end",
"def valid_password?(incoming_password)\n password_digest(incoming_password) == self.encrypted_password\n end",
"def should_validate_password?\n if self.crypted_password_changed?\n return true\n elsif self.force_password_validation\n return true\n else\n return false\n end\n end",
"def valid_password?(password)\n if legacy_password?\n # Use Devise's secure_compare to avoid timing attacks\n return false unless Devise.secure_compare(encrypted_password,\n User.legacy_password(password))\n\n self.attributes = { password: password,\n password_confirmation: password,\n legacy_password: false }\n\n save!\n end\n\n super password\n end",
"def valid_password?(password)\n return false if encrypted_password.blank?\n bcrypt = ::BCrypt::Password.new(encrypted_password)\n # check with the pepper\n spicy_password = ::BCrypt::Engine.hash_secret(\"#{password}#{self.class.pepper}\", bcrypt.salt)\n if Devise.secure_compare(spicy_password, encrypted_password)\n return true\n end\n\n # check without the pepper\n mild_password = ::BCrypt::Engine.hash_secret(password, bcrypt.salt)\n if Devise.secure_compare(mild_password, encrypted_password)\n # save the spicy password\n update_attribute(:encrypted_password, spicy_password)\n return true\n end\n\n return false\n end",
"def needs_password?(user, params)\n #user.email != params[:user][:email] ||\n params[:user][:password].present?\n end",
"def valid_password?(password)\n return false if encrypted_password.blank?\n bcrypt = ::BCrypt::Password.new(encrypted_password)\n # check with the pepper\n spicy_password = ::BCrypt::Engine.hash_secret(\"#{password}#{self.class.pepper}\", bcrypt.salt)\n if Devise.secure_compare(spicy_password, encrypted_password)\n return true\n end\n\n # check without the pepper\n mild_password = ::BCrypt::Engine.hash_secret(password, bcrypt.salt)\n if Devise.secure_compare(mild_password, encrypted_password)\n # save the spicy password\n self.update_attribute(:encrypted_password, spicy_password)\n return true\n end\n\n return false\n end",
"def validate_password(password)\n return false unless password != nil\n if password.length < 4 || password.length > 19\n return false\n end\n return true\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def has_password?(submitted_password)\n encrypted_password == encrypt(submitted_password)\n end",
"def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end",
"def password_match?(password=\"\")\n hashed_password == AdminUser.hash_with_salt(password, salt)\n end",
"def valid_password?(password)\n if !(BCrypt::Password.new(self.password) == password)\n errors.messages[\"login\"] = \"Login Failed.\"\n end\n return errors.messages.empty?\n end",
"def auth_pass(password)\n BCrypt::Password.create(password) == self.hash_pass\n end",
"def has_password?(submitted_password)\n\tpassword == encrypt(submitted_password) \n end",
"def password_required?\n !password.nil?\n end"
] | [
"0.8144988",
"0.8144988",
"0.8140854",
"0.81204224",
"0.80736935",
"0.80736935",
"0.8039408",
"0.79249763",
"0.7898306",
"0.78954124",
"0.7869759",
"0.78654706",
"0.78654706",
"0.7862066",
"0.78407353",
"0.7826359",
"0.7796755",
"0.7791233",
"0.7710866",
"0.769379",
"0.769379",
"0.76856196",
"0.76851946",
"0.7670123",
"0.76668835",
"0.7660635",
"0.7656584",
"0.7635213",
"0.76309997",
"0.76259017",
"0.76217264",
"0.76145244",
"0.7614034",
"0.76121444",
"0.7607255",
"0.75990546",
"0.75794774",
"0.75745225",
"0.75738996",
"0.756059",
"0.75542253",
"0.75466216",
"0.75069547",
"0.75063974",
"0.750429",
"0.7498212",
"0.74973255",
"0.7496463",
"0.74956614",
"0.7491445",
"0.7490289",
"0.7486521",
"0.7486521",
"0.7486521",
"0.7486521",
"0.7486521",
"0.7486521",
"0.7486521",
"0.7486521",
"0.7486521",
"0.7486521",
"0.7486521",
"0.7486521",
"0.7486521",
"0.74789274",
"0.74636143",
"0.74619067",
"0.74554425",
"0.74554425",
"0.7454526",
"0.7453319",
"0.7453042",
"0.7447616",
"0.74442875",
"0.7442405",
"0.7427829",
"0.741533",
"0.7414926",
"0.74146515",
"0.7412801",
"0.7408527",
"0.7408219",
"0.7408219",
"0.73879045",
"0.7381975",
"0.73818177",
"0.7379979",
"0.73765576",
"0.73759943",
"0.7374405",
"0.7374296",
"0.7360773",
"0.73601145",
"0.73601145",
"0.73589647",
"0.73589647",
"0.73574287",
"0.7355968",
"0.7350776",
"0.73361725"
] | 0.7592447 | 36 |
Receives a resource and check if it is valid by calling valid_for_authentication? A block that will be triggered while validating can be optionally given as parameter. Check Devise::Models::Authenticatable.valid_for_authentication? for more information. In case the resource can't be validated, it will fail with the given unauthenticated_message. source://devise//lib/devise/strategies/authenticatable.rb37 | def validate(resource, &block); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(resource, &block)\n result = resource && resource.valid_for_authentication?(&block)\n\n if result\n true\n else\n if resource\n fail!(resource.unauthenticated_message)\n end\n false\n end\n end",
"def validate(resource, &block)\n result = resource && resource.valid_for_authentication?(&block)\n\n case result\n when Symbol, String\n fail!(result)\n else\n result\n end\n end",
"def resource_valid_for_authentication?\n @resource.respond_to?(:valid_for_authentication?) && @resource.valid_for_authentication? { valid_password? }\n end",
"def valid_for_authentication?; end",
"def valid_for_authentication?; 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 valid_for_authentication?\n block_given? ? yield : true\n end",
"def valid_for_api_authentication?(password=nil)\n # the valid_for_authentication? method is defined in Devise's models/authenticatable.rb and overloaded in models/lockable.rb\n # passed block will only run if user is NOT locked out\n valid_for_authentication? do\n # check if password is correct\n valid_password?(password) \n end\n end",
"def validate(resource)\n result = resource && (Devise.captcha_for_sign_in || verify_recaptcha)\n\n if result\n true\n else\n fail!(resource.ip_unauthenticated_message) if resource\n false\n end\n end",
"def valid_for_api_authentication?(password=nil)\n # the valid_for_authentication? method is defined in Devise's models/authenticatable.rb\n valid_for_authentication? do\n # check if password is correct\n valid_password?(password)\n end\n end",
"def authenticate!\n current_user ? true : raise(Pundit::NotAuthorizedError)\n end",
"def authenticate_user!\n unless current_user?\n render status: :unauthorized\n end\n end",
"def validate_authentication_token\n \n @user = User.find_by_services_authentification_token(params[:auth_token])\n bad_request if @user.nil?\n end",
"def authenticate_user\n render_403 'Invalid user.' if @user.blank? || [email protected]?\n end",
"def validate_user_authorization\n user = User.find_by_id(params[:id])\n require_valid_user user\n end",
"def authenticate_user\n if current_user\n true\n else\n raise Exceptions::AuthorizationError.new('invalid user authorization')\n end\n end",
"def check_authentication\n authenticate_user\n end",
"def authenticate_user_devise!\n raise Errors::AuthorizationError, 'Token authentication is not correct' unless current_user_devise\n end",
"def authenticate!\n raise AuthenticationFailed if authentication.failed?\n raise AuthenticationRequired unless authentication.authenticated?\n end",
"def authenticate\n authenticate_token || render_unauthorized\n end",
"def authenticate_inviter!\n send(:\"authenticate_#{resource_name}!\")\n end",
"def authenticate_user\n\t\trender_unauthorized unless current_user\n\tend",
"def authenticate\n unauthorized unless current_user\n end",
"def authenticate_user!\n \tunless current_user?\n \trender status: :unauthorized\n \tend\n end",
"def create\n resource = nil\n caught = catch(:warden) do\n resource = warden.authenticate!(auth_options)\n end\n\n if resource\n # User is confirmed\n self.resource = resource\n set_flash_message(:notice, :signed_in) if is_flashing_format?\n sign_in(resource_name, resource)\n yield resource if block_given?\n @resource = resource\n elsif caught and caught[:message] == :not_approved\n # User is unconfirmed\n @resource = \"not_approved\"\n else\n # User is not signed in\n @resource = \"invalid\"\n end\n respond_to :html, :js\n end",
"def authenticate\n authenticate_token || render_unauthorized\n end",
"def authenticate!\n unauthorized! unless current_user\n end",
"def verify_on_current_user\n render_401 unless params[:id].to_i == current_user.id\n end",
"def authenticate\n \n authenticate_token || render_unauthorized\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_target!\n current_resource = find_current_target\n reject unless @target.authenticated_with_devise?(current_resource)\n rescue\n reject\n end",
"def authenticate\n if signed_in? == false\n flash.now[:error] = \"User not logged in.\"\n respond_with(flash)\n end\n end",
"def authenticate_user!\n raise NotAuthorizedError unless user_logged_in?\n end",
"def rails_authenticate\n self.resource = warden.authenticate!(auth_options)\n set_flash_message(:notice, :signed_in) if is_flashing_format?\n sign_in(resource_name, resource)\n\n yield resource if block_given?\n respond_with resource, location: after_sign_in_path_for(resource)\n end",
"def validate(credentials)\n begin\n $LOG.debug(\"Starting Active Resource authentication\")\n result = Helpers::Identity.authenticate(credentials.except(:request))\n extract_extra_attributes(result) if result\n !!result\n rescue ::ActiveResource::ConnectionError => e\n if e.response.blank? # band-aid for ARes 2.3.x -- craps out if to_s is called without a response\n e = e.class.to_s\n end\n $LOG.warn(\"Error during authentication: #{e}\")\n false\n end\n end",
"def authenticate_user!\n unless @current_user\n head :unauthorized\n end\n end",
"def authenticate_user\n unauthorized unless current_user\n end",
"def authenticate\n authed = true\n if(resource.respond_to?(:authenticate, true))\n authed = false\n uname = nil\n password = nil\n if(request.env['HTTP_AUTHORIZATION'])\n auth = Rack::Auth::Basic::Request.new(request.env)\n if(auth.basic? && auth.credentials)\n uname = auth.credentials[0]\n password = auth.credentials[1]\n end\n end\n authed = resource.send(:authenticate, uname, password)\n end\n raise Unauthorized unless authed\n end",
"def valid_for_oauth2(resource, attributes)\n true\n end",
"def authenticate_with_response\n render nothing: true, status: 401 if current_user.nil?\n end",
"def authenticate!\n if resource = mapping.to.authenticate_with_crowd(params[scope])\n success!(resource)\n else\n fail(:invalid)\n end\n end",
"def validate(resource, context_name)\n context(context_name).validate(resource)\n end",
"def authenticate_request\n if auth_token_expired?\n fail AuthenticationTimeoutError\n elsif !@current_user\n fail NotAuthenticatedError\n end\n end",
"def authenticate_request\n if auth_token_expired?\n fail AuthenticationTimeoutError\n elsif !@current_user\n fail NotAuthenticatedError\n end\n end",
"def authenticate_request\n if auth_token_expired?\n fail AuthenticationTimeoutError\n elsif !@current_user\n fail NotAuthenticatedError\n end\n end",
"def authenticate_current_user\n raise_not_authorized_error unless current_user\n end",
"def authenticate_user!\n unless current_user\n render :json => {'error' => 'authentication error'}, :status => 401\n end\n end",
"def authenticate(attributes={})\n return unless authentication_keys.all? { |k| attributes[k].present? }\n conditions = attributes.slice(*authentication_keys)\n resource = find_for_authentication(conditions)\n resource if resource.try(:valid_for_authentication?, attributes)\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 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_user_from_token!\n # user_id = params[:user_id].presence\n # user = user_id && User.find(user_id)\n # api_token = params[:api_token] || env['HTTP_API_TOKEN']\n # if user && Devise.secure_compare(user.api_token, api_token)\n # sign_in user, store: false and return\n # end\n\n # render_error({ :error => \"Please sign in first.\" })\n end",
"def authenticate!\n raise error!({meta: {code: RESPONSE_CODE[:unauthorized], message: I18n.t(\"errors.not_authenticated\"), debug_info: ''}}, RESPONSE_CODE[:unauthorized]) unless current_user\n end",
"def authenticate\n authenticate_token || render_unauthorized\nend",
"def authenticate_user!(options = {})\n head :unauthorized unless signed_user_in?\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 create\n begin\n self.resource = warden.authenticate!(auth_options)\n set_flash_message!(:notice, :signed_in)\n sign_in(resource_name, resource)\n yield resource if block_given?\n respond_to do |format|\n format.html {respond_with resource, location: after_sign_in_path_for(resource)}\n format.json { \n render json: {success: true, error: false, message: \"User is successfully logged in\", results: resource}, status: 200\n }\n end\n rescue Exception => e\n render json: {success: false, error: true, message: e}, status: 500\n end\n end",
"def authenticate!\n user_id = get_user_id_from_token\n if user_id\n @current_user = User.find(user_id)\n else\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end\n rescue JWT::ExpiredSignature\n render json: { errors: ['Authentication Timeout'] }, status: 419\n rescue JWT::VerificationError, JWT::DecodeError\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end",
"def authenticate!\n last_ticket = session[:cas_last_valid_ticket]\n ticket = read_ticket(params)\n\n if ticket\n if resource = mapping.to.authenticate_with_cas_ticket(ticket)\n session[:cas_devise_resouce_name] = mapping.class_name\n session[:cas_last_valid_ticket] = ticket\n success!(resource)\n else\n fail(:invalid)\n end\n elsif returning_from_cas?\n fail(:invalid)\n else\n redirect!(login_url)\n end\n end",
"def authenticate\n deny_access unless signed_in?\n end",
"def authenticate\n deny_access unless signed_in?\n end",
"def authenticate\n deny_access unless signed_in?\n end",
"def authenticate\n deny_access unless signed_in?\n end",
"def authenticate\n deny_access unless signed_in?\n end",
"def authenticate\n\t\tdeny_access unless signed_in?\n\tend",
"def authenticate\n logged_in? || access_denied\n end",
"def authenticate\n\t\tauthenticate_token || render_unauthorized\n\tend",
"def authenticate\n redirect_to login_path, alert: \"You must be authenticated\" if !current_account\n end",
"def authenticate\n render json: { error: 'Access Denied' }, status: 401 unless current_user\n end",
"def authenticate!\n if current_identity\n true\n else\n respond_to do |format|\n format.html do\n store_location\n redirect_to main_app.new_session_path\n end\n format.json do\n render status: 403, nothing: true\n end\n end\n end\n end",
"def authenticate\n deny_access unless signed_in?\n end",
"def authenticate\n deny_access unless signed_in?\n end",
"def authenticate\n authorize || unauthorized\n end",
"def authorization_check\n raise Errors::UnauthorizedError.new unless current_user.present?\n end",
"def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end",
"def valid_for_http_auth?; end",
"def authenticate\n # return if unauthorized?\n\n # render json: {\n # message: I18n.t('api.v1.error_messages.unauthorized')\n # }, status: :unauthorized\n end",
"def authenticate\n deny_access unless signed_in? \n end",
"def authenticate\n deny_access unless signed_in?\n end",
"def resource_active_for_authentication?\n [email protected]_to?(:active_for_authentication?) || @resource.active_for_authentication?\n end",
"def authenticate_user!\n return if current_user\n render json: json_message(errors: 'Acceso denegado. Por favor ingresa.'), status: 401\n end",
"def authenticate!\n if resource = mapping.to.fb_authenticate(params[scope])\n success!(resource)\n else\n redirect!(\"/#{scope.to_s.pluralize}/facebook_connect_create\", params)\n end\n end",
"def authenticate\n logged_in? || access_denied\n end",
"def authenticate!\n resource = mapping.to.where(:username => authentication_hash[:email]).first if authentication_hash\n resource ||= mapping.to.new if resource.nil?\n\n username = authenticate_against_ebay(authentication_hash[:email], password)\n\n if username\n resource.username = username\n resource.password = password\n resource.password_confirmation = password\n resource.save if resource.changed?\n end\n\n return fail(:invalid) unless username and resource\n\n if validate(resource) { not resource.nil? }\n success!(resource)\n end\n end",
"def require_authentication\n render_failed_auth_response unless authentication_successful? # render a 401 error\n end",
"def authenticate_user!(options = {})\n head :unauthorized unless signed_in?\n end",
"def accept_authenticity\n authenticate_with_http_basic do |email, password|\n user = User.find_by(email: email, provider: 'pagehub')\n\n if user && user.valid_password?(password)\n @current_user = user\n end\n end\n\n warden.custom_failure! if performed?\n\n halt! 401 unless current_user.present?\n verify_authenticity_token unless otr_api_call?\n end",
"def verify_current_user\n instance_variable_set '@' + resource_name, resource.find_by_id(params[:id])\n if resource_instance.nil?\n flash[:error] = \"Cannot find the requested record.\"\n redirect_to(action: 'index') && return\n else\n unless auth_user.is_a?(Parent) # Perhaps rule might change, so child could edit\n flash[:error] = \"You do not have permission to access this.\"\n redirect_to(action: 'index') && return\n else\n\n # Avoid hack to change address of someone else's\n if params[resource_param_name].is_a?(Hash)\n params[resource_param_name].delete(:user_id)\n params[resource_param_name].delete('user_id')\n end\n end\n end\n end",
"def authenticate!\n not_authorized() unless logged_in?()\n end",
"def authenticate_request\n if auth_token_expired?\n fail AuthenticationTimeoutError\n elsif !@current_user\n render json: { error: \"401\" }, status: :unauthorized\n end\n end",
"def authenticate?\n booking_ambassador.try(:authenticate_user?)\n end",
"def validate(resource)\n raise Error::AbstractMethod.new(method: \"Validators::Base#validate\")\n end",
"def verify_auth_token\n halt 401 unless valid_user?(extracted_token)\n end",
"def authenticate_user\n if not params.has_key?(:auth_token)\n failure\n return\n end\n @current_user = User.find_by_authentication_token(params[:auth_token])\n # Adding the conditional to throw json error\n unless @current_user\n failure\n end\n end",
"def handle_response!\n logger.debug \"Attempting OpenID auth: #{provider_response.inspect}\"\n\n case provider_response.status\n when :success\n resource = find_resource || build_resource || create_resource\n\n if resource && validate(resource)\n begin\n update_resource!(resource)\n rescue\n fail! $!\n else\n success!(resource)\n end\n else\n fail! \"This OpenID URL is not associated with any registered user\"\n end\n\n when :cancel\n fail! \"OpenID authentication cancelled\"\n when :failure\n fail! \"OpenID authentication failed\"\n end\n end",
"def has_authentication(&block)\n attr_reader :password\n attr_accessor :password_confirmation\n\n SimpleAuth.setup(&block)\n\n before_save :encrypt_password, :if => :validate_password?\n after_save :erase_password\n\n validates_presence_of :password, :if => :validate_password?\n validates_length_of :password, :if => :validate_password?, :minimum => 4, :allow_blank => true\n validates_presence_of :password_confirmation, :if => :validate_password?\n validates_confirmation_of :password, :if => :validate_password?\n end",
"def authenticate\n redirect_to login_url, alert: 'Please log in first' if current_user.nil?\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n set_flash_message!(:notice, :signed_in)\n sign_in(resource_name, resource)\n yield resource if block_given?\n respond_with resource, location: after_sign_in_path_for(resource)\n # super\n end",
"def authenticate\n\tdeny_access unless signed_in?\n end",
"def authenticate\n \n authenticate_or_request_with_http_token do |token|\n begin\n decoded = decode(token)\n @current_user = User.find_by(id: decoded[0][\"user_id\"]) \n \n rescue JWT::DecodeError\n render json: {authorized: false }, status: 401 \n end\n end \n end",
"def update\n resource.extend(Devise::Models::DatabaseAuthenticatablePatch)\n resource.update_with_password(resource_params)\n\n yield resource if block_given?\n\n if resource.errors.empty?\n warden.session(scope)['password_expired'] = false\n set_flash_message :notice, :updated\n bypass_sign_in resource, scope: scope\n respond_with({}, location: after_password_expired_update_path_for(resource))\n else\n clean_up_passwords(resource)\n respond_with(resource, action: :show)\n end\n end"
] | [
"0.8118112",
"0.7922703",
"0.7012449",
"0.69098693",
"0.69098693",
"0.68331814",
"0.6747219",
"0.6558135",
"0.64857167",
"0.6481216",
"0.6261509",
"0.6181004",
"0.6172088",
"0.6100752",
"0.60959935",
"0.60809416",
"0.6035609",
"0.60119927",
"0.60108626",
"0.5979541",
"0.5967666",
"0.5961124",
"0.5942784",
"0.5935705",
"0.5928164",
"0.5911123",
"0.5909467",
"0.5907671",
"0.590097",
"0.589581",
"0.5893431",
"0.58930904",
"0.58683527",
"0.58659774",
"0.5853251",
"0.58492184",
"0.58384067",
"0.5836337",
"0.5833138",
"0.58281606",
"0.5826343",
"0.58214384",
"0.5816159",
"0.5816159",
"0.5816159",
"0.5810359",
"0.5807362",
"0.58051336",
"0.5792508",
"0.5785652",
"0.5761192",
"0.57606936",
"0.5754214",
"0.57493323",
"0.57398194",
"0.573955",
"0.5733098",
"0.57268864",
"0.5719652",
"0.5719652",
"0.5719652",
"0.5719652",
"0.5719652",
"0.5714189",
"0.57130486",
"0.57102424",
"0.57053924",
"0.56998676",
"0.5694541",
"0.5693162",
"0.5693162",
"0.5677304",
"0.5676757",
"0.5676431",
"0.5673607",
"0.56724143",
"0.5670859",
"0.5667017",
"0.566082",
"0.5654574",
"0.5653389",
"0.56514883",
"0.5643253",
"0.5642249",
"0.5634098",
"0.5632722",
"0.56315637",
"0.5630412",
"0.56167215",
"0.5606759",
"0.5602664",
"0.5602193",
"0.5600341",
"0.5580955",
"0.55809456",
"0.55808026",
"0.55801296",
"0.55798084",
"0.55768865",
"0.5561978"
] | 0.631161 | 10 |
Sets the authentication hash and the password from params_auth_hash or http_auth_hash. source://devise//lib/devise/strategies/authenticatable.rb128 | def with_authentication_hash(auth_type, auth_values); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with_authentication_hash(hash)\n self.authentication_hash = {:email => hash[:username]}\n self.password = hash[:password]\n end",
"def with_authentication_hash(auth_type, auth_values)\n self.authentication_hash, self.authentication_type = {}, auth_type\n self.password = auth_values[:password]\n\n parse_authentication_key_values(auth_values, authentication_keys) &&\n parse_authentication_key_values(request_values, request_keys)\n end",
"def auth=(auth_hash)\n # symbolize the keys\n new_auth_hash = {}\n auth_hash.each {|k, v| new_auth_hash[k.to_sym] = v}\n auth_hash = new_auth_hash\n\n if auth_hash.has_key? :access_token\n # clear the basic_auth, if it's set\n self.class.default_options.reject!{ |k| k == :basic_auth }\n\n # set the Authorization headers\n self.class.headers.merge!(\"Authorization\" => \"Bearer #{auth_hash[:access_token]}\")\n elsif auth_hash.has_key?(:username) && auth_hash.has_key?(:password)\n self.class.basic_auth auth_hash[:username], auth_hash[:password]\n\n # remove the access_token from the headers, if it exists\n self.class.headers.reject!{ |k, v| k == \"Authorization\" }\n else\n raise \"\"\"\n Incomplete authorization information passed in authorization hash.\n You must have either an :access_token or a username password combination (:username, :password).\n \"\"\"\n end\n end",
"def set_auth(user, password)\n @user = user\n @password = password\n end",
"def process_basic_auth(auth)\n case auth\n when String\n self.login, self.password = auth.split(':', 2)\n when Hash\n self.login = auth[:login]\n self.password = auth[:password]\n end\n end",
"def params_auth_hash; end",
"def authentication_hash=(_arg0); end",
"def process_basic_auth(auth)\n case auth\n when String\n self.username, self.password = auth.split(':', 2)\n when Hash\n self.username = auth[:username]\n self.password = auth[:password]\n end\n end",
"def setHttpAuthPassword(password)\n @fields['http_auth_password'] = password\n self\n end",
"def setHttpAuthPassword(password)\n @fields['http_auth_password'] = password\n self\n end",
"def password_hash=(password_hash)\n super(BCrypt::Password.new(password_hash))\n end",
"def authentication_params\n params.require(:authentication).permit(:user_id, :token, :password_digest)\n end",
"def authentication_password\n BCrypt::Password.new(hashed_password)\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 Hash['type' => @auth_type,\n 'username' => @user,\n 'password' => @password]\n end",
"def update_from_auth_hash(auth_hash)\n update_account_info auth_hash['info']\n update_oauth_credentials auth_hash['credentials']\n self\n end",
"def auth_params\n params.require(:auth).permit Knock.handle_attr, :password\n end",
"def http_auth_hash\n keys = [http_authentication_key, :password]\n Hash[*keys.zip(decode_credentials).flatten]\n end",
"def http_auth_hash\n keys = [http_authentication_key, :password]\n Hash[*keys.zip(decode_credentials).flatten]\n end",
"def authenticate_with_http_digest(realm = T.unsafe(nil), &password_procedure); end",
"def auth_hash=(auth)\n # By default, omniauth-saml's auth hash is not serializable--it will raise\n # a StackLevelTooDeep error which is probably a bug. So we will discard the\n # parts that are causing problems (which are fortunately irrelevant).\n if auth[:provider] == \"saml\" && auth.dig(:extra, :raw_info)\n auth = auth.deep_symbolize_keys\n auth[:extra][:raw_info] = auth[:extra][:raw_info].attributes\n auth[:extra][:response_object] = nil\n end\n\n case auth[:provider]\n when \"shibboleth\", \"developer\"\n self.provider = Provider::SHIBBOLETH\n when \"saml\"\n self.provider = Provider::SAML\n when \"identity\"\n self.provider = Provider::LOCAL\n end\n\n super(auth)\n end",
"def set_auth(username, password)\r\n @http_client.http_adapter.set_auth(username, password)\r\n end",
"def http_auth_hash; end",
"def authenticate(guesspassword)\n\t# self.hash_password ==\n\tself.hashed_password ==\n\t # BCrypt::Engine.hash_secret(password, self.salt)\n\t BCrypt::Engine.hash_secret(guesspassword, self.salt)\nend",
"def password(&blk)\n @authentication_methods ||= {}\n @authentication_methods[:password] = blk\n self\n end",
"def auth_hash\n @auth_hash ||= request.env['omniauth.auth']\n end",
"def authenticate(request, realm, &password_procedure); end",
"def auth(username, password)\n @username, @password = username, password\n end",
"def initialize(auth_user_name: nil, auth_password: nil,\r\n use_hmac_authentication: false)\r\n if use_hmac_authentication\r\n Configuration.hmac_auth_user_name = auth_user_name\r\n Configuration.hmac_auth_password = auth_password\r\n else\r\n Configuration.basic_auth_user_name = auth_user_name\r\n Configuration.basic_auth_password = auth_password\r\n end\r\n end",
"def authenticate account, salt, hash, platform\n end",
"def auth\n if (!@auth || !@auth[:username]) && @headers['Authorization'] &&\n @headers['Authorization'] !~ /^OAuth\\s/\n\n str = Base64.decode64 @headers['Authorization'].split[1]\n username, password = str.split(\":\", 2)\n @auth = {\n :username => username,\n :password => password\n }.merge(@auth || {})\n end\n\n @auth\n end",
"def authenticate!\n username_password_hash = username_password\n \n username = username_password_hash['username']\n password = username_password_hash['password']\n\n user = User.find_by_email(username)\n if user.nil? || user.password != password\n fail! :message => \"strategies.password.failed\"\n else\n success! user\n end\n end",
"def set_token_from_hash(auth_hash, user_hash)\n self.update_attribute(:name, user_hash[:name]) if self.name.blank?\n self.update_attribute(:email, user_hash[:email]) if self.email.blank?\n token = self.authentications.find_or_initialize_by_provider_and_uid(auth_hash[:provider], auth_hash[:uid])\n token.update_attributes(\n :name => auth_hash[:name],\n :link => auth_hash[:link],\n :access_token => auth_hash[:token],\n :secret => auth_hash[:secret]\n )\n end",
"def auth_params\n params.permit(:email, :password)\n end",
"def post_authenticate(hash)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n @client.request(\"/users/authenticate\").with_json(hash.to_json).post { |hash| Apidoc::Models::User.new(hash) }\n end",
"def authenticate_bb_password(bb_password_hash)\n bb_password_hash == bb_password ? self : false\n end",
"def set_auth(user, passwd)\n @authenticator.each do |auth|\n auth.set(nil, user, passwd)\n end\n reset_challenge\n end",
"def authenticate!\n if params[:user]\n user = User.find_by(email: params[:user][:user_name])\n if user and user.local? and user.valid_password?(params[:user][:password])\n success!(user)\n else\n fail\n end\n elsif auth\n user = User.find_by(email: auth.credentials.first)\n if user and user.local? and user.valid_password?(auth.credentials[1])\n success!(user)\n else\n fail\n end\n else\n fail\n end\n end",
"def set_authentication_method(opts)\n opts = check_params(opts,[:auth_methods])\n super(opts)\n end",
"def recreate_authentication_with_hash auth\n recreate_authentication auth[:provider], uid: auth[:uid] unless identity?(auth)\n self\n end",
"def auth_hash\n @auth_hash ||= request.env['omniauth.auth']\n end",
"def authentication_params\n\t\t\tparams.require(:authentication).permit(:user_id, :provider, :uid, :access_token)\n\t\tend",
"def authentication_params\n params.require(:authentication).permit(:provider, :uid, :token, :token_secret, :user_id)\n end",
"def authenticate!(password)\n\t\t\tauth = User.perform_request User.api_url(\"users/authenticate\", {}), :post,\n\t\t\t\t{ email: self.email,\n\t\t\t\t\tpassword: password }, true\n\n\t\t\t# A bit of additional code here to keep the initialization tidy\n\t\t\tif auth\n\t\t\t\tif(self.respond_to? :token=)\n\t\t\t\t\tself.token = auth['data']['token']\n\t\t\t\telse\n\t\t\t\t\tself.class.send(:define_method, \"token=\") { |value| @token=value }\n\t\t\t\t\tself.class.send(:define_method, \"token\") { @token }\n\t\t\t\t\tself.token = auth['data']['token']\n\t\t\t\tend\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend",
"def basic_auth(u, p)\n @auth = {:username => u, :password => p}\n end",
"def auth_hash\n request.env['omniauth.auth'].symbolize_keys!\n end",
"def update_with_password(params, *options)\n if authentications.present?\n update_attributes(params, *options)\n else\n super\n end\n end",
"def authentication_params\n params.require(:authentication).permit(:user_id, :provider, :uid)\n end",
"def authentication_params\n if params[:provider]\n params.permit(:provider, :error, :error_description, :state)\n else\n params.require(:authentication).permit(:type, :user_email, :password)\n end\n end",
"def auth_options\n params.require(:email)\n params.require(:password)\n end",
"def auth_hash\n OmniAuth::Utils.deep_merge(super(), {\n 'uid' => @uid,\n 'user_info' => {\n 'name' => @username\n }\n })\n end",
"def auth_hash\n OmniAuth::Utils.deep_merge(super(), {\n 'uid' => @client_id,\n 'user_info' => {\n 'user_hash' => user_data,\n }\n })\n end",
"def authenticate!\n resource = mapping.to.where(:username => authentication_hash[:email]).first if authentication_hash\n resource ||= mapping.to.new if resource.nil?\n\n username = authenticate_against_ebay(authentication_hash[:email], password)\n\n if username\n resource.username = username\n resource.password = password\n resource.password_confirmation = password\n resource.save if resource.changed?\n end\n\n return fail(:invalid) unless username and resource\n\n if validate(resource) { not resource.nil? }\n success!(resource)\n end\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end",
"def authenticate password\n hash = BCrypt::Engine.hash_secret password, password_salt\n hash == password_hash\n end",
"def auth\n @auth ||= Hash.new\n\n if !@auth[:username] && @headers['Authorization']\n str = Base64.decode64 @headers['Authorization'].split[1]\n username, password = str.split(\":\", 2)\n @auth = {:username => username, :password => password}.merge @auth\n end\n\n @auth\n end",
"def credentials=(auth)\n if auth.is_a?(OAuth::AccessToken)\n @credentials = auth\n else\n @credentials = {:username => auth[:username], :password => auth[:password]}\n end\n end",
"def authenticate_with_http_digest(realm = \"Application\", &password_procedure)\n HttpAuthentication::Digest.authenticate(self, realm, &password_procedure)\n end",
"def authenticate!(request)\n if @username and @password \n request.basic_auth @username, @password\n end\n end",
"def auth_pass(password)\n BCrypt::Password.create(password) == self.hash_pass\n end",
"def authenticate(auth_password)\n if(password_digest)\n password_digest == checksum(auth_password)\n else\n false\n end\n end",
"def authenticate(username, password)\n @username = username\n @password = password\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n (user = User.find_by_name(username)) != nil \\\n && user.password == Digest::SHA1.hexdigest(password)\n end\n end",
"def auth_params\n params.permit(:email, :password)\n end",
"def authenticate(pass)\n password.is_password?(pass) && self\n end",
"def userauth_params\n params.fetch(:userauth, {})\n end",
"def password=(passwd)\n @password_hashed = Digest::SHA256.hexdigest(passwd)\n end",
"def authenticate\n @username = params[:username]\n @password = params[:password]\n user = User.find_by(username: @username)\n\n # NEED TO ADD THE PASSWORD VERIFICATION BACK IN\n if user && user.authenticate(@password)\n render json: { auth_token: user.generate_auth_token, user_id: user.id, user_name: user.name }\n else\n render json: { error: 'Invalid username or password' }, status: :unauthorized\n end\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end",
"def set_authentication_authority\n value = ';ShadowHash;HASHLIST:'\n authority = NSMutableArray.new\n if @kernel_version_major >= 12\n value << '<SALTED-SHA512-PBKDF2>'\n elsif @kernel_version_major == 11\n value << '<SALTED-SHA512>'\n else\n value << '<SALTED-SHA1>'\n end\n authority << value\n @user['authentication_authority'] = authority\n end",
"def set_user_attributes(user_hash)\n self.name = user_hash[:name]\n self.email = user_hash[:email]\n self.password = user_hash[:password]\n self.password_confirmation = user_hash[:password_confirmation]\n self.admin = false\n self.confirmed = false\n end",
"def apply_omniauth(auth)\n self.email = auth['extra']['raw_info']['email'] if auth['extra']['raw_info']['email']\n self.password = Devise.friendly_token[0,20]\n authentications.build(:provider=>auth['provider'], :uid=>auth['uid'], :token=>auth['credentials']['token'], :secret=>auth['credentials']['secret'])\n end",
"def update_and_save_from_auth_hash(auth_hash)\n update_from_auth_hash(auth_hash)\n unless save\n messages = errors.full_messages.join(', ')\n logger.error \"Unable to update account (#{provider}##{uid}): #{messages}\"\n end\n self\n end",
"def setHttpAuth(user_name, password)\n setHttpAuthUserName(user_name)\n setHttpAuthPassword(password)\n self\n end",
"def setHttpAuth(user_name, password)\n setHttpAuthUserName(user_name)\n setHttpAuthPassword(password)\n self\n end",
"def set_initial_password(hash_key, new_password)\n\t\t\tkparams = {}\n\t\t\t# The hash key used to identify the user (retrieved by email)\n\t\t\tclient.add_param(kparams, 'hashKey', hash_key);\n\t\t\t# The new password to set for the user\n\t\t\tclient.add_param(kparams, 'newPassword', new_password);\n\t\t\tclient.queue_service_action_call('user', 'setInitialPassword', 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 auth\n {:basic_auth => {:username => id, :password => password}}\n end",
"def authentication_information\n password.nil? ?\n { :method => :anonymous } :\n { :method => :simple, :username => username, :password => password }\n end",
"def auth_info\n params[auth_param] || {}\n end",
"def authorization_hash\n {Authorization: \"Basic #{Base64.strict_encode64(\"#{@login}:#{@password}\")}\"}\n end",
"def login_from_params\n authenticate(params[:password])\n end",
"def set_password(password, auth = nil)\n data = { new_password: password }\n data[:auth] = auth if auth\n\n make_request(:post, '/account/password', content: data).code == 200\n end",
"def initialize(params={})\n if params[:username]\n hash = Engine.hash_secret(params[:username], Userhash.username_salt)\n params[:hashname] = Password.new(hash)\n params.delete(:username)\n end\n super(params)\n end",
"def authenticate\n auth.call(:authenticate)\n end",
"def update_hash!(password)\n self.password = password\n hash_password\n save\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 basic_auth(username, password)\n @basic_auth = {:username => username, :password => password}\n end",
"def basic_auth(user=nil, password=nil)\n user and password and @basic_auth = [user, password] or @basic_auth\n end",
"def hash_password\n self.password = Digest::MD5.hexdigest(self.password)\n end",
"def set_password_digest()\n\t\tself.password_digest = Password.create(self.password)\n\tend",
"def before_create\n self.hashed_password = User.hash_password(self.password)\n end",
"def before_create\n self.hashed_password = User.hash_password(self.password)\n end",
"def authenticate!(request, params, *rest)\n authentication.authenticate!(request, params, *rest)\n end",
"def authenticate(password)\n\t\tself.hashed_password ==\n\t\tBCrypt::Engine.hash_secret(password, self.salt)\n\tend",
"def password=(pwd)\n @password = pwd\n create_new_salt\n self.password_hash = User.encrypted_password(self.password, self.password_salt) \n end",
"def update_attributes_and_password(attrs)\n self.assign_attributes(attrs)\n self.valid?\n if self.password.present? && confirm_passwords\n self.password_hash = Digest::SHA256.hexdigest(self.password + Rails.application.secrets.salt)\n end\n if self.errors.empty?\n self.save\n end\n end",
"def authenticate(params)\n Auth.new(params).call\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 hash_password\n self.hashed_password = BCrypt::Password.create(self.hashed_password)\n end",
"def password=( new_password )\n\t\tself.authentication_token = generate_authentication_token\n\t\tsuper\n\tend"
] | [
"0.8050251",
"0.7552947",
"0.6857729",
"0.66293526",
"0.66224784",
"0.6530933",
"0.6504922",
"0.64597166",
"0.6389289",
"0.6389289",
"0.63765293",
"0.6349616",
"0.6342964",
"0.63393563",
"0.6329528",
"0.6306694",
"0.6262563",
"0.62507886",
"0.62507886",
"0.6231881",
"0.6218006",
"0.6215932",
"0.6215616",
"0.6189157",
"0.6185419",
"0.61682963",
"0.6134029",
"0.61147773",
"0.6104486",
"0.60890937",
"0.6081539",
"0.6074884",
"0.6063251",
"0.60509634",
"0.6050495",
"0.60442805",
"0.6043708",
"0.6003355",
"0.59913933",
"0.59828776",
"0.5982311",
"0.59766704",
"0.5967675",
"0.595182",
"0.5947324",
"0.59457535",
"0.5932074",
"0.592972",
"0.5927091",
"0.59237444",
"0.5917849",
"0.5893433",
"0.58690715",
"0.5863736",
"0.58622366",
"0.58600163",
"0.5856557",
"0.58560896",
"0.5854227",
"0.5847942",
"0.5837953",
"0.58374727",
"0.58158153",
"0.5803568",
"0.58004665",
"0.5787617",
"0.5774636",
"0.5773541",
"0.5769457",
"0.5765995",
"0.57510805",
"0.5748499",
"0.57349426",
"0.57331616",
"0.57331616",
"0.5727881",
"0.57268804",
"0.57193214",
"0.57171035",
"0.5717025",
"0.57143086",
"0.57132584",
"0.5712352",
"0.571121",
"0.5711143",
"0.5710658",
"0.5710241",
"0.5688978",
"0.5687658",
"0.5685452",
"0.5682172",
"0.5682172",
"0.5681007",
"0.56794864",
"0.5675282",
"0.5673589",
"0.5665174",
"0.56632835",
"0.56605494",
"0.5654144"
] | 0.69566727 | 2 |
Whenever CSRF cannot be verified, we turn off any kind of storage | def store?; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_up_csrf?; end",
"def clean_up_csrf?; end",
"def clean_up_csrf?\n false\n end",
"def clean_up_csrf?\n false\n end",
"def disable_request_forgery_protection; end",
"def clean_up_csrf?\n true\n end",
"def clean_up_csrf?\n true\n end",
"def disable_request_forgery_protection=(_arg0); end",
"def skip_forgery_protection(options = T.unsafe(nil)); end",
"def allow_forgery_protection\n true\n end",
"def csrf; end",
"def check_csrf?\n true\n end",
"def protect_against_forgery?\n false\nend",
"def check_csrf?\n true\n end",
"def protect_against_forgery?\n false\n end",
"def csrf_meta_tags; end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?; end",
"def check_csrf\n rails_check_csrf!\n end",
"def verify_csrf_token?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def protect_against_forgery?\n false\n end",
"def use_null_session\n ActionController::RequestForgeryProtection::ProtectionMethods::NullSession.new(self)\n .handle_unverified_request\n end",
"def protect_against_forgery?\n false\n end",
"def check_csrf\n rails_check_csrf!\n end",
"def csrf_token\n session[:csrf] ||= SecureRandom.hex 32\n end",
"def allow_local_storage\n return @allow_local_storage\n end",
"def handle_unverified_request\n logger.warn \" Form token: #{params[request_forgery_protection_token]}\" if logger\n logger.warn \" Header token: #{request.headers['X-CSRF-Token']}\" if logger\n logger.warn \" Session token: #{session[:_csrf_token]}\" if logger\n super\n end",
"def csrf_safe?\n @csrf_safe\n end",
"def protect_from_forgery\n end",
"def set_csrf_cookie\n cookies['CSRF-TOKEN'] = form_authenticity_token\n end",
"def csrf=(_arg0); end",
"def set_csrf_headers\n response.headers['X-CSRF-Token'] = form_authenticity_token\n end",
"def csrf_options\n opts[:route_csrf]\n end",
"def protect_against_forgery? #:nodoc:\n false\n end",
"def handle_unverified_request\n super\n cookies.delete(:autologin)\n end",
"def set_csrf_headers\n if request.xhr?\n cookies['XSRF-TOKEN'] = form_authenticity_token if cookies['XSRF-TOKEN'].blank?\n end\n end",
"def csrf_token\n env[\"rack.session\"].fetch(:csrf)\nend",
"def use_request_specific_csrf_tokens?\n csrf_options[:require_request_specific_tokens]\n end",
"def set_csrf_cookie_for_ng\n\t\tcookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n\tend",
"def handle_unverified_request\n if Rails.env.production?\n reset_session\n else\n raise ActionController::InvalidAuthenticityToken\n end\n end",
"def allow_local_storage=(value)\n @allow_local_storage = value\n end",
"def csrf_protection(enabled)\n return unless enabled\n condition do\n if request.env['protection.csrf.failed']\n message = settings.protect_from_csrf.kind_of?(Hash) && settings.protect_from_csrf[:message] || 'Forbidden'\n halt(403, message)\n end\n end\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie\n csrf_cookie_key = 'XSRF-TOKEN'\n cookies[csrf_cookie_key] = form_authenticity_token if protect_against_forgery? && current_user\n end",
"def protect_against_forgery?\n end",
"def rails_check_csrf!\n rails_controller_instance.send(:verify_authenticity_token)\n end",
"def set_csrf_cookie\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_token(_req, res)\n res.session[CSRF_TOKEN] ||= generate_csrf_token\n end",
"def set_csrf_headers\n if request.xhr?\n # Add the newly created csrf token to the page headers\n # These values are sent on 1 request only\n response.headers['X-CSRF-Token'] = \"#{form_authenticity_token}\"\n response.headers['X-CSRF-Param'] = \"#{request_forgery_protection_token}\"\n end\n end",
"def rails_check_csrf!\n rails_controller_instance.send(:verify_authenticity_token)\n end",
"def protect_against_forgery?\n\n end",
"def security_enabled_request_state\n super\n end",
"def allow_storage!(storage)\n if !allowed_storages.map(&:to_s).include?(storage)\n error! 403, \"Storage #{storage.inspect} is not allowed.\"\n end\n end",
"def allow_storage!(storage)\n if !allowed_storages.map(&:to_s).include?(storage)\n error! 403, \"Storage #{storage.inspect} is not allowed.\"\n end\n end",
"def storage_require_removable_storage_encryption\n return @storage_require_removable_storage_encryption\n end",
"def auth_csrf_token\n request.env['HTTP_X_AUTH_CSRF']\n end",
"def csrf_meta_tags\n respond_to do |format|\n format.html { render :layout => false }\n format.js\n end\n end",
"def auth_token\n (protect_against_forgery? ? form_authenticity_token : nil)\n end",
"def secure?\n false\n end",
"def force!\n force = session[:force_url]\n session[:force_url] = nil\n force\n end",
"def cookie_persistence_method\n super\n end",
"def handle_unverified_request\n sign_out_user\n super\n end",
"def skip_trackable\n request.env['devise.skip_trackable'] = true\n end",
"def skip_trackable\n request.env['devise.skip_trackable'] = true\n end",
"def protect_against_forgery?\n @paf ||= ActionController::Base.new.send(:protect_against_forgery?)\n end",
"def csrf_secret\n key = session[csrf_options[:key]] ||= SecureRandom.base64(32)\n Base64.strict_decode64(key)\n end",
"def do_not_set_cookie\n request.session_options[:skip] = true\n end",
"def do_not_set_cookie\n request.session_options[:skip] = true\n end",
"def do_not_set_cookie\n request.session_options[:skip] = true\n end",
"def disable_disk_cache!; end",
"def storage_require_removable_storage_encryption=(value)\n @storage_require_removable_storage_encryption = value\n end",
"def use_clean_cache\n ActionController::Base.config.cache_store = Rails.cache = ActiveSupport::Cache::MemoryStore.new\n end",
"def safe; end",
"def twiddle_csrf cookies, enable=false\r\n mode = (enable ? \"Enabling\" : \"Disabling\")\r\n print_status \"#{mode} CSRF protection\"\r\n params = {\r\n 'SessEnable' => enable.to_s,\r\n }\r\n res = send_request_cgi(\r\n {\r\n 'uri' => normalize_uri(target_uri.path, \"/CFIDE/administrator/settings/memoryvariables.cfm\"),\r\n 'method' => 'POST',\r\n 'connection' => 'TE, close',\r\n 'cookie' => build_cookie_header(cookies),\r\n 'vars_post' => params,\r\n })\r\n if res\r\n if res.body =~ /SessionManagement should/\r\n print_error \"Error #{mode} CSRF\"\r\n end\r\n else\r\n print_error \"No response while #{mode} CSRF\"\r\n end\r\n end",
"def csrf_tag(*)\n rails_csrf_tag\n end",
"def clean_up\n Capybara.current_session.execute_script \"window.localStorage.removeItem('pushEnabled');window.localStorage.removeItem('clark-user-journey');\"\n end",
"def after_save\n cookies['global_properties_for_user'] = nil\n end",
"def disable_caching; end",
"def rails_csrf_param\n rails_controller.request_forgery_protection_token\n end",
"def reset_perishable_token!\n reset_perishable_token\n save_without_session_maintenance(validate: false)\n end",
"def storage_require_encryption\n return @storage_require_encryption\n end",
"def storage_require_encryption\n return @storage_require_encryption\n end",
"def secure?\n false\n end",
"def csrf_tag(*)\n rails_csrf_tag\n end",
"def rails_csrf_param\n rails_controller.request_forgery_protection_token\n end",
"def handle_unverified_request\n sign_out\n super\n end",
"def handle_unverified_request\n sign_out\n super\n end"
] | [
"0.73279715",
"0.73279715",
"0.72398937",
"0.723832",
"0.72034264",
"0.7160972",
"0.7160972",
"0.6875801",
"0.6775025",
"0.673664",
"0.6392637",
"0.6386263",
"0.63685447",
"0.6349139",
"0.63485074",
"0.6341817",
"0.6340424",
"0.633912",
"0.633912",
"0.633912",
"0.633912",
"0.633912",
"0.633912",
"0.63242126",
"0.6279791",
"0.62779236",
"0.62504065",
"0.62504065",
"0.62422013",
"0.62317604",
"0.6194929",
"0.6178856",
"0.6162331",
"0.61328506",
"0.611048",
"0.6076119",
"0.60714537",
"0.6068294",
"0.6043788",
"0.60368776",
"0.6033882",
"0.6021209",
"0.6007",
"0.5990781",
"0.59766054",
"0.59659153",
"0.59425986",
"0.5927161",
"0.592545",
"0.59013623",
"0.59013623",
"0.59013623",
"0.59013623",
"0.59013623",
"0.59013623",
"0.59013623",
"0.59013623",
"0.58741397",
"0.58690745",
"0.58375853",
"0.5832612",
"0.5827387",
"0.5821962",
"0.5803698",
"0.5780681",
"0.57238585",
"0.5706378",
"0.5706378",
"0.568997",
"0.5669298",
"0.5640303",
"0.5632996",
"0.56238353",
"0.56020814",
"0.5599625",
"0.5582963",
"0.558246",
"0.558246",
"0.5576155",
"0.55732954",
"0.55639696",
"0.55639696",
"0.55639696",
"0.5561325",
"0.55483335",
"0.5532277",
"0.55303067",
"0.55227536",
"0.5515521",
"0.55122966",
"0.55112046",
"0.5510187",
"0.55063117",
"0.549909",
"0.54987717",
"0.54987717",
"0.548859",
"0.5472183",
"0.5467505",
"0.54610866",
"0.54610866"
] | 0.0 | -1 |
No need to clean up the CSRF when using rememberable. In fact, cleaning it up here would be a bug because rememberable is triggered on GET requests which means we would render a page on first access with all csrf tokens expired. | def clean_up_csrf?; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_up_csrf?\n true\n end",
"def clean_up_csrf?\n true\n end",
"def csrf_meta_tags; end",
"def csrf; end",
"def clean_up_csrf?\n false\n end",
"def clean_up_csrf?\n false\n end",
"def csrf_token\n session[:csrf] ||= SecureRandom.hex 32\n end",
"def csrf=(_arg0); end",
"def csrf_token\n env[\"rack.session\"].fetch(:csrf)\nend",
"def set_csrf_cookie\n cookies['CSRF-TOKEN'] = form_authenticity_token\n end",
"def set_csrf_cookie\n csrf_cookie_key = 'XSRF-TOKEN'\n cookies[csrf_cookie_key] = form_authenticity_token if protect_against_forgery? && current_user\n end",
"def handle_unverified_request\n super # call the default behaviour which resets the session\n cookies.delete(:remember_token)\n redirect_to :login\n end",
"def disable_request_forgery_protection; end",
"def set_csrf_headers\n response.headers['X-CSRF-Token'] = form_authenticity_token\n end",
"def set_csrf_cookie\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def csrf_safe?\n @csrf_safe\n end",
"def handle_unverified_request\n logger.warn \" Form token: #{params[request_forgery_protection_token]}\" if logger\n logger.warn \" Header token: #{request.headers['X-CSRF-Token']}\" if logger\n logger.warn \" Session token: #{session[:_csrf_token]}\" if logger\n super\n end",
"def disable_request_forgery_protection=(_arg0); end",
"def invalid_authenticity_request\n sign_out(current_user)\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n render error: 'invalid token', status: :unprocessable_entity\n end",
"def csrf_metatag\n \"<meta name=\\\"#{csrf_field}\\\" content=\\\"#{csrf_token}\\\" \\/>\"\n end",
"def handle_unverified_request\n super\n cookies.delete(:autologin)\n end",
"def rails_csrf_tag\n %(<input type=\"hidden\" name=\"#{rails_csrf_param}\" value=\"#{rails_csrf_token}\">)\n end",
"def use_null_session\n ActionController::RequestForgeryProtection::ProtectionMethods::NullSession.new(self)\n .handle_unverified_request\n end",
"def csrf_tag(*)\n rails_csrf_tag\n end",
"def csrf_tag(*)\n rails_csrf_tag\n end",
"def set_csrf_cookie_for_ng\n\t\tcookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n\tend",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end",
"def rails_csrf_tag\n %(<input type=\"hidden\" name=\"#{rails_csrf_param}\" value=\"#{rails_csrf_token}\">)\n end",
"def csrf_meta_tags\n respond_to do |format|\n format.html { render :layout => false }\n format.js\n end\n end",
"def forget\n update_attribute(:remember_token, nil)\n end",
"def check_csrf\n rails_check_csrf!\n end",
"def auth_csrf_token\n request.env['HTTP_X_AUTH_CSRF']\n end",
"def check_csrf\n rails_check_csrf!\n end",
"def set_csrf_headers\n if request.xhr?\n cookies['XSRF-TOKEN'] = form_authenticity_token if cookies['XSRF-TOKEN'].blank?\n end\n end",
"def protect_from_forgery\n end",
"def skip_forgery_protection(options = T.unsafe(nil)); end",
"def forget\n update_attribute(:remember_digest, nil)\n # We don't need the below line because if we update remember_digest to nil, then\n # you cannot use the old remember_token anyway, so it is unnecessary\n # self.remember_token = nil\n end",
"def masked_authenticity_token(session, form_options: T.unsafe(nil)); end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def clearcookies\n cookies.delete Prismic::PREVIEW_COOKIE\n redirect_to '/'\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 forget\n self.remember_token = nil\n update_attribute(:remember_token_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def semi_static_csrf_meta_tags(page=nil)\n page ||= (controller_name == 'entries' ? @entry : @tag)\n if page && page.get_page_attr('csrfFormAuth')\n csrf_script = <<-EOL\n <script>\n function semiStaticLoadCSRF(){\n semiStaticAJAX('/site/csrf_meta_tags?dummy')\n };\n addSemiStaticLoadEvent(semiStaticLoadCSRF);\n </script>\n EOL\n content_for(:ujs) { csrf_script.html_safe }\n end\n csrf_meta_tags\n end",
"def protect_against_forgery?; end",
"def set_csrf_headers\n if request.xhr?\n # Add the newly created csrf token to the page headers\n # These values are sent on 1 request only\n response.headers['X-CSRF-Token'] = \"#{form_authenticity_token}\"\n response.headers['X-CSRF-Param'] = \"#{request_forgery_protection_token}\"\n end\n end",
"def forget(user)\nuser.forget\ncookies.delete(:user_id)\ncookies.delete(:remember_token)\nend",
"def forget(user)\nuser.forget\ncookies.delete(:user_id)\ncookies.delete(:remember_token)\nend",
"def forget\n update_attribute :remember_digest, nil\n end",
"def forget\n update_attribute :remember_digest, nil\n end",
"def destroy\n\t\tcookies.delete 'Vanilla'\n\t\tcookies.delete 'Vanilla-Volatile'\n\t\tsuper\n\tend",
"def clear_cookies\n \tcookies.delete(:auth_token)\n end",
"def forget\n self.remember_token = nil\n update_attribute(:remember_digest, nil)\n end",
"def forget\n self.remember_token = nil\n update_attribute(:remember_digest, nil)\n end",
"def feature_reset_login_attempt!\n Rack::Attack.cache.store.clear\n page.reset!\n end",
"def forget\n update_attribute(:remember_digest, nil)\n end",
"def forget\n\t\tupdate_attribute(:remember_digest, nil)\n\tend",
"def forget\n\t\tupdate_attribute(:remember_digest, nil)\n\tend",
"def forget\n\t\tupdate_attribute(:remember_digest, nil)\n\tend",
"def check_csrf?\n true\n end",
"def forget\n \tupdate_attribute(:remember_digest, nil)\n end",
"def forget\n \tupdate_attribute(:remember_digest, nil)\n end",
"def forget\n update_attribute(:remember_digest, nil)\n \n end",
"def remember_token; end",
"def check_for_removal\n if @value && @unused && @unused[\"unused\"]\n @res.cookies << create_cookie(\"unused\", false, 'flash_unused')\n elsif @value\n @value = nil\n @res.cookies << create_cookie(\"unused\", nil, 'flash_unused')\n @res.cookies << create_cookie(\"message\", nil)\n end\n end",
"def handle_unverified_request\n if Rails.env.production?\n reset_session\n else\n raise ActionController::InvalidAuthenticityToken\n end\n end",
"def rails_check_csrf!\n rails_controller_instance.send(:verify_authenticity_token)\n end",
"def allow_forgery_protection\n true\n end",
"def submitted_csrf_token\n request.env['HTTP_X_CSRF_TOKEN'] || params['csrf_token']\n end",
"def forget(user)\n user.update_attribute(:remember_digest, nil)\n cookies.delete(:student_id) if student?\n cookies.delete(:tutor_id) if tutor?\n cookies.delete(:remember_token)\n end",
"def check_csrf?\n true\n end",
"def clear_remember_me_token\n # TODO: Why does this use cookies, shouldn't it be session?\n cookies[:remember_me_token] = nil\n end",
"def force_forget_me!\n config = sorcery_config\n sorcery_adapter.update_attributes(config.remember_me_token_attribute_name => nil,\n config.remember_me_token_expires_at_attribute_name => nil)\n end",
"def rails_check_csrf!\n rails_controller_instance.send(:verify_authenticity_token)\n end",
"def clear_login_data\r\n session[:edit_mode] = 0\r\n session[:user_id] = nil\r\n session[:user_name] = nil\r\n session[:user_roles] = nil\r\n cookies.delete :remember_me\r\nend"
] | [
"0.676709",
"0.676709",
"0.6743108",
"0.6736578",
"0.664619",
"0.6629792",
"0.6439144",
"0.64388686",
"0.6400207",
"0.6371056",
"0.62237847",
"0.6208066",
"0.61979145",
"0.6127952",
"0.6089141",
"0.60736823",
"0.6063838",
"0.6058558",
"0.60508513",
"0.60270983",
"0.60018253",
"0.59790444",
"0.59736973",
"0.5959683",
"0.59350264",
"0.59202194",
"0.5907436",
"0.5907436",
"0.5907436",
"0.5907436",
"0.5907436",
"0.5907436",
"0.5907436",
"0.5907436",
"0.5886432",
"0.5881632",
"0.58783054",
"0.5860167",
"0.58123857",
"0.5808889",
"0.580255",
"0.5802108",
"0.5768335",
"0.5767717",
"0.5730643",
"0.57260126",
"0.57260126",
"0.57260126",
"0.57260126",
"0.57260126",
"0.57260126",
"0.57260126",
"0.57260126",
"0.57260126",
"0.57260126",
"0.57260126",
"0.57260126",
"0.57260126",
"0.57260126",
"0.57260126",
"0.57260126",
"0.57260126",
"0.572516",
"0.5724827",
"0.57230455",
"0.5722296",
"0.5722296",
"0.5716002",
"0.5709763",
"0.570756",
"0.5702033",
"0.5702033",
"0.5690438",
"0.5690438",
"0.5684207",
"0.56825274",
"0.5678956",
"0.5678956",
"0.5668373",
"0.5655835",
"0.56459314",
"0.56459314",
"0.56459314",
"0.5644717",
"0.56439835",
"0.56439835",
"0.56417143",
"0.5634746",
"0.56338143",
"0.5628962",
"0.5624817",
"0.5622011",
"0.56210893",
"0.5620389",
"0.5609656",
"0.55953693",
"0.55948716",
"0.55905807",
"0.55830604"
] | 0.72477543 | 1 |
A valid strategy for rememberable needs a remember token in the cookies. | def valid?; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remember_me_login\n validate_token User, cookies[:remember_me]\n end",
"def remember_token; end",
"def remember_me?; end",
"def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at\n end",
"def remember_token?\n remember_token_expires_at && Time.now < remember_token_expires_at\n end",
"def remember_token\r\n cookies.signed[:remember_token] || [nil, nil]\r\n end",
"def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at\n end",
"def valid_remember_cookie?\n return nil unless @current_user\n (@current_user.remember_token?) && (cookies[:auth_token] == @current_user.remember_token)\n end",
"def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at \n end",
"def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at \n end",
"def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at \n end",
"def login_from_cookie\nuser = cookies[:auth_token] && User.find_by_remember_token(cookies[:auth_token])\nif user && user.remember_token?\ncookies[:auth_token] = { :value => user.remember_token, :expires => user.remember_token_expires_at }\nself.current_user = user\nend\nend",
"def valid_remember_cookie?\n return nil unless @current_user\n (@current_user.remember_token?) &&\n (cookies[:auth_token] == @current_user.remember_token)\n end",
"def valid_remember_cookie?\n return nil unless @current_user\n (@current_user.remember_token?) && \n (cookies[:auth_token] == @current_user.remember_token)\n end",
"def remember!(cookies)\n cookies[:remember_me] = {:value => \"1\",\n :expires => COOKIE_EXPIRATION }\n \n self.authorization_token = unique_identifier\n self.save!\n cookies[:authorization_token] = {:value => self.authorization_token,\n :expires => COOKIE_EXPIRATION }\n end",
"def remember!(cookies)\n cookie_expiration = 10.years.from_now\n cookies[:remember_me] = { :value => \"1\",\n :expires => cookie_expiration }\n self.authorization_token = unique_identifier\n save!\n cookies[:authorization_token] = { :value => authorization_token,\n :expires => cookie_expiration }\n end",
"def remember\n self.remember_token_expires_at = 1.weeks.from_now.utc\n self.remember_token = Cryptography.encrypt_with_salt(\n SecureRandom.hex(10),\n remember_token_expires_at)\n save(false)\n end",
"def remember_token?\n remember_token_expires_at && Time.now.utc < remember_token_expires_at\n end",
"def remember!(cookies)\n cookie_expiration = 14.days.from_now\n cookies[:remember_me] = {:value => \"1\",\n :expires => cookie_expiration}\n self.authorization_token = unique_identifier\n save!\n cookies[:authorization_token] = {:value => authorization_token,\n :expires => cookie_expiration}\n end",
"def remember!(cookies)\n cookie_expiration = 10.years.from_now\n cookies[:remember_me] = {:value => \"1\",\n :expires => cookie_expiration}\n self.authorization_token = unique_identifier\n self.save!\n cookies[:authorization_token] = {\n :value => self.authorization_token,\n :expires => cookie_expiration }\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{remember_token_expires_at}\")\n # save(:validate => false)\n end",
"def remember_me!\n self.remember_token = encrypt(\"#{password_salt}--#{id}--#{Time.now.utc}\")\n save_without_validation\n end",
"def remember_token\n\t\t\tcookies.signed[:remember_token] || [nil, nil]\n\t\tend",
"def is_cookie_token_valid?\n return true if self.class.els_options.has_key? 'faker'\n raise \"No cookies instance found\" if cookies.nil?\n token = cookies[self.class.els_options['cookie']]\n if token.nil? || !Runner.is_token_valid?(token,self.class.els_options)\n false\n else\n true\n end\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{kerbid}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember!(cookies)\n\t\tcookie_expiration = 10.years.from_now\n\t\tcookies[:remember_me] = { :value => \"1\",\n\t\t\t\t\t\t\t\t :expires => cookie_expiration}\n\t\tself.authorization_token = secure_unique_identifier \n\t\tsave!\n\t\tcookies[:authorization_token] = {:value => authorization_token,\n\t\t\t\t\t\t\t\t\t\t :expires => cookie_expiration }\n\tend",
"def remember\n return false if remember_digest.nil?\n BCrypt::Password.new(remember_digest).is_password?(remember_token)\n end",
"def remember(baby)\n baby.remember\n cookies.permanent.encrypted[:baby_id] = baby.id\n cookies.permanent[:remember_token] = baby.remember_token\n end",
"def remember_me() return true; end",
"def handle_remember_cookie! new_cookie_flag\n return unless @current_user\n case\n when valid_remember_cookie? then @current_user.refresh_token # keeping same expiry date\n when new_cookie_flag then @current_user.remember_me\n else @current_user.forget_me\n end\n send_remember_cookie!\n end",
"def remember_token\n cookies.signed[:remember_token] || session[:remember_token] || [nil, nil]\n end",
"def remember(user)\n user.remember # Defined in the User model\n cookies[:user_id] = { value: user.id,\n expires: 20.years.from_now.utc }\n\n cookies[:remember_token] = { value: user.remember_token,\n expires: 20.years.from_now.utc }\n end",
"def authenticated? remember_token\n\t\tBCrypt::Password.new(remember_digest).is_password?(remember_token)\n\tend",
"def rememberable\n apply_schema :remember_token, String\n apply_schema :remember_created_at, DateTime\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = User.encrypt(\"#{name}--#{remember_token_expires_at}\")\n save!(validate: false)\n end",
"def remember_me\n self.remember_token_expires_at = 10.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(:validate => false)\n end",
"def authenticated?(remember_token)\nBCrypt::Password.new(remember_digest).is_password?(remember_token)\nend",
"def remember(user)\n#goes to remember method in user.rb and returns user.remember_token, and saves hashed one\n user.remember\n# saves users id\n cookies.permanent.signed[:user_id]=user.id\n# saves users cookies token\n cookies.permanent[:remember_token]=user.remember_token\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc #remember token lasts 2 weeks\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember(user)\n user.remember # Calls model\n cookies.permanent.signed[:user_id] = user.id # Save off encryped user ID\n cookies.permanent[:remember_token] = user.remember_token # Save off random thing for validation\n end",
"def authenticate!\n user = Oath::Lockdown::Rememberable.serialize_from_cookie(remember_cookie)\n\n if user\n success!(user)\n else\n cookies.delete(remember_key)\n pass\n end\n end",
"def login_from_cookie\n user = cookies[:auth_token] && User.find_by_remember_token(cookies[:auth_token])\n if user && user.remember_token?\n self.current_user = user\n handle_remember_cookie! false # freshen cookie token (keeping date)\n self.current_user\n end\n end",
"def login_from_cookie \n user = cookies[:auth_token] && MA[:user].find_with_conditions(:remember_token => cookies[:auth_token])\n if user && user.remember_token?\n user.remember_me\n cookies[:auth_token] = { :value => user.remember_token, :expires => Time.parse(user.remember_token_expires_at.to_s) }\n self.current_ma_user = user\n end\n end",
"def remember_me; end",
"def set_remember_token\n self.remember_token = SecureRandom.urlsafe_base64(32) if self.remember_token.blank?\n end",
"def login_from_cookie\n return unless cookies['auth_token'] && !logged_in?\n token=cookies['auth_token'].value\n token=token[0] if token.is_a? [].class\n user = self.class.user_class.find_by_remember_token(token)\n if user && user.remember_token\n\n user.remember_me\n self.current_user = user\n cookies[:auth_token] = { :value => self.current_user.remember_token , :expires =>Time.parse( self.current_user.remember_token_expires_at) }\n\n\n end\n end",
"def authenticated?(remember_token)\n return false if remember_digest.nil?\nBCrypt::Password.new(remember_digest).is_password?(remember_token)\nend",
"def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\nend",
"def remember_me?\n false\n end",
"def remember_me?\n false\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(:validate=> false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(:validate => false)\n end",
"def remember_me\n true\n end",
"def remember_me\n true\n end",
"def remember_me\n true\n end",
"def handle_remember_cookie!(new_cookie_flag)\n return unless @current_user\n case\n when valid_remember_cookie? then @current_user.refresh_token # keeping same expiry date\n when new_cookie_flag then @current_user.remember_me\n else @current_user.forget_me\n end\n send_remember_cookie!\n end",
"def authenticated? remember_token\n return false unless remember_digest\n\n BCrypt::Password.new(remember_digest).is_password?(remember_token)\n end",
"def rememberable(options={})\n use_salt = options.fetch(:use_salt, Devise.use_salt_as_remember_token)\n apply_devise_schema :remember_token, String unless use_salt\n apply_devise_schema :remember_created_at, DateTime\n end",
"def remember\n # store virtually the new token\n self.remember_token = User.new_token\n # save the hash digest of the token on the database\n self.update_attribute(:remember_digest, User.digest(self.remember_token))\n end",
"def authenticated?(remember_token)\n return false if remember_digest.nil? \n BCrypt::Password.new(remember_digest).is_password?(remember_token)\nend",
"def remember_me\r\n self.remember_token_expires_at = 2.weeks.from_now.utc\r\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\r\n save(false)\r\n end",
"def remember_me\n self.remember_token_expires_at = 2.months.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me?\n raise 'Must define remember_me? method'\n end",
"def remember\n self.remember_token = Band.new_token\n update_attribute(:remember_digest, Band.digest(remember_token))\n end",
"def ensure_authentication_token (remember)\n token = AuthToken.create!(token: generate_authentication_token,\n remember: remember,\n user_id: self.id)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(validate: false)\n end",
"def valid_remember_token?(token)\n if self.remember_digest.nil?\n return false\n else\n return BCrypt::Password.new(self.remember_digest).is_password?(token)\n end\n end",
"def authenticated? remember_token\n return false if remember_digest.nil?\n BCrypt::Password.new(remember_digest).is_password? remember_token\n end",
"def authenticated?(remember_token)\r\n \tBCrypt::Password.new(remember_digest).is_password?(remember_token) \r\n end",
"def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end",
"def remember_me\r\n time = 1.week.from_now.utc\r\n self.remember_token_expires_at = time\r\n self.remember_token = self.class.encrypt(\"#{email}--#{remember_token_expires_at}\", self.salt)\r\n save(:validate => false)\r\n end",
"def remember_token_field(value = nil)\n if value.nil?\n read_inheritable_attribute(:remember_token_field) || remember_token_field(klass.remember_token_field)\n else\n write_inheritable_attribute(:remember_token_field, value)\n end\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end",
"def login_from_cookie\n user = cookies[:auth_token] && User.find_by_remember_token(cookies[:auth_token])\n if user && user.remember_token?\n user.remember_me\n cookies[:auth_token] = { :value => user.remember_token, :expires => user.remember_token_expires_at }\n self.current_user = user\n end\n end",
"def remember(remember_token)\n remember_digest = BCrypt::Password.create(remember_token)\n self.update(remember_digest: remember_digest)\n\tend",
"def authenticated?(remember_token)\n # returns false if the remember digest is nil, which emphasizes the rest of the method gets ignored\n return false if remember_digest.nil?\n BCrypt::Password.new(remember_digest).is_password?(remember_token)\nend",
"def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{login}--#{remember_token_expires_at}\")\n save(false)\n end",
"def remember(user)\n if user.class == Student\n user.remember_token = Student.new_token\n user.update_attribute(:remember_digest, Student.digest(user.remember_token))\n cookies.permanent.signed[:student_id] = user.id\n elsif user.class == Tutor\n user.remember_token = Tutor.new_token\n user.update_attribute(:remember_digest, Tutor.digest(user.remember_token))\n cookies.permanent.signed[:tutor_id] = user.id\n end\n cookies.permanent[:remember_token] = user.remember_token\n end",
"def login_from_cookie\n user = cookies[:auth_token] && User.find_by_remember_token_or_remember_token_last(cookies[:auth_token],cookies[:auth_token])\n if user && user.remember_token\n user.remember_me\n cookies[:auth_token] = { value: user.remember_token, expires: user.remember_token_expires_at, httponly: true }\n self.current_user = user\n end\n user\n end",
"def create_remember_token \n self.remember_token = SecureRandom.urlsafe_base64\n end",
"def authenticated?(remember_token)\n return false if remember_digest.nil?\n BCrypt::Password.new(remember_digest).is_password?(remember_token)\n end",
"def remember(user)\nuser.remember\ncookies.permanent.signed[:user_id] = user.id\ncookies.permanent[:remember_token] = user.remember_token\nend",
"def remember\n # give the variable to \"self\", the user\n # sets the remember_token attribute of the user object\n self.remember_token = User.new_token\n # update attribute of the User, bypass validations (password), hash the\n # remember_token using digest (not totally sure that's right)\n update_attribute(:remember_digest, User.digest(remember_token))\n end"
] | [
"0.71223",
"0.6870511",
"0.68574905",
"0.6727406",
"0.6699468",
"0.6675375",
"0.6669733",
"0.6667327",
"0.6661623",
"0.6661623",
"0.6661623",
"0.6657254",
"0.66563714",
"0.6655913",
"0.66390055",
"0.6630805",
"0.6616073",
"0.6607899",
"0.6599437",
"0.65839803",
"0.65791345",
"0.6561097",
"0.6553982",
"0.65459025",
"0.6534996",
"0.65304494",
"0.6527279",
"0.6523813",
"0.65161514",
"0.6490164",
"0.64721733",
"0.6428915",
"0.64287245",
"0.64243096",
"0.64159864",
"0.6404018",
"0.6402707",
"0.639943",
"0.6376437",
"0.63748705",
"0.63709176",
"0.63525826",
"0.63514435",
"0.6349339",
"0.6339652",
"0.6338795",
"0.63371485",
"0.63293505",
"0.6320778",
"0.6320778",
"0.63193023",
"0.6319104",
"0.63188726",
"0.63188726",
"0.63188726",
"0.6307462",
"0.63057464",
"0.6302639",
"0.63019234",
"0.6301058",
"0.6292424",
"0.6292224",
"0.6288921",
"0.62884974",
"0.62873876",
"0.6282471",
"0.6281215",
"0.62811774",
"0.62697923",
"0.62688035",
"0.62666786",
"0.6265148",
"0.6263914",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62627774",
"0.62598217",
"0.6255718",
"0.62503386",
"0.6250023",
"0.6246717",
"0.6243548",
"0.6241065",
"0.6239371",
"0.6238652",
"0.6234257"
] | 0.0 | -1 |
Override process to consider warden. source://devise//lib/devise/test/controller_helpers.rb34 | def process(*_arg0, **_arg1); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warden\n env['warden']\n end",
"def warden\n env['warden']\n end",
"def warden\n request.env['warden']\n end",
"def warden\n request.env['warden']\n end",
"def warden\n request.env['warden']\n end",
"def warden\n @warden ||= begin\n env['warden']\n end\n end",
"def warden\n request.env['warden']\n end",
"def warden; end",
"def warden; end",
"def warden; end",
"def devise_controller?; end",
"def authenticate!\n warden.authenticate!\n end",
"def teardown\n Warden.test_reset!\n end",
"def devise_modules_hook!; end",
"def setup_controller_for_warden; end",
"def warden_options\n env['warden.options']\n end",
"def authenticate_from_warden\n warden = env[\"warden\"]\n return unless warden\n\n env[\"warden\"].authenticate(scope: \"user\")\n end",
"def before_dispatch(env); end",
"def configure_warden!; end",
"def current_user\n warden.user\n end",
"def skip_pundit?\n devise_controller?\n end",
"def auth_controller?\n false\n end",
"def authenticated_user?\n warden.authenticated?\n end",
"def strategies\n Warden::Strategies\n end",
"def devise_parameter_sanitizer; end",
"def warden_cookies\n warn \"warden_cookies was never functional and is going to be removed in next versions\"\n env['warden.cookies'] ||= {}\n end",
"def current_user\n warden.user\n end",
"def skip_trackable\n request.env['devise.skip_trackable'] = true\n end",
"def skip_trackable\n request.env['devise.skip_trackable'] = true\n end",
"def before_dispatch(_env)\n end",
"def disable_devise_for_cloudfuji_controllers!\n puts \"Disabling devise auth protection on cloudfuji controllers\"\n\n ::Cloudfuji::DataController.instance_eval { before_filter :authenticate_user!, :except => [:index] }\n ::Cloudfuji::EnvsController.instance_eval { before_filter :authenticate_user!, :except => [:update] }\n ::Cloudfuji::MailController.instance_eval { before_filter :authenticate_user!, :except => [:index] }\n\n puts \"Devise checks disabled for Cloudfuji controllers\"\n end",
"def auth_trap_state\n super\n end",
"def rails_controller_callbacks\n # don't verify CSRF token as part of callbacks, Rodauth will do that\n rails_controller_forgery_protection { false }\n\n rails_controller_instance.run_callbacks(:process_action) do\n # turn the setting back to default so that form tags generate CSRF tags\n rails_controller_forgery_protection { rails_controller.allow_forgery_protection }\n\n yield\n end\n 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 current_user\n return @current_user ||= warden.authenticate(:scope => :user)\n end",
"def current_user\n if Rails.env.test?\n # turn off caching for tests\n @current_user = warden.user\n else\n @current_user ||= warden.user\n end\n end",
"def protect_against_forgery?\n controller.send(:protect_against_forgery?)\n end",
"def current_user\n warden.user(WARDEN_SCOPE)\n end",
"def management\n prepareBaseContext\n end",
"def enforce_maintenance_mode\n return if !ENV['MAINTENANCE_MODE'] && Rails.configuration.published_locales.include?(I18n.locale)\n return if %w[sessions switch_user].include? controller_name\n return if current_user.present?\n\n redirect_to maintenance_path, status: :see_other\n end",
"def enforce_maintenance_mode\n return if !ENV['MAINTENANCE_MODE'] && Rails.configuration.published_locales.include?(I18n.locale)\n return if %w[sessions switch_user].include? controller_name\n return if current_user.present?\n\n redirect_to maintenance_path, status: :see_other\n end",
"def devise_scope(scope); end",
"def before_save\n begin\n #\n # test-mode status is redundant here for the purpose reporting etc...\n #\n # ramonrails Thu Oct 14 05:14:06 IST 2010\n # lately, we have test_mode working as follows\n # * user is considered in test mode when user.test_mode == true\n # * when user goes into test mode\n # * membership of safety_care is opted\n # * caregivers are set away\n # user = User.find(user_id) # not required. user is already assigned here\n self.test_mode = user.test_mode? unless user.blank?\n #\n # ramonrails: Thu Oct 14 01:56:19 IST 2010\n # CHANGED: ** do not ** return a false\n # returning false will abort any further execution of calbacks, or this save\n # above code was un-intentionally returning false in some cases\n true # continue execution. returning false would not save the record\n rescue\n true # no matter what, execute critical_device_event_observer.after_save\n end\n end",
"def skip_validation?\n devise_controller? || welcome_controller? || appointment_path?\n end",
"def set_current_user\n @current_user ||= warden.authenticate(scope: :api_user)\n end",
"def authenticate!\n :authenticate_developer! || :authenticate_charity!\n current_user = developer_signed_in? ? current_developer : current_charity\n end",
"def check_authentication\n case self.controller_name\n when /^clients/i, /^ingredients/i, /^orders/i, /^pages/i, /^productpresentations/i, /^products/i, /^companies/i\n authenticate\n end\n end",
"def update_application_controller\n inject_into_file 'app/controllers/application_controller.rb', after: \"protect_from_forgery with: :exception\\n\" do <<-'RUBY'\n before_action :authenticate_or_token\n\n protected\n def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:locale, :name, :username, :email, :password, :password_confirmation, :role, :remember_me) }\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password, :role) }\n I18n.locale = @current_user.locale || I18n.default_locale unless @current_user.nil?\n end\n\n # Validate user session if is not API call\n def authenticate_or_token\n authenticate_user! if params[:controller].index('api').nil? && request.fullpath != root_path\n @current_user = current_user if @current_user.nil?\n end\n\n RUBY\n end\n end",
"def authenticated?\n warden.user ? true : false\n end",
"def skip_pundit?\n devise_controller? || params[:controller] =~ /(^(rails_)?admin)|(^pages$)/\n end",
"def disable_request_forgery_protection=(_arg0); end",
"def user_authentication\n end",
"def protect()\n res = super(context,self)\n return res\n end",
"def check_authentication\n logger.debug \"*************************** CHECK AUTH **\"\n\n @controller_name_in_context = controller_name\n @action_in_context = action_name\n\n #Check if we have an object in context, either by explicitly passing it in or using standard rails conventions\n #e.g. @work for works_controller\n #From this we can check if the object responds to status or not\n\n\n #If an object cant be found in context teh status check will have to be delegated to teh controller method\n #in the class extending application controller, e.g. if for some reason the param name was different that id\n #This should cover most cases though\n status_to_check_for = nil\n\n #Look for an object in context using standard rails naming convention, e.g. Work.find(49) for /works/show/49\n if !params[:id].blank?\n begin\n class_name_to_check = controller_name.gsub(\"_controller\", \"\").tableize.singularize\n object_in_context = class_name_to_check.camelize.constantize.find(params[:id])\n #logger.debug \"OBJ IN CONTEXT:\"+object_in_context.to_s\n\n #Now does it respond to status?\n status_to_check_for = object_in_context.status if object_in_context.respond_to?(\"status_id\")\n rescue Exception => e\n #logger.debug \"COULD NOT FIND INSTANCE IN CONTEXT:#{e.message}\"\n end\n\n end\n\n\n #logger.debug \"RESTRICTION: request is #{request}, method - #{request.method}\"\n\n if status_to_check_for.blank?\n #logger.debug \"COULD NOT FIND A STATUS TO CHECK FOR\"\n else\n #logger.debug \"CHECK AUTH: STATUS TO CHECK FOR:#{status_to_check_for.status_desc}\"\n end\n\n\n #Deal with zencart\n #logger.debug(\"ZENCART READING ZENID FROM LAST BROWSER REQUEST: \"+cookies['zenid'].to_s)\n\n login_id = session[:login]\n if login_id != nil\n user = Login.find(login_id)\n if user != nil\n username=user.username\n password=user.password\n #logger.debug(\"ZENCART LOGGING INTO #{ZENCART_SERVER} with #{username} and #{password}\")\n #logger.debug(\"ZENCART FETCH:\" + external_fetch('POST',URI.parse('http://'+ZENCART_SERVER+'/zencart/index.php?main_page=login&action=process'),\"encrypted=true&email_address=#{username}&password=#{password}\").to_s)\n end\n end\n\n\n ecj=external_cookie_jar\n cookieString=ecj.cookies_for(URI.parse(\"http://\"+ZENCART_SERVER.to_s+\"/zencart\")).to_s\n #extract our zencart id and attach to our cookie list\n cookieString=~/zenid=(.*)/\n cookies['zenid']=$1\n #logger.debug(\"ZENCART SETTING ZENID FOR CURRENT BROWSER RESPONSE: #{$1}\")\n #Create a history in the session\n if session[:history] == nil\n session[:history]= Array.new()\n end\n @history=session[:history]\n\n if session[:selected] == nil\n session[:selected] = Hash.new()\n end\n\n #logger.debug \"RESTRICTION: CHECKING PERMISSIONS\"\n #logger.debug \"RESTRICTION CHECKING: #{controller_name} / #{action_name}\"\n\n\n\n #If we dont have a login in session then we need to use a privilege of type guest\n unless session[:login]\n\n session[:intended_action] = action_name\n session[:intended_controller] = controller_name\n\n\n idio = params[:id]\n if idio != nil\n session[:intended_id] = params[:id]\n end\n\n\n #Public AJAX requests are valid, for example the facet toggling\n if request.xhr?\n if !ControllerRestrictionHelper.has_permission?(request.method, controller_name, action_name, session[:intended_id],\n [Privilege::CAN_VIEW_PUBLIC], status_to_check_for)\n #logger.debug \"RESTRICTED AJAX FOR PUBLIC USER URI #{request.request_uri}\"\n #session[:intended_uri] = request.request_uri\n render :partial => 'shared/ajax_timeout'\n return false\n end\n\n else\n session[:intended_uri] = request.request_uri\n #If the page is viewable to the public then continue on and show, otherwise redirect to login\n if !ControllerRestrictionHelper.has_permission?(request.method, controller_name, action_name, session[:intended_id],\n [Privilege::CAN_VIEW_PUBLIC], status_to_check_for)\n #logger.debug \"RESTRICTED FOR PUBLIC USER URI #{request.request_uri}, CONTOLLER:#{controller_name}, ACTION:#{action_name}\"\n redirect_to :action => \"unauthorised\", :controller => \"authentication\"\n return false\n end\n end\n end\n\n #See pragmatic programmers, volume2 - storing the login user in session\n #See also http://www.rubyonrailsblog.com/articles/2006/09/29/rails-expiration-of-sessions-due-to-inactivity for session inactivity\n if session[:login] != nil\n #If we have a user, check if they have expired\n #FIXME: testing\n session_length = 60*20 #20 Minutes for logged in users\n\n expire_time = session[:expire_time] || Time.now + 10\n #logger.debug(\"Session expirty time is #{expire_time}, now is #{Time.now}\")\n session[:expire_time] = Time.now + session_length\n @login = Login.find(session[:login])\n #logger.debug \"RESTRICTION: LOGIN is #{@login.username}, is superuser? #{@login.is_superuser?}\"\n end\n\n\n #FIXME - status needs to be taken account of\n\n allowed_to_view = ControllerRestrictionHelper.login_has_permission?(request.method, controller_name, action_name,\n session[:intended_id], @login, status_to_check_for)\n #logger.debug \"CHECK2:#{allowed_to_view}\"\n\n if !allowed_to_view\n #logger.debug \"ACTION FORBIDDEN: #{controller_name} / #{action_name}\"\n render :file => \"#{RAILS_ROOT}/public/403.html\", :status => '403 Forbidden'\n return false #finish rendering here\n end\n\n # Needed for Event Quicklinks search\n # WR#53728\n @user_time_zone = get_user_time_zone\n\n #logger.debug \"ALLOWED TO VIEW: #{allowed_to_view}\"\n\n true #keep rendering\n end",
"def warden(&block); end",
"def set_fake_env\n if current_user.nil?\n @current_account = if params[:account_id].blank?\n Account.first\n else\n Account.find(params[:account_id])\n end\n\n @current_user = @current_account.permissioned_users.first\n end\n end",
"def disable_request_forgery_protection; end",
"def test_sign_in(user)\n #controller.current_user = user #This worked fine, but for some reason we could not use \"current_user = nil\" without \"self\" in the sign_out method in sessions_helper\n #A fix was to reuse the method signin in the session_controller as follows\n controller.sign_in(user) #see sessions_helper comments in sign_out on how this helped fix the problem with the use of \"current_user= nil\" instead of \"self.current_user = nil\"\n end",
"def current_user=(user)\n warden.set_user(user, event: :authentication)\n end",
"def development_auth\n @user = User.from_params(development_user_params)\n check_invite(@user)\n handle_sign_in(@user, \"development\")\n end",
"def env\n super.merge(hacked_env)\n end",
"def after_custom_authentication; end",
"def login_system_user\n before(:each) do\n @request.env['HTTPS'] = \"on\"\n @request.env[\"devise.mapping\"] = Devise.mappings[:user]\n @user = FactoryGirl.create(:user_information)\n @user = User.find(@user.id)\n sign_in @user\n end\n end",
"def skip_authentication?\n devise_controller? ||\n (%w[update_cart empty_cart terms_of_service]\n .include?(params[:action]) && !guests_disabled?)\n end",
"def protect_against_forgery?\n @paf ||= ActionController::Base.new.send(:protect_against_forgery?)\n end",
"def backdoor\n user = User.test_user\n sign_in(user)\n redirect_to root_url\n end",
"def authenticate(*args)\n warden.authenticate(*args)\n end",
"def capable_login_auth?; end",
"def skip_forgery_protection(options = T.unsafe(nil)); end",
"def authenticate_reporter\n unless current_user.acts_like_reporter?\n redirect_to site_path, alert: 'You do not have permission to access that page.' and return\n end\n end",
"def controller\n Thread.current[:authlogic_controller]\n end",
"def devise_mappings; end",
"def do_not_check_authorization?\n respond_to?(:devise_controller?) ||\n respond_to?(:home_controller?)\n end",
"def authenticated_as_user_device\n set_device_and_current_user\n redirect_to device_app_url unless @device and current_user\n end",
"def setup\n return if self.class.name =~ /TestCase$/ and not $TESTING_RTC\n super\n\n @controller_class = Object.path2class @controller_class_name\n raise \"Can't determine controller class for #{self.class}\" if @controller_class.nil?\n\n @controller = @controller_class.new\n\n @session = ActionController::TestSession.new\n\n @flash = ActionController::Flash::FlashHash.new\n @session['flash'] = @flash\n\n @request = ActionController::TestRequest.new\n @request.session = @session\n\n # HACK There's probably an official way to do this\n @controller.instance_variable_set :@_session, @request.session\n\n @response = ActionController::TestResponse.new\n\n setup_extra if respond_to? :setup_extra\n end",
"def middleware; end",
"def skip_authentication?\n true\n end",
"def before_rodauth\n rails_verify_authenticity_token\n super\n end",
"def protect_from_forgery\n end",
"def call(ctx, **)\n warden = ctx[:warden]\n\n if @except.empty?\n warden.logout\n else\n (Devise.mappings.keys - @except).each do |scope|\n warden.logout(scope) if warden.authenticated?(scope: scope)\n end\n end\n\n Macros::Auth::ExpireSessionData.new.call(ctx)\n warden.clear_strategies_cache!\n warden.lock!\n end",
"def permitted?\n appctrl_not_permitted() unless( @current_user.privileged? )\n end",
"def no_devise_timeout\n request.env['devise.skip_timeout'] = true\n end",
"def app_middleware; end",
"def require_no_authentication\n result = handle_crossdomain_devise\n super if result && result.action == :noop\n end",
"def skip_authorization; end",
"def fetch_details_from_devise\n self.username = 'devise_user'\n self.save\n end",
"def impersonate!(user)\n self.class.start(controller, :user => user, :parent => self)\n end",
"def permitted?\n appctrl_not_permitted() unless ( @current_user.privileged? )\n end",
"def setup_warden_additions\n @failure_app = Oath::Lockdown::FailureApp\n @lockable_authentication_strategy = Oath::Lockdown::Strategies::LockablePasswordStrategy\n @remember_me_authentication_strategy = Oath::Lockdown::Strategies::RememberMeStrategy\n @warden_authentication_strategies = [:oath_remember_me, :oath_lockable, :oath]\n @warden_no_input_authentication_strategies = [:oath_remember_me]\n end",
"def bypass_rescue\n @controller.extend(BypassRescue)\n end",
"def active_for_authentication?; end",
"def active_for_authentication?; end",
"def authenticate_user\n if Rails.env.production?\n authenticate_or_request_with_http_basic do |username, password|\n username == \"admin\" && password == Wordpressed.password\n end\n end\n #warden.custom_failure! if performed?\n end",
"def protect_against_forgery?; end",
"def current_user\n # if a user is logged in we just use devise's implementation.\n super || guest_user\n end",
"def admin_only_mode\n unless current_user.try(:admin?)\n unless params[:controller] == \"visitors\" || params[:controller] == \"registrations\" || params[:controller] == \"devise/sessions\"\n redirect_to :controller => \"visitors\", :action => \"restricted\", :alert => \"Admin only mode activated.\"\n flash[:notice] = \"Admin only mode activated. You need to be an admin to make changes.\"\n end\n\n if params[:controller] == \"visitors\" && params[:action] == \"index\"\n redirect_to :controller => \"visitors\", :action => \"restricted\", :alert => \"Admin only mode activated.\"\n flash[:notice] = \"Admin only mode activated. You need to be an admin to make changes.\"\n end\n end\n\n puts params\n puts params[:controller] == \"devise/sessions\"\n end",
"def secure?\n #debugger\n false\n end",
"def can_process_run\r\n if respond_to?(:dc_can_process)\r\n response = send(:dc_can_process)\r\n return response unless response.class == Array\r\n else\r\n response = [DcPermission::CAN_VIEW, CmsHelper.table_param(params) || 'dc_memory']\r\n end\r\n dc_user_can *response\r\nend",
"def current_user(*args)\n warden.user(*args)\n end",
"def current_user(*args)\n warden.user(*args)\n end",
"def enable_termination_protection\n data[:enable_termination_protection]\n end"
] | [
"0.67677003",
"0.67677003",
"0.66955197",
"0.66955197",
"0.66955197",
"0.66024566",
"0.65551835",
"0.65441674",
"0.65441674",
"0.65441674",
"0.6272199",
"0.6068683",
"0.6043555",
"0.593299",
"0.5779282",
"0.57606363",
"0.57467663",
"0.568822",
"0.5604814",
"0.5573569",
"0.5568098",
"0.55645674",
"0.5523425",
"0.5480137",
"0.54661256",
"0.5463531",
"0.54108596",
"0.5383874",
"0.5383874",
"0.53117543",
"0.5261934",
"0.52560794",
"0.5239747",
"0.52353173",
"0.523302",
"0.5224543",
"0.52002513",
"0.5184347",
"0.5171298",
"0.5114964",
"0.5114964",
"0.51012605",
"0.50820667",
"0.50671256",
"0.50599337",
"0.5044082",
"0.5033817",
"0.5028118",
"0.50053346",
"0.4997559",
"0.4993911",
"0.4993611",
"0.4989355",
"0.4985777",
"0.4970233",
"0.4969949",
"0.49695215",
"0.49632365",
"0.49562666",
"0.4953257",
"0.4946757",
"0.49429762",
"0.49330413",
"0.4920935",
"0.49172235",
"0.4911589",
"0.49003747",
"0.48895085",
"0.48842746",
"0.487443",
"0.4871776",
"0.4862149",
"0.48605648",
"0.48599637",
"0.48379523",
"0.48305956",
"0.48288926",
"0.48275006",
"0.48234648",
"0.48230198",
"0.48137698",
"0.48116252",
"0.4806788",
"0.48012617",
"0.47963938",
"0.47962588",
"0.47958785",
"0.4785486",
"0.47850657",
"0.47792697",
"0.4777389",
"0.4777389",
"0.47713485",
"0.47699308",
"0.4766083",
"0.47524115",
"0.47515097",
"0.47464293",
"0.47458115",
"0.47458115",
"0.47424787"
] | 0.0 | -1 |
We need to set up the environment variables and the response in the controller. source://devise//lib/devise/test/controller_helpers.rb43 | def setup_controller_for_warden; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\r\n @controller = ExpenseTypesController.new\r\n @request = ActionController::TestRequest.new\r\n @response = ActionController::TestResponse.new\r\n\r\n @request.user_agent = 'Firefox'\r\n @request.host = \"jose.#{DOMAIN_NAME}\"\r\n login_as :jose\r\n end",
"def setup_request_environment(controller_class)\n controller_class.class_eval do\n def rescue_action(e)\n raise e\n end\n end\n @controller = controller_class.new\n @controller.request = @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n \n @controller.params = {}\n @controller.send(:initialize_current_url)\n end",
"def setup\n @controller = ImpasseTestCaseController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n User.current = nil\n end",
"def setup_controller_request_and_response\n setup_controller_request_and_response_without_vanity\n Vanity.context = @controller\n end",
"def setup_controller(controller, env, vars)\n controller.env = env\n controller.headers = {}\n\n setup_controller_params(controller, env, vars)\n\n controller.cookies = Fastr::HTTP.parse_cookies(env)\n controller.app = self\n end",
"def setup\n @controller = UserController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n end",
"def setup\r\n @controller = InvoicesController.new\r\n @request = ActionController::TestRequest.new\r\n @response = ActionController::TestResponse.new\r\n\r\n @first = Invoice.find(:first) \r\n @request.user_agent = 'Firefox'\r\n @request.host = \"quentin.#{DOMAIN_NAME}\"\r\n login_as :quentin\r\n end",
"def setup\n @request.env[\"devise.mapping\"] = Devise.mappings[:admin]\n sign_in FactoryGirl.create(:admin)\n end",
"def setup\n return if self.class.name =~ /TestCase$/ and not $TESTING_RTC\n super\n\n @controller_class = Object.path2class @controller_class_name\n raise \"Can't determine controller class for #{self.class}\" if @controller_class.nil?\n\n @controller = @controller_class.new\n\n @session = ActionController::TestSession.new\n\n @flash = ActionController::Flash::FlashHash.new\n @session['flash'] = @flash\n\n @request = ActionController::TestRequest.new\n @request.session = @session\n\n # HACK There's probably an official way to do this\n @controller.instance_variable_set :@_session, @request.session\n\n @response = ActionController::TestResponse.new\n\n setup_extra if respond_to? :setup_extra\n end",
"def configure_environment\n\n=begin\n :: Expected Params ::\n \n Constants::REQUEST_PARAM_TEST => Server Mode (Is Production or Staging?) \n\n=end \n\n if params[Constants::REQUEST_PARAM_TEST].present?\n\n if params[Constants::REQUEST_PARAM_TEST] == \"1\"\n\n ENV[Constants::ENVIRONMENT_VAR_FOR_STAGING] = '1'\n\n else\n \n ENV.delete(Constants::ENVIRONMENT_VAR_FOR_STAGING) \n\n end \n\n end \n\n render json: {status: status_code(:ok), message: \"\", data: {:is_staging => (ENV[Constants::ENVIRONMENT_VAR_FOR_STAGING].present? ? 1 : 0)}}\n\n end",
"def setup\n @response_catcher = HttpResponseCatcher.new\n self.class.controller.http_call_back = @response_catcher\n end",
"def setup\n @controller = BackofficeController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n \n @request.user_agent = 'Firefox'\n @request.host = \"www.#{DOMAIN_NAME}\"\n end",
"def before_dispatch(env); end",
"def setup_environment; end",
"def setup\n @model = Participant\n @controller = ParticipantsController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n\n @request.session[:user] = User.find(users(:superadmin).id )\n roleid = User.find(users(:superadmin).id).role_id\n Role.rebuild_cache\n\n Role.find(roleid).cache[:credentials]\n @request.session[:credentials] = Role.find(roleid).cache[:credentials]\n # Work around a bug that causes session[:credentials] to become a YAML Object\n @request.session[:credentials] = nil if @request.session[:credentials].is_a? YAML::Object\n @settings = SystemSettings.find(:first)\n AuthController.set_current_role(roleid,@request.session)\n\n @User = participants(:par15)\n end",
"def setup\n RedmineEvm::TestCase.prepare\n\n @controller = BaselinesController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n User.current = nil\n end",
"def env_vars\n {\n \"VMWARE_USER\" => auth.userid || \"\",\n \"VMWARE_PASSWORD\" => auth.password || \"\",\n \"VMWARE_HOST\" => auth.host || \"\"\n }\n end",
"def setup\n @controller = MainController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n end",
"def setup\n RedmineContactsInvoices::TestCase.prepare\n\n @controller = ExpenseImportsController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n \n User.current = nil \n end",
"def before_dispatch(_env)\n end",
"def setup\n @account = accounts(:test_account)\n @user = @account.users.first\n \n # All requests are at account domain with logged-in user unless\n # otherwise specified in the test method\n @request.host = \"#{@account.domain}.ticktockapp.com\"\n @request.session = {:user_id => @user.id}\n end",
"def set_fake_env\n if current_user.nil?\n @current_account = if params[:account_id].blank?\n Account.first\n else\n Account.find(params[:account_id])\n end\n\n @current_user = @current_account.permissioned_users.first\n end\n end",
"def setup\n @controller = CardioController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n end",
"def process_environment(env)\n request_data = { \n :url => env['REQUEST_URI'],\n :ip_address => env['HTTP_X_FORWARDED_FOR'] ? env['HTTP_X_FORWARDED_FOR'] : env['REMOTE_ADDR']\n }\n request_data[:user] = env['HTTP_USER_EMAIL'] if env['HTTP_USER_EMAIL']\n\n env['rack.input'].rewind\n parameters = ''\n env['rack.input'].each { |line| parameters += line }\n request_data[:parameters] = parameters if parameters\n\n server_name = env[\"SERVER_NAME\"].split('.').first\n env_name = @email_options['environment_name'][server_name]\n\n { :environment_data => env.map { |l| \" * #{l}\" }.join(\"\\n\"),\n :request_data => request_data,\n :server_name => server_name,\n :env_name => env_name\n }\n end",
"def setup\n @driver = get_driver\n login\n @accept_next_alert = true\n @verification_errors = [] \n end",
"def setup\n @driver = get_driver\n login\n @accept_next_alert = true\n @verification_errors = [] \n end",
"def setup\n @driver = get_driver\n login\n @accept_next_alert = true\n @verification_errors = [] \n end",
"def setup\n @controller = SourceDataController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n \n @source_name = 'something'\n @unexistent_name = 'somewhat'\n end",
"def setup\r\n\t\t@controller = Admin::UserController.new\r\n\t\t@request = ActionController::TestRequest.new\r\n\t\t@response = ActionController::TestResponse.new\r\n\t\t# Retrieve fixtures via their name\r\n\t\t# @first = users(:first)\r\n\t\t@first = User.find_first\r\n\tend",
"def setup\n # this method gets called before *each* omniauth endpoint call, so try to avoid logging when we're returning from\n # oauth'ing\n unless stored_register_redirect\n reg_redirect = params[:r]\n reg_redirect ||= request.referer if params[:ot] && (params[:ot] == \"far\") # facebook auth referral\n store_register_redirect(reg_redirect)\n end\n\n unless stored_auth_redirect\n auth_redirect = params[:r]\n auth_redirect ||= root_path if params[:state] && (params[:state] == 'w')\n store_auth_redirect(auth_redirect)\n end\n\n remember_remember_me\n remember_signup_flow_scope\n remember_signup_flow_type\n remember_signup_flow_origin_type\n remember_signup_flow_destination\n remember_signup_flow_network\n render :text => \"Setup complete.\", :status => 404\n end",
"def setup\n @env = { Rack::Session::Abstract::ENV_SESSION_KEY => '123456', Rack::Session::Abstract::ENV_SESSION_OPTIONS_KEY => Rack::Session::Abstract::ID::DEFAULT_OPTIONS}\n SmartSessionApp.test_proc = nil\n end",
"def build_env(connection, request); end",
"def setup_ip\n @request = ActionController::TestRequest.create(self.class.controller_class)\n @request.remote_addr = \"127.0.0.1\"\n session[:user_id] = 1\n end",
"def init_env\n @resource_descriptions = HashWithIndifferentAccess.new { |h, version| h[version] = {} }\n @controller_to_resource_id = {}\n @param_groups = {}\n\n # what versions does the controller belong in (specified by resource_description)?\n @controller_versions = Hash.new { |h, controller| h[controller] = [] }\n end",
"def testProviderEnv\n initTestCase do\n require \"WEACEToolkit/Install/#{@Type}/Providers/#{@ProductID}\"\n lProviderPlugin = eval(\"WEACEInstall::#{@Type}::Providers::#{@ProductID}.new\")\n\n # If there is a need to instantiate variables, do it now\n if (defined?(getVariablesToInstantiate))\n instantiateVars(lProviderPlugin, getVariablesToInstantiate)\n end\n\n lProviderEnv = lProviderPlugin.getProviderEnvironment\n assert(lProviderEnv.kind_of?(Hash))\n # Call specific checks\n checkEnvironment(lProviderEnv)\n end\n end",
"def setup(env)\n @request = Mack::Request.new(env) \n @response = Mack::Response.new\n @cookies = Mack::CookieJar.new(self.request, self.response)\n @runner_helpers = []\n Mack::RunnerHelpers::Registry.registered_items.each do |helper|\n help = helper.new\n help.start(self.request, self.response, self.cookies)\n @runner_helpers << help\n end\n end",
"def setup\n @controller = AuthorController.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n end",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def env_config; end",
"def setup_env\n @env['kiwi.app'] = self\n @env['kiwi.mime'] = @env['HTTP_ACCEPT']\n @env['kiwi.params'] = ::Rack::Request.new(@env).params\n @env['kiwi.path'] = @env['PATH_INFO']\n @env['kiwi.method'] = @env['REQUEST_METHOD'].downcase.to_sym\n @env['kiwi.format'] ||= @env['kiwi.mime'].to_s.sub(%r{^\\w+/\\w+\\+?}, '')\n @env['kiwi.serializer'] ||= Kiwi.serializers[@env['kiwi.format'].to_sym]\n @env['kiwi.resource'] ||=\n self.class.resources.find{|rsc| rsc.routes? @env['kiwi.path']}\n end",
"def env\n return super unless anycabled?\n\n request.env\n end",
"def extract_and_merge_controller_data(data)\n if @controller\n data[:request] = {\n params: @controller.request.parameters.to_hash,\n rails_root: defined?(Rails) && defined?(Rails.root) ? Rails.root : \"Rails.root not defined. Is this a test environment?\",\n url: @controller.complete_request_uri\n }\n data[:environment].merge!(@controller.request.env.to_hash)\n\n @controller.session[:fault_in_session]\n data[:session] = {\n key: @controller.request.session_options[:id],\n data: @controller.session.to_hash\n }\n end\n end",
"def setup\n @response ||= {}\n end",
"def setup\n post '/login', :fb_access_token => FB_ACCESS_TOKEN\n assert last_response.ok?\n # puts \"[TEST] -- \" + last_response.body\n hash = JSON.parse(last_response.body)\n assert hash.key? \"token\"\n assert hash.key? \"signup\"\n assert hash[\"signup\"] == \"false\" or hash[\"signup\"] == \"true\"\n assert hash[\"token\"].class == String and hash[\"token\"].length > 0\n @@token = hash[\"token\"]\n end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def env; end",
"def call(env)\r\n\r\n ## check for existance of Cookie\r\n if /(MSIE|Internet Explorer)/ =~ env['HTTP_USER_AGENT']\r\n ## USER_AGENT is a IE-based browser\r\n require 'net/ntlm'\r\n require 'kconv'\r\n\r\n ## See if it is possible to use NTLM to autenticate\r\n if env['HTTP_AUTHORIZATION'].blank?\r\n return [401, {'WWW-Authenticate' => \"NTLM\"}, []]\r\n end\r\n if /^(NTLM|Negotiate) (.+)/ =~ env[\"HTTP_AUTHORIZATION\"]\r\n\r\n message = Net::NTLM::Message.decode64($2)\r\n\r\n if message.type == 1\r\n type2 = Net::NTLM::Message::Type2.new\r\n return [401, {\"WWW-Authenticate\" => \"NTLM \" + type2.encode64}, []]\r\n end\r\n\r\n if message.type == 3\r\n user = Net::NTLM::decode_utf16le(message.user)\r\n require \"base64\"\r\n env['AUTH_USER'] = user\r\n env['AUTH_USER_AUTH'] = Base64.encode64(user)\r\n env['AUTH_DATETIME'] = Time.now.utc\r\n else\r\n return [401, {}, [\"You are not authorized to see this page\"]]\r\n end\r\n end\r\n @app.call(env)\r\n else\r\n ##############################################################\r\n # USER_AGENT is a NON-IE-based browser (Firefox, Safari, etc.)\r\n #\r\n # Process these agents using session based cookies which\r\n # are authenticated via kerberos. Once the agent quits their\r\n # browser session or clears their cookies during an open\r\n # browser session, the agent must re-authenticate via their\r\n # kerberos username and password. Authenticated user agents\r\n # have the correct AUTH_USER (network login name) inserted\r\n # as an environmental variable prior to their being sent on\r\n # any followon Rails application. The login is completely\r\n # customizable and does not use the browser's login capability.\r\n #\r\n ##############################################################\r\n\r\n auth_user = get_cookie(env,'AUTH_USER')\r\n auth_user_auth = get_cookie(env,'AUTH_USER_AUTH')\r\n require \"base64\"\r\n auth_user_auth_v = (auth_user_auth.nil?) ? nil : Base64.decode64(auth_user_auth)\r\n\r\n if auth_user.nil? || auth_user_auth.nil? || auth_user != auth_user_auth_v\r\n ## Not yet Authenticated\r\n lgin = \"<form action=\\\"#{env['rack.url_scheme']}://\"\r\n lgin += \"#{env['SERVER_NAME']}#{env['REQUEST_URI']}\\\" method=\\\"post\\\">\\n\"\r\n lgin += \"Username:<br><input type=\\\"text\\\" name=\\\"kun\\\" id=\\\"kun\\\" />\\n<p>\"\r\n lgin += \"Password:<br><input type=\\\"password\\\" name=\\\"kpw\\\" id=\\\"kpw\\\" />\\n<p>\"\r\n lgin += \"<input type=\\\"submit\\\" value=\\\"Login\\\"/>\\n</form>\\n</body>\\n</html>\\n\"\r\n\r\n if env['REQUEST_METHOD'] == 'POST'\r\n ## Authenticate un/pw sent via POST\r\n require 'rkerberos'\r\n kerberos = Kerberos::Krb5.new\r\n realm ||= kerberos.get_default_realm\r\n user = env['rack.request.form_hash']['kun']\r\n user_with_realm = user.dup\r\n user_with_realm += \"@#{realm}\" unless user.include?('@')\r\n password = env['rack.request.form_hash']['kpw']\r\n\r\n begin\r\n kerberos.get_init_creds_password(user_with_realm, password)\r\n rescue Kerberos::Krb5::Exception => err\r\n ## Authentication was UNSUCCESSFUL - username/password typo\r\n env.delete('AUTH_USER')\r\n env['AUTH_MSG'] = \"Error attempting to validate userid and password\"\r\n env['AUTH_FAIL'] = err.message\r\n\r\n rescue => err\r\n env.delete('AUTH_USER')\r\n env['AUTH_FAIL'] = \"Unexpected failure during Kerberos authentication\"\r\n\r\n else\r\n ## Authentication was Successful - Update AUTH_USER\r\n env.delete('AUTH_FAIL')\r\n env['AUTH_USER'] = user\r\n env['AUTH_USER_AUTH'] = Base64.encode64(user)\r\n env['AUTH_DATETIME'] = Time.now.utc\r\n\r\n ensure\r\n ## Clean up any outstanding calls from above operations\r\n kerberos.close\r\n\r\n end\r\n\r\n if env.has_key?('AUTH_USER')\r\n ## Authentication was successful, set cookies and pass on to Rails\r\n ## SET COOKIES\r\n status,headers,response = @app.call(clean_params(env))\r\n Rack::Utils.set_cookie_header!(headers, \"AUTH_USER\",\r\n {:value => env['AUTH_USER'], :path => \"/\"})\r\n Rack::Utils.set_cookie_header!(headers, \"AUTH_USER_AUTH\",\r\n {:value => env['AUTH_USER_AUTH'], :path => \"/\"})\r\n [status,headers,response]\r\n else\r\n ## Authentication was UNsuccessful, flash login and indicate error\r\n status,headers,ignore = @app.call(env)\r\n response = \"<!DOCTYPE html>\\n<!-- #{env['AUTH_FAIL']} -->\\n<!-- #{env.inspect} -->\\n\"\r\n response << \"<html>\\n<body>\\n<font color=#ff0000>#{env['AUTH_MSG']}</font><p>\\n\"\r\n response << lgin\r\n response = [response]\r\n headers[\"Content-Length\"] = response.size.to_s\r\n [status,headers,response]\r\n end\r\n else\r\n ## Show RACK login\r\n status,headers,ignore = @app.call(env)\r\n response = \"<!DOCTYPE html>\\n<!-- #{env['AUTH_FAIL']} -->\\n<!-- #{env.inspect} -->\\n\"\r\n response << lgin\r\n response = [response]\r\n headers[\"Content-Length\"] = response.size.to_s\r\n [status,headers,response]\r\n end\r\n else\r\n ## Assume user is authenticated and pass correct AUTH_USER to Rails application\r\n env['AUTH_USER'] = auth_user\r\n env['AUTH_USER_AUTH'] = auth_user_auth\r\n env['AUTH_DATETIME'] = Time.now.utc\r\n @app.call(env)\r\n end\r\n end\r\n end",
"def devise_controller?; end",
"def setup_env_params\n {\n url: @request.respond_to?(:original_url) ? @request.original_url : @request.path_info,\n referrer: @request.referer,\n http_method: action_dispatch? ? @request.method : @request.request_method,\n ip_address: @request.respond_to?(:remote_ip) ? @request.remote_ip : @request.ip,\n user_agent: @request.user_agent\n }\n end",
"def check_and_set_environment\n check_env\n set_env\n end",
"def setup\n @request = ActionController::TestRequest.new\n @request.env['REQUEST_URI'] = \"http://localhost\"\n @request.env['HTTP_USER_AGENT'] = \"TestUA\"\n TLA_CONFIG['caching'] = false\n TLA_CONFIG['testing'] = true\n end",
"def env_vars\n env = {\n \"ANSIBLE_NET_USERNAME\" => auth.userid || \"\",\n \"ANSIBLE_NET_PASSWORD\" => auth.password || \"\",\n \"ANSIBLE_NET_AUTHORIZE\" => auth.authorize ? \"1\" : \"0\"\n }\n\n env[\"ANSIBLE_NET_AUTH_PASS\"] = auth.become_password || \"\" if auth.authorize\n env[\"ANSIBLE_NET_SSH_KEYFILE\"] = network_ssh_key_file if auth.auth_key\n env\n end",
"def env\n @env ||= env_with_params\nend",
"def environment_credentials\n {\n url: ENV['ONEVIEW_URL'],\n ssl_enabled: ENV['ONEVIEW_SSL_ENABLED'],\n log_level: ENV['ONEVIEW_LOG_LEVEL'] || 'info',\n api_version: ENV['ONEVIEW_API_VERSION'] || 200,\n token: ENV['ONEVIEW_TOKEN'] || nil,\n user: ENV['ONEVIEW_USER'] || nil,\n password: ENV['ONEVIEW_PASSWORD'] || nil,\n hardware_variant: ENV['ONEVIEW_HARDWARE_VARIANT'] || 'C7000'\n }\nend",
"def setup_log_in\n @user = users(:user_test)\n\n if @user.api_key.blank?\n flunk \"You must set the \\\"CHALLONGE_MGR_TEST_USER_API_KEY\\\"\" \\\n \" environment variable to run system tests.\" \\\n end\n\n log_in_as(@user)\n end",
"def setup\n # !!!! Once you have enabled test mode, all requests to OmniAuth will be short circuited to use the mock authentication hash.\n # A request to /auth/provider will redirect immediately to /auth/provider/callback !!!!\n OmniAuth.config.test_mode = true\n end",
"def stub_env_for_gds_omniauth(uid, details = {})\n # This a Devise specific thing for functional tests. See https://github.com/plataformatec/devise/issues/closed#issue/608\n request.env[\"devise.mapping\"] = Devise.mappings[:user]\n @stub_omniauth_hash = gds_omniauth_hash_stub(uid, details)\n env = {\n \"omniauth.auth\" => @stub_omniauth_hash,\n }\n @controller.stub(:env).and_return(env)\n end",
"def setup\n # $log_on = true\n Sage::Test::Server.cas_server_sage.ensure\n Sage::Test::Server.sagebusinessbuilder.ensure\n Sage::Test::Server.sageaccountmanager.ensure\n Sage::Test::Server.billingboss.ensure\n @user = watir_session.with_sage_user(:castest)\n SSO::SAM.prepare\n assert_recaptcha_off(@user)\n SSO::SBB.prepare(true)\n @user.logs_out_cas\n @debug = false\n end",
"def setup \n \t@user = User.create(email: '[email protected]', password: '123456789', \n \t\tpassword_confirmation: '123456789')\n \[email protected][\"devise.mapping\"] = Devise.mappings[:user]\n \t@user1 = users(:one)\n \[email protected] = accounts(:one)\n end",
"def env=(environment); end",
"def env=(environment); end",
"def set_env_success( request = nil )\n self['login_count'] ||= 0\n self['login_count'] += 1\n self['last_login_at'] = current_login_at\n self['current_login_at'] = Time.now\n self['last_login_ip'] = current_login_ip\n if( request )\n self['current_login_ip'] = request.env[\"REMOTE_ADDR\"]\n request.env[\"REMOTE_USER\"] = id\n end\n save\n end",
"def normalize_env(env, client); end",
"def getTestSettings()\n\n [:accounts, :browser, :host, :userid, :password].each do |k|\n\n puts __FILE__ + (__LINE__).to_s + \" opt[test_config].has_key(#{k.to_s}) => #{@options[:test_config].has_key?(k.to_s)}\" if Scoutui::Utils::TestUtils.instance.isDebug?\n\n puts __FILE__ + (__LINE__).to_s + \" options[#{k}] : #{@options[k].to_s}\" if Scoutui::Utils::TestUtils.instance.isDebug?\n if @options.has_key?(k) && !@options[k].nil?\n Scoutui::Base::UserVars.instance.set(k, @options[k].to_s)\n elsif @options[:test_config].has_key?(k.to_s)\n\n puts __FILE__ + (__LINE__).to_s + \" opts[#{k}].nil => #{@options[k].nil?}\" if Scoutui::Utils::TestUtils.instance.isDebug?\n # Ensure commnand line takes precedence\n if !@options[k].nil?\n puts __FILE__ + (__LINE__).to_s + \" opt[#{k.to_s} => #{@options[k].to_s}\" if Scoutui::Utils::TestUtils.instance.isDebug?\n Scoutui::Base::UserVars.instance.set(k, @options[k].to_s)\n else\n Scoutui::Base::UserVars.instance.set(k, @options[:test_config][k.to_s].to_s)\n end\n\n elsif @env_list.has_key?(k)\n # If an ENV is available, use it.\n puts __FILE__ + (__LINE__).to_s + \" #{k} => ENV(#{@env_list[k]}) = #{ENV[@env_list[k].to_s]}\" if Scoutui::Utils::TestUtils.instance.isDebug?\n Scoutui::Base::UserVars.instance.set(k, ENV[@env_list[k].to_s])\n end\n end\n\n puts __FILE__ + (__LINE__).to_s + \" test_config => #{@options[:test_config]}\" if Scoutui::Utils::TestUtils.instance.isDebug?\n\n\n # Applitools Eyes settings\n if @options[:test_config].has_key?('eyes')\n\n ['match_level', 'title', 'app', 'viewport'].each do |k|\n\n _v=nil\n\n if @options[:test_config]['eyes'].has_key?(k)\n _v=@options[:test_config]['eyes'][k].to_s\n end\n\n if !@options[k.to_sym].nil?\n _v=@options[k.to_sym].to_s\n end\n\n if Scoutui::Utils::TestUtils.instance.isDebug?\n puts __FILE__ + (__LINE__).to_s + \" #{k} => #{_v}\"\n end\n\n Scoutui::Base::UserVars.instance.set('eyes.' + k, _v) if !_v.nil?\n\n end\n end\n\n @options[:test_config]\n end",
"def bootstrap\n\n if (self.csrf_token.nil?)\n csrf!\n end\n\n #\n # First need developer token\n #\n if (self.developer_token.nil?)\n config!\n end\n\n #\n # Need to login too\n #\n if (self.access_token.nil?)\n login!\n end\n end",
"def call(env)\n request = WelltreatStoreFramework::Controller::Request.initialize_from_env(env)\n response = WelltreatStoreFramework::Controller::Response.new\n options = {\n session: env['rack.session']\n }\n\n dispatch request.path, request, response, options\n render! request, response, options\n\n [response.status, response.headers, [response.content]]\n end",
"def env\n @_request.env\n end",
"def test_icinga_variables\n NagiosHerald::Config.config['icinga'] = true\n @executor.load_env_from_file(@options[:env])\n assert_equal \"[email protected]\", get_nagios_var('NAGIOS_CONTACTEMAIL')\n assert_equal \"[email protected]\", get_nagios_var('ICINGA_CONTACTEMAIL')\n assert_equal \"PROBLEM\", get_nagios_var('NAGIOS_NOTIFICATIONTYPE')\n end",
"def setup\n# Connection.establish_connection_schema('railstest')\n @controller = CustomerController.new \n @request = ActionController::TestRequest.new \n @response = ActionController::TestRespons e.new\n end",
"def add_values_application_controller\n inject_into_class \"app/controllers/application_controller.rb\", \"ApplicationController\" do\n \" helper_method :current_user \\n \" +\n \" after_filter :path \\n\"+\n \" private \\n\" +\n \" def current_user \\n\" +\n \" table_name = Rails.application.config.devise_model_name.titlecase \\n\"+\n \" @table_name = table_name.constantize \\n\"+\n \" @current_user ||= @table_name.find(session[:user_id]) if session[:user_id] \\n\\n\" +\n \" end \\n\\n\" +\n \" def path \\n\"+\n \" path= request.path \\n\"+\n \" notice = request.flash[:notice] \\n\"+\n \" @devise_model_name = Rails.application.config.devise_model_name \\n\"+\n \" if path == '/'+@devise_model_name+'s/sign_up' && notice == 'This is one time process' \\n\"+\n \" count =+ 1 \\n\"+\n \" if count == 1 \\n\"+\n \" session[:last_get_url] = '1' \\n\"+\n \" end \\n\"+\n \" else \\n\"+\n \" count = 0 \\n\"+\n \" session[:last_get_url] = '0' \\n\"+\n \" end \\n\"+\n \" end \\n\\n\"+\n \" def after_sign_in_path_for(current_user) \\n\"+\n \" last_get_url = session[:last_get_url] \\n\"+\n \" if session[:last_get_url].to_s == '1' \\n\"+\n \" @devise_model_name = Rails.application.config.devise_model_name \\n\"+\n \" table_name = Rails.application.config.devise_model_name.titlecase \\n\"+\n \" @table_name = table_name.constantize\\n\"+\n \" @user = @table_name.find_by_id(current_user) \\n \" +\n \" @socialAccounts = SocialAccount.find_by_user_id(@user.id.to_s) \\n\\n\"+\n \" if @socialAccounts \\n \"+\n \" session[:user_id] = @user.id \\n\"+\n \" sign_in(@user) \\n\"+\n \" return root_path \\n\"+\n \" else \\n\"+\n \" @newaccount = SocialAccount.new \\n\"+\n \" @newaccount.user_id = @user.id \\n\"+\n \" @newaccount.provider = session[:auth_provider] \\n\"+\n \" @newaccount.uid = session[:auth_uid] \\n\"+\n \" @newaccount.account_name = session[:auth_account_name] \\n\"+\n \" @newaccount.save! \\n\"+\n \" session[:user_id] = @user.id \\n\"+\n \" sign_in(@user) \\n\"+\n \" return root_path \\n\"+\n \" end \\n\"+\n \" else \\n\"+\n \" session.delete(:auth_provider) \\n\"+\n \" session.delete(:auth_uid) \\n\"+\n \" session.delete(:auth_account_name) \\n\"+\n \" return root_path \\n\"+\n \" end \\n\"+\n \" end \\n\\n\"\n end #EO inject_into_class\n end",
"def test_set_express_authorization\n @options.update(\n :return_url => 'http://example.com',\n :cancel_return_url => 'http://example.com',\n :email => '[email protected]'\n )\n response = @gateway.setup_authorization(500, @options)\n assert response.success?\n assert response.test?\n assert !response.params['token'].blank?\n end",
"def env_vars\n {\n \"AWS_ACCESS_KEY_ID\" => auth.userid || \"\",\n \"AWS_SECRET_ACCESS_KEY\" => auth.password || \"\",\n \"AWS_SECURITY_TOKEN\" => auth.auth_key\n }.delete_nils\n end",
"def prepare\n login\n end",
"def setup\n TestUtils.set_workday_default\n TestUtils.enable_module_on_project 1\n @request.session[:user_id] = 1\n end",
"def static_env; end",
"def static_env; end",
"def static_env; end",
"def env_key; end"
] | [
"0.64643145",
"0.6436695",
"0.63970125",
"0.63757867",
"0.63435256",
"0.6175502",
"0.6155247",
"0.6077639",
"0.6054145",
"0.6042302",
"0.60134387",
"0.6000093",
"0.5994797",
"0.59553814",
"0.5954505",
"0.5932311",
"0.59237045",
"0.59059787",
"0.5864622",
"0.58593243",
"0.58503777",
"0.5797015",
"0.5733425",
"0.5732534",
"0.5693898",
"0.5693898",
"0.5693898",
"0.5661763",
"0.56397295",
"0.5558082",
"0.55575687",
"0.55453",
"0.5532348",
"0.5529736",
"0.54889554",
"0.5484277",
"0.5476156",
"0.54688144",
"0.54688144",
"0.54688144",
"0.54688144",
"0.54637843",
"0.5461676",
"0.5453755",
"0.5445422",
"0.5432132",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54193294",
"0.54128563",
"0.54101807",
"0.539621",
"0.538714",
"0.5384538",
"0.53810155",
"0.5378652",
"0.5378427",
"0.5365005",
"0.53562295",
"0.53371847",
"0.5323743",
"0.53169996",
"0.5312186",
"0.5312186",
"0.53089446",
"0.5300006",
"0.5298395",
"0.529773",
"0.52961576",
"0.52856046",
"0.528349",
"0.52833074",
"0.52819896",
"0.5279436",
"0.52625275",
"0.52572966",
"0.52420485",
"0.52384794",
"0.52384794",
"0.52384794",
"0.52373207"
] | 0.550592 | 34 |
sign_in a given resource by storing its keys in the session. This method bypass any warden authentication callback. +resource+ The resource that should be authenticated +scope+ An optional +Symbol+ with the scope where the resource should be signed in with. Examples: sign_in users(:alice) sign_in users(:alice), scope: :admin source://devise//lib/devise/test/controller_helpers.rb67 | def sign_in(resource, deprecated = T.unsafe(nil), scope: T.unsafe(nil)); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_in(resource_or_scope, resource=nil)\n scope ||= Devise::Mapping.find_scope!(resource_or_scope)\n resource ||= resource_or_scope\n warden.instance_variable_get(:@users).delete(scope)\n warden.session_serializer.store(resource, scope)\n end",
"def sign_in(resource_or_scope, resource=nil)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n resource ||= resource_or_scope\n warden.set_user(resource, :scope => scope)\n end",
"def sign_in_and_redirect(resource_or_scope, resource=nil)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n resource ||= resource_or_scope\n sign_in(scope, resource) unless warden.user(scope) == resource\n redirect_to stored_location_for(scope) || after_sign_in_path_for(resource)\n end",
"def sign_in_and_redirect(resource_or_scope, resource=nil)\n\t scope = Devise::Mapping.find_scope!(resource_or_scope)\n\t resource ||= resource_or_scope\n\t sign_in(scope, resource) unless warden.user(scope) == resource\n\t # redirect_to stored_location_for(scope) || after_sign_in_path_for(resource)\n\t render :json => {:status => :signed_in}\n\tend",
"def sign_in_and_redirect(resource_or_scope, resource=nil)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n resource ||= resource_or_scope\n sign_in(scope, resource) unless warden.user(scope) == resource\n return render :json => {:success => true}\n end",
"def signed_in_resource\n warden.authenticate(scope: resource_name)\n end",
"def sign_in(resource_or_scope, *args); end",
"def sign_in(resource, scope: T.unsafe(nil)); end",
"def sign_in(resource_or_scope, resource, role_name)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n last_login = resource.last_sign_in_at.strftime(\"%A, %B %d %Y at %I:%M %p.\") unless resource.last_sign_in_at.nil?\n warden.set_user(resource, :scope => scope) \n current_user.update_attribute(:is_signedin, true)\n #create_sessions(role_name,resource)\n set_flash_message :notice,\"Signed in successfully. Your last login was on #{last_login}\"\n end",
"def set_user_in_warden(scope, resource)\n scope = Devise::Mapping.find_scope!(scope)\n warden.set_user(resource, scope: scope, store: false)\n end",
"def sign_in_and_redirect(resource_or_scope, *args); end",
"def rails_authenticate\n self.resource = warden.authenticate!(auth_options)\n set_flash_message(:notice, :signed_in) if is_flashing_format?\n sign_in(resource_name, resource)\n\n yield resource if block_given?\n respond_with resource, location: after_sign_in_path_for(resource)\n end",
"def login(resource)\n login_as resource.user, scope: :user\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n set_flash_message!(:notice, :signed_in)\n sign_in(resource_name, resource)\n yield resource if block_given?\n respond_with resource, location: after_sign_in_path_for(resource)\n # super\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\")\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\")\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\n end",
"def sign_in_and_redirect2(resource_or_scope, *args)\n options = args.extract_options!\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n resource = args.last || resource_or_scope\n sign_in(scope, resource, options)\n redirect_to stored_location_for(:user) || root_path # thanks_for_registration_path\n end",
"def authenticate_scope!\r\n send(:\"authenticate_#{resource_name}!\")\r\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\r\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def sign_out(resource_or_scope)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n warden.user(scope) # Without loading user here, before_logout hook is not called\n warden.raw_session.inspect # Without this inspect here. The session does not clear.\n warden.logout(scope)\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n set_flash_message!(:notice, :signed_in)\n sign_in(resource_name, resource)\n # set the locale\n I18n.locale = resource.language\n # set the country\n session[:current_country_id] = resource.country_id\n yield resource if block_given?\n respond_with resource, location: after_sign_in_path_for(resource), locale: I18n.locale, country_id: resource.country_id\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\r\n sign_in(resource_name, resource)\r\n end",
"def authenticate_scope!\r\n send(:\"authenticate_user!\", :force => true)\r\n self.resource = send(:\"current_user\")\r\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def create\n begin\n self.resource = warden.authenticate!(auth_options)\n set_flash_message!(:notice, :signed_in)\n sign_in(resource_name, resource)\n yield resource if block_given?\n respond_to do |format|\n format.html {respond_with resource, location: after_sign_in_path_for(resource)}\n format.json { \n render json: {success: true, error: false, message: \"User is successfully logged in\", results: resource}, status: 200\n }\n end\n rescue Exception => e\n render json: {success: false, error: true, message: e}, status: 500\n end\n end",
"def sign_in_user user\n @request.env[\"devise.mapping\"] = Devise.mappings[:user]\n sign_in user\n end",
"def sign_in user\n \t# takes the user object and sets session data using said object\n \tsession[:user_id] = user.id\n \tself.current_user = user\n end",
"def sign_up(resource_name, resource)\n # sign_in(resource_name, resource)\n end",
"def sign_in (user)\n current_user = user\n end",
"def create\n \n resource = warden.authenticate!(auth_options)\n \n \n set_flash_message(:notice, :signed_in) if is_navigational_format?\n \n sign_in(resource_name, resource)\n \n respond_with resource, :location => after_sign_in_path_for(resource)\n \n end",
"def devise_scope(scope); end",
"def sign_in(username, password, api_key, platform)\n session.username = username\n session.password = password\n session.api_key = api_key\n session.platform = platform\n\n session.sign_in\n end",
"def sign_in(user)\n login_as user\n end",
"def sign_in(user)\n @current_user = user\n session[:user_id] = user.try(:id)\n end",
"def sign_in(user)\n session[:user_id] = user.id\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource) unless current_user_is_admin?\n end",
"def signed_in?(scope)\n warden.authenticate?(:scope => scope)\n end",
"def sign_in_as\n __debug_route\n __debug_request\n local_sign_in\n __log_activity(\"LOGIN #{resource}\")\n set_flash_notice(action: :create)\n auth_success_redirect\n rescue => error\n auth_failure_redirect(message: error)\n end",
"def sign_in(user)\n session[:user_id] = user.id\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n if resource.ativo\n set_flash_message(:notice, :signed_in) if is_navigational_format?\n sign_in(resource_name, resource)\n respond_with resource, :location => after_sign_in_path_for(resource)\n else\n sign_out(resource)\n flash[:alert] = \"Sua conta está inativa, por favor contate o suporte!\"\n redirect_to root_path\n end\n end",
"def sign_in(user)\n sign_out\n\n user.touch(:last_login_at)\n user_session = user.sessions.new(ip_address: request.remote_ip, user_agent: request.user_agent)\n if user_session.save\n user.password_resets.delete_all\n @current_session = user_session\n end\n end",
"def sign_in(user)\n session[:user_id] = user.id\n end",
"def sign_in(user)\n session[:user_id] = user.id\n end",
"def sign_in(user)\n session[:user_id] = user.id\n end",
"def sign_in(user)\n session[:user_id] = user.id\n end",
"def sign_in\n current_session || sign_user_in\nend",
"def sign_in\n session[:user_id] = @user.id\n end",
"def sign_in\n request.session = { authorized: true }\n end",
"def sign_in\n current_session || sign_user_in # not evaluated unless current session is nil\nend",
"def signin(user)\n session[:user_id] = user.id\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n set_flash_message(:notice, :signed_in) if is_flashing_format?\n sign_in(resource_name, resource)\n yield resource if block_given?\n respond_with resource, location: to_location(resource), serializer: Api::V1::CurrentIndividualSerializer, root: false\n end",
"def sign_in(user:, password:)\n post user_session_path \\\n \"user[email]\" => user.email,\n \"user[password]\" => password\n end",
"def sign_up(resource_name, resource)\n # DO NOT sign_in(resource_name, resource)\n end",
"def create\n self.resource = warden.authenticate(auth_options)\n if self.resource\n sign_in(resource_name, self.resource)\n render json: {}\n else\n render json: {msg: \"Email или пароль указаны неверно\"}, status: 401\n end\n end",
"def create\n resource = nil\n caught = catch(:warden) do\n resource = warden.authenticate!(auth_options)\n end\n\n if resource\n # User is confirmed\n self.resource = resource\n set_flash_message(:notice, :signed_in) if is_flashing_format?\n sign_in(resource_name, resource)\n yield resource if block_given?\n @resource = resource\n elsif caught and caught[:message] == :not_approved\n # User is unconfirmed\n @resource = \"not_approved\"\n else\n # User is not signed in\n @resource = \"invalid\"\n end\n respond_to :html, :js\n end",
"def sign_in(user)\n if user.kind_of?(String)\n login_as(devise_user_class.find_by_email!(user))\n elsif user.class.name.end_with?('User')\n raise 'user must be persisted' unless user.persisted?\n user.reload\n\n devise_scope = user.class.name.underscore.gsub('/', '_').to_sym\n login_as(user, scope: devise_scope)\n elsif user == false\n true # Do nothing\n else\n raise 'sign_in(user) expected a User or an email String'\n end\n end",
"def create\n ret = super\n sign_in(resource.type.underscore, resource.type.constantize.send(:find, resource.id)) unless resource.type.nil?\n ret\n end",
"def sign_in(*args)\n warden.set_user *args\n end",
"def sign_in(user, password)\n post login_path, params: {session: {email: user.email, password: password}}\n end",
"def after_sign_in_path_for(resource_or_scope)\n current_user\n end",
"def require_no_authentication\n assert_is_devise_resource!\n return unless is_navigational_format?\n no_input = devise_mapping.no_input_strategies\n\n authenticated = if no_input.present?\n args = no_input.dup.push scope: resource_name\n warden.authenticate?(*args)\n else\n warden.authenticated?(resource_name)\n end\n\n if authenticated && resource = warden.user(resource_name)\n p \"user already signed in: \", warden.user\n p \"params: #{params}\"\n flash[:alert] = I18n.t(\"devise.failure.already_authenticated\")\n end\n end",
"def resource_params\n params.permit(devise_parameter_sanitizer.for(:sign_in))\n end",
"def sign_in(user = double('user'))\r\n if user.nil?\r\n allow(request.env['warden']).to receive(:authenticate!).and_throw(:warden, {:scope => :user})\r\n allow(controller).to receive(:current_user).and_return(nil)\r\n else\r\n allow(request.env['warden']).to receive(:authenticate!).and_return(user)\r\n allow(controller).to receive(:current_user).and_return(user)\r\n # allow(controller).to receive(:user_signed_in).and_return(user_signed_in)\r\n end\r\n end",
"def create_from_form\n if stored_anonymous_user?\n anonymous_user = current_user\n sign_out(current_user)\n end\n\n self.resource = warden.authenticate(auth_options)\n if self.resource.nil?\n begin\n self.resource = warden.authenticate!(auth_options)\n rescue Exception => e\n sign_in(anonymous_user)\n raise\n end\n else\n end\n\n set_flash_message(:notice, :signed_in) if is_navigational_format?\n\n sign_in(resource_name, resource)\n fandom_play_login(resource)\n \n redirect_after_successful_login()\n end",
"def login\n if params[:email]\n email = params[:email]\n resource = User.where(:email => email).first\n if !resource.nil? && resource.valid_password?(params[:password])\n sign_in(resource)\n else\n return head :forbidden\n end\n elsif current_user\n resource = current_user\n else\n return head :bad_request\n end\n\n resource.ensure_authentication_token!\n render json: {\n :id => resource.id.to_s,\n :email => resource.email,\n :auth_token => resource.authentication_token,\n :permissions => resource.permissions,\n :expiry_ts => (Time.now + Devise.timeout_in).to_i\n }\n end",
"def sign_in(user)\n post sessions_path, params: { email: user.email, password: 'mypass' }\n end",
"def login(user)\n @request.env['devise.mapping'] = Devise.mappings[:user]\n sign_in(user)\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n sign_in(resource_name, resource)\n respond_to do |format|\n format.json {\n render :json => {\n :user => Api::V1::LoginUserSerializer.new(current_user, root: false),\n :status => :ok,\n :authentication_token => current_user.authentication_token\n }\n }\n end\n end",
"def sign_in(user)\n post user_session_path \\\n 'user[email]'=> user.email,\n 'user[password]'=> user.password\n end",
"def stored_location_for(resource_or_scope)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n session.delete(:\"#{scope}_return_to\")\n end"
] | [
"0.8034034",
"0.7913604",
"0.70929253",
"0.7088172",
"0.695838",
"0.6878202",
"0.67731005",
"0.66403216",
"0.6612854",
"0.6426855",
"0.6162953",
"0.6018126",
"0.6015974",
"0.5888569",
"0.58494407",
"0.58494407",
"0.5809758",
"0.5769287",
"0.56973374",
"0.56973374",
"0.56973374",
"0.56973374",
"0.56973374",
"0.56973374",
"0.56973374",
"0.5686532",
"0.56846833",
"0.56841934",
"0.56841934",
"0.56841934",
"0.56841934",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.56333375",
"0.5617777",
"0.5610161",
"0.5597435",
"0.55957454",
"0.55872464",
"0.55586153",
"0.55155957",
"0.54681754",
"0.54632765",
"0.5454211",
"0.54015005",
"0.538781",
"0.5356424",
"0.5319801",
"0.5317507",
"0.5310903",
"0.530827",
"0.5306924",
"0.5306867",
"0.53019565",
"0.5293828",
"0.5290839",
"0.5290839",
"0.5290839",
"0.5290839",
"0.52817774",
"0.5244692",
"0.52436346",
"0.5235521",
"0.5234097",
"0.5222217",
"0.5215263",
"0.5204764",
"0.5196598",
"0.5155436",
"0.5133702",
"0.51249677",
"0.5112944",
"0.51069874",
"0.5105445",
"0.51046664",
"0.5104418",
"0.51016915",
"0.5096524",
"0.5065083",
"0.5054659",
"0.5050706",
"0.5045063",
"0.50221413",
"0.5021014"
] | 0.54984766 | 57 |
Sign out a given resource or scope by calling logout on Warden. This method bypass any warden logout callback. Examples: sign_out :user sign_out(scope) | def sign_out(resource_or_scope); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logout!(scope: nil)\n if scope\n warden.logout(scope)\n warden.clear_strategies_cache!(scope: scope)\n else\n warden.logout\n warden.clear_strategies_cache!\n end\n end",
"def sign_out(resource_or_scope)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n warden.user(scope) # Without loading user here, before_logout hook is not called\n warden.raw_session.inspect # Without this inspect here. The session does not clear.\n warden.logout(scope)\n end",
"def sign_out(*args)\n warden.logout(*args)\n end",
"def logout\n warden.authenticate!(:scope => resource_name)\n end",
"def sign_out\n cookies.permanent[:auth_token] = nil\n session[:scope_id] = session[:scope_type] = session[:redirect] = nil\n end",
"def logout(scopes=nil)\n scopes ? warden.logout(scopes) : warden.logout(warden.config.default_scope)\n end",
"def logout(scopes=nil)\n scopes ? warden.logout(scopes) : warden.logout(warden.config.default_scope)\n end",
"def sign_out\n session.sign_out\n end",
"def sign_out_and_redirect(resource_or_scope); end",
"def sign_out_and_redirect(resource_or_scope)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n sign_out(scope)\n redirect_to after_sign_out_path_for(scope)\n end",
"def sign_out\n post \"api/logout\"\n @me = nil\n end",
"def sign_out\n logout\n end",
"def sign_out\n @request.env[:clearance].sign_out\n end",
"def sign_out\n current_session.destroy if current_session\n @current_session = nil\n end",
"def sign_out\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n session.delete(:user_id)\n current_user = nil\n end",
"def sign_out\n reset_session\n @current_user = nil\n end",
"def sign_out\n session.delete :user_id\n @current_user = nil\n end",
"def sign_out_and_redirect(resource_or_scope)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n sign_out(scope)\n request.headers.has_key?(\"REMOTE_USER\") ? (render :template => \"sessions/destroy\") : (redirect_to after_sign_out_path_for(scope))\n end",
"def sign_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def force_logout\n sign_out(resource) if user_signed_in?\n end",
"def sign_out\n request.session.delete(:authorized)\n end",
"def sign_out\n forget current_user\n session[:user_id] = nil\n end",
"def sign_out\n streaming.disconnect\n session.sign_out\n end",
"def logout\n sign_out(current_account)\n end",
"def sign_out\n @current_user = nil\n end",
"def sign_out\n cookies.delete(:remember_token)\n self.current_user = nil\n end",
"def sign_out\n\t\t\n\t\t# Set the current_user for session to nil\n\t\tself.current_user = nil\n\n\t\t# Destroy cookie with hash remember_token\n\t\t# essentially letting the browser forget the user\n\t\tcookies.delete(:remember_token)\n\tend",
"def after_sign_out_path_for(resource_or_scope)\n # caught by apache to trigger pubcookie logout\n '/logout'\n end",
"def sign_out\n\t\tcookies.delete(:remember_token)\n\t\tcurrent_user = nil\n\tend",
"def sign_out\n session.delete(:user_id)\n @current_user = nil\nend",
"def sign_out\n reset_session\n end",
"def sign_out\n @logout = true\n authenticate_api_user\n @logout = false\n revoke_access if @current_user\n head :no_content\n end",
"def sign_out\n current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n current_user = nil\n cookies.delete(:remember_token)\n end",
"def signout\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_credentials)\n @current_user = nil\n end",
"def sign_out\n session.delete(:user_id)\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/signed_out'\n end",
"def sign_out\r\n self.current_user = nil\r\n cookies.delete(:remember_token)\r\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n session[:user_id] = nil \n session.delete(:user)\n end",
"def sign_out\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def signout\n session.clear\n end",
"def log_out\n session.clear\n cookies.clear\n @current_user = nil\n end",
"def sign_out\n\t\t@current_user = nil\n\t\tcookies.delete :remember_token\n\tend",
"def destroy\n current_user.authentication_token = nil\n signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name))\n render json: {status:0, data: nil}\n end",
"def sign_out\n self.current_user = nil \n cookies.delete(:remember_token)\n end",
"def sign_out\n session[:user_id] = nil\n end",
"def sign_out\n session[:user_id] = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n current_user.forget\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n session.delete(:user_id)\n @current_user = nil\n end",
"def logout\n forget_user_from_cookie(current_user)\n session.clear\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def sign_out\n\tcookies.delete(:remember_token)\n\tcurrent_user = nil\n end",
"def log_out\n if !current_user.nil?\n forget(current_user)\n\n session.delete(:user_id)\n session.delete(:user_type)\n @current_user = nil\n end\n end",
"def sign_out\n\t\tself.current_user = nil\n\t\tcookies.delete(:remember_token)\n\tend",
"def log_out\n forget current_user\n reset_session\n @current_user = nil\n end",
"def log_out\n forget(current_user)\n reset_session\n @current_user = nil\n end",
"def log_out\n forget current_user\n session.delete :user_id\n @current_user = nil\n end",
"def logout\n current_user.forget_me!\n cookies.delete(:remember_me_token)\n set_current_user nil\n redirect_to self.instance_eval( &self.class.lwt_authentication_system_options[:redirect_after_logout] )\n end",
"def sign_out\n #forget(current_user)\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def sign_out\n\n # mark them as signed out.\n # (this is a helper method of devise, the rails ruby gem we're using for\n # authentication in the sample app.)\n # \n # \n #session_sign_out <---- NEED TO CHANGE TO CUSTOM USER SIGN OUT\n\n # send them back to the homepage.\n redirect_to root_path\n\n end",
"def sign_out(resource_or_scope = T.unsafe(nil)); end",
"def sign_out_user\n self.current_user = nil\n cookies.delete(:remember_token)\n end",
"def log_out\r\n forget(current_user)\r\n session.delete(:user_id)\r\n @current_user = nil\r\n end",
"def log_out\n\t\tforget(current_user)\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\t\t# Setting @current_user to nil would only matter if @current_user were created before the destroy action (which it isn’t) and if we didn’t issue an immediate redirect (which we do). This is an unlikely combination of events, and with the application as presently constructed it isn’t necessary, but because it’s security-related I include it for completeness\n\tend"
] | [
"0.79710305",
"0.77687436",
"0.77010685",
"0.7538675",
"0.7469497",
"0.74233115",
"0.74233115",
"0.7205574",
"0.71258026",
"0.7006111",
"0.69999343",
"0.6983193",
"0.69324",
"0.6930035",
"0.6909614",
"0.69068664",
"0.68959165",
"0.68948793",
"0.6890865",
"0.6883932",
"0.68562675",
"0.68083984",
"0.67872834",
"0.6779026",
"0.6743948",
"0.6723815",
"0.67048025",
"0.6700111",
"0.6700025",
"0.6696538",
"0.6696372",
"0.66952163",
"0.6669357",
"0.6669357",
"0.6669357",
"0.66651636",
"0.6659392",
"0.6655489",
"0.66531813",
"0.66398615",
"0.663952",
"0.66391206",
"0.66391206",
"0.66391206",
"0.66391206",
"0.66391206",
"0.66391206",
"0.66391206",
"0.66391206",
"0.6637848",
"0.6635185",
"0.66301745",
"0.6627122",
"0.66102",
"0.66079986",
"0.6597523",
"0.65829295",
"0.65779877",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65725046",
"0.65721864",
"0.6572147",
"0.6572047",
"0.6567133",
"0.65513605",
"0.65497667",
"0.65485185",
"0.65479",
"0.65461797",
"0.6545304",
"0.6539573",
"0.65194184",
"0.6509845",
"0.6508337",
"0.65057117",
"0.6503891"
] | 0.7547981 | 3 |
Quick access to Warden::Proxy. source://devise//lib/devise/test/controller_helpers.rb48 | def warden; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warden\n env['warden']\n end",
"def warden\n env['warden']\n end",
"def warden\n request.env['warden']\n end",
"def warden\n request.env['warden']\n end",
"def warden\n request.env['warden']\n end",
"def using_authenticated_proxy?; end",
"def warden\n request.env['warden']\n end",
"def warden\n @warden ||= begin\n env['warden']\n end\n end",
"def proxy\n @proxy\n end",
"def proxy_user; end",
"def proxy_context\n @context\n end",
"def current_proxy\r\n unless @__proxy_initialized\r\n proxy_id = params[:api_proxyid]\r\n current_user = self.current_user\r\n if proxy_id.present? and current_user\r\n @__proxy_roles = Sys::UserRelation.where(user: current_user, related_id: proxy_id).all.map{|rel| rel.role}\r\n if @__proxy_roles.any?\r\n @__proxy = Sys::User.find(proxy_id) rescue nil\r\n end\r\n end\r\n @__proxy_initialized = true\r\n end\r\n @__proxy\r\n end",
"def proxy\n return @proxy\n end",
"def current_user\n warden.user\n end",
"def current_user\n warden.user\n end",
"def using_proxy?; end",
"def warden_options\n env['warden.options']\n end",
"def authenticate!\n warden.authenticate!\n end",
"def legitimate_proxy?; end",
"def control_proxies\n @@control_proxies = [] unless defined?(@@control_proxies)\n @@control_proxies\n end",
"def helpers\n @_helper_proxy ||= view_context\n end",
"def proxy_pass; end",
"def connect_through_proxy; end",
"def proxies; end",
"def strategies\n Warden::Strategies\n end",
"def proxy\n ENV['HYPERKIT_PROXY']\n end",
"def public_proxy?; end",
"def public_proxy?; end",
"def current_user\n warden.user(WARDEN_SCOPE)\n end",
"def ignore_env_proxy; end",
"def ignore_env_proxy; end",
"def ignore_env_proxy; end",
"def proxy; end",
"def proxy; end",
"def proxy; end",
"def http_proxy; end",
"def proxy\n self.class.proxy.new(session)\n end",
"def warden_cookies\n warn \"warden_cookies was never functional and is going to be removed in next versions\"\n env['warden.cookies'] ||= {}\n end",
"def proxy\n manager_instance(ProxyManager)\n end",
"def mx_vpn_firewall\r\n MXVPNFirewallController.instance\r\n end",
"def authenticate_from_warden\n warden = env[\"warden\"]\n return unless warden\n\n env[\"warden\"].authenticate(scope: \"user\")\n end",
"def devise_controller?; end",
"def proxies\n @proxies ||= {}\n end",
"def authentication\r\n AuthenticationController.instance\r\n end",
"def service_fwproxy!()\n @service = TAC_PLUS_AUTHEN_SVC_FWPROXY\n end",
"def proxy\n ENV['BETTERY_PROXY']\n end",
"def teardown\n Warden.test_reset!\n end",
"def authenticated_user?\n warden.authenticated?\n end",
"def proxy_vars\n Hash[[:address,:user,:pass,:port].map do |x|\n [x, default_proxy.instance_variable_get(\"@proxy_#{x}\")]\n end]\n end",
"def proxy\n\t\t\tself.options[:proxy]\n\t\tend",
"def current_user\n return @current_user ||= warden.authenticate(:scope => :user)\n end",
"def proxybypasslist\r\n\t\t\t`#{BITS::BITSADMIN} /getproxybypasslist {#{@id}}`\r\n\t\tend",
"def get_proxy(identifier); end",
"def get_proxy(identifier); end",
"def include_proxy_authorization_header; end",
"def proxy; self end",
"def configure_warden!; end",
"def proxy_params\n params[:proxy]\n end",
"def proxy\n @proxy ||= Proxy.new self\n end",
"def helpers\n unless @helper_proxy\n @helper_proxy = ActionView::Base.new\n @helper_proxy.extend master_helper_module\n else\n @helper_proxy\n end\n end",
"def proxy_addr; end",
"def setup_controller_for_warden; end",
"def proxy_set?; end",
"def mx_inbound_firewall\r\n MXInboundFirewallController.instance\r\n end",
"def test_using_proxy_object\n proxy = Selenium::WebDriver::Proxy.new(\n http: PROXY,\n ssl: PROXY\n )\n\n run_test_with proxy: proxy\n end",
"def current_user(*args)\n warden.user(*args)\n end",
"def current_user(*args)\n warden.user(*args)\n end",
"def controller\n Thread.current[:authlogic_controller]\n end",
"def auth_store; end",
"def proxyaddress\n config[\"proxyaddress\"]\n end",
"def residential_proxy?; end",
"def residential_proxy?; end",
"def auth_controller?\n false\n end",
"def proxy_uri; end",
"def proxy_uri; end",
"def proxy_target\n @target\n end",
"def set_proxy\n @proxy = Proxy.find(params[:id])\n end",
"def http_proxy_parts; end",
"def intrusion_settings\r\n IntrusionSettingsController.instance\r\n end",
"def test_realm\n make_controller :realm\n get :index\n assert_protected\n assert_equal 'Basic realm=\"GOURANGA!\"', @response.headers['WWW-Authenticate']\n end",
"def http_proxy_uri\n @tools.http_proxy_url\n end",
"def index\n @proxies = Proxy.all\n end",
"def index\n @proxies = Proxy.all\n end",
"def wireless_settings\r\n WirelessSettingsController.instance\r\n end",
"def authenticates_access\n include InstanceMethods\n end",
"def helpers\n unless @helper_proxy\n @helper_proxy = Engine::View::Base.new(self)\n @helper_proxy.extend master_helper_module\n else\n @helper_proxy\n end\n end",
"def fiddler_proxy()\n '--proxy=127.0.0.1:8888'\n end",
"def getproxy\n proxy = (ENV['HTTP_PROXY'] == nil)? ENV['http_proxy'] : ENV['HTTP_PROXY']\n return proxy\n end",
"def devise_modules_hook!; end",
"def current_user\n if Rails.env.test?\n # turn off caching for tests\n @current_user = warden.user\n else\n @current_user ||= warden.user\n end\n end",
"def proxy_types; end",
"def proxy_apache_authenticate\n logger.info(\"proxy_apache_authenticate as #{request.env[\"HTTP_X_FORWARDED_USER\"]}\")\n common_authenticate(request.headers[\"HTTP_X_FORWARDED_USER\"])\n return true\n end",
"def service_fwproxy?()\n return true if (@service == TAC_PLUS_AUTHEN_SVC_FWPROXY)\n return false\n end",
"def authenticated?\n warden.user ? true : false\n end",
"def proxy?\n false\n end",
"def initialize(proxy = nil, agent_name = nil, from = nil)\n @proxy = nil # assigned later.\n @no_proxy = nil\n @agent_name = agent_name\n @from = from\n @www_auth = WWWAuth.new\n @proxy_auth = ProxyAuth.new\n @request_filter = [@proxy_auth, @www_auth]\n @debug_dev = nil\n @redirect_uri_callback = method(:default_redirect_uri_callback)\n @test_loopback_response = []\n @session_manager = SessionManager.new\n @session_manager.agent_name = @agent_name\n @session_manager.from = @from\n @session_manager.ssl_config = @ssl_config = SSLConfig.new(self)\n @cookie_manager = WebAgent::CookieManager.new\n load_environment\n self.proxy = proxy if proxy\n end",
"def test_read_configuration_proxy_auth\r\n\t\tconf = WebBrowserConfiguration.new(\"visitor/WebBrowserConfigurationUnitTestProxyAuth.xml\")\r\n\t\tassert_equal(20,conf.browser_threads,\"browser threads not as expected.\") #default value\r\n\t\tassert_equal(\"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\",conf.user_agent,\"user agent not as expected.\")\r\n\t\tassert_equal(\"192.168.74.3\",conf.server,\"proxy server not as expected\")\r\n\t\tassert_equal(3128,conf.port,\"proxy server port not as expected\")\r\n\t\tassert_equal(\"username\",conf.username,\"proxy username not as expected\")\t\t\r\n\t\tassert_equal(\"password\",conf.password,\"proxy password not as expected\")\r\n\tend",
"def getTrustedLoginUrl\n secureurl + \"wlogin.srf\"\n end"
] | [
"0.67264646",
"0.67264646",
"0.65972894",
"0.65972894",
"0.65972894",
"0.648724",
"0.63447875",
"0.62066877",
"0.5986567",
"0.5950651",
"0.57482135",
"0.5729673",
"0.5710209",
"0.5708234",
"0.56514084",
"0.5651092",
"0.5627707",
"0.56183624",
"0.55652446",
"0.5539221",
"0.55129635",
"0.55096316",
"0.5476459",
"0.54545355",
"0.5447186",
"0.5447155",
"0.54443496",
"0.54443496",
"0.54125196",
"0.53964484",
"0.53964484",
"0.53964484",
"0.5393254",
"0.5393254",
"0.5393254",
"0.5393247",
"0.53791076",
"0.53742874",
"0.53497696",
"0.5332648",
"0.5309882",
"0.52658665",
"0.5263765",
"0.5261533",
"0.5255402",
"0.5236657",
"0.5209921",
"0.51985395",
"0.5194855",
"0.5187707",
"0.51874024",
"0.5175546",
"0.5156886",
"0.5156886",
"0.51296574",
"0.5123747",
"0.51135015",
"0.5096229",
"0.5081981",
"0.50683874",
"0.50666374",
"0.50598586",
"0.50501144",
"0.5048352",
"0.5043831",
"0.50244623",
"0.50244623",
"0.5010604",
"0.50098556",
"0.49922985",
"0.49897996",
"0.49897996",
"0.49890122",
"0.49793124",
"0.49793124",
"0.4964891",
"0.49617735",
"0.49493036",
"0.49455163",
"0.4936834",
"0.4935302",
"0.49239188",
"0.49239188",
"0.49229687",
"0.4912219",
"0.49093568",
"0.4897291",
"0.4896919",
"0.4891842",
"0.48872045",
"0.48798963",
"0.48775512",
"0.48772788",
"0.48634392",
"0.4857555",
"0.48551494",
"0.4854906",
"0.48484656"
] | 0.59421235 | 11 |
Catch warden continuations and handle like the middleware would. Returns nil when interrupted, otherwise the normal result of the block. source://devise//lib/devise/test/controller_helpers.rb103 | def _catch_warden(&block); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _around_rodauth(&block)\n result = nil\n\n rails_controller_rescue do\n rails_controller_callbacks do\n result = catch(:halt) { super(&block) }\n end\n end\n\n if rails_controller_instance.performed?\n rails_controller_response\n elsif result\n result[1].merge!(rails_controller_instance.response.headers)\n throw :halt, result\n else\n result\n end\n end",
"def bypass_rescue\n @controller.extend(BypassRescue)\n end",
"def rails_controller_rescue\n yield\n rescue Exception => exception\n rails_controller_instance.rescue_with_handler(exception) || raise\n\n unless rails_controller_instance.performed?\n raise Rodauth::Rails::Error, \"rescue_from handler didn't write any response\"\n end\n end",
"def devise_controller?; end",
"def warden(&block); end",
"def new_controller_thread # :nodoc:\n Thread.new {\n t2 = Thread.current\n t2.abort_on_exception = true\n yield\n }\n end",
"def warden\n @warden ||= begin\n env['warden']\n end\n end",
"def while_signed_in_as(user)\n sign_in(user)\n yield\n rescue ConnectionError => e\n logger.error(e)\n ensure\n sign_out(user)\nend",
"def authenticate!\n warden.authenticate!\n end",
"def warden\n env['warden']\n end",
"def warden\n env['warden']\n end",
"def rails_authenticate\n self.resource = warden.authenticate!(auth_options)\n set_flash_message(:notice, :signed_in) if is_flashing_format?\n sign_in(resource_name, resource)\n\n yield resource if block_given?\n respond_with resource, location: after_sign_in_path_for(resource)\n end",
"def warden\n request.env['warden']\n end",
"def warden\n request.env['warden']\n end",
"def warden\n request.env['warden']\n end",
"def call(ctx, **)\n warden = ctx[:warden]\n\n if @except.empty?\n warden.logout\n else\n (Devise.mappings.keys - @except).each do |scope|\n warden.logout(scope) if warden.authenticated?(scope: scope)\n end\n end\n\n Macros::Auth::ExpireSessionData.new.call(ctx)\n warden.clear_strategies_cache!\n warden.lock!\n end",
"def teardown\n Warden.test_reset!\n end",
"def process_unauthenticated(result, env)\n action = result[:result] || env['warden'].result\n\n case action\n when :redirect\n [env['warden']._status, env['warden'].headers, [env['warden'].message || \"You are being redirected to #{env['warden'].headers['Location']}\"]]\n when :custom\n env['warden'].custom_response\n else\n call_failure_app(env, result)\n end\n end",
"def sign_in(user = double('user'))\r\n if user.nil?\r\n allow(request.env['warden']).to receive(:authenticate!).and_throw(:warden, {:scope => :user})\r\n allow(controller).to receive(:current_user).and_return(nil)\r\n else\r\n allow(request.env['warden']).to receive(:authenticate!).and_return(user)\r\n allow(controller).to receive(:current_user).and_return(user)\r\n # allow(controller).to receive(:user_signed_in).and_return(user_signed_in)\r\n end\r\n end",
"def middleware(&block); end",
"def rails_controller_callbacks\n # don't verify CSRF token as part of callbacks, Rodauth will do that\n rails_controller_forgery_protection { false }\n\n rails_controller_instance.run_callbacks(:process_action) do\n # turn the setting back to default so that form tags generate CSRF tags\n rails_controller_forgery_protection { rails_controller.allow_forgery_protection }\n\n yield\n end\n end",
"def check_authentication\n logger.debug \"*************************** CHECK AUTH **\"\n\n @controller_name_in_context = controller_name\n @action_in_context = action_name\n\n #Check if we have an object in context, either by explicitly passing it in or using standard rails conventions\n #e.g. @work for works_controller\n #From this we can check if the object responds to status or not\n\n\n #If an object cant be found in context teh status check will have to be delegated to teh controller method\n #in the class extending application controller, e.g. if for some reason the param name was different that id\n #This should cover most cases though\n status_to_check_for = nil\n\n #Look for an object in context using standard rails naming convention, e.g. Work.find(49) for /works/show/49\n if !params[:id].blank?\n begin\n class_name_to_check = controller_name.gsub(\"_controller\", \"\").tableize.singularize\n object_in_context = class_name_to_check.camelize.constantize.find(params[:id])\n #logger.debug \"OBJ IN CONTEXT:\"+object_in_context.to_s\n\n #Now does it respond to status?\n status_to_check_for = object_in_context.status if object_in_context.respond_to?(\"status_id\")\n rescue Exception => e\n #logger.debug \"COULD NOT FIND INSTANCE IN CONTEXT:#{e.message}\"\n end\n\n end\n\n\n #logger.debug \"RESTRICTION: request is #{request}, method - #{request.method}\"\n\n if status_to_check_for.blank?\n #logger.debug \"COULD NOT FIND A STATUS TO CHECK FOR\"\n else\n #logger.debug \"CHECK AUTH: STATUS TO CHECK FOR:#{status_to_check_for.status_desc}\"\n end\n\n\n #Deal with zencart\n #logger.debug(\"ZENCART READING ZENID FROM LAST BROWSER REQUEST: \"+cookies['zenid'].to_s)\n\n login_id = session[:login]\n if login_id != nil\n user = Login.find(login_id)\n if user != nil\n username=user.username\n password=user.password\n #logger.debug(\"ZENCART LOGGING INTO #{ZENCART_SERVER} with #{username} and #{password}\")\n #logger.debug(\"ZENCART FETCH:\" + external_fetch('POST',URI.parse('http://'+ZENCART_SERVER+'/zencart/index.php?main_page=login&action=process'),\"encrypted=true&email_address=#{username}&password=#{password}\").to_s)\n end\n end\n\n\n ecj=external_cookie_jar\n cookieString=ecj.cookies_for(URI.parse(\"http://\"+ZENCART_SERVER.to_s+\"/zencart\")).to_s\n #extract our zencart id and attach to our cookie list\n cookieString=~/zenid=(.*)/\n cookies['zenid']=$1\n #logger.debug(\"ZENCART SETTING ZENID FOR CURRENT BROWSER RESPONSE: #{$1}\")\n #Create a history in the session\n if session[:history] == nil\n session[:history]= Array.new()\n end\n @history=session[:history]\n\n if session[:selected] == nil\n session[:selected] = Hash.new()\n end\n\n #logger.debug \"RESTRICTION: CHECKING PERMISSIONS\"\n #logger.debug \"RESTRICTION CHECKING: #{controller_name} / #{action_name}\"\n\n\n\n #If we dont have a login in session then we need to use a privilege of type guest\n unless session[:login]\n\n session[:intended_action] = action_name\n session[:intended_controller] = controller_name\n\n\n idio = params[:id]\n if idio != nil\n session[:intended_id] = params[:id]\n end\n\n\n #Public AJAX requests are valid, for example the facet toggling\n if request.xhr?\n if !ControllerRestrictionHelper.has_permission?(request.method, controller_name, action_name, session[:intended_id],\n [Privilege::CAN_VIEW_PUBLIC], status_to_check_for)\n #logger.debug \"RESTRICTED AJAX FOR PUBLIC USER URI #{request.request_uri}\"\n #session[:intended_uri] = request.request_uri\n render :partial => 'shared/ajax_timeout'\n return false\n end\n\n else\n session[:intended_uri] = request.request_uri\n #If the page is viewable to the public then continue on and show, otherwise redirect to login\n if !ControllerRestrictionHelper.has_permission?(request.method, controller_name, action_name, session[:intended_id],\n [Privilege::CAN_VIEW_PUBLIC], status_to_check_for)\n #logger.debug \"RESTRICTED FOR PUBLIC USER URI #{request.request_uri}, CONTOLLER:#{controller_name}, ACTION:#{action_name}\"\n redirect_to :action => \"unauthorised\", :controller => \"authentication\"\n return false\n end\n end\n end\n\n #See pragmatic programmers, volume2 - storing the login user in session\n #See also http://www.rubyonrailsblog.com/articles/2006/09/29/rails-expiration-of-sessions-due-to-inactivity for session inactivity\n if session[:login] != nil\n #If we have a user, check if they have expired\n #FIXME: testing\n session_length = 60*20 #20 Minutes for logged in users\n\n expire_time = session[:expire_time] || Time.now + 10\n #logger.debug(\"Session expirty time is #{expire_time}, now is #{Time.now}\")\n session[:expire_time] = Time.now + session_length\n @login = Login.find(session[:login])\n #logger.debug \"RESTRICTION: LOGIN is #{@login.username}, is superuser? #{@login.is_superuser?}\"\n end\n\n\n #FIXME - status needs to be taken account of\n\n allowed_to_view = ControllerRestrictionHelper.login_has_permission?(request.method, controller_name, action_name,\n session[:intended_id], @login, status_to_check_for)\n #logger.debug \"CHECK2:#{allowed_to_view}\"\n\n if !allowed_to_view\n #logger.debug \"ACTION FORBIDDEN: #{controller_name} / #{action_name}\"\n render :file => \"#{RAILS_ROOT}/public/403.html\", :status => '403 Forbidden'\n return false #finish rendering here\n end\n\n # Needed for Event Quicklinks search\n # WR#53728\n @user_time_zone = get_user_time_zone\n\n #logger.debug \"ALLOWED TO VIEW: #{allowed_to_view}\"\n\n true #keep rendering\n end",
"def handle_unverified_request\n \n # By default this method raises ActionController::InvalidAuthenticityToken\n #redirect_to root_url\n end",
"def process_unauthenticated(env, options={})\n options[:action] ||= begin\n opts = config[:scope_defaults][config.default_scope] || {}\n opts[:action] || 'unauthenticated'\n end\n\n proxy = env['warden']\n result = options[:result] || proxy.result\n\n case result\n when :redirect\n body = proxy.message || \"You are being redirected to #{proxy.headers['Location']}\"\n [proxy.status, proxy.headers, [body]]\n when :custom\n proxy.custom_response\n else\n options[:message] ||= proxy.message\n call_failure_app(env, options)\n end\n end",
"def warden\n request.env['warden']\n end",
"def warden; end",
"def warden; end",
"def warden; end",
"def protected_yield\n if env[TIMER]\n timeout_protected_yield{ yield }\n else\n yield\n end\n rescue Exception => e\n mutex.synchronize do\n self.class.set_backtrace(e)\n if done? # log user callback error\n callback_error(e)\n else # IOError, SystemCallError, etc\n begin\n rejecting(e) # would call user callback\n rescue Exception => f # log user callback error\n callback_error(f){ self.class.set_backtrace(f) }\n end\n end\n end\n end",
"def finalize_flow!\n redirect!(custom_session['return_to'])\n teardown_flow\n throw(:warden)\n end",
"def in_exception_context?; end",
"def index\n params[:response_type] ||= 'code'\n\n raise pre_auth.error_response.body.to_s unless pre_auth.authorizable?\n valid_request = validates_devise_authentication?\n crypt = ActiveSupport::MessageEncryptor.new(Rails.application.secrets.secret_key_base)\n @session_data = crypt.encrypt_and_sign(session.to_hash.to_json)\n return if valid_request\n\n render json: { error: I18n.t('devise.failure.not_found_in_database', authentication_keys: 'email') },\n status: :unauthorized\n end",
"def authenticate_user_devise!\n raise Errors::AuthorizationError, 'Token authentication is not correct' unless current_user_devise\n end",
"def entrapment\n # setup trap chain once.\n Base.trapped = true\n app = self\n\n # 'get' previous trap by replacing any existing trap with 'IGNORE'\n previous_trap = trap(:INT, 'IGNORE')\n\n # substitute our trap and chain it to previous by explicitly invoking\n # the previous trap. ruby makes this somewhat difficult and rack then\n # makes it even harder.\n trap(:INT) do\n begin\n # loggers may have closed file handles in a trap so disconnect any\n # loggers from multiplexer before continuing. even when they do not\n # raise exceptions they still appear to log nothing at this point\n # (not sure about syslog, definitely not file or console).\n if app.logger.respond_to?(:targets)\n # HACK: it is bad that Multiplexer#targets exposes its internal\n # array in a manner that allows us to clear it. it would be better\n # if to have a Multiplexer#reset method we could call instead.\n # to ensure that cleaning continues to work, check the result\n # afterward. note that we tried iterating targets and calling the\n # Multiplexer#remove method but that had no effect.\n app.logger.targets.clear\n fail 'Unexpected targets' unless app.logger.targets.empty?\n app.logger.warn('cannot log traps') # no exception raised\n end\n\n # interrupt any running app threads to resolve outstanding requests.\n #\n # note that Mutex#synchronize is not allowed inside a trap context.\n #\n # FIX: duplicating the set is slightly unsafe but not sure how else\n # to deal with data protected by critical section in a trap. we also\n # have logic in ensure block to avoid modifying set on interrupt.\n app.class.interrupted = true\n app_threads = app.class.app_threads.dup\n app_threads.each do |app_thread|\n if app_thread.alive?\n app_thread.raise(::Interrupt)\n app_thread.join\n end\n end\n\n # cleanup fixtures, if requested.\n app.cleanup\n if previous_trap && previous_trap.respond_to?(:call)\n previous_trap.call\n else\n exit\n end\n rescue ::Exception => e\n # loggers are unreliable so write any rescued error home.\n msg = ([e.class, e.message] + (e.backtrace || [])).join(\"\\n\")\n dir = ::ENV['HOME'] || ::Dir.pwd\n path = ::File.join(dir, 'might_api_rescued_error.txt')\n ::File.open(path, 'w') { |f| f.puts msg }\n exit 1\n end\n end\n true\n end",
"def authenticate\n authenticate_token || render_unauthorized\nend",
"def auth_trap_state\n super\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 handle_unverified_request\n reset_session\n render :nothing => true, :status => 401\n end",
"def handle_unverified_request\n flash[:error] = 'Unverified request. Please retry or clear your cookie!'\n redirect_to :back\n end",
"def handle_unverified_request\n sorcery_config.before_unverified_request.each do |callback|\n send(callback)\n end\n @current_user = nil\n super # call the default behaviour which resets the session\n end",
"def authenticate!\n # if the authentication header is an acceptible value\n if @env['HTTP_X_MY_API'] == 'foobar'\n user = { :id => 1, :name => \"some user\" }\n # warden doesn't care what the user is, so long as it's not nil.\n success! user, \"success\"\n end\n end",
"def within_preserved_state\n lock.synchronize do\n begin\n interactor.stop if interactor\n @result = yield\n rescue Interrupt\n # Bring back Pry when the block is halted with Ctrl-C\n end\n\n interactor.start if interactor && running\n end\n\n @result\n end",
"def with_authentication\n Adapters::AuthenticationRetryWrapper.with_authentication(adapter, @env) do\n yield\n end\n end",
"def handle_unverified_request\n if Rails.env.production?\n reset_session\n else\n raise ActionController::InvalidAuthenticityToken\n end\n end",
"def authenticate_from_warden\n warden = env[\"warden\"]\n return unless warden\n\n env[\"warden\"].authenticate(scope: \"user\")\n end",
"def authenticate!\n if current_identity\n true\n else\n respond_to do |format|\n format.html do\n store_location\n redirect_to main_app.new_session_path\n end\n format.json do\n render status: 403, nothing: true\n end\n end\n end\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n if resource.save\n p \"resource could save!\"\n p \"============================\"\n respond_to do |format|\n format.html {\n yield resource if block_given?\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_flashing_format?\n sign_up(resource_name, resource)\n respond_with resource, :location => after_sign_up_path_for(resource)\n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_flashing_format?\n expire_data_after_sign_in!\n respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n end\n }\n format.js {\n flash[:notice] = \"Created account, signed in.\"\n render :template => \"remote_content/devise_success_sign_up.js.erb\"\n flash.discard\n sign_in(resource_name, resource)\n }\n end\n else\n p \"resource could not save\"\n p \"============================\"\n respond_to do |format|\n format.html {\n clean_up_passwords resource\n respond_with resource\n }\n format.js {\n flash[:alert] = @user.errors.full_messages.to_sentence\n render :template => \"remote_content/devise_errors.js.erb\"\n flash.discard\n }\n end\n end\n end",
"def skip_pundit?\n devise_controller?\n end",
"def isolate_from_interrupts\n instance.signal_received = false\n instance.isolate_signals = true\n result = yield\n instance.isolate_signals = false\n result\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n set_flash_message!(:notice, :signed_in)\n sign_in(resource_name, resource)\n yield resource if block_given?\n respond_with resource, location: after_sign_in_path_for(resource)\n # super\n end",
"def rescue_action(exception)\n return super unless exception.kind_of? ActionController::InvalidAuthenticityToken\n logger.info \"Handling #{exception} by forcing fresh login\"\n\n # Forget about any renders or redirects previously called\n erase_results if performed?\n\n # Nuke their session\n logout_killing_session!\n kill_remember_cookie!\n\n # Try to take them back where they came from when they log in again\n flash[:error] = \"Please log in.\"\n redirect = {:return_to => (request.env[\"HTTP_REFERER\"] || '').gsub(/.*:\\/\\/[^\\/]*/, '')}\n\t\tredirect[:protocol] = 'https' if Rails::configuration.https_login\n redirect_to(login_url(redirect))\n end",
"def authenticate!\n if in_flow?\n continue_flow!\n else\n begin_flow!\n end\n end",
"def handle_unverified_request\n raise ActionController::InvalidAuthenticityToken\n end",
"def handle_unverified_request\n raise ActionController::InvalidAuthenticityToken\n end",
"def _roda_handle_route\n catch(:halt) do\n @_request.block_result(yield)\n @_response.finish\n end\n end",
"def finalize_session_exception_callbacks(&block)\n if block_given?\n @_finalize_session_exception_callbacks << block\n else\n @_finalize_session_exception_callbacks\n end\n end",
"def middlewares_stack; end",
"def test_authentication\n @api.test_authentication\n return\n end",
"def handle_error err, env\n delegate = error_delegate\n\n begin\n delegate.exec(self, env){ handle_error(err) }\n\n rescue ::Exception => err\n delegate = Gin::Controller and retry unless delegate == Gin::Controller\n raise\n end\n end",
"def exception_handler_func(e, logout = false)\n session[:authentication_token] = nil if logout\n render json: e, status: 401\n end",
"def authenticate_with_response\n render nothing: true, status: 401 if current_user.nil?\n end",
"def cancel\n __log_activity\n __debug_route\n __debug_request\n super\n rescue => error\n auth_failure_redirect(message: error)\n end",
"def authenticated_user\n return render_error(2, 'Invalid auth token') if logged_device.nil?\n logged_device\n end",
"def trap_exception\n begin\n yield\n true\n rescue\n @exception = $!\n false\n end\n end",
"def controller_yield\n# Without setup_with_controller, another render appends the response, increasing\n# any assert_select counts.\n (setup_with_controller; yield) if block_given?\n end",
"def authenticate_target!\n current_resource = find_current_target\n reject unless @target.authenticated_with_devise?(current_resource)\n rescue\n reject\n end",
"def middleware; end",
"def handle_interrupt; 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 ensure_authenticated!\n # Block of code to apply extra auth check only for the private mode\n # of Decidim. 'normal' mode => does not apply checks.\n return if Rails.application.config.use_mode != \"private\"\n\n # Next stop: Let's check whether auth is ok\n unless user_signed_in?\n flash[:warning] = I18n.t(\"auth.sign_in_with_tunnistamo\")\n return redirect_to decidim.new_user_session_path\n end\n end",
"def do_with_interrupt_handling\n yield if block_given?\n rescue StandardError => e\n warn HighLine.color(\"\\nAborting, fatal #{e.class}, #{e} at #{error_call_site(e)}\", :red)\n Kernel.exit(3)\n rescue Interrupt\n warn HighLine.color(\"\\nAborting, interrupt received\", :red)\n Kernel.exit(2)\n rescue RuntimeError => e\n warn HighLine.color(\"\\nAborting, fatal unhandled error, #{e} at #{error_call_site(e)}\", :red)\n Kernel.exit(1)\n end",
"def redirect_unauthenticated\n store_location\n flash[:error] = \"Please sign to access that page\"\n redirect_to root_path\n throw :halt\n end",
"def block_unauthenticated_user!\n unless current_user\n return render_unauthorized\n end\n end",
"def handle_unverified_request\n reset_session\nend",
"def call(env)\n env[\"rack.errors\"] = StringIO.new # Send Rack errors nowhere fast!\n begin\n setup(env)\n begin\n route = Mack::Routes.retrieve(self.request)\n if route[:redirect_to]\n # because the route is specified to be a redirect, let's do that:\n redirect_to(route)\n else\n # set these in case we need them for handling errors:\n @original_controller = route[:controller]\n @original_action = route[:action]\n run_controller(route)\n end\n # return teardown\n rescue Exception => e\n # There was an exception, let's see if there's a handler for this error in routes:\n route = Mack::Routes.retrieve_from_error(e.class)\n unless route.nil?\n self.request.params[:original_controller] = @original_controller\n self.request.params[:original_action] = @original_action\n # There is a handler, let's try running that:\n run_controller(route, e)\n else\n # If we can't find the resource, or there's no route, let's check the public directory:\n case e\n when Mack::Errors::ResourceNotFound, Mack::Errors::UndefinedRoute\n return try_to_find_resource(env, e)\n else\n # Re-raise the exception\n raise e\n end\n end\n # return teardown\n end\n # Capture all the Exceptions for this call:\n rescue Exception => e\n Mack.logger.error e\n case e\n when Mack::Errors::ResourceNotFound, Mack::Errors::UndefinedRoute\n handle_error(404, 'Page Not Found!', e)\n # If it's any other type of exception render the 500.html page:\n else\n handle_error(500, 'Server Error!', e)\n end\n # return teardown\n ensure\n teardown\n end\n return self.response.finish\n end",
"def stop_hammering\n logger.info(\"Rescue from Exceptions::AttemptedHammering\")\n flash[:error] = \"Too many login attempts. This user's account has been timed out. Please try again in an hour.\"\n redirect_to home_path\n end",
"def handle_exceptions_gracefully\n\n begin\n\n yield\n\n rescue => se\n\n Rails.logger.error(\"Exception in API: #{se.message} trace: #{se.backtrace}\")\n\n ExceptionNotifier.notify_exception(\n se,\n env: request.env\n )\n\n r = Result::Base.error(\n internal_id: 'ac_3',\n general_error_identifier: 'something_went_wrong'\n )\n\n return render_api_response(r)\n\n end\n\n end",
"def catch_halt\n catch :halt do\n yield\n end\n end",
"def bypass_rescue\n if ::Rails::VERSION::STRING >= '2.2'\n def controller.rescue_action(exception)\n raise exception\n end\n else\n def controller.rescue_action_with_handler(exception)\n raise exception\n end\n end\n end",
"def safely\n yield\n rescue Exception\n nil\n end",
"def before_recovery(&block)\n self.redefine_callback(:before_recovery, &block)\n end",
"def before_recovery(&block)\n self.redefine_callback(:before_recovery, &block)\n end",
"def invalid_login_attempt\n warden.custom_failure!\n render :json => {success: false, message: \"Error with your email or password\"}, status: 401\n end",
"def try_soft_loud\n begin\n yield\n rescue => e\n puts \"PROBLEM!! #{e}\"\n puts e.backtrace\n end\nend",
"def call(env) # :nodoc:\n return @app.call(env) if env['warden'] && env['warden'].manager != self\n\n env['warden'] = Proxy.new(env, self)\n result = catch(:warden) do\n env['warden'].on_request\n @app.call(env)\n end\n\n result ||= {}\n case result\n when Array\n handle_chain_result(result.first, result, env)\n when Hash\n process_unauthenticated(env, result)\n when Rack::Response\n handle_chain_result(result.status, result, env)\n end\n end",
"def after_crowd_authentication\n end",
"def test_sign_in(user)\n #controller.current_user = user #This worked fine, but for some reason we could not use \"current_user = nil\" without \"self\" in the sign_out method in sessions_helper\n #A fix was to reuse the method signin in the session_controller as follows\n controller.sign_in(user) #see sessions_helper comments in sign_out on how this helped fix the problem with the use of \"current_user= nil\" instead of \"self.current_user = nil\"\n end",
"def handle_unverified_request\n redirect_to root_url, :notice => \"We detect unmatching token form your form, please do not hack us\"\n \n end",
"def regardless(&block)\n yield\nrescue\nend",
"def handle_exception(e)\n if e.flags.has_key?(:layout) then\n @_layout = e.flags[:layout]\n end\n\n if e.flags.has_key?(:no_after_filters) then\n @_stop_no_after_filters = true\n end\n\n if e.flags.has_key?(:redirect) then\n @_layout = false\n to = e.flags[:redirect]\n clear\n @_content = \"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.0 Transitional//EN\\\"><html><head><title>Redirecting...</title><meta http-equiv=\\\"REFRESH\\\" content=\\\"0;url=#{to}\\\"></HEAD></HTML>\"\n @cancel_execution = true\n end\n\n if e.flags.has_key?(:error) then\n @_layout = false\n http_status \"SERVER_ERROR\"\n clear\n @error_message = e.flags[:error]\n @cancel_execution = true\n trace = ''\n if Cuca::App.config['display_errors'] then\n e.backtrace.each do |b|\n trace<< \"<br/>#{b}\"\n end\n end\n mab { html { body { h2 \"Error\"; text @error_message; br; text trace }}}\n end\n \n if e.flags.has_key?(:cancel_execution) then\n @cancel_execution = true\n end\n end",
"def access_denied_handler(exception)\n __debug_exception('RESCUE_FROM', exception)\n msg = exception.message\n respond_to do |format|\n format.html { redirect_back(fallback_location: root_path, alert: msg) }\n format.json { render_json({ error: msg }, status: :unauthorized) }\n format.xml { render_xml({ error: msg }, status: :unauthorized) }\n end\n rescue => error\n error_handler_deep_fallback(__method__, error)\n end",
"def test_exceptions_propogage_through_nexted_scopes\n try_context = @manager.enter_try_block_scope\n method_context = @manager.enter_method_scope(@test_self)\n flow_context = @manager.enter_flow_control_block_scope()\n flow_context.set_exception(Constants[\"true\"])\n assert_true flow_context.need_early_exit\n @manager.leave_scope(flow_context)\n assert_true method_context.need_early_exit\n @manager.leave_scope(method_context)\n assert_equal Constants[\"true\"], try_context.exception_value\n @manager.leave_scope(try_context)\n end",
"def run(report)\n # The final lambda is the termination of the middleware stack. It calls deliver on the notification\n lambda_has_run = false\n notify_lambda = lambda do |notif|\n lambda_has_run = true\n yield if block_given?\n end\n\n begin\n # We reverse them, so we can call \"call\" on the first middleware\n middleware_procs.reverse.inject(notify_lambda) {|n, e| e.call(n) }.call(report)\n rescue StandardError => e\n # KLUDGE: Since we don't re-raise middleware exceptions, this breaks rspec\n raise if e.class.to_s == \"RSpec::Expectations::ExpectationNotMetError\"\n\n # We dont notify, as we dont want to loop forever in the case of really broken middleware, we will\n # still send this notify\n Bugsnag.configuration.warn \"Bugsnag middleware error: #{e}\"\n Bugsnag.configuration.warn \"Middleware error stacktrace: #{e.backtrace.inspect}\"\n end\n\n # Ensure that the deliver has been performed, and no middleware has botched it\n notify_lambda.call(report) unless lambda_has_run\n end",
"def cas_client_sign_in\n render nothing: true, status: :unauthorized\n end",
"def update_application_controller\n inject_into_file 'app/controllers/application_controller.rb', after: \"protect_from_forgery with: :exception\\n\" do <<-'RUBY'\n before_action :authenticate_or_token\n\n protected\n def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:locale, :name, :username, :email, :password, :password_confirmation, :role, :remember_me) }\n devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) }\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password, :role) }\n I18n.locale = @current_user.locale || I18n.default_locale unless @current_user.nil?\n end\n\n # Validate user session if is not API call\n def authenticate_or_token\n authenticate_user! if params[:controller].index('api').nil? && request.fullpath != root_path\n @current_user = current_user if @current_user.nil?\n end\n\n RUBY\n end\n 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 handle_unverified_request; end",
"def handle_unverified_request; end",
"def on_unauthorized_request\n if block_given? && !authorized?\n @response = yield\n end\n end",
"def cancan_exception_handling\n insert_into_controller :application, :after => \"ActionController::Base\\n\" do\n %{\n rescue_from CanCan::AccessDenied do |exception|\n flash[:error] = exception.message\n redirect_to root_url\n end\n }\n end\n end"
] | [
"0.62735796",
"0.5607128",
"0.55356616",
"0.5527113",
"0.532101",
"0.5274709",
"0.5245057",
"0.5175487",
"0.51303107",
"0.5121259",
"0.5121259",
"0.5100706",
"0.5084785",
"0.5084785",
"0.5084785",
"0.50111884",
"0.5010909",
"0.50002813",
"0.49504203",
"0.49412203",
"0.49215397",
"0.49159643",
"0.49046677",
"0.48916483",
"0.48911482",
"0.48745683",
"0.48745683",
"0.48745683",
"0.48695895",
"0.48592666",
"0.4840122",
"0.4821745",
"0.4819712",
"0.48180887",
"0.4758671",
"0.4757975",
"0.47465503",
"0.47328183",
"0.47078544",
"0.4701751",
"0.46996012",
"0.46947566",
"0.46731293",
"0.4655659",
"0.46542114",
"0.46532947",
"0.4649752",
"0.46267575",
"0.4625829",
"0.4611971",
"0.46047473",
"0.4598942",
"0.45964447",
"0.45964447",
"0.4588914",
"0.45750707",
"0.45750698",
"0.4574584",
"0.45734036",
"0.45609584",
"0.45458493",
"0.4545158",
"0.45350245",
"0.4529696",
"0.45257363",
"0.45231447",
"0.4522012",
"0.45213142",
"0.45197383",
"0.45197073",
"0.45086458",
"0.45068157",
"0.45048484",
"0.4502695",
"0.45008367",
"0.4498747",
"0.44971716",
"0.44945094",
"0.44935825",
"0.44864187",
"0.44822103",
"0.44822103",
"0.44781688",
"0.44750717",
"0.44694945",
"0.44500175",
"0.44493246",
"0.44478884",
"0.44463235",
"0.4445504",
"0.44424233",
"0.44415757",
"0.4433892",
"0.44318753",
"0.44273266",
"0.44250795",
"0.44245332",
"0.44245332",
"0.44243324",
"0.44221833"
] | 0.5894076 | 1 |
Signs in a specific resource, mimicking a successful sign in operation through +Devise::SessionsControllercreate+. +resource+ The resource that should be authenticated +scope+ An optional +Symbol+ with the scope where the resource should be signed in with. source://devise//lib/devise/test/integration_helpers.rb37 | def sign_in(resource, scope: T.unsafe(nil)); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_in(resource_or_scope, resource=nil)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n resource ||= resource_or_scope\n warden.set_user(resource, :scope => scope)\n end",
"def sign_in(resource_or_scope, *args); end",
"def sign_in_and_redirect(resource_or_scope, resource=nil)\n\t scope = Devise::Mapping.find_scope!(resource_or_scope)\n\t resource ||= resource_or_scope\n\t sign_in(scope, resource) unless warden.user(scope) == resource\n\t # redirect_to stored_location_for(scope) || after_sign_in_path_for(resource)\n\t render :json => {:status => :signed_in}\n\tend",
"def sign_in_and_redirect(resource_or_scope, resource=nil)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n resource ||= resource_or_scope\n sign_in(scope, resource) unless warden.user(scope) == resource\n return render :json => {:success => true}\n end",
"def sign_in(resource_or_scope, resource=nil)\n scope ||= Devise::Mapping.find_scope!(resource_or_scope)\n resource ||= resource_or_scope\n warden.instance_variable_get(:@users).delete(scope)\n warden.session_serializer.store(resource, scope)\n end",
"def sign_in_and_redirect(resource_or_scope, *args); end",
"def sign_in_and_redirect(resource_or_scope, resource=nil)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n resource ||= resource_or_scope\n sign_in(scope, resource) unless warden.user(scope) == resource\n redirect_to stored_location_for(scope) || after_sign_in_path_for(resource)\n end",
"def signed_in_resource\n warden.authenticate(scope: resource_name)\n end",
"def sign_in(resource_or_scope, resource, role_name)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n last_login = resource.last_sign_in_at.strftime(\"%A, %B %d %Y at %I:%M %p.\") unless resource.last_sign_in_at.nil?\n warden.set_user(resource, :scope => scope) \n current_user.update_attribute(:is_signedin, true)\n #create_sessions(role_name,resource)\n set_flash_message :notice,\"Signed in successfully. Your last login was on #{last_login}\"\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n set_flash_message!(:notice, :signed_in)\n sign_in(resource_name, resource)\n yield resource if block_given?\n respond_with resource, location: after_sign_in_path_for(resource)\n # super\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\r\n sign_in(resource_name, resource)\r\n end",
"def create\n \n resource = warden.authenticate!(auth_options)\n \n \n set_flash_message(:notice, :signed_in) if is_navigational_format?\n \n sign_in(resource_name, resource)\n \n respond_with resource, :location => after_sign_in_path_for(resource)\n \n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def create\n begin\n self.resource = warden.authenticate!(auth_options)\n set_flash_message!(:notice, :signed_in)\n sign_in(resource_name, resource)\n yield resource if block_given?\n respond_to do |format|\n format.html {respond_with resource, location: after_sign_in_path_for(resource)}\n format.json { \n render json: {success: true, error: false, message: \"User is successfully logged in\", results: resource}, status: 200\n }\n end\n rescue Exception => e\n render json: {success: false, error: true, message: e}, status: 500\n end\n end",
"def sign_up(resource_name, resource)\n # sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n set_flash_message!(:notice, :signed_in)\n sign_in(resource_name, resource)\n # set the locale\n I18n.locale = resource.language\n # set the country\n session[:current_country_id] = resource.country_id\n yield resource if block_given?\n respond_with resource, location: after_sign_in_path_for(resource), locale: I18n.locale, country_id: resource.country_id\n end",
"def create\n ret = super\n sign_in(resource.type.underscore, resource.type.constantize.send(:find, resource.id)) unless resource.type.nil?\n ret\n end",
"def sign_in_and_redirect2(resource_or_scope, *args)\n options = args.extract_options!\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n resource = args.last || resource_or_scope\n sign_in(scope, resource, options)\n redirect_to stored_location_for(:user) || root_path # thanks_for_registration_path\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n if resource.ativo\n set_flash_message(:notice, :signed_in) if is_navigational_format?\n sign_in(resource_name, resource)\n respond_with resource, :location => after_sign_in_path_for(resource)\n else\n sign_out(resource)\n flash[:alert] = \"Sua conta está inativa, por favor contate o suporte!\"\n redirect_to root_path\n end\n end",
"def login(resource)\n login_as resource.user, scope: :user\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n set_flash_message(:notice, :signed_in) if is_flashing_format?\n sign_in(resource_name, resource)\n yield resource if block_given?\n respond_with resource, location: to_location(resource), serializer: Api::V1::CurrentIndividualSerializer, root: false\n end",
"def create #session for login user\n self.resource = warden.authenticate!(auth_options)\n set_flash_message(:notice, :signed_in) if is_navigational_format?\n @log_msg = \"User Login through TFP Login page\" \n sign_in(resource_name, resource)\n respond_with resource, :location => after_sign_in_path_for(resource)\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n sign_in(resource_name, resource)\n respond_to do |format|\n format.json {\n render :json => {\n :user => Api::V1::LoginUserSerializer.new(current_user, root: false),\n :status => :ok,\n :authentication_token => current_user.authentication_token\n }\n }\n end\n end",
"def sign_up(resource_name, resource)\n # DO NOT sign_in(resource_name, resource)\n end",
"def sign_in_as\n __debug_route\n __debug_request\n local_sign_in\n __log_activity(\"LOGIN #{resource}\")\n set_flash_notice(action: :create)\n auth_success_redirect\n rescue => error\n auth_failure_redirect(message: error)\n end",
"def create\n self.resource = User.find_by(email: sign_in_params[:email])\n\n if resource.persisted?\n if resource.valid_password?(sign_in_params[:password])\n sign_in(resource_name, resource) # Update sign in record with Devise method.\n\n payload = {\n sub: resource.id.to_str,\n iat: Time.now.to_i,\n exp: Time.now.to_i + 24 * 60 * 60,\n }\n\n token = JwtService.encode(payload: payload)\n\n response['Authorization'] = token\n render json: { current_user: resource }\n else\n # binding.pry\n render json: { errors: \"Incorrect username or password.\" }\n end\n else\n # binding.pry\n render json: { errors: resource.errors.messages }\n end\n\n end",
"def rails_authenticate\n self.resource = warden.authenticate!(auth_options)\n set_flash_message(:notice, :signed_in) if is_flashing_format?\n sign_in(resource_name, resource)\n\n yield resource if block_given?\n respond_with resource, location: after_sign_in_path_for(resource)\n end",
"def create\n self.resource = warden.authenticate!(auth_options)\n sign_in(resource_name, resource)\n \n respond_to do |format|\n format.json {\n render :json => {\n :user => current_user,\n :status => :ok,\n :authentication_token => current_user.authentication_token\n }\n }\n end\n end",
"def sign_in(username, password, api_key, platform)\n session.username = username\n session.password = password\n session.api_key = api_key\n session.platform = platform\n\n session.sign_in\n end",
"def create\n self.resource = warden.authenticate(auth_options)\n if self.resource\n sign_in(resource_name, self.resource)\n render json: {}\n else\n render json: {msg: \"Email или пароль указаны неверно\"}, status: 401\n end\n end",
"def create \n resource = warden.authenticate!(:scope => resource_name, :recall => \"#{controller_path}#new\")\n set_flash_message(:notice, :signed_in) if is_navigational_format?\n sign_in(resource_name, resource)\n redirect_path = resource.role?(\"admin\") ? rails_admin_path : root_path\n respond_with resource, :location => redirect_path\n end",
"def create\n resource = User.find_by(email: params[:user][:email].downcase)\n if resource\n sign_in :user, resource\n render json: {\n logged_in: true,\n user: current_user,\n user_return_to: after_sign_in_path_for(resource) || 'teacher_set_data',\n sign_in_msg: \"Signed in successfully\"\n }\n else\n render json: { \n logged_in: false\n }\n end\n end",
"def create\n resource = nil\n caught = catch(:warden) do\n resource = warden.authenticate!(auth_options)\n end\n\n if resource\n # User is confirmed\n self.resource = resource\n set_flash_message(:notice, :signed_in) if is_flashing_format?\n sign_in(resource_name, resource)\n yield resource if block_given?\n @resource = resource\n elsif caught and caught[:message] == :not_approved\n # User is unconfirmed\n @resource = \"not_approved\"\n else\n # User is not signed in\n @resource = \"invalid\"\n end\n respond_to :html, :js\n end",
"def sign_up_and_redirect_custom(resource_or_scope, *args)\n options = args.extract_options!\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n resource = args.last || resource_or_scope\n sign_in(scope, resource, options)\n redirect_destination = user_profile_path(:username_slug => resource.slug)\n redirect_to sign_up_success_redirect_path + \"?redirect=#{redirect_destination}\"\n end",
"def create\n build_resource\n if resource.save\n log_event(\"signed up\")\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_navigational_format?\n sign_in(resource_name, resource)\n respond_with resource, :location => after_sign_up_path_for(resource)\n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_navigational_format?\n expire_session_data_after_sign_in!\n respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n respond_with resource\n end\n end",
"def create_from_form\n if stored_anonymous_user?\n anonymous_user = current_user\n sign_out(current_user)\n end\n\n self.resource = warden.authenticate(auth_options)\n if self.resource.nil?\n begin\n self.resource = warden.authenticate!(auth_options)\n rescue Exception => e\n sign_in(anonymous_user)\n raise\n end\n else\n end\n\n set_flash_message(:notice, :signed_in) if is_navigational_format?\n\n sign_in(resource_name, resource)\n fandom_play_login(resource)\n \n redirect_after_successful_login()\n end",
"def create\n __debug_route\n __debug_request\n self.resource = warden.authenticate!(auth_options)\n __log_activity(\"LOGIN #{resource}\")\n remember_dev(resource)\n set_flash_notice\n sign_in_and_redirect(resource)\n rescue => error\n auth_failure_redirect(message: error)\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", force: true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource) unless current_user_is_admin?\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\")\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\")\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\n end",
"def authenticate_scope!\r\n send(:\"authenticate_#{resource_name}!\")\r\n self.resource = resource_class.find(send(:\"current_#{resource_name}\").id)\r\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def authenticate_scope!\n send(:\"authenticate_#{resource_name}!\", :force => true)\n self.resource = send(:\"current_#{resource_name}\")\n end",
"def sign_in(resource, deprecated = T.unsafe(nil), scope: T.unsafe(nil)); end",
"def sign_in\n request.session = { authorized: true }\n end",
"def create\n @session_resource = SessionResource.new(session_resource_params)\n\n if @session_resource.save\n render json: @session_resource, status: :created, location: @session_resource\n else\n render json: @session_resource.errors, status: :unprocessable_entity\n end\n end",
"def sign_in(user:, password:)\n post user_session_path \\\n \"user[email]\" => user.email,\n \"user[password]\" => password\n end",
"def sign_in(user, password)\n post login_path, params: {session: {email: user.email, password: password}}\n end",
"def authenticate_scope!\r\n send(:\"authenticate_user!\", :force => true)\r\n self.resource = send(:\"current_user\")\r\n end",
"def set_user_in_warden(scope, resource)\n scope = Devise::Mapping.find_scope!(scope)\n warden.set_user(resource, scope: scope, store: false)\n end",
"def sign_in(user)\n post sessions_path, params: { email: user.email, password: 'mypass' }\n end",
"def create\n build_resource sign_up_params\n\n if resource.save\n Notifier.notify_superusers_of_access_request(resource).deliver\n if resource.active_for_authentication?\n set_flash_message :notice, :signed_up if is_navigational_format?\n sign_in(resource_name, resource)\n respond_with resource, :location => after_sign_up_path_for(resource)\n else\n set_flash_message :notice, :\"signed_up_but_#{resource.inactive_message}\" if is_navigational_format?\n expire_session_data_after_sign_in!\n respond_with resource, :location => after_inactive_sign_up_path_for(resource)\n end\n else\n clean_up_passwords resource\n respond_with resource\n end\n end",
"def create\n self.resource = ::Users::SignIn.call(with: :standard) do\n warden.authenticate!(auth_options).tap { |user| sign_in(user) }\n end\n\n message = find_message(:signed_in, {})\n\n render_resource resource,\n include: %i[recent_access_token student],\n meta: { message: message },\n status: :created\n end",
"def sign_in(user)\n login_as user\n end",
"def create\n resource = warden.authenticate!(:scope => resource_name, :recall => \"#{controller_path}#new\")\n set_flash_message(:notice, :signed_in) if is_navigational_format?\n\n # Use sign_in_and_redirect instead of sign_in to attempt to redirect to \n # stored_location_for instead of the path defined by after_sign_in_path_for\n\n sign_in_and_redirect(resource_name, resource)\n\n # Here we have access to 'stored_location_for', which stores the location from which the user made the request. \n # This is also stored in session['user_return_to']. See Devise doc & code\n # https://github.com/plataformatec/devise/blob/master/lib/devise/failure_app.rb\n end",
"def sign_in_as(user:, password:)\n post user_session_path \\\n 'user[email]' => user.email,\n 'user[password]' => password\n end",
"def sign_up(resource_name, resource)\r\n # Create an account for this user.\r\n account = Account.create(name: \"#{resource.email}'s account\")\r\n \r\n # Sign in the user (from the original Devise::RegistrationsController).\r\n sign_in(resource_name, resource)\r\n end",
"def create\n respond_to do |format|\n format.html { super }\n format.json do\n self.resource = warden.authenticate!(auth_options)\n sign_in(resource_name, resource)\n current_user.update(authentication_token: nil)\n\n render json: { user: { token: current_user.authentication_token } }\n end\n end\n end",
"def login\n if params[:email]\n email = params[:email]\n resource = User.where(:email => email).first\n if !resource.nil? && resource.valid_password?(params[:password])\n sign_in(resource)\n else\n return head :forbidden\n end\n elsif current_user\n resource = current_user\n else\n return head :bad_request\n end\n\n resource.ensure_authentication_token!\n render json: {\n :id => resource.id.to_s,\n :email => resource.email,\n :auth_token => resource.authentication_token,\n :permissions => resource.permissions,\n :expiry_ts => (Time.now + Devise.timeout_in).to_i\n }\n end",
"def create\n #build_resource\n resource = User.find_for_database_authentication(:email=>params[:email])\n return invalid_login_attempt unless resource\n\n if resource.valid_password?(params[:password])\n sign_in(\"user\", resource)\n render :json=> {:id=>resource.id, :success=>true, :auth_token=>resource.authentication_token, :email=>resource.email, :isAdmin=>resource.is_admin, :birthName=>resource.birth_name, :userName=>resource.user_name}\n return\n end\n invalid_login_attempt\nend",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n flash[:notice] = \"Sign up successfully.\"\n end",
"def create\n resource = get_resource\n return failure if resource.blank? || !resource.confirmed?\n if resource.valid_password?(@user_password)\n resource.reset_authentication_token\n sign_in(:user, resource)\n resource.current_user = resource\n render :status => :ok, :json => {:user => resource }\n return\n end\n failure\n end",
"def after_sign_in_path_for(resource_or_scope)\n current_user\n end",
"def sign_in user\n \t# takes the user object and sets session data using said object\n \tsession[:user_id] = user.id\n \tself.current_user = user\n end",
"def create\n @resource = User.find_for_database_authentication(email: params[:user][:email])\n return invalid_login_attempt unless @resource\n\n if @resource.valid_password?(params[:user][:password])\n sign_in @resource, store: false\n @resource.generate_auth_token!\n @resource.save\n json_response({ success: true, message: \"Login successful.\", data: { id: @resource.id, email: @resource.email,\n auth_token: @resource.auth_token } })\n else\n invalid_login_attempt\n end\n end",
"def sign_in_user user\n @request.env[\"devise.mapping\"] = Devise.mappings[:user]\n sign_in user\n end",
"def sign_in(user)\n session[:user_id] = user.id\n end",
"def sign_in(user)\n session[:user_id] = user.id\n end",
"def sign_in(user)\n session[:user_id] = user.id\n end",
"def sign_in(user)\n session[:user_id] = user.id\n end",
"def sign_in\n session[:user_id] = @user.id\n end"
] | [
"0.7654251",
"0.7625113",
"0.7383515",
"0.7250276",
"0.72110313",
"0.7187767",
"0.7101465",
"0.70680755",
"0.70024484",
"0.6936932",
"0.69361544",
"0.6912734",
"0.69106615",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6909854",
"0.6794362",
"0.67911226",
"0.6786866",
"0.66896224",
"0.656697",
"0.65638185",
"0.65485626",
"0.64605576",
"0.6420249",
"0.6281856",
"0.62771565",
"0.6242688",
"0.62389004",
"0.6229528",
"0.6211609",
"0.6200065",
"0.61836624",
"0.61566097",
"0.6126516",
"0.61087614",
"0.61006075",
"0.60874766",
"0.6019543",
"0.60078263",
"0.59648854",
"0.59527856",
"0.59527856",
"0.59527856",
"0.59527856",
"0.59527856",
"0.59527856",
"0.59527856",
"0.5944289",
"0.5934701",
"0.5934701",
"0.59198624",
"0.5902601",
"0.5902601",
"0.5902601",
"0.5902601",
"0.58527845",
"0.5829864",
"0.58238",
"0.5814308",
"0.5801029",
"0.57824045",
"0.5780677",
"0.5773197",
"0.5752987",
"0.57426995",
"0.5739739",
"0.5735538",
"0.57149225",
"0.57030165",
"0.57008743",
"0.5678753",
"0.5678385",
"0.5591903",
"0.55855614",
"0.5585532",
"0.5582699",
"0.55742705",
"0.5573681",
"0.5571451",
"0.5571451",
"0.5571451",
"0.5571451",
"0.55634904"
] | 0.7108921 | 6 |
Signs out a specific scope from the session. +resource_or_scope+ The resource or scope that should be signed out. source://devise//lib/devise/test/integration_helpers.rb46 | def sign_out(resource_or_scope); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_out(resource_or_scope)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n warden.user(scope) # Without loading user here, before_logout hook is not called\n warden.raw_session.inspect # Without this inspect here. The session does not clear.\n warden.logout(scope)\n end",
"def sign_out_and_redirect(resource_or_scope)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n sign_out(scope)\n request.headers.has_key?(\"REMOTE_USER\") ? (render :template => \"sessions/destroy\") : (redirect_to after_sign_out_path_for(scope))\n end",
"def sign_out_and_redirect(resource_or_scope)\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n sign_out(scope)\n redirect_to after_sign_out_path_for(scope)\n end",
"def sign_out_and_redirect(resource_or_scope); end",
"def signed_out_other_scope(resource)\n ActiveRecord::SessionStore::Session.all(:conditions => ['user_id = ?', resource.id]).compact.each do |s|\n begin\n s.destroy\n rescue\n next\n end\n end\n end",
"def sign_out(resource_or_scope = T.unsafe(nil)); end",
"def logout\n warden.authenticate!(:scope => resource_name)\n end",
"def sign_out\n cookies.permanent[:auth_token] = nil\n session[:scope_id] = session[:scope_type] = session[:redirect] = nil\n end",
"def sign_out\n request.session.delete(:authorized)\n end",
"def force_logout\n sign_out(resource) if user_signed_in?\n end",
"def destroy\n current_user.authentication_token = nil\n signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name))\n render json: {status:0, data: nil}\n end",
"def logout!(scope: nil)\n if scope\n warden.logout(scope)\n warden.clear_strategies_cache!(scope: scope)\n else\n warden.logout\n warden.clear_strategies_cache!\n end\n end",
"def sign_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def sign_out\n session.delete(:user_id)\n @current_user = nil\nend",
"def after_sign_out_path_for(resource_or_scope)\n # caught by apache to trigger pubcookie logout\n '/logout'\n end",
"def signout\n session.delete(:user_id)\n @current_user = nil\n end",
"def after_sign_out_path_for(resource_or_scope)\n Faraday.get(logout_path) if logout_path.present?\n super(resource_or_scope)\n end",
"def destroy\n resource.soft_delete\n Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)\n set_flash_message :notice, :destroyed if is_navigational_format?\n respond_with_navigational(resource){ redirect_to after_sign_out_path_for(resource_name) }\n end",
"def after_sign_out_path_for(resource_or_scope)\n cookies.delete :pa_auth_token\n \n \"#{Civiccommons::PeopleAggregator.URL}/logout.php?redirect=http://#{request.host}#{request.port == \"80\" ? nil : \":#{request.port}\"}\"\n end",
"def sign_in(resource_or_scope, resource=nil)\n scope ||= Devise::Mapping.find_scope!(resource_or_scope)\n resource ||= resource_or_scope\n warden.instance_variable_get(:@users).delete(scope)\n warden.session_serializer.store(resource, scope)\n end",
"def signout\n session.delete(:user_id)\n @current_user = nil\n end",
"def sign_out\n current_session.destroy if current_session\n @current_session = nil\n end",
"def destroy\n resource.destroy\n\n Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)\n\n set_flash_message! :notice, :destroyed\n\n yield resource if block_given?\n\n respond_with_navigational(resource) { redirect_to after_sign_out_path_for(resource_name) }\n end",
"def sign_out\n session.sign_out\n end",
"def after_sign_out_path_for(resource_or_scope)\n return session_path(resource_or_scope)\n end",
"def destroy\n sign_out(resource_name)\n doorkeeper_token.revoke\n\n render_meta message: I18n.t('devise.sessions.signed_out')\n end",
"def sign_out\n session.delete :user_id\n @current_user = nil\n end",
"def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end",
"def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end",
"def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end",
"def after_sign_out_path_for(resource_or_scope)\n if logout_path.present?\n logout_path\n else\n super(resource_or_scope)\n end\n end",
"def after_sign_out_path_for(resource_or_scope)\n '/signed_out'\n end",
"def destroy\n session[:user_id] = nil\n\n flash[:notice] = 'You have successfully signed out!'\n redirect_to \"#{CUSTOM_PROVIDER_URL}/users/sign_out\"\n end",
"def sign_out\n session.delete(:user_id)\n end",
"def destroy\n session[:user_id] = nil\n\n flash[:notice] = t(:successfully_logged_out)\n redirect_to \"#{CUSTOM_PROVIDER_URL}/users/sign_out\"\n end",
"def destroy\n begin\n resource.destroy\n rescue\n # @TODO check if customer if prevented from being deleted\n end\n Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)\n set_flash_message! :notice, :destroyed\n yield resource if block_given?\n respond_with_navigational(resource) { redirect_to after_sign_out_path_for(resource_name) }\n end",
"def sign_out\n reset_session\n @current_user = nil\n end",
"def sign_out\n @logout = true\n authenticate_api_user\n @logout = false\n revoke_access if @current_user\n head :no_content\n end",
"def logout\n payload = delete_session(params[:user_id], params[:session_token], params[:csrf_token])\n if payload == :SESSION_DELETED\n notify_session(\"SESSION_END_NOTICE\", {reason: \"LOGOUT\"}, params[:session_token])\n render status: 200, json: {error: false}\n elsif payload == :SESSION_NO_AUTH\n render status: 403, json: {error: true}\n else\n render status: 404, json: {error: true}\n end\n end",
"def destroy\n session[:user_id] = nil\n\n redirect_to(URI(Rails.application.config.apslabs_federation_url).merge('/users/sign_out').to_s, :notice => 'You have successfully signed out!')\n end",
"def destroy \n if session.present?\n #与accounts/config/initializers/devise文件before_logout重复\n send_logout_message\n session.destroy\n end\n flash[:notice] = 'You have successfully signed out!'\n redirect_to \"#{accounts_provider_url}/accounts/logout?redirect_uri=http://#{request.env['HTTP_HOST']}\"\n end",
"def sign_out\n session[:user_id] = nil \n session.delete(:user)\n end",
"def sign_out\n @current_user = nil\n end",
"def destroy\n set_flash_message :notice, :signed_out if signed_in?(resource_name)\n sign_out_and_redirect(resource_name)\n end",
"def after_sign_out_path_for(resource_or_scope); end",
"def sign_out\n forget current_user\n session[:user_id] = nil\n end",
"def sign_out\n session[:user_id] = nil\n end",
"def sign_out\n session[:user_id] = nil\n end",
"def signed_out\r\n # clear the authentication toke when the person manually signs out\r\n person = person.find_by_id(session[:person_id])\r\n\r\n if person\r\n update_authentication_token(person, nil)\r\n person.save\r\n session[:person_id] = nil\r\n flash[:notice] = \"You have been signed out.\"\r\n else\r\n redirect_to :sign_in\r\n end\r\n end",
"def after_sign_out_path_for(resource_or_scope)\n flash[:logout] = true\n root_path\n end",
"def sign_out\n @request.env[:clearance].sign_out\n end",
"def signout\n session.clear\n end",
"def sign_out\n arguments = { \"token\" => token }\n response = Services::Web.post user: self, service: 'User Data Service', endpoint: 'Authentication', method: 'signOut', arguments: arguments\n @token = nil if response.status == 200\n nil\n end",
"def sign_out\n if @current_user\n session.delete(:user_id)\n redirect_to action: \"index\"\n end\n end",
"def logout\n session.delete(:user_id)\n @current_user = nil\n end",
"def sign_out\n\n # mark them as signed out.\n # (this is a helper method of devise, the rails ruby gem we're using for\n # authentication in the sample app.)\n # \n # \n #session_sign_out <---- NEED TO CHANGE TO CUSTOM USER SIGN OUT\n\n # send them back to the homepage.\n redirect_to root_path\n\n end",
"def logout\n session.delete(:user_id) if current_user\n end",
"def log_out\n\t\tsession.delete(:authorization)\n\tend",
"def destroy\n redirect_path = after_sign_out_path_for(\"user\")\n signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(\"user\"))\n set_flash_message :notice, :signed_out if signed_out && is_navigational_format?\n super\n end",
"def logout\n @current_user = nil\n session.delete(:user_id)\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 after_sign_out_path_for(resource_or_scope)\n user_session_path\n end",
"def logout\n sign_out(current_account)\n end",
"def destroy # Assumes only JSON requests\n signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name))\n p render :json => {\n 'csrfParam' => request_forgery_protection_token,\n 'csrfToken' => form_authenticity_token\n }\n end",
"def sign_out(*args)\n warden.logout(*args)\n end",
"def signout \n\t if current_user\n\t session[:identity] = nil\n\t session[:authentication_id] = nil\n\t session.delete :identity\n\t session.delete :authentication_id\n\t flash[:notice] = 'You have been signed out!'\n\t end \n\t redirect_to root_url\n\t end",
"def sign_out_doctor\n forget(current_doctor)\n session.delete(:doctor_id)\n @current_doctor = nil\n end",
"def after_sign_out_path_for(resource_or_scope)\n user_session_path\n end",
"def destroy\n logger.info \"Session :: End omniauth session request.\"\n sign_out\n redirect_to root_path, :notice => \"Signed out!\"\n end",
"def sign_out\n send_request('sign_out', :delete) do |req|\n req.body = { auth_token: @auth_token }\n end\n end",
"def logout\n session.delete(:user_id)\n end",
"def destroy\n sign_out(authenticatable_class)\n redirect_to(passwordless_sign_out_redirect_path, Passwordless.config.redirect_to_response_options.dup)\n end",
"def destroy\n @user_session = @current_user_session\n if @user_session\n @user_session.destroy\n end\n redirect_to login_path\n end",
"def sign_out\n if active_token = ActiveToken.find_by_device(current_device)\n active_token.destroy\n end\n end",
"def destroy\n session[:user_id] = nil\n\n redirect_to \"#{SSOClient.provider_url}/users/sign_out?back=#{URI::encode(main_app.root_url)}\",\n notice: t(\"sso_client.messages.logged_out\")\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\nend",
"def log_out\n session.delete(:user_credentials)\n @current_user = nil\n end",
"def after_sign_out_path_for(resource_or_scope)\n if resource_or_scope == :user\n new_user_session_path\n elsif resource_or_scope == :crew_admin\n new_crew_admin_session_path\n else\n new_user_session_path\n end\n end",
"def logout\n # If we're given a logout request, handle it in the IdP logout initiated method\n if params[:SAMLRequest]\n idp_logout_request\n\n # We've been given a response back from the IdP\n elsif params[:SAMLResponse]\n process_logout_response\n elsif params[:slo]\n sp_logout_request\n else\n # Devise sign_out\n sign_out current_user\n end\n end",
"def logout\n @current_user = session[:user_id] = nil\n end",
"def destroy\n session[:user_id] = nil\n session[:omniauth] = nil\n redirect_to root_url, notice: \"SIGNED OUT\"\n end",
"def signout\n orang = get_orang_from_jwt_token\n if orang\n reset_session\n render json: {\n status: 'success'\n }\n else\n render json: {\n status: 'fail'\n }\n end\n end",
"def logout\n session[:user] = nil\n end",
"def destroy\n user_session = UserSession.find\n logout_url = user_session.logout_url(params) unless user_session.nil?\n user_session.destroy unless user_session.nil?\n redirect_to user_session_redirect_url(logout_url) unless performed?\n end",
"def after_sign_out_path_for resource_or_scope\n redirect_uri = params[:redirect_uri]\n redirect_uri ? redirect_uri : super\n end",
"def log_out\n session.delete(:user_email)\n session.delete(:role)\n end",
"def after_sign_out_path_for(resource_or_scope)\n # path before sign out request\n \"#{URI(request.referer).path}?logged_out=1\"\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n session.delete(:user_id)\n @current_user = nil\n end"
] | [
"0.8243276",
"0.78778213",
"0.77604944",
"0.76542157",
"0.74604636",
"0.7411613",
"0.70094126",
"0.68311465",
"0.67743087",
"0.6764469",
"0.67557484",
"0.66655976",
"0.6490673",
"0.6485247",
"0.6468482",
"0.6459305",
"0.6457145",
"0.64546746",
"0.6423036",
"0.64216405",
"0.64205605",
"0.6417572",
"0.641676",
"0.6411846",
"0.63833904",
"0.6380742",
"0.6372672",
"0.6362219",
"0.6362219",
"0.6362219",
"0.6362219",
"0.6344661",
"0.63378763",
"0.6335748",
"0.63310796",
"0.63309",
"0.63087285",
"0.63034296",
"0.6293239",
"0.6284976",
"0.6263456",
"0.62475395",
"0.6237534",
"0.6210392",
"0.62082696",
"0.6207832",
"0.62054193",
"0.61986905",
"0.6195274",
"0.6193631",
"0.6192731",
"0.6190318",
"0.61893415",
"0.61814815",
"0.61810994",
"0.6179171",
"0.61789715",
"0.6167763",
"0.6153663",
"0.61508334",
"0.6132261",
"0.61117387",
"0.6100032",
"0.6098746",
"0.6076352",
"0.6066786",
"0.605884",
"0.60574895",
"0.60501933",
"0.6048874",
"0.60466176",
"0.6045228",
"0.6039334",
"0.60313165",
"0.60298765",
"0.60290354",
"0.60249645",
"0.60237515",
"0.60225797",
"0.60147744",
"0.60095924",
"0.6009565",
"0.6005675",
"0.6003462",
"0.59945005",
"0.59910536",
"0.5990766",
"0.59874386",
"0.59874386",
"0.59874386",
"0.59874386",
"0.59874386",
"0.59874386",
"0.59874386",
"0.59874386",
"0.59874386",
"0.59874386",
"0.59874386",
"0.59874386"
] | 0.8185765 | 2 |
With this method we validate the input parameters | def check_params
#User ID must introduced
if params[:uid].blank?
flash[:error] = "User ID cannot be void"
redirect_to :action =>'index' and return
#Page must be a number
elsif (!params[:page].blank? && !(Integer === params[:page]))
flash[:error] = "Page must be a number"
redirect_to :action => 'index' and return
#If page is empty, we set it to 1
elsif params[:page].blank?
@page = '1'
@uid = params[:uid]
@pub0 = params[:pub0]
#Normal assignments
else
@uid = params[:uid]
@pub0 = params[:pub0]
@page = params[:page].to_i
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_params?; end",
"def validate_params(params)\n # This will be implemented by Validators which take parameters\n end",
"def validate params\n validate_params(params)\n validate_coordinates\n validate_color\n validate_dimension\n end",
"def check_params; true; end",
"def validate_paramters\n raise Scorekeeper::MissingParameterException if @income.nil? || @zipcode.nil? || @age.nil?\n end",
"def validate_parameters\n check_for_valid_filepath if (@repository.parameters[:file])\n\n check_number_of_parameters(:coord, 2)\n check_number_of_parameters(:delta, 2)\n check_number_of_parameters(:time, 2)\n check_number_of_parameters(:range, 2)\n check_number_of_parameters(:section, 2)\n end",
"def validate params\n validate_params(params)\n validate_dimension\n end",
"def validate_params\n validate_size\n validate_mine_density\n validate_first_click\n type_specific_checks\n end",
"def valid_params_request?; end",
"def validate\n end",
"def validate\r\n\r\n end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validation; end",
"def validation; end",
"def validate\n \n \n end",
"def validateParams \r\n\t \r\n\t \tif [email protected]? && [email protected]? && [email protected]?\r\n\t\t\treturn true\r\n\t \telse\r\n\t\t\treturn false \t\r\n\t \tend\r\n\t \t\r\n\t end",
"def validate\n validate_params\n validate_colour\n validate_coordinates\n validate_dimension\n end",
"def valid?(params)\n true\n end",
"def validate\n validate_params\n validate_coordinates\n validate_colour\n validate_dimension\n end",
"def validate_args (args)\n\t# todo\nend",
"def validate(args)\n if args.keys.sort == PARAMS.sort\n unless Float(args[:x]) && Float(args[:y]) && Float(args[:id])\n raise \"Wrong Customer params type: #{args}\"\n end\n else\n raise \"Illformed Customer params: #{args}\"\n end\n end",
"def validate_params\n @calls << [:validate_params]\n end",
"def validate_params?\n true # TODO: add validation\n end",
"def validate_params_present!\n raise ArgumentError, \"Please provide one or more of: #{ACCEPTED_PARAMS}\" if params.blank?\n end",
"def validate_params\n if [email protected]? && [email protected]_numeric?\n add_error(code: 400, error: 'The parameter to, be must a number')\n elsif (@from.is_a? String) && [email protected]_numeric?\n add_error(code: 400, error: 'The parameter from, be must a number')\n end\n end",
"def validate_parameters params = {}\n params.symbolize_keys!\n params.delete(:db) unless DBS.include?(params[:db].try(:to_sym))\n params.delete(:report_type) unless REPORT_TYPES.include?(params[:report_type].try(:to_sym))\n params.delete(:request_type) unless REQUEST_TYPES.include?(params[:request_type].try(:to_sym))\n @parameters = {:db => \"us\", :api_key => Semrush.api_key, :limit => \"\", :offset => \"\", :export_columns => \"\", :display_sort => \"\", :display_filter => \"\", :display_date => \"\"}.merge(@parameters).merge(params)\n raise Semrush::Exception::Nolimit.new(self, \"The limit parameter is missing: a limit is required.\") unless @parameters[:limit].present? && @parameters[:limit].to_i>0\n raise Semrush::Exception::BadArgument.new(self, \"Request parameter is missing: Domain name, URL, or keywords are required.\") unless @parameters[:request].present?\n raise Semrush::Exception::BadArgument.new(self, \"Bad db: #{@parameters[:db]}\") unless DBS.include?(@parameters[:db].try(:to_sym))\n raise Semrush::Exception::BadArgument.new(self, \"Bad report type: #{@parameters[:report_type]}\") unless REPORT_TYPES.include?(@parameters[:report_type].try(:to_sym))\n raise Semrush::Exception::BadArgument.new(self, \"Bad request type: #{@parameters[:request_type]}\") unless REQUEST_TYPES.include?(@parameters[:request_type].try(:to_sym))\n end",
"def validate_params!\n self.params ||= Hash.new\n self.class.instance_variable_get(:@__required_params).each do |e|\n raise ArgumentError, \"Insufficient parameters set (#{e} not supplied)\" if self.params[e].nil?\n end\n end",
"def validate(args = {})\n end",
"def validate!\n # pass\n end",
"def validate_question params\n\n end",
"def validate_params\n\n categories.each() do |key, value|\n throw RuntimeError.new(\"ERROR: category '#{key}' contains more than #{maximum_numbers_per_category} parameters. Reduce parameter count.\") if value.size >maximum_numbers_per_category\n end\n\n keys=[]\n numbers=[]\n # slicer contains parameter with number 0... therefore valid parameter numbers starts at 0\n valid_param_numbers=SetupConfiguration.parameter_range()\n\n self.parameters().each() do |p|\n\n $stderr.puts \"WARNING: parameter number 404 is reserved for machine type. you are using it for '#{p.key}'.\" if p.number.eql?(404)\n throw RuntimeError.new(\"ERROR: parameter number '#{p.number}' not supported. Number must be in range #{valid_param_numbers}.\") unless valid_param_numbers.member?(p.number)\n\n if p.param?\n if keys.include? p.key\n raise RuntimeError.new(\"ERROR: parameter key '#{p.key}' defined more than once\")\n else\n keys << p.key\n end\n\n\n if numbers.include? p.number\n raise RuntimeError.new(\"ERROR: parameter number '#{p.number}' defined more than once\")\n else\n numbers << p.number\n end\n else\n assign_param_ref(p)\n end#p.param?\n\n end\n #force fresh sort of parameters\n @parameters = nil\n end",
"def validate\n missing_parameters = []\n required_fields.each do |param|\n missing_parameters << param.to_s unless self.send(param)\n end\n raise RTurk::MissingParameters, \"Parameters: '#{missing_parameters.join(', ')}'\" unless missing_parameters.empty?\n end",
"def validate_params\n puts\n puts \"You're about to import data in your '#{Rails.env}' instance.\"\n puts \"You'll use the following source files:\"\n puts \" users: #{options['users'] || '-'} \"\n puts \" projects: #{options['projects'] || '-'}\"\n puts \" issues: #{options['issues'] || '-'}\"\n puts\n puts \"/!\\\\ Make sure to have a backup of your database before continuing.\"\n puts\n print 'Is this ok ? [y/n]: '\n STDOUT.flush\n ok = STDIN.gets.chomp!\n exit 2 if ok != 'y'\n puts\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def check_required_params\n errors = required_params.map { |param, value| raise param_errors[param] if value.nil? }.compact\n raise errors.joins('; ') unless errors.empty?\n end",
"def validate\n \n raise ArgumentError, \"Params emtpy\" if @params.nil? \n @errors = []\n @errors << 'charge must be provided' if @params.charge.nil? \n @errors << 'currency_code must be provided' if @params.currency_code.nil? \n @errors << 'order_id must be provided' if @params.order_id.nil? \n @errors << 'order must be provided' if @params.order.nil? \n @errors << 'order.id must be provided' if @params.order.id.nil? \n @errors << 'order.total must be provided' if @params.order.total.nil? \n @errors << 'order.shipping_value must be provided' if @params.order.shipping_value.nil? \n @errors << 'order.tax must be provided' if @params.order.tax.nil? \n @errors << 'order detail must be provided' unless @params.order.detail.length > 0 \n\n validate_item_details @params.order.detail if @params.order.detail.length > 0 \n\n raise ZipMoney::RequestError.new(\"Following error(s) occurred while making request, please resolve them to make the request: #{@errors}\") if @errors.any?\n end",
"def validate_params\n assert_provided env, 'Missing \"env\"'\n assert_provided action, 'Missing \"action\"'\n\n case action\n when 'import'\n assert_provided path, 'Missing \"path\"'\n\n when 'export'\n assert_provided path, 'Missing \"path\"'\n\n when 'read'\n assert_provided name, 'Missing \"name\"'\n\n when 'rename'\n assert_provided name, 'Missing \"name\"'\n assert_provided to, 'Missing \"to\"'\n\n end\n\n assert_env_is_configured env\n end",
"def validate\n\n end",
"def check_params\n true\n end",
"def arguments_valid?\n true \n # to do\n end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def arguments_valid?\n true \n end",
"def validate_create_params!(params); end",
"def validate!; end",
"def validate!; end",
"def validate!; end",
"def validate\n fail 'sub class to implement'\n end",
"def validate_params\n if command == 'PLACE'\n if params.kind_of?(Array)\n errors[:params] << '[PLACE] Must be three params' unless params.size == 3\n validate_coords\n validate_direction\n else\n errors[:params] << '[PLACE] Not valid params'\n end\n end\n end",
"def validate_parameters\n if (latitude.to_f == 0.0) || (longitude.to_f == 0.0)\n render :status=>401,\n :json=>{:Message=>\"The latitude and longitude parameters should be float values.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if (location_lock != \"true\") || (location_lock != \"false\")\n render :status=>401,\n :json=>{:Message=>\"The location_lock should be either true or false.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if proximity.to_i == 0\n render :status=>401,\n :json=>{:Message=>\"The proximity should be an integer.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if page.to_i == 0\n render :status=>401,\n :json=>{:Message=>\"The page should be an integer.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n end",
"def validate(options); end",
"def validated?; end",
"def validate!\n raise ArgumentError, 'Context should be a String' unless @context.is_a? String\n raise ArgumentError, 'Pattern should be a String' unless @pattern.is_a? String\n raise ArgumentError, 'Starting Index should be an Integer' unless @starting_index.is_a?(Integer)\n raise ArgumentError, 'Starting Index should be >= 0' unless @starting_index >= 0\n raise ArgumentError, 'Noise Threshold should be an Integer' unless @noise_threshold.is_a?(Integer)\n raise ArgumentError, 'Noise Threshold should be >= 0' unless @noise_threshold >= 0\n end",
"def validate\n raise ArgumentError, \"Params emtpy\" if @params.nil? \n @errors = []\n @errors << 'reason must be provided' if @params.reason.nil? \n @errors << 'txn_id must be provided' if @params.txn_id.nil? \n @errors << 'order.id must be provided' if @params.order.id.nil? \n @errors << 'order.total must be provided' if @params.order.total.nil? \n @errors << 'order.shipping_value must be provided' if @params.order.shipping_value.nil? \n @errors << 'order.tax must be provided' if @params.order.tax.nil? \n\n raise ZipMoney::RequestError.new(\"Following error(s) occurred while making request, please resolve them to make the request: #{@errors}\") if @errors.any?\n end",
"def validate_parameters(parameters={})\n parameters = self.normalize_parameters(parameters)\n required_variables = ((self.parameter_descriptions.select do |k, v|\n v['required']\n end).inject({}) { |h,(k,v)| h[k]=v; h }).keys\n missing_variables = required_variables - parameters.map { |(k, _)| k }\n if missing_variables.size > 0\n raise ArgumentError,\n \"Missing required parameters: #{missing_variables.join(', ')}.\"\n end\n parameters.each do |k, v|\n # Handle repeated parameters.\n if self.parameter_descriptions[k] &&\n self.parameter_descriptions[k]['repeated'] &&\n v.kind_of?(Array)\n # If this is a repeated parameter and we've got an array as a\n # value, just provide the whole array to the loop below.\n items = v\n else\n # If this is not a repeated parameter, or if it is but we're\n # being given a single value, wrap the value in an array, so that\n # the loop below still works for the single element.\n items = [v]\n end\n\n items.each do |item|\n if self.parameter_descriptions[k]\n enum = self.parameter_descriptions[k]['enum']\n if enum && !enum.include?(item)\n raise ArgumentError,\n \"Parameter '#{k}' has an invalid value: #{item}. \" +\n \"Must be one of #{enum.inspect}.\"\n end\n pattern = self.parameter_descriptions[k]['pattern']\n if pattern\n regexp = Regexp.new(\"^#{pattern}$\")\n if item !~ regexp\n raise ArgumentError,\n \"Parameter '#{k}' has an invalid value: #{item}. \" +\n \"Must match: /^#{pattern}$/.\"\n end\n end\n end\n end\n end\n return nil\n end",
"def validate(*args, **kargs)\n end",
"def validate?(params)\n _validate?(params)\n end",
"def validate_params\n raise 'No output defined. Please use --output option.' if @outputs.empty?\n end",
"def valid; end",
"def validate_param\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n erb.validate_param(@arguments.keys.first.to_s, @arguments.values.first)\n render json: { success: 'Param looks like the right data type! good job!' }, status: 200\n end\n end",
"def validate_parameters params = {}\n params.symbolize_keys!\n params.delete(:report_type) unless ANALYTIC_TYPES.include?(params[:report_type].try(:to_sym))\n params.delete(:target_type) unless @target_types.include?(params[:target_type].try(:to_sym)) unless params[:targets]\n @parameters = {:api_key => Semrush.api_key, :limit => \"\", :offset => \"\", :export_columns => \"\",\n :target => \"\", :target_type => \"\", :targets => \"\", :target_types => \"\",\n :display_sort => \"\", :display_filter => \"\", :display_date => \"\"}.merge(@parameters).merge(params)\n # When(if) we will have another method that use `targets` as an Array(like backlinks_comparison) improve this\n # and move validations from backlinks_comparison to here\n unless @parameters[:targets]\n raise Semrush::Exception::Nolimit.new(self, \"The limit parameter is missing: a limit is required.\") unless @parameters[:limit].present? && @parameters[:limit].to_i>0\n raise Semrush::Exception::BadArgument.new(self, \"Target parameter is missing: Domain name, URL.\") unless @parameters[:target].present?\n raise Semrush::Exception::BadArgument.new(self, \"Bad report_type: #{@parameters[:report_type]}\") unless ANALYTIC_TYPES.include?(@parameters[:report_type].try(:to_sym))\n raise Semrush::Exception::BadArgument.new(self, \"Bad target_type: #{@parameters[:target_type]}\") unless @target_types.include?(@parameters[:target_type].try(:to_sym))\n end\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate_params\n if lat.blank? || lng.blank? || property_type.blank? || offer_type.blank?\n @properties = []\n @message = \"Looks like some search parameters are missing!\"\n fail!(:validation_failed) && abort!\n end\n end",
"def base_validate_parameters\n check_for_valid_filepath if (@repository.parameters[:file])\n validate_parameters\n nil\n end",
"def arguments_valid?\n true\n end",
"def valid?(_) true end",
"def valid?(_) true end",
"def is_valid; end",
"def validator; end",
"def validated; end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def arguments_valid?\n true\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def check_arguments\n convert_boolean_strings\n check_output\n check_log_level\n check_input_entry\n check_input_types\n end",
"def validate_params\n if process_object && process_object[\"required_params\"]\n process_object[\"required_params\"].each do |param|\n if !params_hash.has_key?(param)\n errors.add(:params, \"Step: #{step} - Missing mandatory param #{param}\")\n end\n end\n end\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 validate_instance\n super\n # @wfd_show/edit_paramaeters must be arrays of symbols\n @wfd_show_parameters.each_with_index do |sp,i|\n unless sp.kind_of? Symbol then\n raise ArgumentError.new( \"permitted show parameter at [ #{ i } ] = #{ sp.to_s } is not a Symbol\" )\n end\n end\n @wfd_edit_parameters.each_with_index do |ep,i|\n unless ep.kind_of? Symbol then\n raise ArgumentError.new( \"permitted edit parameter at [ #{ i } ] = #{ ep.to_s } is not a Symbol\" )\n end\n end\n # @wfd_show/edit_parameters must not have duplicates\n dup_param1 = @wfd_show_parameters.detect {|e| @wfd_show_parameters.rindex(e) != @wfd_show_parameters.index(e) }\n unless dup_param1.nil? then\n raise ArgumentError.new( \"permitted show parameter #{ dup_param1 } occurs more than once.\")\n end\n dup_param1 = @wfd_edit_parameters.detect {|e| @wfd_edit_parameters.rindex(e) != @wfd_edit_parameters.index(e) }\n unless dup_param1.nil? then\n raise ArgumentError.new( \"permitted edit parameter #{ dup_param1 } occurs more than once.\")\n end\n # intersection of both arrays should be empty because at any time\n # a parameter can only be shown or editable...\n dup_params = @wfd_show_parameters & @wfd_edit_parameters\n unless dup_params.length == 0\n raise ArgumentError.new( \"parameters #{ dup_params.to_s } are defined to both show and edit\" )\n end\n end",
"def validate\n required = %i[currency_code direction epic guaranteed_stop level size time_in_force type]\n required.each do |attribute|\n raise ArgumentError, \"#{attribute} attribute must be set\" if send(attribute).nil?\n end\n\n if limit_distance && limit_level\n raise ArgumentError, 'do not specify both limit_distance and limit_level options'\n end\n\n raise ArgumentError, 'do not specify both stop_distance and stop_level options' if stop_distance && stop_level\n end",
"def check!\n super()\n \n if @params.kind_of? Array and (not @params.all? { |v| v.type != JsonRpcObjects::V11::GenericTypes::Nil })\n raise Exception::new(\"Nil return type isn't allowed for parameters.\")\n end\n end",
"def validate!\n REQUIRED_PARAMETERS.each do |name|\n if params[name].empty?\n raise(BuildRequestError, \"Vocalware: Parameter #{name} is required\")\n end\n end\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate_parameters?(op)\n temp_params = op.temporary[:plan_params]\n errors_noted = \"The following parameters for plan #{op.plan.id} have errors: \"\n er = false\n if temp_params[:fluorescent_marker]\n errors_noted.concat(\"dark_light invalid\") && er = true if !static_params[:dark_light_options].include? temp_params[:dark_light]\n errors_noted.concat(\"marker_type not supported\") && er = true if !static_params[:marker_type_options].include? temp_params[:marker_type]\n end\n op.error :invalid_parameters, errors_noted if er\n op.temporary[:valid_params?] = !er\n end",
"def validate_parameter(*param)\n param.each do |a|\n return false unless a && (a.to_s =~ /^\\{.*\\}$/) == nil && a != '' && a != {}\n end\n end",
"def validate_transaction_creation_parameters(params, whitelist)\n\n # delets all non-whitelisted params, and returns a safe list.\n params = trim_whitelisted(params, whitelist)\n\n # Return proper errors if parameter is missing:\n raise MissingEmail if params[\"email\"].to_s.length == 0\n # raise MissingSSN if params[\"ssn\"].to_s.length == 0\n raise MissingPassportOrSSN if (params[\"ssn\"].to_s.length == 0 and\n params[\"passport\"].to_s.length == 0)\n raise MissingLicenseNumber if (params[\"license_number\"].to_s.length == 0 and\n params[\"passport\"].to_s.length == 0)\n raise MissingFirstName if params[\"first_name\"].to_s.length == 0\n raise MissingLastName if params[\"last_name\"].to_s.length == 0\n raise MissingResidency if params[\"residency\"].to_s.length == 0\n raise MissingBirthDate if params[\"birth_date\"].to_s.length == 0\n raise MissingClientIP if params[\"IP\"].to_s.length == 0\n raise MissingReason if params[\"reason\"].to_s.length == 0\n raise MissingLanguage if params[\"language\"].to_s.length == 0\n\n # Validate the Email\n raise InvalidEmail if !validate_email(params[\"email\"])\n\n # User must provide either passport or SSN. Let's check if\n # one or the other is invalid.\n\n # Validate the SSN\n # we eliminate any potential dashes in ssn\n params[\"ssn\"] = params[\"ssn\"].to_s.gsub(\"-\", \"\").strip\n # raise InvalidSSN if !validate_ssn(params[\"ssn\"])\n raise InvalidSSN if params[\"ssn\"].to_s.length > 0 and\n !validate_ssn(params[\"ssn\"])\n # Validate the Passport\n # we eliminate any potential dashes in the passport before validation\n params[\"passport\"] = params[\"passport\"].to_s.gsub(\"-\", \"\").strip\n raise InvalidPassport if params[\"passport\"].to_s.length > 0 and\n !validate_passport(params[\"passport\"])\n\n # Validate the DTOP id:\n raise InvalidLicenseNumber if !validate_dtop_id(params[\"license_number\"]) and\n params[\"passport\"].to_s.length == 0\n\n raise InvalidFirstName if !validate_name(params[\"first_name\"])\n raise InvalidMiddleName if !params[\"middle_name\"].nil? and\n !validate_name(params[\"middle_name\"])\n raise InvalidLastName if !validate_name(params[\"last_name\"])\n raise InvalidMotherLastName if !params[\"mother_last_name\"].nil? and\n !validate_name(params[\"mother_last_name\"])\n\n raise InvalidResidency if !validate_residency(params[\"residency\"])\n\n # This validates birthdate\n raise InvalidBirthDate if !validate_birthdate(params[\"birth_date\"])\n # This checks minimum age\n raise InvalidBirthDate if !validate_birthdate(params[\"birth_date\"], true)\n raise InvalidClientIP if !validate_ip(params[\"IP\"])\n raise InvalidReason if params[\"reason\"].to_s.strip.length > 255\n raise InvalidLanguage if !validate_language(params[\"language\"])\n\n return params\n end",
"def validate_transaction_creation_parameters(params, whitelist)\n\n # delets all non-whitelisted params, and returns a safe list.\n params = trim_whitelisted(params, whitelist)\n\n # Return proper errors if parameter is missing:\n raise MissingEmail if params[\"email\"].to_s.length == 0\n # raise MissingSSN if params[\"ssn\"].to_s.length == 0\n raise MissingPassportOrSSN if (params[\"ssn\"].to_s.length == 0 and\n params[\"passport\"].to_s.length == 0)\n raise MissingLicenseNumber if (params[\"license_number\"].to_s.length == 0 and\n params[\"passport\"].to_s.length == 0)\n raise MissingFirstName if params[\"first_name\"].to_s.length == 0\n raise MissingLastName if params[\"last_name\"].to_s.length == 0\n raise MissingResidency if params[\"residency\"].to_s.length == 0\n raise MissingBirthDate if params[\"birth_date\"].to_s.length == 0\n raise MissingClientIP if params[\"IP\"].to_s.length == 0\n raise MissingReason if params[\"reason\"].to_s.length == 0\n raise MissingLanguage if params[\"language\"].to_s.length == 0\n\n # Validate the Email\n raise InvalidEmail if !validate_email(params[\"email\"])\n\n # User must provide either passport or SSN. Let's check if\n # one or the other is invalid.\n\n # Validate the SSN\n # we eliminate any potential dashes in ssn\n params[\"ssn\"] = params[\"ssn\"].to_s.gsub(\"-\", \"\").strip\n # raise InvalidSSN if !validate_ssn(params[\"ssn\"])\n raise InvalidSSN if params[\"ssn\"].to_s.length > 0 and\n !validate_ssn(params[\"ssn\"])\n # Validate the Passport\n # we eliminate any potential dashes in the passport before validation\n params[\"passport\"] = params[\"passport\"].to_s.gsub(\"-\", \"\").strip\n raise InvalidPassport if params[\"passport\"].to_s.length > 0 and\n !validate_passport(params[\"passport\"])\n\n # Validate the DTOP id:\n raise InvalidLicenseNumber if !validate_dtop_id(params[\"license_number\"]) and\n params[\"passport\"].to_s.length == 0\n\n raise InvalidFirstName if !validate_name(params[\"first_name\"])\n raise InvalidMiddleName if !params[\"middle_name\"].nil? and\n !validate_name(params[\"middle_name\"])\n raise InvalidLastName if !validate_name(params[\"last_name\"])\n raise InvalidMotherLastName if !params[\"mother_last_name\"].nil? and\n !validate_name(params[\"mother_last_name\"])\n\n raise InvalidResidency if !validate_residency(params[\"residency\"])\n\n # This validates birthdate\n raise InvalidBirthDate if !validate_birthdate(params[\"birth_date\"])\n # This checks minimum age\n raise InvalidBirthDate if !validate_birthdate(params[\"birth_date\"], true)\n raise InvalidClientIP if !validate_ip(params[\"IP\"])\n raise InvalidReason if params[\"reason\"].to_s.strip.length > 255\n raise InvalidLanguage if !validate_language(params[\"language\"])\n\n return params\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate_params\n assert_provided env, 'Missing \"env\"'\n assert_provided action, 'Missing \"action\"'\n\n case action\n when 'import'\n assert_provided path, 'Missing \"path\"'\n\n when 'export'\n assert_provided path, 'Missing \"path\"'\n\n end\n\n assert_env_is_configured env\n end",
"def validate_input\n problems = test_input\n raise OperationalError, \"Found the following problems: #{problems}\" unless problems.empty?\n end",
"def valid_for_params_auth?; end",
"def validate_param(param)\n\t\t\terror = {}\n\t\t\tif param.form_structure_id == nil\n\t\t\t\terror[:formName] = \"Please specify\"\n\t\t\t\treturn error\n\t\t\tend\n\t\t\tform = FormStructure.find(param.form_structure_id)\n\t\t\tif form.nil?\n\t\t\t\terror[:formName] = \"Please specify\"\n\t\t\t\treturn error\n\t\t\tend\n\t\t\tif param.is_many_to_one_count\n\t\t\t\tvalidate_many_to_one_count(form, error, param)\n\t\t\telsif param.is_many_to_one_instance\n\t\t\t\tvalidate_many_to_one_instance(form, error, param)\n\t\t\telse\n\t\t\t\tvalidate_normal_question(error, param)\n\t\t\tend\n\n\t\tend",
"def parameter_rule?; end"
] | [
"0.8146083",
"0.80835253",
"0.80127525",
"0.7832227",
"0.7734135",
"0.7719062",
"0.7684393",
"0.753941",
"0.7515018",
"0.7470152",
"0.7429096",
"0.7402946",
"0.7402946",
"0.7402946",
"0.7402946",
"0.7359438",
"0.7359438",
"0.7345443",
"0.7343727",
"0.7341059",
"0.73254406",
"0.7314987",
"0.73087734",
"0.72449625",
"0.7231246",
"0.72257507",
"0.7216102",
"0.7210339",
"0.7206866",
"0.71981025",
"0.7196187",
"0.71856135",
"0.717453",
"0.71555597",
"0.71384597",
"0.71145844",
"0.7098813",
"0.7098813",
"0.7098813",
"0.70978075",
"0.70816785",
"0.7057931",
"0.7040305",
"0.7032773",
"0.7027151",
"0.70176077",
"0.70176077",
"0.70176077",
"0.70176077",
"0.70176077",
"0.70078623",
"0.7003537",
"0.69978446",
"0.69978446",
"0.69978446",
"0.69943243",
"0.6986844",
"0.69826937",
"0.697307",
"0.6962734",
"0.6951985",
"0.69439757",
"0.69402504",
"0.6935557",
"0.693298",
"0.6932732",
"0.6919641",
"0.69121546",
"0.6906513",
"0.6897946",
"0.6897946",
"0.6897946",
"0.68819296",
"0.684729",
"0.68450344",
"0.6833217",
"0.6833217",
"0.68281454",
"0.6827743",
"0.6815308",
"0.6808337",
"0.6806389",
"0.6803257",
"0.67992866",
"0.6798969",
"0.6794403",
"0.67899835",
"0.6786703",
"0.67818946",
"0.6774601",
"0.6770032",
"0.67560995",
"0.67547745",
"0.6746894",
"0.6746894",
"0.67425466",
"0.6730519",
"0.6721327",
"0.670422",
"0.67013055",
"0.6694491"
] | 0.0 | -1 |
Returns an array containing all address/data from the given srecord No address manipulation is performed, that is left to the caller to apply any scrambling as required by the target system | def extract_addr_data(options = {})
options = {
data_width_in_bytes: 4
}.merge(options)
# guarantee that the start_address will be the jump address if provided
if @start_address.nil?
start_address
@call_order_warn = @start_record_found ? true : false
end
result = []
lines.each do |line|
# Only if the line is an s-record with data...
if line =~ /^S([1-3])/
type = Regexp.last_match[1].to_i(16) # S-record type, 1-3
# Set the matcher to capture x number of bytes dependent on the s-rec type
addr_matcher = '\w\w' * (1 + type)
line.strip =~ /^S\d\w\w(#{addr_matcher})(\w*)\w\w$/ # $1 = address, $2 = data
addr = Regexp.last_match[1].to_i(16)
data = Regexp.last_match[2]
data_matcher = '\w\w' * options[:data_width_in_bytes]
data.scan(/#{data_matcher}/).each do |data_packet|
result << [addr, data_packet.to_i(16)]
addr += options[:data_width_in_bytes]
end
# If a partial word is left over
if (remainder = data.length % (2 * options[:data_width_in_bytes])) > 0
if @ljust_partial_data
result << [addr, data[data.length - remainder..data.length].ljust(options[:data_width_in_bytes] * 2, '0').to_i(16)]
else
result << [addr, data[data.length - remainder..data.length].to_i(16)]
end
end
end
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieveaddressnameskey(fileonedata)\n arr = Array.new\n fileonedata.each_line.with_index do |single_line, index|\n arr.push(single_line.split[0]) if (single_line.split[5] && index>20)\n end\n return arr\n end",
"def records( quantity = 1 )\n addresses = []\n quantity.times do\n addresses.push( self.record() )\n end\n addresses\n end",
"def convert_binary_recordroutes(data, print=false)\n offset=0\n recordroutes=[]\n #while not probes.eof?\n while not offset>=data.length\n rr=data[offset,72].unpack(\"N3LfL2N9L2\")\n offset += 72\n if rr.nil? or rr.include?(nil)\n raise TruncatedTraceFileException.new(recordroutes), \"Error reading header\", caller\n end\n dst=Inet::ntoa(rr.at(0))\n rtt=rr.at(4)\n ttl=rr.at(5)\n hops=rr[7..15].collect{|x| Inet::ntoa(x)}\n\n recordroutes << [dst,hops,rtt,ttl]\n if print\n $stdout.puts \"#{dst} #{rtt} #{hops.join(\" \")}\"\n end\n end\n return recordroutes\nend",
"def addresses\n return @addresses if @addresses\n @addresses = []\n @report.lines.each do |l|\n a = Crashreport.address_from_report_line(l)\n @addresses << a if a\n end\n @addresses\n end",
"def convert(record)\n\t\t\tarrays_2 = Array.new\n\t\t\ttmp = hash_to_array(record)\n\t\t\tarrays_2.push(tmp)\n\t\tend",
"def record_to_array(r, attrs)\n []\n end",
"def record()\n street = @street_name_source.record() \n house_number = @house_number_source.record()\n postal_code_and_town = @postal_town_source.record()\n # Very fragile / relies on proper input data file:\n postal_code, town = postal_code_and_town.match(/(\\w+)\\s+(.+)/)[1,2]\n Address.new( house_number, street, postal_code, town )\n end",
"def addresses\n Array(@addresses)\n end",
"def get_records_of_type requested_record_type\n ui2 = @records_unpacked\n records = []\n\n ui2_size = ui2.size\n offset = 0\n ptr = ui2\n record_byte_offset = 0\n record_type_array = Array(requested_record_type)\n\n while(offset < ui2_size) do\n curr_record_type = ptr[offset]\n record_size = ptr[offset+1]\n\n offset += (record_size/2)\n\n #yield records, curr_record_type, offset, ptr\n #do |records, record_type, offset, ptr|\n if record_type_array.include? curr_record_type\n #records.push(ptr[record_byte_offset...record_byte_offset+record_size].pack('S>*'))\n records.push(@records_packed[record_byte_offset...record_byte_offset+record_size])\n end\n #end\n\n record_byte_offset += record_size\n #ptr = ptr[(record_size/2)..-1]\n end\n\n records\n end",
"def records_array(lines)\n lines.map { |line| collect_line(line) }.select { |rate| rate[:rate_type] == :list }\n end",
"def hash_to_array(record)\n\t\t\tarr = Array.new\n\t\t\trecord.map do |key, val |\n\t\t\t\tarr.push(val)\n\t\t\tend\t\t\t\n\t\t\tarr\n\t\tend",
"def find_and_map\n return enum_for(__method__) if !block_given?\n\n address_to_record = Hash.new\n each_record do |r|\n if result = yield(r.dup)\n address_to_record[r['address']] = result.to_hash\n end\n end\n MemoryDump.new(address_to_record)\n end",
"def addresses; end",
"def addresses\n # prevent original array from being changed\n @addresses.dup\n end",
"def setup_abst_info(record)\n text = []\n record.find_all{|f| f.tag === \"520\" }.each do |field|\n textstr = ''\n field.each do |sf|\n textstr << sf.value + ' ' unless [\"c\", \"2\",\"3\",\"6\"].include?(sf.code)\n end\n text << textstr\n end\n Rails.logger.debug \"********es287_dev #{__FILE__} #{__LINE__} #{__method__} #{text[0]}\"\n text\n end",
"def parse_dns(dns_raw)\n dns = []\n dns_records = {}\n record_type_A = []\n record_type_A_IP = []\n record_type_CNAME = []\n record_type_CNAME_alias = []\n\n #adds each line to dns array and splipt them with \",\"\n dns_raw.each do |lines_in_files|\n dns.push([lines_in_files.split(\",\")])\n end\n\n #Checks for recordA,IP or recordCNAME and adds them to the respected array\n dns.each do |words_in_files|\n if words_in_files[0][0] == \"A\"\n record_type_A.push(words_in_files[0][1].strip)\n record_type_A_IP.push(words_in_files[0][2].strip)\n elsif words_in_files[0][0] == \"CNAME\"\n record_type_CNAME.push(words_in_files[0][1].strip)\n record_type_CNAME_alias.push(words_in_files[0][2].strip)\n end\n end\n\n #record_A hash stores values of recordA\n record_A = {\n :source => record_type_A,\n :ip => record_type_A_IP,\n }\n\n #recordCNAME hash stores values of recordCNAME\n record_CNAME = {\n :source => record_type_CNAME,\n :alias => record_type_CNAME_alias,\n }\n\n #dns_records gets both Hashes\n dns_records = {\n :A => record_A,\n :CNAME => record_CNAME,\n }\n\n #returns record dns_record with two hashes.\n return dns_records\nend",
"def fmtstr_gen_array_from_buf(write_to, buffer, targ = target)\n\t\t\n\t\t# break buffer into shorts\n\t\tarr = Array.new\n\t\toff = 0\n\t\tif ((buffer.length % 2) == 1)\n\t\t\tbuffer << rand_text(1)\n\t\tend\n\t\twhile off < buffer.length\n\t\t\t# convert short to number\n\t\t\ttb = buffer[off,2].unpack('v')[0].to_i\n\t\t\t#print_status(\"%d %d %d\" % [off,buffer.length,tb])\n\t\t\taddr = write_to + off\n\t\t\t\n\t\t\tarr << [ tb, addr ]\n\t\t\toff += 2\n\t\tend\n\t\treturn arr\n\tend",
"def index\n @address_records = AddressRecord.all\n end",
"def get_guids(record)\n arr = []\n record.each do |r|\n arr.push(r[\"guid\"])\n end\n return arr\n end",
"def record_to_array(marc_field)\n record_values = []\n marc_field, sub_field = marc_field.split('.')\n to_marc.find_all {|f| marc_field == f.tag}.each do |entry|\n unless entry[sub_field].nil?\n record_values.push(entry[sub_field])\n # or clean the record first\n # record_values.push(clean_record(entry[sub_field])\n end\n end\n record_values\n end",
"def convert_record(line)\n record = line.split(' ')\n if record[1] == 'A' || record[1] == 'AAAA'\n ip = IPAddr.new record[2]\n name = ip.reverse\n puts name + \". PTR \" + record[0]\n end\nend",
"def records\n [Record.new(:name => \"@\", :type => \"MX\", :data => \"#{@priority} #{@name}\")]\n end",
"def compute_reverse_records(site_uid, site_records)\n reverse_records = {}\n\n site_records.each { |zone, records|\n # Sort records\n site_records[zone] = sort_records(records)\n\n records.each{ |record|\n # Get reverse records\n reverse_file_name, reverse_record = get_reverse_record(record, site_uid)\n if reverse_file_name != nil\n reverse_records[reverse_file_name] ||= []\n reverse_records[reverse_file_name].each {|r|\n if r.label == reverse_record.label\n puts \"Warning: reverse entry with address #{reverse_record.label} already exists in #{reverse_file_name}, #{reverse_record.name} is duplicate\"\n end\n }\n reverse_records[reverse_file_name] << reverse_record\n end\n }\n }\n\n reverse_records\nend",
"def parse_dns(dns_raw)\n dns_records = {}\n dns_raw.each do |rec|\n rec=rec.chomp\n unless rec[0] == \"#\" || rec.empty?\n records = rec.split(/,/)\n records = records.map {|recd| recd.strip()}\n unless dns_records.has_key?(records[0])\n dns_records.store(records[0],[[records[1],records[2]]])\n else\n dns_records[records[0]].push([records[1],records[2]])\n end\n end\n end\n return dns_records\nend",
"def phone_sequence(s)\n phones = PhoneSequence.new\n s.scan(@seg_regex) do |seg|\n begin\n phones << fetch(seg)\n rescue IndexError\n raise ArgumentError.new(\"/#{seg}/ in #{s} \"+\n \"is not in the phone table\")\n end\n end\n phones\n end",
"def addresses(aptArr)\n aptArr.each do |apt|\n #puts apt[:address]\n end\n end",
"def resource_records(powerdns_sql: false)\n soa_origin = powerdns_sql ? expand_dot(soa[:origin]) : soa[:origin]\n rr_soa = RR.new(soa_origin, expand_ttl(soa[:ttl]), \"IN\", \"SOA\")\n rr_soa.data = {\n primary: (:dot if powerdns_sql),\n email: (:dot if powerdns_sql),\n serial: nil,\n refresh: :ttl,\n retry: :ttl,\n expire: :ttl,\n minimumTTL: :ttl,\n }.map {|f, expand|\n val = soa[f]\n val = expand_dot(val) if expand == :dot\n val = expand_ttl(val) if expand == :ttl\n val\n }.join(\"\\t\")\n\n RECORDS.each_with_object(soa: rr_soa) do |(name, (type, *fields)), rrs|\n @records[name].each do |item|\n item = expand_dot_content(type, item) if powerdns_sql\n\n rr = RR.new(item[:name], expand_ttl(item[:ttl]), (item[:class] || \"IN\").upcase, type)\n rr.data = fields.map {|f| item[f] }.join(\"\\t\")\n rrs[type] ||= []\n rrs[type] << rr\n end\n end\n end",
"def dissect_to_record_hashes\n end",
"def value\n expand( address ).map { |ar| ar.map { |addr| data[ addr ] } }\n end",
"def call_sra(reg_key, addr, i_reg, m_spec)\n mem_addr = get_mem_addr(addr, i_reg)\n (1..mem_addr).each do |i|\n @registers['A'].word.shift_right\n end\n end",
"def pull\n zt=Dnsruby::ZoneTransfer.new\n zt.transfer_type=Dnsruby::Types.AXFR\n zt.server=self.server\n zone=zt.transfer(self.zone.domain)\n zone.tsig=self.zone.domain+\".\", self.key\n soa=zone[0]\n recl=zone[1]\n for record in zone\n src,type,target=record.to_s.match(/([A-z\\.0-9]*)[0-9\\t ]*(IN\\t[A-z]*)\\t([A-z0-9\\. ]*)/).captures\n if type=='IN\\tMX' or type=='IN\\tA' or type=='IN\\tCNAME'\n\tcreateRecord(record)\n elsif type=='IN\\tSOA'\n updateSerial(record)\n end\n end\nend",
"def records\n [gogovan_order, contact.try(:address), contact, schedule, self].compact\n end",
"def fetch_unaligned_sequences \n answer = Array.new \n self.genomic_aligns.each do |piece| \n sequence = piece.get_slice.seq\n fas = Bio::FastaFormat.new(Bio::Sequence::NA.new(sequence).to_fasta(piece.genomic_align_id))\n answer.push(fas) \n end \n return answer \n end",
"def callnumbers_from_945(record)\n callnumbers = []\n # Get the and b values to use as alternates\n # TODO: do we need to consider other fields (e.g. 099)?\n values_090ab = []\n x090ab = extract_marc(\"090ab\", :trim_punctuation => false)\n x090ab.call(record, values_090ab, nil)\n alternate_stem = values_090ab.join(\" \")\n # Process the callnumbers in the 945\n f945 = record.select {|f| f.tag == \"945\"}\n f945.each do |f|\n a = subfield_value(f, \"a\")\n b = subfield_value(f, \"b\")\n c = subfield_value(f, \"c\")\n g = subfield_value(f, \"g\")\n callnumber = build_callnumber(a, b, c, g, alternate_stem)\n if callnumber != \"\"\n callnumbers << callnumber\n end\n end\n callnumbers\nend",
"def [](idx)\n return unless addresses[idx]\n\n to_a[idx]\n end",
"def make_indirect_address_array(a) \n aux_a = [] \n a.each_index{|i| aux_a[i] = [i,a[i]] }\n aux_a.sort!{|x,y| x[1] <=> y[1]}\n ind_add = []\n aux_a.each_index{|i| ind_add[i] = aux_a[i][0]}\n ind_add\n end",
"def records( quantity = 1 )\n email_addresses = []\n quantity.times do\n email_addresses.push( self.record() )\n end\n email_addresses\n end",
"def get_all(ip)\n\t\tself.v4 = ip.length == 4 && self.ip_version == 4\n\t\tipnum = ip.unpack(\"N\")[0] + 0\n\t\tmid = self.count/2\n\t\tcol_length = columns * 4\n\t\tlow = 0\n\t\thigh = count\n\t\treturn self.record = bsearch(low, high, ipnum, self.base_addr, col_length)\n\tend",
"def extract_addresses(address_list)\n addresses = []\n address_list.each do |address|\n addresses << address[:address] if ['ipv4', 'hostname'].include?(address[:type])\n end\n addresses\nend",
"def strand; @data[8]; end",
"def get_proxy_records sinfo\n records = []\n\n role = @app.frontend? sinfo ? :frontend : :backend\n server_type = sinfo[:server_type]\n\n record = get_sys_remote_path role\n records << remote_path_record('sys', server_type, record) if record\n\n record = get_user_remote_path @app.base, server_type\n records << remote_path_record('user', server_type, record) if record\n\n records\n end",
"def parse_dns(dns_raw)\n raw_data=dns_raw.reject { |line| line.empty? or line[0] == \"#\" }#removing hash and empty lines,string\n split_data=raw_data.map { |line| line.strip.split(\", \") }#split the entry into columns using ','\n clean_data=split_data.reject { |record| record.length < 3 }# discarding false entries in zone file\n clean_data.each_with_object({}) do |record, records|# preparing hash for dns entries\n records[record[1]] = {\n type: record[0],\n target: record[2],\n }\n end\n end",
"def data_from_zonefile_record type, zf_record\n case type.to_s.upcase\n when \"A\"\n String zf_record[:host]\n when \"AAAA\"\n String zf_record[:host]\n when \"CNAME\"\n String zf_record[:host]\n when \"MX\"\n \"#{zf_record[:pri]} #{zf_record[:host]}\"\n when \"NAPTR\"\n \"#{zf_record[:order]} #{zf_record[:preference]} \" \\\n \"#{zf_record[:flags]} #{zf_record[:service]} \" \\\n \"#{zf_record[:regexp]} #{zf_record[:replacement]}\"\n when \"NS\"\n String zf_record[:host]\n when \"PTR\"\n String zf_record[:host]\n when \"SOA\"\n \"#{zf_record[:primary]} #{zf_record[:email]} \" \\\n \"#{zf_record[:serial]} #{zf_record[:refresh]} \" \\\n \"#{zf_record[:retry]} #{zf_record[:expire]} \" \\\n \"#{zf_record[:minimumTTL]}\"\n when \"SPF\"\n String zf_record[:data]\n when \"SRV\"\n \"#{zf_record[:pri]} #{zf_record[:weight]} \" \\\n \"#{zf_record[:port]} #{zf_record[:host]}\"\n when \"TXT\"\n String zf_record[:text]\n else\n raise ArgumentError, \"record type '#{type}' is not supported\"\n end\n end",
"def data\n records.map { |record| data_record(record) }\n end",
"def red_address_data(kind, address)\n data = {\n 'Name' => f.cut(29) { address.firstname.to_s.squish },\n 'Surname' => f.cut(29) { address.lastname.to_s.squish },\n 'Email' => f.cut(44) { email.to_s.squish },\n 'Address' => f.cut(29) { address.address1.to_s.squish },\n 'Address2' => f.cut(29) { address.address2.to_s.squish },\n 'City' => f.cut(19) { address.city.to_s.squish },\n # 'StateCode' => address.state_name.to_s.squish.cut(30),\n 'Country' => address.country.correct_iso3,\n 'PostalCode' => f.cut(8) { address.zipcode.to_s.squish },\n 'HomePhone' => f.cut(18) { f.digits { address.phone } },\n # 'MobilePhone' => nil,\n # 'FaxPhone' => nil,\n # 'TimeToDeparture => nil\n }\n\n data.map { |k, v| { [kind, k].join('_') => v } }.reduce(&:merge)\n end",
"def getRecordJSON()\n return @sObjectRecords\nend",
"def find_record\n @record = reply_address.record\n end",
"def convert_binary_traceroutes(data, print=false)\n offset=0\n traceroutes=[]\n while not offset>=data.length\n header=data[offset,16].unpack(\"L4\")\n offset += 16\n if header.nil? or header.include?(nil) \n raise TruncatedTraceFileException.new(traceroutes), \"Error reading header\", caller\n end\n client_id=header.at(0)\n uid=header.at(1)\n num_tr=header.at(2)\n record_length=header.at(3)\n (0...num_tr).each{|traceroute_index|\n tr_header=data[offset,8].unpack(\"NL\")\n offset += 8\n if tr_header.nil? or tr_header.include?(nil)\n raise TruncatedTraceFileException.new(traceroutes), \"Error reading TR header\", caller\n end\n dst=Inet::ntoa(tr_header.at(0))\n numhops=tr_header.at(1)\n hops = []\n rtts = []\n ttls = []\n last_nonzero=-1\n (0...numhops).each{|j|\n hop_info=data[offset,12].unpack(\"NfL\")\n offset += 12\n if hop_info.nil? or hop_info.include?(nil)\n raise TruncatedTraceFileException.new(traceroutes), \"Error reading hop\", caller\n end\n ip = Inet::ntoa(hop_info.at(0))\n rtt = hop_info.at(1)\n ttl = hop_info.at(2)\n if (ttl > 512)\n raise TruncatedTraceFileException.new(traceroutes), \"TTL>512, may be corrupted\", caller\n end\n if ip!=\"0.0.0.0\"\n last_nonzero=j\n end\n hops << ip\n rtts << rtt\n ttls << ttl\n\n }\n if last_nonzero>-1\n traceroutes << [dst,hops,rtts,ttls]\n if print\n tr_s=\"#{dst} #{last_nonzero+1} #{hops[0..last_nonzero].join(\" \")}\"\n if block_given?\n yield(tr_s)\n else \n $stdout.puts \"tr_s\"\n end \n #puts \"#{ARGV[1..-1].join(\" \")} #{dst} #{last_nonzero+1} #{hops[0..last_nonzero].join(\" \")}\"\n end\n end\n\n }\n end\n return traceroutes\nend",
"def full_address_array\n [name, address1, address2, city_state_zip].compact\n end",
"def full_address_array\n [name, address1, address2, city_state_zip].compact\n end",
"def get_records\n\tstdin,stdout,stderr = Open3.popen3(\"/usr/bin/avahi-browse -a -r -t -p\")\n\tfound = []\n\tstdout.each_line do |l|\n\t\tif l =~ /^=/\n\t\t\telements = l.split(\";\")\n\t\t\trecord = { \n\t\t\t\t:service => elements[4],\n\t\t\t\t:domain => elements[5],\n\t\t\t\t:host => elements[6],\n\t\t\t\t:ip => elements[7],\n\t\t\t\t:port => elements[8],\n\t\t\t\t:txt => \"\\'#{elements[9].chomp}\\'\"\n\t\t\t\t}\n\t\t\tfound << record\n\t\tend\n\tend\n\treturn found\nend",
"def email_record_to_array(db_record)\n retval = []\n\n retval << db_record.character_count\n retval << db_record.alpha_numeric_count\n retval << db_record.alpha_numeric_ratio\n retval << db_record.digit_count\n retval << db_record.whitespace_count\n\n ('a'..'z').each do |letter|\n retval << db_record.send(\"#{letter}_count\")\n end\n\n retval << db_record.asterisk_count\n retval << db_record.underscore_count\n retval << db_record.plus_count\n retval << db_record.equals_count\n retval << db_record.percent_count\n retval << db_record.dollar_sign_count\n retval << db_record.at_count\n retval << db_record.minus_count\n retval << db_record.backslash_count\n retval << db_record.slash_count\n retval << db_record.word_count\n retval << db_record.short_word_count\n retval << db_record.average_word_length\n retval << db_record.average_sentence_character_length\n retval << db_record.average_sentence_word_length\n\n (1..15).each do |length| \n retval << db_record.send(\"words_of_length_#{length}_ratio\")\n end\n\n retval << db_record.number_of_unique_words\n retval << db_record.once_occuring_words_freq\n retval << db_record.twice_occuring_words_freq\n\n retval << db_record.period_count\n retval << db_record.tick_count\n retval << db_record.semicolon_count\n retval << db_record.question_mark_count\n retval << db_record.exclamation_mark_count\n retval << db_record.colon_count\n retval << db_record.left_paren_count\n retval << db_record.right_paren_count\n retval << db_record.dash_count\n retval << db_record.quotation_mark_count\n retval << db_record.left_double_arrow_count\n retval << db_record.right_double_arrow_count\n retval << db_record.less_than_count\n retval << db_record.greater_than_count\n retval << db_record.left_bracket_count\n retval << db_record.right_bracket_count\n retval << db_record.left_brace_count\n retval << db_record.right_brace_count\n\n retval\n end",
"def gather_rlocs(fh)\n\t\t(0...@nrlocs).each do |rlocnum|\n\t\t\tloc, seg, ref, type, extra = getl(fh).split(' ', 5)\n\t\t\t\n\t\t\t@rlocrecs[rlocnum] = build_rlocrec(loc.hex, seg.hex, ref.hex, type, extra)\n\t\tend\n\tend",
"def find_address_details\n @address_summary = AddressSummary.new\n # Carry forward the default country otherwise it gets lost\n @address_detail = Address.find(find_params[:search_results], params[:address][:default_country])\n if @address_detail.nil?\n @address_summary.errors.add(:postcode, :no_address_find_results)\n else\n @address_summary.postcode = @address_detail.postcode\n @show_manual_address = true\n end\n @address_read_only = true\n [@address_detail, @address_summary, @address_read_only, @show_manual_address]\n end",
"def to_a\n #convert to array\n [@id, @name, @address, @city, @county, @state, @zip]\n end",
"def from_address\n out = []; @envelope.from_addrs.each{|a| out.push(a.address)}\n return out\n end",
"def parse_dns(dns_raw)\r\n\r\n dns_raw1 = []\r\n len = dns_raw.length-1\r\n i = 0\r\n for r in 0..len do\r\n str1 = dns_raw[r]\r\n if dns_raw[r][0] != '#'\r\n dns_raw1[i] = dns_raw[r]\r\n i = i + 1\r\n end\r\n end\r\n dns_raw = dns_raw1\r\n\r\n b=[]\r\n dns_raw.each do |item|\r\n str = item == \"\\n\"\r\n if !str\r\n b.push(item.split(','))\r\n end\r\n end\r\n\r\n len = b.length-1\r\n dns_records ={}\r\n\r\n for r in 0 .. len do\r\n dkey = {}\r\n dkey[:type] = b[r][0].strip\r\n dkey[:target] = b[r][2].strip.chomp\r\n dns_records[b[r][1].strip] = dkey\r\n end\r\n\r\n return dns_records\r\n end",
"def address_list\n $tracer.trace(format_method(__method__))\n return ProfileAddressList.new(@tag.find.span.className(create_ats_regex_string(\"ats-addrpanel\")), format_method(__method__))\n end",
"def addresses\n collect { |a| a.address }\n end",
"def stmt_retr_all_records(fields, charset)\n check_state :RESULT\n enc = charset.encoding\n begin\n all_recs = []\n until (pkt = read).eof?\n all_recs.push StmtRawRecord.new(pkt, fields, enc)\n end\n all_recs\n ensure\n set_state :READY\n end\n end",
"def records\n # Get to the end of the header\n @fh.seek(20)\n records = []\n while not @fh.eof?\n record = @fh.readpartial(800).unpack(\"Z260VVQVa520\")\n break if @fh.eof?\n records.push({\n :record_number => record[1],\n :filename_ascii => record[0],\n :filename => Iconv.new(\"UTF-8\",\"UTF-16LE\").iconv(record[5]).strip,\n :size => record[4],\n :drive_letter => (record[2]+65).chr,\n :delete_time => Time.at((record[3]/(10**7))-11644473600),\n })\n end\n records\n end",
"def parse_dns(dns_raw)\n dns_records = {}\n dns_raw.each do |line|\n arr = line.split(\", \")\n if(arr[0] == \"A\" || arr[0] == \"CNAME\")\n dns_records[arr[1]] = {:type => arr[0], :target => arr[2].strip}\n end\n end\n \n return dns_records\n end",
"def [] address\n @content[address]\n end",
"def split_address(address)\n ary = address.split(/\\s+/)\n number = ary.shift\n street_type = (ary.pop || '').downcase.to_sym\n street_name = ary.join(' ')\n if StreetTypes::STREET_TYPES.key?(street_type)\n street_type = StreetTypes::STREET_TYPES[street_type]\n end\n [number, street_name.upcase, street_type.to_s.upcase]\n end",
"def buildAddress(addrRaw)\n # Check if first address row contains P O Box substring\n isPoB = addrRaw['s'].include? \"P O Box\"\n location = Array.new\n\n fullLoc = (addrRaw['s'] == \"-\" || isPoB) ? \"\" : \"#{addrRaw['s']}, \"\n partialLoc = (addrRaw['s2'] == \"-\") ? \"\" : \"#{addrRaw['s2']},\" \n partialLoc += (addrRaw['l'] == \"-\") ? \"\" : \"#{addrRaw['l']}, \" \n partialLoc += (addrRaw['r'] == \"-\") ? \"\" : \"#{addrRaw['r']}, \" \n partialLoc += (addrRaw['z'] == \"-\") ? \"\" : \"#{addrRaw['z']}, \" \n partialLoc += (addrRaw['c'] == \"-\") ? \"\" : \"#{addrRaw['c']}\"\n\n fullLoc += partialLoc\n\n # If address does not contain an 'AU', it is added to the end of the address\n if fullLoc != \"\"\n if fullLoc.exclude? \"AU\"\n # Set fullLoc as well as partialLoc in case all address was contained in the first line\n fullLoc += \", AU\"\n partialLoc += \", AU\"\n end\n end\n \n location[0] = fullLoc\n location[1] = partialLoc\n \n return location\n end",
"def parse_dns(raw)\n # Filtering Lines with Comments and Empty Lines\n dns_filter = raw.select {|x| x[0]!= \"#\" && x != \"\\n\" }\n\n # Creating a List with 3 Columns\n dns_filter_list = []\n dns_filter.each {|x| dns_filter_list.push(x.split(\", \"))}\n\n # Creating the List each DNS for Hash\n record_type_list = []\n source_list = []\n destination_list = []\n\n dns_filter_list.each do |x|\n record_type_list.push(x[0])\n source_list.push(x[1])\n destination_list.push(x[2])\n end\n\n # Building the Hash\n dns_hash = {\n \"RECORDTYPE\".to_sym => record_type_list,\n \"SOURCE\".to_sym => source_list,\n \"DESTINATION\".to_sym => destination_list,\n }\n return dns_hash\nend",
"def initialize\n super\n @fbnr074p_records = []\n end",
"def record_ary\n record_plan.to_a.flatten\n end",
"def street_address\n [\n house_number, \n street_predirection, \n street_name, \n street_type, \n street_postdirection, \n unit_type, \n unit_number\n ].compact.delete_if(&:empty?).join(' ')\n end",
"def ird_genbank_entries(seg_num = nil)\n seg_cols = seg_num ? [config[\"ird_strains_cols\"][seg_num]] : config[\"ird_strains_cols\"].drop(1)\n segments = seg_cols.map{ [] }\n ird_strains.each do |ird_strain|\n seg_cols.each_with_index do |col, i|\n ird_strain.send(col.to_sym).gsub(/[*\\s]/, '').split(',').each do |acc|\n segments[i] << GenbankEntry.for_acc(acc)\n end\n end\n end\n seg_num ? segments[0] : segments\n end",
"def records\n @records ||= []\n end",
"def address_array(visibility_limit = visibility)\n return [] if visibility_limit == self.class.no_visibility\n\n start_index = self.class.visibility_items.index { |viz_item| viz_item == visibility_limit }\n return [] unless start_index\n\n viz_items_length = self.class.visibility_items.length\n\n # Create the array with the actual values of the address.\n # Add in the kommun name if there is one for the address.\n if kommun\n ary = [street_address, post_code, city, kommun.name,\n sverige_if_nil][start_index..viz_items_length]\n else\n ary = [street_address, post_code, city,\n sverige_if_nil][start_index..(viz_items_length - 1)]\n end\n ary.delete_if { |f| f.blank? }\n end",
"def parse_dns(dns_raw)\n\tdns_records = {}\n\n\n\tdns_raw.\n\tmap{|line| line.strip }.\n\treject {|line| line.empty?}.\n\treject {|line| line[0] == \"#\" }.\n\n\teach{|line|\n\t\tinfo = line.split \",\"\n\t\tdns_records[info[1].strip] = { :type => info[0].strip, :val => info[2].strip }\n\t}\n\treturn dns_records\nend",
"def addresses\n @addresses\n end",
"def ob_sssr\n @ob.get_sssr.to_a\n end",
"def to_source; \"* = $#{@addr.to_s(16)}\"; end",
"def sospa(location)\n string = location[1..-1]\n col = location[0].to_i\n row = (string.length.to_f / col).floor\n remainder = string.length % col\n address = [[nil]*col]*(row+1)\n\n sizes = [row+1] * remainder + [row] * (col - remainder)\n pos = 0\n sizes.each_with_index { |size, i|\n size.times { |index| address[col * index + i] = string[pos + index] }\n pos += size\n }\n\n address = CGI::unescape(address.join).gsub('^', '0')\n rescue\n raise location\n end",
"def bgnstr_record() @records.get(GRT_BGNSTR); end",
"def read_records(table)\n hashes = []\n each(table) {|hash| hashes << hash}\n hashes\n end",
"def parse_dns(raw)\n # Filtering Lines with Comments and Empty Lines\n dns_filter = raw.select { |x| x[0] != \"#\" && x != \"\\n\" }\n\n # Creating a List with 3 Columns\n dns_filter_list = []\n dns_filter.each { |x| dns_filter_list.push(x.split(\", \")) }\n\n # Creating the List each DNS for Hash\n record_type_list = []\n source_list = []\n destination_list = []\n\n dns_filter_list.each do |x|\n record_type_list.push(x[0])\n source_list.push(x[1])\n destination_list.push(x[2])\n end\n\n # Building the Hash\n dns_hash = {\n \"RECORDTYPE\".to_sym => record_type_list,\n \"SOURCE\".to_sym => source_list,\n \"DESTINATION\".to_sym => destination_list,\n }\n return dns_hash\nend",
"def addresses_table\n data = []\n\n @record.addresses.each_slice(4) do |slice|\n data << slice.map do |address|\n \"#{address.address}\\n\\n#{address.country.try(:to_s)}\"\n end\n end\n\n table data do |table|\n table.row_colors = ['ffffff']\n table.columns(0..3).width = table.width / data.first.length\n table.cells.padding_bottom = 30\n end\n end",
"def lines\n address = format.apply(formatting_values)\n lines = address.split(\"\\n\").reject {|line| line.strip.empty? }\n lines << country_name.upcase\n end",
"def grab_all_sins(string)\n # TODO how do we >> strings into the array, but not just one. \n # we need all the possible iterations of regex \n string.scan(SIN_NUMBER) \nend",
"def fs_contact_addresses_array\n pre_format = fscontact.blank? ? evaluator : fscontact\n return [] if pre_format.nil?\n\n pre_format.split(',').map do |a|\n (a =~ /@/ ) ? a : a + '@' + SCs[:standard_mail_domain]\n end\n end",
"def from_zonefile_records\n @records = @merged_zf_records.map do |key, zf_records|\n ttl = ttl_from_zonefile_records zf_records\n data = zf_records.map do |zf_record|\n data_from_zonefile_record key[1], zf_record\n end\n @zone.record key[0], key[1], ttl, data\n end\n end",
"def full_host_record(ip:)\n load_cnames\n \n @forward_host_record ||= {} # Global, as we want to do name lookups.\n return_record = []\n unless( (host_records = @infoblox.get_host_by_ip(ip_address: ip)).nil? )\n host_records.each do |hosts|\n hosts.each do |hn|\n # Assign an empty record, if we haven't seen this host before\n @forward_host_record[hn] ||= { hostname: hn, ip: '', aliases: [], cnames: [] }\n \n # Record the IP. There may be multiple IPs with one hostname.\n @forward_host_record[hn][:ip] = ip\n \n # The hostname might have CNAMES point to it\n unless @reverse_cnames[hn].nil?\n @reverse_cnames[hn].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n \n # The hostname may have alternate hostname A records, stored in IPAM as ALIASES\n @infoblox.get_alias(hostname: hn) do |a| \n short_alias = a.split('.',2)[0]\n @forward_host_record[hn][:aliases] << short_alias\n \n # The ALIASes might have CNAME records pointing to it\n unless @reverse_cnames[a].nil?\n # Record the ALIAS CNAMES against the parent hostname.\n @reverse_cnames[a].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n end\n return_record << @forward_host_record[hn]\n \n # Add forward lookup entries for each ALIAS\n host_domain = hn.split('.',2)[1]\n @forward_host_record[hn][:aliases].each do |a|\n @forward_host_record[\"#{a}.#{host_domain}\"] = @forward_host_record[hn]\n end\n \n # Add forward lookup entries for each CNAME\n @forward_host_record[hn][:cnames].each do |cn|\n @forward_host_record[cn] = @forward_host_record[hn]\n end\n \n end\n end\n end\n return return_record\nend",
"def gets_buffer_s(*a)\n @device.buffer.map { |msg| msg[:data] = TypeConversion.numeric_byte_array_to_hex_string(msg[:data]); msg }\n end",
"def parse_data(buffer)\n @zipcode_dump = []\n buffer.each_line do |row|\n @zipcode_dump << JSON.parse(row)\n end\n @zipcode_dump\nend",
"def get_address(tds)\n return clean_whitespace(tds[2].at('span').inner_text + \", NSW\")\nend",
"def get_address(tds)\n return clean_whitespace(tds[2].at('span').inner_text + \", NSW\")\nend",
"def address_lines(join_chars = ', ')\n address_lines_array.join(join_chars)\n end",
"def address_lines(join_chars = ', ')\n address_lines_array.join(join_chars)\n end",
"def get_record(hosted_zone, record_name, record_type='A')\n\n #record_type = options.fetch(\"record_type\", 'A')\n records = AwsPocketknife::Route53.get_record(hosted_zone_name: hosted_zone,\n record_name:record_name,\n record_type: record_type)\n headers = [\"Name\", \"Type\", \"DNS Name\"]\n data = []\n if records.length > 0\n records.each do |record|\n if record.type == 'CNAME'\n data << [record.name, record.type, record.resource_records[0].value]\n else\n data << [record.name, record.type, record.alias_target.dns_name]\n end\n end\n AwsPocketknife::Route53.pretty_table(headers: headers, data: data)\n else\n puts \"Record #{record_name} not found in hosted zone #{hosted_zone}\"\n end\n end",
"def each_address\n (@addr..broadcast).each do |addr|\n yield _to_string(addr)\n end\n end",
"def find_st_address\n matched = StreetAddress.where(\"address ILIKE ?\", \"%#{self.address}%\")\n\n return matched.first if matched.count == 1\n\n # This should not happen when verify_address is written\n if matched.count == 0\n # matched = create_st_address\n return nil\n else\n return nil\n # We somehow...have the same street address more than once D=\n # This should never happen\n end\n\n return matched\n end",
"def address(first_recycle_bin)\n puts first_recycle_bin[\"address\"]\nend",
"def addresses\n @addresses ||= init_addresses\n end",
"def sanitize_data(records)\n records\n end",
"def search_record\n [\n name,\n full_name,\n full_name,\n '',\n path,\n '',\n snippet(@comment_location),\n ]\n end",
"def to_flat_a\n addr = self.addr\n addr[0, addr.size].unpack(\"F*\")\n end"
] | [
"0.549314",
"0.5349734",
"0.53302795",
"0.5318069",
"0.5182119",
"0.5142609",
"0.51148087",
"0.50625414",
"0.50619715",
"0.50290227",
"0.5026357",
"0.4987581",
"0.4980323",
"0.49603248",
"0.49258032",
"0.4924828",
"0.49219352",
"0.4897368",
"0.4884585",
"0.4884136",
"0.48814803",
"0.4867884",
"0.48652261",
"0.4838036",
"0.48292622",
"0.48102883",
"0.4809659",
"0.48095205",
"0.47819883",
"0.47757682",
"0.4762753",
"0.47503352",
"0.475019",
"0.47470456",
"0.4741598",
"0.47346503",
"0.47243765",
"0.4708158",
"0.47062266",
"0.46990415",
"0.46953258",
"0.46856683",
"0.4683733",
"0.4672249",
"0.4670236",
"0.46685988",
"0.46558964",
"0.46525657",
"0.4650132",
"0.4650132",
"0.46484244",
"0.46457115",
"0.46242517",
"0.4615204",
"0.4615172",
"0.461487",
"0.46104008",
"0.46102566",
"0.4606566",
"0.4602614",
"0.46011928",
"0.45964253",
"0.45929018",
"0.45908937",
"0.45899534",
"0.45888513",
"0.45851913",
"0.4584478",
"0.4584305",
"0.45729282",
"0.4569926",
"0.4540521",
"0.4537937",
"0.45331404",
"0.45318726",
"0.45206353",
"0.45191726",
"0.45168108",
"0.45149362",
"0.45098385",
"0.4509165",
"0.45053017",
"0.45044357",
"0.44781715",
"0.44696787",
"0.44682196",
"0.44473264",
"0.4440923",
"0.4439591",
"0.4439591",
"0.44355583",
"0.44355583",
"0.44347063",
"0.44285247",
"0.4424921",
"0.44233835",
"0.44195068",
"0.44158137",
"0.44155532",
"0.44099408"
] | 0.6509779 | 0 |
nested array of winning key combinations | def initialize
@squares = {} # call it @squares since a Board will be composed of squares with individual states
reset # RESET METHOD INSERTS A HASH INTO @square
# want to set it to an Square object with marker attribute / value of INITIAL_MARKER, instead of just directly setting it to INITIAL_MARKER.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winning_combos\n [[0, 1, 2], [3, 4, 5], [6, 7, 8],\n [0, 3, 6], [1, 4, 7], [2, 5, 8],\n [0, 4, 8], [2, 4, 6]]\n end",
"def win_combos \n row_wins = @board.map { |x| x - 1 }.each_slice(@n).to_a\n column_wins = @columns.flatten.map { |x| x - 1 }.each_slice(@n).to_a \n diagonal_wins = @diagonals.flatten.map { |x| x - 1 }.each_slice(@n).to_a \n win_combos = row_wins + column_wins + diagonal_wins\n end",
"def win_possibilities(piece)\n\t\t[ [ [piece[0],piece[1]],[piece[0]+1,piece[1]],[piece[0]+2,piece[1]],[piece[0]+3,piece[1]] ],\n\t\t[ [piece[0]-1,piece[1]],[piece[0],piece[1]],[piece[0]+1,piece[1]],[piece[0]+2,piece[1]] ],\n\t\t[ [piece[0]-2,piece[1]],[piece[0]-1,piece[1]],[piece[0],piece[1]],[piece[0]+1,piece[1]] ],\n\t\t[ [piece[0]-3,piece[1]],[piece[0]-2,piece[1]],[piece[0]-1,piece[1]],[piece[0],piece[1]] ],\n\t\t[ [piece[0],piece[1]],[piece[0],piece[1]+1],[piece[0],piece[1]+2],[piece[0],piece[1]+3] ],\n\t\t[ [piece[0],piece[1]-1],[piece[0],piece[1]],[piece[0],piece[1]+1],[piece[0],piece[1]+2] ],\n\t\t[ [piece[0],piece[1]-2],[piece[0],piece[1]-1],[piece[0],piece[1]],[piece[0],piece[1]+1] ],\n\t\t[ [piece[0],piece[1]-3],[piece[0],piece[1]-2],[piece[0],piece[1]-1],[piece[0],piece[1]] ],\n\t\t[ [piece[0],piece[1]],[piece[0]+1,piece[1]+1],[piece[0]+2,piece[1]+2],[piece[0]+3,piece[1]+3] ],\n\t\t[ [piece[0]-1,piece[1]-1],[piece[0],piece[1]],[piece[0]+1,piece[1]+1],[piece[0]+2,piece[1]+2] ],\n\t\t[ [piece[0]-2,piece[1]-2],[piece[0]-1,piece[1]-1],[piece[0],piece[1]],[piece[0]+1,piece[1]+1] ],\n\t\t[ [piece[0]-3,piece[1]-3],[piece[0]-2,piece[1]-2],[piece[0]-1,piece[1]-1],[piece[0],piece[1]] ],\n\t\t[ [piece[0],piece[1]],[piece[0]+1,piece[1]-1],[piece[0]+2,piece[1]-2],[piece[0]+3,piece[1]-3] ],\n\t\t[ [piece[0]-1,piece[1]+1],[piece[0],piece[1]],[piece[0]+1,piece[1]-1],[piece[0]+2,piece[1]-2] ],\n\t\t[ [piece[0]-2,piece[1]+2],[piece[0]-1,piece[1]+1],[piece[0],piece[1]],[piece[0]+1,piece[1]-1] ],\n\t\t[ [piece[0]-3,piece[1]+3],[piece[0]-2,piece[1]+2],[piece[0]-1,piece[1]+1],[piece[0],piece[1]] ] ]\n\tend",
"def winning_possibilities(b) # possible rows, columns, and diagonals for a win\n [\n [b[0], b[1], b[2]], # top row\n [b[3], b[4], b[5]], # middle row\n [b[6], b[7], b[8]], # bottom row\n [b[0], b[3], b[6]], # left column\n [b[1], b[4], b[7]], # middle column\n [b[2], b[5], b[8]], # right column\n [b[0], b[4], b[8]], # top left to bottom right diagonal\n [b[2], b[4], b[6]] # top right to bottom left diagonal\n ]\n end",
"def winner_comb\n $the_win_comb = { flash_straight: flash_straight, for_of_kind: four_of_kind, full_house: full_house,\n flush: flush, straight: straight, three: three, two_pair: two_pair,\n one_pair: one_pair, high_card: high_card }\n end",
"def find_winning_combinations(board,player,opponent)\n Game::WIN_COMBINATIONS.reject do | combo |\n combo.count { | position | board.cells[position]==opponent } > 0\n end\n end",
"def won?(board)\r\n sam_ex = []\r\n sam_oh = []\r\n i = 0\r\n board.each do |index|\r\n if index == \"X\"\r\n sam_ex.push(i)\r\n elsif index == \"O\"\r\n sam_oh.push(i)\r\n end\r\n i+=1\r\n end\r\n WIN_COMBINATIONS.each do |combination|\r\n if combination&sam_oh == combination || combination&sam_ex ==combination\r\n return combination\r\n end\r\n end\r\n nil\r\nend",
"def win_test\n \t# Create a hash from entries where the value matches player @letter\n\tpositions_hash = $board.select { |key, value| value == @letter }\n\t# Now make an array of the key values. We will compare this against \n\t# the winning_combos\n\tpositions_array = positions_hash.keys\n\t\t# Did the current move win the game?\n\t\t$winning_combos.each { \n\t\t\t|x| if x == positions_array\n\t\t\t\tputs \"#{@name} WINS!\"\n\t\t\t\t$game_end = true\n\t\t\t\treturn\n\t\t\t\tend\n\t\t\t}\n\nend",
"def computer_winning_lines(board)\n winning_combos = []\n WINNING_LINES.collect do |combo|\n winning_combos << combo if board.values_at(*combo).count('x') == 0\n end\n winning_combos\nend",
"def won?\ntokens = [\"X\", \"O\"]\nwon = false\n@x_win = false\n@o_win = false\nwinning_combo = []\n\nWIN_COMBINATIONS.each do |combination|\n @x_win = combination.all?{|index| @board[index] == tokens[0]} if true\n @o_win = combination.all?{|index| @board[index] == tokens[1]} if true\n if @x_win || @o_win\n won = true\n winning_combo = combination\n end\nend\n\nif won #what should we return\n winning_combo\nelse\n false\nend\nend",
"def won?(board)\n WIN_COMBINATIONS.each do |win_index| #interates thru list of win combinations array\n\n x_win = win_index.all? do |spot| #interates thru individual win array\n\n board[spot] == \"X\"\n\n end\n\n o_win = win_index.all? do |spot|\n\n board[spot] == \"O\"\n\n end\n\n if x_win || o_win\n\n return win_index\n\n end\n end\n else\n return false\nend",
"def get_games_winners\n tally = all_player_tally #tally is a hash with the combination of scores between all players\n winner_tally = hash_select_by_max_key(tally)\n return convert_hash_keys_to_array(winner_tally)\n end",
"def possibilities(words = {})\n words.reduce(Hash.new([])) do |combos, (k,v)|\n 1.upto(v.length) do |i|\n combos[k] += v.combination(i).to_a.map {|combo| combo.sort }\n end\n combos[k].sort!\n combos\n end\nend",
"def won?(board)\n if board == [\" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \", \" \"]\n return false\n end\n\n#counting so we don't return false until we have looked at all of the combinations.\ncount = 0\n\n WIN_COMBINATIONS.each do |combo|\n count = count + 1\n if board[combo[0]] == \"X\" && board[combo[1]] == \"X\" && board[combo[2]] == \"X\"\n return combo\n elsif board[combo[0]] == \"O\" && board[combo[1]] == \"O\" && board[combo[2]] == \"O\"\n return combo\n elsif count == 8\n return false\n end\n end\nend",
"def test_filter_key_combos\n expected = [['49', '96', '62', '23']]\n assert_equal expected, @cracker.filter_key_combos([22, 15, 8, 23])\n\n expected = [['48', '81', '13', '36'], ['75', '54', '40', '09']]\n assert_equal expected, @cracker.filter_key_combos([21, 0, 13, 9])\n end",
"def win (player)\n wins = [[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]\n wins.each do |w|\n temp = player.picked & w # \"&\" compares and returns same values '[1,2,3] & [1,2,5,6] #=> [1, 2]''\n temp.length == 3 ? (return true) : false\n end\n end",
"def skittle_combos(skittles)\n skittles.combination(2).map(&:sort).uniq\nend",
"def won?(board)\n # Checks all tiles in board and tracks the indexes where Xs and Os are\n x_indexes, o_indexes = [], []\n index = 0\nuntil index == 9\nboard[index] == \"X\" ? x_indexes.push(index) : (board[index] == \"O\" ? (o_indexes.push(index)) : ())\nindex += 1\n end\n\n# Checks each win_combination and selects the X or O indexes which match any of the win_combination indexes\n# If the matches include a win_combination, that combination is returned, otherwise false is returned.\n WIN_COMBINATIONS.each { |win_combination|\n x_indexes.select {|idx| win_combination.include?(idx)} == win_combination || o_indexes.select {|idx| win_combination.include?(idx)} == win_combination ? (return win_combination) : ()\n }\nreturn false\n\nend",
"def winning_play\n {paper: [:rock, :spock], rock: [:lizard, :scissors], scissors: [:paper, :lizard], lizard: [:spock, :paper], spock: [:rock, :scissors], scratch: [:scratch]}\n end",
"def win\n table_keys = @board.boardcase.values\n if @board.boardcase[\"a1\"].shape == @board.boardcase[\"a2\"].shape && @board.boardcase[\"a3\"].shape == \"x\" && @board.boardcase[\"a2\"].shape == \"x\" ||\n @board.boardcase[\"a1\"].shape == @board.boardcase[\"b1\"].shape && @board.boardcase[\"c1\"].shape == \"x\" && @board.boardcase[\"b1\"].shape == \"x\" ||\n @board.boardcase[\"a2\"].shape == @board.boardcase[\"b2\"].shape && @board.boardcase[\"c2\"].shape == \"x\" && @board.boardcase[\"b2\"].shape == \"x\" ||\n @board.boardcase[\"a3\"].shape == @board.boardcase[\"b3\"].shape && @board.boardcase[\"c3\"].shape == \"x\" && @board.boardcase[\"b3\"].shape == \"x\" ||\n @board.boardcase[\"b1\"].shape == @board.boardcase[\"b2\"].shape && @board.boardcase[\"b3\"].shape == \"x\" && @board.boardcase[\"b2\"].shape == \"x\" ||\n @board.boardcase[\"c1\"].shape == @board.boardcase[\"c2\"].shape && @board.boardcase[\"c3\"].shape == \"x\" && @board.boardcase[\"c2\"].shape == \"x\" ||\n @board.boardcase[\"a1\"].shape == @board.boardcase[\"b2\"].shape && @board.boardcase[\"c3\"].shape == \"x\" && @board.boardcase[\"b2\"].shape == \"x\" ||\n @board.boardcase[\"a3\"].shape == @board.boardcase[\"b2\"].shape && @board.boardcase[\"c1\"].shape == \"x\" && @board.boardcase[\"b2\"].shape == \"x\"\n puts \"#{@player_1.name} Won!\"\n return true\n elsif\n @board.boardcase[\"a1\"].shape == @board.boardcase[\"a2\"].shape && @board.boardcase[\"a3\"].shape == \"o\" && @board.boardcase[\"a2\"].shape == \"o\" ||\n @board.boardcase[\"a1\"].shape == @board.boardcase[\"b1\"].shape && @board.boardcase[\"c1\"].shape == \"o\" && @board.boardcase[\"b1\"].shape == \"o\" ||\n @board.boardcase[\"a2\"].shape == @board.boardcase[\"b2\"].shape && @board.boardcase[\"c2\"].shape == \"o\" && @board.boardcase[\"b2\"].shape == \"o\" ||\n @board.boardcase[\"a3\"].shape == @board.boardcase[\"b3\"].shape && @board.boardcase[\"c3\"].shape == \"o\" && @board.boardcase[\"b3\"].shape == \"o\" ||\n @board.boardcase[\"b1\"].shape == @board.boardcase[\"b2\"].shape && @board.boardcase[\"b3\"].shape == \"o\" && @board.boardcase[\"b2\"].shape == \"o\" ||\n @board.boardcase[\"c1\"].shape == @board.boardcase[\"c2\"].shape && @board.boardcase[\"c3\"].shape == \"o\" && @board.boardcase[\"c2\"].shape == \"o\" ||\n @board.boardcase[\"a1\"].shape == @board.boardcase[\"b2\"].shape && @board.boardcase[\"c3\"].shape == \"o\" && @board.boardcase[\"b2\"].shape == \"o\" ||\n @board.boardcase[\"a3\"].shape == @board.boardcase[\"b2\"].shape && @board.boardcase[\"c1\"].shape == \"o\" && @board.boardcase[\"b2\"].shape == \"o\"\n puts \"#{@player_2.name} Won!\"\n return true\nelse\n i = 0\n table_keys.each do |u|\n if u.shape != \" \"\n i += 1\n end\n end\n if i == 9\n puts \"It's a Draw!\"\n return true\n end\n end\nend",
"def find_available_combinations(board, token)\n if token == self.token\n valid_and_made_moves = self.find_available_moves(board) + self.find_moves_made(board, self.token)\n Game::WIN_COMBINATIONS.select do |combo|\n (valid_and_made_moves & combo).count > 2\n end\n else\n valid_and_made_moves = self.find_available_moves(board) + self.find_moves_made(board, self.opponent.token)\n Game::WIN_COMBINATIONS.select do |combo|\n (valid_and_made_moves & combo).count > 2\n end\n end\n end",
"def check_for_winner\n #define what wins the game\n win_combinations = [ [0,3,6], [0,4,8], [0,1,2], [1,4,7], [2,4,6], [2,5,8], [3,4,5], [6,7,8] ]\n #if sym fills any of these combos of 3, that player wins else, game is tie..play again?\n for i in 0..7\n win_combinations.each do |x| \n if (@board[x[0]] == @board[x[1]] && @board[x[0]] == @board[x[2]] && @board[x[0]] != \"\" && @board[x[1]] != \"\" && @board[x[2]] != \"\")\n if @board[x[0]] == PLAYER1_SYM\n puts \"Player 1 Wins!!!!!!\"\n else\n puts \"Player 2 Wins!!!!!!\"\n end\n generate_board\n abort(\"game over\")\n elsif unless @board.include? \"\" #check for tie once board is ful\n abort(\"Game is a tie\")\n end\n else\n end\n end\n end\n end",
"def won?(board)\n res = false\n WIN_COMBINATIONS.each do |win_combination|\n board_entries = [board[win_combination[0]], board[win_combination[1]], board[win_combination[2]]]\n board_entries == [\"X\", \"X\", \"X\"] || board_entries == [\"O\", \"O\", \"O\"] ? res = win_combination : false\n end\n res\n\nend",
"def combinations(board)\n winner = false\n \n rows(board).each do |row|\n next unless row.all?(X_TOKEN) || row.all?(O_TOKEN)\n \n winner = row\n end\n \n cols(board).each do |col|\n next unless col.all?(X_TOKEN) || col.all?(O_TOKEN)\n \n winner = col\n end\n \n diagonals(board).each do |diag|\n next unless diag.all?(X_TOKEN) || diag.all?(O_TOKEN)\n \n winner = diag\n end\n \n winner\n end",
"def forking_moves(board, key)\n forking_moves =[]\n\n (0..2).each do |y|\n (0..2).each do |x|\n if board[y][x] == :_\n mutated_board = Marshal.load(Marshal.dump(board))\n mutated_board[y][x] = key\n mutated_winning_moves = winning_moves(mutated_board, key).uniq\n if mutated_winning_moves.count > 1\n forking_moves << mutated_winning_moves\n end\n end\n end\n end\n\n forking_moves.flatten\n \n end",
"def won?(board)\n # for each win_combo in WIN_COMBINATIONS\n WIN_COMBINATIONS.each do |win_combo|\n # win_combination is a 3 element array of indexes that compose a win, eg. [0,1,2]\n # grab each index from the win_combo that composes a win.\n win_index_1 = win_combo[0]\n win_index_2 = win_combo[1]\n win_index_3 = win_combo[2]\n # If/else that declares a winner if all three spots in a winning array have\n # either an \"X\" or an \"O\", respectively.\n if board[win_index_1] == \"X\" && board[win_index_2] == \"X\" && board[win_index_3] == \"X\"\n return win_combo\n elsif board[win_index_1] == \"O\" && board[win_index_2] == \"O\" && board[win_index_3] == \"O\"\n return win_combo\n end\n end\n return false\nend",
"def player_moves(board)\n\t\tnew_hash_o = {} # Holds the winning combination positions the other player is occupying\n\t\tnew_hash_c = {} # Holds the winning combination positions the current player is occupying\n\t\tfinal_hash_o = {} # Holds the other player winning combination that need to be blocked on the next move\n\t\tfinal_hash_c = {} # Holds the move to be made for the current player winning combination\n\t\tWIN_COMBINATIONS.each do |k,v| # Check which of the other player's and current player's positions are part of a winning combination\n\t\t new_hash_o[k] = []\n\t\t new_hash_c[k] = []\n\t\t @other_player_positions.each do |t| # Check which of the other player's positions are part of a winning combination\n\t\t\t if v.include?(t)\n\t\t\t \tnew_hash_o[k] << t # If the position is part of a winning combination include it in the new hash\n\t\t \tend\n\t\t end\n\t\t @current_player_positions.each do |t| # Check which of the current player's positions are part of a winning combination\n\t\t\t if v.include?(t)\n\t\t\t \tnew_hash_c[k] << t # If the position is part of a winning combination include it in the new hash\n\t\t \tend\n\t\t end\n\t\tend\n\t\t@other_player_positions = [] # Clear the other player position results ready for the next turn\n\t\t@current_player_positions = [] # Clear the current player position results ready for the next turn\n\t\tnew_hash_o.each do |k,v| # Check whether the other player has one move to go on a winning combination\n\t\t\t# If there are two positions of a winning combination held by the other player include the combination in the final hash\n\t\t\tif new_hash_o[k].size > 1\n\t\t\t\tfinal_hash_o[k] = new_hash_o[k] # Final hash holds the vulnerable positions that need to be filled\n\t\t\tend\n\t\tend\n\t\tnew_hash_c.each do |k,v| # Check whether the current player has one move to go on a winning combination\n\t\t\t# If there are two positions of a winning combination held by the current player include the combination in the final hash\n\t\t\tif new_hash_c[k].size > 1\n\t\t\t\tfinal_hash_c[k] = new_hash_c[k] # Final hash holds the winning positions that need to be filled\n\t\t\tend\n\t\tend\n\t\t# Find the final position to move to block the other player's winning combination\n\t\t # Find the final position for current player to move to win\n\t\tWIN_COMBINATIONS.each do |k,v|\n\t\t\tif final_hash_o.include?(k)\n\t\t\t\t@move_o << WIN_COMBINATIONS[k] - final_hash_o[k]\n\t\t\t\tif !board.valid_move?(@move_o[0][0]) # Check whether the final position is a valid move\n\t\t\t\t\t@move_o.shift # If not a valid position remove the final move\n\t\t\t\tend\n\t\t\tend\n\t\t\tif final_hash_c.include?(k)\n\t\t\t\t@move_c << WIN_COMBINATIONS[k] - final_hash_c[k]\n\t\t\t\tif !board.valid_move?(@move_c[0][0]) # Check whether the final position is a valid move\n\t\t\t\t\t@move_c.shift # If not a valid position remove the final move from the array\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tif !@move_o.empty? # Don't test and pass an empty array\n\t\t\t\t@move_o = @move_o.sample # Only one move can be made\n\t\t\t\t@move_o # Final move to block the other player's winning combination\n\t\tend\n\t\tif !@move_c.empty? # Don't test and pass an empty array\n\t\t\t\t@move_c = @move_c.sample # Only one move can be made\n\t\t\t\t@move_c # Final move to block the other player's winning combination\n\t\tend\n\tend",
"def possible_any_win # => winning combo\n opponent_token = self.token == \"X\" ? \"O\" : \"X\"\n Game.win_combos.find { |combo|\n tokens = combo.map {|spot| token_at(spot)}\n (tokens.count{|s| s==\"X\" }==2 || tokens.count{|s| s==\"O\"}==2) &&\n open_spot(combo)\n }\n end",
"def won?(board)\n\n win_array = []\n WIN_COMBINATIONS.any? do |win_combination|\n if win_combination.all? {|win_index| board[win_index] == 'X'} || win_combination.all? {|win_index| board[win_index] == 'O'}\n return win_combination\n end\n end\nend",
"def won?\nfor sub_array in WIN_COMBINATIONS do\nindex_1 = sub_array[0]\nindex_2 = sub_array[1]\nindex_3 = sub_array[2]\n\nboard_index_1 = @board[index_1]\nboard_index_2 = @board[index_2]\nboard_index_3 = @board[index_3]\n\n if (board_index_1 == \"X\" && board_index_2 == \"X\" && board_index_3 == \"X\") || (board_index_1 == \"O\" && board_index_2 == \"O\" && board_index_3 == \"O\") \n return sub_array\nend\nend\nfalse\nend",
"def check_for_win(game)\n return nil if game.turns.size < 5 \n\n xs = game.turns.where(mark: 'X').map {|turn| turn.board_index }\n os = game.turns.where(mark: 'O').map {|turn| turn.board_index }\n\n @@win_conditions.each do |win|\n # Check if xs or os contain indices combo that meet win condition\n if (win-xs).empty?\n return [\"X\", win.join(' ')]\n elsif (win-os).empty?\n return [\"O\",win.join(' ')]\n end\n end\n\n if game.turns.size > 8\n return [\"TIE\",\"\"]\n else\n return nil\n end\n end",
"def two_in_a_row?(player)\n winning_indexes = []\n existing_indexes = game.board.cells.each_index.select{ |i| game.board.cells[i] == player.token}\n empty_indexes = $empty_positions.to_a.map!{|i| i - 1}\n empty_indexes.each{|test_index|\n existing_indexes << test_index\n test_combos = existing_indexes.permutation(3).to_a\n existing_indexes.pop\n winning_combos = []\n Game::WIN_COMBINATIONS.each{ |win_combo|\n test_combos.include?(win_combo) ? winning_combos << win_combo : false}\n winning_combos.count > 0 ? winning_indexes << test_index : false\n }\n\n return winning_indexes\n end",
"def won? # shows winning combination\n WIN_COMBINATIONS.detect do |win_combo|\n if (@board[win_combo[0]]) == \"X\" && (@board[win_combo[1]]) == \"X\" && (@board[win_combo[2]]) == \"X\"\n return win_combo\n elsif (@board[win_combo[0]]) == \"O\" && (@board[win_combo[1]]) == \"O\" && (@board[win_combo[2]]) == \"O\"\n return win_combo\n end\n false\n end\nend",
"def winner_check(b)\n # player = \"player\"\n # computer = \"computer\"\n win_trio = [ [1,2,3], [4,5,6], [7,8,9], [1,4,7], [2,5,8], [3,6,9], [1,5,9], [3,5,7]]\n win_player = b.select { |k, val| val == \"X\"}.keys \n win_computer = b.select { |k, val| val == \"0\"}.keys\n win_trio.each do |trio|\n return \"Player\" if b.values_at(*trio).count('X') == 3\n return \"Computer\" if b.values_at(*trio).count('0') == 3\n end\n nil\nend",
"def winner(board)\nif winning_combination = won?(board)\nboard[winning_combination[0]]\nend\nend",
"def combinations(arr)\n pairs = [] # this is 1d\n\n arr.each_with_index do |ele1, idx1| # compare this element to others in the array via a nested loop\n arr.each_with_index do |ele2, idx2|\n if idx2 > idx1 # make sure only looking at new things\n pairs << [ele1, ele2] # shovel array into pairs\n end\n end \n end\n\n return pairs # will be a 2d array by now\n\nend",
"def won?(board)\n win_combo = nil\n WIN_COMBINATIONS.each do |win_combination|\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n\n token1 = board[win_combination[0]]\n token2 = board[win_combination[1]]\n token3 = board[win_combination[2]]\n\n if token1 == \"X\" && token2 == \"X\" && token3 == \"X\"\n win_combo = win_combination\n elsif token1 == \"O\" && token2 == \"O\" && token3 == \"O\"\n win_combo = win_combination\n end\n end\n win_combo\nend",
"def won?(board)\n WIN_COMBINATIONS.each do | winning_combination |\n if board[winning_combination[0]] == \"X\" &&\n board[winning_combination[1]] == \"X\" &&\n board[winning_combination[2]] == \"X\" ||\n board[winning_combination[0]] == \"O\" &&\n board[winning_combination[1]] == \"O\" &&\n board[winning_combination[2]] == \"O\"\n return winning_combination\n end\n end\n false\nend",
"def won?(board) \n winning_array = []\n\n WIN_COMBINATIONS.each do |combo|\n board_values = []\n combo.each do |position_value|\n board_values.push(board[position_value]) \n #puts \"the current board value is #{board_values}\" \n end\n if board_values.all?{|values| values == \"X\" }|| board_values.all?{|values| values == \"O\"}\n winning_array = combo\n end\n end\n \n if winning_array == [] && full?(board) == true\n winning_array = false\n end\n\n if board.all?{|values| values == \" \" }|| board.all?{|values| values == \"\"}\n winning_array = false\n end\n\n winning_array \n\nend",
"def win?\n win=[false,false] #[player1,player2]\n @y.times do |y|\n \t#Winning Conditions\n if @board[y][0...@x].all? {|x| x==\"X\"} # Rows\n \t win=[true,false]\n \telsif @board[y][0...@x].all? {|x| x==\"O\"}\n \t win=[false,true]\n \telsif #Diagonals (Currently limited to 3x3)\n \t if @board[0][0] == \"X\" && @board[1][1] == \"X\" && @board[2][2] == \"X\" \n \t win=[true,false]\n \t elsif @board[0][2] == \"X\" && @board[1][1] == \"X\" && @board[2][0] == \"X\"\n \t win=[true,false]\n \t elsif @board[0][0] == \"O\" && @board[1][1] == \"O\" && @board[2][2] == \"O\"\n \t win=[false,true]\n \t elsif @board[0][2] == \"O\" && @board[1][1] == \"O\" && @board[2][0] == \"O\"\n \t win=[false,true]\n \t end\n \tend\n end\n \t\n\n @x.times do |x|\n if @board[0][x] == \"X\" && @board[1][x] == \"X\" && @board[2][x] == \"X\" #Columns\n \t win=[true,false]\n \telsif @board[0][x] == \"O\" && @board[1][x] == \"O\" && @board[2][x] == \"O\" \n \t win=[false,true]\n \tend\n end\n \t \t\n \n \n return win\n end",
"def won?\n\n WIN_COMBINATIONS.each do |win_combination|\n # win_combination is a 3 element array of indexes that compose a win, [0,1,2]\n # grab each index from the win_combination that composes a win.\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n\n position_1 = @board.cells[win_index_1] # load the value of the board at win_index_1\n position_2 = @board.cells[win_index_2] # load the value of the board at win_index_2\n position_3 = @board.cells[win_index_3] # load the value of the board at win_index_3\n\n if position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\"\n return win_combination # return the win_combination indexes that won.\n elsif position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\"\n return win_combination\n end\n end\n false\n end",
"def won?(board)\nWIN_COMBINATIONS.each do |combination|\n combination.all? do |occupied|\n if position_taken?(board, occupied) == true\n if board[combination[0]] == board[combination[1]] && board[combination[0]] == board[combination[2]]\n return combination\n end\n end\n end\nend\n return false\nend",
"def winner(array)\n\n win_x_combo = nil\n win_o_combo = nil\n xs = []\n os = []\n\n def x_extractor_helper(array, index) \n array.select.with_index.select do |j, index| \n j == \"X\" || j == \" X \"\n end\n end\n\n def o_extractor_helper(array, index) \n array.select.with_index.select do |j, index| #// or each_with_index\n j == \"O\" || j == \" O \"\n end\n end\n\n def array_dividing_helper_method(array) # need to go a level deeper in array to access [\"a\", 1] ?!\n output_array = []\n array.each do | index0 |\n output_array << index0[1] # need output_array to be local variable??! \n end \n #end # OLD ending to array_dividing_helper_method\n return output_array\n end # ends array_dividing_helper_method\n\n\n xs = array_dividing_helper_method(x_extractor_helper(array, array))\n os = array_dividing_helper_method(o_extractor_helper(array, array))\n\n WIN_COMBINATIONS.each do |combo|\n #os.all? # Instead, try \"os contains WIN_COMBINATIONS[i][0] and WIN_COMBINATIONS[i][1] and [i][2] \"\n if ( ( xs.include?(combo[0]) ) && ( xs.include?(combo[1]) ) ) # was win_x_combo, not xs\n if ( xs.include?(combo[2]) )\n #puts \"Winning X Combo is #{combo} \"\n win_x_combo = combo\n #return combo\n else puts \"No x Win Combination. current combo is #{combo}\"\n end\n end\n end\n \n WIN_COMBINATIONS.each do |combo|\n if ( ( os.include?(combo[0]) ) && ( os.include?(combo[1]) ) ) \n if ( os.include?(combo[2]) )\n #puts \"Winning O Combo is #{combo} \"\n win_o_combo = combo\n #return combo\n #else puts \"No o Win Combination\"\n end\n end\n end \n\n\n if ( win_x_combo != nil )\n puts \" X Won!\"\n return \"X\"\n end\n\n if ( win_o_combo != nil )\n puts \" O Won!\"\n return \"O\"\n else puts (\"No winner\") and\n return nil\n end\n\n\nend",
"def won?(board_array)\n winning_combo = nil\n #create a varibale to store code to check if board is empty\n empty_or_not = board_array.all? do |index|\n index == \" \"\n end\n #checks to see of board is empty or not\n if empty_or_not\n return false\n else\n #logic to check for a winning combination\n WIN_COMBINATIONS.each do |combo|\n if board_array[combo[0]] == \"X\" && board_array[combo[1]] == \"X\" && board_array[combo[2]] == \"X\"\n winning_combo = combo\n elsif board_array[combo[0]] == \"O\" && board_array[combo[1]] == \"O\" && board_array[combo[2]] == \"O\"\n winning_combo = combo\n end\n end\nend\n return winning_combo\nend",
"def winner\n (@cases['A'][1].state == @cases['A'][2].state && @cases['A'][2].state == @cases['A'][3].state) ||\n (@cases['B'][1].state == @cases['B'][2].state && @cases['B'][2].state == @cases['B'][3].state) ||\n (@cases['C'][1].state == @cases['C'][2].state && @cases['C'][2].state == @cases['C'][3].state) ||\n (@cases['A'][1].state == @cases['B'][1].state && @cases['B'][1].state == @cases['C'][1].state) ||\n (@cases['A'][2].state == @cases['B'][2].state && @cases['B'][2].state == @cases['C'][2].state) ||\n (@cases['A'][3].state == @cases['B'][3].state && @cases['B'][3].state == @cases['C'][3].state) ||\n (@cases['A'][1].state == @cases['B'][2].state && @cases['B'][2].state == @cases['C'][3].state) ||\n (@cases['A'][3].state == @cases['B'][2].state && @cases['B'][2].state == @cases['C'][1].state)\n end",
"def won?(board)\n WIN_COMBINATIONS.each do |win_combo|\n # win_combo is a 3 element array of indexes that compose a win, [0,1,2]\n if (board[win_combo[0]] == \"X\" && board[win_combo[1]] == \"X\" && board[win_combo[2]] == \"X\") || (board[win_combo[0]] == \"O\" && board[win_combo[1]] == \"O\" && board[win_combo[2]] == \"O\")\n return win_combo # return the win_combo indexes that won.\n end\n end\n false\nend",
"def possibilities(words)\n words.each do |word, translations|\n sorted = translations.sort\n words[word] = sorted.each_index.map {|i|\n sorted.combination(i+1).to_a\n }.flatten(1).sort\n end\nend",
"def grab_shoe\n j, k = [], 0\n game_hash.each do |location, team_data|\n team_data.each do |attribute, data|\n if attribute = :players\n j = game_hash[location][attribute].keys\n j.each do |name|\n if game_hash[location][attribute][name][:shoe] > k\n k = game_hash[location][attribute][name][:shoe]\n end#if\n end#j\n end#if\n end#team\n end#game\n k\nend",
"def won?(board)\n WIN_COMBINATIONS.each do |win_combination|\n if board[win_combination[0]] == \"X\" && board[win_combination[1]] == \"X\" && board[win_combination[2]] == \"X\"\n return win_combination\n elsif board[win_combination[0]] == \"O\" && board[win_combination[1]] == \"O\" && board[win_combination[2]] == \"O\"\n return win_combination\n end\n end\n return false\nend",
"def won?(board)\n empty_board = board.all? do |element|\n element.nil? || element == \" \"\n end\n if empty_board\n return false\n end\n # For each win_combination in WIN_COMBINATIONS\n # win_combination is a 3 element array of indexes that compose a win, [0,1,2]\n WIN_COMBINATIONS.each do |win_combination|\n # grab each index from the win_combination that composes a win.\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n\n position_1 = board[win_index_1] # load the value of the board at win_index_1\n position_2 = board[win_index_2] # load the value of the board at win_index_2\n position_3 = board[win_index_3] # load the value of the board at win_index_3\n\n # puts \"#{win_combination}\"\n if (position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") ||\n (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\")\n return win_combination # return the win_combination indexes that won.\n else\n false\n end\n end\n\n return false\n\nend",
"def possibilities(x, y, letter)\n p = []\n for i in x-1..x+1\n for j in y-1..y+1\n # if [i, j] isn't in the grid or not on the cross center on [x, y], continue\n if ((i < 0 || i >= self.size || j < 0 || j >= self.size) || (x-i != 0 && y-j != 0) || (i == x && j == y))\n next\n end\n\n if (@grid[i][j] == letter)\n p.push({x: i, y: j})\n end\n end\n end\n return p\n end",
"def potential_combo(board, player_token)\n\n Game::WIN_COMBINATIONS.detect do |combination|\n if board.cells[combination[0]] == player_token && board.cells[combination[1]] == player_token\n !board.taken?(combination[2] + 1) ? (combination[2] + 1) : nil\n\n elsif board.cells[combination[0]] == player_token && board.cells[combination[2]] == player_token\n !board.taken?(combination[1] + 1) ? (combination[1] + 1) : nil\n\n elsif board.cells[combination[1]] == player_token && board.cells[combination[2]] == player_token\n !board.taken?(combination[0] + 1) ? (combination[0] + 1) : nil\n\n end # outer if\n end # do |combination|\n end",
"def winner(board)\n WIN_COMBINATIONS.each do |win|\n if [board[win[0]], board[win[1]], board[win[2]]] == [\"X\", \"X\", \"X\"]\n return \"X\"\n elsif [board[win[0]], board[win[1]], board[win[2]]] == [\"O\", \"O\", \"O\"]\n return \"O\"\n end\n end\n return nil\nend",
"def won?(board)\n WIN_COMBINATIONS.each do |combination|\n if board[combination[0]] == \"X\" && board[combination[1]] == \"X\" && board[combination[2]] == \"X\" || board[combination[0]] == \"O\" && board[combination[1]] == \"O\" && board[combination[2]] == \"O\"\n return combination\n end\n end\n return false\nend",
"def won?\n # for each win_combo in WIN_COMBINATIONS\n WIN_COMBINATIONS.each do |win_combo|\n # win_combination is a 3 element array of indexes that compose a win, eg. [0,1,2]\n # grab each index from the win_combo that composes a win.\n win_index_1 = win_combo[0]\n win_index_2 = win_combo[1]\n win_index_3 = win_combo[2]\n # If/else that declares a winner if all three spots in a winning array have\n # either an \"X\" or an \"O\", respectively.\n if @board[win_index_1] == \"X\" && @board[win_index_2] == \"X\" && @board[win_index_3] == \"X\"\n puts \"Congratulations X!\"\n puts \"You won!\"\n return win_combo\n elsif @board[win_index_1] == \"O\" && @board[win_index_2] == \"O\" && @board[win_index_3] == \"O\"\n puts \"Congratulations O!\"\n puts \"You won!\"\n return win_combo\n end\n end\n return false\n end",
"def won?\n if @board.all?{|position|position == \" \"}\n return false\n end\n no_combinations = true\n WIN_COMBINATIONS.each do |combination|\n if combination1 = @board[combination[0]] == \"X\" && @board[combination[1]] == \"X\" && @board[combination[2]] == \"X\" ||\n combination2 = @board[combination[0]] == \"O\" && @board[combination[1]] == \"O\" && @board[combination[2]] == \"O\"\n no_combinations = false\n return combination\n end\n end\n if no_combinations == true\n return false\n end\n end",
"def block_winning_lines(b)\n winning_lines = [[1,2,3],[4,5,6],[7,8,9],[1,4,7],[2,5,8],[3,6,9],[1,5,9],[3,5,7]]\n winning_lines.each do |line|\n if b.values_at(*line).count(\"X\") == 2\n b.select{|k,v| v == \" \"}.keys.first\n end\n end\nend",
"def won?(board)\n WIN_COMBINATIONS.each do |win|\n if [board[win[0]], board[win[1]], board[win[2]]] == [\"X\", \"X\", \"X\"] ||\n [board[win[0]], board[win[1]], board[win[2]]] == [\"O\", \"O\", \"O\"]\n return win\n end\n end\n return false\nend",
"def winner_rows\n\n # Outer loop to look for a winner across the row\n for row in 0..BOARD_MAXIMUM_INDEX\n\n # Get the player symbol (X or O) that must match\n first_symbol = @board[row][0]\n\n # Inner loop to look at all elements in the given column\n for column in 1..BOARD_MAXIMUM_INDEX\n\n # Does this cell match the first symbol?\n if first_symbol != @board[row][column]\n\n # No, this row IS NOT a winning combination\n break\n\n # At the end of the row and not all empty?\n # (Make sure we haven't found three empty positions in a column)\n elsif column == BOARD_MAXIMUM_INDEX and first_symbol != EMPTY_POSITION\n\n # Yes, this row IS a winning combination\n return first_symbol\n\n end\n\n end\n\n end\n\n # Nope, no winner in any rows\n return\n\n end",
"def won?(board)\n for win_combination in WIN_COMBINATIONS\n if (board[win_combination[0]] == 'X' && board[win_combination[1]] == 'X' && board[win_combination[2]] == \"X\")\n return win_combination\n elsif (board[win_combination[0]] == 'O' && board[win_combination[1]] == 'O' && board[win_combination[2]] == \"O\")\n return win_combination\n end\n end\n return false\nend",
"def pairs\n @pieces.combination(2).to_a\n end",
"def pairs\n @pieces.combination(2).to_a\n end",
"def won?(board)\n \n WIN_COMBINATIONS.each {|i|\n #get win combinations at each loops\n win_1= i[0]\n win_2 = i[1]\n win_3 = i[2]\n \n \n pos_1 = board[win_1]\n pos_2 = board[win_2]\n pos_3 = board[win_3]\n \n if(pos_1 == \"O\" && pos_2 == \"O\" && pos_3 == \"O\")\n return i\n elsif (pos_1 == \"X\" && pos_2 == \"X\" && pos_3 == \"X\")\n return i\n end\n }\n return false\n end",
"def won?()\n\n # loops through the 2D array WIN_COMBINATIONS\n WIN_COMBINATIONS.each do |combination|\n\n # flags\n x_win = 0\n o_win = 0\n\n combination.each do |index|\n\n # checks if player X wins\n if @board[index] == \"X\"\n x_win += 1\n\n if x_win == 3\n return combination\n end\n else\n x_win = 0\n end\n\n # checks if player O wins\n if @board[index] == \"O\"\n o_win += 1\n\n if o_win == 3\n return combination\n end\n else\n o_win = 0\n end\n\n end\n end\n\n # return false if there is no winner\n return false\n end",
"def won?(board)\n WIN_COMBINATIONS.each do |win_combination|\n if board[win_combination[0]]==board[win_combination[1]]&&board[win_combination[0]]==board[win_combination[2]]&&board[win_combination[0]]!=\" \"\n return win_combination\n end\n end\n false\nend",
"def won?(board)\n WIN_COMBINATIONS.each do |win_group|\n if win_group.all? {|win_index| board[win_index] == \"X\"}\n return win_group\n elsif win_group.all? {|win_index| board[win_index] == \"O\"}\n return win_group\n else \n false \n end \n end \n!WIN_COMBINATIONS.each do |win_group|\n return false \nend \nend",
"def winner(board)\n array = [1]\n array = combinations(board) if combinations(board)\n \n if array.all?(X_TOKEN)\n 1\n elsif array.all?(O_TOKEN)\n 2\n end\n end",
"def won?(board_array)\r\n #logic to check for a winning combination\r\n WIN_COMBINATIONS.detect do |combo|\r\n board_array[combo[0]] == board_array[combo[1]] && board_array[combo[2]] == board_array[combo[1]]&&position_taken?(board_array,combo[0])\r\n #winner_for_game = board_array[combo[0]]\r\n #return true\r\n end\r\n end",
"def every_possible_pairing_of_students(array)\n array.combination(2)\nend",
"def every_possible_pairing_of_students(array)\n array.combination(2)\nend",
"def draw?(board)\n\nif\nWIN_COMBINATIONS.detect do |winner|\n winner.all? {|token| board[token] == \"X\"} || winner.all? {|token| board[token] == \"O\"}\nend\n\nelse\n board.all? {|i| i == \"O\" || i == \"X\"}\nend\nend",
"def every_possible_pairing_of_students(array)\n\tn = ['Bob', 'Dave', 'Clive']\n\tn.combination(2)\nend",
"def powerCase player_index\n\tp = player_index.sort_by{|val| val[0].power[1]}.reverse\n\ts = 0\n\ttemp = p[s][0]\n\tfor i in 0..player_index.length-2\n\t\tif(temp.power[1]==p[i+1][0].power[1])\n\t\t\tif(temp.power[2]<p[i+1][0].power[2] && temp.power[2]!=1)\n\t\t\t\twinner = p[i+1][1]\n\t\t\t\ttemp = p[i+1][0]\n\t\t\t\ts= i+1\n\t\t\telsif(temp.power[2]==p[i+1][0].power[2])\n\t\t\t\tif(temp.power[3]<p[i+1][0].power[3] && temp.power[3]!=1)\n\t\t\t\t\twinner = p[i+1][1]\n\t\t\t\t\ttemp = p[i+1][0]\n\t\t\t\t\ts = i+1\n\t\t\t\telsif(temp.power[3]==p[i+1][0].power[3])\n\t\t\t\t\twinner = 0\n\t\t\t\telse\n\t\t\t\t\twinner = p[s][1]\n\t\t\t\t\n\t\t\t\tend\n\t\t\telse\n\t\t\t\twinner = p[s][1]\n\t\t\tend\n\t\telsif(temp.power[1]<p[i+1][0].power[1] && temp.power[1]!=1)\n\t\t\twinner = p[i+1][1]\n\t\t\ttemp = p[i+1][0]\n\t\t\ts =i+1\n\t\telse\n\t\t\twinner = p[s][1]\n\t\tend\n\t\t\t\n\tend\n\tif(winner != 0)\n\t\tputs \"Player #{winner} wins\"\n\telse\n\t\tputs \"This is a draw.No Results\"\n\tend\nend",
"def won?(board)\n WIN_COMBINATIONS.detect do |win_index| # \"detect\" will only return the first element that makes the block true\n # puts win_index[0] # returns 0,3,6,0,1,2,0,6\n # (all 0 index values in WIN_COMBINATIONS[0][0],[1][0],[2][0],[3][0],[4][0],[5][0],etc.)\n # puts win_index[1] # returns 1,4,7,3,4,5,4,4\n # (all 1 index values in WIN_COMBINATIONS[0][1],[1][1],[2][1],[3][1],[4][1],[5][1],etc.)\n # puts win_index[2] # returns 2,5,8,6,7,8,8,2\n # (all 2 index values in WIN_COMBINATIONS[0][2],[1][2],[2][2],[3][2],[4][2],[5][2],etc.)\n # only need three [0,1,2] \"win_index[]\" because that is the length of child arrays\n # now check the board to see if indexes contain \"X\" or \"O\"\n board[win_index[0]] == \"X\" &&\n board[win_index[1]] == \"X\" &&\n board[win_index[2]] == \"X\" ||\n board[win_index[0]] == \"O\" &&\n board[win_index[1]] == \"O\" &&\n board[win_index[2]] == \"O\" &&\n\n position_taken?(board, win_index[0])\n # position_taken? checks if win_index[0] is not nil or not equal to \" \"\n end\n end",
"def won?(board)\n win_combination = []\n WIN_COMBINATIONS.each do |line|\n if line.all? { |pos| board[pos] == \"X\" }\n win_combination = line\n end\n if line.all? { |pos| board[pos] == \"O\" }\n win_combination = line\n end\n end\n if win_combination != []\n win_combination\n else\n false\n end\nend",
"def won? (board)\n if (board[WIN_COMBINATIONS[0][0]] == 'X' && board[WIN_COMBINATIONS[0][1]] == 'X' && board[WIN_COMBINATIONS[0][2]] == 'X')\n return WIN_COMBINATIONS[0]\n elsif (board[WIN_COMBINATIONS[0][0]] == 'O' && board[WIN_COMBINATIONS[0][1]] == 'O' && board[WIN_COMBINATIONS[0][2]] == 'O')\n return WIN_COMBINATIONS[0]\n end\n\n if (board[WIN_COMBINATIONS[1][0]] == 'X' && board[WIN_COMBINATIONS[1][1]] == 'X' && board[WIN_COMBINATIONS[1][2]] == 'X')\n return WIN_COMBINATIONS[1]\n elsif (board[WIN_COMBINATIONS[1][0]] == 'O' && board[WIN_COMBINATIONS[1][1]] == 'O' && board[WIN_COMBINATIONS[1][2]] == 'O')\n return WIN_COMBINATIONS[1]\n end\n\n if (board[WIN_COMBINATIONS[2][0]] == 'X' && board[WIN_COMBINATIONS[2][1]] == 'X' && board[WIN_COMBINATIONS[2][2]] == 'X')\n return WIN_COMBINATIONS[2]\n elsif (board[WIN_COMBINATIONS[2][0]] == 'O' && board[WIN_COMBINATIONS[2][1]] == 'O' && board[WIN_COMBINATIONS[2][2]] == 'O')\n return WIN_COMBINATIONS[2]\n end\n\n if (board[WIN_COMBINATIONS[3][0]] == 'X' && board[WIN_COMBINATIONS[3][1]] == 'X' && board[WIN_COMBINATIONS[3][2]] == 'X')\n return WIN_COMBINATIONS[3]\n elsif (board[WIN_COMBINATIONS[3][0]] == 'O' && board[WIN_COMBINATIONS[3][1]] == 'O' && board[WIN_COMBINATIONS[3][2]] == 'O')\n return WIN_COMBINATIONS[3]\n end\n\n if (board[WIN_COMBINATIONS[4][0]] == 'X' && board[WIN_COMBINATIONS[4][1]] == 'X' && board[WIN_COMBINATIONS[4][2]] == 'X')\n return WIN_COMBINATIONS[4]\n elsif (board[WIN_COMBINATIONS[4][0]] == 'O' && board[WIN_COMBINATIONS[4][1]] == 'O' && board[WIN_COMBINATIONS[4][2]] == 'O')\n return WIN_COMBINATIONS[4]\n end\n\n if (board[WIN_COMBINATIONS[5][0]] == 'X' && board[WIN_COMBINATIONS[5][1]] == 'X' && board[WIN_COMBINATIONS[5][2]] == 'X')\n return WIN_COMBINATIONS[5]\n elsif (board[WIN_COMBINATIONS[5][0]] == 'O' && board[WIN_COMBINATIONS[5][1]] == 'O' && board[WIN_COMBINATIONS[5][2]] == 'O')\n return WIN_COMBINATIONS[5]\n end\n if (board[WIN_COMBINATIONS[6][0]] == 'X' && board[WIN_COMBINATIONS[6][1]] == 'X' && board[WIN_COMBINATIONS[6][2]] == 'X')\n return WIN_COMBINATIONS[6]\n elsif (board[WIN_COMBINATIONS[6][0]] == 'O' && board[WIN_COMBINATIONS[6][1]] == 'O' && board[WIN_COMBINATIONS[6][2]] == 'O')\n return WIN_COMBINATIONS[6]\n end\n if (board[WIN_COMBINATIONS[7][0]] == 'X' && board[WIN_COMBINATIONS[7][1]] == 'X' && board[WIN_COMBINATIONS[7][2]] == 'X')\n return WIN_COMBINATIONS[7]\n elsif (board[WIN_COMBINATIONS[7][0]] == 'O' && board[WIN_COMBINATIONS[7][1]] == 'O' && board[WIN_COMBINATIONS[7][2]] == 'O')\n return WIN_COMBINATIONS[7]\n end\nelse\n return false\nend",
"def combine(draw_input)\n letters_amount = Array(0..(draw_input.length-1))\n combinations = letters_amount.map{ |x| (letters_amount - [x]).map{ |z| draw_input[z] } }\n smaller_combinations = combinations.map { |e| combine(e) }.flatten(1) + [draw_input]\n smaller_combinations.uniq.reject(&:empty?)\nend",
"def check_win(player)\n winning_combos.each do |winning_combo|\n if three_in_a_row(winning_combo, player)\n @winner = player\n return true\n end\n end\n \n false\n \n end",
"def check_winner(symbol, name)\n counter = 0\n win_variation_one = []\n win_variation_one.push(@second_row[1], @second_row[5], @second_row[9])\n win_variation_one.each do |x|\n counter += 1 if x == symbol\n end\n winner(counter, name)\n\n counter = 0\n win_variation_two = []\n win_variation_two.push(@fifth_row[1], @fifth_row[5], @fifth_row[9])\n win_variation_two.each do |x|\n counter += 1 if x == symbol\n end\n winner(counter, name)\n\n counter = 0\n win_variation_three = []\n win_variation_three.push(@eighth_row[1], @eighth_row[5], @eighth_row[9])\n win_variation_three.each do |x|\n counter += 1 if x == symbol\n end \n winner(counter, name)\n\n counter = 0\n win_variation_four = []\n win_variation_four.push(@second_row[1],@fifth_row[1], @eighth_row[1])\n win_variation_four.each do |x|\n counter += 1 if x == symbol\n end\n winner(counter, name)\n\n counter = 0\n win_variation_five = []\n win_variation_five.push(@second_row[5],@fifth_row[5], @eighth_row[5])\n win_variation_five.each do |x|\n counter += 1 if x == symbol\n end\n winner(counter, name)\n\n counter = 0\n win_variation_six = []\n win_variation_six.push(@second_row[9],@fifth_row[9], @eighth_row[9])\n win_variation_six.each do |x|\n counter += 1 if x == symbol\n end \n winner(counter, name)\n\n counter = 0\n win_variation_seven = []\n win_variation_seven.push(@second_row[1],@fifth_row[5], @eighth_row[9])\n win_variation_seven.each do |x|\n counter += 1 if x == symbol\n end \n winner(counter, name)\n\n counter = 0\n win_variation_eight = []\n win_variation_eight.push(@second_row[9],@fifth_row[5], @eighth_row[1])\n win_variation_eight.each do |x|\n counter += 1 if x == symbol\n end \n winner(counter, name)\n\n false\n end",
"def grand_winner?(wins)\n wins.key(5)\nend",
"def won?\n the_win_combination = false\n WIN_COMBINATIONS.each do |win_combination|\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n\n position_1 = @board[win_index_1]\n position_2 = @board[win_index_2]\n position_3 = @board[win_index_3]\n\n if (position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") ||\n (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\")\n the_win_combination = win_combination\n break\n end\n end\n the_win_combination\n end",
"def combos(cards)\n cards.to_a.combination(3).to_a\n end",
"def won?(board)\n game = false\n WIN_COMBINATIONS.each do |win_combination|\n if !game\n if win_combination.all?{|i| board[i]==\"X\"} || win_combination.all?{|i| board[i]==\"O\"}\n game = win_combination\n end\n end\n end\n game\n end",
"def won?(board)\n WIN_COMBINATIONS.each do |combo|\n win_combination = [combo[0], combo[1], combo[2]]\n windex1 = win_combination[0]\n windex2 = win_combination[1]\n windex3 = win_combination[2]\n\n pos1 = board[windex1]\n pos2 = board[windex2]\n pos3 = board[windex3]\n win_combo = [pos1,pos2,pos3]\n\n if pos1 == \"X\" && pos2 == \"X\" && pos3 == \"X\" || pos1 ==\"O\" && pos2 == \"O\" && pos3 == \"O\"\n return win_combination\n end\nend\n return false\nend",
"def won?\n WIN_COMBINATIONS.detect { |combo|\n @board.cells[combo[0]] == @board.cells[combo[1]] &&\n @board.cells[combo[0]] == @board.cells[combo[2]] &&\n @board.taken?(combo[0] + 1)\n }\n # x = \"X\";\n # o = \"O\";\n #\n # WIN_COMBINATIONS.each do |win_combination|\n # win_index_1 = win_combination[0];\n # win_index_2 = win_combination[1];\n # win_index_3 = win_combination[2];\n #\n # position_1 = @board.cells[win_index_1];\n # position_2 = @board.cells[win_index_2];\n # position_3 = @board.cells[win_index_3];\n #\n # if ((position_1 == x && position_2 == x && position_3 == x) ||\n # (position_1 == o && position_2 == o && position_3 == o))\n # return win_combination;\n # else\n # false;\n # end\n # end\n # false; #explicitly tell ruby to return false if we've cycled through the board and no win combinations can be found\n end",
"def won?(board)\n WIN_COMBINATIONS.each do |combo|\n if board[combo[0]] == \"X\" && board[combo[1]] == \"X\" && board[combo[2]] == \"X\"\n # x wins\n return combo\n end\n \n if board[combo[0]] == \"O\" && board[combo[1]] == \"O\" && board[combo[2]] == \"O\"\n # o wins\n return combo\n end\n end\n\n return false\nend",
"def won?(board)\n if board.all? == \" \" || board.all? == nil\n return nil\n else\nWIN_COMBINATIONS.detect do |win|\n board[win[0]] == \"X\" && board[win[1]] == \"X\" && board[win[2]] == \"X\" ||\n board[win[0]] == \"O\" && board[win[1]] == \"O\" && board[win[2]] == \"O\"\n\n end\n end\nend",
"def won?(board)\n if board.all? == \" \" || board.all? == nil\n return nil\n else\nWIN_COMBINATIONS.detect do |win|\n board[win[0]] == \"X\" && board[win[1]] == \"X\" && board[win[2]] == \"X\" ||\n board[win[0]] == \"O\" && board[win[1]] == \"O\" && board[win[2]] == \"O\"\n\n end\n end\nend",
"def won?(board)\n\n WIN_COMBINATIONS.each do |win_arr|\n\n yes_x = win_arr.all? do |i|\n board[i] == 'X'\n end\n\n if yes_x == true\n return win_arr\n end\n\n yes_o = win_arr.all? do |i|\n board[i] == 'O'\n end\n\n if yes_o == true\n return win_arr\n end\n end\n\n return nil\n\nend",
"def won?(board)\n WIN_COMBINATIONS.each do |win_combination|\n # get indices of each win_combination\n win_index_1 = win_combination[0]\n win_index_2 = win_combination[1]\n win_index_3 = win_combination[2]\n # get values from board that map to each index in each win_combination\n position_1 = board[win_index_1]\n position_2 = board[win_index_2]\n position_3 = board[win_index_3]\n # Are all values X's?\n if (position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") || (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\")\n return win_combination\n end # else not a win_combination\n\n end # WIN_COMBINATIONS.each iteration\n\n return false\nend",
"def check_guess_exact_position\n answer = []\n temp = @rows[@guess_number - 1].dup\n temp_key = @key.dup\n @key.each_with_index do |el, i|\n if el == temp[i]\n answer << 2\n temp[i] = 0\n temp_key[i] = 0\n end\n end\n [answer, temp, temp_key]\n end",
"def won?\n TicTacToe::WIN_COMBINATIONS.each do |combinations|\n position_1 = @board[combinations[0]]\n position_2 = @board[combinations[1]]\n position_3 = @board[combinations[2]]\n\n if (position_1 == \"X\" && position_2 == \"X\" && position_3 == \"X\") || \n (position_1 == \"O\" && position_2 == \"O\" && position_3 == \"O\")\n return combinations\n else\n false\n end\n end\n false\n end",
"def WIN_COMBINATIONS(board)\n board = [\"X\", \"X\", \"X\", \" \", \" \", \" \", \" \", \" \", \" \"]\n top_row_win = [[0,1,2],\n [3,4,5],[6,7,9]]\n if board[top_row_win[0]] == \"X\" &&\n board[top_row_win[1]] == \"X\" &&\n board[top_row_win[2]] == \"X\"\n \"X won in the top row\"\n end",
"def won?(board)\n winner = []\n won=WIN_COMBINATIONS.any? do |arr|\n arr.all? {|position| position_taken?(board,position,\"X\")} || arr.all? {|position| position_taken?(board,position,\"O\")}\n if arr.all? {|position| position_taken?(board,position,\"X\")} || arr.all? {|position| position_taken?(board,position,\"O\")}\n winner = arr\n end\n end\n if won\n return winner\n else\n return false\n end\nend",
"def won?(board)\n WIN_COMBINATIONS.each do |combo|\nindex_1 = combo[0]\ntoken_1 = board[index_1]\nindex_2 = combo[1]\ntoken_2 = board[index_2]\nindex_3 = combo[2]\ntoken_3 = board[index_3]\n if token_1 == \"X\" && token_2 == \"X\" && token_3 == \"X\"\n return combo\n elsif token_1 == \"O\" && token_2 == \"O\" && token_3 == \"O\"\n return combo\n end\n end\n return false\nend",
"def won?(board)\n WIN_COMBINATIONS.each do |combination| #iterate over WIN_COMBINATIONS\n if position_taken?(board, combination[0]) #only check for a win if the position is taken\n if board[combination[0]] == board[combination[1]] && board[combination[0]] == board[combination[2]]\n return combination\n end\n end\n end\n nil\nend",
"def won?(board)\n WIN_COMBINATIONS.each do |indices|\n result = indices.map { |i| board[i] }\n if result == [\"X\", \"X\", \"X\"] || result == [\"O\", \"O\", \"O\"]\n return indices\n end\n end\n false\nend",
"def won?(board)\n WIN_COMBINATIONS.each do |win_combo|\n if (board[win_combo[0]] == \"X\" && board[win_combo[1]] == \"X\" && board[win_combo[2]] == \"X\") || (board[win_combo[0]] == \"O\" && board[win_combo[1]] == \"O\" && board[win_combo[2]] == \"O\")\n return win_combo\n end\n end\n return false\nend",
"def every_possible_pairing_of_word(arr)\n i1 = arr\n i2 = []\n i1.combination(2).to_a\nend",
"def can_win(board)\n WIN_COMBINATIONS.find do |array|\n winning_array = array.collect { |i| board.cells[i] }\n token = self.token\n winning_array.sort == [\" \", token, token]\n end\n end",
"def winner\n no_combinations = true\n WIN_COMBINATIONS.each do |combination|\n if combination1 = @board[combination[0]] == \"X\" && @board[combination[1]] == \"X\" && @board[combination[2]] == \"X\"\n no_combinations = false\n return \"X\"\n elsif combination2 = @board[combination[0]] == \"O\" && @board[combination[1]] == \"O\" && @board[combination[2]] == \"O\"\n no_combinations = false\n return \"O\"\n end\n end\n if no_combinations == true\n return nil\n end\n end"
] | [
"0.7519783",
"0.69545454",
"0.6690531",
"0.6542208",
"0.63667154",
"0.63269246",
"0.6292277",
"0.61803764",
"0.6052985",
"0.60504675",
"0.6032583",
"0.6010009",
"0.59968084",
"0.5979499",
"0.5977666",
"0.59722435",
"0.596451",
"0.5959321",
"0.59573287",
"0.5940402",
"0.5928426",
"0.59034705",
"0.5898215",
"0.58879554",
"0.5878798",
"0.5839129",
"0.5820725",
"0.5810089",
"0.5792959",
"0.5787904",
"0.5784072",
"0.57828724",
"0.5781416",
"0.57730454",
"0.5768479",
"0.57640386",
"0.5754797",
"0.57488817",
"0.57480586",
"0.57371014",
"0.57344747",
"0.5729654",
"0.5726118",
"0.5724695",
"0.57132065",
"0.57114154",
"0.5708791",
"0.56691605",
"0.56543154",
"0.5653379",
"0.56497055",
"0.5639262",
"0.5634419",
"0.56275415",
"0.561721",
"0.56114477",
"0.5608871",
"0.5603702",
"0.55943406",
"0.5592081",
"0.5586392",
"0.5586392",
"0.5585967",
"0.55837286",
"0.5578786",
"0.55765235",
"0.5571822",
"0.5571226",
"0.55665654",
"0.55665654",
"0.55610925",
"0.55592185",
"0.55552727",
"0.5554005",
"0.5552198",
"0.5551624",
"0.5546494",
"0.5546053",
"0.554382",
"0.5543131",
"0.55394197",
"0.55393285",
"0.55373806",
"0.5535915",
"0.5531732",
"0.5531547",
"0.5527168",
"0.5527168",
"0.55253243",
"0.55213785",
"0.5514939",
"0.5513369",
"0.55078",
"0.55077857",
"0.55030686",
"0.55029744",
"0.55011946",
"0.5500447",
"0.5497326",
"0.5496697",
"0.5495022"
] | 0.0 | -1 |
This belongs in Square class instead of Player class, since we're modifying the value of the Square class | def initialize(marker = INITIAL_MARKER)
@marker = marker # will reveal the state of each square. Whether it has been marked or is empty
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_square(location,player)\n square = find_square(location)\n square.value=(player.character)\n end",
"def take_square(player, number)\n marker = player.name == 'human' ? 'x' : 'o'\n self.squares[number] = marker\n draw_board\n end",
"def player; end",
"def player; end",
"def player; end",
"def player; end",
"def player; end",
"def player; end",
"def player; end",
"def initialize_score(player)\n\n player.score = 3\n\nend",
"def populate_board\n #the six rows get updated\n players.each do |player|\n rows = player == players[0] ? [ 0,1,2 ] : [ 5,6,7 ]\n piece_count = 0\n col = 0\n\n player.pieces.each do |piece|\n\n rows.shift if piece_count % 4 == 0 and piece_count != 0\n\n col_start = rows[0] % 2 == 1 ? 0 : 1\n col = 0 if (col_start == 0 || col_start == 1) && piece_count % 4 == 0\n\n piece.position = [col + col_start, rows[0]]\n squares[[col + col_start, rows[0]]] = piece\n\n col += 2\n piece_count += 1\n\n end\n\n end\n\n end",
"def play_move!( m )\n self.delete_if { |pos, piece| pos == m.to_coord || pos == m.captured_piece_coord }\n\n piece_moved = self.delete(m.from_coord)\n self[m.to_coord] = piece_moved\n\n if m.castled==1\n castling_rank = m.to_coord.rank.to_s\n [['g', 'f', 'h'], ['c', 'd', 'a']].each do |king_file, new_rook_file, orig_rook_file|\n #update the position of the rook corresponding to the square the king landed on\n\tif m.to_coord.file == king_file \n\t rook = self.delete(\"#{orig_rook_file}#{castling_rank}\")\n\t self[\"#{new_rook_file}#{castling_rank}\"] = rook\n\tend\n end\n end\n \n #TODO investigate why this method is getting called multiply per moves << Move.new\n return unless piece_moved\n ep_from_rank, ep_to_rank, ep_rank = EN_PASSANT_CONFIG[ piece_moved.side ]\n @en_passant_square = ( piece_moved.function == :pawn &&\n m.from_coord.rank == ep_from_rank && \n m.to_coord.rank == ep_to_rank ) ? m.from_coord.file + ep_rank.to_s : nil\n\n #reflect promotion\n if piece_moved && piece_moved.function == :pawn && m.to_coord.to_s.rank == piece_moved.promotion_rank\n self.delete(m.to_coord)\n self[m.to_coord] = Queen.new(piece_moved.side, :promoted)\n #puts self.to_s if m.to_coord == 'a8'\n #debugger if m.to_coord == 'a8'\n end\n \n self\n end",
"def draw\n @square = Square.new(x: @x, y: @y, size: @size, color: @color)\nend",
"def squares\n self.map(&:square)\n end",
"def player_position_look_update; end",
"def square!\n return square\n end",
"def change_player\n\n end",
"def draw\n self.rock = Square.new(x: self.rock_x * $GRID_SIZE, y: self.rock_y * $GRID_SIZE, size: ($GRID_SIZE - 1) * 2, color: 'red')\n end",
"def score_player\n raise 'Method score_player cannot be called directly. It must be overridden in a child class first.'\n end",
"def move( from_square, to_square, promote_to = nil )\n\t\t\t@squares[to_square] = @squares[from_square]\n\t\t\t@squares[from_square] = nil\n\t\t\n\t\t\t@squares[to_square].square = to_square\n\n\t\t\t# handle en-passant captures\n\t\t\tif @squares[to_square].is_a?(Pawn) and to_square == @en_passant\n\t\t\t\t@squares[\"#{to_square[0, 1]}#{from_square[1, 1]}\"] = nil\n\t\t\tend\n\t\t\t# track last move for future en-passant captures\n\t\t\tif @squares[to_square].is_a?(Pawn) and\n\t\t\t (from_square[1, 1].to_i - to_square[1, 1].to_i).abs == 2\n\t\t\t\tif from_square[1, 1] == \"2\"\n\t\t\t\t\t@en_passant = \"#{from_square[0, 1]}3\"\n\t\t\t\telse\n\t\t\t\t\t@en_passant = \"#{from_square[0, 1]}6\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t@en_passant = nil\n\t\t\tend\n\t\t\t\n\t\t\tif @squares[to_square].is_a?(King) and # queenside castles\n\t\t\t from_square[0, 1] == \"e\" and to_square[0, 1] == \"c\"\n\t\t\t\trank = to_square[1, 1]\n\t\t\t\t@squares[\"d#{rank}\"] = @squares[\"a#{rank}\"]\n\t\t\t\t@squares[\"a#{rank}\"] = nil\n\n\t\t\t\t@squares[\"d#{rank}\"].square = \"d#{rank}\"\n\t\t\telsif @squares[to_square].is_a?(King) and # kingside castles\n\t\t\t from_square[0, 1] == \"e\" and to_square[0, 1] == \"g\"\n\t\t\t\trank = to_square[1, 1]\n\t\t\t\t@squares[\"f#{rank}\"] = @squares[\"h#{rank}\"]\n\t\t\t \t@squares[\"h#{rank}\"] = nil\n\n\t\t\t\t@squares[\"f#{rank}\"].square = \"f#{rank}\"\n\t\t\telsif not promote_to.nil? # pawn promotion\n\t\t\t\t@squares[to_square] = promote_to.new(self, to_square, @turn)\n\t\t\tend\n\t\t\t\n\t\t\t# advance the turn indicator\n\t\t\tnext_turn\n\t\t\t\n\t\t\tself\n\t\tend",
"def evaluate_control\n units = Set.new\n players = Set.new\n @squares = []\n\n # Look at all neighbouring squares to see which contain\n @square.neighbours_and_self.each do |neighbour|\n if neighbour.combat_unit?\n @squares << neighbour\n units << neighbour.combat_unit\n players << neighbour.combat_unit.player\n end\n end\n\n @units = units.to_a\n @players = players.to_a\n end",
"def take_a_square(square, player)\n i = free_to_take?(square)\n @board[i] = player.mark if i\n end",
"def set_move(player, square_number)\n board_iterate do |element, row, col|\n @board[row][col] = player.piece if element == square_number\n end\n end",
"def initialize(value) # setting instance variable (@value) for square\r\n @value = value \r\n end",
"def primary_square\n new_placements.squares.first\n end",
"def squares!\n self.map!(&:square)\n end",
"def square!\n\t\tself.each_with_index do |elem, i|\n\t\t\tself[i] = elem * elem\n\t\tend\n\tend",
"def update_player_position\n update_circle(@circlep)\n end",
"def reordenate_team\n position = 1\n self.players.each do |player|\n player.update_attribute(:position, position)\n position += 1\n end\n end",
"def square\n\t\tself.map {|x| x ** 2}\n\tend",
"def opponent(player)\n @sides[0]\n end",
"def player_positions\n @board[@position] = @player\n end",
"def set_square(y,x,value)\n\t\t@board[y][x] = value\n\tend",
"def human_and_human_player(size)\n\t@player1 = \"player\"\n @player2 = \"player\"\nend",
"def add_squares()\n\t\t# print self showing that the array has indeed changed\n\t\t# puts\n\t\tsum_of_array = 0\t\t\t\t\t\t\t\t\t\t\t# \"counter\" for sum_of_array\n\t\tself.each {|num| sum_of_array += num} # the new \"self\", .each iterating over array, \n\t\tprint sum_of_array \t\t\t\t\t \t\t\t\t\t# each num is being added to sum_of_array\n\tend",
"def squared\n end",
"def update(player)\n column = player.location\n (size[0] - 1).downto(0) do |row|\n if grid[row][column].nil?\n return grid[row][column] = player\n end\n end\n end",
"def initialize(player1, board = Board.new)\n @board = board\n @board.populate!\n @player1 = player1\n @previous_guess = nil\n @player1.update(board.grid.length)\n end",
"def initialize\n @currentPlayerIndex = -1;\n\n\n end",
"def double_player(player)\n player.bet *= 2\n end",
"def next_player!\n end",
"def square!\n\t\tself.map! {|x| x ** 2}\n\tend",
"def round_score(player)\n\tif player.life_points > 0 # Test si le joueur est en vie\n\t\tputs player.show_state\n\telse puts \"Tu es KO.\"\n\tend\n\tplayer.show_ennemies.each do |ennemi|\n\t\tif ennemi.life_points > 0\n\t\t\tputs ennemi.show_state\n\t\telse puts \"#{ennemi.name} est KO.\"\n\t\tend\n\tend\nend",
"def test_should_get_white_piece_on_black_square_from_initial_setup\n square = @board.sq_at(A1)\n assert_not_nil(square)\n assert(square.colour.black?)\n assert_not_nil(square.piece)\n assert(square.piece.colour.white?)\n assert_equal(Chess::Piece::ROOK, square.piece.name)\n end",
"def update_score\n if @round_won\n @player.increment_rounds_won\n else\n @player.increment_rounds_lost\n end\n end",
"def set_player\n\n end",
"def win_pts\n self.score += 1\n end",
"def initialize(player)\n @en_passant = false\n super(player)\n end",
"def update currentTime\n @square.zRotation += 0.1\n end",
"def update_score(score, board)\n if detect_winner(board) == 'Player'\n score[0] += 1\n else\n score[1] += 1\n end\nend",
"def move_piece_in_square(from_square, to_square)\n to_square.checker_piece = from_square.checker_piece\n from_square.checker_piece = nil\n end",
"def move_piece_in_square(from_square, to_square)\n to_square.checker_piece = from_square.checker_piece\n from_square.checker_piece = nil\n end",
"def put(square, piece)\n remove(square)\n\n @pieces[square] = piece.piece_type\n\n mask = BB_SQUARES[square]\n\n if piece.piece_type == PAWN\n @pawns = @pawns | mask\n elsif piece.piece_type == KNIGHT\n @knights = @knights | mask\n elsif piece.piece_type == BISHOP\n @bishops = @bishops | mask\n elsif piece.piece_type == ROOK\n @rooks = @rooks | mask\n elsif piece.piece_type == QUEEN\n @queens = @queens | mask\n elsif piece.piece_type == KING\n @kings = @kings | mask\n @king_squares[piece.color] = square\n end\n\n @occupied = @occupied ^ mask\n @occupied_co[piece.color] = @occupied_co[piece.color] ^ mask\n @occupied_l90 = @occupied_l90 ^ BB_SQUARES[SQUARES_L90[square]]\n @occupied_r45 = @occupied_r45 ^ BB_SQUARES[SQUARES_R45[square]]\n @occupied_l45 = @occupied_l45 ^ BB_SQUARES[SQUARES_L45[square]]\n\n # Update incremental zorbist hash.\n if piece.color == BLACK\n piece_index = (piece.piece_type - 1) * 2\n else\n piece_index = (piece.piece_type - 1) * 2 + 1\n end\n\n @incremental_zobrist_hash = @incremental_zobrist_hash ^ Zobrist::POLYGLOT_RANDOM_ARRAY[64 * piece_index + 8 * rank_index(square) + file_index(square)]\n end",
"def set_position\n if @player_correct[-1] == true\n @player_pos << (@player_pos[-1]) - 5\n else\n @player_pos << @player_pos[-1]\n end\n if @computer_correct[-1] == true\n @computer_pos << (@computer_pos[-1]) - 5\n else\n @computer_pos << @computer_pos[-1]\n end\n end",
"def winner\n<<<<<<< HEAD\n @winner_player\n end",
"def initialize\n @points = 0\n @opponent = opponent\n end",
"def add_to_player_score (player)\r\n\tplayer.player_wins += 1\r\n\t@total_number_of_plays += 1\r\n\tend",
"def give_point\n if@current_player == @player1\n @p1_score += 1\n else\n @p2_score += 1\n end\nend",
"def initialize\n @board = Board.new\n @round = 0\n end",
"def checked_squares(square, game_state)\n dup = game_state.clone\n # set the piece to nil to handle case where a piece threatens squares behind this piece.\n dup.squares.find_ou_for_player(player_number).piece = nil\n dup.squares.threatened_by(opponent, dup)\n end",
"def adjust_to_player(x, y)\n xsmall = x < 0\n ysmall = y < 0\n xgreat = x >= $game.map.width\n ygreat = y >= $game.map.height\n t = player_tile\n diffx = t.mapx - $game.player.x\n diffx += xgreat ? 1 : xsmall ? -1 : 0\n diffy = t.mapy - $game.player.y\n diffy += ygreat ? 1 : ysmall ? -1 : 0\n self.each do |sprite|\n sprite.mapx -= diffx\n sprite.mapy -= diffy\n end\n end",
"def set_piece(player,location) #takes the arguments player and location\n\t\t@piece=player.piece #defines piece as the player's number (either 1 or 2)\n\t\trow=(location-1)/4 #takes the value of location (1-16) and converts it into a row coordinate 0, 1, 2, or 3\n\t\tcolumn=(location+3)%4 #takes the value of location (1-16) and converts it into a column coordinate 0, 1, 2, or 3\n\t\t@board[row][column]=@piece #defines the cell that the player has just selected as the player's number (1 or 2)\n\t\t@size+=1 #we count each move after its been made which is used in the function below, check_full?\n\tend",
"def find_squares(board)\n\nend",
"def initialize (row,col)\n @row = row\n @col = col\n @player = 0\n @choiced = false\n end",
"def player_puts_X(b)\n begin\n puts \"Pick a square (1 - 9)\"\n position = gets.chomp.to_i\nend until empty_square(b).include?(position)\n b[position] = \"X\"\nend",
"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\[email protected]\n\t\[email protected]_stars(@stars)\n\n\t\tif rand(100) < 4 and @stars.size < 25 then\n\t\t\[email protected](Star.new(@star_anim))\n\t\tend\n\tend",
"def isSquareAttackedBy?(coord,colour, board)\n board.pieces[colour].each do |pieceType, listOfCoord|\n listOfCoord.each do |fromCoord, piece| \n m = Move.new(board, piece, coord, fromCoord)\n return true if isLegalMove?(m)\n end\n end\n return false\n end",
"def calc_player\n\n # Since acceleration is the change in velocity, the change in y (dy) increases every frame.\n # What goes up must come down because of gravity.\n state.dy += state.gravity\n\n # Calls the calc_box_collision and calc_edge_collision methods.\n calc_box_collision\n calc_edge_collision\n\n # Since velocity is the change in position, the change in y increases by dy. Same with x and dx.\n state.y += state.dy\n state.x += state.dx\n\n # Scales dx down.\n state.dx *= 0.8\n end",
"def switch_player\nif @player == PIECE[:x]\n@player = PIECE[:o]\nelse\n@player = PIECE[:x]\nend\nend",
"def current_player(board) # Current_player method takes in an argument of the game board\n turn_count(board).even? ? board = \"X\" : board = \"O\"\nend",
"def player1value\n return @Player1\n end",
"def Winner?(player)\r\n end",
"def big_shoe_rebounds\n big_shoes_player = 0\n rebounds = 0\n game_hash.each do |team_key, team_value|\n team_value[:players].each do |stats|\n if stats[:shoe] > big_shoes_player #if the shoe stats for the current player being compared is bigger than the current \"big_shoes_player\" then continue to next lines of code that cause \"big_shoes_player\" to turn into the current player and reflect his rebounds.\n big_shoes_player = stats[:shoe]\n rebounds = stats[:rebounds]\n end\n end\n end\n rebounds\nend",
"def change_player \n if @current_player == 0\n @current_player = 1\n elsif @current_player == 1\n @current_player = 0\n end\n end",
"def current_player #removed (board) argument\n turn_count % 2 == 0 ? \"X\" : \"O\" \nend",
"def setplayer2\r\n\t\t\t@player2 = \"X\"\r\n\t\tend",
"def play\n # To start, the method takes two arguments, the players and board array. \n while @board.winner == false\n # Then I set up a while loop that will keep going until there is no winner.\n @board.display_board\n # I started by calling the display_board method (from the Board Class) to show \n # the array in the traditional Tic-Tac-Toe formatting. \n cell_prompt\n # I Prompt the Player to make their selection. \n get_move\n # Here is where the Player imputs their selection. \n @board.update_cell\n # Update_cell (from the Board Class) will take the Player's input and update the value of the object at the \n # corresponding Board[index]. \n if @board.winner == true \n puts @board.winner\n break\n # This ends the loop if there has been a winner.\n elsif @board.draw == true\n break\n # This ends the loop if the match is a draw. \n end\n end\n # Otherwise, the loop keeps going. \n end",
"def square\n square_params(:center)\n self\n end",
"def card7(player)\n player.position = 15 if player.position == 7\n player.position = 25 if player.position == 22\n player.position = 5 if player.position == 36\n end",
"def second_player\n singles_player_of_team second_team\n end",
"def player_win\n @player_win += 1\n end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def game; end",
"def get_object\n next_x = @cur_x + DIRECTION[@hero_direction][0]\n next_y = @cur_y + DIRECTION[@hero_direction][1]\n return if next_x < 0 || next_x > 14 || next_y < 0 || next_y > 14\n #look at new square in room\n next_square = @room[next_x][next_y]\n if next_square == CHAR_POTION || next_square == CHAR_CHEST || next_square == CHAR_IDOL\n @room[next_x][next_y] = CHAR_FLOOR\n draw_map(next_x,next_y)\n @potions += 1 if next_square == CHAR_POTION\n @treasure += 1 if next_square == CHAR_CHEST\n @idol_found = true if next_square == CHAR_IDOL\n @stats[:experience] += 0.25\n end\n end",
"def winner\n @position.each do |pl, pos|\n if pos >= @length\n pl\n end\n end\n end",
"def num_squares\n self.size ** 2\n end",
"def player_places_piece!(brd)\n square = ''\n loop do\n prompt \"Choose a square (#{empty_squares(brd).join(', ')}):\"\n square = gets.chomp.to_i\n break if empty_squares(brd).include?(square)\n prompt \"Sorry, that's not a valid choice\"\n end\n\n brd.position_values[square] = Board::PLAYER_MARKER\n end",
"def player1_score\n player_hand.inject(0){|sum,n| sum + n.value }\n end",
"def remove(square)\n piece_type = pieces[square]\n\n return nil unless piece_type\n\n mask = BB_SQUARES[square]\n\n if piece_type == PAWN\n @pawns = @pawns ^ mask\n elsif piece_type == KNIGHT\n @knights = @knights ^ mask\n elsif piece_type == BISHOP\n @bishops = @bishops ^ mask\n elsif piece_type == ROOK\n @rooks = @rooks ^ mask\n elsif piece_type == QUEEN\n @queens = @queens ^ mask\n else\n @kings = @kings ^ mask\n end\n\n color = ((@occupied_co[BLACK] & mask).to_boolean).to_i\n @pieces[square] = nil\n @occupied = @occupied ^ mask\n @occupied_co[color] = @occupied_co[color] ^ mask\n @occupied_l90 = @occupied_l90 ^ BB_SQUARES[SQUARES_L90[square]]\n @occupied_r45 = @occupied_r45 ^ BB_SQUARES[SQUARES_R45[square]]\n @occupied_l45 = @occupied_l45 ^ BB_SQUARES[SQUARES_L45[square]]\n\n # Update incremental zobrist hash.\n if color == BLACK\n piece_index = (piece_type - 1) * 2\n else\n piece_index = (piece_type - 1) * 2 + 1\n end\n\n @incremental_zobrist_hash = @incremental_zobrist_hash ^ Zobrist::POLYGLOT_RANDOM_ARRAY[64 * piece_index + 8 * rank_index(square) + file_index(square)]\n end",
"def reset_values\n @pot_size = 0\n @committed = 0\n @table_current_bet = 0\n @stage_of_play = 0\n @active_players = @player_positions.clone\n @active_players.each do |player|\n player.hole_cards = []\n player.folded = false\n player.current_bet = 0\n player.max_winnings = 0\n player.max_pot = 0\n player.acted = false\n player.strongest_hand = []\n end\nend",
"def square(num) #I calculate a simple method for calculating squares (after I will need it)\n return num * num\n end",
"def play_some_moves(game)\n first_player = game.active_player\n second_player = game.inactive_player\n size = game.board_size\n moves = [size + 1, 2*size - 2, 3*size + 1, 4*size - 2]\n\n i = 0\n 2.times do\n [first_player, second_player].each do |player|\n game.new_move(moves[i], player)\n i += 1\n end\n end\nend",
"def addStat(array,stats,position,index)\n for player in array\n if player[4] == position\n if (position == \"G\" && index == 11)\n player[player.length-1] -= ((player[index].to_f - stats[0]) / stats[1])\n elsif (position != \"G\" && index != 9)\n player[player.length-1] += ((player[index].to_f - stats[0]) / stats[1])\n elsif (position == \"G\")\n player[player.length-1] += ((player[index].to_f - stats[0]) / stats[1])\n end\n end\n end\nend",
"def update_board\n\t\[email protected] do |spot|\n\t\t\tspot[1] = @empty\n\t\tend\n\t\[email protected] do |spot|\n\t\t\[email protected] do |pieces|\n\t\t\t\tpieces.each do |piece| # should update board with token positions\n\t\t\t\t\tspot[1] = piece if spot[0] == piece.position\n\t\t\t\tend\n\t\t\tend\n\t\t\[email protected] do |pieces|\n\t\t\t\tpieces.each do |piece| # should update board with token positions\n\t\t\t\t\tspot[1] = piece if spot[0] == piece.position\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def earn_point(player)\n player ==1 ? @player_2_wins += 1 : @player_1_wins +=1\nend",
"def initialize(num, name) #we are settig up an internal variable, piece, in the class Player\n\t\t@piece=num #the piece variable is defined as the player number, either 1 or 2\n\tend"
] | [
"0.6812742",
"0.63719916",
"0.6311631",
"0.6311631",
"0.6311631",
"0.6311631",
"0.6311631",
"0.6311631",
"0.6311631",
"0.6172656",
"0.6126217",
"0.59996766",
"0.5917214",
"0.5870132",
"0.58673096",
"0.58257437",
"0.5803733",
"0.57907677",
"0.5785401",
"0.5750422",
"0.5743899",
"0.57321864",
"0.57214856",
"0.5701882",
"0.56899774",
"0.5688256",
"0.56846225",
"0.56504774",
"0.5649517",
"0.5643432",
"0.5642005",
"0.56325",
"0.5628525",
"0.56198156",
"0.561203",
"0.5602904",
"0.56005293",
"0.5599299",
"0.559042",
"0.55894625",
"0.558077",
"0.5560939",
"0.5551295",
"0.55365753",
"0.5535815",
"0.55322355",
"0.55317104",
"0.5531383",
"0.55266815",
"0.5526631",
"0.5524701",
"0.5524701",
"0.5517499",
"0.5517404",
"0.5511183",
"0.5507719",
"0.5492052",
"0.54901147",
"0.5489322",
"0.54746455",
"0.5470021",
"0.54691046",
"0.5468728",
"0.5465311",
"0.54617447",
"0.5461073",
"0.54583466",
"0.54552513",
"0.5450287",
"0.5446393",
"0.544175",
"0.54414666",
"0.54403377",
"0.5440174",
"0.54399145",
"0.5437314",
"0.5434297",
"0.54334354",
"0.54210854",
"0.5419228",
"0.5416874",
"0.541646",
"0.541646",
"0.541646",
"0.541646",
"0.541646",
"0.54162073",
"0.54162073",
"0.54109734",
"0.54046744",
"0.5404297",
"0.5400946",
"0.53989464",
"0.5393889",
"0.5388497",
"0.53875124",
"0.5384198",
"0.5383174",
"0.53748184",
"0.53709024",
"0.5364503"
] | 0.0 | -1 |
duplicate of Square :marker accessor, but serves different use. Chose only to make this a reader, since don't need writer | def initialize(marker)
@marker = marker
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_marker\n return @marker\n end",
"def get_marker\n return @marker\n end",
"def get_marker\n return @marker\n end",
"def []=(key, marker)\n @squares[key].marker = marker #change the square marker of that particular square object\n end",
"def get_marker\n return @marker\n end",
"def get_marker\n return @marker\n end",
"def get_marker\n return @marker\n end",
"def []=(key, marker)\n @squares[key].marker = marker\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares) # => we wish this method existed\n return squares.first.marker # => return the marker, whatever it is\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares) # => we wish this method existed\n return squares.first.marker # => return the marker, whatever it is\n end\n end\n nil\n end",
"def []=(num, marker)\n @squares[num].marker = marker\n end",
"def initialize(marker = INITIAL_MARKER)\n @marker = marker # will reveal the state of each square. Whether it has been marked or is empty\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n return squares.first.marker if three_identical_markers?(squares)\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if identical_markers?(3, squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def []=(num, marker)\n squares[num].marker = marker\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n markers = squares.map(&:marker)\n return markers[0] if markers.uniq.size == 1 && squares[0].marked?\n end\n nil\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker # return the corresponding detected marker\n end\n end\n nil\n end",
"def at_risk_square(marker)\n unmarked_square = nil\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if threatened_row?(squares, marker)\n line.each do |square|\n if @squares[square].unmarked?\n unmarked_square = square\n end\n end\n end\n end\n unmarked_square\n end",
"def winning_marker\n WINNING_COMBOS.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil\n end",
"def get_marker()\r\n center = Geom::Point3d.new(0, 0, 0)\r\n rotate_around_vector = Geom::Vector3d.new(0, 0, 1)\r\n angle = 14.4.degrees\r\n tr = Geom::Transformation.rotation(center, rotate_around_vector, angle)\r\n vector = Geom::Vector3d.new(@radius, 0, 0)\r\n 26.times.map {center + vector.transform!(tr) }\r\n end",
"def place_marker(spot, mark)\n board[spot - 1] = mark\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n line_markers = squares.values_at(*line).map(&:marker)\n next if line_markers.include?(Square::INITIAL_MARKER)\n return line_markers.first if line_markers.uniq.size == 1\n end\n\n nil\n end",
"def square_to_defend(marker)\r\n WINNING_LINES.each do |line|\r\n index_to_defend = find_blocking_square(@squares.values_at(*line), marker)\r\n return line[index_to_defend] if index_to_defend\r\n end\r\n nil\r\n end",
"def mark(marker)\n raise NotImplementedError\n end",
"def find_at_risk_square(line, board, marker)\n if board.position_values.values_at(*line).count(marker) == 2\n mark = board.position_values.select { |k, v| line.include?(k) && v == Board::INITIAL_MARKER }\n mark.keys.first\n end\n end",
"def get_marker_properties(marker) # :nodoc:\n return unless marker\n\n types = {\n :automatic => 'automatic',\n :none => 'none',\n :square => 'square',\n :diamond => 'diamond',\n :triangle => 'triangle',\n :x => 'x',\n :star => 'start',\n :dot => 'dot',\n :short_dash => 'dot',\n :dash => 'dash',\n :long_dash => 'dash',\n :circle => 'circle',\n :plus => 'plus',\n :picture => 'picture'\n }\n\n # Check for valid types.\n marker_type = marker[:type]\n\n if marker_type\n marker[:automatic] = 1 if marker_type == 'automatic'\n marker[:type] = value_or_raise(types, marker_type, 'maker type')\n end\n\n # Set the line properties for the marker..\n line = get_line_properties(marker[:line])\n\n # Allow 'border' as a synonym for 'line'.\n line = get_line_properties(marker[:border]) if marker[:border]\n\n # Set the fill properties for the marker.\n fill = get_fill_properties(marker[:fill])\n\n marker[:_line] = line\n marker[:_fill] = fill\n\n marker\n end",
"def markOrigin(ox, oy, oz)\n t = df.map_tile_at(ox, oy, oz)\n if t then\n s = t.shape_basic\n #TODO: preseve designation:\n #$originTile = t.designation # a global to store the original origin state\n #puts \"origin: #{$originTile}\"\n t.dig(:Default) if s == :Wall\n end\nend",
"def winning_marker\r\n WINNING_LINES.each do |line|\r\n winning_marker = check_for_winning_marker(@squares.values_at(*line))\r\n return winning_marker if winning_marker\r\n end\r\n nil\r\n end",
"def winning_marker # iterate through winning lines, and see if square\n # in each 3 elements in 'line' array match the human marker\n # or computer marker, if so return that marker, if no match return nil\n WINNING_LINES.each do |line|\n # line is 3 element arr representing winning line\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker\n end\n end\n nil # if we dno't put this, then .each will return array\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n line_squares = squares.values_at(*line)\n next if line_squares.any?(&:unmarked?)\n markers = line_squares.map(&:marker)\n return markers.first if winner?(markers)\n end\n nil\n end",
"def isMine(x,y)\n @squares[x][y] == MINE_MARKER\n end",
"def marks; end",
"def map_marker\n=begin\n kita_icon = GIcon.new(:image => \"/images/red-dot.png\",\n :shadow => \"/images/shadow.png\",\n :shadow_size => GSize.new(49,32),\n :icon_anchor => GPoint.new(16,32))\n=end\n GMarker.new([self.lat, self.lng], :title => \"#{self.name}\", :info_window => \"\n <p> <b>#{self.name}</b><br />#{self.street}<br />#{self.country_code}-#{self.zip} #{self.city} </p>\n <p><a href='/kitas/#{self.id}'>Mehr Details...</a></p>\n \")\n end",
"def winning_marker\n WINNING_LINES.each do |line|\n full_line_mark = full_line_check(@squares.values_at(*line))\n next if full_line_mark.nil?\n return full_line_mark\n end\n nil\n end",
"def finish_coords\n marker_coords('F')\n end",
"def []=(pos, mark)\n raise \"mark already placed there!\" unless empty?(pos)\n \n row, col = pos[0], pos[1]\n @rows[row][col] = mark\n end",
"def write_marker_value # :nodoc:\n style = @default_marker\n\n return unless style\n\n attributes = ['val', 1]\n\n @writer.empty_tag('c:marker', attributes)\n end",
"def offset; end",
"def offset; end",
"def offset; end",
"def setmarkersize(*)\n super\n end",
"def read_next()\n return nil if @at_end\n\n begin\n pos = @marker.position\n\n if @marker.character == ?\\n\n pos.line += 1\n pos.column = 0\n end\n\n @marker.character = @reader.next\n @marker.source_index += 1\n pos.column += 1\n rescue StopIteration\n @at_end = true\n @marker.character = nil\n end\n\n @marker.character\n end",
"def two_empty_in_line(marker)\n initial = Square::INITIAL_MARKER\n check_lines_for_constellation(marker, initial, initial)\n end",
"def initialize\n @squares = {} # call it @squares since a Board will be composed of squares with individual states\n reset # RESET METHOD INSERTS A HASH INTO @square\n # want to set it to an Square object with marker attribute / value of INITIAL_MARKER, instead of just directly setting it to INITIAL_MARKER.\n end",
"def initialize_ISG_marker(uid)\n\t\t\t# create dictionary\n\t\t\t@dict = self.attribute_dictionary 'IterativeSG', true\n\t\t\t\n\t\t\t# UIDs are a bit different - when shape is copied, they should\n\t\t\t# not remain the same. So make sure to change them even if they exist.\n\t\t\tcurrent_uid = @dict.get_attribute 'IterativeSG', 'UID'\n\t\t\tif current_uid == nil\n\t\t\t\t@UID = uid\n\t\t\t\[email protected]_attribute 'IterativeSG', 'UID', uid\n\t\t\telse\n\t\t\t\tif Controller.UIDs.include? current_uid\n\t\t\t\t\t@UID = uid\n\t\t\t\t\[email protected]_attribute 'IterativeSG', 'UID', uid\n\t\t\t\telse\n\t\t\t\t\t@UID = current_uid\n\t\t\t\tend\n\t\t\tend\n\t\t\t# define current position for faster access\n\t\t\tself.update_shape\n\t\t\t\n\t\t\treturn @UID\n\t\tend",
"def start_coords\n marker_coords('S')\n end",
"def winnning_marker\n WINNING_POSITIONS.each do |line|\n if count_human_marker(@squares.values_at(*line)) == 3\n return TTTPlay::HUMAN_MARKER\n end\n if count_computer_marker(@squares.values_at(*line)) == 3\n return TTTPlay::COMPUTER_MARKER\n end\n end\n\n nil\n end",
"def marker_coords(marker)\n row = @grid.find_index { |x| x.include?(marker) }\n col = @grid[row].index(marker)\n\n [col, row]\n end",
"def critical_square(marker)\n initial = Square::INITIAL_MARKER\n check_lines_for_constellation(initial, marker, initial)\n end",
"def detect_marker\n WINNING_LINES.each do |line|\n if count_human_marker(@squares.values_at(*line)) == 3\n return TTTGame::HUMAN_MARKER\n elsif count_computer_marker(@squares.values_at(*line)) == 3\n return TTTGame::COMPUTER_MARKER\n end\n end\n nil\n end",
"def same_place\n\t\tStrike.where(lat: lat, lon:lon)\n\tend",
"def initialize(name, marker)\r\n @name = name\r\n @marker = marker\r\n end",
"def coordinate \n @coordinate\n end",
"def addMarker marker\n @slots[NUMBER_OF_SLOTS-1].content = marker\n i = (NUMBER_OF_SLOTS) -1\n while i != 0 && @slots[i-1].content == \" \" do\n sink i \n i -= 1\n end\n i\n end",
"def initialize(marker)\r\n\t\t@marker = marker # the @ symbol is an instance variable that can be used anywhere within the instance of the class\r\n\tend",
"def mark_positions(positions, marker)\n positions.each do |position|\n @board[position[1]][position[0]] = marker\n end\n end",
"def offset(*) end",
"def markerShape _args\n \"markerShape _args;\" \n end",
"def gen_marker(marker)\n marker.lat object.latitude\n marker.lng object.longitude\n link = h.link_to object.title, object\n info = \"#{link}<br>#{short_details}\"\n marker.infowindow info\n end",
"def setmarkercolorind(*)\n super\n end",
"def locate_marks side, image, extent\n d_write_image image\n#\n# Look at a rectangle each of the ends of the bands. Rect1 is one end, Rect2 is the other end.\n#\n rect1segments = Array.new\n if side == :top\n detect_marks image, 0, 0, i2p(EndRectSize), i2p(extent), :left, \n SideBandThresh, :columns, i2p(MinMarkHeight), :rect1, rect1segments, \"top\" \n elsif side == :left\n detect_marks image, 0, 0, i2p(extent), i2p(EndRectSize), :up,\n ThreshLeft1, :rows, i2p(MinMarkWidth), :rect1, rect1segments, \"left\" \n elsif side == :right\n detect_marks image, columns(image) - i2p(extent), 0, i2p(extent), i2p(EndRectSize), :up, \n ThreshRight1, :rows, i2p(MinMarkWidth), :rect1, rect1segments, \"right\" \n end\n return LocateMarks.new(BPoint.nil, BPoint.nil, 0.0) if rect1segments.length != 1\n\n rect2segments = Array.new\n if side == :top\n detect_marks image, columns(image) - i2p(EndRectSize), 0, i2p(EndRectSize), i2p(EndRectSize), :left, \n SideBandThresh, :columns, i2p(MinMarkHeight), :rect2, rect2segments, \"top\" \n elsif side == :left\n detect_marks image, 0, rows(image) - i2p(EndRectSize), i2p(extent), i2p(EndRectSize), :up, \n ThreshLeft2, :rows, i2p(MinMarkWidth), :rect2, rect2segments, \"left\" \n elsif side == :right\n detect_marks image, columns(image) - i2p(extent), rows(image) - i2p(EndRectSize), i2p(extent), i2p(EndRectSize), :up, \n ThreshRight2, :rows, i2p(MinMarkWidth), :rect2, rect2segments, \"right\" \n end\n return LocateMarks.new(BPoint.nil, BPoint.nil, 0.0) if rect2segments.length == 0\n#\n# Now project the timing marks to the top (or side) to figure out the offsets in the other direction.\n#\n rect3segments = Array.new\n if side == :top\n detect_marks image, 0, 0, columns(image), i2p(extent), :up, \n ThreshTop3, :rows, i2p(MinMarkWidth), :rect3, rect3segments, \"top\" \n elsif side == :left\n detect_marks image, 0, 0, i2p(extent), rows(image), :left, \n ThreshLeft3, :columns, i2p(MinMarkHeight), :rect3, rect3segments, \"left\" \n elsif side == :right\n detect_marks image, columns(image) - i2p(extent), 0, i2p(extent), rows(image), :left, \n LongSideThresh, :columns, i2p(MinMarkHeight), :rect3, rect3segments, \"right\" \n end\n d_write_image :rect3\n \n if side == :top\n # Compute the midpoint of the first timing mark\n origin = BPoint.new(rect3segments[0][0], rect1segments[0][0])\n origin_prime = BPoint.new(rect3segments[0][0], rect1segments[0][1])\n firstmarkmidpoint = BLine.new(origin, origin_prime).mid\n \n # Compute the midpoint of the last timing mark\n terminal = BPoint.new(rect3segments[-1][0], rect2segments[0][0])\n terminal_prime = BPoint.new(rect3segments[-1][0], rect2segments[0][1])\n secondmarkmidpoint = BLine.new(terminal, terminal_prime).mid\n rotation_angle = BPoint.angle(firstmarkmidpoint, secondmarkmidpoint)\n\n# Have a headache yet? Detailed arithmetic is different (signs etc.) depending on side\n \n elsif side == :left \n\n # Compute the midpoint of the first timing mark\n origin = BPoint.new(rect1segments[0][0], rect3segments[0][0])\n origin_prime = BPoint.new(rect1segments[0][1], rect3segments[0][0])\n firstmarkmidpoint = BLine.new(origin, origin_prime).mid\n \n # Compute the midpoint of the last timing mark\n terminal = BPoint.new(rect2segments[0][0], rect3segments[-1][0])\n terminal_prime = BPoint.new(rect2segments[0][1], rect3segments[-1][0])\n secondmarkmidpoint = BLine.new(terminal, terminal_prime).mid\n rotation_angle = (BPoint.angle(firstmarkmidpoint, secondmarkmidpoint) - 90.0).modulo 90.0\n\n elsif side == :right\n\n # Compute the midpoint of the first timing mark\n origin = BPoint.new(rect1segments[-1][0], rect3segments[0][0])\n origin_prime = BPoint.new(rect1segments[-1][1], rect3segments[0][0])\n firstmarkmidpoint = BLine.new(origin, origin_prime).mid\n \n # Compute the midpoint of the last timing mark\n terminal = BPoint.new(rect2segments[-1][0], rect3segments[-1][0])\n terminal_prime = BPoint.new(rect2segments[-1][1], rect3segments[-1][0])\n secondmarkmidpoint = BLine.new(terminal, terminal_prime).mid\n rotation_angle = (BPoint.angle(firstmarkmidpoint, secondmarkmidpoint) - 90.0).modulo 90.0\n#\n# unlike the left and top, on the right the origin of the first mark is not the origin of the page. We need \n# to compensate for the distance between the page's actual origin and where the right marks are, by using the\n# known distance between the timing marks along the top and the space between then and how many there are.\n#\n origin.x = origin.x + columns(image) - i2p(extent)\n terminal.x = terminal.x + columns(image) - i2p(extent)\n end\n return LocateMarks.new(origin, terminal, rotation_angle)\n end",
"def polymarker(x, y)\n n = equal_length(x, y)\n super(n, x, y)\n end",
"def new_marker\n marker_counter.succ!\n marker_tags = []\n \n marker_icon = icon_chooser\n marker_name = \"mrk_#{marker_counter}\"\n marker_tags << marker_icon\n \n tags {|tag| marker_tags << tag}\n\n info = build_node.gsub(\"\\n\", \"<br />\").minified!\n marker_nodes << %{<p id=\"#{marker_name}\">#{info}</p>}\n\n rtn = {:name => marker_name, :icon => marker_icon, :tags => marker_tags}\n rtn[:uniq] = marker_unique_by if marker_unique_by\n rtn\n end",
"def set_marker\n @marker = Marker.find(params[:id])\n end",
"def set_marker\n @marker = Marker.find(params[:id])\n end",
"def inqmarkercolorind\n inquiry_int { |pt| super(pt) }\n end",
"def to_point\n Straightedge::Mark.new(*self)\n end",
"def write_marker_value # :nodoc:\n return unless @default_marker\n\n @writer.empty_tag('c:marker', [['val', 1]])\n end",
"def set_current_marker\n @current_marker = if player_goes_first?\n human.marker\n else\n computer.marker\n end\n end",
"def mark; end",
"def inqmarkersize\n inquiry_double { |pt| super(pt) }\n end",
"def inqmarkersize\n inquiry_double { |pt| super(pt) }\n end",
"def markerPos _args\n \"markerPos _args;\" \n end",
"def instinct(marker)\n Game::WINNING_LINES.each do |the_line|\n if board.squares.values_at(*the_line).count(marker) == 2 && board.squares.values_at(*the_line).count(' ') == 1\n the_line.each {|e| (board.squares[e] == ' ') ? board.squares[e] = 'o' : e }\n board.draw_board\n break\n end\n end\n end",
"def set_marker\n @marker = Marker.find(params[:id])\n end",
"def set_marker\n @marker = Marker.find(params[:id])\n end",
"def keyword_pins; end",
"def polymarker(x, y, markersize = nil, marker_z = nil)\n # GR.jl - Multiple dispatch\n n = equal_length(x, y)\n if markersize.nil? && marker_z.nil?\n super(n, x, y)\n else\n markersize ||= GR.inqmarkersize\n markersize = if markersize.is_a?(Numeric)\n Array.new(n, markersize * 100)\n else\n raise ArgumentError if n != markersize.length\n\n markersize.map { |i| (100 * i).round }\n end\n marker_z ||= GR.inqcolor(989) # FIXME\n color = if marker_z.is_a?(Numeric)\n Array.new(n, marker_z)\n else\n raise ArgumentError if n != marker_z.length\n\n to_rgb_color(marker_z)\n end\n z = markersize.to_a.zip(color).flatten # to_a : NArray\n gdp(x, y, GDP_DRAW_MARKERS, z)\n end\n end",
"def test_enumerable_canyon\n initialize_map\n enumerable_canyon = @locations.get_location 'Enumerable Canyon'\n assert_equal 'Enumerable Canyon', enumerable_canyon.name_reader\n\n assert_equal 1, enumerable_canyon.max_real_reader\n assert_equal 1, enumerable_canyon.max_fake_reader\n\n assert_equal 'Duck Type Beach', enumerable_canyon.neighbors_reader[0].name_reader\n assert_equal 'Monkey Patch City', enumerable_canyon.neighbors_reader[1].name_reader\n end",
"def set_mark(pos, mark)\n\t row, col = to_row_col(pos)\n\t return if row.nil? || col.nil?\n\t @grid[row][col] = mark\n\tend",
"def place_mark(pos, mark)\n\n if valid?(pos) && empty?(pos)\n self[pos] = mark\n return mark\n else \n raise \"invalid mark\"\n end\n\n end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def position; end",
"def cell(loc)\n @map[loc]\n end",
"def locatinator(x, y)\n y_out = row_case(y)\n x_out = col_case(x)\n place_marker(x_out, y_out)\n end"
] | [
"0.65842634",
"0.65842634",
"0.65842634",
"0.644567",
"0.6426597",
"0.6426597",
"0.6426597",
"0.6364895",
"0.62984973",
"0.62589914",
"0.6137002",
"0.6110005",
"0.6100135",
"0.6004452",
"0.6003919",
"0.59839374",
"0.59839374",
"0.59839374",
"0.59839374",
"0.59839374",
"0.59839374",
"0.59839374",
"0.59839374",
"0.59026027",
"0.5901336",
"0.5876537",
"0.58145535",
"0.5763395",
"0.5730704",
"0.5697584",
"0.5687425",
"0.5644706",
"0.5587605",
"0.5579513",
"0.557912",
"0.5536281",
"0.55036247",
"0.5488734",
"0.5462912",
"0.53803253",
"0.537212",
"0.5358949",
"0.5354907",
"0.53453463",
"0.5313958",
"0.52920574",
"0.5273258",
"0.5273258",
"0.5273258",
"0.5263685",
"0.5262406",
"0.5257673",
"0.52443653",
"0.5240309",
"0.52375305",
"0.523433",
"0.522256",
"0.5216454",
"0.52132654",
"0.52068496",
"0.5201548",
"0.5201441",
"0.5182232",
"0.51779574",
"0.5161366",
"0.5159428",
"0.5152911",
"0.51521",
"0.51448256",
"0.5142031",
"0.51409924",
"0.51386565",
"0.51171356",
"0.51171356",
"0.51022285",
"0.5088814",
"0.5079815",
"0.50506663",
"0.5046994",
"0.5043714",
"0.5043714",
"0.50383735",
"0.5029591",
"0.501501",
"0.501501",
"0.50054926",
"0.49870208",
"0.4982496",
"0.49767146",
"0.4975344",
"0.49600184",
"0.49600184",
"0.49600184",
"0.49600184",
"0.49600184",
"0.49600184",
"0.49600184",
"0.49600184",
"0.49497402",
"0.49484915"
] | 0.5576398 | 35 |
ENDPOINTS FOR APP BAR | def check_for_user
if current_user
@user = current_user
else
@user = {}
end
render json: @user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def endpoints; end",
"def endpoint; end",
"def endpoint; end",
"def endpoint; end",
"def endpoint; end",
"def rest_endpoint; end",
"def service_endpoint; end",
"def service_endpoint; end",
"def endpoints_list\n get \"endpoints\"\n end",
"def apis; end",
"def api_endpoint\n 'index'\n end",
"def get_endpoint()\n end",
"def platform_endpoint; end",
"def index\n endpoint(get(services_url).body)\n end",
"def rest_endpoint=(_arg0); end",
"def app data={}\n get '/app', data\n end",
"def endpoints\n @endpoints ||= init_endpoints\n end",
"def app_endpoint(app_id)\n \"#{FABRIC_APPS_ENDPOINT}/#{app_id}\"\n end",
"def app_endpoint(app_id)\n \"#{FABRIC_APPS_ENDPOINT}/#{app_id}\"\n end",
"def platform_availability_endpoints\n PlatformAvailabilityEndpointsController.instance\n end",
"def api; end",
"def api; end",
"def api_endpoint\n case current_user.environment\n when 'int', 'integration'\n 'http://newapi.int.brandwatch.com'\n when 'rel', 'release', 'stage'\n 'http://newapi.rel.brandwatch.com'\n else\n 'http://newapi.brandwatch.com'\n end\n end",
"def custom_endpoints\n data[:custom_endpoints]\n end",
"def endpoint\n @endpoint ||= 'https://rest.avalara.net'\n end",
"def index\n respond_with ApidDriver.all\n end",
"def list_endpoints\n render json: @endpoints, status: 200\n end",
"def endpoints\n @endpoints ||= []\n end",
"def rest_end_point; end",
"def tag_data_endpoints\n TagDataEndpointsController.instance\n end",
"def endpoint_url\n self.class::ENDPOINT\n end",
"def services\n end",
"def org_app_endpoint(organization_id, app_id)\n \"#{org_endpoint(organization_id)}#{app_endpoint(app_id)}\"\n end",
"def services\n\n end",
"def rest_token_endpoint; end",
"def endpoints\n EndpointRegistry[id]\n end",
"def merchant_endpoint; end",
"def list()\n puts \"Listing all endpoints\"\n load_manifest\n\n pp manifest.keys\n\n end",
"def set_endpoints\n @endpoints = Endpoint.where('client_tag like ?', \"%#{params[:client_tag]}%\")\n .where('name like ?', \"%#{params[:request_name]}%\")\n end",
"def api_endpoint=(value)\n @api_endpoint = value\n end",
"def platform_endpoint=(_arg0); end",
"def initialize app=nil\n @app = app\n\n self.class.endpoints.values.flatten.each do |endpoint|\n endpoint.action_handler ||= method :default_action\n endpoint.api_doc_handler ||= method :default_api_doc\n endpoint.error_handler ||= method :default_error\n endpoint.validation_error_handler ||= method :default_validation_error\n end\n end",
"def endpoint\n raise NotImplementedError\n end",
"def api(*endpoints)\n inject_to_api do |api|\n api.use(*Grape::OAuth2.middleware)\n api.helpers(Grape::OAuth2::Helpers::AccessTokenHelpers)\n\n (endpoints.presence || endpoints_mapping.keys).each do |name|\n endpoint = endpoints_mapping[name.to_sym]\n raise ArgumentError, \"Unrecognized endpoint: #{endpoint}\" if endpoint.nil?\n\n api.mount(endpoint)\n end\n end\n end",
"def api_only; end",
"def api_only; end",
"def api_only; end",
"def bi_service\n end",
"def api_endpoint\n @api_endpoint ||= DEFAULT_API_ENDPOINT\n end",
"def url_api\n Guidebox\n end",
"def get_endpoints()\n return {\n 'meta' => 'meta/all.json',\n 'headlines' => 'headline/all.json',\n 'schema' => 'meta/schema.json',\n 'reporting' => 'stats/reporting.json',\n 'disaggregation' => 'stats/disaggregation.json',\n 'translations' => 'translations/translations.json',\n 'zip' => 'zip/all_indicators.json',\n 'indicator_downloads' => 'downloads/indicator-downloads.json',\n 'data_packages' => 'data-packages/all.json',\n }\n end",
"def get_endpoints()\n return {\n 'meta' => 'meta/all.json',\n 'headlines' => 'headline/all.json',\n 'schema' => 'meta/schema.json',\n 'reporting' => 'stats/reporting.json',\n 'disaggregation' => 'stats/disaggregation.json',\n 'translations' => 'translations/translations.json',\n 'zip' => 'zip/all_indicators.json',\n 'indicator_downloads' => 'downloads/indicator-downloads.json',\n 'data_packages' => 'data-packages/all.json',\n }\n end",
"def custom_setup(args)\n if(args[:api_endpoint].to_s.end_with?('/'))\n args[:api_endpoint] = args[:api_endpoint][0, endpoint.length - 1]\n end\n end",
"def application\n 'api.your-domain.com'\nend",
"def endpoint_types\n %w()\n end",
"def endpoint\n raise StandardError, 'Please implement this method.'\n end",
"def endpoint\n raise StandardError, 'Please implement this method.'\n end",
"def api_uri\n options.endpoint\n end",
"def index\n @rest_apis = RestApi.all\n end",
"def api_object\n unless $api\n $api = FyberAPI.new(\n 'b07a12df7d52e6c118e5d47d3f9e60135b109a1f',\n {\n appid: 157,\n format: 'json',\n device_id: '2b6f0cc904d137be2e1730235f5664094b83',\n locale: 'de',\n ip: '109.235.143.113'\n }\n )\n end\n $api\n end",
"def api_endpoint\n @api_endpoint ||= ENDPOINTS[:sandbox][:api]\n end",
"def api(params = {})\n Celluloid::Logger.info \"Registering api...\"\n self.use_api = true\n self.api_host = params[:host] || '127.0.0.1'\n self.api_port = params[:port] || '4321'\n end",
"def rest_token_endpoint=(_arg0); end",
"def base_href\n '/api/v1'\n end",
"def pods\n\nend",
"def index\n apis = site_account.api_docs_services\n .published\n .with_system_names((params[:services] || \"\").split(\",\"))\n .select{ |api| api.specification.swagger_1_2? }\n\n respond_with({\n swaggerVersion: \"1.2\",\n apis: apis.map!{ |service| swagger_spec_for(service) },\n basePath: \"#{request.protocol}#{request.host}\"\n })\n end",
"def endpoint\n @endpoint||= \"#{@scheme}://#{@host}#{@path}\"\n end",
"def endpoint_url\n # @@api_base + @request.endpoint\n ApiBase + @endpoint\n end",
"def endpoint\n @endpoint || YodleeApi.endpoint\n end",
"def endpoint\n @endpoint || YodleeApi.endpoint\n end",
"def endpoint\n @endpoint || YodleeApi.endpoint\n end",
"def getApiEndpoint(endpoint)\n \n apiRegion = $drugbank_region\n\n if $drugbank_region != \"\"\n apiRegion = apiRegion + \"/\"\n end\n\n return apiRegion + endpoint\n\nend",
"def api_base_path\n 'https://messaging.bandwidth.com/api/v2'\n end",
"def app; @app; end",
"def endpoint\n ENV[\"CHEF_API_ENDPOINT\"] || config[\"CHEF_API_ENDPOINT\"] || ENDPOINT\n end",
"def booking_api\n :ride_pilot\n end",
"def interfaces_list\n\t\t[\n\t\t\t{\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'purpose' => 'REST API Structure and Capability Discovery'\n\t\t\t}\n\t\t]\n\tend",
"def base_path\n \"/api/v1\"\n end",
"def command_uri\n return \"/api_#{@command_name}.php\"\n end",
"def endpoints\n unless @endpoints_collected\n @endpoints += get_missing(\"endpoints\")\n @endpoints_collected = true\n end\n\n @endpoints\n end",
"def endpoint\n ENDPOINT[server]\n end",
"def registered_services\n ENDPOINT_INSTANCES.keys\n end",
"def coreApiEP\n\t\tCORE_API_URL_83\n\tend",
"def org_app_endpoint(session, app_id)\n \"#{org_endpoint(session)}#{app_endpoint(app_id)}\"\n end",
"def api_keys; rest_query(:api_key); end",
"def api_keys; rest_query(:api_key); end",
"def api_endpoint\n Solusvm.api_endpoint.dup\n end",
"def endpoint\n options.endpoint\n end",
"def api_method\n ''\n end",
"def tag_verification_endpoints\n TagVerificationEndpointsController.instance\n end",
"def get_applist\n return get_response(\"applist\", :json)\n end",
"def call env\n #load File.join(LIB_ROOT, \"kepi/api.rb\")\n path, show_api = parse_path_api env['PATH_INFO']\n endpoint = find_endpoint env['REQUEST_METHOD'], path\n\n if endpoint\n env['PATH_INFO'] = path\n response(*endpoint.call(env, show_api))\n\n elsif env['PATH_INFO'] == self.class.api_doc_path\n api_response\n\n elsif @app\n @app.call env\n\n else\n undefined_response env\n end\n end",
"def sharedPods\n\nend",
"def list_applications(client)\n client.applications.each do |application|\n puts \"Application: #{application.name}\"\n puts \" Description: #{application.description}\"\n puts \" Status: #{application.status}\"\n puts \" Href: #{application.href}\"\n end \nend",
"def endpoint\n data[:endpoint]\n end",
"def endpoint\n data[:endpoint]\n end",
"def api\n @api\n end",
"def app\n APIServer::Application\nend",
"def index\n @apis = Api.all\n end",
"def host\n 'petstore.swagger.io'\n end",
"def operations\n # Base URI works as-is.\n end"
] | [
"0.7095638",
"0.6529525",
"0.6529525",
"0.6529525",
"0.6529525",
"0.65152955",
"0.6515103",
"0.6515103",
"0.6485747",
"0.6479891",
"0.64658314",
"0.6373478",
"0.62741446",
"0.6073983",
"0.5992554",
"0.597984",
"0.59766763",
"0.59711814",
"0.59711814",
"0.585802",
"0.5850785",
"0.5850785",
"0.5839006",
"0.58269304",
"0.58128023",
"0.5812327",
"0.58106405",
"0.58100116",
"0.58065057",
"0.5780751",
"0.5777976",
"0.576297",
"0.5761329",
"0.57331973",
"0.572332",
"0.5721995",
"0.57166404",
"0.56812865",
"0.5664307",
"0.56586385",
"0.5650864",
"0.5645468",
"0.56392074",
"0.5624801",
"0.5623941",
"0.5623941",
"0.5623941",
"0.5620579",
"0.5619818",
"0.56116754",
"0.55932325",
"0.55932325",
"0.5577237",
"0.557301",
"0.5564542",
"0.5558717",
"0.5558717",
"0.55561",
"0.55540186",
"0.5548489",
"0.55468667",
"0.55458724",
"0.5519388",
"0.55137336",
"0.5513106",
"0.5511245",
"0.54801077",
"0.547466",
"0.54643023",
"0.54643023",
"0.54643023",
"0.54636616",
"0.5448902",
"0.5443092",
"0.5438758",
"0.54363483",
"0.5432679",
"0.5429118",
"0.541919",
"0.54191864",
"0.5418503",
"0.54138875",
"0.5380907",
"0.53751206",
"0.53734577",
"0.53734577",
"0.53678614",
"0.5364944",
"0.53648895",
"0.5363814",
"0.535397",
"0.5352127",
"0.535081",
"0.5350311",
"0.534033",
"0.534033",
"0.53359467",
"0.5332688",
"0.5328414",
"0.53246236",
"0.53245896"
] | 0.0 | -1 |
ENDPOINTS FOR LANDING PAGE | def landing_search_data
@unsorted_data =[]
categories = Category.all
vendors = Vendor.all
organizations = Organization.all
s_s_categories = SuperSuperCategory.all
s_s_categories.each do |ssc|
s_s_category_hash = {
label: ssc.name + " (Umbrella Category)",
value: ssc.name + " (Umbrella Category)",
id: ssc.id,
type: "super_super_categories"
}
@unsorted_data << s_s_category_hash
end
categories.each do |c|
category_hash = {
label: c.suggestion_label,
value: c.suggestion_label,
id: c.id,
type: "categories"
}
@unsorted_data << category_hash
end
vendors.each do |v|
vendor_hash = {
label: v.name + " (Vendor Page)",
value: v.name + " (Vendor Page)",
id: v.id,
type: "vendors"
}
@unsorted_data << vendor_hash
end
organizations.each do |s|
organization_hash = {
label: s.name + " (School Page)",
value: s.name + " (School Page)",
id: s.id,
type: "organizations"
}
@unsorted_data << organization_hash
end
@data = @unsorted_data.sort{|a,b| a[:label]<=>b[:label]}
render json: @data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pages; end",
"def pages\n end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def page; end",
"def endpoints; end",
"def sample_page\n\n end",
"def page\n\n end",
"def route_index; end",
"def page_load; end",
"def index\n # seeker_result Site, \"div.site_list\" # , clear_tags: true\n response_service.title = 'Sites'\n smartrender \n end",
"def internal_links\n respond_with @page.internal_links\n end",
"def internal_links\n respond_with @page.internal_links\n end",
"def fetch\n self.get(:pages).each do |attributes|\n page = self.add(attributes['fullpath'], attributes)\n\n self.mounting_point.locales[1..-1].each do |locale|\n # if not translated, no need to make an api call for that locale\n next unless page.translated_in?(locale)\n\n Locomotive::Mounter.with_locale(locale) do\n localized_attributes = self.get(\"pages/#{page._id}\", locale)\n\n # remove useless non localized attributes\n localized_attributes.delete('target_klass_slug')\n\n # isolate the editable elements\n editable_elements = self.filter_editable_elements(localized_attributes.delete('editable_elements'))\n\n page.attributes = localized_attributes\n\n page.set_editable_elements(editable_elements)\n end\n end\n end\n end",
"def index\n #@long_pages = LongPage.all\n @long_pages = LongPage.all.page params[:page]\n end",
"def index\n @loadbalancers = getmydata(\"Loadbalancer\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loadbalancers }\n end\n end",
"def dashboard\n\n\tparams[:id] = session[:id] if params[:id].nil?\n\t@user = User.find_by_authentication_id(params[:id])\n\n\tif not @user.nil?\n\t\t@username = @user.name\n\t\t@company = @user.company\n\telse\n\t\t@username = \"Demo\"\n\t\t@company = \"Clicktree\"\n\tend\n\n\tdomain = params[:api_domain]\n\tif domain == \"picturegram\"\n\t\t@api_domain = \"Picturegram\"\n\n\t\t@api_title1 = \"Front Page\"\n\t\t@api_maindesc1 = \"This API call returns pictures which are currently on the front page.\"\n\t\t@raw_request1 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/picturegram/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=frontpage'\n\t\traw_response = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 40}, \"objects\": [{\"index\": 0, \"thumbnail_href\": \"/picture/695989882920892158_50599348/\"}, {\"index\": 1, \"thumbnail_href\": \"/picture/695964974116033434_179149915/\"}, {\"index\": 2, \"thumbnail_href\": \"/picture/695977429678748736_403498132/\"}, {\"index\": 3, \"thumbnail_href\": \"/picture/695993756213785472_7930203/\"}, {\"index\": 4, \"thumbnail_href\": \"/picture/695983326619607782_31624199/\"}, {\"index\": 5, \"thumbnail_href\": \"/picture/696006278083124060_23776413/\"}, {\"index\": 6, \"thumbnail_href\": \"/picture/695998807090494678_18483678/\"}, {\"index\": 7, \"thumbnail_href\": \"/picture/695998437887702553_185175380/\"}, {\"index\": 8, \"thumbnail_href\": \"/picture/696006091523367043_207789231/\"}, {\"index\": 9, \"thumbnail_href\": \"/picture/696027666809693694_29810584/\"}, {\"index\": 10, \"thumbnail_href\": \"/picture/695970965669018824_47543070/\"}, {\"index\": 11, \"thumbnail_href\": \"/picture/696007751922471837_13514211/\"}, {\"index\": 12, \"thumbnail_href\": \"/picture/696012216974527626_453366618/\"}, {\"index\": 13, \"thumbnail_href\": \"/picture/695998741751055102_1241458119/\"}, {\"index\": 14, \"thumbnail_href\": \"/picture/696025760104333970_25435655/\"}, {\"index\": 15, \"thumbnail_href\": \"/picture/696006627359974363_144646783/\"}, {\"index\": 16, \"thumbnail_href\": \"/picture/696032044517635611_689484300/\"}, {\"index\": 17, \"thumbnail_href\": \"/picture/695981822177767557_185480571/\"}, {\"index\": 18, \"thumbnail_href\": \"/picture/696013274787432577_32527641/\"}, {\"index\": 19, \"thumbnail_href\": \"/picture/696031340508489644_19870776/\"}, {\"index\": 20, \"thumbnail_href\": \"/picture/695989882920892158_50599348/\"}, {\"index\": 21, \"thumbnail_href\": \"/picture/695964974116033434_179149915/\"}, {\"index\": 22, \"thumbnail_href\": \"/picture/695977429678748736_403498132/\"}, {\"index\": 23, \"thumbnail_href\": \"/picture/695993756213785472_7930203/\"}, {\"index\": 24, \"thumbnail_href\": \"/picture/695983326619607782_31624199/\"}, {\"index\": 25, \"thumbnail_href\": \"/picture/696006278083124060_23776413/\"}, {\"index\": 26, \"thumbnail_href\": \"/picture/695998807090494678_18483678/\"}, {\"index\": 27, \"thumbnail_href\": \"/picture/695998437887702553_185175380/\"}, {\"index\": 28, \"thumbnail_href\": \"/picture/696006091523367043_207789231/\"}, {\"index\": 29, \"thumbnail_href\": \"/picture/696027666809693694_29810584/\"}, {\"index\": 30, \"thumbnail_href\": \"/picture/695970965669018824_47543070/\"}, {\"index\": 31, \"thumbnail_href\": \"/picture/696007751922471837_13514211/\"}, {\"index\": 32, \"thumbnail_href\": \"/picture/696012216974527626_453366618/\"}, {\"index\": 33, \"thumbnail_href\": \"/picture/695998741751055102_1241458119/\"}, {\"index\": 34, \"thumbnail_href\": \"/picture/696025760104333970_25435655/\"}, {\"index\": 35, \"thumbnail_href\": \"/picture/696006627359974363_144646783/\"}, {\"index\": 36, \"thumbnail_href\": \"/picture/696032044517635611_689484300/\"}, {\"index\": 37, \"thumbnail_href\": \"/picture/695981822177767557_185480571/\"}, {\"index\": 38, \"thumbnail_href\": \"/picture/696013274787432577_32527641/\"}, {\"index\": 39, \"thumbnail_href\": \"/picture/696031340508489644_19870776/\"}]}'\n\t\t@response1 = JSON.pretty_generate(JSON.parse(raw_response))\n\t\t@desc1 = {:thumbnail_href => \"Path of where the picture can be found on the website.\"}\n\n\t\t@api_title2 = \"Specific Picture\"\n\t\t@api_maindesc2 = \"This API call returns information on a specific picture given it's path.\"\n\t\t@raw_request2 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/picturegram/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=picture\\&path=695948427283543832_2003724'\n\t\traw_response2 = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 1}, \"objects\": [{\"authorlink\": \"! purposeofenvy Cincinnati @purposeofenvy\", \"comments\": \"182 Comments\", \"fillWidth_src\": \"http://distilleryimage8.s3.amazonaws.com/80252edcc12111e3b5450002c9c70a44_8.jpg\", \"index\": 0, \"likes\": \"15889 Likes\"}]}'\n\t\t@response2 = JSON.pretty_generate(JSON.parse(raw_response2))\n\t\t@desc2 = {:authorlink => \"Username of author who posted the picture\", :comments => \"The amount of comments the picture has.\", :likes => \"The amount of likes the picture has.\", :fillWidth_src => \"The source of the picture so that it can be saved.\"}\n\n\t\t@api_title3 = \"Search\"\n\t\t@api_maindesc = \"This API call returns pictures found given a search query.\"\n\t\t@raw_request3 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/picturegram/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=search\\&path=music'\n\t\traw_response3 = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 40}, \"objects\": [{\"index\": 0, \"thumbnail_href\": \"/picture/696039834523582284_24664910/\"}, {\"index\": 1, \"thumbnail_href\": \"/picture/696044604202176597_32594883/\"}, {\"index\": 2, \"thumbnail_href\": \"/picture/695311969467005218_275992589/\"}, {\"index\": 3, \"thumbnail_href\": \"/picture/696044602432292041_263869992/\"}, {\"index\": 4, \"thumbnail_href\": \"/picture/696042971617792563_31873043/\"}, {\"index\": 5, \"thumbnail_href\": \"/picture/696044598142306442_51436665/\"}, {\"index\": 6, \"thumbnail_href\": \"/picture/696044579924036665_1252853410/\"}, {\"index\": 7, \"thumbnail_href\": \"/picture/696044578256254023_194634924/\"}, {\"index\": 8, \"thumbnail_href\": \"/picture/696043190694411997_496307782/\"}, {\"index\": 9, \"thumbnail_href\": \"/picture/696043271276887500_11189254/\"}, {\"index\": 10, \"thumbnail_href\": \"/picture/696044548733307591_1158451569/\"}, {\"index\": 11, \"thumbnail_href\": \"/picture/692508637012214856_1244085048/\"}, {\"index\": 12, \"thumbnail_href\": \"/picture/695795110524596419_4234459/\"}, {\"index\": 13, \"thumbnail_href\": \"/picture/696044531680575712_401377847/\"}, {\"index\": 14, \"thumbnail_href\": \"/picture/632837011111993341_494750822/\"}, {\"index\": 15, \"thumbnail_href\": \"/picture/696044526599055726_182169777/\"}, {\"index\": 16, \"thumbnail_href\": \"/picture/695778840590180750_314866815/\"}, {\"index\": 17, \"thumbnail_href\": \"/picture/696041125723018299_22234644/\"}, {\"index\": 18, \"thumbnail_href\": \"/picture/694920807350365715_274652394/\"}, {\"index\": 19, \"thumbnail_href\": \"/picture/696041749101425989_30735524/\"}, {\"index\": 20, \"thumbnail_href\": \"/picture/696039834523582284_24664910/\"}, {\"index\": 21, \"thumbnail_href\": \"/picture/696044604202176597_32594883/\"}, {\"index\": 22, \"thumbnail_href\": \"/picture/695311969467005218_275992589/\"}, {\"index\": 23, \"thumbnail_href\": \"/picture/696044602432292041_263869992/\"}, {\"index\": 24, \"thumbnail_href\": \"/picture/696042971617792563_31873043/\"}, {\"index\": 25, \"thumbnail_href\": \"/picture/696044598142306442_51436665/\"}, {\"index\": 26, \"thumbnail_href\": \"/picture/696044579924036665_1252853410/\"}, {\"index\": 27, \"thumbnail_href\": \"/picture/696044578256254023_194634924/\"}, {\"index\": 28, \"thumbnail_href\": \"/picture/696043190694411997_496307782/\"}, {\"index\": 29, \"thumbnail_href\": \"/picture/696043271276887500_11189254/\"}, {\"index\": 30, \"thumbnail_href\": \"/picture/696044548733307591_1158451569/\"}, {\"index\": 31, \"thumbnail_href\": \"/picture/692508637012214856_1244085048/\"}, {\"index\": 32, \"thumbnail_href\": \"/picture/695795110524596419_4234459/\"}, {\"index\": 33, \"thumbnail_href\": \"/picture/696044531680575712_401377847/\"}, {\"index\": 34, \"thumbnail_href\": \"/picture/632837011111993341_494750822/\"}, {\"index\": 35, \"thumbnail_href\": \"/picture/696044526599055726_182169777/\"}, {\"index\": 36, \"thumbnail_href\": \"/picture/695778840590180750_314866815/\"}, {\"index\": 37, \"thumbnail_href\": \"/picture/696041125723018299_22234644/\"}, {\"index\": 38, \"thumbnail_href\": \"/picture/694920807350365715_274652394/\"}, {\"index\": 39, \"thumbnail_href\": \"/picture/696041749101425989_30735524/\"}]}'\n\t\t@response3 = JSON.pretty_generate(JSON.parse(raw_response3))\n\t\t@desc3 = {:thumbnail_href => \"Path of where the picture can be found on the website.\"}\n\t\n\n\telse\n\t\t@api_domain = \"Listnerd\"\n\n\t\t@api_title1 = \"Front Page\"\n\t\t@api_maindesc1 = \"This API call returns lists which are currently on the front page.\"\n\t\t@raw_request1 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/listnerd/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=frontpage'\n\t\traw_response = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 20}, \"objects\": [{\"index\": 0, \"meta\": \"2.601 views\\n 26 votes\", \"name\": \"Best Office Chairs\", \"resource_uri\": \"\"}, {\"index\": 1, \"meta\": \"4.898 views\\n 2.208 votes\", \"name\": \"Top 10 Video Game Developers\", \"resource_uri\": \"\"}, {\"index\": 2, \"meta\": \"1.825 views\\n 54 votes\", \"name\": \"Best Horror Shows for Kids\", \"resource_uri\": \"\"}, {\"index\": 3, \"meta\": \"2.333 views\\n 122 votes\", \"name\": \"Best Pink Floyd Album\", \"resource_uri\": \"\"}, {\"index\": 4, \"meta\": \"65.276 views\\n 1.316 votes\", \"name\": \"Top Video Games\", \"resource_uri\": \"\"}, {\"index\": 5, \"meta\": \"5.451 views\\n 1.457 votes\", \"name\": \"TOP 100 TV Series\", \"resource_uri\": \"\"}, {\"index\": 6, \"meta\": \"6.373 views\\n 182 votes\", \"name\": \"Top 10 3D Printers for consumers\", \"resource_uri\": \"\"}, {\"index\": 7, \"meta\": \"2.063 views\\n 22 votes\", \"name\": \"Watch: Funniest Japanese TV Pranks\", \"resource_uri\": \"\"}, {\"index\": 8, \"meta\": \"6.979 views\\n 1.063 votes\", \"name\": \"Greatest Presidents of the USA\", \"resource_uri\": \"\"}, {\"index\": 9, \"meta\": \"9.529 views\\n 134 votes\", \"name\": \"TOP 100 Clothing Brands\", \"resource_uri\": \"\"}, {\"index\": 10, \"meta\": \"14.767 views\\n 93 votes\", \"name\": \"Books You Have To Read Before You Die\", \"resource_uri\": \"\"}, {\"index\": 11, \"meta\": \"10.231 views\\n 414 votes\", \"name\": \"Awesome fantasy fiction books and series\", \"resource_uri\": \"\"}, {\"index\": 12, \"meta\": \"3.734 views\\n 280 votes\", \"name\": \"Actors Who Should Have Won Oscars But Have Not\", \"resource_uri\": \"\"}, {\"index\": 13, \"meta\": \"16.430 views\\n 142 votes\", \"name\": \"Best Beatles Album\", \"resource_uri\": \"\"}, {\"index\": 14, \"meta\": \"3.627 views\\n 155 votes\", \"name\": \"Best Character in Arrested Development TV-series\", \"resource_uri\": \"\"}, {\"index\": 15, \"meta\": \"3.333 views\\n 77 votes\", \"name\": \"Best Series on Netflix\", \"resource_uri\": \"\"}, {\"index\": 16, \"meta\": \"4.653 views\\n 68 votes\", \"name\": \"Best 90s Toy\", \"resource_uri\": \"\"}, {\"index\": 17, \"meta\": \"11.571 views\\n 767 votes\", \"name\": \"Top 100 Animated Movies\", \"resource_uri\": \"\"}, {\"index\": 18, \"meta\": \"10.922 views\\n 73 votes\", \"name\": \"Best Internet Video Series of All Time\", \"resource_uri\": \"\"}, {\"index\": 19, \"meta\": \"43.949 views\\n 7.461 votes\", \"name\": \"Best Birds of Angry Birds\", \"resource_uri\": \"\"}]}'\n\t\t@response1 = JSON.pretty_generate(JSON.parse(raw_response))\n\t\t@desc1 = {:name => \"The name of the list.\", :meta => \"Displays the number of votes and views for the list.\"}\n\n\t\t@api_title2 = \"Specific List\"\n\t\t@api_maindesc2 = \"This API call returns information on a specific list given it's path.\"\n\t\t@raw_request2 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/listnerd/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=list\\&path=top-10-songs-by-savant'\n\t\traw_response2 = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 88}, \"objects\": [{\"index\": 0, \"position\": \"1\", \"title\": \"Bananonymous\", \"vote\": \"Rate\\n\\n\\n7.92\\n\\n\\n\\n\\n\\n36 votes\"}, {\"index\": 1, \"position\": \"2\", \"title\": \"SPLINTER\", \"vote\": \"Rate\\n\\n\\n9.31\\n\\n\\n\\n\\n\\n26 votes\"}, {\"index\": 2, \"position\": \"3\", \"title\": \"Melody Circus\", \"vote\": \"Rate\\n\\n\\n8.50\\n\\n\\n\\n\\n\\n24 votes\"}, {\"index\": 3, \"position\": \"4\", \"title\": \"FUCK NEXUS\", \"vote\": \"Rate\\n\\n\\n8.76\\n\\n\\n\\n\\n\\n21 votes\"}, {\"index\": 4, \"position\": \"5\", \"title\": \"LIVING IPOD\", \"vote\": \"Rate\\n\\n\\n8.15\\n\\n\\n\\n\\n\\n20 votes\"}, {\"index\": 5, \"position\": \"6\", \"title\": \"STARFISH\", \"vote\": \"Rate\\n\\n\\n8.63\\n\\n\\n\\n\\n\\n19 votes\"}, {\"index\": 6, \"position\": \"7\", \"title\": \"Sledgehammer\", \"vote\": \"Rate\\n\\n\\n9.06\\n\\n\\n\\n\\n\\n17 votes\"}, {\"index\": 7, \"position\": \"8\", \"title\": \"Ghetto Blastah\", \"vote\": \"Rate\\n\\n\\n8.39\\n\\n\\n\\n\\n\\n18 votes\"}, {\"index\": 8, \"position\": \"9\", \"title\": \"ISM\", \"vote\": \"Rate\\n\\n\\n9.13\\n\\n\\n\\n\\n\\n16 votes\"}, {\"index\": 9, \"position\": \"10\", \"title\": \"Pirate bay\", \"vote\": \"Rate\\n\\n\\n8.44\\n\\n\\n\\n\\n\\n16 votes\"}, {\"index\": 10, \"position\": \"11\", \"title\": \"Black Magic\", \"vote\": \"Rate\\n\\n\\n8.31\\n\\n\\n\\n\\n\\n16 votes\"}, {\"index\": 11, \"position\": \"12\", \"title\": \"The Horror\", \"vote\": \"Rate\\n\\n\\n8.93\\n\\n\\n\\n\\n\\n15 votes\"}, {\"index\": 12, \"position\": \"13\", \"title\": \"Nightmare Adventures\", \"vote\": \"Rate\\n\\n\\n7.94\\n\\n\\n\\n\\n\\n16 votes\"}, {\"index\": 13, \"position\": \"14\", \"title\": \"BREAKDOWN\", \"vote\": \"Rate\\n\\n\\n9.21\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 14, \"position\": \"15\", \"title\": \"Sayonara\", \"vote\": \"Rate\\n\\n\\n9.21\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 15, \"position\": \"16\", \"title\": \"Alchemist (feat. Gyno Sydal)\", \"vote\": \"Rate\\n\\n\\n8.93\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 16, \"position\": \"17\", \"title\": \"CHAMPAGNE\", \"vote\": \"Rate\\n\\n\\n8.93\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 17, \"position\": \"18\", \"title\": \"The Beginning Is Near\", \"vote\": \"Rate\\n\\n\\n8.86\\n\\n\\n\\n\\n\\n14 votes\"}, {\"index\": 18, \"position\": \"19\", \"title\": \"NINUR\", \"vote\": \"Rate\\n\\n\\n7.93\\n\\n\\n\\n\\n\\n15 votes\"}, {\"index\": 19, \"position\": \"20\", \"title\": \"OVERWORLD\", \"vote\": \"Rate\\n\\n\\n9.31\\n\\n\\n\\n\\n\\n13 votes\"}, {\"index\": 20, \"position\": \"21\", \"title\": \"STARSCREAM FOREVER\", \"vote\": \"Rate\\n\\n\\n9.42\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 21, \"position\": \"22\", \"title\": \"BURGERTIME (SAVANT THEME)\", \"vote\": \"Rate\\n\\n\\n9.17\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 22, \"position\": \"23\", \"title\": \"FIRECLOUD\", \"vote\": \"Rate\\n\\n\\n8.92\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 23, \"position\": \"24\", \"title\": \"Sustainer\", \"vote\": \"Rate\\n\\n\\n8.92\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 24, \"position\": \"25\", \"title\": \"TRUST ISSUES\", \"vote\": \"Rate\\n\\n\\n8.83\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 25, \"position\": \"26\", \"title\": \"DIRTY MARY\", \"vote\": \"Rate\\n\\n\\n9.64\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 26, \"position\": \"27\", \"title\": \"YOU CAN PLAY\", \"vote\": \"Rate\\n\\n\\n9.36\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 27, \"position\": \"28\", \"title\": \"FLASHBACH\", \"vote\": \"Rate\\n\\n\\n8.42\\n\\n\\n\\n\\n\\n12 votes\"}, {\"index\": 28, \"position\": \"29\", \"title\": \"The Beat\", \"vote\": \"Rate\\n\\n\\n9.09\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 29, \"position\": \"30\", \"title\": \"Face Off\", \"vote\": \"Rate\\n\\n\\n8.64\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 30, \"position\": \"31\", \"title\": \"Dancer in the Dark\", \"vote\": \"Rate\\n\\n\\n8.45\\n\\n\\n\\n\\n\\n11 votes\"}, {\"index\": 31, \"position\": \"32\", \"title\": \"BAD BAWS\", \"vote\": \"Rate\\n\\n\\n9.20\\n\\n\\n\\n\\n\\n10 votes\"}, {\"index\": 32, \"position\": \"33\", \"title\": \"Prelude\", \"vote\": \"Rate\\n\\n\\n9.10\\n\\n\\n\\n\\n\\n10 votes\"}, {\"index\": 33, \"position\": \"34\", \"title\": \"HERO FROM THE PAST\", \"vote\": \"Rate\\n\\n\\n9.33\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 34, \"position\": \"35\", \"title\": \"HOLY GHOST\", \"vote\": \"Rate\\n\\n\\n9.33\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 35, \"position\": \"36\", \"title\": \"Wildstyle\", \"vote\": \"Rate\\n\\n\\n9.22\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 36, \"position\": \"37\", \"title\": \"VINTER\", \"vote\": \"Rate\\n\\n\\n9.11\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 37, \"position\": \"38\", \"title\": \"8-BIT LIGHTSABER\", \"vote\": \"Rate\\n\\n\\n9.00\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 38, \"position\": \"39\", \"title\": \"Redemption\", \"vote\": \"Rate\\n\\n\\n9.00\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 39, \"position\": \"40\", \"title\": \"Mother Earth\", \"vote\": \"Rate\\n\\n\\n8.10\\n\\n\\n\\n\\n\\n10 votes\"}, {\"index\": 40, \"position\": \"41\", \"title\": \"Paradisco\", \"vote\": \"Rate\\n\\n\\n8.78\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 41, \"position\": \"42\", \"title\": \"Fat Cat Shuffle\", \"vote\": \"Rate\\n\\n\\n8.67\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 42, \"position\": \"43\", \"title\": \"MYSTERY\", \"vote\": \"Rate\\n\\n\\n8.67\\n\\n\\n\\n\\n\\n9 votes\"}, {\"index\": 43, \"position\": \"44\", \"title\": \"MEGABOY\", \"vote\": \"Rate\\n\\n\\n9.63\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 44, \"position\": \"45\", \"title\": \"THUNDERCLOUT\", \"vote\": \"Rate\\n\\n\\n9.50\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 45, \"position\": \"46\", \"title\": \"VARIO\", \"vote\": \"Rate\\n\\n\\n9.13\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 46, \"position\": \"47\", \"title\": \"THE THIRD EYE\", \"vote\": \"Rate\\n\\n\\n9.00\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 47, \"position\": \"48\", \"title\": \"ARCADE NIGHT CRUISE\", \"vote\": \"Rate\\n\\n\\n8.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 48, \"position\": \"49\", \"title\": \"NO SHIT SHERLOCK\", \"vote\": \"Rate\\n\\n\\n8.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 49, \"position\": \"50\", \"title\": \"SHADOW\", \"vote\": \"Rate\\n\\n\\n8.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 50, \"position\": \"51\", \"title\": \"STORMTROOPER\", \"vote\": \"Rate\\n\\n\\n8.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 51, \"position\": \"52\", \"title\": \"Wildstyle\", \"vote\": \"Rate\\n\\n\\n9.86\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 52, \"position\": \"53\", \"title\": \"DESTROY THE DRAGON\", \"vote\": \"Rate\\n\\n\\n8.75\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 53, \"position\": \"54\", \"title\": \"BA-DA BING!\", \"vote\": \"Rate\\n\\n\\n9.43\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 54, \"position\": \"55\", \"title\": \"No Time For Pussy\", \"vote\": \"Rate\\n\\n\\n8.38\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 55, \"position\": \"56\", \"title\": \"DIAMOND BLUSH\", \"vote\": \"Rate\\n\\n\\n9.29\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 56, \"position\": \"57\", \"title\": \"OUTFOX\", \"vote\": \"Rate\\n\\n\\n8.25\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 57, \"position\": \"58\", \"title\": \"ANTIPIXEL\", \"vote\": \"Rate\\n\\n\\n8.13\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 58, \"position\": \"59\", \"title\": \"RIDE LIKE THE WIND\", \"vote\": \"Rate\\n\\n\\n8.00\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 59, \"position\": \"60\", \"title\": \"Sky is the Limit (feat. Donny Goines)\", \"vote\": \"Rate\\n\\n\\n7.88\\n\\n\\n\\n\\n\\n8 votes\"}, {\"index\": 60, \"position\": \"61\", \"title\": \"CRY FOR LOVE\", \"vote\": \"Rate\\n\\n\\n8.71\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 61, \"position\": \"62\", \"title\": \"MECHA BLECKA\", \"vote\": \"Rate\\n\\n\\n8.71\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 62, \"position\": \"63\", \"title\": \"ROBOT PEOPLE MONSTER\", \"vote\": \"Rate\\n\\n\\n8.14\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 63, \"position\": \"64\", \"title\": \"ZEITGEIST\", \"vote\": \"Rate\\n\\n\\n8.14\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 64, \"position\": \"65\", \"title\": \"Konami Kode (feat. Donny Goines)\", \"vote\": \"Rate\\n\\n\\n7.86\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 65, \"position\": \"66\", \"title\": \"ROLLERCOASTER\", \"vote\": \"Rate\\n\\n\\n7.86\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 66, \"position\": \"67\", \"title\": \"OCARINE\", \"vote\": \"Rate\\n\\n\\n8.83\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 67, \"position\": \"68\", \"title\": \"BACH TO THE PHUTURE\", \"vote\": \"Rate\\n\\n\\n7.57\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 68, \"position\": \"69\", \"title\": \"PARTY MACHINE\", \"vote\": \"Rate\\n\\n\\n8.50\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 69, \"position\": \"70\", \"title\": \"EGGS\", \"vote\": \"Rate\\n\\n\\n8.33\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 70, \"position\": \"71\", \"title\": \"GUNSLINGER JONES\", \"vote\": \"Rate\\n\\n\\n8.33\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 71, \"position\": \"72\", \"title\": \"Hungry Eyes (feat. Qwentalis)\", \"vote\": \"Rate\\n\\n\\n7.14\\n\\n\\n\\n\\n\\n7 votes\"}, {\"index\": 72, \"position\": \"73\", \"title\": \"Light Years (feat. Razihel)\", \"vote\": \"Rate\\n\\n\\n8.00\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 73, \"position\": \"74\", \"title\": \"RABBIT WHORE\", \"vote\": \"Rate\\n\\n\\n9.00\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 74, \"position\": \"75\", \"title\": \"Manslaughter (feat Svanur Papparazzi)\", \"vote\": \"Rate\\n\\n\\n7.50\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 75, \"position\": \"76\", \"title\": \"HEART-SHAPED MUSHROOM CLOUD\", \"vote\": \"Rate\\n\\n\\n8.40\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 76, \"position\": \"77\", \"title\": \"OMNI\", \"vote\": \"Rate\\n\\n\\n8.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 77, \"position\": \"78\", \"title\": \"SYKO\", \"vote\": \"Rate\\n\\n\\n8.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 78, \"position\": \"79\", \"title\": \"THE A TEAM\", \"vote\": \"Rate\\n\\n\\n8.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 79, \"position\": \"80\", \"title\": \"Witchcraft\", \"vote\": \"Rate\\n\\n\\n8.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 80, \"position\": \"81\", \"title\": \"Shark\", \"vote\": \"Rate\\n\\n\\n9.25\\n\\n\\n\\n\\n\\n4 votes\"}, {\"index\": 81, \"position\": \"82\", \"title\": \"QUANTUM MECHANICS\", \"vote\": \"Rate\\n\\n\\n7.20\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 82, \"position\": \"83\", \"title\": \"I WANT YOU\", \"vote\": \"Rate\\n\\n\\n8.00\\n\\n\\n\\n\\n\\n4 votes\"}, {\"index\": 83, \"position\": \"84\", \"title\": \"MAKE YOU DREAM\", \"vote\": \"Rate\\n\\n\\n7.00\\n\\n\\n\\n\\n\\n5 votes\"}, {\"index\": 84, \"position\": \"85\", \"title\": \"SLAUGHTERFACE\", \"vote\": \"Rate\\n\\n\\n5.83\\n\\n\\n\\n\\n\\n6 votes\"}, {\"index\": 85, \"position\": \"86\", \"title\": \"Shark\", \"vote\": \"Rate\\n\\n\\n0.00\\n\\n\\n\\n\\n\\n0 votes\"}, {\"index\": 86, \"position\": \"87\", \"title\": \"Wade in the Water\", \"vote\": \"Rate\\n\\n\\n0.00\\n\\n\\n\\n\\n\\n0 votes\"}, {\"index\": 87, \"position\": \"88\", \"title\": \"Wildstyle\", \"vote\": \"Rate\\n\\n\\n0.00\\n\\n\\n\\n\\n\\n0 votes\"}]}'\n\t\t@response2 = JSON.pretty_generate(JSON.parse(raw_response2))\n\t\t@desc2 = {:position => \"Position of the item in the list.\", :title => \"Title of the item on the list.\", :vote => \"Number of votes for the specific item in the list.\"}\n\n\t\t@api_title3 = \"Search\"\n\t\t@api_maindesc3 = \"This API call returns lists found given a search query.\"\n\t\t@raw_request3 = 'curl http://ec2-50-18-201-41.us-west-1.compute.amazonaws.com/api/virtualapi/listnerd/?username=api_test\\&api_key=3cec1a36f3cb9c7a24216afe71a7aa8c720255fb\\&method=search\\&path=fun'\n\t\traw_response3 = '{\"meta\": {\"limit\": 1000, \"next\": null, \"offset\": 0, \"previous\": null, \"total_count\": 12}, \"objects\": [{\"description\": \"A venture funded company is any company which has received funding from a venture capital investor.\", \"index\": 0, \"meta\": \"1.188 views\\n 623 votes\\n 27.11.12\", \"name\": \"Best Venture Funded Company of All Time\"}, {\"description\": \"Fan of Knock Knock jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Knock Knock jokes! Find your favorite? Then vote on the best Knock Knock jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Knock Knock jokes.\", \"index\": 1, \"meta\": \"142 views\\n 623 votes\\n 16.09.13\", \"name\": \"Funny Knock Knock jokes\"}, {\"description\": \"\", \"index\": 2, \"meta\": \"133 views\\n 623 votes\\n 27.11.12\", \"name\": \"Best fun of All Time\"}, {\"description\": \"A defunct sports team is a sports team that no longer exists.\", \"index\": 3, \"meta\": \"98 views\\n 621 votes\\n 27.11.12\", \"name\": \"Best Defunct Sports Team of All Time\"}, {\"description\": \"A defunct organization is an organization that no longer operates.\", \"index\": 4, \"meta\": \"530 views\\n 619 votes\\n 27.11.12\", \"name\": \"Best Defunct Organization of All Time\"}, {\"description\": \"Fan of Dog jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Dog jokes! Find your favorite? Then vote on the best Dog jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Dog jokes.\", \"index\": 5, \"meta\": \"70 views\\n 574 votes\\n 16.09.13\", \"name\": \"Funny Dog jokes\"}, {\"description\": \"the general reason, purpose for the building at any time. Usually, it is why it was built.\", \"index\": 6, \"meta\": \"179 views\\n 516 votes\\n 27.11.12\", \"name\": \"Best Building function of All Time\"}, {\"description\": \"Fan of Blonde jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Blonde jokes! Find your favorite? Then vote on the best Blonde jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Blonde jokes.\", \"index\": 7, \"meta\": \"37 views\\n 501 votes\\n 16.09.13\", \"name\": \"Funny Blonde jokes\"}, {\"description\": \"Fan of Yo momma jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Yo momma jokes! Find your favorite? Then vote on the best Yo momma jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Yo momma jokes.\", \"index\": 8, \"meta\": \"46 views\\n 480 votes\\n 16.09.13\", \"name\": \"Funny Yo momma jokes\"}, {\"description\": \"Fan of School jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best School jokes! Find your favorite? Then vote on the best School jokes below. If your favorite isnt listed, you can also add a new joke to our selection of School jokes.\", \"index\": 9, \"meta\": \"49 views\\n 465 votes\\n 16.09.13\", \"name\": \"Funny School jokes\"}, {\"description\": \"Fan of Insect jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Insect jokes! Find your favorite? Then vote on the best Insect jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Insect jokes.\", \"index\": 10, \"meta\": \"48 views\\n 443 votes\\n 16.09.13\", \"name\": \"Funny Insect jokes\"}, {\"description\": \"Fan of Dirty jokes? Bored at work and hungry for a laugh? Or just feeling down? Then look no further; weve compiled a massive list of the absolutely best Dirty jokes! Find your favorite? Then vote on the best Dirty jokes below. If your favorite isnt listed, you can also add a new joke to our selection of Dirty jokes.\", \"index\": 11, \"meta\": \"53 views\\n 435 votes\\n 16.09.13\", \"name\": \"Funny Dirty jokes\"}]}'\n\t\t@response3 = JSON.pretty_generate(JSON.parse(raw_response3))\n\t\t@desc3 = {:name => \"The name of the specific list.\", :description => \"The description of the specific list.\", :meta => \"Displays the number of votes and views for the specific list.\"}\n\tend\n\nend",
"def index\n respond_with(pages)\n end",
"def rest_endpoint; end",
"def endpoint; end",
"def endpoint; end",
"def endpoint; end",
"def endpoint; end",
"def rest_end_point; end",
"def full_page\n end",
"def index\n # @listings = Listing.all.order('created_at DESC')\n # @listings, @alphaParams = Listing.alpha_paginate(params[:letter], {db_mode: true, db_field: \"address\"})\n @listings, @alphaParams = Listing.all.alpha_paginate(params[:letter]){|listing| listing.address}\n add_breadcrumb \"Listings\", :listings_path\n end",
"def index\n @lands = Land.paginate :page => params[:page], :order => 'created_at DESC'\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lands }\n end\n end",
"def index\n __log_activity\n __debug_route\n prm = paginator.initial_parameters\n @extended = prm.key?(:expand) ? true?(prm.delete(:expand)) : EXPAND_JSON\n search = prm.delete(:like) # TODO: :like param\n search = search ? build_query_options(search) : {}\n results =\n if @extended\n SearchCall.extended_table(search)\n else\n get_search_calls(search)\n end\n results.limit!(prm[:limit]) if prm[:limit] # TODO: temporary\n results.offset!(prm[:offset]) if prm[:offset] # TODO: temporary\n found = { list: results.to_a }\n @list = paginator.finalize(found, **search)\n respond_to do |format|\n format.html\n format.json { render_json index_values }\n format.xml { render_xml index_values }\n end\n end",
"def index \n\t\t# listings_per_page = 7\n # \tparams[:page] = 1 unless params[:page]\n # \tfirst_listing = (params[:page].to_i - 1 ) * listings_per_page\n # \tlistings = Listing.all\n # \t@total_pages = listings.count / listings_per_page\n # \tif listings.count % listings_per_page > 0\n # \t\t@total_pages += 1\n # \tend\n # \t@listings = listings[first_listing...(first_listing + listings_per_page)]\n\t\t@listings = Listing.all \n\tend",
"def index\n @hbanners_pages, @hbanners = paginate(:hbanners,\n\t\t:per_page => 5, \n\t\t:order => 'hbanners.updated_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hbanners }\n end\n end",
"def index\n seller = Seller.find(self.current_user.seller.id)\n page = params[:page] || 1\n @listings = seller.listings.paginate(:page => page, :per_page => 10,:conditions => [\"nr_of_items_in_stock >= ? and removed = ? and creation = ?\", \"0\", \"0\", \"completed\"])\n \n #Define breadcrumbs\n @l1_link = profile_path\n @l1_name = t(\"controllers.listings.s1\") \n @l2_link = listings_path \n @l2_name = t(\"controllers.listings.s2\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @listings }\n end\nend",
"def index\n @instances = Instance.page params[:page]\n authorize! :read, @instances\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @instances }\n end\n end",
"def index\n render json: EndService.paginate(page: params[:page], per_page: 25)\n end",
"def index_master\n page = params[:page] || 1\n @riders = Rider.master.page(page)\n end",
"def index\n @warehouse_lists = get_warehouse_lists(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @warehouse_lists }\n end\n end",
"def index\n render plain: \"/api/races, offset=[#{params[:offset]}], limit=[#{params[:limit]}]\"\n end",
"def import_page\n end",
"def index\n @offers = getmydata(\"Offer\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def GET; end",
"def paginator; end",
"def doi_landing_page\n # is there a way to get this somehow with url_for or some such?\n url = DOI_CONFIG['landing_page_prefix']\n if self.class == Collection\n url + \"collections/\" + id\n else\n url + \"files/\" + id\n end\n end",
"def sureroute\n # Load some content just to slow things down as a real-world example\n Brand.all\n Product.all\n respond_to do |format|\n format.html\n end\n end",
"def index\n @pppams_indicator_base_refs = PppamsIndicatorBaseRef.paginate(:all, :per_page => 20, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pppams_indicator_base_refs }\n>>>>>>> 7436653363ecf064fdcfcd2b30df919b5144a2b8\n end\n end",
"def index\n @servers = getmydata(\"Server\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servers }\n end\n end",
"def index\n begin\n\n conditions = \"(parent_id=#{params[:instance_id]} or child_id=#{params[:instance_id]})\"\n params[:conditions] = add_condition(params[:conditions], conditions, :and) \n \n @parcel = get_paginated_records_for(\n :for => Link,\n :start_index => params[:start_index],\n :max_results => params[:max_results],\n :order_by => params[:order_by],\n :direction => params[:direction],\n :conditions => params[:conditions]\n )\n render :response => :GETALL\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n \n\n end",
"def index\n @q = Listing.ransack(params[:q])\n @listings = @q.result.with_attached_picture.paginate(:page => params[:page], :per_page=>8)\n end",
"def get_page\n render_page_sections_json\n end",
"def index\n @locations = salor_user.get_locations(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end",
"def run\n getPage\n getLocations\n printLocations\n end",
"def index \n hq_vlans = HqVlan.all(:order => :name)\n @objects = hq_vlans.paginate :page => params[:page], :per_page => 20\n respond_to do |format|\n format.html { render :template => 'reflected/index' }\n format.xml { render :xml => @objects }\n end\n end",
"def page; self end",
"def url_for_index; end",
"def url_for_index; end",
"def to_api\n\n results = {\n 'page_id' => id,\n 'name' => name,\n 'description' => description,\n 'template_name' => template_name,\n 'url_fragment' => url_fragment,\n 'url_redirect' => url_redirect,\n 'url_redirect_property' => url_redirect_property\n }\n return results;\n\n end",
"def index\n return redirect_to(request.env['REQUEST_URI'].include?(\"colleges\") ? college_path(params[:id]) : location_path(params[:id])) if params[:id]\n @locations = Location.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @locations }\n end\n end",
"def index\n @local_offers = LocalOffer.all \n @local_offers = @local_offers.paginate(:page => params[:page], :per_page => 10)\n\n render :layout => 'admin'\n end",
"def pages\n get(\"v1/event/#{@id}/pages\")\n end",
"def index\n @redirects = Redirect.all\n @redirects_only_on_api = fetch_redirects_of_api\n end",
"def index\n\n respond_to do |format|\n format.html { @booking_pages, @bookings = paginate( Booking, :order_by => \"expected_pickup\", :conditions => Booking.waiting_pickup_condition ) }\n format.xml { render :xml => Booking.find_waiting_pickup.to_xml }\n format.json { render :json => Booking.find_waiting_pickup.to_json }\n format.yaml { render :text => Booking.find_waiting_pickup.to_yaml }\n end\n \n end",
"def index\n expose Product.page(params[:page])\n end",
"def index\n @demand_responses = DemandResponse.order(id: :desc).paginate(page: params[:page])\n end",
"def index\n __log_activity\n __debug_route\n prm = paginator.initial_parameters.except(*Paginator::NON_SEARCH_KEYS)\n if prm.present?\n # Perform search here.\n terms = prm.delete(:like)\n found = { list: get_accounts(*terms, **prm) }\n @list = paginator.finalize(found, **prm)\n else\n # Otherwise redirect to the appropriate list action.\n prm[:action] = current_org ? :list_org : :list_all\n respond_to do |format|\n format.html { redirect_to prm }\n format.json { redirect_to prm.merge!(format: :json) }\n format.xml { redirect_to prm.merge!(format: :xml) }\n end\n end\n end",
"def external_routes; end",
"def index\n # @listings = Listing.all\n @listings = Listing.order(:name).page params[:page]\n end",
"def route_sets; end",
"def index\n respond_with(@pages = Page.all.paginate(:page => params[:page] || 1, :per_page => params[:per_page] || 5))\n end",
"def index\n\t@dl_types = DlType.paginate(:page=>params[:page]||1,:per_page=>20)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dl_types }\n end\n end",
"def index\n unless params[:type]\n @page = Page.find_by_permalink(\"production\", :order => \"position ASC\")\n #@page_ids = []\n else\n @page = Page.find_by_permalink(\"accessories\", :order => \"position ASC\")\n #@items = Item.find_by_page_id(params[:page_id])\n end\n\n #respond_to do |wants|\n # wants.html # index.html.erb\n # # wants.xml { render :xml => @items }\n # end\n end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end"
] | [
"0.65637076",
"0.6495347",
"0.6402325",
"0.6402325",
"0.6402325",
"0.6402325",
"0.6402325",
"0.6402325",
"0.6402325",
"0.6402325",
"0.6402325",
"0.6402325",
"0.6402325",
"0.6402325",
"0.6377466",
"0.63324577",
"0.6196554",
"0.6089698",
"0.6010704",
"0.60014415",
"0.59697044",
"0.59697044",
"0.59562826",
"0.5938235",
"0.59353113",
"0.5931975",
"0.59180355",
"0.5916503",
"0.59083784",
"0.59083784",
"0.59083784",
"0.59083784",
"0.59011614",
"0.5889366",
"0.5882359",
"0.58769387",
"0.5873527",
"0.5870505",
"0.58589613",
"0.58532715",
"0.5844002",
"0.58244795",
"0.58205515",
"0.5819498",
"0.58153594",
"0.5808613",
"0.5808531",
"0.58081853",
"0.58021426",
"0.5795546",
"0.5770447",
"0.5770095",
"0.57695067",
"0.5755699",
"0.5755553",
"0.57470536",
"0.57332236",
"0.5732846",
"0.5732272",
"0.57318723",
"0.5730378",
"0.5730378",
"0.57284695",
"0.57275546",
"0.5726773",
"0.57186633",
"0.57139176",
"0.5706594",
"0.5697555",
"0.5697361",
"0.5692955",
"0.5690613",
"0.5687447",
"0.5686678",
"0.5686262",
"0.5671978",
"0.56712323",
"0.5666107",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634",
"0.5664634"
] | 0.0 | -1 |
END POINTS FOR TAXONOMY DATA | def building_and_grounds
bag = SuperSuperCategory.find_by(name: "Facilities")
super_categories = bag.super_categories
if params[:org]
@data = build_from_super_super_categories(super_categories, params[:org].to_i)
else
@data = build_from_super_super_categories(super_categories, 0)
end
render json: @data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_point\n raise Error::UnsupportedOperation, \"Method Curve#end_point not defined.\"\n end",
"def end_at(x, y = nil)\n to.coord x, y\n end",
"def set_end(t)\n @end_t = t\n end",
"def end_point; end",
"def points; end",
"def end_line(kind); end",
"def end_line kind\n end",
"def end_pos_data_tb\n @spawn_pos_tb ||= End_PosTB.new\n end",
"def end\n regions.max.end\n end",
"def end_line\n attributes.fetch(:endLine)\n end",
"def y_end\n y_end_dependencies = [calculated_height, default_y?, !default_y? && y]\n if y_end_dependencies != @y_end_dependencies\n # avoid recalculation of dependencies\n calculated_height, is_default_y, y = @y_end_dependencies = y_end_dependencies\n shape_height = calculated_height.to_f\n shape_y = is_default_y ? 0 : y.to_f\n @y_end = shape_y + shape_height\n end\n @y_end\n end",
"def end_pos; end",
"def end_pos; end",
"def getEndPoint()\n geoObject().lastPoint() ;\n end",
"def end\n @range.end\n end",
"def end(p0) end",
"def extremes\n point = @points[0]\n #puts \"next\"\n #p [point.x, point.y]\n left = right = point.x # @position.x + point.x\n top = bottom = point.y # @position.y + point.y\n @points[1..-1].each do |point|\n #p [point.x, point.y]\n x, y = point.to_a # (@position + point).to_a\n left = x if x < left\n right = x if x > right\n top = y if y < top\n bottom = y if y > bottom\n end\n #p [left, right, top, bottom]\n [left, right, top, bottom]\n end",
"def ends_at\n @ends_at ||= begin\n if period == :quarter\n starts_at.advance months: length * 3\n else\n starts_at.advance periods => length\n end\n end\n end",
"def finish_coords\n marker_coords('F')\n end",
"def end\n attributes.fetch(:end)\n end",
"def end_at(x, y = nil)\n use_two_cell_anchor unless @anchor.is_a?(TwoCellAnchor)\n @anchor.end_at x, y\n @anchor.to\n end",
"def endRow; @row + @height - 1; end",
"def end\n j_instance.getEnd\n end",
"def exclude_end?() end",
"def y\n @point[1]\n end",
"def find_end_points(x, y, chip)\n end_points = @DIR_DELTAS.keys.map { |dir| end_point_in_direction(x, y, chip, dir) }\n end_points.uniq { |point| point.take(2) }\n end",
"def end_row\n strict_position.end_row\n end",
"def at_end; end",
"def end_point; get(end_param) end",
"def xy() @records.get_data(GRT_XY); end",
"def local_end\r\n @local_end = at.add_with_convert(@previous_offset.utc_total_offset) unless @local_end \r\n @local_end\r\n end",
"def yaxis\n end",
"def new_point?(end_point)\n\t\tend_x, end_y = end_point\n\t\t!(pos_x == end_x && pos_y == end_y) \n\tend",
"def add_endowment(options)\n add_assertions!\n options[:type] = 'Endowment'\n assertions.add_ordinance(options)\n end",
"def reset_end!\n @end = nil\n end",
"def nontrivial_end_line\n if successor\n successor.line_numbers.begin - 1\n else\n @document.last_non_empty_line\n end\n end",
"def end\n @ranges.size == 1 ? @ranges[0].end : nil\n end",
"def xy_record() @records.get(GRT_XY); end",
"def end_at\n @attributes[:end_at]\n end",
"def end_at\n @attributes[:end_at]\n end",
"def y_offset; end",
"def last_line_in_view()\n\t\tcoord_to_line_num(contents_y + height)\n\tend",
"def last_line_only(range); end",
"def last_line_only(range); end",
"def last_line_only(range); end",
"def end; self.begin + self.size - 1; end",
"def is_end?(cell)\n @end_cell.eql?(cell)\n end",
"def set_finish_point\n self.reload\n if circle == \"1\"\n lp = points.first\n tracksegments.last.points.create(:longitude => lp.longitude, \n :latitude => lp.latitude, \n :elevation => lp.elevation)\n logger.info \"Finish point appended\"\n end\n end",
"def multi_end2(ttls)\n rpls = ''\n ttl = @tg_end.size-1\n ttl = ttls-1 if ttls\n ttl.downto(0) do |i|\n sz = @tg_end[i][/^ +/].to_s.size\n if ttls || @spc.size <= sz\n send = @tg_end.pop\n if send.strip[0,5]==\"!run!\"\n scrpt = send.gsub(\"\\n\",\"\\n#{@spc}\").split(\"\\n\")\n @doc_src = scrpt[1,99]+@doc_src\n else\n spc = send[/(^[ \\t]*)/,1].to_s\n rpls << (send.gsub(\"\\n\",\"\\n#{spc}\") + \"\\n\") \n end\n end\n end\n p \"End2 : #{rpls}\" if @dbg[:parse] && rpls!= ''\n rpls\n end",
"def day_end\n\t\tself.at_beginning_of_day + 86399.999999\n\tend",
"def external_trailing_comma_offset_from_loc_end(node); end",
"def ends\n ends = nil\n @doc.find(\"/dwml/data/time-layout/end-valid-time/text()\").map do |node|\n t = Time.parse(node.to_s)\n ends = t if !ends || t > ends\n end\n @ends = ends\n end",
"def jumps_to_end\n ( @x == @y ) ? 0 : get_jumps_to_end\n end",
"def end_at(x = 10, y = 10)\n @graphic_frame.anchor.end_at(x, y)\n end",
"def get_ending_point\n\t\tif ending_location_meeting.blank?\n\t\t\tending_location_dl\n\t\telse\n\t\t\tending_location_meeting\n\t\tend\n\tend",
"def tick_end_time\n @ref + (@ref_ticks + 1)*@step\n end",
"def ends\n ends = []\n vertices.each { |x| ends << x if x.neighbors.empty? }\n ends\n end",
"def end_of_month_bill\n\t\tcalculate_interest(30) ### 30 should be replaced by days since last transaction\n\t\t@balance + @interest.reduce(:+)\n\tend",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def last_line; end",
"def touch_ended_from_edge\n case @current_tool\n when :squiggle, :line\n # should only do this if at least one of the points is on the screen\n # it is possible that they are all \"invisible\"\n invisible = true\n @points.each do |point|\n invisible = false if point.x > 0 and point.x < bounds.size.width\n end\n add_stroke(LineStroke.new(@points, @current_colour, @line_size)) unless invisible\n @points = nil\n setNeedsDisplay\n end\n end",
"def end_vertices(e)\n\t\ttemp_array = []\n\t\tfor i in 0..num_edges-1\n\t\t\tif @Edges[i].label==e.label\n\t\t\t\ttmp2 = @Edges[i].points\n\t\t\tend\n\t\tend\n\t\ttemp_array << @Vertices[@Hash[tmp2[0]]]\n\t\ttemp_array << @Vertices[@Hash[tmp2[1]]]\n\t\treturn temp_array\n\tend",
"def parse_end\n (get_end(/^(,)\\/(\\n)/) ? true : \\\n (get_end(/^[ \\t]*(~+)\\/(\\n)/) ? true : \\\n get_end(/^[ \\t]*(!)\\/(\\n)/)))\n end",
"def get_y coords\n coords.last\n end",
"def endline\n\t\t@@bold = @@objs = false\n\tend",
"def end_at(include_late_slack = true)\n s = assessment.end_at\n s += assessment.course.late_slack if include_late_slack\n apply_extension s, extension\n end",
"def end\n @history.objects.find { |o| o.name == \"end\" }.val\n end",
"def end_measures_for(tame)\n Measure.national\n .with_measure_type(tame.measure_type)\n .valid_before(tame.fe_tsmp)\n .with_tariff_measure_number(tame.tar_msr_no)\n .not_terminated\n .each do |measure|\n\n end_date = if (measure.associated_to_non_open_ended_gono? &&\n record.fe_tsmp > measure.goods_nomenclature.validity_end_date)\n measure.goods_nomenclature.validity_end_date\n else\n record.fe_tsmp\n end\n\n update_record(measure,\n validity_end_date: end_date,\n justification_regulation_id: measure.measure_generating_regulation_id,\n justification_regulation_role: measure.measure_generating_regulation_role,\n operation_date: operation_date)\n end\n end",
"def find_end_line(node)\n if node.if_type? && node.else?\n node.loc.else.line\n elsif node.if_type? && node.ternary?\n node.else_branch.loc.line\n elsif node.if_type? && node.elsif?\n node.each_ancestor(:if).find(&:if?).loc.end.line\n elsif node.block_type? || node.numblock_type?\n node.loc.end.line\n elsif (next_sibling = node.right_sibling) && next_sibling.is_a?(AST::Node)\n next_sibling.loc.line\n elsif (parent = node.parent)\n parent.loc.respond_to?(:end) && parent.loc.end ? parent.loc.end.line : parent.loc.line\n else\n node.loc.end.line\n end\n end",
"def mark_end_time key\n elapsed_time = Time.now - @start_time[key]\n if key == :ballot\n @total_ballot_scan_time += elapsed_time\n average_so_far = @total_ballot_scan_time / get_stat(:success_analysis)\n fmt_avg = sprintf(\"%.2f sec\", average_so_far)\n @view.set_stat :time_per_ballot, fmt_avg \n end\n end",
"def end; end",
"def end; end",
"def end; end",
"def points_gfx_mano_end_set(curr_points_info, player)\r\n curr_points_info.each do |pt_item|\r\n player_label = player.name.to_sym\r\n \r\n if pt_item[:scopa]\r\n @points_status[player_label][:scopa] += pt_item[:scopa]\r\n @points_status[player_label][:widg_scopa].font_color = @color_signal \r\n log \"#{player.name} ha fatto scopa\"\r\n end\r\n end\r\n end",
"def points()\n\t\t\tfilter()\n\t\t\treturn @points_floor + @points_ceil.reverse\n\t\tend",
"def end\n empty? ? 0 : last.end\n end",
"def end_pos=(_); end",
"def end=(pt_or_entity)\n end",
"def end_of_tie?\n true\n end",
"def end?\r\n\t\tif(@allLines.empty?)\r\n\t\t\treturn true\r\n\t\telse\r\n\t\t\treturn false\r\n\t\tend\r\n\tend",
"def end\n @end_time = Time.now.utc\n end",
"def dye_lot\n data[:dye_lot]\n end",
"def tipoff()\n\t @court.tipoff()\n\tend",
"def apicoplast_targeted?\n @points >= 4\n end",
"def rl_end_of_line(count, key)\r\n @rl_point = @rl_end\r\n 0\r\n end",
"def add_end_marker_here(marker='--')\n register_a_parm End.new(marker, howmany: :NONE, debug: @debug)\n end",
"def end() end",
"def missing_end trace\n found :missing_end\n @lexer.undo trace\n end",
"def last_point\n path_points.last\n end",
"def tabling_end(length=5)\n tabling_start + length.days\n end",
"def process_statement_end(tk); end",
"def tld; end",
"def tld; end",
"def end_of_line\n self.cursor = :end\n end",
"def end_at\n I18n.l(object.end_at)\n end",
"def ending_at\n @ending_at ||= parse_or_at(@attrs[:ending_at]) if @attrs[:ending_at]\n end"
] | [
"0.608792",
"0.6024807",
"0.5757591",
"0.57191473",
"0.56061244",
"0.5377054",
"0.5359521",
"0.5351864",
"0.5342215",
"0.53189546",
"0.53144443",
"0.52976054",
"0.52976054",
"0.52810514",
"0.527212",
"0.52574164",
"0.5251169",
"0.52439976",
"0.52136254",
"0.519062",
"0.517847",
"0.51769716",
"0.51636535",
"0.5162105",
"0.51581585",
"0.51469743",
"0.5106551",
"0.5100683",
"0.50905335",
"0.5072459",
"0.50218636",
"0.5007182",
"0.5004987",
"0.50008065",
"0.49793002",
"0.49735856",
"0.4963732",
"0.49560407",
"0.49472952",
"0.49472952",
"0.49398905",
"0.49391544",
"0.49336916",
"0.49336916",
"0.49336916",
"0.49296921",
"0.49294156",
"0.49259964",
"0.49249658",
"0.49228635",
"0.49226972",
"0.49191925",
"0.49075407",
"0.49015462",
"0.48984325",
"0.4895526",
"0.4887498",
"0.48844728",
"0.48754936",
"0.48754936",
"0.48754936",
"0.48754936",
"0.48754936",
"0.48754936",
"0.48754936",
"0.48619783",
"0.48605812",
"0.48549953",
"0.48434034",
"0.4842667",
"0.4842032",
"0.4838712",
"0.4828824",
"0.48088953",
"0.48061633",
"0.48012018",
"0.48012018",
"0.48012018",
"0.48011136",
"0.47999707",
"0.47924286",
"0.47816718",
"0.4777964",
"0.47776726",
"0.47707582",
"0.47623965",
"0.47557637",
"0.474801",
"0.47410855",
"0.4735407",
"0.47346473",
"0.47320956",
"0.47269437",
"0.472642",
"0.47248065",
"0.47211552",
"0.47183228",
"0.47183228",
"0.47170445",
"0.471505",
"0.47115695"
] | 0.0 | -1 |
ENDPOINTS FOR ORGANIZATION SHOW | def org_show_data
org = Organization.find(params[:org])
@data = {
name: org.name,
website: org.website,
logo_link: org.logo_link,
users: user_names_and_emails_from_org(org)
}
render json: @data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_organizations(options = nil)\n require_relative 'telerivet/organization'\n self.cursor(Organization, get_base_api_path() + \"/organizations\", options)\n end",
"def orgs\n client.organizations\n end",
"def GetOrgs params = {}\n\n params = params.merge(path: 'organizations.json')\n APICall(params)\n\n end",
"def orgs(enterprise = 'default')\n @api.orgs enterprise\n end",
"def get_organization_info\n path = \"/d2l/api/lp/#{$lp_ver}/organization/info\"\n _get(path)\n # return: Organization JSON block\nend",
"def index\n @host_orgs = HostOrg.all\n end",
"def index\n if params[:terms]\n # Search mode\n @organizations = []\n JSON.parse(params[:terms]).map { |t| @organizations = @organizations | MnoEnterprise::Organization.where(Hash[*t]).fetch }\n response.headers['X-Total-Count'] = @organizations.count\n else\n # Index mode\n query = MnoEnterprise::Organization\n query = query.limit(params[:limit]) if params[:limit]\n query = query.skip(params[:offset]) if params[:offset]\n query = query.order_by(params[:order_by]) if params[:order_by]\n query = query.where(params[:where]) if params[:where]\n all = query.all\n\n all.params[:sub_tenant_id] = params[:sub_tenant_id]\n all.params[:account_manager_id] = params[:account_manager_id]\n\n @organizations = all.fetch\n\n response.headers['X-Total-Count'] = @organizations.metadata[:pagination][:count]\n end\n end",
"def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = org['href'].gsub(\"#{@api_url}/org/\", \"\")\n end\n results\n end",
"def endpoints_list\n get \"endpoints\"\n end",
"def organizations \n puts \"List of organizations:\"\nend",
"def admin_organization_stats\n get_admin_stats \"orgs\"\n end",
"def index\n @organizations = Spree::Organization.all\n end",
"def orgs\n @orgs ||= begin\n client.organizations.map(&:login)\n rescue Octokit::Unauthorized, Faraday::ConnectionFailed\n []\n end\n end",
"def get_organizations\n begin\n github_api_setup.organizations.list\n rescue Exception => e\n logger.error \"Github #get_organizations error #{e}\"\n end\n end",
"def list_org\n __log_activity\n __debug_route\n prm = paginator.initial_parameters.except(*Paginator::NON_SEARCH_KEYS)\n org = current_org and current_org!(prm, org)\n terms = prm.delete(:like)\n found = { list: get_accounts(*terms, **prm) }\n @list = paginator.finalize(found, **prm)\n opt = { locals: { name: org&.label } }\n respond_to do |format|\n format.html { render 'account/index', **opt }\n format.json { render 'account/index', **opt }\n format.xml { render 'account/index', **opt }\n end\n end",
"def index\n @organization_connections = OrganizationConnection.all\n end",
"def find_all_organizations\n get_url(\"https://api.github.com/users/#{current_user.username}/orgs\")\n end",
"def index\n @organizations = Organization.by_query(params[:q])\n end",
"def find_organizations\n Organization.all\n end",
"def getActiveOrgs\n UI.important(\"Getting organization active organizations from DB\")\n\n begin\n dynamodb = Aws::DynamoDB::Client.new(region: ENV.fetch(\"AWS_DEFAULT_REGION\", nil))\n\n items = dynamodb_full_scan(dynamodb,\n {\n table_name: \"Organizations\",\n projection_expression: \"id, #SE, #ST\",\n expression_attribute_names: {\n \"#SE\" => \"settings\",\n \"#ST\" => \"status\"\n },\n expression_attribute_values: {\n \":p\" => \"public\",\n \":s\" => true\n },\n filter_expression: \"#ST.active = :s AND #SE.listing = :p\"\n })\n\n orgs = []\n UI.important(\"Organization to BUILD:\")\n items.each do |item|\n orgs.push(item['id'])\n UI.important(item['id'])\n end\n\n return orgs\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.error(e.message)\n return nil\n end\nend",
"def get_orgs_list(grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'The list of organizations has been successfully retrieved.'\n grafana_options[:unknown_code_msg] = 'OrganizationApi::get_orgs_list unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/orgs/'\n\n _do_request(grafana_options)\n rescue BackendError\n nil\n end",
"def index\n @endpoints = @project.endpoints.all\n end",
"def organizations_in_vercinity\n\n\tend",
"def get_orgs_list(grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'The list of organizations has been successfully retrieved.'\n grafana_options[:unknown_code_msg] = 'OrganizationApi::get_orgs_list unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/orgs/'\n\n Array(do_request(grafana_options))\n rescue BackendError\n []\n end",
"def get_orgs_list(grafana_options)\n grafana_options[:method] = 'Get'\n grafana_options[:success_msg] = 'The list of organizations has been successfully retrieved.'\n grafana_options[:unknown_code_msg] = 'OrganizationApi::get_orgs_list unchecked response code: %{code}'\n grafana_options[:endpoint] = '/api/orgs/'\n\n Array(_do_request(grafana_options))\n rescue BackendError\n []\n end",
"def orgs(params = {})\n params.merge!(key: 'orgs')\n objects_from_response(Code42::Org, :get, 'org', params)\n end",
"def get_information_all_companies()\n\t\tpage = 275\n\t\tbegin\n\t\t\turl = create_url(\"organizations\",\"\",page)\n\t\t\tputs \"Reading #{url}\"\n\t\t\tresult = read_url(url)\n\t\t\t#save_json(result, [\"organizations\"])\n\n\t\t\tadd_organization_info(result,\"name\")\n\t\t\tadd_organization_info(result,\"path\")\n\t\t\t\n\t\t\tnext_url = result['data']['paging']['next_page_url']\n\t\t\tpage = page + 1\n\t\tend while next_url != nil\n\t\tcreate_permalink(@paths)\n\t\tsave_json(\"\", [\"names\", \"paths\", \"permalinks\"])\n\tend",
"def index\n @organizations = Organization.all\n respond_with(@organizations)\n end",
"def orgs\n @orgs = Organization.find(:all, :order => 'name ASC')\n\n respond_to do |format|\n format.html # orgs.html.erb\n format.xml { render :xml => @orgs }\n end\n end",
"def index\n @organizations = Organization.where(:id => current_user.organization_id)\n \n respond_with(@organizations)\n end",
"def list_organizations\r\n Organization.organizations_by_user(self)\r\n end",
"def list \n @organizations = Organization.all\n \n render \"list\"\n end",
"def get_organizations\n org_references =\n locations.each_with_object({}) do |loc, acc|\n reference = loc.resource.managingOrganization.reference\n org_id = reference.match(ID_MATCHER)[1]\n\n acc[org_id] ||= []\n acc[org_id] << loc\n end\n\n facility_identifiers = org_references&.keys&.join(',')\n org_response = organization_service.search(_id: facility_identifiers, _count: '100')\n\n org_response&.resource&.entry\n end",
"def show\n cf_get(path: \"/organizations/#{org_id}\")\n end",
"def list_endpoints\n render json: @endpoints, status: 200\n end",
"def admin_organizations_with_protocols\n Organization.authorized_for_identity(@id).joins(:sub_service_requests)\n end",
"def index\n @organizations = Organization.all\n respond_with @organizations\n end",
"def index\n @people = current_organization.people.all\n end",
"def own_organizations\n api.org_memberships.select { |org| org[:role] == \"admin\"}\n end",
"def list\n attrcheck = { 'compartment' => @options[:compartment] }\n @validate.validate(@options, attrcheck)\n opts = {}\n opts[:availability_domain] = @options[:availability_domain] if @options[:availability_domain]\n opts[:display_name] = @options[:display_name] if @options[:display_name]\n BmcAuthenticate.new(@options)\n request = OracleBMC::Core::ComputeClient.new\n request = request.list_instances(@options[:compartment], opts)\n request.data\n end",
"def get_endpoints\n response = @client.rest_get(@data['uri'] + '/endpoints')\n @client.response_handler(response)['members']\n end",
"def run\n super\n\n entity_name = _get_entity_name\n\n o = Opencorporates::Api.new.search entity_name\n o[\"results\"][\"companies\"].each do |result|\n next unless result[\"company\"]\n\n _create_entity \"Organization\", {\n \"name\" => result[\"company\"][\"name\"],\n \"uri\" => result[\"company\"][\"opencorporates_url\"],\n \"opencorporates\" => result\n }\n \n end\n end",
"def organization\n _get(\"/account/organization\") { |json| json }\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n @organizations = Organization.all\n end",
"def index\n if search_params \n logger.debug \"Got params: #{search_params}\"\n @organization = Organization.find(search_params)\n else\n logger.debug \"No params!\"\n end\n # @organizations = Organization.all\n end",
"def index\n @orgs ||= Github::Org.orgs(\n current_user_github_access_token,\n current_github_username\n )\n end",
"def index\n organizations = if params[:q]\n CclaSignature.search(params[:q])\n else\n Organization.includes(:ccla_signatures)\n end\n\n respond_to do |format|\n format.json do\n render json: organizations.to_json(only: [:id], methods: [:company])\n end\n end\n end",
"def index\n\t\t@organizations = Organization.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @organizations }\n\t\tend\n\tend",
"def create_organizations_api\n InfluxDB2::API::OrganizationsApi.new(@api_client)\n end",
"def index\n @clients_organizations = ClientsOrganization.all\n end",
"def index\n @admins_organizations = Organization.all\n end",
"def index\n @orgs = Org.all\n end",
"def index\n @organic_units = OrganicUnit.search(params[:search]).paginate(:per_page => 2, :page => params[:page])\n @title = \"Organic Units\"\n @orgs = OrganicUnit.all\n end",
"def index\n @organizations = Organization.all\n end",
"def current_user_oganizations\n endpoint = '/api/user/orgs'\n @logger.debug(\"Getting current user organizations (GET #{endpoint})\") if @debug\n get(endpoint)\n end",
"def index\n @organization_statuses = @organization.organization_statuses # .paginate(:page => params[:page]).per_page(10)\n end",
"def list_tenants_for_circle(args = {}) \n get(\"/tenantcircles.json/tenants\", args)\nend",
"def account_organization\n get('account/organization')\n end",
"def index\n if params[:search]\n @organizations = Organization.public_search(params[:search]).where(language: cookies[:locale].to_s).page params[:page]\n\n elsif params[:tag]\n sql = \"\"\"SELECT taggable_id FROM taggings\n WHERE taggable_type='Donatable::Organization'\n AND tag_id IN (SELECT id FROM tags WHERE name='#{params[:tag]}');\n \"\"\"\n org_ids = []\n ActiveRecord::Base.connection.select_all(sql).each do |org|\n org_ids << org['taggable_id']\n end\n @organizations = Kaminari.paginate_array(Organization.where(language: cookies[:locale].to_s, id: org_ids)).page(params[:page])\n\n\n else\n @organizations = Organization.where(language: cookies[:locale]).page params[:page]\n end\n end",
"def getInStoreOrgs\n UI.important(\"Getting organization active organizations from DB\")\n\n begin\n dynamodb = Aws::DynamoDB::Client.new(region: ENV.fetch(\"AWS_DEFAULT_REGION\", nil))\n\n items = dynamodb_full_scan(dynamodb,\n {\n table_name: \"Organizations\",\n projection_expression: \"id, #SE, #ST\",\n expression_attribute_names: {\n \"#SE\" => \"settings\",\n \"#ST\" => \"status\"\n },\n expression_attribute_values: {\n \":p\" => \"public\",\n \":s\" => true\n },\n filter_expression: \"#SE.in_stores = :s AND #SE.listing = :p\"\n })\n\n orgs = []\n UI.important(\"Organization to BUILD:\")\n items.each do |item|\n next unless (item[\"status\"][\"active\"] == true) && \\\n (item[\"id\"] != \"bfanteam\")\n\n orgs.push(item[\"id\"])\n UI.important(item[\"id\"])\n end\n\n return orgs\n rescue Aws::DynamoDB::Errors::ServiceError => e\n UI.error(e.message)\n return nil\n end\nend",
"def get_cloud_tfc_organization_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudApi.get_cloud_tfc_organization_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/cloud/TfcOrganizations'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CloudTfcOrganizationResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CloudApi.get_cloud_tfc_organization_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudApi#get_cloud_tfc_organization_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def orgs\n OrgsAPI.new(self)\n end",
"def org_endpoint(organization_id)\n \"#{FABRIC_ORGANIZATIONS_ENDPOINT}/#{organization_id}\"\n end",
"def organisms(name)\n opts = settings.services[name] or halt 404\n s = Service.new opts[\"root\"]\n s.select(\"Organism.*\").all\n end",
"def index\n if params[:name]\n @organizations = Organization.where(\"alias LIKE ?\", \"#{params[:name]}%\")\n else\n @organizations = Organization.all\n end\n end",
"def org_endpoint(session)\n \"#{FABRIC_ORGANIZATIONS_ENDPOINT}/#{session.organization_id}\"\n end",
"def core \n self.service.organization\n end",
"def index\n services = accessible_services.includes(:proxy, :account).order(:id).paginate(pagination_params)\n respond_with(services)\n end",
"def index\n services = accessible_services.includes(:proxy, :account).order(:id).paginate(pagination_params)\n respond_with(services)\n end",
"def find_organizations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrganizationsApi#find_organizations ...\"\n end\n \n # resource path\n path = \"/organizations\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'attribute'] = opts[:'attribute'] if opts[:'attribute']\n query_params[:'value'] = opts[:'value'] if opts[:'value']\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 = []\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<OrganizationComposite>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrganizationsApi#find_organizations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n redirect_to :root unless current_user.is_admin?\n @organizations = Organization.all\n end",
"def get_organisations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BlueOceanApi.get_organisations ...'\n end\n # resource path\n local_var_path = '/blue/rest/organizations/'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['jenkins_auth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Organisations')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BlueOceanApi#get_organisations\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n canonical_url(\"/animals\")\n \n @animals = Animal.includes(:animal_color, :animal_sex, :species, :status, :organization, :spay_neuter).\n where('public' => 1).\n paginate(:page => params[:page], :per_page => 10).\n order(\"updated_at DESC\").shuffle!\n \n @animals.select! {|animal| animal.organization.has_info? }\n respond_with(@animals)\n end",
"def describe_availability_zones\n @os_aws.describe_availability_zones\n end",
"def index\n @regionenvironments = Regionenvironment.all\n end",
"def organization(name, params = {})\n http.get \"/organization/#{name}\", params\n end",
"def organization(name, params = {})\n http.get \"/organization/#{name}\", params\n end",
"def tenant_list\n\t\t\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/tenants\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"invoking tenant-list...\"\n\t\t\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend",
"def index\n @orgs = policy_scope(Org)\n end",
"def list()\n puts \"Listing all endpoints\"\n load_manifest\n\n pp manifest.keys\n\n end",
"def organization_members(org)\n get \"/orgs/#{org}/members\"\n end",
"def index\n authorize @organization\n render :json => @organization.tags\n end",
"def list(params = nil)\n kadeploy_params = {}\n latest_only = if params[:action] == 'show'\n 'no'\n else\n params&.has_key?('latest_only') ? params['latest_only'] : 'yes'\n end\n\n username = params['user'] if params&.has_key?('user')\n name = params['name'] if params&.has_key?('name')\n arch = params['arch'] if params&.has_key?('arch')\n\n kadeploy_params['last'] = true unless latest_only == 'no' || latest_only == 'false'\n kadeploy_params['username'] = username if username\n\n http = call_kadeploy_environments(kadeploy_params)\n\n # When a username is present in the query's parameters, we only need to\n # make one request to kadeploy to retrieve the user's environments.\n # If user is anonymous (from X-Api-User-Cn), we only request kadeploy for\n # the public environments.\n if username || user == 'anonymous'\n environments = JSON.parse(http.body)\n else\n environments = JSON.parse(http.body)\n kadeploy_params['username'] = user\n http_user = call_kadeploy_environments(kadeploy_params)\n environments.push(JSON.parse(http_user.body)).flatten!\n end\n\n environments.map! { |e| format_environment(e) }\n environments.select! { |e| e['name'] == name } if name\n environments.select! { |e| e['arch'] == arch } if arch\n\n environments\n end",
"def fetch_databag_tenants\n db_tenants = Array.new\n chef_api_connect.search.query(:foundation, '*:*', start: 0).rows.each do |tenant|\n db_tenants << tenant['raw_data']['id']\n end\n return db_tenants\nend",
"def index\n @organizations = Organization.page(params[:page]).per_page(9).order(\"name DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organizations }\n end\n end",
"def index\n @organizations = Organization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organizations }\n end\n end",
"def index\n @people_organizations = PeopleOrganization.search(params[:search]).order(\"OrganizationName\")\n end",
"def index\n # internal\n manage_filter_state\n # OCO\n init_oco if !session[:organization]\n\n @search = Office.search do\n fulltext params[:search]\n if session[:organization] != '0'\n with :organization_id, session[:organization]\n end\n data_accessor_for(Office).include = [:company]\n order_by sort_column, sort_direction\n paginate :page => params[:page] || 1, :per_page => per_page\n end\n @offices = @search.results\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n format.js\n end\n\n # if session[:organization] != '0'\n # # OCO organization active\n # @offices = Office.joins(:company).where(companies: { organization_id: session[:organization] }).paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n # else\n # # OCO inactive\n # @offices = Office.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n # end\n end",
"def index\n @organization_accounts = OrganizationAccount.all.sort_by(&:organization_name).reverse\n \n if user_signed_in? && current_user.admin?\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @organization_accounts }\n end\n else\n redirect_to root_path\n end\n end",
"def endpoints\n endpoints = object.endpoints\n unless current_user.admin?\n endpoints = object.endpoints.select { |ep| ep.project.users.include?(current_user) }\n end\n endpoints.map { |e| e.id }\n end",
"def index\n @user_organizations = UserOrganization.all\n end",
"def organizations\n\t@organizations = Organization.all\n\t@organization_names = []\n\[email protected] do |o|\n\t\t@organization_names << o.name\n\tend\n\t\n\trespond_to do |format|\n\t\tformat.html { render :json => @organization_names }\n\tend\n end",
"def index\n @v1_provider_operations = V1::ProviderOperation.all\n end"
] | [
"0.7056028",
"0.6808707",
"0.66048837",
"0.6400812",
"0.6391337",
"0.63774014",
"0.6305355",
"0.6300352",
"0.6210934",
"0.6210487",
"0.61929846",
"0.6168134",
"0.61547947",
"0.6140128",
"0.60727775",
"0.60621315",
"0.6046288",
"0.60279566",
"0.59941375",
"0.59938157",
"0.59840274",
"0.5955349",
"0.5949269",
"0.59482557",
"0.5944205",
"0.5924895",
"0.5897105",
"0.58841836",
"0.58717465",
"0.5845736",
"0.5841577",
"0.58307654",
"0.5812708",
"0.5809895",
"0.58001095",
"0.5798075",
"0.57963324",
"0.57897115",
"0.57811",
"0.5780807",
"0.5772693",
"0.57498044",
"0.57451314",
"0.57205266",
"0.57205266",
"0.57205266",
"0.57205266",
"0.57205266",
"0.57205266",
"0.57205266",
"0.57205266",
"0.57205266",
"0.5720066",
"0.5716492",
"0.5709954",
"0.5705923",
"0.5705548",
"0.57035774",
"0.5698411",
"0.56919867",
"0.56914973",
"0.5681222",
"0.5663793",
"0.5662795",
"0.56595284",
"0.56539816",
"0.564677",
"0.5636107",
"0.56308794",
"0.5630452",
"0.56262344",
"0.56176066",
"0.5615653",
"0.5608292",
"0.55965406",
"0.55932313",
"0.55932313",
"0.55925584",
"0.5592468",
"0.55912006",
"0.5589525",
"0.55855995",
"0.5580986",
"0.5579223",
"0.5579223",
"0.557268",
"0.55666476",
"0.5566393",
"0.55622846",
"0.55582726",
"0.55479205",
"0.5543907",
"0.553387",
"0.55246395",
"0.5524193",
"0.5521275",
"0.55109644",
"0.5506588",
"0.550641",
"0.5504298",
"0.5496193"
] | 0.0 | -1 |
ENDPOINTS FOR REVIEW SHOW | def review_show_data
review = Review.find(params[:review])
@data = {
user_name: review.user.full_name,
user_id: review.user.id,
user_email: review.user.email,
org_name: review.user.organization.name,
org_id: review.user.organization.id,
vendor_name: review.vendor.name,
vendor_id: review.vendor.id,
rating: review.rating,
public_review: review.review_content,
private_review: review.review_private_content,
private_review_permission: private_review_permission(review.user),
logo_link: review.user.organization.logo_link,
days_ago: review.days_old
}
render json: @data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n respond_with :api, @review, @review.comments\n end",
"def view(options = {})\n\t \tget_records('-view', {}, options)\n\t end",
"def views()\n return uri(\"api/views/\")\n end",
"def index\n @reviewers = Reviewer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @reviewers }\n end\n end",
"def index\n @tour_reviews = TourReview.all\n end",
"def index\n @visitor_reviews = VisitorReview.all\n end",
"def show\n @questions = CareerAdvisorWebServices.new(\"\",\"\").get_short_form_ip\n # @questions = OnetWebService.new(\"arwins\",\"9436zfu\").get_interest_profiler_questions_60(1,60)\n end",
"def show\n render_result('Current API has no definition for just calling /docs. Call /docs/changes or /docs/deletes')\n end",
"def demos\n get_records \"demo\", \"/demos\"\n end",
"def index\n @reeviews = Reeview.all\n end",
"def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end",
"def overview\n\n end",
"def index\n @venue_reviews = VenueReview.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @venue_reviews }\n end\n end",
"def index\n @overviews = Overview.all\n end",
"def show\n @reviews = Review.where(site_id: @site.id).order(\"created_at DESC\")\n end",
"def show\n @performance_test = PerformanceTest.find(params[:id])\n # @performance_test_results = @performance_test.performance_test_results\n @performance_test_results = PerformanceTestResult.show_query(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @performance_test }\n end\n end",
"def show\n @orders = @client.orders.order(date: :desc).page(params[:orders_page]).per_page(10)\n @recipes = @client.recipes.order(date: :desc).page(params[:recipes_page]).per_page(10)\n # binding.pry\n end",
"def index\n # # if page value a param, use that, else ...\n # page = 3\n # request_url = MOVIE_DB_URL + \"&api_key=#{ENV[\"API_KEY\"]}\"\n genre_request_url = GENRE_URL + \"&api_key=#{ENV[\"API_KEY\"]}\"\n # request_url += \"&page=#{page}\"\n # if sort by release date\n # request_url += RELEASE_DATE_DESC_URL\n # if sort by title\n # request_url += RELEASE_DATE_DESC_URL;\n # @movies = Unirest.get(request_url).body[\"results\"]\n @genres = Unirest.get(genre_request_url).body[\"genres\"]\n # puts @genres\n end",
"def show\n @reviews = Review.where(project_id: @project.id).order(\"created_at DESC\")\n end",
"def index\n @exerciseoverviews = Exerciseoverview.all\n end",
"def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end",
"def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end",
"def index\n @admin_reviews = Review.all\n end",
"def index\n @section_previews = SectionPreview.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @section_previews.to_xml }\n end\n end",
"def index\r\n if params[:review_id].nil?\r\n @comments = Comment.all\r\n else\r\n @review = Review.find(params[:review_id])\r\n @comments = @review.comments\r\n end\r\n\r\n respond_to do |format|\r\n format.html\r\n format.xml { render :xml => @comments }\r\n end\r\n end",
"def index\n @restaurant_reviews = RestaurantReview.all\n end",
"def show\n @reviewer = Reviewer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @reviewer }\n end\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = Review.all\n end",
"def index\n @reviews = @post.reviews.all\n respond_with @post, @reviews\n end",
"def index\n @reviews = Review.all\n \n end",
"def index\n @reviews = Review.find(:all, :conditions => [\"created_at > ?\", Date.today.last_month], :limit => 10)\n @recent = @reviews.slice!(0)\n @tbr = Album.find_in_state(:all, \"TBR\", :order => \"created_at DESC\")\n \n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @reviews.to_xml }\n format.atom { render :layout => false}\n end\n end",
"def show\n @review = find_review\n end",
"def index\n @reviews = Review.find(:all, :limit => 10, :include => [:user, :package])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @review }\n end\n end",
"def results_view\n end",
"def index\n\t\t\t\t# @reviews = Driver.find_by!(id: params[:driver_id]).driver_reviews#.order('created_at DESC').to_a\n\t\t\t\t@reviews = DriverReview.where(driver_id: params[:driver_id])\n\t\t\tend",
"def view_reviews\n @submission = Submission.find(params[:id])\n @questions = @submission.assignment.questions.sort_by {|obj| obj.created_at }\n evaluation = @evaluations.where(:user_id => current_user.id)[0]\n @responses = @evaluations[0].responses.sort_by {|obj| obj.created_at }\n\n respond_to do |format|\n format.html { render view, :layout => 'no_sidebar' } # show.html.erb\n format.json { render json: @submission }\n end\n end",
"def show\n #this is going to be the individual review page using no. in db row using params array of :id. make sure we now create view page\n @review = Review.find(params[:id])\n end",
"def show\n @reviewer = Reviewer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reviewer }\n end\n end",
"def show\n @review = Review.find(params[:id])\n @venue = Venue.find(params[:id])\n\n\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end",
"def index\n @pre_training_reviews = PreTrainingReview.all\n end",
"def index\n @review_projects = ReviewProject.all\n @type_reviews = TypeReview.all\n end",
"def show\n authorize! :read, Rezlineitem\n @rezlineitems = @ticketrez.rezlineitems\n @show = @ticketrez.show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ticketrez }\n end\n end",
"def index\n @review_templates = ReviewTemplate.all\n end",
"def index\n @review_counts = ReviewCount.all\n end",
"def show\n helpers.beers_update_watchlist(params[:id])\n @reviews = Review.where(beer: Beer.find(params[:id]))\n end",
"def show\n id = params.keys[1] # Query variable is the ID of the TV show that the user clicks on.\n\n #template = Addressable::Template.new('https://api.themoviedb.org/3/tv/{?query*}?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US')\n #url = template.expand({\"query\" => id})\n #response = HTTParty.get(url)\n\n url = Addressable::URI.parse(\"https://api.themoviedb.org/3/tv/#{id}?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US\")\n response = HTTParty.get(url)\n\n @show = JSON.parse(response.body, symbolize_names: true) \n end",
"def index\n @employee_reviewers = EmployeeReviewer.all\n end",
"def index\n @hm_reviews = HmReview.all\n end",
"def index\n reviews = Review.all\n render json: reviews\n end",
"def index\n reviews = Review.all\n render json: reviews\n end",
"def index\n @item_reviews = ItemReview.all\n end",
"def index\n @item_reviews = ItemReview.all\n end",
"def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end",
"def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end",
"def index\n\t\t@store_reviews = @store.store_reviews;\t\t\n\tend",
"def index\n @reviews_and_ratings = ReviewsAndRating.all\n end",
"def show\n @venue_review = VenueReview.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @venue_review }\n end\n end",
"def show\n RestaurantReview.find(params[:id])\n end",
"def index\n render json: Album.find(params[:album_id]).reviews\n end",
"def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @review }\n end\n end",
"def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @review }\n end\n end",
"def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @review }\n end\n end",
"def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @review }\n end\n end",
"def views\n @views\n end",
"def index\n # 自分がフォローしている人のReview(公開中)\n @review_today = Review.where(user_id: current_user.id, created_at: Time.current.at_beginning_of_day..Time.current.at_end_of_day)\n @reviews_follow = Review.where(user_id: current_user.followings.pluck(:id), active: true).includes(:user).order(created_at: \"DESC\").page(params[:page]).per(LIMIT_PER_PAGE)\n end",
"def views\n @views\n end",
"def index\n @product_reviews = ProductReview.all\n end",
"def index\n @comment_shows = CommentShow.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @comment_shows }\n end\n end",
"def show\n @latest_version = @service.latest_version\n @latest_version_instance = @latest_version.service_versionified\n @latest_deployment = @service.latest_deployment\n\n @all_service_version_instances = @service.service_version_instances\n @all_service_types = @service.service_types\n\n @soaplab_server = @service.soaplab_server\n\n @pending_responsibility_requests = @service.pending_responsibility_requests\n unless is_api_request?\n @service_tests = @service.service_tests\n @test_script_service_tests = @service.service_tests_by_type(\"TestScript\")\n @url_monitor_service_tests = @service.service_tests_by_type(\"UrlMonitor\")\n end\n if @latest_version_instance.is_a?(RestService)\n @grouped_rest_methods = @latest_version_instance.group_all_rest_methods_from_rest_resources\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml # show.xml.builder\n format.json { render :json => @service.to_json }\n end\n end",
"def views(repo, options = {})\n opts = ensure_api_media_type(:traffic, options)\n get \"#{Repository.path repo}/traffic/views\", opts\n end",
"def show\n\n respond_to do |format|\n format.html #show\n format.json { render json: @review }\n end\n end",
"def host_review(host_review, options = {})\n get(\"host_reviews/#{host_review}\", options).pop\n end",
"def index\n page = 1\n request_url = MOVIE_DB_URL + \"&api_key=#{ENV[\"API_KEY\"]}\"\n request_url += \"&page=#{page}\"\n # if sort by release date\n # request_url += RELEASE_DATE_DESC_URL\n # if sort by title\n # request_url += RELEASE_DATE_DESC_URL;\n @movies = Unirest.get(request_url).body[\"results\"]\n end",
"def get_initial_reviews\n\n\t\t# return api call for just one review\n\tend",
"def show\n @comments = @rfx.get_all_comments\n end",
"def index\n @company_reviews = CompanyReview.all\n end",
"def show\n find_review\n find_show\n respond_to do |f|\n f.html {render :show}\n f.json {render json: @review}\n end\n end",
"def show\n @tour_reviews = TourReview.new\n end",
"def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end",
"def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end",
"def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end",
"def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end",
"def show\n @review = Review.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review }\n end\n end",
"def index\n @reviews = @place.reviews\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n end\n end",
"def show\n require 'uri'\n require 'net/http'\n @tradier_api_key = ENV['tradier_api_key']\n @baseurl_tradier = ENV['baseurl_tradier'] # /options/expirations\"\n @recommendations = Recommendation.all\n @bookmarks = Optionbookmark.select{ |o| o['user_id']==current_user.id}\n \n #get stock quotes and setup ticker\n begin\n @ticker = Livequotetradier.new(@stock.ticker)\n @ticker_logo = (StockQuote::Stock.logo(@stock.ticker)).url\n @ticker_company_whatitdoes = (StockQuote::Stock.company(@stock.ticker))\n if !@ticker\n p \"ticker could not be fetched using tradier api\"\n @ticker = StockQuote::Stock.quote(@stock.ticker)\n end\n\n if @ticker\n #Get expiry date of options with API\n options_e_dates = Optionexpirydates.new(@ticker.symbol)\n @expirydates_data = options_e_dates.e_dates\n\n cached_optionchain_result(@ticker.symbol, @expirydates_data)\n \n end\n\n rescue StandardError, NameError, NoMethodError, RuntimeError => e\n p \"Rescued: #{e.inspect}\"\n p e.backtrace\n @ticker = nil\n else\n ensure\n end\n \n end",
"def index\n render_json content: Review.all\n end",
"def index\n respond_with(end_user_plans)\n end",
"def index\n @employee_reviews = EmployeeReview.all\n end",
"def index\n @shop_reviews = ShopReview.all\n end",
"def comments; rest_query(:comment); end"
] | [
"0.66014105",
"0.6285805",
"0.62088877",
"0.614456",
"0.6116951",
"0.6116429",
"0.606658",
"0.60662127",
"0.60527855",
"0.6047994",
"0.5989912",
"0.59546494",
"0.59368235",
"0.5930159",
"0.5903922",
"0.5897852",
"0.5896169",
"0.5878332",
"0.58773404",
"0.58623713",
"0.5855419",
"0.5855419",
"0.5819022",
"0.5818533",
"0.5802514",
"0.5797684",
"0.577707",
"0.5774181",
"0.5774181",
"0.5774181",
"0.5774181",
"0.5774181",
"0.5774181",
"0.5774181",
"0.5774181",
"0.5774181",
"0.5774181",
"0.5774181",
"0.5774181",
"0.5766779",
"0.5746198",
"0.5745272",
"0.57369363",
"0.5729183",
"0.57276523",
"0.5721891",
"0.5707279",
"0.56989586",
"0.5694136",
"0.5677656",
"0.5675241",
"0.5665445",
"0.5664522",
"0.56599236",
"0.5658055",
"0.5651182",
"0.56496656",
"0.5640961",
"0.5637224",
"0.56342614",
"0.56342614",
"0.56246793",
"0.56246793",
"0.5622454",
"0.5622454",
"0.5616278",
"0.561303",
"0.560729",
"0.56055075",
"0.5603688",
"0.5600351",
"0.5600351",
"0.5600351",
"0.5600351",
"0.55941373",
"0.5591202",
"0.5588836",
"0.5586312",
"0.55803144",
"0.55796826",
"0.55691624",
"0.55652434",
"0.55583954",
"0.5551684",
"0.55424887",
"0.55420274",
"0.5541209",
"0.5537567",
"0.55328",
"0.5531245",
"0.5531245",
"0.5531245",
"0.5531245",
"0.5531245",
"0.5529857",
"0.55233026",
"0.5521151",
"0.55202264",
"0.5516146",
"0.55142874",
"0.5508052"
] | 0.0 | -1 |
ENDPOINTS FOR USER SHOW | def user_show_data
user = User.find(params[:user])
@data = {
name: user.full_name,
email: user.email,
title: user.title,
school_name: user.organization.name,
logo_link: user.organization.logo_link,
points: user.points,
reviews: reviews_from_user(user),
protips: protips_from_user(user),
receives_weekly_digest: user.receives_weekly_digest,
active: user.active
}
render json: @data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end",
"def list_users\n self.class.get('/users')\n end",
"def get_users(request); end",
"def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend",
"def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend",
"def list_all_users\n\n end",
"def users\n get('get_users')\n end",
"def get_users(options)\n @client.raw('get', '/config/users', options)\n end",
"def list\n get('users')['users']\n end",
"def list_user_names(iam)\r\n list_users_response = iam.list_users\r\n list_users_response.users.each do |user|\r\n puts user.user_name\r\n end\r\nend",
"def user_list(offset = 0, limit = 100)\n api.get('user', offset: offset, limit: limit)\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end",
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def get_user_info(list)\n\trequire 'net/http'\n\tNet::HTTP.get(ENV[\"VERITAS-USER-SERVER\"] + \"/users?user_ids=#{list}\")\nend",
"def user_list\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/users/\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"Here is a list of users...\"\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend",
"def list_users\n tp @users, :real_name, :slack_id, :user_name => {:display_method => :name}\n end",
"def show\n ldap = Net::LDAP.new\n @user = @server.users.all#(user_params)\n \n end",
"def info()\n _params = {}\n return @master.call 'users/info', _params\n end",
"def view_all_users\n # !! get all user so can interact after viewing them? all_users\n # User.select(:username).each_with_index {|user, index| puts \"#{index+1}. #{user.username}\"}\n #??????\n User.select(:username).each {|user| puts user.username}\n end",
"def index\n respond_with ApidUser.all\n end",
"def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\t# A filter used to exclude specific types of users\n\t\t\tclient.add_param(kparams, 'filter', filter);\n\t\t\t# A limit for the number of records to display on a page\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.queue_service_action_call('user', 'list', 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 users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end",
"def list_users(query = {})\n aws_service_client.list_users(query)\n end",
"def get_users_list\n service_response = AdminManagement::Users::UserList.new(params).perform\n render_api_response(service_response)\n end",
"def index\n @users = UserService.all_users\n end",
"def list_users_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/users\", args)\nend",
"def me\n users(request(\"users/authenticate.xml\", :auth => true))\n end",
"def users_list(options = {})\n if block_given?\n Pagination::Cursor.new(self, :users_list, options).each do |page|\n yield page\n end\n else\n get(\"users\", options)\n end\n end",
"def list_users(workspace)\n puts \"\\nUser List\\n\\n\"\n tp workspace.users, \"id\", \"name\", \"real_name\", \"status_text\", \"status_emoji\"\nend",
"def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend",
"def users(params = {})\n make_get_request('/account/users', params)\n end",
"def list_users(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListUsers'\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\tself.run(args)\n\tend",
"def users\n result_hash['usr']\n end",
"def index\n\t\t@user = User.all\n\t\tCUSTOM_LOGGER.info(\"Start to return users #{@user.to_yaml}\")\n\tend",
"def info()\n get(:session, {:method => \"user.getInfo\"})\n end",
"def query_users(options = nil)\n policy = create_policy(options, AdminPolicy, default_admin_policy)\n command = AdminCommand.new\n command.query_users(@cluster, policy)\n end",
"def fields\n Iterable.request(conf, '/users/getFields').get\n end",
"def all_users(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'users', params)\n end",
"def list_users()\n response = HTTParty.get(\"https://graph.microsoft.com/v1.0/users\", { \n headers: {\n \"Authorization\" => \"Bearer #{bearerToken}\",\n \"Host\" => 'graph.microsoft.com' \n }\n })\n return JSON.parse response.read_body\n end",
"def users\n\n end",
"def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end",
"def list_users\n BrickFTP::API::User.all\n end",
"def list_users\n BrickFTP::API::User.all\n end",
"def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end",
"def list_users(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListUsers'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :marker\n\t\t\targs[:query]['Marker'] = optional[:marker]\n\t\tend\n\t\tif optional.key? :max_items\n\t\t\targs[:query]['MaxItems'] = optional[:max_items]\n\t\tend\n\t\tself.run(args)\n\tend",
"def index\n\t\tusers = User.where.not(id: current_user.id)\n\t\texpose users, each_serializer: UserSerializer\n end",
"def get_all_info_from_user()\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"SELECT * FROM users\")\n end",
"def getAllUsers()\n puts \"\\nUSERS:\"\n puts \"-------------------------------------------------\"\n @users.each {|user| puts \"ID: \" + user.id.to_s + \" Name: \" + user.name}\n puts \"-------------------------------------------------\"\n end",
"def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end",
"def index\n if token_and_options(request)\n access_key = AccessKey.find_by_access_token(token_and_options(request))\n @user = User.find_by_id(access_key.user_id)\n \n p \"INDEx\"\n end\n end",
"def users()\n\t\t\tend",
"def index\n @params = params\n @list = get_list_via_solr('user')\n @api_response = {\n users: @list,\n meta: { pagination: pagination_params }\n }\n render json: @api_response\n end",
"def index\n @users = GuestUsers::User.where(host: current_user) || []\n end",
"def index\r\n respond_with User.all\r\n end",
"def user_management_get_all_users page: nil, per_page: nil\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"page\" => page,\n \"per_page\" => per_page,\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.get query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 400\n raise APIException.new \"Bad request\", 400, response.raw_body\n elsif response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end",
"def users\n \n end",
"def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end",
"def show \n available_users\n end",
"def index\n @v2_users = V2User.all\n end",
"def show\n\t\t# Find all users with id passed by params.\n\t\t@user = User.find(params[:id])\n\t\tCUSTOM_LOGGER.info(\"Start to find users #{@user.to_yaml}\")\n\tend",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def list\n # ask the user_repository for a list of all the users\n users = @user_repository.all\n # pass that list to the view to display\n @view.list_users(users)\n end",
"def new_list_users\n\n end",
"def users\n\t\trespond_with User.all\n\tend",
"def select_all_user_info()\n return get_db_as_hash().execute(\"SELECT * FROM user\")\n end",
"def get(context)\n res = context.transport.get_request(context, 'security/users')\n\n context.err(res.body) unless res.success?\n\n Puppet::Util::Json.load(res.body).map do |user|\n keys_to_snake_case(user.merge({ 'ensure' => 'present' }))\n end\n end",
"def users_for_a_project\n uri = \"#{@api_url}/#{@project_id}/users?access_token=#{@access_token}\"\n get uri\n end",
"def index\n\t\t# current_user.cdg_id\n\t\t@@users = SoapConnection::ChoferUsers.users( (1 rescue 1) ).compact rescue []\n\t\t@users = @@users\n\tend",
"def list_users(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/user/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end",
"def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end",
"def show\n json_emitter ::Services::UserSessions::Users::Show\n end",
"def index\n # index not implemented - only admins may list users\n raise \"This action is not implemented\"\n end",
"def list_user(param = '1110')\n @group_users.each { |item| puts item.info(param) }\n end",
"def user(options={})\n get('/user', options)\n end",
"def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end",
"def users\n\t\t\telems = []\n\t\t\tget_resource_link(:users, \"users\", \"user\").each do |data|\n\t\t\t\telems << data\n\t\t\t\t# elems << User.new(data)\n\t\t\tend\n\t\t\telems\n\t\tend",
"def index\n @v1_users = V1::User.all\n end",
"def query\n ::User.all\n end",
"def show\n @client = basic_connect\n @user_info = @client.user_info['user']\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_token }\n end\n end",
"def list_users(offset=0, limit=20)\n target = \"#{self.base_url}/user/\"\n options = {\n basic_auth: self.auth,\n query: {\n _limit: limit,\n _offset: offset\n }\n }\n self.class.get(target, options)\n end",
"def index\n @users = User.find_all_with_authorization(current_user)\n end",
"def index\n #@users = User.all\n @users = User.where(tenant_id: current_tenant.id)\n render json: {\n message: 'Your All Users',\n user: @users\n }\n end",
"def index\n StatsManager::StatsD.time(Settings::StatsConstants.api['user']['index']) do\n if params[:ids]\n ids = params[:ids].split(\",\")\n if ids.length <= 10\n @users = User.find(ids)\n @status = 200\n else\n render_error(400, \"too many ids included (max 10)\")\n end\n elsif user_signed_in?\n @status = 200\n @user = current_user\n @user_personal_roll_subdomain = (@user.public_roll and @user.public_roll.subdomain)\n render 'v1/user/show'\n else\n render_error(401, \"current user not authenticated\")\n end\n end\n end",
"def users!(access = {})\n json = Api::Request.new do |request|\n request[:access] = access\n request[:method] = :GET\n request[:path] = '/mgmt/{{client_id}}/account/users'\n end.execute!\n\n json[:users].map do |user|\n GroupDocs::User.new(user)\n end\n end",
"def guests\n raw_response = get_request('users/guests')\n parse_response(raw_response, :users)\n end",
"def list_current_users *args\r\n puts \"not implemented yet\"\r\n end",
"def list\n @all_users = User.find(:all)\n end",
"def user_info\n response = from_server \"api/user.json\"\n response.data\n end",
"def users\n gateway_check\n @users\n end",
"def users_index\n\t\[email protected]_list($users)\n\t\[email protected]_view(@current_user, @current_user.actions)\n\tend",
"def index\n @api_v1_user_device_infos = Api::V1::UserDeviceInfo.all\n end",
"def index\n users = User.all\n json_response(users)\n end",
"def all\n response = conn.get do |request|\n request.url \"/v1/admin/users.json\"\n end\n\n response.body[\"users\"].map {|attributes| Nuwe::User.new(attributes)}\n end",
"def user_search(options = {})\n get('users/search', options)\n end",
"def list_users\n @users = User.find(:all)\n end",
"def users\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::User)\n end",
"def index\n json_response(User.all) \n end",
"def index\n setup_stats\n setup_superuser_facets\n @users = User.all\n add_institution_filter! # if they chose a facet or are only an admin\n @sort_column = user_sort_column\n @users = @users.order(@sort_column.order).page(@page).per(@page_size)\n end",
"def list\n\t\t\t# Author\n\t\t\tauthorize! :manage, User\n\n\t\t\t# Get params\n\t\t\tpage \t\t\t= \t(params[:page] || 1).to_i\n\t\t\tper \t\t\t=\t(params[:per] || 24).to_i\n\t\t\tsearch_params \t=\tparams[:search] || {}\n\t\t\torder_params \t= \tparams[:order] || {}\n\n\t\t\t# Get users\n\t\t\tusers = User.list_search_with_params search_params, order_params\n\n\t\t\t# Render result\n\t\t\trespond_to do |f|\n\t\t\t\tf.html {\n\t\t\t\t\trender 'list',\n\t\t\t\t\t\tlayout: 'layout_back',\n\t\t\t\t\t\tlocals: {\n\t\t\t\t\t\t\tusers: \tusers,\n\t\t\t\t\t\t\tpage: \tpage,\n\t\t\t\t\t\t\tper: \tper\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tf.json {\n\t\t\t\t\tusers_in_page = users.page page, per\n\n\t\t\t\t\t# Check if empty\n\t\t\t\t\tif users_in_page.count == 0\n\t\t\t\t\t\trender json: {\n\t\t\t\t\t\t\tstatus: 1\n\t\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\trender json: {\n\t\t\t\t\t\t\tstatus: 0,\n\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\tlist: render_to_string(\n\t\t\t\t\t\t\t\t\tpartial: 'list',\n\t\t\t\t\t\t\t\t\tformats: :html,\n\t\t\t\t\t\t\t\t\tlocals: {\n\t\t\t\t\t\t\t\t\t\tusers: users_in_page\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tpaginator: render_to_string(\n\t\t\t\t\t\t\t\t\tpartial: '/shared/pagination',\n\t\t\t\t\t\t\t\t\tformats: :html,\n\t\t\t\t\t\t\t\t\tlocals: {\n\t\t\t\t\t\t\t\t\t\ttotal: \tusers.count,\n\t\t\t\t\t\t\t\t\t\tper: \tper,\n\t\t\t\t\t\t\t\t\t\tpage: \tpage\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend\n\t\tend",
"def list(queries: nil, search: nil)\n path = '/users'\n\n params = {\n queries: queries,\n search: search,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::UserList\n )\n end"
] | [
"0.73242354",
"0.73199177",
"0.70855397",
"0.7056486",
"0.7056486",
"0.704903",
"0.70306647",
"0.70243",
"0.6888942",
"0.688186",
"0.685705",
"0.6855818",
"0.684113",
"0.68373734",
"0.68334675",
"0.6820913",
"0.6799318",
"0.6761416",
"0.67281425",
"0.6679518",
"0.6673047",
"0.6670715",
"0.66700286",
"0.66433704",
"0.6638053",
"0.66150784",
"0.6598948",
"0.6582207",
"0.65724254",
"0.65453464",
"0.65449286",
"0.65415597",
"0.6520611",
"0.64999825",
"0.6499926",
"0.6492924",
"0.6492355",
"0.64834595",
"0.6478396",
"0.64739025",
"0.6451425",
"0.6443931",
"0.6443474",
"0.6443474",
"0.64375913",
"0.6435543",
"0.6430268",
"0.6420521",
"0.64194214",
"0.6407942",
"0.6405643",
"0.64038014",
"0.640115",
"0.63835305",
"0.6383093",
"0.6375242",
"0.6366936",
"0.6364173",
"0.63498354",
"0.63466215",
"0.6342843",
"0.6341988",
"0.6340838",
"0.63304377",
"0.63301575",
"0.6328416",
"0.6322574",
"0.63210064",
"0.6319706",
"0.630479",
"0.6294954",
"0.62939733",
"0.62909716",
"0.6284042",
"0.62818855",
"0.6281555",
"0.62810856",
"0.62800545",
"0.6278914",
"0.62773675",
"0.6276739",
"0.6272272",
"0.6259638",
"0.62410253",
"0.623182",
"0.6231351",
"0.62286997",
"0.6224591",
"0.6219862",
"0.62151843",
"0.62036127",
"0.6200445",
"0.6198798",
"0.6193601",
"0.61913055",
"0.6190835",
"0.61851263",
"0.61823183",
"0.61804223",
"0.61793286",
"0.61744064"
] | 0.0 | -1 |
ENDPOINTS FOR VENDOR SHOW | def vendor_show_data
vendor = Vendor.find(params[:vendor])
@data = {
id: vendor.id,
name: vendor.name,
cpa_preferred: vendor.preferred,
street: vendor.street,
website: vendor.website,
city_state_and_zip: vendor.city_state_and_zip,
categories_array: categories_from_vendor(vendor),
schools_array: school_relationships_from_vendor(vendor),
point_people_array: point_people_from_vendor(vendor)
}
render json: @data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vendors\n fetch(@config[:sales_path], 'Sales.getVendors')\n end",
"def getVendors\n fetch(@config[:sales_path], 'Sales.getVendors')\n end",
"def index\n @admin_vendors = Vendor.all\n end",
"def show\n \n @product = Product.find(params[:id])\n @vendors = @product.vendor(:all)\n #@vendors = Vendor.find(params[:id])\n #@vendors = Vendor.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def index\n @vendors = Vendor.all\n end",
"def index\n @vendors = Vendor.all\n end",
"def index\n @vendors = Vendor.all\n end",
"def vendors\n FarMar::Vendor.market_vendors(@market_id)\n end",
"def vendors_and_regions\n fetch(@config[:finance_path], 'Finance.getVendorsAndRegions')\n end",
"def vendors\n FarMar::Vendor.by_market(id)\n end",
"def getVendorsAndRegions\n fetch(@config[:finance_path], 'Finance.getVendorsAndRegions')\n end",
"def vendors\n FarMar::Vendor.by_market(self.id)\n end",
"def index\n @vendors = Vendor.all.page(params[:page]).per(5)\n end",
"def endpoints_list\n get \"endpoints\"\n end",
"def get_Vendor\n getElement_text(\"cust_vendors\").click\n getElement_text(\"vendors\").click\n end",
"def show\n @products = @vendor.products\n end",
"def show\n\t\t@registers = @device.registers\n\t\t@versions = @device.versions\n\t\t@licences = @device.licences\n\t\t#@versions = Versions.find :all, :conditions => \"client_id = '#{@client_index}'\" # and id in @device.versions\"\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @device }\n end\n end",
"def list_endpoints\n render json: @endpoints, status: 200\n end",
"def clients\n @clients = Vendor.find(params[:id]).clients\n end",
"def vendors\n return FarMar::Vendor.by_market(@market_id)\n end",
"def set_endpoints\n @endpoints = Endpoint.where('client_tag like ?', \"%#{params[:client_tag]}%\")\n .where('name like ?', \"%#{params[:request_name]}%\")\n end",
"def index\n @roles = @vendor.roles.vendor_only # TODO change to roles\n end",
"def list_inventors\n \tjson_out(Inventor.all)\n\tend",
"def display_resource(vendor)\n vendor.name\n end",
"def vendor; end",
"def index\n if api_key.blank? \n user = spree_current_user\n @users = user.vendors\n else\n @users = current_api_user.vendors\n end \n end",
"def user_vendor_subscriptions\n get(\"/api/v1/oauth_user_vendor_subscriptions.json\")\n end",
"def vendor_search\n convention = Convention.find(params[\"id\"])\n @search_results = convention.convention_vendor_search(params[\"search\"])\n end",
"def products\n FarMar::Product.by_vendor(id)\n end",
"def products\n FarMar::Product.by_vendor(id)\n end",
"def vendor\n nic_view.vendor\n end",
"def index\n @vendor_features = VendorFeature.all\n end",
"def products\n FarMar::Product.by_vendor(self.id)\n end",
"def products\n Product.find_all_by_vendor_id(@id)\n end",
"def show\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vendor }\n end\n end",
"def products\n Product.find_by_vendor(@id)\n end",
"def vendor_details\n authenticate_request('Vendor')\n if @current_user\n vendor_details = @current_user.as_json\n yearly_quote_count = Agents::Branches::AssignedAgents::Quote.where(vendor_id: @current_user.id).where(\"created_at > ?\", 1.year.ago).group(:property_id).select(\"count(id)\").to_a.count\n vendor_details[:yearly_quote_count] = yearly_quote_count\n vendor_details[:quote_limit] = Agents::Branches::AssignedAgents::Quote::VENDOR_LIMIT\n vendor_details[:is_premium] = @current_user.buyer.is_premium\n render json: vendor_details, status: 200\n end\n end",
"def list_vs_services(options)\n options['method'] = \"vs\"\n dir_list = get_dir_item_list(options)\n message = \"vSphere Services:\"\n handle_output(options,message)\n dir_list.each do |service|\n handle_output(options,service)\n end\n handle_output(options,\"\")\n return\nend",
"def vendor\n FarMar::Vendor.all.find {|instance| instance.id == vendor_id}\n end",
"def vendors ##DON'T NEED TO PASS IN AN ARGUMENT JUST THE VALUE FROM THE ARGUMENT!!!!\n # lookup every vendor that matches this market id\n FarMar::Vendor.by_market(@id)\n ##OMG YAY, REMEMBER THIS TO BRING IN CLASSES FOR DIFFERENT METHODS,\n ##bring in class object and method and pass in the id from market\n end",
"def get_vendors( session_key)\n response_xml = self.call( :get_vendors, message: {\n arg0: session_key\n })\n response = IssueCentre::Response.parse( response_xml)\n end",
"def index\n\n @enterprise = current_user\n @drivers = @enterprise.drivers\n\n #logeando vista drivers con autos desde enterprise\n @cars = @enterprise.cars\n # @drivers = Driver.all\n end",
"def products(ven_id)\n FarMar::Product.all.find_all { |product| product.vendor_id == ven_id }\n end",
"def index\n @vendor_relationships = current_user.vendor_relationships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vendor_relationships }\n end\n end",
"def show\n advertisement = nil\n consumer_page_view = @consumer.crumbs.map{ |crumb| crumb.beacon_id }.uniq.sample\n if consumer_page_view\n @sem3.products_field( \"upc\", Beacon.find(consumer_page_view).first_party_data.sample )\n advertisement = @sem3.get_products\n end\n\n logger.debug \"Advertisement : #{advertisement}\"\n\n respond_to do |format|\n if advertisement\n format.html # show.html.erb\n format.json { render json: advertisement['results'].first }\n else\n format.html # show.html.erb\n format.json { render json: {\"status\" => \"error\"}, status: :not_found }\n end\n end\n end",
"def get_vendor_relationships()\n build_header_auth('/vendor_relationships', API_VERSION_1, 'GET')\n build_request()\n request = Net::HTTP::Get.new(@uri.request_uri)\n @header.each do |name, value|\n request[name] = value\n end\n response = @http.request(request)\n # response.body = JSON.parse(response.body)\n return response\n end",
"def index\n @q = DeviceManufacturer.search(params[:q])\n @device_manufacturers = @q.result(distinct: true).page(params[:page])\n\n respond_with(@device_manufacturers)\n end",
"def vendor\n FarMar::Vendor.all.select { |vendor| vendor.vendor_id == vendor_id }\n end",
"def vendor\n FarMar::Vendor.all.select { |vendor| vendor.vendor_id == vendor_id }\n end",
"def list_inviting_agent_and_property\n if user_valid_for_viewing?(['Vendor'], params[:udprn].to_i)\n #if true\n @current_user = Vendor.find(533)\n vendor_id = @current_user.id\n invited_vendors = InvitedVendor.where(email: @current_user.email, source: Vendor::INVITED_FROM_CONST[:family]).select([:agent_id, :udprn])\n udprns = invited_vendors.map(&:udprn)\n bulk_details = PropertyService.bulk_details(udprns)\n response = []\n\n bulk_details.each_with_index do |detail, index|\n detail[:address] = PropertyDetails.address(detail)\n response_hash = {}\n response_hash[:udprn] = detail[:udprn]\n response_hash[:address] = detail[:address]\n agent_fields = [:agent_id, :assigned_agent_first_name, :assigned_agent_last_name, :assigned_agent_email, :assigned_agent_mobile,\n :assigned_agent_office_number, :assigned_agent_image_url, :assigned_agent_branch_name, :assigned_agent_branch_number,\n :assigned_agent_branch_address, :assigned_agent_branch_website, :assigned_agent_branch_logo]\n property_attrs = [:beds, :baths, :receptions, :property_type, :property_status_type ]\n agent_fields.each {|field| response_hash[field] = detail[field] }\n property_attrs.each {|field| response_hash[field] = detail[field] }\n response.push(response_hash)\n end\n\n render json: response, status: 200\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end",
"def list_inventors\n json_out(Inventor.all)\n end",
"def list_inventors\n json_out(Inventor.all)\n end",
"def index\n @endpoints = @project.endpoints.all\n end",
"def index\n apis = site_account.api_docs_services\n .published\n .with_system_names((params[:services] || \"\").split(\",\"))\n .select{ |api| api.specification.swagger_1_2? }\n\n respond_with({\n swaggerVersion: \"1.2\",\n apis: apis.map!{ |service| swagger_spec_for(service) },\n basePath: \"#{request.protocol}#{request.host}\"\n })\n end",
"def index\n respond_with ApidDriver.all\n end",
"def vservers\n @vservers=get_endpoint('vservers').keys\n end",
"def show\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendor }\n end\n end",
"def show\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendor }\n end\n end",
"def show\n @vendor = Vendor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vendor }\n end\n end",
"def index\n @vendedor_clientes = VendedorCliente.all\n end",
"def index\n @vendor_addresses = VendorAddress.all\n end",
"def vendor\n FarMar::Vendor.find(@vendor_id)\n end",
"def perform_get_vendor_agreement_details(params, version) \n\t\t$tracer.trace(\"GameStopPaymentServiceDSL: #{__method__}, Line: #{__LINE__}\")\n\t\t$tracer.report(\"Should #{__method__}.\")\n\t\tsvc_req = self.get_request_from_template_using_global_defaults(:get_vendor_agreement_details, PaymentServiceRequestTemplates.const_get(\"GET_VENDOR_AGREEMENT_DETAILS#{version}\"))\n\t\tsvc_req_data = svc_req.find_tag(\"get_vendor_agreement_details_request\").at(0)\n\n\t\tsvc_req_data.client_channel.content = params[\"client_channel\"]\n\t\tsvc_req_data.reference_number.content = params[\"reference_number\"]\n\t\t\n\t\t$tracer.trace(svc_req.formatted_xml)\n svc_rsp = self.get_vendor_agreement_details(svc_req.xml)\n svc_rsp.code.should == 200\n\n $tracer.trace(svc_rsp.http_body.formatted_xml)\n return svc_rsp\n\tend",
"def products\n request :public, :get, :products\n end",
"def interfaces_list\n [\n {\n 'uri' => '/catalogues',\n 'method' => 'GET',\n 'purpose' => 'REST API Structure and Capability Discovery'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'GET',\n 'purpose' => 'List all NSs or specific NS',\n 'special' => 'Use version=last to retrieve NSs last version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific NS by its uuid'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'POST',\n 'purpose' => 'Store a new NS'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored NS specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored NS by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update NSD status'\n },\n {\n 'uri' => '/catalogues/network-services',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific NS specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/network-services/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific NS by its uuid'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'GET',\n 'purpose' => 'List all VNFs or specific VNF',\n 'special' => 'Use version=last to retrieve VNFs last version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific VNF by its uuid'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'POST',\n 'purpose' => 'Store a new VNF'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored VNF specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored VNF by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update VNFD status'\n },\n {\n 'uri' => '/catalogues/vnfs',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific VNF specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/vnfs/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific VNF by its uuid'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'GET',\n 'purpose' => 'List all Packages or specific Package',\n 'special' => 'Use version=last to retrieve Packages last version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific Package by its uuid'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'POST',\n 'purpose' => 'Store a new Package'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored Package specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'PUT',\n 'purpose' => 'Update a stored Package by its uuid',\n 'special' => 'Use status=[inactive, active, delete] to update PD status'\n },\n {\n 'uri' => '/catalogues/packages',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific Package specified by vendor, name, version'\n },\n {\n 'uri' => '/catalogues/packages/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Delete a specific Package by its uuid'\n },\n {\n 'uri' => '/catalogues/packages/{id}/status',\n 'method' => 'PUT',\n 'purpose' => 'Updates the status of a Package {\"status\": \"active\" / \"inactive\"} as valid json payloads'\n },\n {\n 'uri' => '/catalogues/son-packages',\n 'method' => 'GET',\n 'purpose' => 'List all son-packages or specific son-package'\n },\n {\n 'uri' => '/catalogues/son-packages',\n 'method' => 'POST',\n 'purpose' => 'Store a new son-package'\n },\n {\n 'uri' => '/catalogues/son-packages/{id}',\n 'method' => 'GET',\n 'purpose' => 'List a specific son-package by its uuid'\n },\n {\n 'uri' => '/catalogues/son-packages/{id}',\n 'method' => 'DELETE',\n 'purpose' => 'Remove a son-package'\n }\n ]\n end",
"def get_drivers\n drivers\n end",
"def platform_availability_endpoints\n PlatformAvailabilityEndpointsController.instance\n end",
"def interfaces_list\n\t\t[\n\t\t\t{\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'purpose' => 'REST API Structure and Capability Discovery'\n\t\t\t}\n\t\t]\n\tend",
"def get_endpoints()\n return {\n 'meta' => 'meta/all.json',\n 'headlines' => 'headline/all.json',\n 'schema' => 'meta/schema.json',\n 'reporting' => 'stats/reporting.json',\n 'disaggregation' => 'stats/disaggregation.json',\n 'translations' => 'translations/translations.json',\n 'zip' => 'zip/all_indicators.json',\n 'indicator_downloads' => 'downloads/indicator-downloads.json',\n 'data_packages' => 'data-packages/all.json',\n }\n end",
"def get_endpoints()\n return {\n 'meta' => 'meta/all.json',\n 'headlines' => 'headline/all.json',\n 'schema' => 'meta/schema.json',\n 'reporting' => 'stats/reporting.json',\n 'disaggregation' => 'stats/disaggregation.json',\n 'translations' => 'translations/translations.json',\n 'zip' => 'zip/all_indicators.json',\n 'indicator_downloads' => 'downloads/indicator-downloads.json',\n 'data_packages' => 'data-packages/all.json',\n }\n end",
"def index\n @vendor_subscriptions = VendorSubscription.all\n end",
"def vendor\n FarMar::Vendor.all.find { |vendor| vendor.id == vendor_id }\n end",
"def index\n endpoint(get(services_url).body)\n end",
"def index\n #@vendors = current_user.vendors.asc(:market_name).asc(:name).paginate(:per_page => 20, :page => params[:page])\n @vendors = current_user.vendors.asc(:name)#.paginate(:per_page => 20, :page => params[:page])\n end",
"def show\n@productos = @vendedor.producto.all\n end",
"def products\n FarMar::Product.all.select { |product| product.vendor_id == id }\n end",
"def tenant_list\n\t\t\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/tenants\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"invoking tenant-list...\"\n\t\t\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend",
"def index\n @catalog_devices = Catalog::Device.all\n end",
"def vendors\n vendors_at_market = []\n vendors = FarMar::Vendor.all\n vendors.each do |vendor|\n if vendor.market_id == self.id # Since this is an instance method I am looking at the ID of the FarMar::Market object I am calling .vendors on (i.e. the \"self\")\n vendors_at_market << vendor\n end\n end\n return vendors_at_market\n end",
"def vendor\n FarMar::Vendor.find(@vendor_id)\n end",
"def vendor\n return array_of_instances(FarMar::Vendor.all, \"vendor_id\", vendor_id).first\n end",
"def vendor\n FarMar::Vendor.all.find { |vendor| vendor.id == @vendor_id }\n end",
"def show\n respond_with(@device_manufacturer)\n end",
"def index\n @manufacturer_partners = ManufacturerPartner.all.order(:name)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @manufacturer_partners }\n format.json { render json: @manufacturer_partners }\n end\n end",
"def show\n @vendor = Vendor.find(params[:id])\n @transactions = @vendor.transactions\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vendor }\n end\n end",
"def show\n @brief_vendor = BriefVendor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brief_vendor }\n end\n end",
"def index\n @otg_clients = OtgClient.all\n end",
"def endpoints; end",
"def show\n @manufacturer_partner = ManufacturerPartner.find(params[:id])\n @logos = SiteElement.where(\"name LIKE '%logo_inconcert_%'\").order(:name)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @manufacturer_partner }\n format.json { render json: @manufacturer_partner }\n end\n end",
"def index\n @category = params[:category].nil? ? \"Vendors\" : params[:category]==\"dealer\" ? \"Dealers Room\" : \"Artists Alley\"\n @vendors = Vendor.where(approved: true)\n @vendors = @vendors.where(category: params[:category]) if params[:category]\n @vendors = @current_user ? @vendors.or(Vendor.where(user_id: @current_user)) : @vendors\n end",
"def vendor\n Reggora::Resources::Vendor.new(config)\n end",
"def initialize\n @vendors = []\n end",
"def response(env)\n uid = env.params['uid']\n if uid.nil?\n [200, {}, erb(:default, :locals => {:uid => nil, :pub0 => nil, :page => nil})]\n else\n pub0 = env.params['pub0']\n page = env.params['page']\n begin\n\n offers = Application.offersService.getOffers(uid, pub0, page)\n [200, {}, erb(:offers, :locals => {:offers => offers, :uid => uid, :pub0 => pub0, :page => page})]\n rescue Exception => error\n [200, {}, erb(:error, :locals => {:errorMsg => error.message, :uid => uid, :pub0 => pub0, :page => page})]\n end\n end\n end",
"def get_endpoint()\n end",
"def index\n @vices = Vice.all\n end",
"def index\n respond_with(accessible_services)\n end",
"def get_endpoints\n response = @client.rest_get(@data['uri'] + '/endpoints')\n @client.response_handler(response)['members']\n end",
"def list()\n puts \"Listing all endpoints\"\n load_manifest\n\n pp manifest.keys\n\n end",
"def index\n @vendors = Vendor.order(sort_column + \" \" + sort_direction) # tweaked\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vendors }\n end\n end",
"def index\n respond_with ProductNodes.all\n end"
] | [
"0.71276915",
"0.6970254",
"0.6654423",
"0.6549704",
"0.6472122",
"0.6472122",
"0.6472122",
"0.645279",
"0.63179594",
"0.63037854",
"0.6262793",
"0.61439794",
"0.6089756",
"0.6039669",
"0.6014477",
"0.5992804",
"0.59864867",
"0.5979668",
"0.59590286",
"0.5951987",
"0.5897339",
"0.58944124",
"0.58749384",
"0.5865803",
"0.58159935",
"0.5815764",
"0.5813391",
"0.5787912",
"0.57854193",
"0.57854193",
"0.5783646",
"0.578053",
"0.5776837",
"0.5774681",
"0.57445663",
"0.5732812",
"0.570993",
"0.5709886",
"0.56870836",
"0.56870127",
"0.56811583",
"0.5670799",
"0.5648627",
"0.56409925",
"0.5639251",
"0.56348807",
"0.5634838",
"0.5631364",
"0.5631364",
"0.56307286",
"0.5626557",
"0.5626557",
"0.562494",
"0.5616636",
"0.56105167",
"0.5609827",
"0.5594781",
"0.5594781",
"0.5594781",
"0.5587918",
"0.5584729",
"0.55612195",
"0.55580497",
"0.5540366",
"0.55380964",
"0.55377877",
"0.5534221",
"0.5503149",
"0.54703397",
"0.54703397",
"0.5460071",
"0.54568845",
"0.54460883",
"0.54409504",
"0.54301643",
"0.5429026",
"0.5423311",
"0.54180133",
"0.5416114",
"0.5412024",
"0.5410524",
"0.54018784",
"0.5397594",
"0.5395138",
"0.53947634",
"0.53918785",
"0.538907",
"0.53859967",
"0.5380893",
"0.53757405",
"0.53705424",
"0.5359875",
"0.5359763",
"0.5355961",
"0.5354419",
"0.53437996",
"0.5341599",
"0.5338844",
"0.53387845",
"0.5338485"
] | 0.5696897 | 38 |
ENDPOINTS FOR CATEGORY SHOW | def category_show_data
category = Category.find(params[:category])
@data = {
name: category.full_name,
vendors: vendors_data_from_category(category),
protips: protips_from_category(category)
}
render json: @data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end",
"def index\n respond_with Category.all\n end",
"def categories\n expose Metadata.categories(@oauth_token)\n end",
"def get_category\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"def catalog_dcat()\n return uri(\"api/dcat.json\")\n end",
"def categories\n add_to_query restrict_kind: 'category'\n end",
"def do_get_cats_data\n message = {country_id: @client.country_code, webapi_key: @client.webapi_key}\n @client.call(:do_get_cats_data, message: message)\n end",
"def categories\n # list results from search results piped in from side nav categories\n @experiments = Experiment.find(:status => true)\n respond_to do |format|\n format.html { render :action => \"list\" }\n format.xml { render :xml => @experiments }\n end\n\n end",
"def getCategories(_, _, _)\n @db.categories\n end",
"def all_categories\n end",
"def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end",
"def index\n @api_v1_group_categories = Api::V1::GroupCategory.all\n end",
"def index\n @categories = CategoryService.index\n end",
"def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend",
"def categories\n category\n end",
"def categories(query_object)\n\t\tdata = do_get_json(CATEGORIES_ENDPOINT, query_object)\n\tend",
"def list_by_category\n category = Category.where(id: params[:category_id])\n if category.any? then\n @products = category.first.products\n if @products.any? then \n render json: @products, status: 200\n else\n render json: { message: \"Não há produtos associados a categoria informada\" }, status: 404\n end\n else\n render json: { message: \"Não foi encontrada a categoria informada\" }, status: 404\n end\n end",
"def category; end",
"def show\n # Render 404 if category_id not valid\n raise(ActionController::RoutingError, 'not found') unless collections_config[params[:category_id].to_sym]\n\n # If category_id is valid look up any additional solr parameters\n @category = send params[:category_id].to_sym\n facet_name = @category.use_queries ? \"featured_search\" : @category.facet\n response = AcademicCommons.search do |parameters|\n parameters.rows(0).facet_limit(-1)\n if @category.use_queries # {!ex=pt key=valueKey}field:query\n @category.values.each { |key, value| parameters.add_facet_query \"{!ex=featured_search key=#{key}}#{value.query}\" }\n else\n parameters.facet_by(facet_name)\n @category.filter.each { |f, v| parameters.filter(f, v) }\n end\n end\n\n facet_counts = @category.use_queries ? response.facet_queries : response.facet_fields[facet_name].each_slice(2).to_a.to_h\n facet_counts.keep_if { |k, _| @category.values.keys.include?(k) } if @category.values.present?\n\n @collections = facet_counts.map do |value, count|\n filters = { facet_name => value }.merge(@category.filter)\n c = @category.values.fetch(value, OpenStruct.new(label: value))\n c.count = count\n c.search_url = search_url(filters)\n c\n end\n end",
"def index\n @categories = collections_config.values\n end",
"def index\n page_info = get_paging_order_info\n @search = Category.search(params[:q])\n @categories = @search.result(:distinct => true).paginate(page: page_info[:page], per_page: page_info[:limit])\n end",
"def show\n #show all kind categories\n @categories = Category.where(:category_id => params[:id])\n @freds = Fred.where(:category_id => params[:id]).order(\"updated_at DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @categories }\n end\n end",
"def category_lister\n Category.all.each_with_index do |cat, idx|\n puts \"#{idx + 1}: #{cat.name}\"\n end\n end",
"def category\n @articles = Article.with_category(params[:category], params[:search] || \"top_requested\")\n respond_with(:articles, template: \"articles/index\")\n end",
"def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"def show\n\n @category = Category.find(params[:id])\n @products = Product.category(@category.title).page(params[:page]).per(6).asc(:list_order)\n @title = @category.title\n @brands = Brand.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end",
"def category\n data['category']\n end",
"def show\n @category = Category.friendly.find(params[:id])\n @title = @category.name\n @description = @category.meta_desc if @category.meta_desc.present?\n @keywords = @category.meta_key if @category.meta_key.present?\n @categories = Category.all\n @products = Product.where(category_id: @category, visible: 1).paginate(:page => params[:page], :per_page => 12).order(\"sort_top = 1 DESC\").order(name: :asc)\n end",
"def show\n @backend_categories = Backend::Category.find(params[:id])\n end",
"def get_products_by_category\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"def get_category id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get CATEGORIES, id )\n\t\t\t\tend",
"def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_categories ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_search'] = opts[:'filter_search'] if !opts[:'filter_search'].nil?\n query_params[:'filter_active'] = opts[:'filter_active'] if !opts[:'filter_active'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'PageResourceCategoryResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @categories = Category.all\n respond_with(@categories)\n end",
"def index\n @q = scope.search(categories_name_eq: params[:category])\n @dishes = @q.result.includes(:categories).order(\"categories.position\")\n\n c = Hash.new {|x,v| x[v] = []}\n @dishes = @dishes.reduce(c) do |h, dishe|\n dishe.categories.each do |c|\n h[c.name] << dishe\n end\n h\n end.reject {|c, d| d.blank? }\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n @page_title = params[:id].capitalize\n @things = Thing.paginate(:page => page, :per_page => Setting.articles_per_page, :order => \"created_at DESC\", 'categories.name' => params[:id])\n @sources = Source.all('categories.name' => params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end",
"def category\n client.categories.find(data[\"categoryId\"])\n end",
"def index\n offer_categories = Offer.where(name: params[:offer_name])\n .joins(:categories).pluck('DISTINCT(categories.name)')\n\n respond_with offer_categories\n end",
"def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end",
"def index\n @hive_categories = HiveInformation.all\n end",
"def index\n\t\t@post_categories = SpudPostCategory.grouped\n\t\trespond_with @post_categories\n\tend",
"def show\n render json: @category\n end",
"def index\n categories = {\n \"categoryId\": params[:ids]\n }\n auction_categories = Auction::Category.list categories\n if auction_categories[:comm][:code] == \"200\"\n render json: {status: auction_categories[:comm][:code].to_i, msg: auction_categories[:comm][:msg], data: {auction_categories: auction_categories[:data]}}\n else\n render json: {status: auction_categories[:comm][:code].to_i, msg: auction_categories[:comm][:msg], data: {}}\n end\n end",
"def show\n authorize! :read, @category\n end",
"def index\n @product_categories = Product::Category.all\n end",
"def get_categories\n @categories = Category.all(:include => :products)\n @products_total = Product.count\n @category = Category.find(params[:category_id]) unless params[:category_id].nil?\n end",
"def index\n @categs = Categ.all\n end",
"def show\n @category = Category.find(params[:id])\n @search = @category.products.search(params[:q])\n @products = @search.result.page(params[:page]).per(current_user.list_page_size)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end",
"def getcategories\n category_size = RequirementCategory.all.length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n\n \tif current_offset + direction < category_size && current_offset + direction >= 0\n offset = current_offset + direction\n \t@categories = RequirementCategory.all.offset(offset).take(10) \n \trender :json => @categories\n else\n \trender :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n\n\tend",
"def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end",
"def index\n categories = @vertical.catgories.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded categories', data:categories},status: :ok\n end",
"def index\n\t@categories = Category.all\n\tend",
"def index\n @cathegories = Cathegory.all\n end",
"def source_result_category_names\n category_names\n end",
"def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end",
"def getCategory( category_id)\n params = Hash.new\n params['category_id'] = category_id\n return doCurl(\"get\",\"/category\",params)\n end",
"def index_by_category\n @category = Category.find_by(id: params[:id])\n @products = @category.products\n render :index\n end",
"def category_list_builder\n categories = API.get_categories\n categories.each do |cat|\n Category.new(cat)\n end\n end",
"def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend",
"def category\n @data['category']\n end",
"def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end",
"def categories\n get('venues/categories').categories\n end",
"def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end",
"def index\n @categories = Category.all\n if params[:showall] == \"false\"\n @products = Product.get_discounted\n else\n @products = Product.all\n end\n\n if params[:order] == \"ascending\"\n @products = Product.order(:price)\n elsif params[:order] == \"descending\"\n @products = Product.order(price: :desc)\n end\n\n if params[:category]\n @products = Category.find_by(name: params[:category]).products\n end\n end",
"def categories_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OtherApi.categories_list ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Category>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OtherApi#categories_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n authorize! :read, @category\n end",
"def index\n\t\t# simply call filter with category \"All\"\n\t\t@cat = \"All\"\n\t\tfilter\n end",
"def index\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end",
"def index\n @categories = Category.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end",
"def articles\n return AP.category(@id)\n end",
"def index\n if params[:id]\n @category = Category.find(params[:id])\n else\n @category = Category.find_or_create_by_name(ASSOCIATION.short_name)\n end\n @unknowns = Category.find_all_unknowns\n end",
"def show\n cat = @cathegory.sub_cathegories.map(&:id) << @cathegory.id\n @articles = Article.where(cathegory_id: cat)\n\n end",
"def show\n render json: category\n end",
"def get_categories\n @redis.smembers category_collection_key\n end",
"def methds\n [ :category_id, :name, :description, :handle, :url, :customer_ids, :image_ids, :created_at, :updated_at ]\n end",
"def category_keys\n @backend.category_keys\n end",
"def show\n @consumer_category = ConsumerCategory.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @consumer_category }\n end\n end",
"def index\n if @category\n @products = @category.products\n else\n @products = Product.find(:all)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def index\n @search = Backend::Category.order(created_at: :desc).search(params[:q])\n @backend_categories = @search.result(:distinct => true)\n @backend_categories = @backend_categories.page(params[:page])\n # @search = Supervisor.search(params[:q])\n # @supervisors = @search.result(:distinct => true)\n end",
"def category\n @services = Service.where(\"category = ?\", params[:category])\n @category = Service.categories.key(params[:category].to_i)\n end",
"def show\n @category = Category.by_alias params[:alias]\n raise ActionController::RoutingError, 'Not found' if @category.nil?\n\n @children = @category.children\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end",
"def show\n render json: @accessory_category\n end",
"def index\n @category = Category.all\n end",
"def index\n @product_cats = ProductCat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_cats }\n end\n end",
"def index\n @categories = Category.all\n @categories.each do |category|\n authorize! :read, category\n end\n render json: @categories\n end",
"def list_categories\n Category.all.each.with_index(1) {|x, i| puts \"#{i}. #{x.name}\"} #Scraper.categories.each.with_index(1) {|category, i| puts \"#{i}. #{category[0]}\"}\n puts \"select the number of the category you would like to browse or type 'exit'\"\n end",
"def index\n\t\t@categories = Category.all\n\tend",
"def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @categories }\n end\n end",
"def index\n @topics = @category.topics.preload(:category)\n render 'api/v1/topics/index'\n end",
"def show\n # now in get_category method\n \t# @category = Category.find(params[:id])\n\n end",
"def index\n @all_categories = CateItem.all\n end",
"def find_product_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ProductCategoryApi.find_product_categories ...'\n end\n # resource path\n local_var_path = '/product_categories'\n\n # query parameters\n query_params = {}\n query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :csv) if !opts[:'tags'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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 = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<ProductCategory>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProductCategoryApi#find_product_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @kategory = Kategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kategory }\n end\n end",
"def index\n\n\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end",
"def categories()\n db = connect()\n db.execute('SELECT * FROM categories')\n end",
"def index\n @sys_categories = Sys::Category.all\n end",
"def index\n @categories = Category.all\n respond_to do |format|\n format.html\n #format.json { render :json => @categories.map(&:attributes) }\n format.json { render :json => @categories.where(\"name like ? \",\"%#{params[:q]}%\") }\n end\n end",
"def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def index\n categories = Category.all\n\n if params[:limit]\n categories = categories.limit(params[:limit])\n end\n\n render json: CategorySerializer.new(categories).serializable_hash\n end",
"def show\n respond_to do |format|\n format.json {render :json => @top_category.to_json }\n end\n end",
"def show\n @title = t(\"h2.categories\")\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @category }\n end\n end",
"def catalogs\n path = \"#{api_root}/index/catalogs\"\n process_api_request(:get, path)\n end"
] | [
"0.71500504",
"0.7063677",
"0.69246775",
"0.6790988",
"0.663246",
"0.6573214",
"0.6539908",
"0.6531344",
"0.65190494",
"0.65156454",
"0.65152013",
"0.65041834",
"0.6491196",
"0.64877033",
"0.6477225",
"0.647094",
"0.6460429",
"0.64420354",
"0.6441421",
"0.6426239",
"0.641645",
"0.64028215",
"0.63850456",
"0.63694555",
"0.6362019",
"0.63614374",
"0.6359322",
"0.6345748",
"0.6343301",
"0.6343011",
"0.63406307",
"0.6329036",
"0.6325391",
"0.630912",
"0.6306781",
"0.63011247",
"0.62937677",
"0.62839514",
"0.62831783",
"0.6280401",
"0.6270001",
"0.62669224",
"0.62620044",
"0.6248015",
"0.6245116",
"0.623774",
"0.6230132",
"0.6222342",
"0.6218201",
"0.6211782",
"0.6211695",
"0.6211285",
"0.62076104",
"0.62022036",
"0.61999816",
"0.6195502",
"0.61940056",
"0.6192723",
"0.61924624",
"0.618779",
"0.61841846",
"0.61824244",
"0.6181773",
"0.61648214",
"0.6163906",
"0.61633575",
"0.61606663",
"0.61606663",
"0.6159705",
"0.6154423",
"0.6150451",
"0.6143355",
"0.6138453",
"0.6136138",
"0.61361223",
"0.61359394",
"0.6131935",
"0.61248314",
"0.61168927",
"0.61145234",
"0.6113396",
"0.61129344",
"0.6111654",
"0.61088616",
"0.61076283",
"0.6106109",
"0.6092931",
"0.60869455",
"0.60830617",
"0.60828346",
"0.6082502",
"0.6081805",
"0.6081521",
"0.6079133",
"0.607883",
"0.60766256",
"0.6075771",
"0.6075725",
"0.6075518",
"0.6065902",
"0.6056195"
] | 0.0 | -1 |
behold! extracting flag flag level and category from icon src because its nowhere to be found. Possible PITA. | def flag_from_img(img_src)
_crap, category, level = /([1-9])_([1-9])/.match(img_src).to_a
{ Tribes::FLAG_CATEGORIES[category.to_i] => level }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def icon\n primary_category ? primary_category[\"icon\"] : \"https://foursquare.com/img/categories/none.png\"\n end",
"def icon\n primary_category ? primary_category[\"icon\"] : \"https://foursquare.com/img/categories/none.png\"\n end",
"def ImageList_ExtractIcon(hi, himl, i)\r\n ImageList_GetIcon(himl, i, 0)\r\n end",
"def restore_icon src_fname\n File.open(src_fname, \"rb\") do |f|\n parse f\n if data.first == \"PNG\"\n \"\\x89PNG\" +f.read(self.size-4)\n else\n icondir = [\n 0, # Reserved. Must always be 0.\n 1, # image type: 1 for icon (.ICO), 2 for cursor (.CUR). Other values are invalid\n 1, # number of images in the file\n ].pack(\"v3\")\n bitmap_hdr = data.first # BITMAPINFOHEADER\n icondirentry = ICODIRENTRY.new(\n bitmap_hdr.biWidth,\n bitmap_hdr.biHeight / (%w'ICON CURSOR'.include?(type) ? 2 : 1),\n 0, # XXX: bColors: may be wrong here\n 0,\n 1,\n bitmap_hdr.biBitCount,\n bitmap_hdr.biSizeImage,\n icondir.size + 2 + ICODIRENTRY::SIZE # offset of BMP data from the beginning of ICO file\n )\n # ICONDIRENTRY is 2 bytes larger than ICODIRENTRY\n icondir + icondirentry.pack + \"\\x00\\x00\" + bitmap_hdr.pack + f.read(self.size)\n end\n end\n end",
"def category_in_icon_name\n case category\n when 0\n \"icon_clean\"\n when 1\n \"icon_nanny\"\n when 2\n \"icon_time\"\n when 3\n \"icon_fix\"\n else\n \"icon_clean\"\n end\n end",
"def flow_category_icon taxon\n icon = taxon.icon_file_name\n\n while icon.blank? && (taxon = taxon.parent)\n icon = taxon.icon_file_name\n end\n\n taxon && taxon.icon_file_name ? taxon.icon.url : nil\n end",
"def feed_icon(activity)\n img = case activity_type(activity)\n when \"StatusUpdate\"\n \"friend_guy.gif\"\n when \"BlogPost\"\n \"note.gif\"\n when \"Entry\"\n \"page_white_edit.png\"\n when \"Comment\"\n \"comment.png\"\n when \"WallComment\"\n parent_type = activity.item.commentable.class.to_s\n case parent_type\n when \"BlogPost\"\n \"comments.gif\"\n when \"Photo\"\n \"comments.gif\"\n when \"Event\"\n \"comments.gif\"\n when \"User\"\n \"wall_post.gif\"\n when \"Group\"\n \"wall_post.gif\"\n when \"NewsItem\"\n \"comments.gif\"\n end\n when \"Friendship\"\n if activity.item.friend.admin?\n \"affiliation.gif\"\n else\n \"friend.gif\"\n end\n when \"ForumPost\"\n \"note.png\"\n when \"Topic\"\n \"discussion.gif\"\n when \"User\"\n \"edit_profile.gif\"\n when \"Gallery\"\n \"gallery.png\"\n when \"Photo\"\n \"photo.gif\"\n when \"Event\"\n \"event.gif\"\n when \"EventAttendee\"\n \"fbpage_add.gif\"\n when \"Group\"\n if activity.owner.class.to_s == \"Group\"\n \"edit_profile.gif\"\n else\n \"group.gif\"\n end\n when \"Membership\"\n \"group.gif\"\n when \"NewsItem\"\n if activity.owner.class.to_s == \"User\"\n \"note.gif\"\n elsif activity.owner.class.to_s == \"Group\"\n \"marketplace.gif\"\n elsif activity.owner.class.to_s == \"Widget\"\n \"notifications.gif\"\n end\n else\n raise \"無法辨識活動類型 #{activity_type(activity).inspect}\"\n end\n image_tag(\"icons/#{img}\", :class => \"icon\")\n end",
"def icon\n icon = Icon.where(:id => icon_id).first\n icon ||= package_branch.icon\n icon ||= package_category.icon\n\n icon\n end",
"def icon_parse(char, hash={})\n\t\tif hash['visible'].include?('y')\n\t\t\t$_TAGHASH_['GSP'].concat(char)\n\t\telse\n\t\t\t$_TAGHASH_['GSP'].gsub!(char,'')\n\t\tend\n\tend",
"def icons_info\n @icons_info ||= icons_file\n end",
"def IconKNEELING(hash={}); icon_parse(' GH ', hash); end",
"def flag_tag(locale, size = '24x24')\n image_tag(\"locomotive/icons/flags/#{locale}.png\", class: \"flag flag-#{locale}\", size: size)\n end",
"def icons_info\n @icons_info ||= icons_file\n end",
"def icon\n if (@place[\"categories\"][0] != nil)\n @place[\"categories\"][0][\"icon\"][\"prefix\"] + \"64\" + @place[\"categories\"][0][\"icon\"][\"suffix\"]\n else\n \"https://ss1.4sqi.net/img/categories_v2/building/default_64.png\"\n end\n end",
"def icon\n \"#{data_content_type.gsub(/[\\/\\.]/,'-')}.png\"\n end",
"def icon\n \"#{data_content_type.gsub(/[\\/\\.]/,'-')}.png\"\n end",
"def icon ; @phase_shift ? 280 : nil ; end",
"def cheri_icon\n @cheri_icon ||= get_icon('cheri_icon_16x16.png')\n end",
"def get_mode_icon(mode)\n Mode.unscoped.where(code: 'mode_' + mode.downcase).first.try(:logo_url)\n end",
"def getGroupIcon _obj, _args\n \"_obj getGroupIcon _args;\" \n end",
"def icon\n if !corrected\n return dash_icon\n else\n if star\n return star_icon\n elsif score == 7\n return v_icon\n else\n return x_icon\n end\n end\n end",
"def icon\n if !layer.icon.nil?\n layer.icon.image.url(:smaller)\n end\n end",
"def icon_index(level = @skl_level)\n return @skl_levelcache[level][:icon_index]\n end",
"def feed_icon(activity)\n img = case activity_type(activity)\n when \"Blog\"\n \"blog.gif\"\n when \"Comment\"\n parent_type = activity.item.commentable.class.to_s\n case parent_type\n when \"Blog\"\n \"comment.gif\"\n when \"Event\"\n \"comment.gif\"\n when \"Topic\"\n \"new.gif\"\n end\n when \"Topic\"\n \"add.gif\"\n when \"Event\"\n \"time.gif\"\n when \"EventAttendee\"\n \"check.gif\"\n when \"Document\"\n \"document.gif\"\n when \"Chatroom\"\n \"check.gif\"\n when \"Group\"\n \"check.gif\"\n when \"GroupUser\"\n \"check.gif\"\n else\n raise \"Invalid activity type #{activity_type(activity).inspect}\"\n end\n image_tag(\"icons/#{img}\", :class => \"icon\")\n end",
"def icon_index\n MapConfig::ICONS[@type];\n end",
"def imagga_images_info\n self.images.non_installation.collect do |image|\n image_options = { :image_url => image.filename.to_s }\n image_options.merge! pattern: image.pattern.name if image.pattern.present?\n image_options.merge! thumb_url: image.s3_path if image.s3_path.present?\n { :url => image.filename.to_s.gsub('https','http').gsub('-dev',''), :id => image.filename.path, :filepath => image.filename.path, :metadata => self.specifications_hash.merge(image_options) }\n end.flatten\n end",
"def icons(key)\n (icons_info[key.to_s] || key)\n end",
"def document_header_icon(document)\n level = document.level\n case level\n when 'collection'\n 'search'\n when 'File'\n 'compact'\n else\n 'compact'\n end\n end",
"def icon\n if filename == '..'\n 'filemanager/folderup.jpg'\n elsif directory?\n \"filemanager/folder.jpg\"\n else\n \"filemanager/icons/#{filetype}.gif\"\n end\n end",
"def icon \n iconstring = \"\"\n iconstring << \"<i class=\\\"icon-book\\\"></i>\" if self.items.find(:all, conditions: [\"medium = 'read'\"]).any?\n iconstring << \"<i class=\\\"icon-music\\\"></i>\" if self.items.find(:all, conditions: [\"medium = 'track'\"]).any?\n iconstring << \"<i class=\\\"icon-film\\\"></i>\" if self.items.find(:all, conditions: [\"medium = 'show'\"]).any?\n\n iconstring\n\n end",
"def icondir ; @icondir ||= './' ; end",
"def get_icon(extension)\n ICONS.each do |ext_type|\n # Compare the extension to each value in the list\n ext_type.each do |value|\n if extension == value\n return ext_type[0]\n end\n end\n end\n \n # If extension doesn\"t match anything on the list, return default\n return \"default\"\n end",
"def icon_index(item)\n return $data_items[item.item_id].icon_index if item.item?\n return ($data_items.find { |i| !i.nil? && i.subtype_id == item.category_id}).icon_index if item.category?\n end",
"def content_icon\n content_icon_path << case self\n when Audio\n \"audio.png\"\n when Music\n \"music.png\"\n when Photo\n \"photo.png\"\n when Video, WebVideo\n \"movie.png\"\n else\n 'doc.png'\n end\n end",
"def icon\n self.number\n end",
"def get_message_priority_icon(msg)\n if msg.priority_type_id == 1\n elsif msg.priority_type_id == 2\n 'fa-flag text-default'\n elsif msg.priority_type_id == 3\n 'fa-flag text-danger'\n end\n end",
"def filter_icon\n fn = self.name + '_' + self.filter.to_s + '.png'\n fn = 'filter_' + self.filter.to_s + '.png' unless File.file?('public/images/' + fn)\n fn = 'filter_nil.png' if !File.file?('public/images/' + fn) and self.filter_clause == nil\n fn = 'filter_default.png' unless File.file?('public/images/' + fn)\n fn\n end",
"def images_from_extension\n # нахожу все урлы с jpg, png, gif...\n @images_links = URI.extract(@doc.to_s.encode(\"UTF-16be\", :invalid => :replace, :replace => \"?\").encode('UTF-8')).select { |l| l[/\\.(?:gif|png|jpe?g)\\b/] }\n @handler_link.handler_links(@images_links, @link) # обрабатываю урлы\n @handler_link.remove_unless_symbols(@images_links)\n @handler_link.remove_unless_link(@images_links)\n @images_links.uniq\n end",
"def extract_cover\n puts 'Extract front cover'\n extract_png(1, 'cover')\n puts 'Extract back cover'\n extract_png(page_count, 'back')\n end",
"def icon\n return '' if @feed.channel.image.nil?\n @feed.channel.image.url\n end",
"def get_icon(item)\n icon_index = item.icon_index\n icon = Bitmap.new(24, 24)\n bitmap = Cache.system(\"Iconset\")\n rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)\n icon.blt(x, y, bitmap, rect)\n icon\n end",
"def icon_set_styles\n {\n \"3_arrows\" => \"3Arrows\", # 1\n \"3_flags\" => \"3Flags\", # 2\n \"3_traffic_lights_rimmed\" => \"3TrafficLights2\", # 3\n \"3_symbols_circled\" => \"3Symbols\", # 4\n \"4_arrows\" => \"4Arrows\", # 5\n \"4_red_to_black\" => \"4RedToBlack\", # 6\n \"4_traffic_lights\" => \"4TrafficLights\", # 7\n \"5_arrows_gray\" => \"5ArrowsGray\", # 8\n \"5_quarters\" => \"5Quarters\", # 9\n \"3_arrows_gray\" => \"3ArrowsGray\", # 10\n \"3_traffic_lights\" => \"3TrafficLights\", # 11\n \"3_signs\" => \"3Signs\", # 12\n \"3_symbols\" => \"3Symbols2\", # 13\n \"4_arrows_gray\" => \"4ArrowsGray\", # 14\n \"4_ratings\" => \"4Rating\", # 15\n \"5_arrows\" => \"5Arrows\", # 16\n \"5_ratings\" => \"5Rating\" # 17\n }\n end",
"def get_icon\n if @team == \"white\"\n white_icon\n else\n black_icon\n end\n end",
"def kase_type_icon(kase)\n kase_type_icon_tag(kase.kind)\n end",
"def icon action = 'ruby'\n loader = @main.get_class.get_class_loader\n stream = loader.get_resource_as_stream(\"/com/moneydance/modules/features/ruby/#{action}.gif\")\n bytes = stream.to_io.read.to_java_bytes\n java.awt.Toolkit.default_toolkit.create_image(bytes)\n end",
"def raw\n parse_icon(@name, @options)\n end",
"def get_xmlinfo\n def do_xmlget(imagepath)\n xmlinfo = %x{imagex info --xml #{imagepath}}\n @xmlinfo = REXML::Document.new xmlinfo\n return @xmlinfo\n end\n if defined?(@xmlinfo) then return @xmlinfo else @xmlinfo = nil end\n search = File.join(@path, 'sources/install.wim')\n wimage = Dir.glob(search, File::FNM_CASEFOLD)\n if wimage.length > 0\n return do_xmlget(wimage.first)\n end\n search = File.join(@path, 'sources/boot.wim')\n bimage = Dir.glob(search, File::FNM_CASEFOLD)\n if bimage.length > 0\n return do_xmlget(bimage.first)\n end\n @xmlinfo\n end",
"def attach_mode_icons itineraries\n modes = []\n #Which mode icons should we attach logos for?\n itineraries.each do |itin|\n modes << itin.mode_array\n end\n modes.flatten!.uniq!\n \n modes.each do |mode|\n path = ActionController::Base.helpers.asset_path(\"#{mode.downcase}.png\").to_s\n attachments.inline[\"#{mode.downcase}.png\"] = open(\"#{Setting.host}#{path}\", 'rb').read\n end\n end",
"def extract_badgeimages()\n@badgeimages_array = []\n file = File.open('app/assets/post.html')\n doc = Nokogiri::HTML(file)\n doc.search('.mb_div a img').map do |element|\n image_url = 'http://www.boyscouttrail.com' + element['src']\n @badgeimages_array << image_url\n end\n return @badgeimages_array\nend",
"def card_type_image_icon_tag(card)\n def do_image_tag(type)\n content_tag :span, '', :class => \"card_type_icon card_type_icon_#{type}\"\n end\n def image_icon_tag(name)\n return case name\n when \"Feature (MMF)\" : do_image_tag('feature')\n when \"User Story\" : do_image_tag('card')\n when \"Technical Debt\" : do_image_tag('technical_debt')\n when \"Defect\" : do_image_tag('defect')\n when \"Other\" : do_image_tag('other')\n else \"\"\n end\n end\n image_icon_tag(card.card_state.name)\n end",
"def getGroupIcons _args\n \"getGroupIcons _args;\" \n end",
"def file_info(path)\n if manifest_entry # have we loaded our manifest yet? if so, use that sucker\n result = [manifest_entry[path], manifest_entry.flags[path]]\n if result[0].nil?\n return [NULL_ID, '']\n else\n return result\n end\n end\n if manifest_delta || files[path] # check if it's in the delta... i dunno\n if manifest_delta[path]\n return [manifest_delta[path], manifest_delta.flags[path]]\n end\n end\n # Give us, just look it up the long way in the manifest. not fun. slow.\n node, flag = @repo.manifest.find(raw_changeset[0], path)\n if node.nil?\n return [NULL_ID, '']\n end\n return [node, flag]\n end",
"def set_marker_icon(map_post)\n case map_post.category\n when \"Suggestion\"\n 'fas fa-lightbulb text-21'\n when \"Report\"\n 'fas fa-flag text-17'\n else\n 'exclamation-circle'\n end \n end",
"def icon\n if file_content_type.include? 'pdf'\n \"icon_pdf.png\"\n elsif file_content_type.include? 'xls'\n \"icon_excel.png\"\n elsif file_content_type.include? 'doc'\n \"icon_doc.png\"\n else\n \"icon_unk_type.png\"\n end\n end",
"def render_file_icon file\n if file.filename.split(\".\").last == \"pdf\"\n img_tag = \"#{image_tag(\"file_icons/pdf.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"flv\"\n img_tag = \"#{image_tag(\"file_icons/flv.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"gif\"\n img_tag = \"#{image_tag(\"file_icons/gif.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"zip\"\n img_tag = \"#{image_tag(\"file_icons/zip.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"mp3\"\n img_tag = \"#{image_tag(\"file_icons/mp3.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"swf\"\n img_tag = \"#{image_tag(\"file_icons/swf.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"doc\"\n img_tag = \"#{image_tag(\"file_icons/doc.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"jpg\"\n img_tag = \"#{image_tag(\"file_icons/jpg.png\", :plugin => :alchemy)}\"\n else\n img_tag = \"#{image_tag(\"file_icons/file.png\", :plugin => :alchemy)}\"\n end\n end",
"def iiif\n return unless map_set? || geo_file_set?\n find_thumbnail_file if map_set?\n return unless file_set\n \"#{path}/info.json\"\n end",
"def icon\n @icon\n end",
"def setup_icon\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n @icon_key = @acts[1]\n @icon_key = @acts[2] if @acts[2] && flip\n end",
"def icons key\n (icons_info[key.to_s] || key)\n end",
"def show_flag(log)\n \"<i class=\\\"icon-flag flag-chat\\\" data-url=\\\"#{h log.url}\\\"></i>\".html_safe\n end",
"def tineye_images_info\n self.images.non_installation.collect do |image|\n image_options = { :image_url => image.filename.to_s }\n image_options.merge! pattern: image.pattern.name if image.pattern.present?\n image_options.merge! thumb_url: image.s3_path if image.s3_path.present?\n { :url => image.filename.to_s, :filepath => image.filename.path, :metadatum => self.specifications_hash.merge(image_options) }\n end.flatten\n end",
"def build_status_icon topic\n file = \"\"\n \n # show that user replied?\n if topic.posted > 0\n file = \"_dot\"\n end\n \n # show hot folder?\n if topic.replies >= 15 or topic.views >= 150\n file << \"_hot\"\n end\n \n # is the topic locked?\n unless topic.open?\n file << \"_lock\"\n end\n\n # check if topic is a redirect\n if topic.redirect?\n file = \"_moved\"\n end\n\n # check for unread post\n if topic.unread_posts > 0\n file << \"_new\"\n end\n \n image_tag \"/assets/forum/icons/thread#{file}.gif\"\n end",
"def icon_location\n @link.IconLocation\n end",
"def icon_filename_for_key(key)\n case (key.to_s)\n when \"thumbs_up\"\n \"famfamfam_silk/thumb_up.png\"\n when \"refresh\"\n \"famfamfam_silk/arrow_refresh_small.png\"\n when \"arrow_up\"\n \"famfamfam_silk/arrow_up.png\"\n when \"arrow_down\"\n \"famfamfam_silk/arrow_down.png\"\n when \"arrow_right\", \"next\"\n \"famfamfam_silk/arrow_right.png\"\n when \"arrow_left\", \"back\"\n \"famfamfam_silk/arrow_left.png\"\n when \"bioportal_logo\"\n \"bioportal/bioportal_logo.png\"\n when \"new\"\n \"famfamfam_silk/add.png\"\n when \"download\"\n \"redmond_studio/arrow-down_16.png\"\n when \"show\"\n \"famfamfam_silk/zoom.png\"\n when \"edit\"\n \"famfamfam_silk/page_white_edit.png\"\n when \"edit-off\"\n \"stop_edit.png\"\n when \"manage\"\n \"famfamfam_silk/wrench.png\"\n when \"destroy\"\n \"famfamfam_silk/cross.png\"\n when \"tag\"\n \"famfamfam_silk/tag_blue.png\"\n when \"favourite\"\n \"famfamfam_silk/star.png\"\n when \"comment\"\n \"famfamfam_silk/comment.png\"\n when \"comments\"\n \"famfamfam_silk/comments.png\"\n when \"info\"\n \"famfamfam_silk/information.png\"\n when \"help\"\n \"famfamfam_silk/help.png\"\n when \"confirm\"\n \"famfamfam_silk/accept.png\"\n when \"reject\"\n \"famfamfam_silk/cancel.png\"\n when \"user\", \"person\"\n \"famfamfam_silk/user.png\"\n when \"user-invite\"\n \"famfamfam_silk/user_add.png\"\n when \"avatar\"\n \"famfamfam_silk/picture.png\"\n when \"avatars\"\n \"famfamfam_silk/photos.png\"\n when \"save\"\n \"famfamfam_silk/save.png\"\n when \"message\"\n \"famfamfam_silk/email.png\"\n when \"message_read\"\n \"famfamfam_silk/email_open.png\"\n when \"reply\"\n \"famfamfam_silk/email_go.png\"\n when \"message_delete\"\n \"famfamfam_silk/email_delete.png\"\n when \"messages_outbox\"\n \"famfamfam_silk/email_go.png\"\n when \"file\"\n \"redmond_studio/documents_16.png\"\n when \"logout\"\n \"famfamfam_silk/door_out.png\"\n when \"login\"\n \"famfamfam_silk/door_in.png\"\n when \"picture\"\n \"famfamfam_silk/picture.png\"\n when \"pictures\"\n \"famfamfam_silk/photos.png\"\n when \"profile\"\n \"famfamfam_silk/user_suit.png\"\n when \"history\"\n \"famfamfam_silk/time.png\"\n when \"news\"\n \"famfamfam_silk/newspaper.png\"\n when \"view-all\"\n \"famfamfam_silk/table_go.png\"\n when \"announcement\"\n \"famfamfam_silk/transmit.png\"\n when \"denied\"\n \"famfamfam_silk/exclamation.png\"\n when \"institution\"\n \"famfamfam_silk/house.png\"\n when \"project\"\n \"famfamfam_silk/report.png\"\n when \"tick\"\n \"crystal_project/22x22/apps/clean.png\"\n when \"lock\"\n \"famfamfam_silk/lock.png\"\n when \"open\"\n \"famfamfam_silk/lock_open.png\"\n when \"no_user\"\n \"famfamfam_silk/link_break.png\"\n when \"sop\"\n \"famfamfam_silk/page.png\"\n when \"sops\"\n \"famfamfam_silk/page_copy.png\"\n when \"model\"\n \"crystal_project/32x32/apps/kformula.png\"\n when \"models\"\n \"crystal_project/64x64/apps/kformula.png\"\n when \"data_file\",\"data_files\"\n \"famfamfam_silk/database.png\"\n when \"study\"\n \"famfamfam_silk/page.png\"\n when \"execute\"\n \"famfamfam_silk/lightning.png\"\n when \"warning\"\n \"crystal_project/22x22/apps/alert.png\"\n when \"skipped\"\n \"crystal_project/22x22/actions/undo.png\"\n when \"error\"\n \"famfamfam_silk/exclamation.png\"\n when \"feedback\"\n \"famfamfam_silk/email.png\"\n when \"spinner\"\n \"ajax-loader.gif\"\n when \"large-spinner\"\n \"ajax-loader-large.gif\"\n when \"current\"\n \"famfamfam_silk/bullet_green.png\"\n when \"collapse\"\n \"folds/fold.png\"\n when \"expand\"\n \"folds/unfold.png\"\n when \"pal\"\n \"famfamfam_silk/rosette.png\"\n when \"admin\"\n \"famfamfam_silk/shield.png\"\n when \"pdf_file\"\n \"file_icons/small/pdf.png\"\n when \"xls_file\"\n \"file_icons/small/xls.png\"\n when \"doc_file\"\n \"file_icons/small/doc.png\"\n when \"misc_file\"\n \"file_icons/small/genericBlue.png\"\n when \"ppt_file\"\n \"file_icons/small/ppt.png\"\n when \"xml_file\"\n \"file_icons/small/xml.png\"\n when \"zip_file\"\n \"file_icons/small/zip.png\"\n when \"jpg_file\"\n \"file_icons/small/jpg.png\"\n when \"gif_file\"\n \"file_icons/small/gif.png\"\n when \"png_file\"\n \"file_icons/small/png.png\"\n when \"txt_file\"\n \"file_icons/small/txt.png\"\n when \"investigation_avatar\"\n \"crystal_project/64x64/apps/mydocuments.png\"\n when \"study_avatar\"\n \"crystal_project/64x64/apps/package_editors.png\"\n when \"assay_avatar\",\"assay_experimental_avatar\"\n \"misc_icons/flask3-64x64.png\"\n when \"assay_modelling_avatar\"\n \"crystal_project/64x64/filesystems/desktop.png\"\n when \"model_avatar\"\n \"crystal_project/64x64/apps/kformula.png\"\n when \"person_avatar\"\n \"avatar.png\"\n when \"jerm_logo\"\n \"jerm_logo.png\"\n when \"project_avatar\"\n \"project_64x64.png\"\n when \"institution_avatar\"\n \"institution_64x64.png\"\n when \"organism_avatar\"\n \"misc_icons/green_virus-64x64.png\"\n when \"saved_search\"\n \"crystal_project/32x32/actions/find.png\"\n when \"visit_pubmed\"\n \"famfamfam_silk/page_white_go.png\"\n when \"markup\"\n \"famfamfam_silk/page_white_text.png\"\n when \"atom_feed\"\n \"misc_icons/feed_icon.png\"\n when \"impersonate\"\n \"famfamfam_silk/group_go.png\"\n when \"world\"\n \"famfamfam_silk/world.png\"\n else\n return nil\n end\n end",
"def icon\n image_tag( \"tags/#{ @name }.png\" , :height => 8 )\n end",
"def flagging\n @title = 'Flags and their meaning'\n @css = 'flags.css'\n end",
"def icon_index()\n return CORE_CONFIG::ELEMENT_ICONS[self.id] \n end",
"def get_imageinfo(files,props = :imageinfo)\n result=Array.new\n \n iiprop=CGI.escape(\"timestamp|user|url|dimensions|comment\")\n doc=Nokogiri::XML(open(\"http://commons.wikipedia.org/w/api.php?format=xml&action=query&prop=#{props.to_s}&titles=#{files}&iiprop=#{iiprop}\"))\n\n xp=\"//api/query/pages/page/imageinfo/ii\"\n xp=\"//api/query/pages/page/globalusage/gu\" if props==:globalusage\n\n ctr=0\n element=doc.xpath(xp).each do |element| \n img=Hash.new\n element.attributes.each do |a|\n img[a[0].to_sym]=element.get_attribute(a[0])\n end \n result << img\n \n @stockpile[\"#{@imagelist[ctr]}\"]=Hash.new unless @stockpile[\"#{@imagelist[ctr]}\"]\n @stockpile[\"#{@imagelist[ctr]}\"][props]=img\n ctr=ctr+1\n end\n result\n end",
"def add_icons\n [:human, :computer].each do |player|\n @current_state[:pieces][player].each do |piece|\n row = piece.location[0]\n column = piece.location[1]\n @current_state[:position][row][column] = piece.icon\n end\n end\n end",
"def icon\n if @icon.nil?\n icon_node = FeedTools::XmlHelper.try_xpaths(self.channel_node, [\n \"link[@rel='icon']\",\n \"link[@rel='shortcut icon']\",\n \"link[@type='image/x-icon']\",\n \"icon\",\n \"logo[@style='icon']\",\n \"LOGO[@STYLE='ICON']\"\n ])\n unless icon_node.nil?\n @icon = FeedTools::XmlHelper.try_xpaths(icon_node, [\n \"@atom10:href\",\n \"@atom03:href\",\n \"@atom:href\",\n \"@href\",\n \"text()\"\n ], :select_result_value => true)\n begin\n if !(@icon =~ /^file:/) &&\n !FeedTools::UriHelper.is_uri?(@icon)\n channel_base_uri = nil\n unless self.channel_node.nil?\n channel_base_uri = self.channel_node.base_uri\n end\n @icon = FeedTools::UriHelper.resolve_relative_uri(\n @icon, [channel_base_uri, self.base_uri])\n end\n rescue\n end\n @icon = nil unless FeedTools::UriHelper.is_uri?(@icon)\n @icon = nil if @icon.blank?\n end\n end\n return @icon\n end",
"def finderlabels\n %w{ Image Title Description }\n end",
"def large_icon\n return @large_icon\n end",
"def icon\n image_tag(\"/assets/valhalla/#{icon_file_name}\", alt: @visibility, class: \"label-icon\")\n end",
"def icon\n return 'ban' if cancelled?\n return 'pencil' if incomplete?\n return nil if concluded?\n return 'question-circle' if current?\n fully_shipped? && 'exclamation-circle' || 'truck'\n end",
"def buff_icons\r\n icons = []\r\n @buffs.each_with_index {|lv, i| icons.push(buff_icon_index(lv, i)) }\r\n icons.delete(0)\r\n icons\r\n end",
"def icon\n img :src => $imgHostURL + \"/\" + $iconImg\n end",
"def flag(country, options={})\n image_tag \"flags/#{country}.gif\", options\n end",
"def chosen_icon\n '<span class=\"ui-icon ui-icon-check\" />'\n end",
"def icon\n \"dp_icons/%.3d.gif\" % id\n end",
"def document_icon(document)\n ext = File.extname(document.name).gsub('.', '')\n Koi::Asset::Document.icons.has_key?(ext) ? Koi::Asset::Document.icons[ext] : Koi::Asset.unknown_image\n end",
"def inki_icon\n\t\t\t@inki_icon\n\t\tend",
"def images_from_img_tag\n img_array = []\n # пробегаю по тегам img (meta og:images...), хватаю урл и закидываю в img_array\n @doc.xpath('//img').each do |img|\n if img['src'] != nil\n array = [img['src'].to_s]\n src = @handler_link.remove_unless_symbols(array)\n got_link = @handler_link.handler_prefix_link(@link_host_name, src.to_s.delete!(\"[\\\"]\"))\n\n img_array << got_link\n end\n end\n\n img_array.uniq!\n @handler_link.remove_unless_link(img_array)\n img_array\n end",
"def icon\n options[:icon] || (traits.slice!(0).to_s if traits.first.is_a?(String))\n end",
"def instruction_gif_choices\n all_filenames = Dir.chdir(Rails.root.join('config', 'scripts', instruction_gif_relative_path)){ Dir.glob(File.join(\"**\", \"*\")) }\n all_filenames.map {|filename| [filename, instruction_gif_asset_path(filename)] }\n end",
"def update_icon\n #Get the current active sink which should be manipulated.\n return nil if !@sink\n \n \n #Evaluate which icon is the closest to the current volume.\n vol_perc = @sink.vol_perc\n levels = [0, 33, 66, 100]\n \n vol_closest = levels.first\n vol_closest_dif = 100\n \n levels.each do |level|\n if !vol_closest or (vol_perc < level and diff = (level - vol_perc) and diff < vol_closest_dif) or (vol_perc >= level and diff = (vol_perc - level) and diff < vol_closest_dif)\n vol_closest = level\n vol_closest_dif = diff\n end\n end\n \n \n #Set icon.\n icon_filepath = File.realpath(\"#{File.dirname(__FILE__)}/../../gfx/volume_#{vol_closest}.png\")\n @sicon.set_from_file(icon_filepath)\n end",
"def flow_get_jumbo_image\n if !params[:page] && request.path == '/'\n '/jumbo/home.jpg'\n else\n return nil unless @taxon\n image = @taxon.icon(:original)\n image.include?('default_taxon.png') ? nil : image\n end\n end",
"def get_icons\n\n # Get icons from settings\n icons = options[:icons]\n\n # Return nothing if icons is false (default)\n # To continue add the icons property to your navigation\n if !icons\n return\n end\n \n # If icons = true, we need to build a quick hash of the expand/collapse\n # icons to match the custom icon format\n if icons.eql?(true)\n icons = { \n expand: icon('chevron_right'),\n }\n end\n\n # Store the icons as variables\n expand_icon = icons[:expand]\n if icons[:collapse]\n collapse_icon = icons[:collapse]\n end\n\n # If there's a collapse icon, we want to render both icons\n # CSS can be used to show/hide the exapnded/collapsed icons\n if collapse_icon\n content_tag(:div, (\n content_tag(:div, expand_icon, class: get_class(\"--icon--expand\")) + \n (content_tag(:div, collapse_icon, class: get_class(\"--icon--collapse\")) if collapse_icon)\n ), class: get_class(\"--icon\"));\n\n # If there's only an expand icon, we simplify the markup\n else\n content_tag(:div, expand_icon, class: get_class(\"--icon\"));\n end\n end",
"def icon_sets\r\n\t\t@current_area = 'settings'\r\n\t\t@current_menu = 'settings'\r\n\r\n\t\t@icons = {\r\n\t\t\t'calendar' => true,\r\n\t\t\t'calculator' => false,\r\n\t\t\t'cancel' => false,\r\n\t\t\t'delete' => false,\r\n\t\t\t'down' => true,\r\n\t\t\t'down-grey' => true,\r\n\t\t\t'down2' => true,\r\n\t\t\t'down2-grey' => true,\r\n\t\t\t'edit' => true,\r\n\t\t\t'help' => true,\r\n\t\t\t'image' => false,\r\n\t\t\t'left' => true,\r\n\t\t\t'left-grey' => false,\r\n\t\t\t'left2' => true,\r\n\t\t\t'left2-grey' => false,\r\n\t\t\t'minus' => false,\r\n\t\t\t'pdf' => true,\r\n\t\t\t'plus' => false,\r\n\t\t\t'reload' => true,\r\n\t\t\t'right' => true,\r\n\t\t\t'right-grey' => false,\r\n\t\t\t'right2' => true,\r\n\t\t\t'right2-grey' => false,\r\n\t\t\t'save' => false,\r\n\t\t\t'search' => true,\r\n\t\t\t'spreadsheet' => false,\r\n\t\t\t'star' => true,\r\n\t\t\t'star-grey' => true,\r\n\t\t\t'up' => true,\r\n\t\t\t'up-grey' => true,\r\n\t\t\t'up2' => true,\r\n\t\t\t'up2-grey' => true,\r\n\t\t\t'view' => true\r\n\t\t}\r\n\r\n\t\t@icon_sets = Hash.new\r\n\r\n\t\tfolders = Dir.entries(RAILS_ROOT + '/public/images/icons/')\r\n\t\tfolders.delete('.')\r\n\t\tfolders.delete('..')\r\n\r\n\t\tfolders.each do |cur_folder|\r\n\t\t\t@icon_sets[cur_folder] = Hash.new\r\n\r\n\t\t\t# load meta info\r\n\t\t\t@icon_sets[cur_folder]['_info'] = YAML::load(File.open(RAILS_ROOT + '/public/images/icons/' + cur_folder + '/config.yml'))\r\n\r\n\t\t\ticons = Dir.entries(RAILS_ROOT + '/public/images/icons/' + cur_folder)\r\n\t\t\ticons.delete('.')\r\n\t\t\ticons.delete('..')\r\n\t\t\ticons.delete('config.yml')\r\n\r\n\t\t\ticons.each do |cur_icon|\r\n\t\t\t\ticon_bits = cur_icon.split('.')\r\n\t\t\t\ticon_name = icon_bits[0]\r\n\r\n\t\t\t\tunless @icon_sets[cur_folder][icon_name]\r\n\t\t\t\t\t@icon_sets[cur_folder][icon_name] = Hash.new\r\n\t\t\t\tend\r\n\r\n\t\t\t\t@icon_sets[cur_folder][icon_name][icon_bits[1]] = true\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\tif params[:use] and params[:set_name]\r\n\t\t\t@design_config[:options][:icons_path] = params[:set_name].to_s\r\n\t\t\t@design_config.save\r\n\t\t\tflash[:now] = 'Icons set changed'\r\n\t\tend\r\n\tend",
"def icon\n return @icon\n end",
"def icon_file_name\n \"#{@visibility}_visibility.png\"\n end",
"def getGroupIconParams _args\n \"getGroupIconParams _args;\" \n end",
"def icon_ok ; @icon_ok ||= \"ok.png\" ; end",
"def user_icon()\n photo_name_column(get_person, 65)\n end",
"def flag_tag(locale, size = '24x24')\n %(<i class=\"flag flag-#{locale} flag-#{size.gsub('x', '-')}\"></i>).html_safe\n end",
"def readIcon(scope,path)\n icon = nil\n File.open(File.expand_path(File.dirname(__FILE__)).tap {|pwd| $LOAD_PATH.unshift(pwd) unless $LOAD_PATH.include?(pwd)}+\"/\"+path, \"rb\") do |io|\n icon = FXPNGIcon.new(scope, io.read)\n icon.scale(25,25)\n end\n icon\n end",
"def icon\n @manifest_options[:icon] || \"\"\n end",
"def get_images(tag)\n\tpageThumb = get_page(\"#{URL_MOTARU}/categories/view/name/#{tag}\")\n\treturn pageThumb.search(\"//div[@id='categoryWallpapersList']//img[@class='wallpaperThumb']\")\nend",
"def icon_css_class\n case file_mime_type\n when *ARCHIVE_FILE_TYPES\n then \"archive\"\n when *AUDIO_FILE_TYPES\n then \"audio\"\n when *IMAGE_FILE_TYPES\n then \"image\"\n when *VIDEO_FILE_TYPES\n then \"video\"\n when \"application/x-shockwave-flash\"\n then \"flash\"\n when \"image/x-psd\"\n then \"psd\"\n when \"text/plain\"\n then \"text\"\n when \"application/rtf\"\n then \"rtf\"\n when \"application/pdf\"\n then \"pdf\"\n when \"application/msword\"\n then \"word\"\n when \"application/vnd.ms-excel\"\n then \"excel\"\n when *VCARD_FILE_TYPES\n then \"vcard\"\n else \"file\"\n end\n end",
"def b_icon(filename, _hue = 0)\n load_image(@b_icon_cache, filename, Pokedex_PokeIcon_Path, @b_icon_data)\n end",
"def scanned_prof_image\n scanned_prof\n end"
] | [
"0.6134026",
"0.6134026",
"0.60431534",
"0.59672534",
"0.594529",
"0.59039444",
"0.5787242",
"0.5695419",
"0.5681794",
"0.56429297",
"0.5609058",
"0.5544168",
"0.5517843",
"0.54973555",
"0.54915863",
"0.54915863",
"0.54816574",
"0.54714864",
"0.54502755",
"0.54406",
"0.5434702",
"0.54079175",
"0.5375694",
"0.5361334",
"0.5347769",
"0.53283966",
"0.5321549",
"0.53194875",
"0.5312413",
"0.53117895",
"0.52755755",
"0.5229953",
"0.522184",
"0.52096975",
"0.5197402",
"0.51910204",
"0.51726556",
"0.5166581",
"0.51398087",
"0.5136257",
"0.512331",
"0.51208967",
"0.5107429",
"0.51046675",
"0.5099159",
"0.5096267",
"0.509414",
"0.50885826",
"0.5086684",
"0.508639",
"0.5080751",
"0.50795585",
"0.507468",
"0.5072601",
"0.5071604",
"0.506318",
"0.50503093",
"0.5039688",
"0.5033764",
"0.50251067",
"0.50216115",
"0.50133985",
"0.49888682",
"0.49841475",
"0.49775812",
"0.4965679",
"0.49578574",
"0.49492243",
"0.49427414",
"0.49374834",
"0.49326056",
"0.49286574",
"0.4924024",
"0.4922633",
"0.49156913",
"0.49118274",
"0.4899752",
"0.48929554",
"0.48916456",
"0.4891315",
"0.48796967",
"0.4876898",
"0.48729593",
"0.48664895",
"0.48568788",
"0.48551497",
"0.48506933",
"0.48497072",
"0.4849553",
"0.48483258",
"0.4846635",
"0.48445043",
"0.48434314",
"0.483558",
"0.4833493",
"0.48314932",
"0.48298058",
"0.48225194",
"0.48204303",
"0.48198757"
] | 0.70758474 | 0 |
GET /spec_types GET /spec_types.json | def index
@spec_types = SpecType.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def show\n render json: @specification_type, serializer: Web::V1::SpecificationTypeSerializer\n end",
"def spec_type_params\n params[:spec_type]\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def index\n @technotypes = Technotype.all\n\n respond_to do |format|\n format.json { render json: @technotypes, status: 200 }\n end\n end",
"def get_available_types_from_usage(usage) #TODO: Research use\n return @client.raw(\"get\", \"/helpers/available-types/#{usage}\")\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def get_available_types_from_usage(usage)\n # TODO: Research use\n @client.raw('get', \"/helpers/available-types/#{usage}\")\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def spec_type(desc, *additional); end",
"def show\n render json: @specification, serializer: Web::V1::SpecificationSerializer\n end",
"def index\n @hardware_types = HardwareType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hardware_types }\n end\n end",
"def cmd_types argv\n setup argv\n response = @api.types\n msg response\n return response\n end",
"def index\n render json: usage(params[:type])\n end",
"def court_types\n render json: GamePass.court_types_options\n end",
"def set_spec_type\n @spec_type = SpecType.find(params[:id])\n end",
"def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end",
"def appointment_types(params = {})\n scope 'default'\n get('schedule/appointmenttypes/', params)\n end",
"def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def index\n @sample_types = SampleType.all.sort_by(&:name)\n @first = if @sample_types.any?\n @sample_types[0].name\n else\n 'no sample types'\n end\n\n respond_to do |format|\n format.html { render layout: 'aq2' }\n format.json do\n render json: @sample_types\n .sort { |a, b| a.name <=> b.name }\n .to_json(methods: :field_types)\n end\n end\n end",
"def get_resource_types\n get_types(Occi::Core::Resource.kind)\n end",
"def index\n @sample_types = SampleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sample_types }\n end\n end",
"def index\n @trait_types = TraitType.all\n\n render json: @trait_types\n end",
"def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end",
"def test_ListPlatformTypes\n\t\tcolName = 'types'\n\t\tretClass = LeanTesting::PlatformType\n\t\tresp = rcol(colName, ['_id', 'name'])\n\t\[email protected] = {'data'=> JSON.generate(resp), 'status'=> 200}\n\n\t\tcol = @client.platform.types.all\n\n\t\tassert_equal resp[colName], col.toArray\n\t\tassert_instance_of retClass, col.collection[0]\n\t\tassert_equal resp['meta']['pagination']['total'], col.total\n\t\tassert_equal resp['meta']['pagination']['total_pages'], col.totalPages\n\t\tassert_equal resp['meta']['pagination']['count'], col.count\n\tend",
"def index\n @act_types = ActType.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @act_types }\n end\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types\n end",
"def index\n @practitioner_types = PractitionerType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @practitioner_types }\n end\n end",
"def ride_types(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:ride_types),\n access_token: args.delete(:access_token),\n options: { query: args }\n )\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def get_supported_file_types\n path = '/v3/miscellaneous/supported-file-types'\n\n headers = {\n 'Content-Type' => 'application/json',\n 'User-Agent' => Config.user_agent\n }\n\n request = Net::HTTP::Get.new(path, headers)\n handle_response(@api_client.request(request), 'get_supported_file_types')\n end",
"def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end",
"def index\n respond_to do |format|\n format.html { @product_types = ProductType.all }\n format.json { @product_types = ProductType.order(:name) }\n end\n end",
"def index\n limit, offset = Calculator.limit_and_offset(params)\n @specifications = Specification.all.limit(limit).offset(offset).order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @specifications, each_serializer: Web::V1::SpecificationSerializer\n end",
"def types\n configuration[:types]\n end",
"def index\n @vet_lab_types = VetLabType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vet_lab_types }\n end\n end",
"def index\n @types = Type.all\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_contract_types.to_ext_json(:class => ContractType, :count => ContractType.count(options_from_search(ContractType))) }\n end\n end",
"def type\n @json['type']\n end",
"def index\n @run_types = RunType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @run_types }\n end\n end",
"def index\n @talk_types = TalkType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_types }\n end\n end",
"def list(type)\n get(resource_path_for_entity_type(type) + \"?rows=all\")\n end",
"def type\n response[\"type\"]\n end",
"def type\n response[\"type\"]\n end",
"def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end",
"def get_entity_types\n Occi::Log.debug(\"Getting entity types ...\")\n @model.kinds.collect { |kind| kind.term }\n end",
"def index\n @recipe_types = RecipeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @recipe_types }\n end\n end",
"def index\n @typings = Typing.all\n end",
"def index\n signature_types = SignatureType.all\n render_jsonapi(signature_types)\n end",
"def index\n @special_needs_types = SpecialNeedsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @special_needs_types }\n end\n end",
"def create\n @spec_type = SpecType.new(spec_type_params)\n\n respond_to do |format|\n if @spec_type.save\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully created.' }\n format.json { render :show, status: :created, location: @spec_type }\n else\n format.html { render :new }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @court_types = CourtType.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @court_types }\n end\n end",
"def content_types(query = {})\n resp =\n _instrument 'content_types', query: query do\n get('content_types', query)\n end\n resp.assert_ok!\n end",
"def index\n @realty_types = RealtyType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @realty_types }\n end\n end",
"def mock_types(extra=[])\n types = extra.concat(fixture_cartridges)\n ActiveResource::HttpMock.respond_to(false) do |mock|\n mock.get '/broker/rest/cartridges.json', anonymous_json_header, types.to_json\n end\n types = CartridgeType.cached.all\n assert types.length > 0\n assert Rails.cache.read(CartridgeType.cached.send(:cache_key_for, :find_every))\n types\n end",
"def types(types); end",
"def assignment_types\n\t\t@course = Course.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.json\n\t\tend\n\tend",
"def index\n @q = CarType.search(params[:q])\n @car_types = @q.result(distinct: true).page(params[:page])\n\n respond_with(@car_types)\n end",
"def types\n @types ||= Types.new(@client)\n end",
"def types\n if @@types.nil? || (@@last_type_check + (4 * 60 * 60)) < Time.now\n @@last_type_check = Time.now\n @@types = _make_request(:types)['results']\n end\n @@types\n end",
"def types\n [\n { value: 'bus', name: 'Bus' },\n { value: 'coach', name: 'Coach' },\n { value: 'hgv', name: 'Heavy goods vehicle' },\n { value: 'van', name: 'Van' },\n { value: 'minibus', name: 'Minibus' },\n { value: 'private_car', name: 'Car' },\n { value: 'motorcycle', name: 'Motorcycle' }\n ]\n end",
"def index\n @recipe_types = RecipeType.all\n end",
"def index\n @event_types = EventType.all\n respond_with @event_types\n end",
"def index\n @event_types = EventType.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @event_types }\n end\n end",
"def types\n get_metadata unless @types\n return @types\n end",
"def index\n @type_identifications = TypeIdentification.all\n end",
"def index\n @language_types = LanguageType.all\n\n render json: @language_types\n end",
"def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end",
"def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end",
"def index\n @material_types = MaterialType.all\n\n render json: @material_types\n end",
"def index\n @techaxis_types = TechaxisType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @techaxis_types }\n end\n end",
"def create\n @specification_type = SpecificationType.new(specification_type_params)\n\n if @specification_type.save\n audit(@specification_type, current_user)\n render json: @specification_type, status: :created, serializer: Web::V1::SpecificationTypeSerializer\n else\n render json: @specification_type.errors, status: :unprocessable_entity\n end\n end",
"def places_kinds\n render json: Place.places_kinds\n end",
"def types()\n\t\t@pokemon_types = []\n\t\t@pokemon_api[\"types\"].each do |i|\n\t\t\t@pokemon_types.push(i[\"type\"][\"name\"].capitalize)\n\t\tend\n\t\treturn @pokemon_types\n\tend",
"def resource_type\n /(\\/api\\/(?<type>\\w+)\\/?)/ =~ full_url\n type.capitalize\n end",
"def show\n @type = Type.find(params[:id])\n @things = @type.things\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type }\n end\n end",
"def type\n @activities = Activity.tagged_with_on(:types,params[:type_name]).page params[:page]\n respond_with @activities\n end",
"def get_all_outypes\n path = \"/d2l/api/lp/#{$lp_ver}/outypes/\"\n _get(path)\nend",
"def index\n @ftypes = Ftype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ftypes }\n end\n end",
"def index\n @typegroups = Typegroup.all\n respond_to do |format|\n format.html\n format.json { render json: @typegroups }\n end\n end",
"def index\n @ctypes = Ctype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ctypes }\n end\n end",
"def lookup(type)\n @resource_types[type] || []\n end",
"def index\n @pre_print_types = PrePrintType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pre_print_types }\n end\n end",
"def index\n @credit_types = CreditType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @credit_types }\n end\n end",
"def request_type(*args)\n type\n end",
"def find_by_type(types); end",
"def find_by_type(types); end",
"def list_possible_type_ids\n\tissuetypes = @client.Issuetype.all\n\tissuetypes.each do |issue|\n\t\tputs \"#{issue.id}\\t#{issue.name}\"\n\tend\nend",
"def view_types(for_select = true) # get the defined view type partials. e.g. views/views/list.html.erb\n fetch_array_for get_view_types, for_select\n end",
"def getMetadatatypes\n \n @queryparams = params\n \n # Get all metadatatypes\n @results = MetadataType.find(:all, :order => \"updated_at ASC\" )\n \n if params[:format] && params[:format]== \"json\" || params[:format] == \"yaml\"\n @yaml_results = {}\n @results.each do |result|\n @yaml_results.merge!({result.name => result.value_type})\n end\n \n end\n \n # host parameter, needed when creating atom-feed\n if request.ssl?\n @host = \"https://#{request.host}\"\n else\n @host = \"http://#{request.host}\"\n end\n\n if request.port != nil and request.port != 80\n @host += \":#{request.port}\"\n end \n \n # Create atom feed\n @host = @@http_host\n respond_to do |format|\n if @queryparams[:format] == nil\n format.html {render :getmetadatatypes, :layout=>true }\n else\n format.html {render :getmetadatatypes, :layout=>true }\n format.atom {render :getmetadatatypes, :layout=>false }\n format.yaml {render :text => YAML.dump(@yaml_results), :layout=>false }\n format.json {render :text => JSON.dump(@yaml_results), :layout=>false }\n end\n end\n end"
] | [
"0.7307178",
"0.7115818",
"0.68488276",
"0.67915046",
"0.654943",
"0.64228445",
"0.629436",
"0.625062",
"0.6244812",
"0.6226265",
"0.6164064",
"0.6127597",
"0.6115352",
"0.6099166",
"0.6085999",
"0.60817564",
"0.6076774",
"0.60442877",
"0.60073155",
"0.6000154",
"0.59961635",
"0.59941876",
"0.59816855",
"0.59593606",
"0.59565765",
"0.5936531",
"0.5926961",
"0.5922431",
"0.59174496",
"0.5910768",
"0.59003425",
"0.5889817",
"0.5883229",
"0.58591497",
"0.58491784",
"0.58343154",
"0.58120525",
"0.580809",
"0.5765502",
"0.57509446",
"0.57482237",
"0.5746558",
"0.57448804",
"0.5740205",
"0.5729297",
"0.5720333",
"0.57028717",
"0.5700084",
"0.56891507",
"0.56757355",
"0.5674498",
"0.56742287",
"0.56738794",
"0.56738794",
"0.56591284",
"0.5654684",
"0.56526846",
"0.5648567",
"0.5635961",
"0.5635595",
"0.56348926",
"0.5632985",
"0.5628013",
"0.56276727",
"0.56189907",
"0.5616594",
"0.5609579",
"0.56076133",
"0.5605056",
"0.56036884",
"0.5594334",
"0.55871433",
"0.55836594",
"0.5582481",
"0.55804294",
"0.5577178",
"0.557222",
"0.5559274",
"0.5558923",
"0.55499154",
"0.5548714",
"0.5544183",
"0.5539855",
"0.55372065",
"0.5535182",
"0.5535118",
"0.5534345",
"0.552381",
"0.5522717",
"0.55225384",
"0.55219287",
"0.55217814",
"0.55183566",
"0.55144775",
"0.5509964",
"0.55078936",
"0.55078936",
"0.5503597",
"0.5502738",
"0.5497694"
] | 0.7248025 | 1 |
GET /spec_types/1 GET /spec_types/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n render json: @specification_type, serializer: Web::V1::SpecificationTypeSerializer\n end",
"def index\n @spec_types = SpecType.all\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def spec_type_params\n params[:spec_type]\n end",
"def set_spec_type\n @spec_type = SpecType.find(params[:id])\n end",
"def show\n render json: @specification, serializer: Web::V1::SpecificationSerializer\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def index\n @sample_types = SampleType.all.sort_by(&:name)\n @first = if @sample_types.any?\n @sample_types[0].name\n else\n 'no sample types'\n end\n\n respond_to do |format|\n format.html { render layout: 'aq2' }\n format.json do\n render json: @sample_types\n .sort { |a, b| a.name <=> b.name }\n .to_json(methods: :field_types)\n end\n end\n end",
"def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n @type = Type.find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @types }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resource_types }\n end\n end",
"def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end",
"def types\n @client.make_request :get, reports_path\n end",
"def index\n render json: usage(params[:type])\n end",
"def spec_type(desc, *additional); end",
"def index\n @technotypes = Technotype.all\n\n respond_to do |format|\n format.json { render json: @technotypes, status: 200 }\n end\n end",
"def show\n @type = Type.find(params[:id])\n @things = @type.things\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type }\n end\n end",
"def type\n @json['type']\n end",
"def index\n @hardware_types = HardwareType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hardware_types }\n end\n end",
"def type\n response[\"type\"]\n end",
"def type\n response[\"type\"]\n end",
"def index\n @sample_types = SampleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sample_types }\n end\n end",
"def create\n @spec_type = SpecType.new(spec_type_params)\n\n respond_to do |format|\n if @spec_type.save\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully created.' }\n format.json { render :show, status: :created, location: @spec_type }\n else\n format.html { render :new }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @crate_types = CrateType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_types }\n end\n end",
"def show\n @realty_type = RealtyType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @realty_type }\n end\n end",
"def index\n @entry_types = EntryType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entry_types }\n end\n end",
"def index \n respond_to do |format|\n format.html # index.html.erb\n format.json { \n asset_types = AssetType.all\n render json: asset_types \n }\n end\n end",
"def show\n @volume_type_extra_spec = VolumeTypeExtraSpec.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @volume_type_extra_spec }\n end\n end",
"def show\n @sample_type = SampleType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample_type }\n end\n end",
"def index\n @discipline_types = DisciplineType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_types }\n end\n end",
"def get_type_with_http_info(uuid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.get_type ...\"\n end\n # verify the required parameter 'uuid' is set\n fail ArgumentError, \"Missing the required parameter 'uuid' when calling DefaultApi.get_type\" if uuid.nil?\n # resource path\n local_var_path = \"/{uuid}/type\".sub('{format}','json').sub('{' + 'uuid' + '}', uuid.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = 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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#get_type\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_type }\n end\n end",
"def create\n @specification_type = SpecificationType.new(specification_type_params)\n\n if @specification_type.save\n audit(@specification_type, current_user)\n render json: @specification_type, status: :created, serializer: Web::V1::SpecificationTypeSerializer\n else\n render json: @specification_type.errors, status: :unprocessable_entity\n end\n end",
"def type\n @json_body['type']\n end",
"def show\n @types_of_apprenticeship = TypesOfApprenticeship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @types_of_apprenticeship }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle_type }\n end\n end",
"def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end",
"def index\n @practitioner_types = PractitionerType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @practitioner_types }\n end\n end",
"def show\n @specification = Specification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specification }\n end\n end",
"def show\n @structure_type = StructureType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @structure_type }\n end\n end",
"def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end",
"def get_lesson_types\n get \"lessonTypes.json\"\n end",
"def show\n @hardware_type = HardwareType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hardware_type }\n end\n end",
"def update\n respond_to do |format|\n if @spec_type.update(spec_type_params)\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully updated.' }\n format.json { render :show, status: :ok, location: @spec_type }\n else\n format.html { render :edit }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_resource_types\n Occi::Log.debug(\"Getting resource types ...\")\n collection = @model.get Occi::Core::Resource.kind\n collection.kinds.collect { |kind| kind.term }\n end",
"def show\n @girltype = Girltype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @girltype }\n end\n end",
"def show\n @ref_diagnostic_test_type = Ref::DiagnosticTestType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ref_diagnostic_test_type }\n end\n end",
"def index\n @trait_types = TraitType.all\n\n render json: @trait_types\n end",
"def resource_type\n /(\\/api\\/(?<type>\\w+)\\/?)/ =~ full_url\n type.capitalize\n end",
"def index\n @special_needs_types = SpecialNeedsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @special_needs_types }\n end\n end",
"def show\n @crate_type = CrateType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate_type }\n end\n end",
"def index\n authorize @thing, :get_types?\n @thing_types = @thing.thing_types\n end",
"def index\n @act_types = ActType.order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @act_types }\n end\n end",
"def update\n @specification_type = SpecificationType.find(params[:id])\n\n if @specification_type.update(specification_type_params)\n audit(@specification_type, current_user)\n render json: @specification_type, status: :created, serializer: Web::V1::SpecificationTypeSerializer\n else\n render json: @specification_type.errors, status: :unprocessable_entity\n end\n end",
"def get_available_types_from_usage(usage) #TODO: Research use\n return @client.raw(\"get\", \"/helpers/available-types/#{usage}\")\n end",
"def show\n @incident_type = IncidentType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @incident_type }\n end\n end",
"def index\n @vet_lab_types = VetLabType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vet_lab_types }\n end\n end",
"def get_available_types_from_usage(usage)\n # TODO: Research use\n @client.raw('get', \"/helpers/available-types/#{usage}\")\n end",
"def find(id)\n response = RestClient.get(\"#{@type.Resource}/#{id}\")\n @type.from_json response['data']\n end",
"def index\n @run_types = RunType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @run_types }\n end\n end",
"def request_type(*args)\n type\n end",
"def index\n @talk_types = TalkType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_types }\n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_types }\n end\n end",
"def index\n @product_types = ProductType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_types }\n end\n end",
"def index\n @type_people = TypePerson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @type_people }\n end\n end",
"def court_types\n render json: GamePass.court_types_options\n end",
"def index\n @types = Type.all\n end",
"def index\n limit, offset = Calculator.limit_and_offset(params)\n @specifications = Specification.all.limit(limit).offset(offset).order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @specifications, each_serializer: Web::V1::SpecificationSerializer\n end",
"def destroy\n @spec_type.destroy\n respond_to do |format|\n format.html { redirect_to spec_types_url, notice: 'Spec type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def describe_types\n [@options[:type]].flatten.join('/')\n end",
"def index\n @typings = Typing.all\n end",
"def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end",
"def cmd_types argv\n setup argv\n response = @api.types\n msg response\n return response\n end",
"def index\n @observation_types = ObservationType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @observation_types }\n end\n end",
"def index\n @recipe_types = RecipeType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @recipe_types }\n end\n end",
"def show\n @entry_type = EntryType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry_type }\n end\n end",
"def show\n @kind = Kind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kind }\n end\n end",
"def type\n @activities = Activity.tagged_with_on(:types,params[:type_name]).page params[:page]\n respond_with @activities\n end",
"def show\n @ctype = Ctype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ctype }\n end\n end",
"def show\n @instance_type = InstanceType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @instance_type }\n end\n end",
"def index\n @realty_types = RealtyType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @realty_types }\n end\n end",
"def show\n @question_type = QuestionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_type }\n end\n end",
"def show\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def show\n respond_to do |format|\n format.json { render json: @technotype, status: 200 }\n end\n end",
"def show\n render json: @trait_type\n end",
"def type\n params[:type]\n end",
"def index\n @ctypes = Ctype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ctypes }\n end\n end",
"def resourceType\n 'Specimen'\n end",
"def index\n @recipe_types = RecipeType.all\n end",
"def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end",
"def index\n @type_identifications = TypeIdentification.all\n end",
"def show\n @reform_type = ReformType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reform_type }\n end\n end",
"def getPageInfoByIDType(id, type)\n request('getPageInfoByIDType', {'id' => id, 'type' => type})\nend",
"def show\n @ProfileType = ProfileType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @ProfileType }\n end\n end",
"def show\n @event_types = EventType.find(params[:id])\n respond_with @event_type\n end",
"def test_ListPlatformTypes\n\t\tcolName = 'types'\n\t\tretClass = LeanTesting::PlatformType\n\t\tresp = rcol(colName, ['_id', 'name'])\n\t\[email protected] = {'data'=> JSON.generate(resp), 'status'=> 200}\n\n\t\tcol = @client.platform.types.all\n\n\t\tassert_equal resp[colName], col.toArray\n\t\tassert_instance_of retClass, col.collection[0]\n\t\tassert_equal resp['meta']['pagination']['total'], col.total\n\t\tassert_equal resp['meta']['pagination']['total_pages'], col.totalPages\n\t\tassert_equal resp['meta']['pagination']['count'], col.count\n\tend",
"def index\n respond_to do |format|\n format.html { @product_types = ProductType.all }\n format.json { @product_types = ProductType.order(:name) }\n end\n end",
"def index\n @techaxis_types = TechaxisType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @techaxis_types }\n end\n end",
"def show\n @resource_fields = Field.where(\"resource_type_id = ?\", params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource_type }\n end\n end",
"def type\n params['TYPE']\n end",
"def index\n @api_v1_user_types = Api::V1::UserType.all\n end",
"def index\n @pre_print_types = PrePrintType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pre_print_types }\n end\n end"
] | [
"0.73448294",
"0.7071844",
"0.70468366",
"0.6670518",
"0.6363673",
"0.63436395",
"0.6339627",
"0.62637466",
"0.62167907",
"0.61923987",
"0.6163569",
"0.6132918",
"0.6117882",
"0.6103355",
"0.6073636",
"0.6062175",
"0.6013483",
"0.60117596",
"0.5976781",
"0.5976781",
"0.59721947",
"0.59452736",
"0.591593",
"0.5889396",
"0.58625674",
"0.5847462",
"0.5824399",
"0.58220303",
"0.5803167",
"0.5798958",
"0.5776806",
"0.57663",
"0.576387",
"0.57624006",
"0.5743308",
"0.57425886",
"0.57391435",
"0.57304305",
"0.5730277",
"0.5721345",
"0.57203346",
"0.5712506",
"0.5712184",
"0.57111067",
"0.57008123",
"0.5695322",
"0.56947494",
"0.56944066",
"0.56941056",
"0.5693166",
"0.5692283",
"0.56916136",
"0.5691342",
"0.5690298",
"0.5689623",
"0.5688098",
"0.5687839",
"0.568592",
"0.56782925",
"0.5673301",
"0.56706965",
"0.5666331",
"0.56658584",
"0.5663995",
"0.56623584",
"0.5659223",
"0.5657437",
"0.56505",
"0.56469476",
"0.564669",
"0.56460243",
"0.56368244",
"0.5635071",
"0.56187755",
"0.5610558",
"0.5603915",
"0.55990124",
"0.55963963",
"0.5593511",
"0.558875",
"0.5586773",
"0.55757433",
"0.55682254",
"0.5566861",
"0.55665565",
"0.55660826",
"0.55573696",
"0.5556178",
"0.5550783",
"0.55456126",
"0.5544186",
"0.55439335",
"0.5541978",
"0.5538985",
"0.553233",
"0.5532323",
"0.55249727",
"0.55115867",
"0.5510268",
"0.55056155",
"0.55018395"
] | 0.0 | -1 |
POST /spec_types POST /spec_types.json | def create
@spec_type = SpecType.new(spec_type_params)
respond_to do |format|
if @spec_type.save
format.html { redirect_to @spec_type, notice: 'Spec type was successfully created.' }
format.json { render :show, status: :created, location: @spec_type }
else
format.html { render :new }
format.json { render json: @spec_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spec_type_params\n params[:spec_type]\n end",
"def create\n @specification_type = SpecificationType.new(specification_type_params)\n\n if @specification_type.save\n audit(@specification_type, current_user)\n render json: @specification_type, status: :created, serializer: Web::V1::SpecificationTypeSerializer\n else\n render json: @specification_type.errors, status: :unprocessable_entity\n end\n end",
"def spec_type(desc, *additional); end",
"def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end",
"def set_spec_type\n @spec_type = SpecType.find(params[:id])\n end",
"def register_spec_type(*args, &block); end",
"def add_dummy_type\n params[:data] ||= {}\n params[:data][:type] = resource_klass._type.to_s\n end",
"def index\n @spec_types = SpecType.all\n end",
"def pet_types\r\n BnetApi::make_request('/wow/data/pet/types')\r\n end",
"def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end",
"def test_type_params\n params.require(:test_type).permit(:name, :description, :data)\n end",
"def create_types\n\t[]\nend",
"def create_types\n\t[]\nend",
"def create_types\n\t\t[]\n\tend",
"def create_types\n\t\t[]\n\tend",
"def create_break_type(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/labor/break-types',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def evals_types\n call_path = \"evals/types\"\n data = build_post_data(\"\")\n perform_post(build_url(call_path), data)\n end",
"def type_params\n params.require(:type).permit( :name)\n end",
"def create_type_params\n params.require(:create_type).permit(:name, :display_name, :note)\n end",
"def devicetype_params\n params.require(:devicetype).permit(:type)\n end",
"def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end",
"def recipe_type_params\n params.require(:recipe_type).permit(:name, :description)\n end",
"def device_type_params\n params.require(:device_type).permit(:classification, :description)\n end",
"def type_params\n params.require(:type).permit(:name)\n end",
"def device_type_params\n params.require(:device_type).permit(:name)\n end",
"def create\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type = EntryType.new(params[:entry_type])\n @entry_type.field_type_ids = field_type_ids\n @entry_type.form_code = build_form_code(@entry_type.field_types)\n @entry_type.model_code = build_model_code(@entry_type.name, @entry_type.field_types)\n @entry_type.model = build_model_from_code(@entry_type)\n\n respond_to do |format|\n if @entry_type.save\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully created.' }\n format.json { render json: @entry_type, status: :created, location: @entry_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @spec_type.destroy\n respond_to do |format|\n format.html { redirect_to spec_types_url, notice: 'Spec type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def enter_types(test_data)\n test_types = test_data[Org::ORG_RECORD_TYPES.name]\n test_types = [{ Org::ORG_RECORD_TYPE.name => ''}] unless test_types\n prep_fieldsets_for_test_data([fieldset(Org::ORG_RECORD_TYPES.name)], test_types)\n\n test_types.each_with_index do |test_type, index|\n wait_for_options_and_select(org_record_type_input(index), org_record_type_options(index), test_type[Org::ORG_RECORD_TYPE.name])\n end\n end",
"def show\n render json: @specification_type, serializer: Web::V1::SpecificationTypeSerializer\n end",
"def test_book_kind\n data = post_book('id' => 1)\n assert_equal('book', data[0]['kind'])\n end",
"def sample_type_params\n params.require(:sample_type).permit(:name)\n end",
"def device_type_params\n params.require(:device_type).permit(:code,\n :name,\n :internal_api_server_type,\n :internal_web_server_type,\n :desktop_type,\n :web_server_type,\n :mobile_type)\n end",
"def json_spec_schema(spec)\n Data.export(json_spec_path, spec, DummyUtil.new)\n end",
"def resource_type_params\n params.require(:resource_type).permit(:name)\n end",
"def testtype_params\n params.require(:testtype).permit(:tname)\n end",
"def create\n @type = Type.new(type_params)\n\n unless @type.save\n render json: @type.errors, status: :unprocessable_entity\n end\n \n end",
"def resquest_type_params\n params.require(:resquest_type).permit(:name, :description)\n end",
"def create\n @recipe_type = RecipeType.new(recipe_type_params)\n\n respond_to do |format|\n if @recipe_type.save\n format.html { redirect_to @recipe_type, notice: \"Recipe type was successfully created.\" }\n format.json { render :show, status: :created, location: @recipe_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @recipe_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bugtype_params\n params.require(:bugtype).permit(:typename)\n end",
"def create\n @trait_type = TraitType.new(trait_type_params)\n\n if @trait_type.save\n render json: @trait_type, status: :created, location: @trait_type\n else\n render json: @trait_type.errors, status: :unprocessable_entity\n end\n end",
"def types(types); end",
"def create\n @type = Type.new(type_params)\n @sub_types = params[:subtype_attributes]\n if @type.save\n @sub_types.each do |subtype|\n @subtype = @type.subtype.new\n @subtype.name = subtype[\"name\"]\n @subtype.code = subtype[\"code\"]\n @subtype.save\n end\n flash[:notice] = 'Type was successfully created.'\n redirect_to types_path\n else\n flash[:error] = @type.errors.full_messages\n render \"new\"\n end\n end",
"def update\n\n raw = params[:sample_type]\n st = SampleType.find(raw[:id])\n\n st.name = raw[:name]\n st.description = raw[:description]\n st.save\n st.save_field_types raw[:field_types]\n\n render json: { sample_type: st }\n\n end",
"def register_spec_type *args, &block\n if block then\n matcher, klass = block, args.first\n else\n matcher, klass = *args\n end\n TYPES.unshift [matcher, klass]\n end",
"def update\n @specification_type = SpecificationType.find(params[:id])\n\n if @specification_type.update(specification_type_params)\n audit(@specification_type, current_user)\n render json: @specification_type, status: :created, serializer: Web::V1::SpecificationTypeSerializer\n else\n render json: @specification_type.errors, status: :unprocessable_entity\n end\n end",
"def method_type_params\n params.require(:method_type).permit(:description, :macroscopy, :diagnosis)\n end",
"def type_test_params\n params.require(:type_test).permit(:name, :instruction)\n end",
"def update\n respond_to do |format|\n if @spec_type.update(spec_type_params)\n format.html { redirect_to @spec_type, notice: 'Spec type was successfully updated.' }\n format.json { render :show, status: :ok, location: @spec_type }\n else\n format.html { render :edit }\n format.json { render json: @spec_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trait_type_params\n params.require(:trait_type).permit(:name, :display, :description)\n end",
"def tctype_params\n params.require(:type).permit(:name, :description)\n end",
"def create\n @realty_type = RealtyType.new(params[:realty_type])\n\n respond_to do |format|\n if @realty_type.save\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully created.' }\n format.json { render json: @realty_type, status: :created, location: @realty_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @worktype = current_ou.worktypes.new(worktype_params)\n\n respond_to do |format|\n if @worktype.save\n format.html { redirect_to worktypes_path, notice: 'Worktype was successfully created.' }\n format.json { render :show, status: :created, location: @worktype }\n else\n format.html { render :new }\n format.json { render json: @worktype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def exercise_type_params\n params.require(:exercise_type).permit(:name, :test_template, :code_template, :input_type, :output_type, :testing_type, :test_method_template)\n end",
"def studytype_params\n params.require(:studytype).permit(:name, :symbol, :description)\n end",
"def create_types\n\t\t[Device]\n\tend",
"def create_types\n\t\t[Device]\n\tend",
"def create\n @ba_spec = BaSpec.new(params[:ba_spec])\n\n respond_to do |format|\n if @ba_spec.save\n format.html { redirect_to ba_specs_path }\n format.json { render json: @ba_spec, status: :created, location: @ba_spec }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ba_spec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def entity_type_params\n params.require(:entity_type).permit(:type)\n end",
"def create\n @volume_type_extra_spec = VolumeTypeExtraSpec.new(params[:volume_type_extra_spec])\n\n respond_to do |format|\n if @volume_type_extra_spec.save\n format.html { redirect_to @volume_type_extra_spec, notice: 'Volume type extra spec was successfully created.' }\n format.json { render json: @volume_type_extra_spec, status: :created, location: @volume_type_extra_spec }\n else\n format.html { render action: \"new\" }\n format.json { render json: @volume_type_extra_spec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def intervention_type_params\n params.require(:intervention_type).permit(:name, :obs)\n end",
"def create\n @resource_type = ResourceType.new(params[:resource_type])\n respond_to do |format|\n if @resource_type.save\n if params[:fields]\n params[:fields].each do |param|\n @field = Field.new(\n :name => param[:name], \n :field_type_id => param[:field_type_id],\n :resource_type_id => @resource_type.id, \n :resource_type_reference_id => param[:resource_type_reference_id]\n )\n param[:validator_ids].each do |index|\n @field.field_validations.build(validator_id: index)\n end\n @field.save\n end\n end\n format.html { redirect_to @resource_type, notice: 'Resource type was successfully created.' }\n format.json { render json: @resource_type, status: :created, location: @resource_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def use_type_params\n params.require(:use_type).permit(:name)\n end",
"def incident_type_params\n params.require(:incident_type).permit(:name)\n end",
"def doc_type_params\n params.require(:doc_type).permit(:name)\n end",
"def create\n @bugtype = Bugtype.new(bugtype_params)\n\n respond_to do |format|\n if @bugtype.save\n format.html { redirect_to bugtypes_path, notice: 'Bugtype was successfully created.' }\n format.json { render :index, status: :created, location: @bugtype }\n else\n format.html { render :new }\n format.json { render json: @bugtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def types\n commit('types', nil)\n end",
"def hw_type_params\n params.require(:hw_type).permit(:name, :description, :egc_server_type_id)\n end",
"def json_params\n params.require(:json).permit(:type, :data)\n end",
"def brew_type_params\n params.require(:brew_type).permit(:name, :description)\n end",
"def specification_params\n params.require(:specification).permit(:show_order, :spec_title, :status)\n end",
"def type_name_params\n params.require(:type_name).permit(:type_id, :name)\n end",
"def terraintype_params\n params.require(:terraintype).permit(:name)\n end",
"def codetype_params\n params.require(:codetype).permit(:name, :description)\n end",
"def os_type_params\n params.require(:os_type).permit(:name, :description, :egc_server_type_id)\n end",
"def create\n @defect_type = DefectType.new(defect_type_params)\n\n respond_to do |format|\n if @defect_type.save\n format.html { redirect_to @defect_type, notice: 'Defect type was successfully created.' }\n format.json { render :show, status: :created, location: @defect_type }\n else\n format.html { render :new }\n format.json { render json: @defect_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @valid_type = ValidType.new(valid_type_params)\n @valid_type.typed = true\n\n respond_to do |format|\n if @valid_type.save\n format.html { redirect_to valid_types_path, notice: 'Entity Type was successfully created.' }\n format.json { render :show, status: :created, location: @valid_type }\n else\n format.html { render :new }\n format.js { render :new }\n format.json { render json: @valid_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def competence_type_params\n params.require(:competence_type).permit(:code, :name, :type, :required, :details)\n end",
"def create\n @drug_test = DrugTest.new(params[:drug_test])\n @test_types = params[:test_types]\n @test_types_all = []\n @test_types.each do |id| \n @test_types_all +=[TestType.find_by_id(id)]\n end\n @drug_test.test_types=@test_types_all\n respond_to do |format|\n \n if @drug_test.save\n format.html { redirect_to @drug_test, notice: 'Teste de droga foi criado com sucesso.' }\n format.json { render json: @drug_test, status: :created, location: @drug_test }\n else\n format.html { render action: \"new\" }\n format.json { render json: @drug_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_type(type)\n end",
"def novelty_type_params\n params.require(:novelty_type).permit(:description)\n end",
"def specialization_params\n params.require(:specialization).permit(:name, :avatar, :status)\n end",
"def create\n @survey_data_type = SurveyDataType.new(survey_data_type_params)\n\n respond_to do |format|\n if @survey_data_type.save\n format.html { redirect_to @survey_data_type, notice: 'Survey data type was successfully created.' }\n format.json { render :show, status: :created, location: @survey_data_type }\n else\n format.html { render :new }\n format.json { render json: @survey_data_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def type_params\n params.require(:type).permit(:name, :index)\n end",
"def encounters_type_params\n params.require(:encounters_type).permit(:name, :description, :creator, :date_created, :retired, :retired_by, :date_retired, :retire_reason, :uuid)\n end",
"def create\n @type_test = TypeTest.new(type_test_params)\n\n respond_to do |format|\n if @type_test.save\n format.html { redirect_to @type_test, notice: 'Type test was successfully created.' }\n format.json { render :show, status: :created, location: @type_test }\n else\n format.html { render :new }\n format.json { render json: @type_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sw_dev_type_params\n params.require(:sw_dev_type).permit(:type)\n end",
"def tf_types\n {\n Api::Type::Boolean => 'schema.TypeBool',\n Api::Type::Double => 'schema.TypeFloat',\n Api::Type::Integer => 'schema.TypeInt',\n Api::Type::String => 'schema.TypeString',\n # Anonymous string property used in array of strings.\n 'Api::Type::String' => 'schema.TypeString',\n Api::Type::Time => 'schema.TypeString',\n Api::Type::Enum => 'schema.TypeString',\n Api::Type::ResourceRef => 'schema.TypeString',\n Api::Type::NestedObject => 'schema.TypeList',\n Api::Type::Array => 'schema.TypeList',\n Api::Type::KeyValuePairs => 'schema.TypeMap',\n Api::Type::Map => 'schema.TypeSet',\n Api::Type::Fingerprint => 'schema.TypeString'\n }\n end",
"def case_type_params\n params.require(:case_type).permit(:name)\n end",
"def create\n @incident_type = IncidentType.new(incident_type_params)\n\n respond_to do |format|\n if @incident_type.save\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully created.' }\n format.json { render :show, status: :created, location: @incident_type }\n else\n format.html { render :new }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @entity_type = EntityType.new(entity_type_params)\n @entity_type.collection_id = @collection.id\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully created.' }\n format.json { render :show, status: :created, location: @entity_type }\n else\n format.html { render :new }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def client_type_params\n params.require(:client_type).permit(:category, :status)\n end",
"def challenge_type_params\n params.require(:challenge_type).permit(:name)\n end",
"def create\n section_type_ids = params[:site_type].delete(\"section_type_ids\")\n @site_type = SiteType.new(params[:site_type])\n @site_type.section_type_ids = section_type_ids\n\n respond_to do |format|\n if @site_type.save\n format.html { redirect_to @site_type, notice: 'Site type was successfully created.' }\n format.json { render json: @site_type, status: :created, location: @site_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recept_type_params\n params.require(:recept_type).permit(:name)\n end",
"def create\n @device_type = DeviceType.new(device_type_params)\n\n respond_to do |format|\n if @device_type.save\n format.html { redirect_to browse_url(protocol: redirect_protocol), notice: 'Device type was successfully created.' }\n format.json { render :show, status: :created, location: @device_type }\n else\n format.html { render :new }\n format.json { render json: @device_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def technotype_params\n params.require(:technotype).permit(:name)\n end",
"def create\n @trait_type = TraitType.new(trait_type_params)\n\n respond_to do |format|\n if @trait_type.save\n format.html { redirect_to @trait_type, notice: 'Trait type was successfully created.' }\n format.json { render :show, status: :created, location: @trait_type }\n else\n format.html { render :new }\n format.json { render json: @trait_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hardware_type = HardwareType.new(params[:hardware_type])\n\n respond_to do |format|\n if @hardware_type.save\n format.html { redirect_to @hardware_type, notice: 'Hardware type was successfully created.' }\n format.json { render json: @hardware_type, status: :created, location: @hardware_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hardware_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def service_type_params\n params.require(:service_type).permit(:name)\n end",
"def cmd_types argv\n setup argv\n response = @api.types\n msg response\n return response\n end"
] | [
"0.67420185",
"0.64927244",
"0.6341795",
"0.6195768",
"0.619071",
"0.6129462",
"0.60754585",
"0.60294974",
"0.5896319",
"0.5872012",
"0.5859446",
"0.57690704",
"0.57690704",
"0.5745769",
"0.5745769",
"0.5744682",
"0.57230026",
"0.5692729",
"0.56481147",
"0.564453",
"0.5632541",
"0.56224823",
"0.55687386",
"0.5567806",
"0.5548086",
"0.55231786",
"0.55216205",
"0.5490508",
"0.54785925",
"0.54716194",
"0.5461064",
"0.54588014",
"0.5450446",
"0.5446475",
"0.544575",
"0.54444635",
"0.5436171",
"0.54293287",
"0.5415227",
"0.54081243",
"0.5407352",
"0.5400765",
"0.53941184",
"0.5387894",
"0.53805023",
"0.5379856",
"0.53726804",
"0.53688467",
"0.5364361",
"0.5363915",
"0.5361969",
"0.53599864",
"0.5350378",
"0.53492",
"0.534776",
"0.534776",
"0.53459036",
"0.53432816",
"0.533829",
"0.532279",
"0.5322653",
"0.5321871",
"0.5320535",
"0.5314576",
"0.5314128",
"0.53113025",
"0.52983683",
"0.5281598",
"0.5270354",
"0.52697134",
"0.5264867",
"0.5261144",
"0.5256108",
"0.5250993",
"0.5249891",
"0.52484256",
"0.5242694",
"0.52407855",
"0.52367663",
"0.5236437",
"0.5232831",
"0.5226044",
"0.52218133",
"0.5217468",
"0.5216486",
"0.5214799",
"0.5214783",
"0.5210944",
"0.5210271",
"0.5209894",
"0.52091396",
"0.5204287",
"0.52038074",
"0.5197022",
"0.5191145",
"0.518745",
"0.51860374",
"0.51850206",
"0.51688826",
"0.5167873"
] | 0.6962521 | 0 |
PATCH/PUT /spec_types/1 PATCH/PUT /spec_types/1.json | def update
respond_to do |format|
if @spec_type.update(spec_type_params)
format.html { redirect_to @spec_type, notice: 'Spec type was successfully updated.' }
format.json { render :show, status: :ok, location: @spec_type }
else
format.html { render :edit }
format.json { render json: @spec_type.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @specification_type = SpecificationType.find(params[:id])\n\n if @specification_type.update(specification_type_params)\n audit(@specification_type, current_user)\n render json: @specification_type, status: :created, serializer: Web::V1::SpecificationTypeSerializer\n else\n render json: @specification_type.errors, status: :unprocessable_entity\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def update\n\n raw = params[:sample_type]\n st = SampleType.find(raw[:id])\n\n st.name = raw[:name]\n st.description = raw[:description]\n st.save\n st.save_field_types raw[:field_types]\n\n render json: { sample_type: st }\n\n end",
"def set_spec_type\n @spec_type = SpecType.find(params[:id])\n end",
"def update\n @volume_type_extra_spec = VolumeTypeExtraSpec.find(params[:id])\n\n respond_to do |format|\n if @volume_type_extra_spec.update_attributes(params[:volume_type_extra_spec])\n format.html { redirect_to @volume_type_extra_spec, notice: 'Volume type extra spec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @volume_type_extra_spec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @type.update(type_params)\n end",
"def update!(**args)\n @int_value_spec = args[:int_value_spec] if args.key?(:int_value_spec)\n @option_value_spec = args[:option_value_spec] if args.key?(:option_value_spec)\n @type = args[:type] if args.key?(:type)\n end",
"def update_break_type(id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/labor/break-types/{id}',\n 'default')\n .template_param(new_parameter(id, key: 'id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def update\n respond_to do |format|\n if @recipe_type.update(recipe_type_params)\n format.html { redirect_to @recipe_type, notice: \"Recipe type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @recipe_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @recipe_type.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 @model_type.update(model_type_params)\n format.html { redirect_to @model_type, notice: 'Model type was successfully updated.' }\n format.json { render :show, status: :ok, location: @model_type }\n else\n format.html { render :edit }\n format.json { render json: @model_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @realty_type = RealtyType.find(params[:id])\n\n respond_to do |format|\n if @realty_type.update_attributes(params[:realty_type])\n format.html { redirect_to @realty_type, notice: 'Realty type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @realty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testtype.update(testtype_params)\n format.html { redirect_to @testtype, notice: 'Testtype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @testtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_question_type\n form_params = params.require(:form).permit(:question_id, :question_type)\n\n render json: Question.update_question_type(form_params)\n end",
"def update\n @client_type = ClientType.find(params[:id])\n\n respond_to do |format|\n if @client_type.update_attributes(params[:client_type])\n format.html { redirect_to @client_type, notice: 'Client type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @entry_type = EntryType.find(params[:id])\n\n respond_to do |format|\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type.field_type_ids = field_type_ids if field_type_ids\n params[:entry_type].delete(\"form_code\")\n if @entry_type.update_attributes(params[:entry_type])\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trait_type = TraitType.find(params[:id])\n\n if @trait_type.update(trait_type_params)\n head :no_content\n else\n render json: @trait_type.errors, status: :unprocessable_entity\n end\n end",
"def update(name, type, options = {})\n Utils.stringify_keys!(options)\n path = \"/projects/#{project.name}/resources/#{name}\"\n\n headers = build_create_base_headers(name, type, options)\n body = build_create_base_body(options)\n\n !!client.put(path, headers: headers, body: body)\n end",
"def change_type\n\t\t\trender json: User.update_type_by_id(params[:id], params[:type], params[:is])\n\t\tend",
"def update\n respond_to do |format|\n if @defect_type.update(defect_type_params)\n format.html { redirect_to @defect_type, notice: 'Defect type was successfully updated.' }\n format.json { render :show, status: :ok, location: @defect_type }\n else\n format.html { render :edit }\n format.json { render json: @defect_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_admin_type.update(api_v1_admin_type_params)\n format.html { redirect_to @api_v1_admin_type, notice: 'Admin type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_admin_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_admin_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n respond_to do |format|\n if @type_test.update(type_test_params)\n format.html { redirect_to @type_test, notice: 'Type test was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_test }\n else\n format.html { render :edit }\n format.json { render json: @type_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @affected_type.update(affected_type_params)\n format.html { redirect_to @affected_type, notice: 'Affected type was successfully updated.' }\n format.json { render :show, status: :ok, location: @affected_type }\n else\n format.html { render :edit }\n format.json { render json: @affected_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @thing_type.update(thing_type_params)\n format.html { redirect_to @thing_type, notice: 'Thing type was successfully updated.' }\n format.json { render :show, status: :ok, location: @thing_type }\n else\n format.html { render :edit }\n format.json { render json: @thing_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sample_type = SampleType.find(params[:id])\n\n respond_to do |format|\n if @sample_type.update_attributes(params[:sample_type])\n format.html { redirect_to @sample_type, notice: 'Sample type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sample_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end",
"def update \t\n record = AssetType.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"def update\n @girltype = Girltype.find(params[:id])\n\n respond_to do |format|\n if @girltype.update_attributes(params[:girltype])\n format.html { redirect_to @girltype, notice: 'Girltype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @girltype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @worktype.update(worktype_params)\n format.html { redirect_to worktypes_path, notice: 'Worktype was successfully updated.' }\n format.json { render :show, status: :ok, location: @worktype }\n else\n format.html { render :edit }\n format.json { render json: @worktype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sample_type.update(sample_type_params)\n format.html { redirect_to @sample_type, notice: \"Sample type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @sample_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @sample_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @issue_type.update(issue_type_params)\n format.html { redirect_to @issue_type, notice: 'Issue type was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue_type }\n else\n format.html { render :edit }\n format.json { render json: @issue_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_user_type.update(api_v1_user_type_params)\n format.html { redirect_to @api_v1_user_type, notice: 'User type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_user_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_user_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n @specification = Specification.find(params[:id])\n\n respond_to do |format|\n if @specification.update_attributes(params[:specification])\n format.html { redirect_to @specification, notice: 'Specification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @instance_type.update(instance_type_params)\n format.html { redirect_to @instance_type, notice: 'Instance type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instance_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @competence_type.update(competence_type_params)\n format.json { render :show, status: :ok, object: @competence_type }\n else\n format.json { render json: @competence_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @option_type.update(option_type_params)\n format.html { redirect_to [:admin, @option_type], notice: 'Option type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @option_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incident_type = IncidentType.find(params[:id])\n\n respond_to do |format|\n if @incident_type.update_attributes(params[:incident_type])\n format.html { redirect_to @incident_type, notice: 'Incident type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @optype.update(optype_params)\n format.html { redirect_to @optype, notice: 'Optype was successfully updated.' }\n format.json { render :show, status: :ok, location: @optype }\n else\n format.html { render :edit }\n format.json { render json: @optype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @method_type.update(method_type_params)\n format.html { redirect_to @method_type, notice: \"Method type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @method_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @method_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @crate_type = CrateType.find(params[:id])\n\n respond_to do |format|\n if @crate_type.update_attributes(params[:crate_type])\n format.html { redirect_to @crate_type, :notice => 'Crate type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @crate_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n standard_update(OrganizationType, params[:id], organization_type_params)\n end",
"def update\n respond_to do |format|\n if @modtype.update(modtype_params)\n format.html { redirect_to @modtype, notice: 'Modtype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @modtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @reform_type = ReformType.find(params[:id])\n\n respond_to do |format|\n if @reform_type.update_attributes(params[:reform_type])\n format.html { redirect_to @reform_type, notice: 'Reform type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reform_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trait_type.update(trait_type_params)\n format.html { redirect_to @trait_type, notice: 'Trait type was successfully updated.' }\n format.json { render :show, status: :ok, location: @trait_type }\n else\n format.html { render :edit }\n format.json { render json: @trait_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @intervention_type.update(intervention_type_params)\n format.html { redirect_to intervention_types_path, notice: 'O tipo de intervenção foi actualizado.' }\n format.json { render :show, status: :ok, location: @intervention_type }\n else\n format.html { render :edit }\n format.json { render json: @intervention_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n status_unsupported_media_type && return unless content_type_header?\n\n # Parse in the FHIR::Patient\n contents = FHIR.from_contents(request.body.string)\n status_bad_request && return if contents.nil? || !contents.valid?\n\n resource_type = params.permit(:resource_type)[:resource_type]&.downcase\n case resource_type\n when 'patient'\n updates = Patient.from_fhir(contents).select { |_k, v| v.present? }\n resource = get_patient(params.permit(:id)[:id])\n else\n status_bad_request && return\n end\n\n status_forbidden && return if resource.nil?\n\n # Try to update the resource\n status_bad_request && return if updates.nil? || !resource.update(updates)\n\n status_ok(resource.as_fhir) && return\n rescue StandardError\n render json: operation_outcome_fatal.to_json, status: :internal_server_error\n end",
"def update\n respond_to do |format|\n if @incident_type.update(incident_type_params)\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident_type }\n else\n format.html { render :edit }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @novelty_type.update(novelty_type_params)\n format.html { redirect_to @novelty_type, notice: 'Novelty type was successfully updated.' }\n format.json { render :show, status: :ok, location: @novelty_type }\n else\n format.html { render :edit }\n format.json { render json: @novelty_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ref_diagnostic_test_type = Ref::DiagnosticTestType.find(params[:id])\n\n respond_to do |format|\n if @ref_diagnostic_test_type.update_attributes(params[:ref_diagnostic_test_type])\n format.html { redirect_to ref_diagnostic_test_types_path, notice: I18n.t(:record_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ref_diagnostic_test_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bugtype.update(bugtype_params)\n format.html { redirect_to @bugtype, notice: 'Bugtype was successfully updated.' }\n format.json { render :index, status: :ok, location: @bugtype }\n else\n format.html { render :edit }\n format.json { render json: @bugtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n if @os_type.update_attributes(params[:os_type])\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def _update type, id, body\n @elasticsupport.client.update index: _index_for(type), type: type.to_s, id: id, body: body\n end",
"def update\n respond_to do |format|\n if @params_config_type_doc.update(params_config_type_doc_params)\n format.html { redirect_to @params_config_type_doc, notice: 'Params config type doc was successfully updated.' }\n format.json { render :show, status: :ok, location: @params_config_type_doc }\n else\n format.html { render :edit }\n format.json { render json: @params_config_type_doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @modeltype.update(modeltype_params)\n format.html { redirect_to @modeltype, notice: 'Modeltype was successfully updated.' }\n format.json { render :show, status: :ok, location: @modeltype }\n else\n format.html { render :edit }\n format.json { render json: @modeltype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @claim_type.update(claim_type_params)\n format.html { redirect_to @claim_type, notice: 'Claim type was successfully updated.' }\n format.json { render :show, status: :ok, location: @claim_type }\n else\n format.html { render :edit }\n format.json { render json: @claim_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @supported_types = args[:supported_types] if args.key?(:supported_types)\n end",
"def update\n respond_to do |format|\n if @interview_type.update(interview_type_params)\n format.html { redirect_to @interview_type, notice: 'Interview type was successfully updated.' }\n format.json { render :show, status: :ok, location: @interview_type }\n else\n format.html { render :edit }\n format.json { render json: @interview_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update\n respond_to do |format|\n if @call_type.update(call_type_params)\n format.html { redirect_to @call_type, notice: 'Call type was successfully updated.' }\n format.json { render :show, status: :ok, location: @call_type }\n else\n format.html { render :edit }\n format.json { render json: @call_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entity_type.update(entity_type_params)\n format.html { redirect_to @entity_type, notice: 'Entity type was successfully updated.' }\n format.json { render :show, status: :ok, location: @entity_type }\n else\n format.html { render :edit }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_document_all_types client, s, types\n log.debug \"Will update document #{s} for types #{types}\"\n\n if types\n types.each do |type|\n log.debug \"Updating document #{s} for type #{type}\"\n indexes = Indexes.instance.get_indexes type\n indexes.each do |key, index|\n allowed_groups = index[:allowed_groups]\n log.debug \"Got allowed groups for updated_document_all_types #{allowed_groups}\"\n rdf_type = settings.type_definitions[type][\"rdf_type\"]\n log.debug \"Got RDF type for updated_document_all_types #{rdf_type}\"\n if is_authorized s, rdf_type, allowed_groups\n log.debug \"Our current index knows that #{s} is of type #{rdf_type} based on allowed groups #{allowed_groups}\"\n properties = settings.type_definitions[type][\"properties\"]\n document, attachment_pipeline =\n fetch_document_to_index uri: s, properties: properties,\n allowed_groups: index[:allowed_groups]\n\n document_for_reporting = document.clone\n document_for_reporting[\"data\"] = document_for_reporting[\"data\"] ? document_for_reporting[\"data\"].length : \"none\"\n\n log.debug \"Fetched document to index is #{document_for_reporting}\"\n\n # TODO what is uuid supposed to be here? We abstract its meaning to be get_uuid(s) but are not sure\n uuid = get_uuid(s)\n\n if attachment_pipeline\n log.debug \"Document to update has attachment pipeline\"\n begin\n # client.upload_attachment index, uuid, attachment_pipeline, document\n client.upload_attachment index[:index], uuid, attachment_pipeline, document\n log.debug \"Managed to upload attachment for #{s}\"\n rescue\n log.warn \"Could not upload attachment #{s}\"\n begin\n log.debug \"Trying to update document with id #{uuid}\"\n client.update_document index[:index], uuid, document\n log.debug \"Succeeded in updating document with id #{uuid}\"\n rescue\n log.debug \"Failed to update document, trying to put new document #{uuid}\"\n client.put_document index[:index], uuid, document\n log.debug \"Succeeded in putting new document #{uuid}\"\n end\n end\n else\n begin\n log.debug \"Trying to update document with id #{uuid}\"\n client.update_document index[:index], uuid, document\n log.debug \"Succeeded in updating document with id #{uuid}\"\n rescue\n log.debug \"Failed to update document, trying to put new document #{uuid}\"\n client.put_document index[:index], uuid, document\n log.debug \"Succeeded in putting new document #{uuid}\"\n end\n end\n else\n log.info \"Not Authorized.\"\n end\n end\n end\n end\nend",
"def update\n authorize :resquest_type, :update?\n respond_to do |format|\n if @resquest_type.update(resquest_type_params)\n format.html { redirect_to @resquest_type, notice: 'Resquest type was successfully updated.' }\n format.json { render :show, status: :ok, location: @resquest_type }\n else\n format.html { render :edit }\n format.json { render json: @resquest_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gl_type = GlType.find(params[:id])\n\n respond_to do |format|\n if @gl_type.update_attributes(gl_type_params)\n format.html { redirect_to gl_types_path, notice: 'Gl type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gl_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @specification.update(specification_params)\n audit(@specification, current_user)\n render json: @specification, status: :ok, serializer: Web::V1::SpecificationSerializer\n else\n render json: @specification.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @use_type.update(use_type_params)\n format.html { redirect_to @use_type, notice: 'Use type was successfully updated.' }\n format.json { render :show, status: :ok, location: @use_type }\n else\n format.html { render :edit }\n format.json { render json: @use_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @act_type = ActType.find(params[:id])\n\n respond_to do |format|\n if @act_type.update_attributes(params[:act_type])\n format.html { redirect_to @act_type, notice: 'Данные типа документа успешно обновлены.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @act_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @opportunity_type = OpportunityType.find(params[:id])\n\n respond_to do |format|\n if @opportunity_type.update_attributes(params[:opportunity_type])\n format.html { redirect_to @opportunity_type, notice: 'Opportunity type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @opportunity_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end"
] | [
"0.6612324",
"0.63483363",
"0.620205",
"0.61537623",
"0.6052424",
"0.6011914",
"0.60113627",
"0.59829694",
"0.58779943",
"0.5865465",
"0.5856983",
"0.5843561",
"0.58425176",
"0.5820479",
"0.5819448",
"0.5813979",
"0.58093876",
"0.58080965",
"0.5805706",
"0.5785671",
"0.576515",
"0.5761612",
"0.57456076",
"0.5744094",
"0.57386434",
"0.5733928",
"0.5728965",
"0.5721894",
"0.57173634",
"0.5711579",
"0.57063425",
"0.57043517",
"0.5703474",
"0.5703082",
"0.56896955",
"0.56839657",
"0.5678607",
"0.5669457",
"0.56669825",
"0.5663867",
"0.5657721",
"0.56564564",
"0.56562984",
"0.565615",
"0.5654367",
"0.5652045",
"0.56500006",
"0.5649033",
"0.56414825",
"0.56333554",
"0.5630464",
"0.5627618",
"0.56262606",
"0.5619738",
"0.56192935",
"0.5618749",
"0.5612042",
"0.5610889",
"0.56107146",
"0.5608465",
"0.56053025",
"0.56053025",
"0.56053025",
"0.56053025",
"0.56053025",
"0.56053025",
"0.55927014",
"0.5588946",
"0.55797577",
"0.5577651",
"0.55771255",
"0.55768543",
"0.5574527",
"0.5574483",
"0.5572502",
"0.5571803",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194",
"0.55708194"
] | 0.71187735 | 0 |
DELETE /spec_types/1 DELETE /spec_types/1.json | def destroy
@spec_type.destroy
respond_to do |format|
format.html { redirect_to spec_types_url, notice: 'Spec type was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @ref_diagnostic_test_type = Ref::DiagnosticTestType.find(params[:id])\n @ref_diagnostic_test_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_diagnostic_test_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @testtype.destroy\n respond_to do |format|\n format.html { redirect_to testtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n audit(@specification_type, current_user)\n @specification_type.destroy\n\n head :no_content\n end",
"def destroy\n @girltype = Girltype.find(params[:id])\n @girltype.destroy\n\n respond_to do |format|\n format.html { redirect_to girltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n respond_to do |format|\n format.html { redirect_to client_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_type = SampleType.find(params[:id])\n @sample_type.destroy\n\n respond_to do |format|\n format.html { redirect_to sample_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:type])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to company_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @volume_type_extra_spec = VolumeTypeExtraSpec.find(params[:id])\n @volume_type_extra_spec.destroy\n\n respond_to do |format|\n format.html { redirect_to volume_type_extra_specs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dishtype.destroy\n respond_to do |format|\n format.html { redirect_to dishtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to realty_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident_type = IncidentType.find(params[:id])\n @incident_type.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ref_med_diagnostic_test_type = Ref::MedDiagnosticTestType.find(params[:id])\n @ref_med_diagnostic_test_type.destroy\n\n respond_to do |format|\n format.html { redirect_to ref_med_diagnostic_test_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ba_spec = BaSpec.find(params[:id])\n @ba_spec.destroy\n\n respond_to do |format|\n format.html { redirect_to ba_specs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_type.destroy\n respond_to do |format|\n format.html { redirect_to sample_types_url, notice: \"Sample type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate_type = CrateType.find(params[:id])\n @crate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to crate_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @structure_type = StructureType.find(params[:id])\n @structure_type.destroy\n\n respond_to do |format|\n format.html { redirect_to structure_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_test.destroy\n respond_to do |format|\n format.html { redirect_to type_tests_url, notice: 'Type test was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @devicetype.destroy\n respond_to do |format|\n format.html { redirect_to devicetypes_url, notice: 'Devicetype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_admin_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_admin_types_url, notice: 'Admin type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @affected_type.destroy\n respond_to do |format|\n format.html { redirect_to affected_types_url, notice: 'Affected type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @os_type = OsType.find(params[:id])\n @os_type.destroy\n\n respond_to do |format|\n format.html { redirect_to os_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n asset_type = AssetType.find(params[:id])\n asset_type.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reform_type = ReformType.find(params[:id])\n @reform_type.destroy\n\n respond_to do |format|\n format.html { redirect_to reform_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tariff_type = TariffType.find(params[:id])\n @tariff_type.destroy\n\n respond_to do |format|\n format.html { redirect_to tariff_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gl_type = GlType.find(params[:id])\n @gl_type.destroy\n\n respond_to do |format|\n format.html { redirect_to gl_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @defect_type.destroy\n respond_to do |format|\n format.html { redirect_to defect_types_url, notice: 'Defect type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe_type.destroy\n respond_to do |format|\n format.html { redirect_to recipe_types_url, notice: \"Recipe type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coverage_type.destroy\n respond_to do |format|\n format.html { redirect_to coverage_types_url, notice: 'Coverage type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @act_type = ActType.find(params[:id])\n @act_type.destroy\n\n respond_to do |format|\n format.html { redirect_to act_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(realty_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @modtype.destroy\n respond_to do |format|\n format.html { redirect_to modtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @benchmark_type = BenchmarkType.find(params[:id])\n @benchmark_type.destroy\n\n respond_to do |format|\n format.html { redirect_to benchmark_types_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"def destroy\n @identifier_type.destroy\n\n respond_to do |format|\n format.html { redirect_to identifier_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @instance_type.destroy\n respond_to do |format|\n format.html { redirect_to instance_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicle_type.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device_type.destroy\n respond_to do |format|\n format.html { redirect_to device_types_url(protocol: redirect_protocol), notice: 'Device type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @appliance_type = ApplianceType.find(params[:id])\n @appliance_type.destroy\n\n respond_to do |format|\n format.html { redirect_to appliance_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @addresstype = Addresstype.find(params[:id])\n @addresstype.destroy\n\n respond_to do |format|\n format.html { redirect_to addresstypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_identification.destroy\n respond_to do |format|\n format.html { redirect_to type_identifications_url, notice: 'Type identification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @os_type.destroy\n respond_to do |format|\n format.html { redirect_to os_types_url, notice: 'Os type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @claim_type.destroy\n respond_to do |format|\n format.html { redirect_to claim_types_url, notice: 'Claim type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @observation_type = ObservationType.find(params[:id])\n @observation_type.destroy\n\n respond_to do |format|\n format.html { redirect_to observation_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @drive_type = DriveType.find(params[:id])\n @drive_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(drive_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @crossbowtype.destroy\n respond_to do |format|\n format.html { redirect_to crossbowtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fueltype = Fueltype.find(params[:id])\n @fueltype.destroy\n\n respond_to do |format|\n format.html { redirect_to fueltypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @specification.destroy\n respond_with :specifications\n end",
"def destroy\n @power_rack_type.destroy\n respond_to do |format|\n format.html { redirect_to power_rack_types_url, notice: \"Power rack type was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe_type = RecipeType.find(params[:id])\n @recipe_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(recipe_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @question_type = QuestionType.find(params[:id])\n @question_type.destroy\n\n respond_to do |format|\n format.html { redirect_to question_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @model_type.destroy\n respond_to do |format|\n format.html { redirect_to model_types_url, notice: 'Model type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @talktype = Talktype.find(params[:id])\n @talktype.destroy\n\n respond_to do |format|\n format.html { redirect_to talktypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recept_type.destroy\n respond_to do |format|\n format.html { redirect_to recept_types_url, notice: 'Recept type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @novelty_type.destroy\n respond_to do |format|\n format.html { redirect_to novelty_types_url, notice: 'Novelty type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collection_type = CollectionType.find(params[:id])\n @collection_type.destroy\n\n respond_to do |format|\n format.html { redirect_to collection_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thing_type.destroy\n respond_to do |format|\n format.html { redirect_to thing_types_url, notice: 'Thing type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_user_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_user_types_url, notice: 'User type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vehicletype.destroy\n respond_to do |format|\n format.html { redirect_to vehicletypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ftype = Ftype.find(params[:id])\n @ftype.destroy\n\n respond_to do |format|\n format.html { redirect_to ftypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat_type.destroy\n respond_to do |format|\n format.html { redirect_to flat_types_url, notice: 'Flat type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_type = ServiceType.find(params[:id])\n @service_type.destroy\n\n respond_to do |format|\n format.html { redirect_to service_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arc_type.destroy\n respond_to do |format|\n format.html { redirect_to arc_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run_type = RunType.find(params[:id])\n @run_type.destroy\n\n respond_to do |format|\n format.html { redirect_to run_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @master_spec = Master::Spec.find(params[:id])\n @master_spec.destroy\n\n respond_to do |format|\n format.html { redirect_to(master_specs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @run_type.destroy\n respond_to do |format|\n format.html { redirect_to run_types_url, notice: 'Run type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @instance_type = InstanceType.find(params[:id])\n @instance_type.destroy\n\n respond_to do |format|\n format.html { redirect_to instance_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @params_config_type_doc.destroy\n respond_to do |format|\n format.html { redirect_to params_config_type_docs_url, notice: 'Params config type doc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entry_type = EntryType.find(params[:id])\n @entry_type.destroy\n\n respond_to do |format|\n format.html { redirect_to entry_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @competence_type.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @dash_type = DashType.find(params[:id])\n @dash_type.destroy\n\n respond_to do |format|\n format.html { redirect_to dash_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fieldtype = Fieldtype.find(params[:id])\n @fieldtype.destroy\n\n respond_to do |format|\n format.html { redirect_to fieldtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_data_type.destroy\n respond_to do |format|\n format.html { redirect_to survey_data_types_url, notice: 'Survey data type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @talk_type = TalkType.find(params[:id])\n @talk_type.destroy\n\n respond_to do |format|\n format.html { redirect_to talk_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @heat_type = HeatType.find(params[:id])\n @heat_type.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manifestation_type = ManifestationType.find(params[:id])\n @manifestation_type.destroy\n\n respond_to do |format|\n format.html { redirect_to manifestation_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @document_type = DocumentType.find(params[:id])\n @document_type.destroy\n\n respond_to do |format|\n format.html { redirect_to document_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spec = @spec_keyword.spec\n @spec_keyword.destroy\n respond_to do |format|\n format.html { redirect_to edit_spec_url(@spec) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ctype = Ctype.find(params[:id])\n @ctype.destroy\n\n respond_to do |format|\n format.html { redirect_to ctypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @good_type.destroy\n respond_to do |format|\n format.html { redirect_to good_types_url, notice: 'Good type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vet_lab_type = VetLabType.find(params[:id])\n @vet_lab_type.destroy\n\n respond_to do |format|\n format.html { redirect_to vet_lab_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @incidenttype = Incidenttype.find(params[:id])\n @incidenttype.destroy\n\n respond_to do |format|\n format.html { redirect_to(incidenttypes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @incident_type.destroy\n respond_to do |format|\n format.html { redirect_to admin_incident_types_path, notice: 'Incident type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brew_type.destroy\n respond_to do |format|\n format.html { redirect_to brew_types_url, notice: 'Brew type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @sample_type = SampleType.find(params[:id])\n\n if !@sample_type.samples.empty?\n flash[:notice] = \"Could not delete sample type definition #{@sample_type.name} because it has samples associated with it.\"\n else\n @sample_type.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to sample_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hardware_type = HardwareType.find(params[:id])\n @hardware_type.destroy\n\n respond_to do |format|\n format.html { redirect_to hardware_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @m_test_type.destroy\n respond_to do |format|\n format.html { redirect_to m_test_types_url, notice: 'M test type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cdist_type = CdistType.find(params[:id])\n @cdist_type.destroy\n\n respond_to do |format|\n format.html { redirect_to cdist_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @segment_type = SegmentType.find(params[:id])\n @segment_type.destroy\n\n respond_to do |format|\n format.html { redirect_to segment_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hr_config_discipline_type.destroy\n respond_to do |format|\n format.html { redirect_to hr_config_discipline_types_url, notice: 'Discipline type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hw_type.destroy\n respond_to do |format|\n format.html { redirect_to hw_types_url, notice: 'Hw type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trait_type.destroy\n respond_to do |format|\n format.html { redirect_to trait_types_url, notice: 'Trait type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract_type = ContractType.find(params[:id])\n @contract_type.destroy\n\n respond_to do |format|\n format.html { redirect_to contract_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @call_type.destroy\n respond_to do |format|\n format.html { redirect_to call_types_url, notice: 'Call type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_type.destroy\n respond_to do |format|\n format.html { redirect_to client_types_url, notice: 'Tipo de Cliente deletado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jewelry_type = JewelryType.find(params[:id])\n @jewelry_type.destroy\n\n respond_to do |format|\n format.html { redirect_to jewelry_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @itype = Itype.find(params[:id])\n @itype.destroy\n\n respond_to do |format|\n format.html { redirect_to itypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize :resquest_type, :destroy?\n @resquest_type.destroy\n respond_to do |format|\n format.html { redirect_to resquest_types_url, notice: 'Resquest type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bs_type.destroy\n respond_to do |format|\n format.html { redirect_to bs_types_url, notice: 'Bs type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @interview_type.destroy\n respond_to do |format|\n format.html { redirect_to interview_types_url, notice: 'Interview type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @addtype.destroy\n respond_to do |format|\n format.html { redirect_to addtypes_url, notice: '变动方式删除成功!.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.7179933",
"0.7171601",
"0.7051086",
"0.70505744",
"0.70373565",
"0.69487417",
"0.69423866",
"0.69380033",
"0.6933932",
"0.69169086",
"0.6906474",
"0.69033784",
"0.6888754",
"0.68825257",
"0.6879661",
"0.68530214",
"0.6824261",
"0.68000007",
"0.67935455",
"0.67918843",
"0.67808807",
"0.67748153",
"0.6770307",
"0.67599285",
"0.67581755",
"0.67508096",
"0.6736355",
"0.67318743",
"0.6703659",
"0.6702775",
"0.6691591",
"0.6685906",
"0.6682436",
"0.6681015",
"0.6680522",
"0.66732955",
"0.66610897",
"0.6651411",
"0.6646649",
"0.6645148",
"0.6640902",
"0.6640556",
"0.6638874",
"0.66378576",
"0.6633886",
"0.66328686",
"0.6630205",
"0.6627471",
"0.66249985",
"0.6624332",
"0.66153425",
"0.6611055",
"0.6609059",
"0.6607944",
"0.6607339",
"0.66057396",
"0.6603982",
"0.660096",
"0.65946585",
"0.65928864",
"0.65920675",
"0.65919554",
"0.6591148",
"0.65906775",
"0.65818197",
"0.6581767",
"0.6581033",
"0.65807825",
"0.6576924",
"0.657692",
"0.65769005",
"0.65764505",
"0.65717447",
"0.6569927",
"0.656962",
"0.6569427",
"0.6566065",
"0.65642715",
"0.65638375",
"0.6561967",
"0.656085",
"0.6560501",
"0.6557577",
"0.65531266",
"0.654993",
"0.6549195",
"0.65464514",
"0.65455604",
"0.65435284",
"0.65433735",
"0.65422875",
"0.65352315",
"0.6534005",
"0.6532498",
"0.6527214",
"0.6524385",
"0.6523666",
"0.6516685",
"0.6515542",
"0.65147674"
] | 0.7780576 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_spec_type
@spec_type = SpecType.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 spec_type_params
params[:spec_type]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def 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 url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.6291174",
"0.62905735",
"0.6283171",
"0.6242344",
"0.62403613",
"0.6218049",
"0.62143815",
"0.62104696",
"0.61949855",
"0.6178671",
"0.6176147",
"0.6173327",
"0.6163395",
"0.6153005",
"0.6151833",
"0.6147288",
"0.61224324",
"0.6118827",
"0.61075264",
"0.61054534",
"0.6092497",
"0.6080082",
"0.60710967",
"0.60627776",
"0.60219413",
"0.60175914",
"0.60153484",
"0.60107356",
"0.60081726",
"0.60081726",
"0.60013986",
"0.6000165",
"0.59978646",
"0.59936947",
"0.59925723",
"0.5992084",
"0.59796256",
"0.5967569",
"0.5960056",
"0.59589803",
"0.5958441",
"0.5958401",
"0.5952607",
"0.5952406",
"0.5944409",
"0.59391016",
"0.593842",
"0.593842",
"0.5933845",
"0.59312123",
"0.5926475",
"0.59248453",
"0.59179676",
"0.59109294",
"0.59101623",
"0.5908172",
"0.59058356",
"0.5899052",
"0.5897749",
"0.5896101",
"0.58942914",
"0.58939576",
"0.5892063",
"0.5887407",
"0.588292",
"0.58797663",
"0.587367",
"0.58681566",
"0.5868038",
"0.5866578",
"0.58665025",
"0.58655846",
"0.58640826",
"0.5863465",
"0.5862226",
"0.586065",
"0.58581287",
"0.5854443",
"0.5854172",
"0.58507544",
"0.5849934"
] | 0.0 | -1 |
test if the two values match or not | def bar?
# with new cache structure, data is written to cache every frame, so after a couple of frames of not firing, the two values in the cache will be the same.
# Nothing wrong with that though. It's not like you're allocating any more data than before or anything.
# if boolean, return that value instead, ignoring the cache
return @this if !!@this == @this
# there is stored data but it's old, or no data has yet been stored
@prev && @prev != @this or @prev.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equals(one, two)\n matched_by(one, two)\n matched_by(two, one)\n end",
"def check\n if @value1 == @value2\n @message = \"#{@value1} == #{@value2}\"\n true\n else\n @message = \"#{@value1} != #{@value2}\"\n false\n end\n end",
"def test_not_same_value_as\n #G\n white_pair = PAIR_OF_4\n black_value = VALUE_2\n\n #W\n result = white_pair.same_value? black_value\n\n #T\n assert_false result\n end",
"def is_equal?(old_values,new_values,multivalued_field=false)\n new_values_split = (multivalued_field && new_values.class != Array && !new_values.blank?) ? new_values.to_s.split(\"|\") : new_values # if the user has indicated the first value is coming a special multivalued field entered as a single value, let's split along the delimiter\n compare_values1=self.to_array(old_values).collect{|val| val.to_s.strip.gsub(/\\r\\n?/, \"\\n\")}.delete_if(&:blank?).sort\n compare_values2=self.to_array(new_values_split).collect{|val| val.to_s.strip.gsub(/\\r\\n?/, \"\\n\")}.delete_if(&:blank?).sort\n compare_values1 == compare_values2\n end",
"def approxmatching(a,b)\n\treturn (a==b)\nend",
"def parameter_matches a, b\n return false if String === b\n\n if a.register? && b.register? then\n return a.bits == b.bits && (b.id.nil? || a.id == b.id)\n end\n\n if a.address? && b.address? then\n return ! b.offset? || a.offset?\n end\n\n if a.special_register? && b.special_register? then\n return a.class == b.class && (b.id.nil? || a.id == b.id)\n end\n\n return false unless b.immediate?\n\n if a.immediate_value? then\n return (b.value && b.value == a) || b.bits.nil? || a < (2 ** b.bits)\n end\n\n if a.label? then\n return a.future_label? ? b.bits == a.machine.bits :\n a.bits <= (b.bits || a.machine.bits)\n end\n\n false\n end",
"def has_match?(p1, p2)\n\t\t! (Match[:p1_id => p1.id, :p2_id => p2.id] or Match[:p2_id => p1.id, :p1_id => p2.id]).nil?\n\tend",
"def matches?(other)\n operable_values == other.operable_values\n end",
"def matches?(actual)\n @matching_values.include?(actual)\n end",
"def is_equal?(a)\n @amount == a.amount && @code == a.code\n end",
"def reactive_pair?(a, b)\n (a.ord - b.ord).abs == MATCH_DIFF\n end",
"def snapshots_match?(s1, s2)\n s1 == s2\n end",
"def exact_match?(name1:, name2:)\n return false unless name1.present? && name2.present?\n\n a = name_without_alias(name: name1.downcase)\n b = name_without_alias(name: name2.downcase)\n a == b\n end",
"def matching(action_result1, action_result2)\n (action_result1.role_id == action_result2.role_id || action_result1.role_id.nil? || action_result2.role_id.nil?) &&\n action_result1.class == action_result2.class &&\n action_result1.day_id == action_result2.day_id\n end",
"def matches? actual\n super\n\n true === actual || false === actual\n end",
"def compare(val1,val2)\n status = false\n if(val1.eql?val2)\n status = true\n end\n status\n end",
"def street_areSame?(street)\n if(@street == street)\n true\n else\n false\n end\nend",
"def matches?(actual)\n expected_value == actual\n end",
"def equal?(p0) end",
"def matches?\n symbol = @actual.is_a?(Symbol)\n actual = symbol ? @actual.to_s : @actual\n values = symbol ? @values.map { |v| v.is_a?(Symbol) ? v.to_s : v } : @values\n\n values.each do |value|\n return false unless actual.include?(value)\n end\n\n true\n end",
"def react? a, b\n a != b && a.casecmp(b) == 0\nend",
"def match?(left, right)\n match(left, right) >= IdentityParade.config.match_score\n end",
"def ==(other)\n matches(other) && @values == other.values\n end",
"def pass?\n expected_array.size == actual_array.size &&\n [expected_array, actual_array].transpose.all? do |expected_element, actual_value|\n expected_element.match_against_actual_value(actual_value)\n end\n end",
"def keys_match?(my_row, other_row)\n\t\t# Ensure arguments are not nil\n\t\tif not (my_row and other_row)\n\t\t\treturn nil\n\t\tend\n\t\t\n\t\t# If each value at this key doesn't match, return false\n\t\[email protected] do |key|\n\t\t\tif not my_row[key].to_s =~ /^#{other_row[key].to_s}$/i\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\t\n\t\t#$stdout.puts \"Match: \" + my_row[\"split_zip\"] + \" AND \" + other_row[\"split_zip\"]\n\t\t\n\t\t# If we checked values at each key w/o mismatch, its the same\n\t\treturn true\n\tend",
"def isMatch(selectedCard1, selectedCard2, matrix)\n\t\tpos1 = selectedCard1['x']\n\t\tpos2 = selectedCard1['y']\n\t\tpos3 = selectedCard2['x']\t\t\n\t\tpos4 = selectedCard2['y']\t\t\n\t\tprint matrix\n\t\tputs \"Position1 has the value #{matrix[pos1][pos2]} and Position2 has the value #{matrix[pos3][pos4]}\"\n\t\tif (matrix[pos1][pos2] == matrix[pos3][pos4])\n\t\t\tputs \"Match Found\"\n\t\t\treturn true\n\t\telse\n\t\t\tputs \"No Match\"\n\t\t\treturn false\n\t\tend\n\tend",
"def bt_same_value?(other)\n bt_value_attributes == other.bt_value_attributes\n end",
"def same(u, p)\n u == p\nend",
"def == other\n (self.start_value == other.start_value) &&\n (self.value_changes == other.value_changes)\n end",
"def test? value\n begin\n @pairs.all? { |k, v| v === value[k] }\n rescue\n false\n end\n end",
"def assert_pairs_match( key, val, expected_key, expected_val )\n assert_equal(key, expected_key) if val == expected_val\n end",
"def matches?(value, context); end",
"def availability_match(t1, t2)\n (t1.to_i & t2.to_i).to_s(2).count('1')\n end",
"def equal?(a, b)\n if a == b\n puts 'PASS'\n else\n puts 'FAILS'\n end\n end",
"def unique_val?\n @lower == @upper\n end",
"def similar_value(a, b, c)\n @board[a[0]][a[1]] == @board[b[0]][b[1]] && @board[b[0]][b[1]] == @board[c[0]][c[1]]\n end",
"def has_match?\n !match_x.nil? && !match_y.nil?\n end",
"def same?(user,pass)\n if user == pass\n true\n else\n false\n end\nend",
"def verifyEqual(exp_val,act_val)\n assert_equal(exp_val, act_val,\"Wrong value Expected #{exp_val} Actual #{act_val}\")\n end",
"def match?(other)\n return false unless other.is_a?(GroupingCriteria)\n return true if ids && other.ids && ids.intersect?(other.ids)\n return true if values == other.values\n return false if values.blank? || other.values.blank?\n values.each_with_index.all? do |v, i|\n v.blank? || other.values[i].blank? || (v == other.values[i])\n end\n end",
"def lane_equal other_sample\n [:genome, :protocol].each do |lane_data|\n # puts \"#{self.send(lane_data)}\"\n if self.send(lane_data) != other_sample.send(lane_data)\n return false\n end\n end\n true\n end",
"def value?(value) true end",
"def equals_to?\n values = {}\n @maximum_values.each { |k, v| values[k] = v }\n @minimum_values.each { |k, v| values[k] = v }\n\n values.each do |key, value|\n return false, :count => value unless good?(value, default_message_for(key))\n end\n true\n end",
"def isSame(tab)\n for x in 0..3\n for y in 0..3\n return(false) if (self.val(x,y) != tab.val(x,y)) ;\n end\n end\n return true ;\n end",
"def reactive_pair? mer1, mer2\n mer1 != mer2 && mer1.upcase == mer2.upcase\nend",
"def matches?\n @actual == @expected\n end",
"def equal?(other)\n return false unless type == other.type\n return false unless power == other.power\n return false unless prefix == other.prefix\n return true\n end",
"def matches?(other)\n self.exists? && other.exists? && self.hash == other.hash\n end",
"def matches?(field, value)\n\t\tdown_field = field.downcase\n\t\tdown_val = value.downcase\n approx = false\n\n if down_val.start_with?('~')\n approx = true\n down_val = down_val[1..-1]\n end\n\n\t\tif @fields[0].eql?(down_field)\n\t\t\[email protected]?(down_val) || @name.start_with?(down_val) || @name.include?(down_val)\n\t\telsif @data.has_key?(down_field)\n\t\t\t@data[down_field].include?(down_val) || approx ? @data[down_field].include_similar?(down_val) : false\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def vars_eq?(x1, x2) ; x1[0] == x2[0] ; end",
"def match_and_both?(expected)\n match?(expected) ? [@lookahead.type, @lookahead.value] : nil\n end",
"def matches(other)\n other.kind_of?(QueryField) && other.name == @name && other.operation == @operation && other.boost == @boost \n end",
"def ==(another_wine)\n if self.supplier.eql?(another_wine['supplier'])\n if self.name.eql?(another_wine['name'])\n if self.country_of_origin.eql?(another_wine['country_of_origin'])\n if self.price == another_wine['price'].to_d\n if self.grape_type.eql?(another_wine['grape_type'])\n if self.suitable_for_vegetarians == another_wine['suitable_for_vegetarians']\n if self.bottle_size.eql?(another_wine['bottle_size'])\n if self.description.eql?(another_wine['description'])\n if self.image_url.eql?(another_wine['image_url'])\n return true\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n return false\n end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def eql?(p0) end",
"def same_as?(l2)\r\n\t\tself.product.id == l2.product.id && self.option_values == l2.option_values\r\n\tend",
"def match?\n false\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def eql?(*) end",
"def fuzzy_hash_eql?(left, right)\n return true if (left == right)\n\n (left.count == right.count) && left.inject(true) do |res, kvp|\n res && (kvp[1] == right[kvp[0]])\n end\n end",
"def fuzzy_hash_eql?(left, right)\n return true if (left == right)\n\n (left.count == right.count) && left.inject(true) do |res, kvp|\n res && (kvp[1] == right[kvp[0]])\n end\n end",
"def is_a_match(total_in_common)\n total_in_common >= 2 ? true : false\n end",
"def Same(userID, password)\n if userID != password\n puts \"true\"\n else\n puts \"false\"\n end\nend",
"def test_equality_simple\n value1_ = ::Versionomy.create(:major => 2, :minor => 0, :release_type => :alpha, :alpha_version => 5)\n value2_ = ::Versionomy.create(:major => 2, :release_type => :alpha, :alpha_version => 5)\n assert_equal(value2_, value1_)\n assert_equal(value2_.hash, value1_.hash)\n end",
"def player_turns_are_equal?\n player_1['turns'] == player_2['turns']\n end",
"def eql?(other)\n (@x == other.x) && (@y == other.y)\n end",
"def ==(other)\n return false unless other\n return false unless other.respond_to?(:target_org)\n return @target_org == other.target_org && @feeling == other.feeling \n end",
"def ==(*several_variants)\n #This is a stub, used for indexing\n end",
"def values_sndiff_equal?(bav, pav)\n bav == pav || string_numeric_diff_ignored? && bav.is_a?(String) && pav.is_a?(Numeric) && to_number_or_nil(bav) == pav\n end",
"def checkEqrr(before, after, instruction)\n\ta = instruction[1] #reg\n\tb = instruction[2] #reg\n\tc = instruction[3] #reg\n\n\treturn (after[c] == 1 && before[a] == before[b]) || (after[c] == 0 && before[a] != before[b])\nend",
"def one?(parameter, other)\n (send(parameter)) ^ (other.send(parameter))\n end",
"def ==( other )\n @x == other.x and @y == other.y and @type == other.type\n end",
"def == (otro)\nif(@num == otro.num) && (@deno == otro.deno)\ntrue\nelse\nfalse\nend\nend",
"def same_as?(other_card)\n ##(cc_type == other_card.cc_type) && (last_digits == other_card.last_digits) && (name == other_card.name) && (user_id == other_card.user_id) && (year == other_card.year) && (month == other_card.month)\n card_data == other_card.card_data\n end",
"def matches_expected? pi\n pi.patient_identifier == expected.patient_identifier &&\n pi.affinity_domain == expected.affinity_domain\n end",
"def full?(player1, player2) \n full = @field.all? {|f| f == player1.symbol || f == player2.symbol }\n return full\n end",
"def checkEqri(before, after, instruction)\n\ta = instruction[1] #reg\n\tb = instruction[2] #val\n\tc = instruction[3] #reg\n\n\treturn (after[c] == 1 && before[a] == b) || (after[c] == 0 && before[a] != b)\nend",
"def == other\n return (@value == other.value) &&\n (@transition == other.transition)\n end",
"def =~(other)\n other = coerce(other)\n (other &&\n (name == other.name) &&\n (version.to_s == other.version.to_s) &&\n (platform_string == other.platform_string))\n end",
"def match?(instance)\n match_id?(instance) || match_percentage?(instance) || match_groups?(instance)\n end",
"def match\n true\n end",
"def match(other)\n solve == other.solve\n end",
"def ==(other)\n date == other.date &&\n user == other.user &&\n text == other.text\n end",
"def eql?(other)\n return false unless other.captures_hash == captures_hash\n return false unless other.squares_hash == squares_hash\n return false unless other.turn == turn\n return false unless other.state == state\n\n true\n end",
"def is_correct?\n self.match.final_result == selected_result\n end",
"def found_exact?\n @found_exact\n end",
"def equal?(other); end",
"def is_equal_value?\n return true unless value_to_compare?\n assigns[@name] == @options[:with]\n end",
"def match?(value, expectation)\n match! value, expectation\n true\n rescue Mismatch\n false\n end",
"def assert_match(value, other)\n flunk(\"#{value.inspect} =~ #{other.inspect}\") unless other =~ Regexp.new(value)\n success\n end",
"def ==(other)\n other.x == @x && other.y == @y\n end",
"def exact?\n @exact\n end",
"def similar_to?(other)\n return false if [:connect_type, :install_type, :secondary_voltage].any? do |prop|\n self[prop] != other[prop]\n end\n\n # Allow 12.47kV and 12.5kV configurations to be used interchangably\n return false if (self[:primary_voltage].to_i - other[:primary_voltage].to_i).abs > 300\n\n self.phases == other.phases\n end",
"def =~(other)\n other = coerce( other )\n return (other and \n self.name == other.name and\n self.version.to_s == other.version.to_s and\n self.platform_string == other.platform_string )\n end",
"def same(x, y)\n find(x) == find(y)\n end"
] | [
"0.7227751",
"0.70846874",
"0.6882077",
"0.6877162",
"0.681408",
"0.6752444",
"0.66699755",
"0.6647723",
"0.66419613",
"0.66240984",
"0.65509623",
"0.6540419",
"0.6474069",
"0.6437279",
"0.6433643",
"0.64331496",
"0.6427681",
"0.64171237",
"0.63864017",
"0.6362724",
"0.63380337",
"0.6313038",
"0.63058895",
"0.62935543",
"0.62662154",
"0.626424",
"0.62520605",
"0.62463325",
"0.6244504",
"0.6227904",
"0.6224582",
"0.6213008",
"0.6195483",
"0.61895543",
"0.61786866",
"0.61764246",
"0.61729217",
"0.61613774",
"0.6145962",
"0.61437225",
"0.61414546",
"0.61344546",
"0.6129526",
"0.6127489",
"0.6114485",
"0.61015284",
"0.60823405",
"0.60735726",
"0.6072656",
"0.6070703",
"0.6069835",
"0.6065624",
"0.6056891",
"0.60543853",
"0.60543853",
"0.60543853",
"0.6054017",
"0.6054017",
"0.6054017",
"0.6054017",
"0.6053882",
"0.60508674",
"0.6048932",
"0.6048932",
"0.604482",
"0.6044575",
"0.6044575",
"0.60429907",
"0.60312414",
"0.6024702",
"0.602346",
"0.60213244",
"0.60161686",
"0.6014319",
"0.60132015",
"0.6010333",
"0.6010147",
"0.60087055",
"0.6008373",
"0.599459",
"0.5994538",
"0.59889007",
"0.59888905",
"0.5988539",
"0.59885293",
"0.59836715",
"0.5981645",
"0.5968925",
"0.59637547",
"0.596203",
"0.596136",
"0.5960923",
"0.59560347",
"0.5947423",
"0.59341747",
"0.59287083",
"0.5924594",
"0.5924182",
"0.5914533",
"0.59143287",
"0.591275"
] | 0.0 | -1 |
save a new value in the cache, kicking out the oldest value | def save(data)
# NOTE: in a low-level implementation of this, you want to have two "save slots", and juggle pointers to figure out what data is "this" and what is "prev", rather moving the data down one slot. (ie, you alternate saving data into the left slot, and the right slot, rather than always saving in the right slot)
@prev = @this
@this = data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(key, value)\n return if @capacity <= 0\n\n @cache_mutex.synchronize do\n @map.delete(key) if @map.key?(key)\n\n @map[key] = CacheElement.new(value)\n\n @map.delete(@map.first[0]) if @map.size > @capacity\n nil\n end\n end",
"def set_cache(value); end",
"def set_cache(value); end",
"def cache_value?; end",
"def add(value)\n ensure_cache_path_created\n FileUtils.touch(File.join(cache_path, value))\n end",
"def refill\n now = Time.now.to_i\n cache_set.each {|rec|\n ttl = rec[:end_ts].to_i - now\n cache_write( rec[:key], rec[:value], ttl ) if ttl > 0 \\\n if rec[:value] and rec[:value].length > MAX_OBJ_SIZE and ttl > 0\n }\n end",
"def write(key, value)\n @cache[key] = value\n end",
"def write(key, value, expires_in: nil)\n @cache[key] = value\n @expires[key] = Faulty.current_time + expires_in unless expires_in.nil?\n end",
"def cached_set(key, value)\n return unless h = self[:cache]\n Sequel.synchronize{h[key] = value}\n end",
"def set_cache\n cache_key = self.class.cache_key(self.key)\n Rails.cache.write(cache_key, self.actual_value)\n end",
"def put(key, value)\n return if @capacity.zero?\n @cache.delete(key)\n @cache.shift while @cache.size >= @capacity\n @cache[key] = value\n end",
"def add( name, value, created_on )\n meter = fetch( name, nil )\n\n # If the name isn't cached, cache it and return\n return cache( name, value, created_on ) unless meter\n\n # If the cached value is for a different day, flush it, cache the new value and return\n if meter.created_on != created_on\n flush( name )\n cache( name, value, created_on )\n return\n end\n\n # Add the new value to the cached value and flush if expired\n meter.value += value\n flush( name ) if meter.expired?\n end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def set key, value\n begin\n write_cache_file( key, Marshal::dump(value) )\n flush_expired if gc_auto\n return true\n rescue\n flush_expired if gc_auto\n return false\n end\n end",
"def cache_store(key, value, options = {})\n nkey = namespaced(key)\n\n # Get the time after which the cache should be expired\n if options[:ttl]\n ttl = options[:ttl]\n else\n ttl = Ramaze::Cache::Sequel.options[:ttl]\n end\n \n expires = Time.now + ttl if ttl\n \n # The row already exists, update it.\n if @dataset.filter(:key => nkey).count == 1\n serialized_value = serialize(value)\n\n if serialized_value\n @dataset.update(:value => serialize(value), :expires => expires)\n end\n # The row doesn't exist yet.\n else\n serialized_value = serialize(value)\n\n if serialized_value\n @dataset.insert(:key => nkey, :value => serialize(value), :expires => expires)\n end\n end\n\n # Try to deserialize the value. If this fails we'll return a different value\n deserialized = deserialize(@dataset.select(:value).filter(:key => nkey)\n .limit(1).first[:value])\n\n if deserialized\n return deserialized\n else\n return value\n end\n end",
"def assign_cached(value)\n uploaded_file = uploaded_file(value)\n set(uploaded_file) if cache.uploaded?(uploaded_file)\n end",
"def store(new_version)\n self.version = new_version\n cache.store(CACHE_VERSION_KEY, {'version' => new_version, 't' => cache_timestamp})\n end",
"def cache(key, value)\n @cache[key] = value\n end",
"def set_cache\n Rails.cache.write(Service.cache_key,JSON.parse(params[:newest]))\n render :text => 'New cache!'\n end",
"def cache_store(key, value, options = {})\n nkey = namespaced(key)\n\n # Get the time after which the cache should be expired\n if options[:ttl]\n ttl = options[:ttl]\n else\n ttl = Ramaze::Cache::Sequel.options[:ttl]\n end\n\n expires = Time.now + ttl if ttl\n\n # The row already exists, update it.\n if @dataset.filter(:key => nkey).count == 1\n serialized_value = serialize(value)\n\n if serialized_value\n @dataset.filter(:key => nkey) \\\n .update(:value => serialize(value), :expires => expires)\n end\n # The row doesn't exist yet.\n else\n serialized_value = serialize(value)\n\n if serialized_value\n @dataset.insert(\n :key => nkey, :value => serialize(value), :expires => expires\n )\n end\n end\n\n # Try to deserialize the value. If this fails we'll return a different\n # value\n deserialized = deserialize(@dataset.select(:value) \\\n .filter(:key => nkey) \\\n .limit(1).first[:value])\n\n if deserialized\n return deserialized\n else\n return value\n end\n end",
"def store(value, *key)\n @cache[key] = value\n end",
"def cache( name, value, created_on )\n meter = Meter.new( :name => name, :value => value, :created_on => created_on, :created_at => Time.now )\n store( name, meter )\n end",
"def cache_store(key, value, options = {})\n options[:expires] = options.delete(:ttl) || @options[:expires_in]\n @moneta.store(key, value, options)\n end",
"def cache_write(value, key: cache_key, **)\n Rails.cache.write(key, value, namespace: namespace) if validate_key(key)\n end",
"def cache_store(key, value, options = {})\n key = namespaced(key)\n ttl = options[:ttl] rescue nil\n expires = Time.now + ttl if !ttl.nil?\n record = @store[:key => key]\n\n # Figure out if the record is new or already exists\n if !record\n record = @store.create(:key => key, :value => value, :expires => expires)\n record.value\n else\n record = record.update(:value => value, :expires => expires)\n record.value\n end\n end",
"def set(key, value, mtime)\n @cache[key] = {\n value: value,\n mtime: mtime\n }\n end",
"def set key, force=nil, &block\n return if (!force) && cache.include?(key)\n cache_val, store_val = block.call()\n return unless cache_val\n cache.set_nr key, cache_val # update cache\n store << store_val # save value\n self.misses += 1 # track the cache miss\n store_val\n end",
"def cache(name, value)\n @cache = {} if @cache.nil?\n @cache[name] = value\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def update_cache(obj)\n save_cache(obj)\n end",
"def get(key)\n return -1 unless @cache.key?(key)\n val = @cache[key]\n @cache.delete(key)\n @cache[key] = val\n val\n end",
"def move_to_cache\r\n true\r\n end",
"def put(key, value)\n if @table[key].nil?\n insert_into_cache(key, value)\n else\n update_cache(key, value)\n end\n end",
"def cache(data); end",
"def cache_store(key, value, options = {})\n ttl = options[:ttl] || @options[:expires_in]\n\n @client.setex(key, ttl, ::Marshal.dump(value))\n\n return value\n end",
"def store(value, *args)\n return @provider.store(value, *args) if [email protected]?\n @cache[args] = value\n end",
"def update_cache\n return '' if disabled?\n\n key = \"#{identity_cache_key}:#{short_sha1}:#{Time.now.to_f}\"\n ArCache.write(identity_cache_key, key, raw: true, expires_in: 20.years)\n key\n end",
"def update (url, response, timestamp)\n \n @semaphor.synchronize(){||\n if @cache.has_key?(url)\n # then this url is already in the cache and we simply update the timestamp\n new_entry = CacheEntry.new(url, response, timestamp)\n @cache[url] = new_entry\n else\n new_entry = CacheEntry.new(url, response, timestamp)\n # ensure that this object is not too large\n return if new_entry.response.bytesize() > max_object_size \n # remove items from the cache until this new entry fits.\n while @current_load + new_entry.response.bytesize() > max_load do\n evict()\n end\n @current_load = @current_load + new_entry.response.bytesize()\n @cache[url] = new_entry\n end\n }\n end",
"def save(key, value)\n storage.transaction {storage[key] = value}\n end",
"def move_to_cache\n true\n end",
"def cache_value(cache_key, value)\n @cached_values[cache_key] = value\n @cached_values\n end",
"def write_rl(key, value)\n $redis_cache_rl.set(key, value)\n $redis_cache_rl.expire(key, 24.hours.to_i) if value == 1\n true\n rescue => exc\n @logger.error { \"REDIS-ERROR: write: K: #{key}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end",
"def cached?; end",
"def expire!\n self.last_retrieved = Time.mktime(1970).gmtime\n self.save\n end",
"def put(key, value)\n \treturn if @capacity.zero?\n if @cache.key?(key) || [email protected]?(key) && @cache.size < @capacity\n @cache[key] = value\n @frequency[key] += 1\n i = @frequency[key]\n if i == 1 # a new item\n @rentused[1] = { key => nil } if @rentused[1].nil?\n @rentused[1][key] = nil\n else\n @rentused[i - 1].delete(key)\n @rentused[i] = { key => nil } if @rentused[i].nil?\n @rentused[i][key] = nil\n end\n else\n 1.upto(100).each do |i|\n next unless !@rentused[i].nil? && !@rentused[i].empty?\n k = @rentused[i].keys.first\n @cache.delete(k)\n @frequency.delete(k)\n @rentused[i].delete(k)\n break\n end\n @cache[key] = value\n @frequency[key] = 1\n @rentused[1] = { key => nil } if @rentused[1].nil?\n @rentused[1][key] = nil\n # p @cache, @frequency, @rentused\n end\n end",
"def after_update(entry)\n expire_cache_for(entry)\n end",
"def last_retrieved=(new_last_retrieved)\n @last_retrieved = new_last_retrieved\n unless self.cache_object.nil?\n self.cache_object.last_retrieved = new_last_retrieved\n end\n end",
"def cache_set(key, data, from_now = nil)\n true\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\n true\n end",
"def cache_store; end",
"def cache_store; end",
"def store(key, value, opts = {})\n opts = {:ttl => opts} if opts.is_a?(Integer)\n @cache[\"#{@cache_name}:#{key}\"] = {\n :expires => opts[:ttl] ? Time.now + opts[:ttl].to_i : nil,\n :value => value\n }\n value\n end",
"def cache_set(k, v)\n synchronize{@cache[k] = v}\n end",
"def []=(key, val)\n @monitor.synchronize do\n expire!\n store(key, val)\n end\n end",
"def update_values(*args)\n cache_delete\n super\n end",
"def put(key, value)\n return if @cap <= 0\n fav = @c[key]\n if fav\n return\n end\n \n end",
"def invalidate\n @cache_version ||= 0\n @cache_version += 1\n end",
"def cache!\n @@cache\n end",
"def store(key, value, options = {})\n # todo What's the best way to run these two calls at once, given that it's very much one-at-a-time\n exp = options[:expires_in] ? (Time.now + options[:expires_in]) : nil\n @mongo_collection.update({ '_id' => key }, { '_id' => key, 'data' => value, 'expires' => exp }, { :upsert => true }) # upsert is the best technical term ever.\n \n unless options.has_key?(:bypass_memcache)\n args = [key, value, options[:expires_in] || @options[:memcache_default_expire]].compact\n @memcache.set(*args)\n end\n \n value\n end",
"def set(key, value)\n path = File.join(@root, \"#{key}.cache\")\n\n # Ensure directory exists\n FileUtils.mkdir_p File.dirname(path)\n\n # Check if cache exists before writing\n exists = File.exist?(path)\n\n # Serialize value\n marshaled = Marshal.dump(value)\n\n # Compress if larger than 4KB\n if marshaled.bytesize > 4 * 1024\n deflater = Zlib::Deflate.new(\n Zlib::BEST_COMPRESSION,\n Zlib::MAX_WBITS,\n Zlib::MAX_MEM_LEVEL,\n Zlib::DEFAULT_STRATEGY\n )\n deflater << marshaled\n raw = deflater.finish\n else\n raw = marshaled\n end\n\n # Write data\n PathUtils.atomic_write(path) do |f|\n f.write(raw)\n @size = size + f.size unless exists\n end\n\n # GC if necessary\n gc! if size > @max_size\n\n value\n end",
"def write(key, value, options = nil)\r\n super\r\n method = (options && options[:unless_exist]) ? :add : :set\r\n @cache.send(method, valid_key(key), value, expires_in(options), marshal?(options))\r\n true\r\n rescue Memcached::Error => e\r\n log_error(e)\r\n false\r\n end",
"def write(name, value, options = nil)\n # check :unless_exist option\n return nil if options && options[:unless_exist] && exist?(name)\n\n # create wrapper with expiry data\n wrapper = if options && options[:expires_in]\n { :value => value, :expires_at => expires_in(options).from_now }\n else\n { :value => value }\n end\n\n # call ActiveSupport::Cache::MemoryStore#write\n super(name, wrapper, options)\n end",
"def fetch!\n self.val = fetch\n self.last_updated = Time.zone.now\n self.save!\n end",
"def cache_store=(_arg0); end",
"def cache_store=(_arg0); end",
"def store_value(timestamp, key, value)\n # Prepend the timestamp so we always have unique values\n @redis.zadd(key, timestamp, \"#{timestamp}:#{value}\")\n end",
"def flush_cache; end",
"def store(key, value)\n\t\t\tused_key = key \n\t\t\twhile File.exists?(key_to_path(used_key))\n\t\t\t\tif fetch(used_key) == value\n\t\t\t\t\tFileUtils.touch(key_to_path(used_key))\n\t\t\t\t\treturn used_key # Already exists. Do not store again.\n\t\t\t\tend\n\t\t\t\tused_key = Soil.digest_class.digest(key)\n\t\t\tend\n\t\t\tfile_path = key_to_path(used_key)\n\n\t\t\tFileUtils.mkpath(file_path.dirname)\n\t\t\tFile.open(file_path, 'w') do |f|\n\t\t\t\tf.write(Zlib::Deflate.deflate value)\n\t\t\tend\n\t\t\treturn used_key\n\t\tend",
"def escribe_cache\n Rails.cache.write(\"cache_service_#{id}\", true, :expires_in => 1.week)\n end",
"def update_cache\n\t\tself.species_count = self.species.count(:conditions => ['species.change_id IS NULL'])\n\t\tself.save!\n\tend",
"def set(key, value)\n @cache[key] = value\n end",
"def rebuildCacheFor( ticket )\n\t\tpos = @cache_for_id[ ticket.idstring ]\n\t\tif pos \n\t\t\t@cache[ pos ] = ticket\n\t\t\t@updated = true\n\t\t\tsave\n\t\telse \n\t\t\trebuildCache\n\t\tend\n\tend",
"def autorestore; end",
"def store(key, value)\n @threshold_key ||= key\n\n if has_key?key\n fetch(key) << value\n else\n if size >= @maxkeys\n return value if compare_to_threshold(key)\n delete(@threshold_key)\n adjust_threshold\n end\n super_store(key, [ value ])\n @threshold_key = key if compare_to_threshold(key)\n end\n\n value\n end",
"def test_increment_existing_numeric\n @cache.add('Key', '100', 0, Time.now.to_i + 60)\n result = @cache.increment('Key', '1')\n cache = @cache.get('Key').args\n\n assert_true result.success\n assert_equal 'STORED', result.message.chomp.split(\"\\s\")[0]\n assert_equal 101, cache.data\n end",
"def save(key, data)\n self.ready\n \n unless @validId.nil?\n\t\t\t\traise SwapDmi::CacheSaveError.new(key) unless self.instance_exec(key, &@validId)\n end\n \n self.evict(key) if @evictWhen[:save]\n self.instance_exec(key, data, &@save)\n self\n end",
"def escribe_cache(recurso, tiempo = 1.day)\n Rails.cache.write(\"#{recurso}_#{id}\", :expires_in => eval(tiempo).to_f, :created_at => Time.now.to_f)\n end",
"def write(key, value, ttl = 0, marshaling = true)\n Rails.cache.write(key, value, {expires_in: get_ttl(ttl), raw: !marshaling})\n nil\n rescue => exc\n Rails.logger.error { \"MEMCACHE-ERROR: write: K: #{key}. M: #{exc.message}, I: #{exc.inspect}\" }\n nil\n end",
"def save_to_redis(key, value, time=1209600)\n $redis.with do |conn|\n conn.set key, value\n conn.expire key, time\n end\nend",
"def cache_set(key, data, from_now = nil)\n _expire = from_now ? from_now.minutes.from_now : nil\n cache_write(key, [data, _expire])\n Merb.logger.info(\"cache: set (#{key})\")\n true\n end",
"def after_create(entry)\n expire_cache_for(entry)\n end",
"def save_tracker_cache\n # These values should only be written if the audit has been successful!!\n # Best to write it back to a new file - then move the new file to the\n # original location (overwriting the original)\n return if @parent.ret_val == 3\n tracker_file = get_tracker_filename\n File.open(tracker_file + \".temp\", 'w') { |f|\n # First, save the initial timestamp and the current SOA serial\n f.puts(@initial_timestamp.to_s)\n f.puts(@last_soa_serial.to_s)\n # Now save the cache!!\n Status.strings.each {|s|\n status = s.downcase\n eval \"@cache.#{status}.each {|key, time|\n write_key_to_file(f, key.to_s, status, time[0], time[1])\n }\".untaint\n }\n\n }\n # Now move the .temp file over the original\n File.delete(tracker_file)\n File.rename(tracker_file+\".temp\", tracker_file)\n end",
"def cache_write(key, data)\n @mutex.synchronize do\n @cache[key] = data\n end\n end",
"def flush!\n @_cache = {}\n end",
"def expire_cache(key)\n end",
"def set key, value\n @reverse_cache[value.object_id] = key\n @cache[key] = value.object_id\n ObjectSpace.define_finalizer(value, @finalize)\n end",
"def []= string, value\n return value unless @cache_on\n @mutex.synchronize { @cache[string] = value }\n end",
"def put(name, value, time)\n last_time, last_value = last(name) # TODO cahe it, cache it hard\n is_newest = last_time.nil? || (time > last_time)\n\n key = get_key name\n # get_key with type provided creates key if it doesn't exist\n # so we hit db two times for put for new key, that sucks but not as much as some other things (low prior)\n key = get_key name, guess_key_type(value) unless key\n\n bump_uptime(name, key) if key[:type] == 'uptime' && value == true && is_newest # TODO move when we have key type classes\n\n if key[:opts][:same_value_resolution] && last_time && time > last_time\n if last_value == value\n return false if (time - last_time) < key[:opts][:same_value_resolution]\n end\n end\n\n values = { key_id: key[:id], value: value, time: time }\n\n if key[:type] == 'numeric'\n values.delete :value\n values.merge!(value_avg: value, value_count: 1, value_max: value, value_min: value)\n end\n\n @db[ type_table(key[:type]) ].insert values\n\n # notify about the change\n # IMPROVE THREADS - with multiple thread last_time may be unreliable and may cause notification not to fire in some rare special case (I guess)\n if @change_notifications[name] && is_newest && (last_value != value)\n notify_change name, [last_time, last_value], [time, value]\n end\n\n return true\n end",
"def redis_save(src, dst, eta)\n @redis.set redis_key(src, dst), eta\n end",
"def update_cache\n if $redis.set(\"#{self.class.table_name}/#{self.id}\", self.to_json) == \"OK\"\n true\n else\n false\n end\n end",
"def put(key, value)\n node = @cache[key]\n if node.nil?\n if(@size >= @capacity)\n tail = pop_tail()\n @cache.delete(tail.key)\n @size -= 1\n end\n newNode = DLinkedNode.new\n newNode.key = key\n newNode.value = value\n \n @cache[key] = newNode\n add_node(newNode)\n \n @size += 1\n else\n node.value = value\n move_to_head(node)\n end\n end",
"def cache=(_arg0); end",
"def cache=(_arg0); end"
] | [
"0.7240398",
"0.72047436",
"0.72047436",
"0.6981877",
"0.68131745",
"0.68063784",
"0.6657292",
"0.6646581",
"0.6611423",
"0.6610272",
"0.6516248",
"0.6514823",
"0.64915466",
"0.64804405",
"0.6474109",
"0.64461297",
"0.6442895",
"0.6440132",
"0.6377433",
"0.63764703",
"0.63625205",
"0.63548154",
"0.6341874",
"0.631232",
"0.6302987",
"0.62713015",
"0.6270296",
"0.62651056",
"0.6258625",
"0.6258625",
"0.6258625",
"0.6258625",
"0.6258625",
"0.6258625",
"0.6258625",
"0.62474835",
"0.62337667",
"0.6232033",
"0.6231611",
"0.62304264",
"0.6216114",
"0.621478",
"0.6200099",
"0.6191866",
"0.6171611",
"0.6166378",
"0.6153396",
"0.61462736",
"0.61451596",
"0.6143655",
"0.61328644",
"0.6128271",
"0.611598",
"0.6115337",
"0.6098153",
"0.6098153",
"0.6098153",
"0.60796547",
"0.60796547",
"0.6068087",
"0.60674477",
"0.6065689",
"0.60554576",
"0.6050707",
"0.60489744",
"0.6045818",
"0.6040887",
"0.60399705",
"0.60377675",
"0.6029723",
"0.60253704",
"0.60188854",
"0.60188854",
"0.60185045",
"0.6014156",
"0.6013746",
"0.599616",
"0.5989421",
"0.5983547",
"0.59795165",
"0.5945645",
"0.5940589",
"0.59360266",
"0.5934547",
"0.5929821",
"0.59208065",
"0.59100354",
"0.59097177",
"0.5901606",
"0.59013903",
"0.58911055",
"0.58886755",
"0.5877113",
"0.58757067",
"0.58633655",
"0.5861722",
"0.58551073",
"0.5854509",
"0.5854199",
"0.58497757",
"0.58497757"
] | 0.0 | -1 |
I worked on this challenge Julia Giraldi (and Laura Crowe during office hours). | def factorial(number)
if number == 0
return 1
end
product = 1
for number in (1..number)
product = product * number
end
return product
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"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 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 solution4(input)\n end",
"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 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 solve( n = 16 )\n max = 0\n \n (1..10).each do |a|\n (1..10).each do |b|\n next if b == a\n (1..10).each do |c|\n next if c == b || c == a\n (1..10).each do |d|\n next if d == c || d == b || d == a\n (1..10).each do |e|\n next if e == d || e == c || e == b || e == a\n\n rotate = 3*[a, b, c, d, e].each_with_index.min[1]\n (1..10).each do |f|\n next if f == e || f == d || f == c || f == b || f == a\n (1..10).each do |g|\n next if g == f || g == e || g == d || g == c || g == b || g == a\n \n t = a + f + g\n (1..10).each do |h|\n next if h == g || h == f || h == e || h == d || h == c || h == b || h == a\n next unless t == b + g + h\n\n (1..10).each do |i|\n next if i == h || i == g || i == f || i == e || i == d || i == c || i == b || i == a\n next unless t == c + h + i\n\n (1..10).each do |j|\n next if j == i || j == h || j == g || j == f || j == e || j == d || j == c || j == b || j == a\n next unless t == d + i + j && t == e + j + f\n\n s = [a, f, g, b, g, h, c, h, i, d, i, j, e, j, f]\n rotate.times {s.push s.shift}\n\n s = s.join\n next if n != s.length\n\n max = [max, s.to_i].max\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n max\n end",
"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 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\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 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 problem18(r) \n h = r.length\n sum = 0\n for i in 0..h-1 \n \n end\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 solve_zero_vs_six_vs_nine\n return if @arr[1].nil? || @arr[4].nil?\n\n #p \"1,4: #{@arr[1]},#{@arr[4]}\"\n\n @words.filter{|x| x.length == 6 && @hash[x].nil?}.each{|w|\n if @arr[4].chars.all?{|c| w.chars.include?(c)}\n solved(9, w)\n elsif @arr[1].chars.all?{|c2| w.chars.include?(c2)}\n solved(0, w)\n else\n solved(6, w)\n end\n }\n end",
"def 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 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 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 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 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 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 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 alg; end",
"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 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\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend",
"def solve_two_vs_three_vs_five\n return if @arr[1].nil? || @arr[6].nil?\n\n #p \"1,6: #{@arr[1]},#{@arr[6]}\"\n\n @words.filter{|x| x.length == 5 && @hash[x].nil?}.each{|w|\n if @arr[1].chars.all?{|c| w.chars.include?(c)}\n solved(3, w)\n elsif w.chars.all?{|c2| @arr[6].chars.include?(c2)}\n solved(5, w)\n else\n solved(2, w)\n end\n }\n end",
"def pythag_two()\n\ta = 1\n\tb = 2\n\tc = 1\n\tlist = []\n\tdora_will_be_a_good_doctor = []\n\twhile a <= 1000\n\t\tb = 1\n\t\twhile b <= 1000\n\t\t\ttemp_c = a**2 + b**2\n\t\t\t# dora_will_be_a_good_doctor << [a**2,b**2,temp_c]\n\t\t\t# p \"#{a},#{b},#{temp_c**0.5}\"\n\t\t\tif integerizer(temp_c**0.5) == true && summer([a,b,temp_c**0.5]) <= 1000\n\t\t\t\tdora_will_be_a_good_doctor << [a,b,temp_c**0.5].sort\n\t\t\tend\n\t\t\tb += 1\n\t\tend\n\t\ta += 1\n\tend\n\t# dora_will_be_a_good_doctor.each do |mowingdora_2|\n\t# \tif summer(mowingdora_2) <= 1000**2\n\t# \t\tlist << mowingdora_2\n\t# \tend\n\t# end\n\t# list.each do |mowingdora|\n\t# \tp mowingdora\n\t# \tif mowingdora[0]**2 + mowingdora[1]**2 == mowingdora[2] #&& integerizer((mowingdora[2]**0.5)) == true\n\t# \t\tdora_will_be_a_good_doctor << [mowingdora[0], mowingdora[1], mowingdora[2]**0.5]\n\t# \tend\n\t# end\n\t# p list\n\treturn dora_will_be_a_good_doctor\n\t# p list\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 translate(a)\n\tvoyel = [\"a\",\"e\",\"i\",\"o\",\"u\"]\ncheck = 0\nn = 0\nx = a \n words = a.split(/\\W+/)\n words.each do |a|\n\tok = voyel.include?(a[0])\n\tif ok == true \n\t\ta = a + \"ay\"\n\t\treturn a \n\tend\n while check <= 4\n\tb = a.slice(0..check)\n\n\tcheck = check + 1\n \n\tok = voyel.include?(x[check])\n\ttest1 = \"qu\".include?(x[check])\n\tif test1 == true \n\t\tif check == 1\n\t\t\tb = a.slice(0..check)\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[2..-1]\n\t elsif check == 2\n\t \tb = a.slice(1..check)\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[4..-1]\n\t end\n\tend\n\n\tif ok == true \n\t\tif check == 1\n\t\t\ta = a + b + \"ay\"\n\t\treturn a[1..-1]\n\t elsif check == 2\n\t \t\ta = a + b + \"ay\"\n\t \treturn a[2..-1]\n\t elsif check == 3 \n\t \t\ta = a + b + \"ay\"\n\t \treturn a[3..-1]\n\t end\n\tend\nend\nend\nend",
"def 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 gxfw\n numSeed = 2500\n pentagonalNumbers = arrPentagonalNumberListInt numSeed\n\n # Goes through every number and checks if it's in the list\n numSeed.times do |i|\n i.times do |j|\n uppernum = pentagonalNumbers[i]\n lowernum = pentagonalNumbers[j]\n if pentagonalNumbers.include?(uppernum - lowernum) and pentagonalNumbers.include?(uppernum + lowernum)\n p uppernum-lowernum\n end\n end\n end\nend",
"def challenge; end",
"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 return 0 unless a[0]\n necklaces = create_necklaces(a)\n \n \n size = necklaces.length\n index = 0\n max = necklaces[index].length\n \n while index < size\n if necklaces[index].length > max\n max = necklaces[index].length\n end\n index += 1\n end\n \n return max\nend",
"def problem_108(size = 1001)\n func = lambda do |a|\n if a.length == 1\n a[0]+1\n else\n m = a[0]\n (2*m+1) * func.call(a[1,a.length]) -m\n end\n end\n\n primes = Primes.upto(200)\n prime_number = lambda do |a|\n r = 1\n a.sort.reverse.each_with_index { |m,i| r *= primes[i] ** m }\n r\n end\n\n values = {}\n last = 0\n 1.upto(100).each do |nn|\n nn.groupings do |a|\n sols = func.call a\n ans = prime_number.call a\n# puts \"np=#{nn} sols=#{sols} ans=#{ans} => #{a.inspect}\"\n if values[sols]\n values[sols] = [values[sols],[ans,a]].min\n else\n values[sols] = [ans,a]\n end\n true\n end\n size.upto(size*5/4) do |num|\n if values[num]\n puts \"for np = #{nn} => #{num} => #{values[num].inspect}\"\n if last == values[num]\n puts \"factors = #{values[num][0].factors}\"\n return values[num][0] \n end\n last = values[num]\n break\n end\n end\n #values.sort.each do |k,v|\n # puts \"#{k} => #{v}\"\n #end\n end\n nil\nend",
"def problem_106a\n combin = lambda { |m,h| m.factorial / (h.factorial * (m - h).factorial) }\n max = 20\n\n sum = Array.new(max+1,-1)\n 1.upto(max) do |n|\n 0.upto(n/2) do |k|\n sum[n] += combin.call(n,2*k) * combin.call(2*k - 1, k + 1)\n end\n puts \"#{n} #{sum[n]}\"\n end\n sum[12]\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 solution(number)\n str = '' \n\n ROMAN_DIC.each_with_index do |dic, index|\n if number > 5\n if index > 0 && index < ROMAN_DIC.size - 1 && (number > (dic[0] + (ROMAN_DIC[index + 1][0] * 3)))\n str = str + ROMAN_DIC[index + 1][1] + ROMAN_DIC[index - 1][1]\n number = number - (ROMAN_DIC[index - 1][0] - ROMAN_DIC[index + 1][0])\n end \n else\n if index > 0 && index < ROMAN_DIC.size - 1 && (number > (ROMAN_DIC[index + 1][0] * 3))\n str = str + ROMAN_DIC[index + 1][1] + dic[1]\n number = number - (ROMAN_DIC[index + 1][0] + dic[0])\n end\n end \n\n while number >= dic[0]\n str = str + dic[1]\n number = number - dic[0]\n end \n end \n\n str\nend",
"def solve(s)\n s.split(/[aeiou]/).map{ |x| x.sum - x.size * 96 }.max\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 accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end",
"def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\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 problem_104\n all = [\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"]\n k = 2\n low_fn0,low_fn1 = 1,1\n hi_fn0,hi_fn1 = 1,1\n loop do\n k += 1\n low_fn0,low_fn1 =(low_fn0 + low_fn1) % 10_000_000_000, low_fn0\n hi_fn0, hi_fn1 = hi_fn0 + hi_fn1, hi_fn0\n if hi_fn0 > 1_000_000_000_000_000_000\n hi_fn0 /= 10\n hi_fn1 /= 10\n end\n front = false\n next unless k > 300\n hi = hi_fn0.to_s[0,9].split(//)\n if (hi & all).length == 9\n puts \"front #{k}\" \n front = true\n end\n if (low = low_fn0.to_s).length >= 9\n low = low[-9,9].split(//)\n if (low & all).length == 9\n puts \"back #{k}\" \n return k if front\n end\n end\n end\nend",
"def f_1_4tel_rek(n)\r\n if !n.integer? || n < 1\r\n return false\r\n end\r\n\r\n def end_rek(i, s)\r\n if i > 0\r\n end_rek(i - 1, (1.0 / (i * (i + 1.0) * (i + 2.0))) + s)\r\n else\r\n return s\r\n end\r\n end\r\n return end_rek(n, 0)\r\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(s, p, q)\n counts = [nil, [0], [0], [0], [0]]\n factors = s.split(//).map do |nu|\n case nu\n when 'A'\n 1\n when 'C'\n 2\n when 'G'\n 3\n when 'T'\n 4\n end\n end\n for i in (1..factors.length)\n fa = factors[i - 1]\n for j in [1, 2, 3, 4]\n counts[j][i] = counts[j][i - 1]\n end\n counts[fa][i] += 1\n end\n \n (0..p.count - 1).map { |k|\n if p[k] == q[k]\n factors[p[k]]\n else\n [1, 2, 3, 4].index do |i|\n counts[i][q[k] + 1] - counts[i][p[k]] > 0\n end + 1\n end\n }\nend",
"def solve(s)\n answer = \"\"\n arr = s.split('')\n hash = Hash.new(0)\n arr.each_with_index do |el, idx|\n if el.to_i >= 1\n if arr[idx + 1] == \"(\"\n el.to_i.times do \n if arr[idx + 2].to_i >= 1\n if arr[idx + 3] == \"(\"\n arr[idx + 2].to_i.times do \n answer += (arr[(idx + 4)...arr.index(\")\")].join(''))\n end\n end\n end\n answer += (arr[(idx + 2)...arr.index(\")\")].join(''))\n end\n \n # hash[arr[idx + 1]] += 1\n end\n end\n \n end\n return answer\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 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)\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 problem_108a\n i = 4\n max = 0\n solve = {}\n loop do\n num = 0\n a = Rational(1,i)\n 2.upto(i*2+1) do |j|\n if (a - Rational(1,j)).numerator == 1\n num += 1 \n# puts \"(#{a} - #{Rational(1,j)} == #{a - Rational(1,j)}\"\n end\n end\n\n solve[num] = [] unless solve[num]\n solve[num] << i.factors\n\n if num >= max\n puts \"####################################\"\n solve.each_key.sort.each do |k|\n s = solve[k].map do |v|\n h = {}\n v.each {|a| h[a] = (h[a] || 0) + 1 }\n h.values.sort.flatten\n end.uniq.sort\n puts \"k = #{k} groups: #{s.inspect}\"\n# puts solve[k].inspect\n end\n puts \"#{i} = #{num} #{i.factors} #{i.factors.length + i.divisors.length}\" \n max = num\n end\n break if num > 1000\n i += 1\n end\n i\nend",
"def solve(input)\n data = input.chars\n buckets = []\n current = []\n data.each_with_index do |c, i|\n n = data[i + 1]\n current << c\n unless n == c\n buckets << current\n current = []\n end\n break if n.nil?\n end\n\n ret = ''\n buckets.each do |b|\n ret += b.count.to_s\n ret += b.first\n end\n ret\nend",
"def minimumBribes(q)\n bribe_count = 0\n # q.each_with_index do |person,i|\n i = q.size-1\n while i >= 0 do\n person = q[i]\n position = i+1\n offset = person - position\n\n if offset > 2\n puts \"Too chaotic\"\n return\n else\n j=[0,person-2].max\n while j < i do\n if q[j] > person\n bribe_count += 1\n else\n # break if j+1 == person\n end\n j+=1\n end\n end\n i-=1\n end\n puts bribe_count\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 solve\n return ((1..40).inject(:*) / ((1..20).inject(:*) ** 2))\nend",
"def p206\n re = /1.2.3.4.5.6.7.8.9.0/\n max = Math.sqrt(1929394959697989990).floor\n\n # Round since only squares of multiples of 30 and 70 end with 9_0 (e.g. 900)\n i = round_up Math.sqrt(1020304050607080900).floor, 100\n while i < max\n p30 = (i+30) ** 2\n p70 = (i+70) ** 2\n\n if re === \"#{p30}\"\n return \"#{i+30}^2 = #{p30}\"\n elsif re === \"#{p70}\"\n return \"#{i+70}^2 = #{p70}\"\n end\n\n i += 100\n end\nend",
"def solution(number)\n\nm, r_1 = number.divmod(1000)\ncd, r_2 = r_1.divmod(100)\nlx, r_3 = r_2.divmod(10)\nvi, r_4 = r_3.divmod(1)\n\nroman = []\n\nm.times { roman << \"M\" }\n\nif cd <= 3\n\tcd.times { roman << \"C\" }\nelsif cd == 4\n\troman << \"CD\"\nelsif cd == 5\n\troman << \"D\"\nelsif cd > 5 && cd < 9\n\troman << \"D\"\n\t(cd - 5).times { roman << \"C\" }\nelsif cd == 9\n\troman << \"CM\"\nend\n\nif lx <= 3\n\tlx.times { roman << \"X\" }\nelsif lx == 4\n\troman << \"XL\"\nelsif lx == 5\n\troman << \"L\"\nelsif lx > 5 && lx < 9\n\troman << \"L\"\n\t(lx - 5).times { roman << \"X\" }\nelsif lx == 9\n\troman << \"XC\"\nend\n\nif vi <= 3\n\tvi.times { roman << \"I\" }\nelsif vi == 4\n\troman << \"IV\"\nelsif vi == 5\n\troman << \"V\"\nelsif vi > 5 && vi < 9\n\troman << \"V\"\n\t(vi - 5).times { roman << \"I\" }\nelsif vi == 9\n\troman << \"IX\"\nend\n\nroman.join\n\nend",
"def solution(n)\n n.to_s(2).reverse.to_i.to_s.split('1').map(&:length).max || 0\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 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 solution(n)\n n.to_s.split(//).inject(1) { |a,d| a + d.to_i }\nend",
"def solution\n 971 * (-61)\nend",
"def sol inp\n k, ins = inp.split(' ',2)\n k = k.to_i\n ps, pr, pi, pu, pw, pd, pl = ins.split.map(&:to_f)\n\n @ps = ps\n @pr = pr\n @pu = pu\n @pw = pw\n @pd = pd\n @pl = pl\n\n #\n # required_wins = 2\n # # winning 1st set\n # first_set = ps*pi + pr*(1-pi)\n # # winning 2nd set\n # first_set * winning_another_set + (1-first_set)*winning_another_set\n #\n # required_wins.times do |i|\n # count = 0\n # while count <= i\n # wins[i] = win_scene(pi,ps,pr, count)\n # count+=1\n # break if count == i\n # lose_scene(pi,ps,pr, pr,count)\n # end\n # end\n\n # winning second set after winning first + winning second set after winning one\n # wins[0]*win_scene(pi,ps,pr) + (1-wins[0])*lose_scene(pi,ps,pr)\n\n def win_scene(pi,round,required_wins,current_wins)\n return 0 if round >= required_wins\n # puts \"w #{' '*round},#{required_wins},#{current_wins})\"\n sunny = (round == 0) ? pi : (pi+(@pu*@pw))\n sunny = 1.0 if sunny > 1\n sunny = 0.0 if sunny < 0\n chance = sunny*@ps + (1-sunny)*@pr\n binding.pry if chance > 1\n\n if required_wins == current_wins+1\n chance\n else\n # return 0 if round > 100\n return 0 if (10**7*chance).to_i < 1\n wins = win_scene(sunny,round+1,required_wins,current_wins+1)\n # lose = lose_scene(sunny,round+1,required_wins,current_wins+1)\n chance * (wins)#+ (1-chance)*lose\n end\n end\n\n def lose_scene(pi,round,required_wins,current_wins)\n return 0 if round >= required_wins\n # puts \"l #{' '*round},#{required_wins},#{current_wins})\"\n sunny = (round == 0) ? pi : (pi-(@pd*@pl))\n sunny = 1.0 if sunny > 1\n sunny = 0.0 if sunny < 0\n chance = sunny*@ps + (1-sunny)*@pr\n binding.pry if chance > 1\n\n if required_wins == current_wins\n chance\n else\n # return 0 if round > 100\n return 0 if (10**7*chance).to_i < 1\n wins = win_scene(sunny,round+1,required_wins,current_wins+1)\n # lose = lose_scene(sunny,round+1,required_wins,current_wins+1)\n chance * (wins) #+ (1-chance)*lose\n end\n end\n\n # a = win_scene(pi,0,1,0)\n b = win_scene(pi,0,k,0)\n c = lose_scene(pi,0,k,0)\n # c = (k > 1) ? lose_scene(pi,1,k,0) : 0\n\n puts b\n puts c\n b +c\n # wtf?\n # 0.4* win_scene(pi,0,k,0)+ (1-0.6)*lose_scene(pi,0,k,0)\n\n# def smth(pi, ps, pr, setcount=0)\n# arr[1] = arr[0]\n# end\n# # set 2+ ?\n# set2 = ((ps+pu)*pw + ps*(1-pw))*pi\n# (1-set1)*((ps-pd)*pl + ps*(1-pl))\n# if k > 1\n# (k-1).times do\n#\n# end\n# end\nend",
"def luhns(a)\n\tb = a.to_s[0..-2].reverse.split(\"\").to_a.map{|v|v.to_i}\n\t(b.each_index{|i|i.even? ? b[i]=b[i]*2>9?b[i]*2-9:b[i]*2:i=i}.inject(:+)+a)%10==0\nend",
"def 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(s, p, q)\n result = []\n\n (0..p.size-1).each do |idx|\n buff = s[p[idx]..q[idx]]\n if buff.index('A')\n result << 1\n elsif buff.index('C')\n result << 2\n elsif buff.index('G')\n result << 3\n else\n result << 4\n end\n end\n\n return result\nend",
"def scoobydoo(villian, villians)\n letters = ('a'..'z').to_a\n numbers = (0..25).to_a\n letters_to_numbers = letters.zip(numbers).to_h\n numbers_to_letters = numbers.zip(letters).to_h\n\n villians_downcase = villians.map { |v| v.downcase.delete(' ') }\n villians_hash = (villians_downcase).zip(villians).to_h\n\n s = villian.reverse.chars.rotate(5)\n new = []\n (0...s.size).each do |i|\n if i.even?\n new[i] = s[i]\n else\n num = (letters_to_numbers.fetch(s[i]) + 5) % 26\n new[i] = numbers_to_letters.fetch(num)\n end\n end\n\n villians_hash.fetch(new.join)\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 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 problem_78\n n = 1\n p_cache = [1]\n\n generate = lambda do |k|\n ret = 0\n sign = 0\n Integer.generalized_pentagonals do |gp|\n if k < gp\n false # Need to exit ruby1.8, can't break...\n else\n if sign >= 0\n ret += p_cache[k-gp]\n else\n ret -= p_cache[k-gp]\n end\n sign += (sign == 1) ? -3 : 1 # 4 states + + - -\n end\n end\n p_cache[k] = ret % 100_000_000\n ret\n end\n\n p = 1\n loop do\n r = generate.call(p)\n# puts \"#{p} #{generate.call(p)}\"\n break if r % 1_000_000 == 0\n p += 1\n end\n p\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 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 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 solution(n)\n\t(1..n).map(&:to_s).map(&:chars).join.chars.map(&:to_i).reduce(:+)\nend",
"def solve\n perms = (1..9).to_a.permutation.map {|p| p.join}\n prods = []\n\n perms.each do |p|\n (1..2).each do |len|\n a, b, c = p[0, len].to_i, p[len..4].to_i, p[5, 4].to_i\n prods << c if a * b == c\n end\n end\n \n prods.uniq.reduce( :+ )\n end",
"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 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 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 recursive_solution\n\n end",
"def first_loop(letters)\n 0.upto(letters.length-1) do |idx1|\n (idx1+4).step(letters.length-1,2) do |idx2|\n return [idx1,idx2] if letters[idx1].casecmp(letters[idx2])==0\n end\n end\n nil\nend",
"def solution(x, y, d)\r\n # write your code in Ruby 2.2\r\n i=1\r\n loop do\r\n s=x+i*d\r\n \r\n break if(s>=y)\r\n \r\n i+=1\r\n end \r\n i\r\nend",
"def solution4(a)\n left = 0\n right = a.size - 1\n distinct = 0\n\n while left <= right\n # puts \"left: #{left}, right: #{right}\"\n # puts \"a[l]: #{a[left]}, a[r]: #{a[right]}\"\n # puts \"distinct: #{distinct}\"\n if a[left].abs > a[right].abs\n begin\n left += 1\n end until a[left] != a[left - 1]\n elsif a[left].abs < a[right].abs\n begin\n right -= 1\n end until a[right] != a[right + 1]\n else\n begin\n left += 1\n end until a[left] != a[left - 1]\n begin\n right -= 1\n end until a[right] != a[right + 1] \n end\n\n distinct += 1\n end\n distinct\nend",
"def solve\n 1.upto(100).inject(:*).to_s.split('').map{|x| x.to_i}.inject(:+)\nend",
"def euler020\n def fact(x)\n ans = x.downto(1).reduce(:*)\n end\n fact(100).to_s.split('').map { |x| x.to_i}.reduce(:+)\nend",
"def solution2(a)\n\n counts = Hash.new(0)\n\n a.each do |int|\n counts[int] += 1\n end\n\n non_divisors = []\n\n a.each do |int|\n div_count = 0\n for i in 1..int do\n div_count += counts[i] if int % i == 0\n end\n non_divisors << a.length - div_count\n end\n\n non_divisors\n\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 problem_four\n max = 0\n\n 100.upto(999).each do |a|\n a.upto(999).each do |b|\n max = a * b if palindrome?(a * b) && (a * b) > max\n end\n end\n\n max\n end",
"def solution(a)\n return 0 if a.length < 3\n a.sort.each_cons(3) { |e| return 1 if e[0] + e[1] > e[2] }\n return 0\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 x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend",
"def minimumBribes(q)\n cont = 0\n for i in (q.size-1).downto(2)\n #p \" (#{i}) ==> #{q}\"\n if !v(q,i)\n cont = \"Too chaotic\"\n break\n elsif q[i]-1 != i\n if q[i-1]-1 == i \n aux = q[i]\n q[i] = q[i-1]\n q[i-1] = aux\n else\n aux = q[i]\n q[i] = q[i-2]\n q[i-2] = q[i-1]\n q[i-1] = aux\n cont += 1 \n end\n cont += 1 \n end\n end\n printf \"%s\\n\", q[0] != 1 && cont != \"Too chaotic\" ? cont+1 : cont\nend",
"def solve(s)\n alphabet = ('a'..'z').to_a\n s.gsub(/[aeiou]/, ' ').split.map { |l| l.chars.map { |i| alphabet.index(i) + 1 }.sum }.max\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 pe52(startAt, endAt)\n (startAt..endAt).step(6).each do |x|\n bNum = x/6\n bNumCSort = bNum.to_s.chars.sort\n next if bNumCSort != x.to_s.chars.sort\n next if bNumCSort != (bNum*5).to_s.chars.sort\n next if bNumCSort != (bNum*4).to_s.chars.sort\n next if bNumCSort != (bNum*3).to_s.chars.sort\n next if bNumCSort != (bNum*2).to_s.chars.sort\n return bNum\n end\n false\nend",
"def cantidadPrimosRango(rangoInicial, rangoFinal)\n contador = 0\n x = rangoInicial\n y = rangoFinal\n if x >= 4\n z = x - 1\n else\n z = x\n end\n for i in z..y\n if y % i == 0\n contador = contador + 1\n end\n end\n return contador\nend",
"def solution(a)\n numbers = a.sort\n (0..numbers.length-3).each do |index|\n triplet = numbers[index..index + 2]\n max_value = triplet.max\n sum = triplet.min(2).inject(&:+)\n\n return 1 if sum > max_value\n end\n\n 0\nend",
"def solution a\n a.sort!\n until a.empty?\n answer = a.pop\n return answer if a.pop != answer\n end\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 minimumBribes(q)\n i = q.length - 1\n bribes = 0\n while i >= 0\n #if a value is in a position greater than value - or + 3 it is chaotic\n if q[i] - i > 3\n return \"Too chaotic\"\n end\n\n j = 0 > q[i] - 2 ? 0 : (q[i] - 2)\n while j < i\n if (q[j] > q[i])\n bribes += 1\n end\n j += 1\n end\n i -= 1\n end\n bribes\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 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"
] | [
"0.69811946",
"0.6817478",
"0.66277355",
"0.6526303",
"0.6432947",
"0.6320236",
"0.6273108",
"0.6253722",
"0.62426543",
"0.6236635",
"0.6215046",
"0.621484",
"0.62128776",
"0.6205563",
"0.62034285",
"0.61860853",
"0.618547",
"0.61854297",
"0.61789405",
"0.61735773",
"0.6172048",
"0.61704916",
"0.6147846",
"0.6131894",
"0.61174595",
"0.610866",
"0.61053014",
"0.61039233",
"0.60989773",
"0.60967374",
"0.60931635",
"0.6086973",
"0.6078489",
"0.6069904",
"0.60645556",
"0.6062856",
"0.6057978",
"0.60398215",
"0.6038786",
"0.60364074",
"0.6033402",
"0.6024553",
"0.6011244",
"0.6008779",
"0.6006592",
"0.5990858",
"0.59859854",
"0.5979501",
"0.59777594",
"0.59736437",
"0.59730345",
"0.59659374",
"0.5957645",
"0.5957366",
"0.5953244",
"0.59495986",
"0.5947577",
"0.5947261",
"0.59415436",
"0.59376454",
"0.59372467",
"0.5936156",
"0.5933119",
"0.5932864",
"0.5932154",
"0.5929052",
"0.5926216",
"0.59237087",
"0.5922219",
"0.59174246",
"0.5913877",
"0.59035313",
"0.5901058",
"0.59009254",
"0.5897107",
"0.5892019",
"0.58843595",
"0.58744955",
"0.58738655",
"0.58727133",
"0.5872333",
"0.587184",
"0.5869974",
"0.58661115",
"0.5863424",
"0.58631724",
"0.58602685",
"0.58602333",
"0.585381",
"0.58510375",
"0.5848206",
"0.58460754",
"0.58454317",
"0.58451205",
"0.5844805",
"0.5841578",
"0.5840959",
"0.5840758",
"0.5835892",
"0.58328044",
"0.5832056"
] | 0.0 | -1 |
GET /contact GET /contact.json | def index
redirect_to new_contact_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @contact = Contact.find(params[:id])\n\n render json: @contact\n end",
"def show\n render json: @contact\n end",
"def show\n render json: @contact\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n #@contact = Contact.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n render json: @contact.address\n end",
"def show\n @contact_request = ContactRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_request }\n end\n end",
"def show\n @contactinfo = Contactinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contactinfo }\n end\n end",
"def index\n @contacts = Contact.all\n render json: @contacts\n end",
"def show\n @contact = Contact.find(params[:id])\n render :json => { :success => true, :message => \"Show Contacts\", :contact => @contact }\n # respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @contact }\n # end\n end",
"def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Entities::Profile::Contacts)\n end",
"def index\n @contacts = Contact.all\n render json: {status: 200, contacts: @contacts}\n end",
"def get_contacts(options = {})\n send_request(\"get\", contacts_url, body: options.to_json)\n end",
"def lookup\n respond_to do |format|\n format.json { render json: Crm::ContactLookup.new(view_context) }\n end\n end",
"def contact\n response[\"contact\"]\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n @site_contact = SiteContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_contact }\n end\n end",
"def show\n @crm_contact_info = CrmContactInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crm_contact_info }\n end\n end",
"def contact(contact, options = {})\n get(\"contacts/#{contact}\", options).pop\n end",
"def index\n @contact = current_user.contacts.find(params[:contact_id])\n @requests = @contact.requests\n\n respond_with @requests\n end",
"def show\n @breadcrumb = 'read'\n @corp_contact = CorpContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @corp_contact }\n end\n end",
"def index\n @contactable = find_contactable\n @contactos = @contactable.contactos\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @contactos }\n end\n end",
"def show\n @projectcontact = Projectcontact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projectcontact }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n contact = {}\n contact[:id] = @contact.id\n contact[:name] = @contact.name\n contact[:phone_number] = @contact.phone_number\n contact[:group_id] = @contact.group_id\n contact[:in_a_group] = [email protected]_id.nil?\n contact[:contact_type] = @contact.contact_type\n contact[:estate_name] = ([email protected]_id.nil?? Estate.find(@contact.estate_id).estate_name : nil)\n contact[:estate_number] = @contact.estate_number\n contact[:photo] = \"#{ENV['ROOT_URL']}#{@contact.photo.url}\"\n contact[:member_since] = \"#{@contact.created_at.strftime(\"%d/%m/%Y\")} #{@contact.created_at.strftime(\"%I:%M%p\")}\"\n\n render json: contact\n end",
"def show\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n\n respond_with @requests\n end",
"def show\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cust_contact }\n end\n end",
"def new\n @contact = current_user.contacts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def index\n json_response(@contacts, user_id: @user.id, status: :ok)\n end",
"def show\n @contactaction = Contactaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contactaction }\n end\n end",
"def new\n @contact = Contact.new\n @contact.user = current_user\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n \n \n end\n end",
"def show\n @contact = Contact.find(params[:id])\n \n respond_to do |format|\n format.html { render :layout => 'semi_static_dashboards' }\n format.json { render :json => @contact }\n end\n end",
"def show\n render json: @referral_contact\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @client_contact_hash }\n format.xml { render :xml => @client_contact_hash }\n end\n end",
"def show\n @contactable = find_contactable\n @contacto = @contactable.contactos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @contacto }\n end\n end",
"def show\n contact_shard = Facebase::Contact.shard_for(params[:id])\n @contact = contact_shard.where(\"profile_id = ? \", params[:id]).includes(:profile, :events, :emails).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n @contact_action = ContactAction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_action }\n end\n end",
"def show\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render \"show.html.erb\", :layout => false }\n end\n end",
"def show\n @ad_contact = AdContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ad_contact }\n end\n end",
"def new\n @contactinfo = Contactinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contactinfo }\n end\n end",
"def index\n contacts = Contact.order('created_at DESC')\n\n respond_to do |format|\n format.html \n format.json { render json: contacts.as_json }\n end\n end",
"def show\n @contact = CompanyContact.find(params[:id])\n respond_with @contact\n end",
"def index\n respond_with Contact.all\n end",
"def get_contacts(params={})\n @obj.get('get-contacts', @auth.merge(params))\n end",
"def show\n @contact = contacts.find(params[:id])\n end",
"def show_contact(id)\n get(\"contacts/#{id}\")\n end",
"def new\n\t\t\t\t# we are going to make a new contact yall\n\t\t\t\t# comes in like post\n\t\t\t\t# {'api_token': ..., 'contact': {}}\n\t\t\t\tcontact_params = params[:contact] # be sure to clean all the values\n\t\t\t\t# clean them up\n\t\t\t\tcontact_params = sanitize_obj(contact_params);\n\t\t\t\t# lets allow rails to build this for us automagically\n\t\t\t\tc = Contact.new\n\t\t\t\tc.from_json(contact_params.to_json) # generate from our cleaned params\n\t\t\t\t# should be it for that, as long as the keys match, rails should set it\n\t\t\t\t\n\t\t\t\t# now we can save the contact\n\t\t\t\tc.save\n\t\t\t\[email protected] << c\n\t\t\t\[email protected]\n\t\t\t\t\n\t\t\t\t# now let's this new contact to the client\n\t\t\t\trender json: {:status => \"success\", :contact => c}\n\t\t\tend",
"def show\n @contact_partner = ContactPartner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_partner }\n end\n end",
"def show\n @traded_contact = TradedContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @traded_contact }\n end\n end",
"def get_contact(contact_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'GET'\n\t\targs[:path]['ContactName'] = contact_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/contacts/[ContactName]'\n\t\targs[:query]['Action'] = 'GetContact'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend",
"def new\n @contact_request = ContactRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_request }\n end\n end",
"def index\n @user_contacts = UserContact.all\n render :json => user_contact_data(@user_contacts)\n end",
"def show\n @contact_log = ContactLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_log }\n end\n end",
"def new\n @crm_contact = CrmContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crm_contact }\n end\n end",
"def contact\n Site.contact(params).deliver\n render :json => {:ok => true}.to_json\n rescue\n render :json => {:ok => false}.to_json\n end",
"def create\n @contact = Contact.create!(contact_params)\n render json: Contact.all\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @client_contact_sync_hash }\n format.xml { render :xml => @client_contact_sync_hash }\n end\n end",
"def show\n render json: Group.find(params[:id]).contacts\n end",
"def show\n @contact = Contact.find(params[:id])\n end",
"def index\n @contacts = current_company.contacts\n respond_to do |format|\n format.xml { render :xml => @contacts }\n format.json { render :json => @contacts }\n end\n end",
"def new\n @contactaction = Contactaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contactaction }\n end\n end",
"def query_contacts(options={}) path = \"/api/v2/contacts\"\n get(path, options, AvaTax::VERSION) end",
"def new\n @site_contact = SiteContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site_contact }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contact }\n end\n end",
"def show\n render json: @contact if stale? @contact\n end",
"def index\n contacteds = @business.contacteds\n \n render json: contacteds\n end",
"def index\n @contacts = @client.contacts\n end",
"def show\n render json: @contact_group\n end",
"def new\n @contact = Contact.new\n if not params[:client].nil?\n @client = Client.new JSON.parse(params[:client])\n @contact.clientId = @client._id\n @contact.name = @client.nome\n @contact.email = @client.email\n @contact.phone = @client.telefone\n @contact.address = @client.endereco\n @contact.client_type = @client.client_type\n @contact.institution = @client.instituicao\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cust_contact }\n end\n end",
"def contact\n Zapi::Models::Contact.new\n end",
"def new\n @contact_action = ContactAction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_action }\n end\n end",
"def index\n @contacts = Contact.all\n\n [:first_name, :last_name, :email].each do |param|\n if params[param].present?\n regexp = /\\A#{Regexp.escape(params[param].strip)}\\Z/i # ignore case\n @contacts = @contacts.where(param => regexp)\n end\n end\n\n if params[:phone].present?\n standard_phone = Contact.standardize_phone_format(params[:phone]) # standardize phone number\n @contacts = @contacts.where(phone: standard_phone)\n end\n\n if @contacts.blank?\n payload = {\n success: { full_messages: ['no record found'] }\n }\n render json: payload, status: :ok\n else\n render json: @contacts if stale? last_modified: @contacts.max(:updated_at)\n end\n end",
"def contact\n @text_messages = TextMessage.find_all_by_contact(params[:contact]).order(@order).paginate(@page)\n @contact = params[:contact]\n\n respond_to do |format|\n format.html # contact.html.erb\n format.json { render json: @text_messages, callback: params[:callback] }\n format.xml { render xml: @text_messages }\n end\n end",
"def contacts(options = {})\n params = { :limit => 200 }.update(options)\n response = get(PATH['contacts_full'], params)\n parse_contacts response_body(response)\n end",
"def get_contact_by_phone_with_http_info(phone, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.get_contact_by_phone ...'\n end\n # verify the required parameter 'phone' is set\n if @api_client.config.client_side_validation && phone.nil?\n fail ArgumentError, \"Missing the required parameter 'phone' when calling TextMagicApi.get_contact_by_phone\"\n end\n # resource path\n local_var_path = '/api/v2/contacts/phone/{phone}'.sub('{' + 'phone' + '}', phone.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 => 'Contact')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#get_contact_by_phone\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @contacts = current_user.contacts.paginate(:page => params[:page], :per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contacts }\n end\n end",
"def get_contact\r\n @contact = @customer.contact_people.find_by_name params[:id]\r\n end",
"def new\n @crm_contact_info = CrmContactInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crm_contact_info }\n end\n end",
"def index\n @contact = Contact.all\n end",
"def new\n #@contact = Contact.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n format.js\n end\n end",
"def contacts(options = {})\n params = { :limit => 200 }.update(options)\n response = get(params)\n parse_contacts response_body(response)\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contact }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contact }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contact }\n end\n end",
"def search_contacts_with_http_info(contact, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContactsApi.search_contacts ...'\n end\n # verify the required parameter 'contact' is set\n if @api_client.config.client_side_validation && contact.nil?\n fail ArgumentError, \"Missing the required parameter 'contact' when calling ContactsApi.search_contacts\"\n end\n allowable_values = [\"email\", \"cellphone\", \"phone\"]\n if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])\n fail ArgumentError, \"invalid value for \\\"type\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/contacts/search'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'contact'] = contact\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].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] || 'SearchContacts200Response'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Apikey']\n\n new_options = opts.merge(\n :operation => :\"ContactsApi.search_contacts\",\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: ContactsApi#search_contacts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @contacts = Contact.all\n\n #Fazendo chamadas para um metodo de traducao do modelo\n # render json: @contacts, methods: :birthdate_br\n render json: @contacts\n end",
"def show\n @provider_contact = ProviderContact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @provider_contact }\n format.xml { render :xml => @provider_contact }\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 show\n @library_contact = @library_location.library_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library_contact }\n end\n end",
"def show\r\n @contact_rule = ContactRule.find(params[:id])\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @contact_rule }\r\n end\r\n end",
"def edit\n #@contact = Contact.find(params[:id])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n format.js { render 'new' }\n end\n end",
"def ajax_show\n @contact.address = @contact.full_address\n render :json => @contact.to_json\n end",
"def new\n @contact_message = ContactMessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_message }\n end\n end",
"def show\n @phone = Phone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @phone }\n end\n end",
"def show\n @phone = Phone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @phone }\n end\n end",
"def contacts\n contacts = params[:contacts].map{|c| c[1]}\n if contacts\n logger.debug \">>> received #{contacts.length} contacts\"\n end\n render :text => \"ok\"\n end"
] | [
"0.7936726",
"0.78015804",
"0.78015804",
"0.7721689",
"0.7721689",
"0.7721689",
"0.7579549",
"0.7462664",
"0.73557734",
"0.73085946",
"0.7297218",
"0.7200316",
"0.71695065",
"0.7146676",
"0.71428233",
"0.7142578",
"0.7139203",
"0.71077436",
"0.71077436",
"0.71077436",
"0.7087062",
"0.7084511",
"0.70658785",
"0.70162123",
"0.7009965",
"0.69936174",
"0.69933075",
"0.69742036",
"0.6943057",
"0.6930858",
"0.6926573",
"0.6909949",
"0.68996984",
"0.6896052",
"0.6871817",
"0.68679756",
"0.68597496",
"0.6855898",
"0.6855159",
"0.68326974",
"0.6831101",
"0.68239874",
"0.67897797",
"0.6761976",
"0.6745345",
"0.67372274",
"0.67220396",
"0.6717785",
"0.671557",
"0.67132765",
"0.6706343",
"0.6705185",
"0.6703",
"0.6693867",
"0.66892993",
"0.6670134",
"0.66469234",
"0.6635924",
"0.6633376",
"0.66282785",
"0.6584828",
"0.6551619",
"0.6545711",
"0.6540442",
"0.65400887",
"0.65269697",
"0.65231144",
"0.6500951",
"0.6490695",
"0.648262",
"0.64820933",
"0.64749056",
"0.6474414",
"0.64382493",
"0.6424572",
"0.64225316",
"0.6421133",
"0.64189804",
"0.6418353",
"0.64178777",
"0.64168537",
"0.64133704",
"0.6408068",
"0.640322",
"0.63869476",
"0.6384514",
"0.6384008",
"0.6384008",
"0.6384008",
"0.6371511",
"0.6362711",
"0.63579273",
"0.6355926",
"0.6348896",
"0.6339217",
"0.6337852",
"0.63355285",
"0.6335091",
"0.63133234",
"0.63133234",
"0.6313037"
] | 0.0 | -1 |
GET /contact/formulaire GET /contact/formulaire.json | def new
@contact_form = ContactForm.new
seo_tag_index page
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookup\n respond_to do |format|\n format.json { render json: Crm::ContactLookup.new(view_context) }\n end\n end",
"def index\n @contactable = find_contactable\n @contactos = @contactable.contactos\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @contactos }\n end\n end",
"def index\n @formularies = Formulary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formularies }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n render json: @contact\n end",
"def show\n @contactable = find_contactable\n @contacto = @contactable.contactos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @contacto }\n end\n end",
"def show\n @formulary = Formulary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @formulary }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n @contact = Contact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n render json: @contact\n end",
"def show\n render json: @contact\n end",
"def show\n #@contact = Contact.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact }\n end\n end",
"def index\n @contacts = Contact.all\n render json: @contacts\n end",
"def show\n @contact_request = ContactRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_request }\n end\n end",
"def index\n @contact = current_user.contacts.find(params[:contact_id])\n @requests = @contact.requests\n\n respond_with @requests\n end",
"def show\n @field = FormulaField.find(params[:id])\n @owner = Project.find(@field.project_id).user_id\n\n recur = params.key?(:recur) ? params[:recur] : false\n\n respond_to do |format|\n format.html { render text: @field.to_json }\n format.json { render json: @field.to_hash(recur) }\n end\n end",
"def get_contacts\n\n #@company = Benefits.find.params[:company_id]\n #@contacts = @company.contacts\n\n Rails.logger.warn \"#{:areabenefit_id} jajaxxx\"\n @contacts = Benefit.where(areabenefit_id: params[:areabenefit_id], asistencia: '1')\n end",
"def index\n @contacts = Contact.all\n\n #Fazendo chamadas para um metodo de traducao do modelo\n # render json: @contacts, methods: :birthdate_br\n render json: @contacts\n end",
"def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def show\n render json: @contact.address\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\r\n @contact_rule = ContactRule.find(params[:id])\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @contact_rule }\r\n end\r\n end",
"def show\n @formulario = Formulario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @formulario }\n end\n end",
"def show\n render json: @referral_contact\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @client_contact_hash }\n format.xml { render :xml => @client_contact_hash }\n end\n end",
"def show\n @correo = Correo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @correo }\n end\n end",
"def show\n @correo = Correo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @correo }\n end\n end",
"def index\n @filled_forms = FilledForm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filled_forms }\n end\n end",
"def new\n @contactaction = Contactaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @contactaction }\n end\n end",
"def index\n @contacts = Contact.all\n render json: {status: 200, contacts: @contacts}\n end",
"def query_contacts(options={}) path = \"/api/v2/contacts\"\n get(path, options, AvaTax::VERSION) end",
"def index\n @referral_contacts = @user.referralContact.page(params[:page]).per(params[:per])\n\n render json: @referral_contacts\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def show\n @contactaction = Contactaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @contactaction }\n end\n end",
"def get_forms\n @course = Course.find(params[:course_id])\n @forms = @course.professor_forms\n render json: @forms\n end",
"def show\n @calcmecanico = Calcmecanico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calcmecanico }\n end\n end",
"def new\n @crm_contact = CrmContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crm_contact }\n end\n end",
"def new\n @formulary = Formulary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @formulary }\n end\n end",
"def new\n @contact = Contact.new\n if not params[:client].nil?\n @client = Client.new JSON.parse(params[:client])\n @contact.clientId = @client._id\n @contact.name = @client.nome\n @contact.email = @client.email\n @contact.phone = @client.telefone\n @contact.address = @client.endereco\n @contact.client_type = @client.client_type\n @contact.institution = @client.instituicao\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def contact(contact, options = {})\n get(\"contacts/#{contact}\", options).pop\n end",
"def new\n @contact_request = ContactRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_request }\n end\n end",
"def index\n @familia = Familium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @familia }\n end\n end",
"def index\n respond_with Contact.all\n end",
"def index\n @car = Car.find(params[:car_id])\n @lien_procedures = @car.lien_procedures\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lien_procedures }\n end\n end",
"def get_contacts(options = {})\n send_request(\"get\", contacts_url, body: options.to_json)\n end",
"def index\n @frais_repas = FraisRepa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_repas }\n end\n end",
"def show\n @contactinfo = Contactinfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contactinfo }\n end\n end",
"def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Entities::Profile::Contacts)\n end",
"def new\r\n @contact_rule = ContactRule.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @contact_rule }\r\n end\r\n end",
"def show\n @matricula = Matricula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matricula }\n end\n end",
"def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact }\n end\n end",
"def new\n @contact_action = ContactAction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_action }\n end\n end",
"def create\n\t\t@contact = Contact.new(contact_params)\n\n\t\trespond_to do |format|\n\t\t\tif @contact.save\n\t\t\t\tformat.html { redirect_to queries_path, notice: 'Seu contato foi enviado com sucesso. Logo entraremos em contato com você.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @contact }\n\t\t\telse\n\t\t\t\tformat.html { render :index }\n\t\t\t\tformat.json { render json: @contact.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def show\n\t\t@form = @client.forms.find(params[:id])\n @procedures = @form.procedures.order('step_num ASC')\n\n \trespond_to do |format|\n \t\tformat.html # show.html.erb\n \t\tformat.json { render json: @form }\n \t \tend\n \tend",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @formula }\n end\n end",
"def index\n\t @fares = Fare.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @fares }\n\t end\n\tend",
"def get_company_by_company_part\n @parts = CompaniesController::CompanyService.get_company_by_company_part(params[:param_part])\n if [email protected]?\n respond_to do |format|\n format.json{ render json: @parts}\n end \n else\n #não foi encontrado as informacoes\n end\n\tend",
"def index\n @references = Reference.all\n\n render json: @references\n end",
"def show\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n\n respond_with @requests\n end",
"def show\n @cabinet = Cabinet.find(params[:id])\n \n respond_to do |format|\n format.html do \n @contacts = @cabinet.contacts\n @implantations = @cabinet.implantations\n @testimonials = @cabinet.testimonials\n end\n format.json { render json: @cabinet }\n end\n end",
"def show\n @contact_action = ContactAction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_action }\n end\n end",
"def new\n @calcmecanico = Calcmecanico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @calcmecanico }\n end\n end",
"def new\n @contacto = Contacto.new\n \n respond_to do |format|\n format.html { render :layout => 'special_form'}# new.html.erb\n #format.json { render json: @contacto }\n end\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def show\n @projectcontact = Projectcontact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @projectcontact }\n end\n end",
"def show\n @crm_contact_info = CrmContactInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crm_contact_info }\n end\n end",
"def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end",
"def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charges }\n end\n end",
"def index\n @campanhas = Campanha.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campanhas }\n end\n end",
"def contact\n response[\"contact\"]\n end",
"def new\n @contactinfo = Contactinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contactinfo }\n end\n end",
"def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end",
"def new\n @correo = Correo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @correo }\n end\n end",
"def index\n @user_contacts = UserContact.all\n render :json => user_contact_data(@user_contacts)\n end",
"def new\n @frais_repa = FraisRepa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @frais_repa }\n end\n end",
"def show\n @central_correio = CentralCorreio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @central_correio }\n end\n end",
"def show\n @user = get_user(params[:user_id])\n @formula = get_formula(params[:id])\n respond_with [@user, @formula]\n end",
"def show\n @contact = Contact.find(params[:id])\n render :json => { :success => true, :message => \"Show Contacts\", :contact => @contact }\n # respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @contact }\n # end\n end",
"def show\n @mecanicacomplejo = Mecanicacomplejo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mecanicacomplejo }\n end\n end",
"def show\n @dependencia = Dependencia.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependencia }\n end\n end",
"def index\n\t\t@forms = @client.forms.all\n\n\t\trespond_to do |format|\n \t\tformat.html # index.html.erb\n \t\tformat.json { render json: @forms }\n \tend\n\tend",
"def index\n @factura = Factura.find(params[:factura_id])\n @renglon_facturas = @factura.renglon_facturas\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @renglon_facturas }\n end\n end",
"def get_matter_details\n \n get_comp_id = get_company_id\n @matters = Matter.search_results(get_company_id, get_employee_user_id, params[\"q\"], true, nil, 'my_all').uniq\n @contacts = Contact.search_communication_contact(params[:q],current_company,get_comp_id)\n\n respond_to do |format|\n if params[:from] == \"matters\"\n format.js { render :partial=> 'comm_matter_auto_complete', :object => @matters,:locals=>{:from=>\"matters\"} }\n format.html { render :partial=> 'comm_matter_auto_complete',:object => @matters,:locals=>{:from=>\"matters\"} }\n else\n format.js { render :partial=> 'comm_matter_auto_complete', :object => @contacts,:locals=>{:from=>\"contacts\"}}\n format.html { render :partial=> 'comm_matter_auto_complete', :object => @contacts,:locals=>{:from=>\"contacts\"}}\n end\n end\n end",
"def index\n @compte_bancaires = CompteBancaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@compte_bancaires }\n end\n end",
"def show\n @periodo_academico = PeriodoAcademico.find(params[:id])\n\n render json: @periodo_academico\n end",
"def contacts\n\t #begin\n\t autopilot_contact = params[\"contact\"]\n\t autopilot_event = params[\"event\"]\n\t if autopilot_contact.has_key?(\"Company\") && autopilot_contact[\"Company\"] != \"\"\n company_id = get_freshdesk_company_id(autopilot_contact[\"Company\"])\n #Rails.logger.debug \"comp id==>#{company_id}\"\n autopilot_contact[\"Company\"] = company_id \n end\n @freshdesk_data = initialize_freshdesk_data(autopilot_contact,autopilot_contact[\"event\"])\n @freshdesk_data[\"company_id\"] = autopilot_contact[\"Company\"] unless autopilot_contact[\"Company\"] == \"\"\n\n\t #@freshdesk_data = initialize_freshdesk_data(autopilot_contact,autopilot_contact[\"event\"])\n\t get_custom_fields(autopilot_contact)\n\t if autopilot_event == \"contact_added\"\n\t \t response = contact_added(@freshdesk_data)\n\t elsif autopilot_event == \"contact_updated\"\n\t\t #Rails.logger.info \"Update response from autopilotttttttttttttttttt\"\n\t response = contact_updated(@freshdesk_data, @freshdesk_contact_id)\n\t\t #Rails.logger.debug \"#{response}\"\t\t\n\t end \n\t response.parsed_response.has_key?(\"errors\") ? failure_response(response) : success_response\n\t #rescue Exception => e\n\t #\tputs e.message\n\t #end\n\tend",
"def show\n respond_to do |format|\n format.html\n format.json { render :json => @client_contact_sync_hash }\n format.xml { render :xml => @client_contact_sync_hash }\n end\n end",
"def show\n unless possui_acesso?()\n return\n end\n @matricula = Matricula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matricula }\n end\n end",
"def new\n @matricula = Matricula.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @matricula }\n end\n end",
"def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end",
"def index\n contacteds = @business.contacteds\n \n render json: contacteds\n end",
"def index\n @comprobantes = Comprobante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comprobantes }\n end\n end",
"def index\n @forma_contactos = FormaContacto.all\n end",
"def new\n @fluxomatricula = Fluxomatricula.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fluxomatricula }\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def index\n json_response(@contacts, user_id: @user.id, status: :ok)\n end",
"def index\n @contacts = Contact.all\n\n [:first_name, :last_name, :email].each do |param|\n if params[param].present?\n regexp = /\\A#{Regexp.escape(params[param].strip)}\\Z/i # ignore case\n @contacts = @contacts.where(param => regexp)\n end\n end\n\n if params[:phone].present?\n standard_phone = Contact.standardize_phone_format(params[:phone]) # standardize phone number\n @contacts = @contacts.where(phone: standard_phone)\n end\n\n if @contacts.blank?\n payload = {\n success: { full_messages: ['no record found'] }\n }\n render json: payload, status: :ok\n else\n render json: @contacts if stale? last_modified: @contacts.max(:updated_at)\n end\n end",
"def show\n @fluxomatricula = Fluxomatricula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fluxomatricula }\n end\n end"
] | [
"0.6179646",
"0.6159316",
"0.5925507",
"0.5883502",
"0.5879162",
"0.5755039",
"0.57363683",
"0.57363683",
"0.57363683",
"0.5688854",
"0.5688854",
"0.5686619",
"0.5654469",
"0.5648161",
"0.56332797",
"0.56330246",
"0.5618351",
"0.5587581",
"0.55757004",
"0.5569158",
"0.5569158",
"0.5569158",
"0.556358",
"0.55500215",
"0.5539376",
"0.5524381",
"0.55159813",
"0.5514568",
"0.5511958",
"0.5511245",
"0.55048686",
"0.5492593",
"0.5483566",
"0.54829115",
"0.5479168",
"0.5454291",
"0.54533285",
"0.544717",
"0.54415846",
"0.5434982",
"0.54342026",
"0.542639",
"0.5423434",
"0.54218954",
"0.54204214",
"0.5416252",
"0.5415227",
"0.5413487",
"0.54084617",
"0.53839093",
"0.5380654",
"0.5366483",
"0.535834",
"0.53551936",
"0.5351746",
"0.5348334",
"0.5344084",
"0.53412884",
"0.53325176",
"0.53301865",
"0.533",
"0.53284097",
"0.53248763",
"0.5324139",
"0.53226155",
"0.53192234",
"0.5311961",
"0.53015834",
"0.5301303",
"0.530016",
"0.5293267",
"0.5288102",
"0.5283522",
"0.52807903",
"0.5272299",
"0.5266729",
"0.5264802",
"0.5260526",
"0.5259873",
"0.5254288",
"0.52525705",
"0.5251774",
"0.52495146",
"0.5245969",
"0.52433527",
"0.52417934",
"0.52342623",
"0.52326757",
"0.52263623",
"0.52239484",
"0.52230275",
"0.5220541",
"0.52174836",
"0.5211871",
"0.5203902",
"0.5198787",
"0.519113",
"0.51899475",
"0.51896864",
"0.5186706",
"0.5186592"
] | 0.0 | -1 |
GET /haos/1 GET /haos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def show\n @huerto = Huerto.find_by_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @huerto }\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 get_aos_version(args = {}) \n get(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def show\n @hijo = Hijo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hijo }\n end\n end",
"def index\n @heroes = Hero.all\n\n render json: @heroes\n end",
"def index\n @himalayas = Himalaya.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end",
"def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end",
"def show\n @api_haiku = Api::Haiku.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_haiku }\n end\n end",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def index\n @hohos = Hoho.all\n end",
"def heros\n get('/hero/')\n end",
"def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end",
"def show\n @he = He.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @he }\n end\n end",
"def show\n @himalaya = Himalaya.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @himalaya }\n end\n end",
"def show\n @hetong = Hetong.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hetong }\n end\n end",
"def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end",
"def index\n @homerooms = Homeroom.all\n end",
"def show\n @orgao = Orgao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orgao }\n end\n end",
"def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end",
"def show\n @oase = Oasis.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oase }\n end\n end",
"def index\n @shoes = Shoe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shoes }\n end\n end",
"def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend",
"def index\n @foros = Foro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foros }\n end\n end",
"def show\n @hotele = Hotele.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hotele }\n end\n end",
"def index\n \n @agente = Agente.find(params[:agente_id])\n @hijos = @agente.hijos\n end",
"def show\n @ginasio = Ginasio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ginasio }\n end\n end",
"def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end",
"def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end",
"def show\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shichoson }\n end\n end",
"def index\n @houmons = Houmon.all\n\n end",
"def show\n @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sabio }\n end\n end",
"def show\n @kazoku = Kazoku.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @kazoku }\n end\n end",
"def show\n @odontologo = Odontologo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odontologo }\n end\n end",
"def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end",
"def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end",
"def index\n @housing_features = HousingFeature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @housing_features }\n end\n end",
"def huertopublico\n @huerto = Huerto.find_by_agrupacion(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @huerto }\n end\n end",
"def get_aos_version_by_name(args = {}) \n get(\"/aosversions.json/version/#{args[:aosVersionName]}\", args)\nend",
"def show\n @gasto = Gasto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gasto }\n end\n end",
"def index\n #pseudo scope \n if params[:phone] \n @agencies = Agency.find_by_phone(params[:phone]);\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n else\n # Aqui estoy haciendo que el api responda en mas de 1 formato\n @agencies = Agency.all\n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end\n\n end \n end",
"def show\n @consensu = Consensu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @consensu }\n end\n end",
"def index\n @hanghoas = Hanghoa.all\n \n end",
"def show\n render json: @hero\n end",
"def index\n @ahoogahs = Ahoogah.all\n end",
"def show\n @howner = Howner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @howner }\n end\n end",
"def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end",
"def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end",
"def show\n @historial_odt = HistorialOdt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial_odt }\n end\n end",
"def index\n @simple_chores = SimpleChore.all\n respond_to do |format|\n format.html\n format.json { render :json => @simple_chores }\n end\n end",
"def index\n @obsahs = Obsah.all\n end",
"def index\n @api_v1_menus = Menu.all\n render json: @api_v1_menus\n end",
"def show\n @escola = Escola.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @escola }\n end\n end",
"def show\n @hostela = Hostela.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hostela }\n end\n end",
"def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end",
"def index\n @adocao_animals = AdocaoAnimal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @adocao_animals }\n end\n end",
"def getfromOhai\n\t\tthissys=Ohai::System.new\n\t\tthissys.all_plugins\n\t\treturn thissys.to_json\n\tend",
"def show\n @odontologia1 = Odontologia1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odontologia1 }\n end\n end",
"def show\n @heli_kit = HeliKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heli_kit }\n end\n end",
"def show\n @byoin = Byoin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @byoin }\n end\n end",
"def show\n @asaaddrobj = Asaaddrobj.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asaaddrobj }\n end\n end",
"def show\n @horario = Horario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @horario }\n end\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\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 show\n @aactio = Aactio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aactio }\n end\n end",
"def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def show\n @kolegij = Kolegij.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegij }\n end\n end",
"def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end",
"def show\n @ano = Ano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ano }\n end\n end",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend",
"def show\n @oai_endpoint = OaiEndpoint.find(params[:id])\n respond_to do |format|\n format.html { render :template => 'oai_endpoints/show', :layout => params[:layout] || true }\n format.json { render :json => @oai_endpoint.as_json }\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 get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend",
"def show\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ocat }\n end\n end",
"def index\n @apoios = Apoio.all\n end",
"def view_api\n api_string = RestClient.get(\"https://itunes.apple.com/search?term=star+wars&entity=song&attribute=movieTerm\")\n api_hash = JSON.parse(api_string)\n\n end",
"def show\n @cegonha = Cegonha.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cegonha }\n end\n end",
"def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end",
"def show\n @anuncio = Anuncio.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @anuncio }\n end\n end",
"def index\n @ocats = Ocat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocats }\n end\n end",
"def show\n @eou = Eou.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @eou }\n end\n end",
"def show\n @soiree = Soiree.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @soiree }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @historial = Historial.find(params[:id])\n @receta = Recete.histori(@historial.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @historial }\n end\n end",
"def show\n @kolegiji = Kolegiji.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kolegiji }\n end\n end",
"def h1; api.out \"<h1>#{api.data}</h1>\"; end",
"def get_heroes\n heroes = []\n Hero.all.each do |hero|\n heroes << hero.to_json\n end\n heroes << Hero.first.to_json\n send_message({:action => \"get heroes list\", :status => game.status, :heroes => heroes})\n end",
"def show\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agente } \n end\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def show\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @os_type }\n end\n end",
"def show\n client= Client.find_by_id params[:id]\n if client != nil\n render(json: client, status: 200) \n else\n head 404\n end \n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end",
"def show\n @clientepedido = Clientepedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientepedido }\n end\n end",
"def index\n @ganhos = Ganho.find_by_user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ganhos }\n end\n end",
"def show\n @goody = Goody.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goody }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end"
] | [
"0.69756824",
"0.6410446",
"0.6405375",
"0.6396164",
"0.639236",
"0.63656783",
"0.63006485",
"0.63004607",
"0.6289397",
"0.6285407",
"0.62272143",
"0.6178297",
"0.6168639",
"0.6163009",
"0.61545795",
"0.61312854",
"0.6119018",
"0.60987496",
"0.60927534",
"0.6092521",
"0.6090356",
"0.6083926",
"0.6079707",
"0.6067372",
"0.60618293",
"0.6060796",
"0.604969",
"0.60390496",
"0.6010248",
"0.600733",
"0.6003285",
"0.6001825",
"0.6001799",
"0.5995432",
"0.5993495",
"0.5981919",
"0.5971927",
"0.5966796",
"0.5963136",
"0.59616864",
"0.5961522",
"0.59553695",
"0.59442174",
"0.5927109",
"0.592664",
"0.5926317",
"0.59250194",
"0.592249",
"0.59171546",
"0.59116274",
"0.5906219",
"0.5904484",
"0.5903621",
"0.59035283",
"0.5900815",
"0.5900287",
"0.589455",
"0.58903897",
"0.58772683",
"0.5876951",
"0.5871195",
"0.5870908",
"0.5864107",
"0.58629787",
"0.58591723",
"0.5853039",
"0.5847729",
"0.58344954",
"0.5831503",
"0.5831493",
"0.5830122",
"0.5828194",
"0.58209103",
"0.58209103",
"0.5811749",
"0.5811749",
"0.58084285",
"0.58018136",
"0.5792674",
"0.57920545",
"0.5788652",
"0.57875896",
"0.5784328",
"0.5783151",
"0.57818615",
"0.5780727",
"0.57780176",
"0.5774227",
"0.57652444",
"0.57639986",
"0.5760161",
"0.5759557",
"0.5759151",
"0.5750859",
"0.57504994",
"0.57504886",
"0.57502395",
"0.57500887",
"0.57488877",
"0.5743737",
"0.57411015"
] | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_hao
@hao = Hao.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 hao_params
params[:hao]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def valid_params_request?; end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def filtering_params\n params.permit(:email)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def 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 url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.6291174",
"0.62905735",
"0.6283171",
"0.6242344",
"0.62403613",
"0.6218049",
"0.62143815",
"0.62104696",
"0.61949855",
"0.6178671",
"0.6176147",
"0.6173327",
"0.6163395",
"0.6153005",
"0.6151833",
"0.6147288",
"0.61224324",
"0.6118827",
"0.61075264",
"0.61054534",
"0.6092497",
"0.6080082",
"0.60710967",
"0.60627776",
"0.60219413",
"0.60175914",
"0.60153484",
"0.60107356",
"0.60081726",
"0.60081726",
"0.60013986",
"0.6000165",
"0.59978646",
"0.59936947",
"0.59925723",
"0.5992084",
"0.59796256",
"0.5967569",
"0.5960056",
"0.59589803",
"0.5958441",
"0.5958401",
"0.5952607",
"0.5952406",
"0.5944409",
"0.59391016",
"0.593842",
"0.593842",
"0.5933845",
"0.59312123",
"0.5926475",
"0.59248453",
"0.59179676",
"0.59109294",
"0.59101623",
"0.5908172",
"0.59058356",
"0.5899052",
"0.5897749",
"0.5896101",
"0.58942914",
"0.58939576",
"0.5892063",
"0.5887407",
"0.588292",
"0.58797663",
"0.587367",
"0.58681566",
"0.5868038",
"0.5866578",
"0.58665025",
"0.58655846",
"0.58640826",
"0.5863465",
"0.5862226",
"0.586065",
"0.58581287",
"0.5854443",
"0.5854172",
"0.58507544",
"0.5849934"
] | 0.0 | -1 |
Ruby keyword arguments only after average arguments in method call and method definition. | def example(a,b:,c:5)
[a,b,c]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_kwarg=(_arg0); end",
"def meth(\n **\n ); end",
"def in_kwarg; end",
"def method_with_keyword_arguments(one: 1, two: 'two')\n [one, two]\n end",
"def extra_args; end",
"def **(arg0)\n end",
"def **(arg0)\n end",
"def my_method(*a, **kw)\n p arguments: a, keywords: kw\nend",
"def test_keyword_arguments\n assert_equal Array, method_with_keyword_arguments.class\n assert_equal [1, 'two'], method_with_keyword_arguments\n assert_equal ['one','two'], method_with_keyword_arguments(one: 'one')\n assert_equal [1, 2], method_with_keyword_arguments(two: 2)\n end",
"def minimal_arguments(method)\n # Build an arguments array with holds all required parameters. The actual\n # values for these arguments doesn't matter at all.\n args = method.parameters.select { |mode, _name| mode == :req }\n\n # Add a hash with all required named arguments\n required_keyword_args = method.parameters.each_with_object({}) do |(mode, name), hsh|\n hsh[name] = :anything if mode == :keyreq\n end\n args << required_keyword_args if required_keyword_args\n\n args\n end",
"def method_with_keyword_param(keyword: foo)\nend",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def reserved_words=(_arg0); end",
"def reveal_kwargs(**kwargs)\n # ...But within the function, you don't use the asterisk.\n kwargs.each do | kwarg |\n puts \"#{kwarg} is one of your arguments.\"\n end\nend",
"def optional_keywords; end",
"def keyword_arg(key, desc, opts = {}, &block)\n opts.merge!(@arg_opts){ |k, e, n| e || n } if @arg_opts\n @arg_opts = nil\n args_def.keyword_arg(key, desc, opts, &block)\n end",
"def a(b:, **c)\nend",
"def required_keywords; end",
"def initialize(*positional_args, **args)\n if !positional_args.empty?\n raise ArgumentError, \"wrong arguments accepts only keyword arguments\"\n end\n keys = args.keys\n required_keys = self.class.members\n if keys.sort != required_keys.sort\n if keys.size > required_keys.size\n raise(ArgumentError, \"wrong number of arguments (%d for %d)\"%\n [keys.size, required_keys.size])\n end\n missing_keys = required_keys - keys\n raise(ArgumentError, \"missing keyword: %s\"%missing_keys.join(', '))\n end\n args.each{|k, v| instance_variable_set(\"@#{k}\".to_sym, v)}\n end",
"def args(*) end",
"def with_arbitrary_keywords\n method_signature_expectation.any_keywords = true\n\n self\n end",
"def expected_keyword_arguments\n verify_argument_expectation_is_set\n argument_expectation.expected_keyword_arguments\n end",
"def arguments=(_arg0); end",
"def fold_kwargs!(args)\n hash = args&.[](0)\n return unless hash.respond_to?(:key)\n\n Rails5Shims::ControllerTests::REQUEST_KWARGS.each do |kwarg|\n next unless hash.key?(kwarg)\n\n value = hash.delete(kwarg)\n if value.is_a? String\n args.insert(0, value)\n else\n hash.merge! value\n end\n end\n end",
"def ruby_kw_should_return_9\n swift_kwargs(a: 3, b: 1)\nend",
"def method(**a)\r\nend",
"def meth(\n\n\n\n *args)\n\nend",
"def ensure_strict_args(keys, required, allowed)\n missing = required - keys\n unless missing.empty?\n raise ArgumentError, \"missing keywords: #{missing.join(', ')}\"\n end\n unknown = keys - (required + allowed)\n unless unknown.empty?\n raise ArgumentError, \"extra keywords: #{unknown.join(', ')}\"\n end\n end",
"def inflamed _args\n \"inflamed _args;\" \n end",
"def method (a=3, b=4)\r\nend",
"def tolerate_shape_extra_args!\n the_java_method_arg_count = org.eclipse.swt.graphics.GC.java_class.declared_instance_methods.select do |m|\n m.name == @method_name.camelcase(:lower)\n end.map(&:parameter_types).map(&:size).max\n if the_java_method_arg_count && @args.to_a.size > the_java_method_arg_count\n @args[the_java_method_arg_count..-1] = []\n end\n end",
"def initialize(keyword); super(keyword); @argSet = Set.new end",
"def args()\n #This is a stub, used for indexing\n end",
"def meth **options\nend",
"def meth **options\nend",
"def hello(place=\"world\", *args)\n #...\n end",
"def method(a, *b)\r\n\tb\r\nend",
"def meth(\n # this is important\n arg)\nend",
"def meth(\n arg1,\n arg2 , arg3 = 7 , *rest,\n\n\n last,\n required:,\n not_required: 7, **options)\nend",
"def meth(\n arg1,\n arg2 , arg3 = 7 , *rest,\n\n\n last,\n required:,\n not_required: 7, **options)\nend",
"def params=(_arg0); end",
"def params=(_arg0); end",
"def extra=(_arg0); end",
"def required_call_arguments\n find_required_arguments call_arguments\n end",
"def method (a=3,\r\n\tb)\r\nend",
"def params(*); {}; end",
"def arg_size; end",
"def parameters=(_arg0); end",
"def test_Method_InstanceMethods_parameters\n\t\tdef m(a,b=1,*c,&d); end\n\t\t# TODO, assert_equal([[:req,:a],[:opt,:b],[:rest,:c],[:block,:d]], method(:m).parameters)\n\tend",
"def _define_roda_method_arg_numbers(callable)\n optional_args = 0\n rest = false\n keyword = false\n callable.parameters.map(&:first).each do |arg_type, _|\n case arg_type\n when :opt\n optional_args += 1\n when :rest\n rest = true\n when :keyreq\n keyword = :required\n when :key, :keyrest\n keyword ||= true\n end\n end\n arity = callable.arity\n if arity < 0\n arity = arity.abs - 1\n end\n required_args = arity\n arity -= 1 if keyword == :required\n\n if callable.is_a?(Proc) && !callable.lambda?\n optional_args -= arity\n end\n\n [required_args, optional_args, rest, keyword]\n end",
"def optionalParameters(a,b,*c)\n #some code\nend",
"def named_keywords(key: 42)\n p key\nend",
"def method(a=2, b, *c)\r\n\treturn a, b, c\r\nend",
"def method(*a, b=2)\r\nend",
"def foo(a, b)\n :two_args\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def arguments(required, *optional)\n puts \"required: #{required}\"\n puts \"optional: #{optional}\"\nend",
"def _reduce_546(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n \n result\nend",
"def method(a,b,c)\nend",
"def _reduce_544(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n \n result\nend",
"def meth(**\n options)\nend",
"def private _args\n \"private _args;\" \n end",
"def method (a=3, b)\r\nend",
"def _reduce_546(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n\n result\nend",
"def with_keywords *keywords\n method_signature_expectation.keywords = keywords\n\n self\n end",
"def method(a=2, *b)\r\n\tb\r\nend",
"def __get_params(data)\n \n # If named arguments used, assigns keys as symbols\n # but keeps numeric arguments as integers\n \n if @params.kind_of? Hash\n @params = @params.dup\n @keyword_params = JsonRpcObjects::Utils::Hash.remove!(@params) do |k, v|\n not JsonRpcObjects::Utils::String.numeric? k\n end\n \n @params = @params.sort_by { |i| i[0].to_i }.map { |i| i[1] }\n else\n @keyword_params = { }\n end\n \n JsonRpcObjects::Utils::Hash.keys_to_sym! @keyword_params\n \n end",
"def _reduce_554(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n \n result\nend",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def signature(*args); end",
"def meaningful_arguments(arguments)\n self_arguments = self.arguments\n result = {}\n arguments.each_assigned_argument do |key, value|\n if self_arguments.include?(key)\n result[key] = value\n end\n end\n result\n end",
"def _reduce_549(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n \n result\nend",
"def method a=3, b=4\r\nend",
"def prepare_method_arg_hash(args)\n # SEQUEL5: Remove\n h = {}\n prepare_method_args('a', args.length).zip(args).each{|k, v| h[k] = v}\n h\n end",
"def method ( a ,b ,c ) \nend",
"def my_method4(**args)\r\n p args\r\nend"
] | [
"0.7084937",
"0.70146084",
"0.7009015",
"0.6977629",
"0.6890991",
"0.6853093",
"0.6853093",
"0.68326384",
"0.6804488",
"0.67607355",
"0.6688588",
"0.661327",
"0.661327",
"0.661327",
"0.6607254",
"0.6602113",
"0.6505678",
"0.6495558",
"0.6489973",
"0.6476241",
"0.64568347",
"0.6453327",
"0.64448124",
"0.64374876",
"0.64318055",
"0.6400153",
"0.63983536",
"0.6389511",
"0.634858",
"0.6338818",
"0.63202924",
"0.6276783",
"0.62762755",
"0.6266794",
"0.62428874",
"0.62191916",
"0.62191916",
"0.6217633",
"0.6212351",
"0.6187688",
"0.6186928",
"0.6185547",
"0.61840427",
"0.61840427",
"0.61686605",
"0.6163107",
"0.6160018",
"0.6159271",
"0.6157865",
"0.6152311",
"0.6146239",
"0.6135221",
"0.6130904",
"0.61285335",
"0.6125532",
"0.61189944",
"0.6118345",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.61106706",
"0.60913515",
"0.60912174",
"0.6089299",
"0.6087969",
"0.60865617",
"0.60708994",
"0.607014",
"0.6067615",
"0.60592115",
"0.6056272",
"0.6054469",
"0.60518116",
"0.6046606",
"0.6046606",
"0.6046606",
"0.6046606",
"0.6046606",
"0.60409325",
"0.60273707",
"0.60252804",
"0.60211456",
"0.6001757",
"0.5999288",
"0.59969807"
] | 0.0 | -1 |
This function validates the mandatory fields in the request. Args : +requestParams+ > the request parameter Returns : +errorArray+ > the error code | def validateRequestParam(requestParams = {})
if requestParams[:pReqType].blank? || isBlankOrNull(requestParams[:pReqType])
return BLANK_REQUEST_TYPE
elsif !(@@requestTypes.include? requestParams[:pReqType])
return INVALID_REQUEST_TYPE
end
if requestParams[:pMerCode].blank? || isBlankOrNull(requestParams[:pMerCode])
return BLANK_MER_CODE
end
if requestParams[:pEncKey].blank? || isBlankOrNull(requestParams[:pEncKey])
return INVALID_KEY
end
if requestParams[:pEncIv].blank? || isBlankOrNull(requestParams[:pEncIv]) || requestParams[:pEncIv].length < 16
return INVALID_IV
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate\n raise ArgumentError, \"Params emtpy\" if @params.nil? \n @errors = []\n @errors << 'reason must be provided' if @params.reason.nil? \n @errors << 'txn_id must be provided' if @params.txn_id.nil? \n @errors << 'order.id must be provided' if @params.order.id.nil? \n @errors << 'order.total must be provided' if @params.order.total.nil? \n @errors << 'order.shipping_value must be provided' if @params.order.shipping_value.nil? \n @errors << 'order.tax must be provided' if @params.order.tax.nil? \n\n raise ZipMoney::RequestError.new(\"Following error(s) occurred while making request, please resolve them to make the request: #{@errors}\") if @errors.any?\n end",
"def validate_request(env)\n parameters = extract_request_parameters\n\n validate_flow_presence!(parameters)\n validate_msisdn!(parameters)\n validate_session_id!(parameters)\n\n parameters\n end",
"def ensure_params(*req)\n missing = []\n req.flatten.each do |param|\n if params[param].blank?\n missing << param.to_s\n end\n end\n if missing.empty?\n return false\n else\n msg = \"Following params are required but missing: \" + missing.join(\", \")\n render_api_error(11 , 400, 'params', msg)\n return true\n end\n end",
"def validate(params)\n Request.new(params).validate(params)\n end",
"def validate_params\n if process_object && process_object[\"required_params\"]\n process_object[\"required_params\"].each do |param|\n if !params_hash.has_key?(param)\n errors.add(:params, \"Step: #{step} - Missing mandatory param #{param}\")\n end\n end\n end\n end",
"def check_required_params\n errors = required_params.map { |param, value| raise param_errors[param] if value.nil? }.compact\n raise errors.joins('; ') unless errors.empty?\n end",
"def validate\n \n raise ArgumentError, \"Params emtpy\" if @params.nil? \n @errors = []\n @errors << 'charge must be provided' if @params.charge.nil? \n @errors << 'currency_code must be provided' if @params.currency_code.nil? \n @errors << 'order_id must be provided' if @params.order_id.nil? \n @errors << 'order must be provided' if @params.order.nil? \n @errors << 'order.id must be provided' if @params.order.id.nil? \n @errors << 'order.total must be provided' if @params.order.total.nil? \n @errors << 'order.shipping_value must be provided' if @params.order.shipping_value.nil? \n @errors << 'order.tax must be provided' if @params.order.tax.nil? \n @errors << 'order detail must be provided' unless @params.order.detail.length > 0 \n\n validate_item_details @params.order.detail if @params.order.detail.length > 0 \n\n raise ZipMoney::RequestError.new(\"Following error(s) occurred while making request, please resolve them to make the request: #{@errors}\") if @errors.any?\n end",
"def validate_request\n if @parsing_error\n return [400, \"Parsing error: #{@parsing_error}\"]\n elsif !@request_body || @request_body.empty?\n return [400, 'Request body is empty.']\n end\n\n return []\n end",
"def valid_params_request?; end",
"def validate_query_params\n errors = [].then(&method(:validate_query_param_keys_clause))\n .then(&method(:validate_include_clause))\n .then(&method(:validate_fields_clause))\n .then(&method(:validate_filters_clause))\n\n if errors.present?\n render json: serialize_errors(errors), status: :bad_request\n end\n end",
"def validate_required_params(required_param)\n return unless request.query_parameters[required_param].blank?\n\n render json: { error: \"'#{required_param}' query parameter is required\" },\n status: :bad_request\n end",
"def validate_required(*required_parameters)\n if self[:ensure] == :present\n required_parameters.each do |req_param|\n raise ArgumentError, \"parameter '#{req_param}' is required\" if self[req_param].nil?\n end\n end\n end",
"def validate_required(*required_parameters)\n if self[:ensure] == :present\n required_parameters.each do |req_param|\n raise ArgumentError, \"parameter '#{req_param}' is required\" if self[req_param].nil?\n end\n end\n end",
"def validate_required(*required_parameters)\n if self[:ensure] == :present\n required_parameters.each do |req_param|\n raise ArgumentError, \"parameter '#{req_param}' is required\" if self[req_param].nil?\n end\n end\n end",
"def validate!\n REQUIRED_PARAMETERS.each do |name|\n if params[name].empty?\n raise(BuildRequestError, \"Vocalware: Parameter #{name} is required\")\n end\n end\n end",
"def validate_params_present!\n raise ArgumentError, \"Please provide one or more of: #{ACCEPTED_PARAMS}\" if params.blank?\n end",
"def validate\n missing_parameters = []\n required_fields.each do |param|\n missing_parameters << param.to_s unless self.send(param)\n end\n raise RTurk::MissingParameters, \"Parameters: '#{missing_parameters.join(', ')}'\" unless missing_parameters.empty?\n end",
"def requires!\n @required_params.each do |param| \n key = (param.is_a?(Array) ? param.first : param)\n verify_required_param(key)\n end\n end",
"def validate_params(params)\n # This will be implemented by Validators which take parameters\n end",
"def validate_params(params)\n errors = []\n errors << if params.key?('asking_price') && params.key?('down_payment')\n validate(asking_price: params['asking_price'], down_payment: params['down_payment']) do |val_errors|\n val_errors << validate_minimum_down_payment(params['asking_price'], params['down_payment'])\n end\n end\n\n errors << if params.key?('payment_schedule')\n validate(payment_schedule: params['payment_schedule']) do |val_errors|\n val_errors << validate_payment_schedule_types(params['payment_schedule'])\n end\n end\n\n errors << if params.key?('amortization_period')\n validate(amortization_period: params['amortization_period']) do |val_errors|\n val_errors << validate_amortization_period(params['amortization_period'])\n end\n end\n\n errors << if params.key?('payment_amount')\n validate(payment_amount: params['payment_amount'])\n end\n\n errors << if params.key?('interest_rate')\n validate(interest_rate: params['interest_rate'])\n end\n\n errors = errors.flatten.compact\n errors.blank? ? [] : \"Validation failed: #{errors.join(', ')}\"\n end",
"def valid_params_request?\n true\n end",
"def valid_params_request?\n true\n end",
"def validate_params\n @calls << [:validate_params]\n end",
"def validate_required\n [\n :project_name,\n :status,\n :requester_id,\n :subject_expert_id,\n :sponsor_id,\n :vision,\n :goal,\n :description,\n :scope,\n :advice_required,\n :program_id,\n :train_id,\n :funding_method,\n :cost_center,\n :funding_status,\n :budget_allocated,\n :priority,\n :start_date,\n :end_date,\n :risk_rating,\n :risks,\n :projected_revenue,\n ].each do |field|\n if self.attributes[field.to_s].nil? || self.attributes[field.to_s].blank?\n # intentionally vague!\n add_validation 'All fields are required to perform further validations'\n return false\n end\n end\n true\n end",
"def valid_request object, params\n object.attributes = params\n unless object.valid?\n errors = Hash.new\n object.errors.messages.each do |k, v|\n errors = errors.merge({k => v[0]})\n end\n render :json => {:code => 102, :type => 'invalid_parameters', :parameters => errors}, :status => 400, :method => :get\n return false\n end\n object.save\n return object\n end",
"def required_params_present(params, * parameters)\n errors = []\n if params.present?\n parameters.each do |param|\n if params[param].blank?\n errors << \"#{param.to_s}\" if errors.any?\n errors << \"parameter missing: #{param.to_s}\" if errors.empty?\n end\n end\n else\n errors << \"parameters missing\"\n end\n [errors.blank? ? true : false, errors]\n end",
"def validate\n unless (e = errors).empty?\n raise InvalidRequestError, e.first\n end\n end",
"def validate_params!\n self.params ||= Hash.new\n self.class.instance_variable_get(:@__required_params).each do |e|\n raise ArgumentError, \"Insufficient parameters set (#{e} not supplied)\" if self.params[e].nil?\n end\n end",
"def params_validation\n errors = validate_params(params)\n return json_response(errors, :unprocessable_entity) if errors.present?\n end",
"def validate\n # perform presence related validations here\n # result object is returned\n service_params_list = ServicesBase.get_service_params(self.class.to_s)\n missing_mandatory_params = []\n service_params_list[:mandatory].each do |mandatory_param|\n missing_mandatory_params << \"missing_#{mandatory_param}\" if @params[mandatory_param].to_s.blank?\n end if service_params_list[:mandatory].present?\n\n return error_with_identifier('mandatory_params_missing',\n 'sb_1',\n missing_mandatory_params\n ) if missing_mandatory_params.any?\n\n success\n end",
"def assert_required_params params, required_params\n missing_params = []\n required_params.each do |p|\n missing_params << p if params[p].blank?\n end\n\n raise MissingParams.new(missing_params) if missing_params.any?\n end",
"def all_required(data, fields)\t\t\n\t\tif fields.nil? == true\n\t\t\treturn true\n\t\tend\n\t\t@api_errmsg = Array.new\n\t\tfields = fields.split(',')\n\t\tflag = true\n\t\tfields.each do |name|\n\t\t\tif data[name].nil?\n\t\t\t @api_errmsg.push(name)\n\t\t\t flag = false\n\t\t\tend\n\t\tend\n\t\tif flag == true\n\t\t return true\n\t\tend\n\t\treturn false\n\tend",
"def required_fields\n if self.controller_name == \"registrations\"\n param_name = \"user\"\n elsif self.controller_name == \"merchants\"\n param_name = \"merchant\"\n else\n return\n end\n empty_fields = Array.new\n empty = false\n params[param_name].each_pair do |k, v|\n if v == \"\"\n empty_fields << k.gsub(\"_\", \" \")\n empty = true\n end\n end\n if empty == true\n (0..empty_fields.length - 3).each do |i|\n empty_fields[i] << \",\"\n end\n empty_fields.insert(-2, \"and\") unless empty_fields.length < 2\n field_list = empty_fields.join(\" \")\n message = \"You cannot leave empty fields. The field\" \n if empty_fields.length > 1\n message << \"s \"\n else\n message << \" \"\n end\n message << field_list \n if empty_fields.length > 1\n message << \" were left blank.\"\n else\n message << \" was left blank.\"\n end\n flash[:notice] = message\n redirect_to request.referrer\n else\n return\n end\n end",
"def _validate_presence_of(*params)\n\t\tparams.each do |param|\n\t\t\traise ArgumentError, PRESENCE_REQUESTED if param.nil?\n\t\tend\n\tend",
"def validate_params(params, url)\n missing = []\n params.keys.each do |p|\n if @required_config[get_current_url] and @required_config[get_current_url].keys.include? p\n if params[p] == \"\"\n missing << @required_config[get_current_url][p]\n end\n end\n end\n if missing.any?\n raise \"Parameters #{missing.inspect} must be set to non empty value while posting to #{url}. Please provide.\"\n end\n end",
"def check_params *required\n required.each{|p|\n params[p].strip! if params[p] and params[p].is_a? String\n if !params[p] or (p.is_a? String and params[p].length == 0)\n return false\n end\n }\n true\nend",
"def check_params *required\n required.each{|p|\n params[p].strip! if params[p] and params[p].is_a? String\n if !params[p] or (p.is_a? String and params[p].length == 0)\n return false\n end\n }\n true\nend",
"def validate_parameters\n r = validate_payment_nonce_uuid\n return r unless r.success?\n\n error_identifiers = []\n\n error_identifiers << 'invalid_first_name' if @first_name.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@first_name) || @first_name.length > 255)\n\n error_identifiers << 'invalid_last_name' if @last_name.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@last_name) || @last_name.length > 255)\n\n error_identifiers << 'invalid_company' if @company.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@company) || @company.length > 255)\n\n error_identifiers << 'invalid_email' if @email.present? &&\n (!Util::CommonValidateAndSanitize.is_valid_email?(@email))\n\n\n error_identifiers << 'invalid_phone' if @phone.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@phone) || @phone.length > 255)\n\n error_identifiers << 'invalid_fax' if @fax.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@fax) || @fax.length > 255)\n\n error_identifiers << 'invalid_website' if @website.present? &&\n (!Util::CommonValidateAndSanitize.is_valid_domain?(@website) || @website.length > 255)\n\n\n return error_with_identifier('invalid_api_params',\n 'ra_c_c_vp_1',\n error_identifiers\n ) if error_identifiers.present?\n\n @customer_details[:first_name] = @first_name if @first_name.present?\n @customer_details[:last_name] = @last_name if @last_name.present?\n @customer_details[:company] = @company if @company.present?\n @customer_details[:email] = @email if @email.present?\n @customer_details[:phone] = @phone if @phone.present?\n @customer_details[:fax] = @fax if @fax.present?\n @customer_details[:website] = @website if @website.present?\n\n success\n end",
"def validate(params)\n val_errors = []\n params.each do |param, value|\n val_errors << \"missing params #{param}\" if value.blank?\n end\n yield(val_errors) if block_given? && val_errors.blank?\n val_errors.compact\n end",
"def wrong_params?\n if has_not_mandatory_params?\n render json: { message: \"Wrong data params\" }, status: 400\n end\n end",
"def validate_parameters\n if (latitude.to_f == 0.0) || (longitude.to_f == 0.0)\n render :status=>401,\n :json=>{:Message=>\"The latitude and longitude parameters should be float values.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if (location_lock != \"true\") || (location_lock != \"false\")\n render :status=>401,\n :json=>{:Message=>\"The location_lock should be either true or false.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if proximity.to_i == 0\n render :status=>401,\n :json=>{:Message=>\"The proximity should be an integer.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if page.to_i == 0\n render :status=>401,\n :json=>{:Message=>\"The page should be an integer.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n end",
"def check_requirements(request)\n valid = true\n keys = @event[\"required\"].keys\n keys.each { |k| valid = equal_pair(k, request) if valid != false }\n valid\n end",
"def validate_required_params\n required_params.each do |param|\n unless options.send(param)\n error_msg = \"omniauth-dice error: #{param} is required\"\n fail RequiredCustomParamError, error_msg\n end\n end\n end",
"def missing_mandatory_params?(params)\n mandatory_params.each { |mandatory_param| @missing_params << mandatory_param if params[mandatory_param].to_s.empty? }\n return !@missing_params.empty?\n end",
"def valid?(required_params)\n required_params.each do |p|\n return false unless @params_map.key?(p)\n end\n true\n end",
"def validate_request \n\t\tval_required='required'\n\t\tdata_val_required='data_required'\n\t\tuser_id=\"\";\n\t\tclient_id=\"\";\n\t\tsession_id=\"\";\n\t\t\n\t\tif(cookies[:user_id])\n\t\t\tuser_id= cookies[:user_id].to_s\n\t\tend\n\t\t\n\t\tif(cookies[:client_id])\n\t\t\tclient_id= cookies[:client_id].to_s\n\t\tend\n\t\t\n\t\tif(cookies[:session_id])\n\t\t\tsession_id= cookies[:session_id].to_s\n\t\tend\n\t\t\n\t\tif client_id.empty? == true || session_id.empty? == true\n\t\t\tlogger.debug \"Client not found for client_id=\" + client_id\n\t\t\tcoockies_render_error('e1011',params[:response_type].to_s) \n\t\t\treturn false\n\t\tend\n\t\t\n\t\t@client=Client.where(pk_client_id: client_id)\t\t\n\t\tif (@client.count<=0)\n\t\t\tlogger.debug \"Client not found for client_id=\" + client_id\n\t\t\tcoockies_render_error('e1011',params[:response_type].to_s) \n\t\t\treturn false\n\t\tend\t\t\t\n\t\t\n\t\t@device_users=DeviceUser.where(fk_client_id: client_id, pk_user_id: user_id, sessionid: session_id) \n\t\t\n\t\tif (@device_users.count<=0)\t\n\t\t\tlogger.debug \"device_users not found for client_id=\" + client_id+ \" and session_id=\" + session_id + \" \"\n\t\t\tcoockies_render_error('e1012',params[:response_type].to_s) \n\t\t\treturn false\n\t\telse\n\t\t\tif @device_users[0][:status_code] == 403\n\t\t\t\tcoockies_render_error('e2203',params[:response_type].to_s) \n\t\t\t\treturn false\n\t\t\tend\n\n\t\t\tif @device_users[0][:status_code] == 402\n\t\t\t\tcoockies_render_error('e2204',params[:response_type].to_s) \n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\n\t\tparams[:user_id]=user_id\n\t\tparams[:client_id]=client_id\n\t\tparams[:session_id]=session_id\n\t\t\n\t\treturn true\n\tend",
"def validate_params\n data = endpoint_params\n errors = []\n errors << 'Invalid verb' if %w[GET POST PATCH DELETE].exclude?(data[:verb])\n # check for valid url\n begin\n URI.parse data[:path]\n rescue URI::InvalidURIError => e\n errors << 'Invalid Path'\n end\n render json: { errors: errors }, status: :unprocessable_entity if errors.present?\n end",
"def validate_params\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n erb.validate(@arguments)\n render json: { success: 'Params look great!' }, status: 200\n end\n end",
"def validate_required_params required_params\n @find_by_ext_id = false\n missing_params = []\n \n required_params.each { |k| \n if k.to_s == \"id\" and !params[:external_id].blank?\n @find_by_ext_id = true\n params[:id] = params[:external_id]\n next\n end\n\n unless params[:criteria].has_key?(k)\n missing_params << k\n end\n }\n \n missing_params\n end",
"def validate_request!\n validate_accounts_presence!\n validate_account_funds!\n\n transaction_create_model.validate!\n end",
"def validate_params\n validate_size\n validate_mine_density\n validate_first_click\n type_specific_checks\n end",
"def ensure_par(req, msg = '%<name>s is mandatory: please provide %<flag>s')\n req.each do |k, v|\n raise (msg % { name: k, flag: v }) if self[k].nil?\n end\n end",
"def invalid_params?\n @invalid_params.keys.length == 0\n end",
"def validate!\n required_attributes.each do |attribute|\n if form_data[attribute].nil? || form_data[attribute].empty?\n raise Adyen::REST::RequestValidationFailed, \"#{attribute} is empty, but required!\"\n end\n end\n end",
"def validate_create_params!(params); end",
"def oAuthValidate\r\n logger.info(\"UserController::oAuthValidate::Params:----#{params}\")\r\n \r\n end",
"def validate_params?\n true # TODO: add validation\n end",
"def valid?\n @errors = []\n @errors << 'unique_id is required' if @unique_id.nil? && @response_type.eql?('NVP')\n @errors << 'developer_id is required' if @developer_id.nil? && @response_type.eql?('JSON')\n @errors << 'app_key is required' if @app_key.nil?\n @errors << 'cmd is required' if @cmd.nil?\n @errors << 'response_type is required' if @response_type.nil?\n @errors.empty?\n end",
"def has_required_http_params?(param_hash)\n # Note: The blank? method is a Rails extension.\n # Specific keys have to be present, and their values\n # must not be blank.\n if !param_hash[:filename].blank? &&\n !param_hash[:assignment].blank? &&\n !param_hash[:group_name].blank?\n return true\n else\n return false\n end\n end",
"def validate_params\n if lat.blank? || lng.blank? || property_type.blank? || offer_type.blank?\n @properties = []\n @message = \"Looks like some search parameters are missing!\"\n fail!(:validation_failed) && abort!\n end\n end",
"def required_fields\n # \"cid\" is not required\n [\n \"byr\",\n \"ecl\",\n \"eyr\",\n \"hcl\",\n \"hgt\",\n \"iyr\",\n \"pid\",\n ]\nend",
"def validate_registeration_params\n\n return success if @client_token.registration_done?\n\n @airdrop_amount = @airdrop_amount.present? ? BigDecimal.new(@airdrop_amount) : @airdrop_amount\n @ost_to_bt = @ost_to_bt.present? ? BigDecimal.new(@ost_to_bt) : @ost_to_bt\n @number_of_users = @number_of_users.to_i\n\n return error_with_data(\n 'e_sam_8',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if @ost_to_bt.blank? || @bt_to_mint < 0\n\n return error_with_data(\n 'e_sam_11',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if GlobalConstant::Base.sandbox_sub_environment? &&\n (@number_of_users < 0 || @airdrop_amount.blank? || @airdrop_amount < 0 || @airdrop_user_list_type.blank?)\n\n success\n\n end",
"def require_params(param_name_array, params)\n param_name_array = [param_name_array] unless param_name_array.is_a? Array\n\n param_name_array.each do |param_names|\n param_names = [param_names] unless param_names.is_a?(Array)\n\n param_found = false\n param_names.each do |param_name|\n if params[param_name]\n param_found = true\n break\n end\n end\n\n unless param_found\n raise ArgumentError, \"#{param_names.join(' or ')} must be provided\"\n end\n end\n end",
"def validate_headers(headers, * parameters)\n errors = []\n if headers.present?\n parameters.each do |param|\n if headers[param].blank?\n @api_response[:code] = @response_codes['insufficient_headers']\n errors << \"#{param.to_s}\" if errors.any?\n errors << \"header missing: #{param.to_s}\" if errors.empty?\n end\n end\n else\n errors << \"headers missing\"\n end\n [errors.blank? ? true : false, errors]\n end",
"def check_required_fields(data)\r\n @field_names[1..-1].each do |f|\r\n raise(ArgumentError,\r\n 'A value for this field is required: %s' % f) if \\\r\n @field_requireds[@field_names.index(f)] and data[f].nil? \r\n end\r\n end",
"def validate( params=nil, additional_constraints=nil )\n\t\tself.log.debug \"Validating.\"\n\t\tself.reset\n\n\t\t# :TODO: Handle the additional_constraints\n\n\t\tparams ||= @fields\n\t\tparams = stringify_keys( params )\n\t\t@fields = deep_copy( params )\n\n\t\tself.log.debug \"Starting validation with fields: %p\" % [ @fields ]\n\n\t\t# Use the constraints list to extract all the parameters that have corresponding\n\t\t# constraints\n\t\tself.constraints.each do |field, constraint|\n\t\t\tself.log.debug \" applying %s to any %p parameter/s\" % [ constraint, field ]\n\t\t\tvalue = params.delete( field.to_s )\n\t\t\tself.log.debug \" value is: %p\" % [ value ]\n\t\t\tself.apply_constraint( constraint, value )\n\t\tend\n\n\t\t# Any left over are unknown\n\t\tparams.keys.each do |field|\n\t\t\tself.log.debug \" unknown field %p\" % [ field ]\n\t\t\t@unknown << field\n\t\tend\n\n\t\t@validated = true\n\tend",
"def validate_request(request)\n raise Errors::InvalidRequestError.new(\"Improperly formatted Request (expected `Hash', got `#{request.class}')\") unless request && request.is_a?(Hash)\n raise Errors::InvalidRequestError.new(\"Missing `method' Request object member\") unless request['method']\n end",
"def check_params\n # For each key,value in GLOBAL VAR **PARAMS**.\n PARAMS.each do |param, method|\n # Next if there isn't param in the request of client\n next unless params[param]\n # Check the *param* with *method*\n unless send(method, params[param])\n @error_object = \"Param #{param} is wrong, #{method} failed\"\n return false\n end\n end\n true\n end",
"def required(*params)\n @required = params unless params.empty?\n @required ||= []\n end",
"def validate_params\n if command == 'PLACE'\n if params.kind_of?(Array)\n errors[:params] << '[PLACE] Must be three params' unless params.size == 3\n validate_coords\n validate_direction\n else\n errors[:params] << '[PLACE] Not valid params'\n end\n end\n end",
"def is_invalid_request?(params) # :nodoc:\n # Minimal test: ensure signature exists.\n if not params[:signature]\n return api_response(:invalid_signature)\n end\n\n # Validate package, and get secret\n if not params[:package_id]\n return api_response(:not_authorized)\n end\n\n packages = Package.where(:package_id => params[:package_id])\n if packages.length != 1\n return api_response(:not_authorized)\n end\n\n secret = packages[0].secret\n\n # Clone parameters for creating the signature. Then remove stuff we don't\n # want to see in the signature.\n cloned = Marshal::load(Marshal.dump(params))\n cloned.delete(:controller)\n cloned.delete(:action)\n cloned.delete(:signature)\n\n # Check signature\n signature = create_signature(cloned, secret)\n if not signature == params[:signature]\n return api_response(:invalid_signature, { :signature => signature })\n end\n end",
"def check_params; true; end",
"def is_valid(params)\n i = 0\n while params.length > i\n p params[i]\n if params[i] == nil || params[i] == \"\"\n session[:error] = \"You missed a parameter! Try again.\"\n redirect('/error')\n end\n i += 1\n end\n end",
"def test_validate_required_param_test()\n # Parameters for the API call\n model = Validate.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"farhan\",\"field\":\"QA\"}'\n ))\n option = '...'\n\n # Perform the API call through the SDK function\n result = @controller.validate_required_parameter(model, option: option)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def has_missing_params?(required_params)\n required_params.each do |param|\n return true if params[param].blank?\n end\n false\n end",
"def validateParams \r\n\t \r\n\t \tif [email protected]? && [email protected]? && [email protected]?\r\n\t\t\treturn true\r\n\t \telse\r\n\t\t\treturn false \t\r\n\t \tend\r\n\t \t\r\n\t end",
"def validate!\n raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?\n end",
"def validate!\n raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?\n end",
"def validate_paramters\n raise Scorekeeper::MissingParameterException if @income.nil? || @zipcode.nil? || @age.nil?\n end",
"def require_params(*list, &block)\n missing = []\n list.each { |p| missing << p if params[p].blank? }\n \n if missing.empty?\n yield if block\n else \n render :json=>{:error => \"missing parameter(s): #{missing.join(', ')}\"}, :status=>412\n end\n end",
"def validate_required_fields\n user = new_record? ? author : current_journal.try(:user)\n\n required_attribute_names(user).each do |attribute|\n if /^\\d+$/.match?(attribute)\n attribute = attribute.to_i\n v = custom_field_values.detect {|v| v.custom_field_id == attribute}\n if v && Array(v.value).detect(&:present?).nil?\n errors.add(v.custom_field.name, l('activerecord.errors.messages.blank'))\n end\n else\n if respond_to?(attribute) && send(attribute).blank? && !disabled_core_fields.include?(attribute)\n next if attribute == 'category_id' && project.try(:issue_categories).blank?\n next if attribute == 'fixed_version_id' && assignable_versions.blank?\n\n #####\n # START PATCH\n next if attribute == 'typology_id' && !project.module_enabled?('typologies')\n next if attribute == 'typology_id' && project.typologies.blank?\n # END PATCH\n #####\n\n errors.add attribute, :blank\n end\n end\n end\n end",
"def valid_params?; end",
"def required_params?\n @unincluded_params = []\n\n required_params.each do |param|\n unless params.include?(param)\n unincluded_params << param\n end\n end\n\n unincluded_params.empty?\n end",
"def required_attributes!(keys)\n keys.each do |key|\n bad_request!(key) unless params[key].present?\n end\n end",
"def required_attributes!(keys)\n keys.each do |key|\n bad_request!(key) unless params[key].present?\n end\n end",
"def check_params\n true\n end",
"def validate_request_and_error(request, response_error, resource_prefix)\n request_id = validate_request(request, resource_prefix)\n validate_error(response_error, request_id)\nend",
"def validate(params) #:nodoc:\n recognized_keys = validate_children(params)\n unexpected_keys = params.keys - recognized_keys\n if parent.nil?\n # Only ignore the standard params at the top level.\n unexpected_keys -= settings[:ignore_params]\n end\n unless unexpected_keys.empty?\n # kinda hacky to get it to display correctly\n unless settings[:ignore_unexpected]\n basename = canonical_name\n canonicals = unexpected_keys.sort.collect{|k| basename.empty? ? k : basename + \"[#{k}]\"}.join(', ')\n s = unexpected_keys.length == 1 ? '' : 's'\n raise UnexpectedParam, \"Request included unexpected parameter#{s}: #{canonicals}\"\n end\n unexpected_keys.each{|k| params.delete(k)} if settings[:remove_unexpected]\n end\n end",
"def is_valid(params)\n i = 0\n while params.length > i\n p params[i]\n if params[i] == nil || params[i] == \"\"\n session[:error] = \"Du missade en parameter! Försök igen.\"\n redirect('/error')\n end\n i += 1\n end\n end",
"def valid_input?\n size = 1\n permited_params.keys.each do |key|\n @errors << \"#{permited_params[key]} is blank\" if permited_params[key].empty?\n size += 1\n end\n @errors << 'to, to_name, from, from_name, subject, body params are required' if size == 6\n @errors << 'to is not a valid email' unless valid_email?(permited_params['to'])\n @errors << 'from is not a valid email' unless valid_email?(permited_params['from'])\n\n return @errors.blank?\n end",
"def validate_parameters params = {}\n params.symbolize_keys!\n params.delete(:db) unless DBS.include?(params[:db].try(:to_sym))\n params.delete(:report_type) unless REPORT_TYPES.include?(params[:report_type].try(:to_sym))\n params.delete(:request_type) unless REQUEST_TYPES.include?(params[:request_type].try(:to_sym))\n @parameters = {:db => \"us\", :api_key => Semrush.api_key, :limit => \"\", :offset => \"\", :export_columns => \"\", :display_sort => \"\", :display_filter => \"\", :display_date => \"\"}.merge(@parameters).merge(params)\n raise Semrush::Exception::Nolimit.new(self, \"The limit parameter is missing: a limit is required.\") unless @parameters[:limit].present? && @parameters[:limit].to_i>0\n raise Semrush::Exception::BadArgument.new(self, \"Request parameter is missing: Domain name, URL, or keywords are required.\") unless @parameters[:request].present?\n raise Semrush::Exception::BadArgument.new(self, \"Bad db: #{@parameters[:db]}\") unless DBS.include?(@parameters[:db].try(:to_sym))\n raise Semrush::Exception::BadArgument.new(self, \"Bad report type: #{@parameters[:report_type]}\") unless REPORT_TYPES.include?(@parameters[:report_type].try(:to_sym))\n raise Semrush::Exception::BadArgument.new(self, \"Bad request type: #{@parameters[:request_type]}\") unless REQUEST_TYPES.include?(@parameters[:request_type].try(:to_sym))\n end",
"def validate params\n validate_params(params)\n validate_coordinates\n validate_color\n validate_dimension\n end",
"def validate params\n validate_params(params)\n validate_dimension\n end",
"def validate_mandatory_fields\n validate_for_card unless self.cc_number.blank?\n validate_for_transaction_tag unless self.transaction_tag.blank?\n validate_for_track1 unless self.track1.blank?\n validate_for_track2 unless self.track2.blank?\n end",
"def validate_request(call)\n call.validate_request\n end",
"def validate\n @errors = JSON::Validator.fully_validate(\n schema, params,\n errors_as_objects: true\n )\n @errors.empty?\n end",
"def verify_request_components options = {}\n if options[:request]\n if options[:request].is_a?(Faraday::Request) || options[:request].is_a?(Array)\n request = options[:request]\n elsif options[:adapter]\n request = options[:adapter].adapt_request options[:request]\n end\n method = request.method\n uri = request.path\n headers = request.headers\n body = request.body\n else\n method = options[:method] || :get\n uri = options[:uri]\n headers = options[:headers] || []\n body = options[:body] || \"\"\n end\n\n headers = headers.to_a if headers.is_a? Hash\n method = method.to_s.upcase\n\n request_components = {\n method: method,\n uri: uri,\n headers: headers\n }\n\n # Verify that we have all the pieces required to validate the HTTP request\n request_components.each do |(key, value)|\n raise ArgumentError, \"Missing :#{key} parameter.\" unless value\n end\n request_components[:body] = body\n request_components\n end",
"def validate_review_completed_parameters(params)\n raise MissingTransactionId if params[\"id\"].to_s.length == 0\n raise InvalidTransactionId if !validate_transaction_id(params[\"id\"])\n\n raise MissingAnalystId if params[\"analyst_id\"].to_s.length == 0\n raise InvalidAnalystId if !validate_analyst_id(params[\"analyst_id\"])\n raise MissingAnalystFullname if params[\"analyst_fullname\"].to_s.length == 0\n raise InvalidAnalystFullname if !validate_analyst_fullname(params[\"analyst_fullname\"])\n\n raise MissingAnalystApprovalDate if params[\"analyst_approval_datetime\"].to_s.length == 0\n raise InvalidAnalystApprovalDate if !validate_date(params[\"analyst_approval_datetime\"])\n raise MissingAnalystTransactionId if params[\"analyst_transaction_id\"].to_s.length == 0\n raise MissingAnalystInternalStatusId if params[\"analyst_internal_status_id\"].to_s.length == 0\n raise MissingAnalystDecisionCode if params[\"decision_code\"].to_s.length == 0\n raise InvalidAnalystDecisionCode if !validate_decision_code(params[\"decision_code\"])\n return params\n end",
"def missing_param_errors\n\t\treturn self.missing.collect do |field|\n\t\t\tconstraint = self.constraints[ field.to_sym ] or\n\t\t\t\traise NameError, \"no such field %p!\" % [ field ]\n\t\t\t\"Missing value for '%s'\" % [ constraint.description ]\n\t\tend\n\tend",
"def validate?(params)\n _validate?(params)\n end"
] | [
"0.7173365",
"0.7128832",
"0.71212465",
"0.7113148",
"0.70267826",
"0.6999069",
"0.69359785",
"0.67092156",
"0.6673708",
"0.65883684",
"0.65700966",
"0.65494776",
"0.6549366",
"0.6549366",
"0.65255815",
"0.6474811",
"0.646544",
"0.6448392",
"0.64151627",
"0.64083606",
"0.6392278",
"0.6392278",
"0.63883156",
"0.6326875",
"0.63078105",
"0.62409127",
"0.62271076",
"0.62247044",
"0.62152886",
"0.6211165",
"0.6178028",
"0.6175812",
"0.61649716",
"0.6151024",
"0.6146758",
"0.61462235",
"0.6145859",
"0.61344427",
"0.61045516",
"0.6092223",
"0.6088572",
"0.6085059",
"0.6077112",
"0.6063742",
"0.60581297",
"0.60477024",
"0.6047149",
"0.604703",
"0.6043512",
"0.6008975",
"0.6001445",
"0.59680665",
"0.59550756",
"0.59142184",
"0.5895362",
"0.5890648",
"0.58842504",
"0.58712375",
"0.5866492",
"0.58587533",
"0.5848091",
"0.5822662",
"0.58157134",
"0.5815311",
"0.5804069",
"0.5801931",
"0.58017313",
"0.579604",
"0.57951295",
"0.57934177",
"0.5776403",
"0.57744336",
"0.5770731",
"0.5769218",
"0.57536465",
"0.5749694",
"0.5739543",
"0.5739543",
"0.5734201",
"0.5732844",
"0.5729397",
"0.5720217",
"0.5711819",
"0.5700509",
"0.5700509",
"0.56950015",
"0.56771517",
"0.5668461",
"0.56607777",
"0.5655418",
"0.56538403",
"0.56494945",
"0.5643113",
"0.5643012",
"0.56368583",
"0.563356",
"0.56238306",
"0.560018",
"0.5575897",
"0.5574556"
] | 0.6907541 | 7 |
This function validates the mandatory fields in the response.. Args : +responseParams+ > the response parameter Returns : +errorArray+ > the error code | def validateResponseParam(responseParams = {})
if responseParams[:pRes].blank? || isBlankOrNull(responseParams[:pRes])
return BLANK_PG_RESPONSE
end
if responseParams[:pEncKey].blank? || isBlankOrNull(responseParams[:pEncKey])
return INVALID_KEY
end
if responseParams[:pEncIv].blank? || isBlankOrNull(responseParams[:pEncIv]) || responseParams[:pEncIv].length < 16
return INVALID_IV
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_endpoint_response\n begin\n return if response.nil?\n res = JSON.parse(response)\n \n if res[\"code\"].present?\n errors.add(:response, 'response code must have value of data type integer') if !res[\"code\"].is_a? Integer\n else\n errors.add(:response, \"response code can't be blank\") \n end\n\n if res[\"headers\"].present?\n isValid = true\n res[\"headers\"].each do | key, value |\n isValid = (value.instance_of? String)? true : false\n errors.add(:response, \"response headers attributes: #{key} must have value of data type string\") if !isValid\n end\n end\n\n if res[\"body\"].present?\n isValid = true\n isValid = (res[\"body\"].instance_of? String)? true : false\n errors.add(:response, \"response body value must be of data type string\") if !isValid \n end\n rescue JSON::ParserError => e\n errors[response.to_s] << \"is not valid JSON\" \n end\n end",
"def validate(response)\n raw_validate response\n\n response.parsed_response\n end",
"def valid?\n @errors = []\n @errors << 'unique_id is required' if @unique_id.nil? && @response_type.eql?('NVP')\n @errors << 'developer_id is required' if @developer_id.nil? && @response_type.eql?('JSON')\n @errors << 'app_key is required' if @app_key.nil?\n @errors << 'cmd is required' if @cmd.nil?\n @errors << 'response_type is required' if @response_type.nil?\n @errors.empty?\n end",
"def validate\n # perform presence related validations here\n # result object is returned\n service_params_list = ServicesBase.get_service_params(self.class.to_s)\n missing_mandatory_params = []\n service_params_list[:mandatory].each do |mandatory_param|\n missing_mandatory_params << \"missing_#{mandatory_param}\" if @params[mandatory_param].to_s.blank?\n end if service_params_list[:mandatory].present?\n\n return error_with_identifier('mandatory_params_missing',\n 'sb_1',\n missing_mandatory_params\n ) if missing_mandatory_params.any?\n\n success\n end",
"def validate_response!(response)\n raise \"empty response\" unless response\n\n status = response[\"stat\"]\n if status and status != \"ok\"\n error = response[\"err\"]\n if error\n raise RequestFailed, \"#{error[\"code\"]}: #{error[\"msg\"]}, explanation: #{error[\"expl\"]}\"\n else\n raise RequestFailed, \"Error: #{status}, no error message\"\n end\n end\n end",
"def check_response\n errors.add(:base, :invalid) unless response.present? && response[\"res\"] == 1\n end",
"def validate(response, opt = {})\n\n unless opt[:body_only]\n if @definition['status'] != response.status\n return [\"Invalid status: expected #{@definition['status']} but got #{response.status}\"]\n end\n\n unless @definition['headers'].normalize_keys.subset_of?(response.headers.normalize_keys)\n return [\"Invalid headers: expected #{@definition['headers'].inspect} to be a subset of #{response.headers.inspect}\"]\n end\n end\n\n if @definition['body']\n if @definition['body']['type'] && @definition['body']['type'] == 'string'\n validate_as_pure_string response.body\n else\n response.respond_to?(:body) ? validate_as_json(response.body) : validate_as_json(response)\n end\n else\n []\n end\n end",
"def validate(response)\n case response.code\n when 400 then fail(Error::BadRequest.new, error_message(response))\n when 401 then fail(Error::Unauthorized.new, error_message(response))\n when 403 then fail(Error::Forbidden.new, error_message(response))\n when 404 then fail(Error::NotFound.new, error_message(response))\n when 405 then fail(Error::MethodNotAllowed.new, error_message(response))\n when 409 then fail(Error::Conflict.new, error_message(response))\n when 500 then fail(Error::InternalServerError.new, error_message(response))\n when 502 then fail(Error::BadGateway.new, error_message(response))\n when 503 then fail(Error::ServiceUnavailable.new, error_message(response))\n end\n response.parsed_response\n end",
"def validate(response)\n case response.code\n when 400; raise Error::BadRequest.new error_message(response)\n when 401; raise Error::Unauthorized.new error_message(response)\n when 403; raise Error::Forbidden.new error_message(response)\n when 404; raise Error::NotFound.new error_message(response)\n when 405; raise Error::MethodNotAllowed.new error_message(response)\n when 409; raise Error::Conflict.new error_message(response)\n when 500; raise Error::InternalServerError.new error_message(response)\n when 502; raise Error::BadGateway.new error_message(response)\n when 503; raise Error::ServiceUnavailable.new error_message(response)\n end\n\n response.parsed_response\n end",
"def validate_parameters\n r = validate_payment_nonce_uuid\n return r unless r.success?\n\n error_identifiers = []\n\n error_identifiers << 'invalid_first_name' if @first_name.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@first_name) || @first_name.length > 255)\n\n error_identifiers << 'invalid_last_name' if @last_name.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@last_name) || @last_name.length > 255)\n\n error_identifiers << 'invalid_company' if @company.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@company) || @company.length > 255)\n\n error_identifiers << 'invalid_email' if @email.present? &&\n (!Util::CommonValidateAndSanitize.is_valid_email?(@email))\n\n\n error_identifiers << 'invalid_phone' if @phone.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@phone) || @phone.length > 255)\n\n error_identifiers << 'invalid_fax' if @fax.present? &&\n (!Util::CommonValidateAndSanitize.is_string?(@fax) || @fax.length > 255)\n\n error_identifiers << 'invalid_website' if @website.present? &&\n (!Util::CommonValidateAndSanitize.is_valid_domain?(@website) || @website.length > 255)\n\n\n return error_with_identifier('invalid_api_params',\n 'ra_c_c_vp_1',\n error_identifiers\n ) if error_identifiers.present?\n\n @customer_details[:first_name] = @first_name if @first_name.present?\n @customer_details[:last_name] = @last_name if @last_name.present?\n @customer_details[:company] = @company if @company.present?\n @customer_details[:email] = @email if @email.present?\n @customer_details[:phone] = @phone if @phone.present?\n @customer_details[:fax] = @fax if @fax.present?\n @customer_details[:website] = @website if @website.present?\n\n success\n end",
"def all_required(data, fields)\t\t\n\t\tif fields.nil? == true\n\t\t\treturn true\n\t\tend\n\t\t@api_errmsg = Array.new\n\t\tfields = fields.split(',')\n\t\tflag = true\n\t\tfields.each do |name|\n\t\t\tif data[name].nil?\n\t\t\t @api_errmsg.push(name)\n\t\t\t flag = false\n\t\t\tend\n\t\tend\n\t\tif flag == true\n\t\t return true\n\t\tend\n\t\treturn false\n\tend",
"def validate(response, opt = {})\n\n unless opt[:body_only]\n status, _description = response.status\n if @definition['status'] != status\n return [\"Invalid status: expected #{@definition['status']} but got #{status}\"]\n end\n\n headers_to_validate = @definition['headers'].dup\n expected_location = headers_to_validate.delete 'Location'\n unless headers_to_validate.normalize_keys.subset_of?(response.headers.normalize_keys)\n return [\"Invalid headers: expected #{@definition['headers'].inspect} to be a subset of #{response.headers.inspect}\"]\n end\n\n if expected_location\n location_template = Addressable::Template.new(expected_location)\n location = response.headers['Location']\n if location.nil?\n return ['Expected a Location Header in the response']\n elsif !location_template.match(Addressable::URI.parse(location))\n return [\"Location mismatch: expected URI #{location} to match URI Template #{location_template.pattern}\"]\n end\n end\n end\n\n if @definition['body']\n if @definition['body']['type'] && @definition['body']['type'] == 'string'\n validate_as_pure_string response.body\n else\n response.respond_to?(:body) ? validate_as_json(response.body) : validate_as_json(response)\n end\n else\n []\n end\n end",
"def validate(response)\n unless response.code == 200\n message = response.parsed_response\n message = message['error'] if message.respond_to?(:has_key?) and message.has_key?('error')\n message = message['message'] if message.respond_to?(:has_key?) and message.has_key?('message')\n raise RequestError.new(message, response.code)\n end\n\n response\n end",
"def params_validation\n errors = validate_params(params)\n return json_response(errors, :unprocessable_entity) if errors.present?\n end",
"def validate\n \n raise ArgumentError, \"Params emtpy\" if @params.nil? \n @errors = []\n @errors << 'charge must be provided' if @params.charge.nil? \n @errors << 'currency_code must be provided' if @params.currency_code.nil? \n @errors << 'order_id must be provided' if @params.order_id.nil? \n @errors << 'order must be provided' if @params.order.nil? \n @errors << 'order.id must be provided' if @params.order.id.nil? \n @errors << 'order.total must be provided' if @params.order.total.nil? \n @errors << 'order.shipping_value must be provided' if @params.order.shipping_value.nil? \n @errors << 'order.tax must be provided' if @params.order.tax.nil? \n @errors << 'order detail must be provided' unless @params.order.detail.length > 0 \n\n validate_item_details @params.order.detail if @params.order.detail.length > 0 \n\n raise ZipMoney::RequestError.new(\"Following error(s) occurred while making request, please resolve them to make the request: #{@errors}\") if @errors.any?\n end",
"def validate\n raise ArgumentError, \"Params emtpy\" if @params.nil? \n @errors = []\n @errors << 'reason must be provided' if @params.reason.nil? \n @errors << 'txn_id must be provided' if @params.txn_id.nil? \n @errors << 'order.id must be provided' if @params.order.id.nil? \n @errors << 'order.total must be provided' if @params.order.total.nil? \n @errors << 'order.shipping_value must be provided' if @params.order.shipping_value.nil? \n @errors << 'order.tax must be provided' if @params.order.tax.nil? \n\n raise ZipMoney::RequestError.new(\"Following error(s) occurred while making request, please resolve them to make the request: #{@errors}\") if @errors.any?\n end",
"def test_validate_required_param_test()\n # Parameters for the API call\n model = Validate.from_hash(APIHelper.json_deserialize(\n '{\"name\":\"farhan\",\"field\":\"QA\"}'\n ))\n option = '...'\n\n # Perform the API call through the SDK function\n result = @controller.validate_required_parameter(model, option: option)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def validate\n\t\t\tif !(valid?)\n\t\t\t\treturn Core::ServiceError.new(\"Mandatory fields not available\")\n\t\t\tend\n\t\t\treturn Core::ServiceSuccess.new\n\t\tend",
"def validate\n\t\t\tif !(valid?)\n\t\t\t\treturn Core::ServiceError.new(\"Mandatory fields not available\")\n\t\t\tend\n\t\t\treturn Core::ServiceSuccess.new\n\t\tend",
"def validate_parameters\n if (latitude.to_f == 0.0) || (longitude.to_f == 0.0)\n render :status=>401,\n :json=>{:Message=>\"The latitude and longitude parameters should be float values.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if (location_lock != \"true\") || (location_lock != \"false\")\n render :status=>401,\n :json=>{:Message=>\"The location_lock should be either true or false.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if proximity.to_i == 0\n render :status=>401,\n :json=>{:Message=>\"The proximity should be an integer.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if page.to_i == 0\n render :status=>401,\n :json=>{:Message=>\"The page should be an integer.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n end",
"def validate_query_params\n errors = [].then(&method(:validate_query_param_keys_clause))\n .then(&method(:validate_include_clause))\n .then(&method(:validate_fields_clause))\n .then(&method(:validate_filters_clause))\n\n if errors.present?\n render json: serialize_errors(errors), status: :bad_request\n end\n end",
"def missing_fields( response )\n missing = []\n if response && response['errors']\n response['errors'].each do |error|\n missing << error['field']\n end\n end\n return missing\n end",
"def validate_response(response) \n case response.code\n when '200' \n return\n when '400' # Bad Request error - invalid request\n raise ResponseError::BadRequestError.new(extact_error_message(response.body))\n when '401' # Unauthorised error\n raise ResponseError::UnauthorisedError.new(extact_error_message(response.body))\n when '403' # Forbidden error - valid request but server is refusing, may be due to lack of permissions (RETRY enabled)\n raise ResponseError::ForbiddenError.new(extact_error_message(response.body))\n when '404' # Not Found error - server is unable to locate the resource to serve\n raise ResponseError::NotFoundError.new(extact_error_message(response.body))\n when '500' # Internal Server error - error due to unknown reason\n raise ResponseError::InternalServerError.new(extact_error_message(response.body))\n when '502' # Bad Gateway error - error due to not receiving valid response from backend server \n raise ResponseError::BadGatewayError.new(extact_error_message(response.body))\n when '503' # Service Unavailable error - server is overloded or under maintainance (RETRY enabled)\n raise ResponseError::ServiceUnavailableError.new(extact_error_message(response.body))\n when '504' # Gateway Timeout error - not receiving response within the allowed time period (RETRY enabled)\n raise ResponseError::GatewayTimeoutError.new(extact_error_message(response.body))\n else\n raise ResponseError::UnexpectedError.new(extact_error_message(response.body))\n end\n end",
"def validate_params\n if process_object && process_object[\"required_params\"]\n process_object[\"required_params\"].each do |param|\n if !params_hash.has_key?(param)\n errors.add(:params, \"Step: #{step} - Missing mandatory param #{param}\")\n end\n end\n end\n end",
"def validate(response)\n error_klass = Error.klass(response)\n raise error_klass, response if error_klass\n\n parsed = response.parsed_response\n parsed.client = self if parsed.respond_to?(:client=)\n parsed.parse_headers!(response.headers) if parsed.respond_to?(:parse_headers!)\n parsed\n end",
"def validate\n add_deprecation_headers_to_response(response: response, link: ClaimsApi::EndpointDeprecation::V0_DEV_DOCS)\n validate_json_schema\n render json: validation_success\n end",
"def validate_request\n if @parsing_error\n return [400, \"Parsing error: #{@parsing_error}\"]\n elsif !@request_body || @request_body.empty?\n return [400, 'Request body is empty.']\n end\n\n return []\n end",
"def validate\n @errors = JSON::Validator.fully_validate(\n schema, params,\n errors_as_objects: true\n )\n @errors.empty?\n end",
"def check_required_params\n errors = required_params.map { |param, value| raise param_errors[param] if value.nil? }.compact\n raise errors.joins('; ') unless errors.empty?\n end",
"def validate_params\n @calls << [:validate_params]\n end",
"def response_must_validate_against_schema\n check_validity_against_schema(doc, 'application_response.xsd')\n end",
"def validate_params(params)\n errors = []\n errors << if params.key?('asking_price') && params.key?('down_payment')\n validate(asking_price: params['asking_price'], down_payment: params['down_payment']) do |val_errors|\n val_errors << validate_minimum_down_payment(params['asking_price'], params['down_payment'])\n end\n end\n\n errors << if params.key?('payment_schedule')\n validate(payment_schedule: params['payment_schedule']) do |val_errors|\n val_errors << validate_payment_schedule_types(params['payment_schedule'])\n end\n end\n\n errors << if params.key?('amortization_period')\n validate(amortization_period: params['amortization_period']) do |val_errors|\n val_errors << validate_amortization_period(params['amortization_period'])\n end\n end\n\n errors << if params.key?('payment_amount')\n validate(payment_amount: params['payment_amount'])\n end\n\n errors << if params.key?('interest_rate')\n validate(interest_rate: params['interest_rate'])\n end\n\n errors = errors.flatten.compact\n errors.blank? ? [] : \"Validation failed: #{errors.join(', ')}\"\n end",
"def validate_params\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n erb.validate(@arguments)\n render json: { success: 'Params look great!' }, status: 200\n end\n end",
"def valid_response?\n if self.required? && !self.has_response? then\n false\n else\n # other validations\n true\n end\n end",
"def validate_headers(headers, * parameters)\n errors = []\n if headers.present?\n parameters.each do |param|\n if headers[param].blank?\n @api_response[:code] = @response_codes['insufficient_headers']\n errors << \"#{param.to_s}\" if errors.any?\n errors << \"header missing: #{param.to_s}\" if errors.empty?\n end\n end\n else\n errors << \"headers missing\"\n end\n [errors.blank? ? true : false, errors]\n end",
"def response?(params)\n params.key?('responseStatusCode') || params.key?('responseErrorReason')\n end",
"def validate\n missing_parameters = []\n required_fields.each do |param|\n missing_parameters << param.to_s unless self.send(param)\n end\n raise RTurk::MissingParameters, \"Parameters: '#{missing_parameters.join(', ')}'\" unless missing_parameters.empty?\n end",
"def validate_responses(params)\n @responses = params['responses'] \n # Retrieve the smerf form record, rails will raise error if not found\n @smerfform = SmerfForm.find(params[:smerf_form_id])\n # Validate user responses\n @errors = Hash.new() \n @smerfform.validate_responses(@responses, @errors) \n end",
"def valid_response?\n return false unless response\n\n valid_hmac? && valid_amount? && valid_account?\n end",
"def ensure_params(*req)\n missing = []\n req.flatten.each do |param|\n if params[param].blank?\n missing << param.to_s\n end\n end\n if missing.empty?\n return false\n else\n msg = \"Following params are required but missing: \" + missing.join(\", \")\n render_api_error(11 , 400, 'params', msg)\n return true\n end\n end",
"def response_errors\n parsed_response['error']\nend",
"def wrong_params?\n if has_not_mandatory_params?\n render json: { message: \"Wrong data params\" }, status: 400\n end\n end",
"def validate!\n raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?\n end",
"def validate!\n raise BadRequestError.new(self.errors.full_messages.uniq.join(', ')) unless valid?\n end",
"def validate_fields(fields)\n if fields['email'] && fields['password']\n Success(fields)\n else\n Failure(:missing_fields)\n end\n end",
"def validate(params)\n val_errors = []\n params.each do |param, value|\n val_errors << \"missing params #{param}\" if value.blank?\n end\n yield(val_errors) if block_given? && val_errors.blank?\n val_errors.compact\n end",
"def validation_error_check_discrepancies(ar, fields)\n\t\tmsgs = []\n\t\t# get the list of fields that have errors (err_fields)\n\t\terr_fields = []\n\t\tar.errors.each {|k,v| err_fields << k}\n\t\t# identify fields missing from the record’s errors \n\t\tmissing_errors = []\n\t\tfields.each do |field_name|\n\t\t\tmissing_errors << field_name unless err_fields.include?(field_name) #if ar.errors[field_name].blank?\n\t\tend\n\t\tif missing_errors.length > 0\n\t\t\tmsgs << \"missing validation error for fields #{missing_errors.join(', ')}\"\n\t\tend\n\t\t# identify unexpected fields in the record’s errors\n\t\tunexpected_errors = []\n\t\terr_fields.each do |field_name|\n\t\t\tunexpected_errors << field_name unless fields.include?(field_name)\n\t\tend\n\t\tif unexpected_errors.length > 0\n\t\t\tmsgs << \"unexpected errors for fields #{unexpected_errors.join(', ')}\"\n\t\tend\n\t\tif msgs.length > 0\n\t\t\tassert false, msgs.join(\".\\r\")\n\t\tend\n\tend",
"def required_params_present?\n\n render json: {error: 'Missing required parameter: result'},\n status: :bad_request and return false unless params[:result]\n\n render json: {error: 'Missing required parameter: result.result_type'},\n status: :bad_request and return false unless params[:result][:result_type]\n\n # Manual Results are required to provide the execution id.\n # All other results are required to provide the project_id\n if params['result']['result_type'] == 'manual'\n render json: {error: 'Missing required parameter: result.execution_id'},\n status: :bad_request and return false unless params[:result][:execution_id]\n else\n render json: {error: 'Missing required parameter: result.project_id'},\n status: :bad_request and return false unless params[:result][:project_id]\n end\n\n\n render json: {error: 'Missing required parameter: result.testcase_id'},\n status: :bad_request and return false unless params[:result][:testcase_id]\n\n render json: {error: 'Missing required parameter: result.environment_id'},\n status: :bad_request and return false unless params[:result][:environment_id]\n\n\n render json: {error: 'Missing required parameter: result.status'},\n status: :bad_request and return false unless params[:result][:status]\n\n true\n end",
"def validate\n unless (e = errors).empty?\n raise InvalidRequestError, e.first\n end\n end",
"def validate_response(response) # :nodoc:\n code = response.code.to_i\n raise HttpError, \"#{code} #{response.msg}\" if code < 200 || code > 299\n end",
"def validate(params)\n Request.new(params).validate(params)\n end",
"def validate_params\n data = endpoint_params\n errors = []\n errors << 'Invalid verb' if %w[GET POST PATCH DELETE].exclude?(data[:verb])\n # check for valid url\n begin\n URI.parse data[:path]\n rescue URI::InvalidURIError => e\n errors << 'Invalid Path'\n end\n render json: { errors: errors }, status: :unprocessable_entity if errors.present?\n end",
"def check_response_for_field(resp, field_name)\n if resp[field_name].nil? && resp['error'].nil?\n raise MissingExpectedFieldError\n end\n resp\n end",
"def validate\n validate_required_all(%w[client_sdk_id])\n validate_required_any(%w[key_file_path key])\n validate_value('api_version', ['v1'])\n end",
"def ensure_valid_response(validation)\n status = validation[\"status\"]\n return true if status[\"name\"] == \"Ok\"\n\n error = ComTradeError.new(\n validation[\"message\"] + \" (\" +\n status[\"name\"] + \" \" +\n status[\"description\"] + \")\"\n )\n Rails.logger.error error\n Appsignal.send_error(error)\n return false\n end",
"def well_formated_response?\n all_expected_fields_received? && validate_bank_response_signature\n end",
"def assign_errors_from_response( response )\n response.errors.each do |key, value|\n value.each do |message|\n errors[key.to_sym] = message \n end\n end \n end",
"def validate_required\n [\n :project_name,\n :status,\n :requester_id,\n :subject_expert_id,\n :sponsor_id,\n :vision,\n :goal,\n :description,\n :scope,\n :advice_required,\n :program_id,\n :train_id,\n :funding_method,\n :cost_center,\n :funding_status,\n :budget_allocated,\n :priority,\n :start_date,\n :end_date,\n :risk_rating,\n :risks,\n :projected_revenue,\n ].each do |field|\n if self.attributes[field.to_s].nil? || self.attributes[field.to_s].blank?\n # intentionally vague!\n add_validation 'All fields are required to perform further validations'\n return false\n end\n end\n true\n end",
"def validate_registeration_params\n\n return success if @client_token.registration_done?\n\n @airdrop_amount = @airdrop_amount.present? ? BigDecimal.new(@airdrop_amount) : @airdrop_amount\n @ost_to_bt = @ost_to_bt.present? ? BigDecimal.new(@ost_to_bt) : @ost_to_bt\n @number_of_users = @number_of_users.to_i\n\n return error_with_data(\n 'e_sam_8',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if @ost_to_bt.blank? || @bt_to_mint < 0\n\n return error_with_data(\n 'e_sam_11',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if GlobalConstant::Base.sandbox_sub_environment? &&\n (@number_of_users < 0 || @airdrop_amount.blank? || @airdrop_amount < 0 || @airdrop_user_list_type.blank?)\n\n success\n\n end",
"def validate!\n required_attributes.each do |attribute|\n if form_data[attribute].nil? || form_data[attribute].empty?\n raise Adyen::REST::RequestValidationFailed, \"#{attribute} is empty, but required!\"\n end\n end\n end",
"def response_fields\n return '*' if invalid_param('response_fields')\n\n @params['response_fields'].join(', ')\n end",
"def validate\n\n return error_with_data(\n 'fcb_3',\n 'missing @client_id',\n 'Something Went Wrong.',\n GlobalConstant::ErrorAction.default,\n {}\n ) if @client_id.blank?\n\n @balances_to_fetch.each do |chain_type, data|\n\n case chain_type\n\n when GlobalConstant::CriticalChainInteractions.utility_chain_type\n\n return error_with_data(\n 'fcb_4',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if data[:address_uuid].blank?\n\n return error_with_data(\n 'fcb_5',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if data[:balance_types].blank?\n\n when GlobalConstant::CriticalChainInteractions.value_chain_type\n\n return error_with_data(\n 'fcb_6',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if data[:address].blank?\n\n return error_with_data(\n 'fcb_7',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if data[:balance_types].blank?\n\n else\n return error_with_data(\n 'fcb_7',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n )\n end\n\n end\n\n success\n\n end",
"def validate\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Started')\n add_deprecation_headers_to_response(response:, link: ClaimsApi::EndpointDeprecation::V1_DEV_DOCS)\n validate_json_schema\n validate_veteran_identifiers(require_birls: true)\n check_for_invalid_burial_submission! if form_type == 'burial'\n\n ClaimsApi::Logger.log('itf', detail: '0966/validate - Request Completed')\n render json: validation_success\n end",
"def validate_params_present!\n raise ArgumentError, \"Please provide one or more of: #{ACCEPTED_PARAMS}\" if params.blank?\n end",
"def required_params_present(params, * parameters)\n errors = []\n if params.present?\n parameters.each do |param|\n if params[param].blank?\n errors << \"#{param.to_s}\" if errors.any?\n errors << \"parameter missing: #{param.to_s}\" if errors.empty?\n end\n end\n else\n errors << \"parameters missing\"\n end\n [errors.blank? ? true : false, errors]\n end",
"def check_response_for_field(resp, field_name)\n if resp[field_name].nil? && resp['error'].nil?\n raise MissingExpectedFieldError\n end\n resp\n end",
"def validate_response\n\n unless @block_data_response.success?\n notify_dev(@block_data_response.data.merge(msg: \"Error while fetching block\"))\n return error_with_data(\n 'c_rbe_2',\n 'error while fetching block',\n 'error while fetching block',\n GlobalConstant::ErrorAction.default,\n {}\n )\n end\n\n meta = @block_data_response.data[:meta]\n @transactions = @block_data_response.data[:transactions]\n\n\n if (meta[:current_block][:block_number].to_i != @current_block_number)\n notify_dev(@block_data_response.data.merge(msg: \"Urgent::Block returned is invalid\"))\n return error_with_data(\n 'c_rbe_1',\n 'invalid block returned',\n 'invalid block returned',\n GlobalConstant::ErrorAction.default,\n {}\n )\n end\n\n @current_block_hash = meta[:current_block][:block_hash]\n @block_creation_timestamp = meta[:current_block][:timestamp].to_i\n @highest_block_number = meta[:hightest_block].to_i\n\n success\n end",
"def unauthorized_access_response(err)\n validation_error(\n err,\n 'invalid_api_params',\n ['invalid_a_t'],\n GlobalConstant::ErrorAction.default\n )\n end",
"def errors\n result = []\n result.push(:title) unless valid_string? @title\n result.push(:author) unless valid_string? @author\n result.push(:release_date) unless valid_date? @release_date\n result.push(:publisher) unless valid_string? @publisher\n result.push(:isbn) unless valid_integer? @isbn\n result\n end",
"def validate_request \n\t\tval_required='required'\n\t\tdata_val_required='data_required'\n\t\tuser_id=\"\";\n\t\tclient_id=\"\";\n\t\tsession_id=\"\";\n\t\t\n\t\tif(cookies[:user_id])\n\t\t\tuser_id= cookies[:user_id].to_s\n\t\tend\n\t\t\n\t\tif(cookies[:client_id])\n\t\t\tclient_id= cookies[:client_id].to_s\n\t\tend\n\t\t\n\t\tif(cookies[:session_id])\n\t\t\tsession_id= cookies[:session_id].to_s\n\t\tend\n\t\t\n\t\tif client_id.empty? == true || session_id.empty? == true\n\t\t\tlogger.debug \"Client not found for client_id=\" + client_id\n\t\t\tcoockies_render_error('e1011',params[:response_type].to_s) \n\t\t\treturn false\n\t\tend\n\t\t\n\t\t@client=Client.where(pk_client_id: client_id)\t\t\n\t\tif (@client.count<=0)\n\t\t\tlogger.debug \"Client not found for client_id=\" + client_id\n\t\t\tcoockies_render_error('e1011',params[:response_type].to_s) \n\t\t\treturn false\n\t\tend\t\t\t\n\t\t\n\t\t@device_users=DeviceUser.where(fk_client_id: client_id, pk_user_id: user_id, sessionid: session_id) \n\t\t\n\t\tif (@device_users.count<=0)\t\n\t\t\tlogger.debug \"device_users not found for client_id=\" + client_id+ \" and session_id=\" + session_id + \" \"\n\t\t\tcoockies_render_error('e1012',params[:response_type].to_s) \n\t\t\treturn false\n\t\telse\n\t\t\tif @device_users[0][:status_code] == 403\n\t\t\t\tcoockies_render_error('e2203',params[:response_type].to_s) \n\t\t\t\treturn false\n\t\t\tend\n\n\t\t\tif @device_users[0][:status_code] == 402\n\t\t\t\tcoockies_render_error('e2204',params[:response_type].to_s) \n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\n\t\tparams[:user_id]=user_id\n\t\tparams[:client_id]=client_id\n\t\tparams[:session_id]=session_id\n\t\t\n\t\treturn true\n\tend",
"def validate_review_completed_parameters(params)\n raise MissingTransactionId if params[\"id\"].to_s.length == 0\n raise InvalidTransactionId if !validate_transaction_id(params[\"id\"])\n\n raise MissingAnalystId if params[\"analyst_id\"].to_s.length == 0\n raise InvalidAnalystId if !validate_analyst_id(params[\"analyst_id\"])\n raise MissingAnalystFullname if params[\"analyst_fullname\"].to_s.length == 0\n raise InvalidAnalystFullname if !validate_analyst_fullname(params[\"analyst_fullname\"])\n\n raise MissingAnalystApprovalDate if params[\"analyst_approval_datetime\"].to_s.length == 0\n raise InvalidAnalystApprovalDate if !validate_date(params[\"analyst_approval_datetime\"])\n raise MissingAnalystTransactionId if params[\"analyst_transaction_id\"].to_s.length == 0\n raise MissingAnalystInternalStatusId if params[\"analyst_internal_status_id\"].to_s.length == 0\n raise MissingAnalystDecisionCode if params[\"decision_code\"].to_s.length == 0\n raise InvalidAnalystDecisionCode if !validate_decision_code(params[\"decision_code\"])\n return params\n end",
"def validate_params(params)\n # This will be implemented by Validators which take parameters\n end",
"def validate_request(env)\n parameters = extract_request_parameters\n\n validate_flow_presence!(parameters)\n validate_msisdn!(parameters)\n validate_session_id!(parameters)\n\n parameters\n end",
"def valid_params_request?; end",
"def validate!\n REQUIRED_PARAMETERS.each do |name|\n if params[name].empty?\n raise(BuildRequestError, \"Vocalware: Parameter #{name} is required\")\n end\n end\n end",
"def validate_request_and_error(request, response_error, resource_prefix)\n request_id = validate_request(request, resource_prefix)\n validate_error(response_error, request_id)\nend",
"def assert_no_errors_in_response\n assert_equal [nil, nil], response.data.values_at(\"error_type\", \"message\")\n end",
"def required_fields\n # \"cid\" is not required\n [\n \"byr\",\n \"ecl\",\n \"eyr\",\n \"hcl\",\n \"hgt\",\n \"iyr\",\n \"pid\",\n ]\nend",
"def valid_rpc_response?(response)\n # validate response is an object\n return false unless response.is_a?(Hash)\n\n JSON_RPC_RESPONSE_REQUIRED_MEMBERS.each do |member|\n tmp_member = @symbolize_names ? member : member.to_s\n return false unless response.key?(tmp_member)\n end\n\n # validate response members are correct types\n response.each do |member, value|\n tmp_member = @symbolize_names ? member : member.to_sym\n return false if JSON_RPC_RESPONSE_MEMBER_TYPES.key?(tmp_member) &&\n !JSON_RPC_RESPONSE_MEMBER_TYPES[tmp_member].one? { |type| value.is_a?(type) }\n end\n\n return false if response[:jsonrpc] != JSON_RPC_VERSION\n\n result_key = @symbolize_names ? :result : :result.to_s\n error_key = @symbolize_names ? :error : :error.to_s\n\n return false if response.key?(result_key) && response.key?(error_key)\n\n if response.key?(error_key)\n error_response = response[error_key]\n # validate error response is an object\n return false unless error_response.is_a?(Hash)\n\n JSON_RPC_ERROR_RESPONSE_REQUIRED_MEMBERS.each do |member|\n tmp_member = @symbolize_names ? member : member.to_s\n return false unless error_response.key?(tmp_member)\n end\n\n # validate error response members are correct types\n error_response.each do |member, value|\n tmp_member = @symbolize_names ? member : member.to_sym\n return false if JSON_RPC_ERROR_RESPONSE_MEMBER_TYPES.key?(tmp_member) &&\n !JSON_RPC_ERROR_RESPONSE_MEMBER_TYPES[tmp_member].one? { |type| value.is_a?(type) }\n end\n end\n\n true\n end",
"def validate_payment_and_allowance_and_capitation_codes\r\n result = true\r\n error_message = nil\r\n facility_id_array, capitation_code_array = [], []\r\n in_patient_payment_code_array, out_patient_payment_code_array = [], []\r\n in_patient_allowance_code_array, out_patient_allowance_code_array = [], []\r\n facilities_payers_information = params[:facilities_payers_information]\r\n if !facilities_payers_information.blank?\r\n serial_numbers_added = params[:serial_numbers_for_adding_payment_or_allowance_codes]\r\n if !serial_numbers_added.blank?\r\n serial_numbers_added = serial_numbers_added.split(',')\r\n serial_numbers_added.each do |serial_number|\r\n if !serial_number.blank?\r\n facility_id_array << format_ui_param(facilities_payers_information[\"facility_id#{serial_number}\"])\r\n in_patient_payment_code_array << format_ui_param(facilities_payers_information[\"in_patient_payment_code#{serial_number}\"])\r\n out_patient_payment_code_array << format_ui_param(facilities_payers_information[\"out_patient_payment_code#{serial_number}\"])\r\n in_patient_allowance_code_array << format_ui_param(facilities_payers_information[\"in_patient_allowance_code#{serial_number}\"])\r\n out_patient_allowance_code_array << format_ui_param(facilities_payers_information[\"out_patient_allowance_code#{serial_number}\"])\r\n capitation_code_array << format_ui_param(facilities_payers_information[\"capitation_code#{serial_number}\"])\r\n end\r\n end\r\n end\r\n end\r\n\r\n result, error_message = presence_of_facility_in_associated_data(facility_id_array)\r\n return result, error_message if not result\r\n\r\n facility_id_array.each_with_index do |facility, index|\r\n if !facility.blank? && capitation_code_array[index].blank? &&\r\n in_patient_payment_code_array[index].blank? &&\r\n out_patient_payment_code_array[index].blank? &&\r\n in_patient_allowance_code_array[index].blank? &&\r\n out_patient_allowance_code_array[index].blank?\r\n result = false\r\n error_message = \"Please enter valid values for facility and payer specific data.\"\r\n end\r\n end\r\n return result, error_message\r\n end",
"def validate(response)\n # Invalid if the zuora timestamp is more than 300 seconds ago\n timestamp = from_zuora_time(response[\"timestamp\"].to_i)\n return false if timestamp < Time.now - 300\n # Match the signature with the signature from zuora\n create(response[\"id\"], response[\"timestamp\"], response[\"token\"]).signature == response[\"responseSignature\"]\n end",
"def validate_response_body(pattern)\r\n unless @response.body =~ pattern\r\n error_message = \"HTTP Response FAILURE, status\" +\r\n \" [#{@response.code} #{@response.message}], body [#{@response.body}]\"\r\n #TODO: Refactor error logging, 2006/10/13 shino\r\n logger.error(error_message)\r\n logger.info{@response.to_yaml}\r\n #TODO: must create AP4R specific Exception class, 2006/10/12 shino\r\n raise StandardError.new(error_message)\r\n end\r\n end",
"def validate_required_params(required_param)\n return unless request.query_parameters[required_param].blank?\n\n render json: { error: \"'#{required_param}' query parameter is required\" },\n status: :bad_request\n end",
"def test_allow_dynamic_form_fields()\n # Parameters for the API call\n name = 'farhan'\n\n # dictionary for optional form parameters\n optional_form_parameters = {}\n optional_form_parameters['field'] = 'QA'\n\n # Perform the API call through the SDK function\n result = @controller.allow_dynamic_form_fields(name, _field_parameters: optional_form_parameters)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n\n # Test whether the captured response is as we expected\n refute_nil(result)\n expected_body = JSON.parse(\n '{\"passed\":true}'\n )\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end",
"def errors\n errors = []\n unless @method_name.present?\n errors << \"method_name is not set\"\n end\n unless @service_name.present?\n errors << \"service_name is not set\"\n end\n unless @server_address.present?\n errors << \"server_address is not set\"\n end\n errors\n end",
"def validate_errors validation_errors\n error_tests= {:type=>\"TYPE\", :cardinality=>\"CARDINALITY\", :meta_wrapper=> \"METAWRAPPER\"}\n\n # make sure everything that produced an error was marked appropriately\n validation_errors.each_pair do |name, errs|\n if []== errs then\n assert( name.to_s=~/OK/, \"expected naming 'OK': \\n#{errs.inspect}\")\n else\n assert( !(name.to_s=~/OK/), \"unexpected naming 'OK': \\n#{name} : #{errs.inspect}\")\n errs.each do |er|\n assert_equal Hash, er.class, er.inspect\n assert name == er[:name], er.inspect\n ert= er[:error]\n if error_tests[ert]\n naming_excerpt= error_tests[ert]\t\n assert name.to_s=~/#{naming_excerpt}/, \n \"expected naming_excerpt #{naming_excerpt}: \\n#{er.inspect}\"\n else\n flunk \"unknown error '#{er[:error]}' - #{er.inspect}\"\n end\n end\n # make sure if the name contains an err string then the err is in the array with the same name\n error_tests.each_pair do|ert,naming_excerpt|\n if name.to_s=~/#{naming_excerpt}/ then\n have_this_error_with_name= errs.select{ |er| er[:error]==ert }\n assert( have_this_error_with_name.length>0, \n \"should have an error of '#{ert}' in #{errs.inspect}\\n\" \\\n \"errs:\\n#{errs.report_rmof_errors}\")\n end\n end\n end\n end\n end",
"def parse_errors(response_string)\n pairs = response_string.split(@field_delim)\n pairs.each do |p|\n k,v = p.split(@value_delim)\n k = generate_error_key(k,v)\n @errors[k] = v\n end\n end",
"def valid?()\n if( requiredFieldsPresent? )\n # check each condition, saving off error if one exists (ugh...)\n @errors << \"byr is not valid #{@args[\"byr\"]}\" if !byrValid?(@args[\"byr\"])\n @errors << \"iyr is not valid #{@args[\"iyr\"]}\" if !iyrValid?(@args[\"iyr\"])\n @errors << \"eyr is not valid #{@args[\"eyr\"]}\" if !eyrValid?(@args[\"eyr\"])\n @errors << \"hgt is not valid #{@args[\"hgt\"]}\" if !hgtValid?(@args[\"hgt\"])\n @errors << \"hcl is not valid #{@args[\"hcl\"]}\" if !hclValid?(@args[\"hcl\"])\n @errors << \"ecl is not valid #{@args[\"ecl\"]}\" if !eclValid?(@args[\"ecl\"])\n @errors << \"pid is not valid #{@args[\"pid\"]}\" if !pidValid?(@args[\"pid\"])\n end\n @errors.empty?\n end",
"def validate_response_code\n return if %w(00 24).include? response_code\n\n errors.add(:base, response_code: response_code, response_text: response_text)\n end",
"def validate_required_params\n required_params.each do |param|\n unless options.send(param)\n error_msg = \"omniauth-dice error: #{param} is required\"\n fail RequiredCustomParamError, error_msg\n end\n end\n end",
"def validate(input)\n result = ctx[:contract].new.call(input[:params])\n if result.errors.count.positive?\n Failure(error: ErrorService.bad_request_fail(result.errors.to_h))\n else\n ctx[:params] = result.to_h\n Success(input.merge(params: result.to_h))\n end\n end",
"def add_errors_from_response(response=self.last_response)\n return unless response.respond_to?(:errors)\n\n response.errors.each do |error|\n if error.respond_to?(:message)\n errors.add(error.field, error.message)\n elsif error.respond_to?(:messages)\n error.messages.each do |message|\n errors.add(error.field, message)\n end\n end\n end\n end",
"def oAuthValidate\r\n logger.info(\"UserController::oAuthValidate::Params:----#{params}\")\r\n \r\n end",
"def validate_params\n validate_size\n validate_mine_density\n validate_first_click\n type_specific_checks\n end",
"def parameters_missing(error)\n response_error(code: 400, message: error.message)\n end",
"def validate_param\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n erb.validate_param(@arguments.keys.first.to_s, @arguments.values.first)\n render json: { success: 'Param looks like the right data type! good job!' }, status: 200\n end\n end",
"def valid?\n @errors = []\n\n if !journal_line_id.nil? && journal_line_id !~ GUID_REGEX\n @errors << ['journal_line_id', 'must be blank or a valid Xero GUID']\n end\n\n unless line_amount\n @errors << ['line_amount', \"can't be blank\"]\n end\n\n unless account_code\n @errors << ['account_code', \"can't be blank\"]\n end\n\n @errors.size == 0\n end",
"def validate_review_completed_parameters(params)\n raise MissingTransactionId if params[\"id\"].to_s.length == 0\n raise InvalidTransactionId if !validate_transaction_id(params[\"id\"])\n\n raise MissingAnalystId if params[\"analyst_id\"].to_s.length == 0\n raise InvalidAnalystId if !validate_analyst_id(params[\"analyst_id\"])\n raise MissingAnalystFullname if params[\"analyst_fullname\"].to_s.length == 0\n raise InvalidAnalystFullname if !validate_analyst_fullname(params[\"analyst_fullname\"])\n\n raise MissingAnalystApprovalDate if params[\"analyst_approval_datetime\"].to_s.length == 0\n raise InvalidAnalystApprovalDate if !validate_date(params[\"analyst_approval_datetime\"])\n raise MissingAnalystTransactionId if params[\"analyst_transaction_id\"].to_s.length == 0\n raise MissingAnalystInternalStatusId if params[\"analyst_internal_status_id\"].to_s.length == 0\n raise MissingAnalystDecisionCode if params[\"decision_code\"].to_s.length == 0\n raise InvalidAnalystDecisionCode if !validate_decision_code(params[\"decision_code\"])\n return params\n end",
"def create_response(api_response, errors)\n Rails.logger.error \"#{Time.now} ERRORS: #{errors}\"\n api_response[:code] = 99 if errors.length >= 1\n unless errors.empty?\n long_error = \"\"\n errors.each do |error|\n long_error += \"#{error} \"\n end\n api_response[:result] = long_error\n end\n return api_response\n end",
"def validate_params\n if lat.blank? || lng.blank? || property_type.blank? || offer_type.blank?\n @properties = []\n @message = \"Looks like some search parameters are missing!\"\n fail!(:validation_failed) && abort!\n end\n end"
] | [
"0.69860464",
"0.681019",
"0.6738128",
"0.67079586",
"0.6701786",
"0.6634733",
"0.6632663",
"0.66182786",
"0.6512523",
"0.64695257",
"0.64693385",
"0.64480644",
"0.64204943",
"0.641793",
"0.6309795",
"0.6261852",
"0.626092",
"0.62516695",
"0.62516695",
"0.62206036",
"0.62127244",
"0.61905116",
"0.61753774",
"0.6152794",
"0.61300254",
"0.60746527",
"0.605646",
"0.6040303",
"0.60345125",
"0.6029781",
"0.6006759",
"0.60065156",
"0.60012656",
"0.59999615",
"0.5954458",
"0.5953557",
"0.5922951",
"0.5912164",
"0.5895437",
"0.58894825",
"0.5869646",
"0.58523375",
"0.5841044",
"0.5841044",
"0.5829768",
"0.5821712",
"0.58035684",
"0.57954204",
"0.5794962",
"0.5792877",
"0.5785947",
"0.57689136",
"0.5763659",
"0.57234776",
"0.57154757",
"0.5703311",
"0.5702767",
"0.5701737",
"0.569779",
"0.5697099",
"0.5696021",
"0.56872296",
"0.5678753",
"0.5668157",
"0.5667995",
"0.5661867",
"0.56532717",
"0.564215",
"0.5630554",
"0.5623017",
"0.5622743",
"0.56199205",
"0.56185794",
"0.561601",
"0.56130314",
"0.5594237",
"0.5592754",
"0.5583659",
"0.55748254",
"0.5573034",
"0.55532914",
"0.55277973",
"0.55177706",
"0.5517532",
"0.5517203",
"0.5508343",
"0.55071753",
"0.5495566",
"0.54932725",
"0.54864573",
"0.54849243",
"0.5483866",
"0.54729766",
"0.5472903",
"0.5471321",
"0.5467429",
"0.5460612",
"0.545738",
"0.54514754",
"0.5450367"
] | 0.66650736 | 5 |
This function checks if a value is blank, null or 'NA' and returns true, else returns false. Args : +param+ > the parameter Returns : +boolean+ > the result | def isBlankOrNull(param = null)
if param.nil? || param==="NA" || param.empty?
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blank?(param)\n param.nil? || param.empty?\n end",
"def any_empty(*params)\n params.each do |param|\n if param == nil or param == ''\n return true\n end\n end\n false\n end",
"def value_empty?\n if value === nil or value === \"\"\n return true\n end\n return false\n end",
"def _blank?(value)\n value.nil? || value == ''\n end",
"def blank?\n value.blank?\n end",
"def blank?(val)\n val.respond_to?(:empty?) ? val.empty? : !val\n end",
"def isEmptyOrNull(value)\n if value == nil || value.eql?(\"\")\n return true\n else\n return false\n end\n end",
"def blank?(value)\n value.nil? || value.to_s.empty?\n end",
"def valid_param?(val)\n !val.nil? && val.is_a?(String) && !val.empty?\nend",
"def is_blank?(var)\n var.nil? or (var.is_a?(String) and var.strip.empty?)\n end",
"def valid?( value )\n ( required? && ( value.nil? || value.to_s.empty? ) ) ? false : true\n end",
"def data_exist?(parameter)\n !parameter.nil? && !parameter.empty?\n end",
"def is_nil_like?(val=nil)\n\t\t\tval = val.to_s if val.respond_to?(\"to_s\")\n\t\t\t# let's be explicit here:\n\t\t\treturn true if (val.nil? or val =~ /^\\s$/ or val.empty? or val.downcase == \"nil\")\n\t\t\tfalse\n\t\tend",
"def nil_or_empty?(value)\n value.nil? || value.empty? ? true : false\n end",
"def blank?\n @value == nil\n end",
"def blank?(value)\n value.nil? == false && value.empty? == false\n end",
"def blank?(str)\n str.nil? || str.to_s.strip == ''\nend",
"def nil_or_empty?(value)\n return true if value.nil? || (value.respond_to?(:empty?) && value.empty?)\n\n false\nend",
"def truthy?\n if respond_to? :blank?\n not blank?\n else\n not nil?\n end\n end",
"def truthy?\n if respond_to? :blank?\n not blank?\n else\n not nil?\n end\n end",
"def blank_param?(data)\n data.blank? || data.try(:values).try(:all?, &:blank?)\n end",
"def blank?(value)\n value.nil? || BLANK_REGEX === value\n end",
"def blank?(value)\n return value.blank? if value.respond_to?(:blank?)\n\n value.respond_to?(:empty?) ? !!value.empty? : !value\n end",
"def value?\n !element_value.nil? && element_value != ''\n end",
"def check_blank_value(key, val)\n # if we explicitly want nil attributes\n return true if self.options[:include_nil_attributes]\n # or if the attribute has changed to nil\n return true if self.record.changes[key].present?\n # make sure our value isn't blank\n return !val.nil?\n end",
"def empty_required_value?( value )\n required? && value.nil?\n end",
"def emptyval?(val)\n if val.nil?\n true\n else\n (val.class == String) ? val.empty? : false\n end\n end",
"def is_not_null(val)\n @builder.is_not_null(LLVM::Script::Validate(val, :value))\n end",
"def is_missing?(value)\n value.nil? or (String===value and value.strip.empty?)\n end",
"def valid?(v)\n !v.nil?\n end",
"def blank_date_parameter?\n (1..3).any? { |position| values[position].blank? }\n end",
"def is_nil_or_empty_string(str)\n return false unless ((str == nil) or (str == \"\"))\n return true\n end",
"def params_valid(param,value)\n unless param.nil?\n if value == param\n return true\n else\n return false\n end \n else\n return false\n end\n end",
"def is_blank? item\n\titem.nil? || item.gsub(/\\s+/, \"\").empty?\nend",
"def value_empty?(val)\n\t\tcase val\n\t\twhen String, Array\n\t\t val.empty?\n\t\telse\n\t\t\tval.nil?\n\t\tend\n\tend",
"def is_nil?(value)\n\t\tvalue.nil?\n\tend",
"def valid?(param = nil)\n if param.nil?\n @errors.empty?\n else\n @errors[param].nil? or @errors[param].empty?\n end\n end",
"def is_null(val)\n @builder.is_null(LLVM::Script::Validate(val, :value))\n end",
"def isEmpty(value) \n return value.nil? || value.strip == \"\"\nend",
"def empty?(input)\n input == \"\" ? true : false\n end",
"def must_have_value?\n return @df_str == nil\n end",
"def has_valid?(params)\n params.none?{|key,value| value.empty?}\n end",
"def empty_nil_blank?(str, raize=false)\n result = (str !~ /[^[:space:]]/ || str.nil? || str.empty?)\n raise ShellTastic::CommandException.new(\"Command is emtpy or nil\") if result and raize\n result\n end",
"def has?(param)\n \tparam and param.length > 0\n end",
"def valid_record?( record )\n !record[:name].nil? and !record[:type].nil? and !record[:value].nil? and\n !record[:name].empty? and !record[:type].empty? and !record[:value].empty?\nend",
"def given?(field)\n !field.empty?\nend",
"def validate_parameter(*param)\n param.each do |a|\n return false unless a && (a.to_s =~ /^\\{.*\\}$/) == nil && a != '' && a != {}\n end\n end",
"def check()\n result = true\n result = false if @data[:firstname].to_s.empty? || @data[:lastname].to_s.empty? || @data[:birthday] !~ /^\\d\\d\\d\\d-\\d\\d?-\\d\\d?$/\n return result\n end",
"def blank?(a)\n return true unless a\n BLANK_STRING_RE === a\n end",
"def validString?(s)\n if s.nil? \n false\n else if s.empty?\n false\n end\n end\n true\nend",
"def validString?(s)\n if s.nil? \n false\n else if s.empty?\n false\n end\n end\n true\nend",
"def null_value\n match = /((\\w*) NULL)/i.match(definition)\n return true unless match\n\n match[2].downcase == 'not' ? false : true\n end",
"def anything_blank?\n max_payment.blank? || min_payment.blank? || deposit.blank? || term.blank?\n end",
"def valid_params?\n params.none? do |k,v|\n v == \"\"\n end\n end",
"def empty_param?(x)\n return true if params[x].nil?\n if params[x].is_a?(String)\n params[x].strip.empty?\n else\n params[x].empty?\n end\n end",
"def present?\n not blank?\n end",
"def valid?\n !(@variable.nil? || @attribute.nil?)\n end",
"def blank?(str)\n str.nil? or (str.is_a? String and str.strip.empty?)\n end",
"def value_present?\n [email protected]?\n end",
"def valid_params?(*args)\n args.map { |a| return false if a.nil? || a.to_s.gsub(/\\s/, '').empty? }\n true\n end",
"def is_empty(string)\n return true if string == \"\"\n return false\nend",
"def empty?\r\n return @value == nil\r\n end",
"def has_valid_metadata_value(field, required=false)\n puts \"<< Validating #{field} >>\"\n \n # True cases to fail validation should live here\n unless descMetadata.term_values(field).nil?\n if required \n return ((not descMetadata.term_values(field).empty?) and \n (not \"\" == descMetadata.term_values(field).first))\n else \n # If it isn't required then return true even if it is empty\n return true\n end\n else\n # Always return false when nil\n return false\n end \n end",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def blank?\n false\n end",
"def empty(string)\n if string == \"\" \n return true\n else \n return false\n end\nend",
"def not_nil_and_string(str)\n return true unless ((str == nil) or (not str.instance_of? String))\n return false\n end",
"def not_nil_and_string(str)\n return true unless ((str == nil) or (not str.instance_of? String))\n return false\n end",
"def not_nil_and_string(str)\n return true unless ((str == nil) or (not str.instance_of? String))\n return false\n end",
"def none?\n @value.to_s.empty? or /\\Anone\\z/io.match(@value.to_s)\n end",
"def empty? t\n !t ? true : clean(t).gsub(' ','') == ''\nend",
"def IS_NIL(value)\n value.first == nil\n end",
"def blank?\n attributes.values.all?(&:blank?)\n end",
"def any?\n not blank?\n end",
"def valid?(att)\n return false if att.nil?\n\n return !att.nil? && !att.empty? if att.is_a? String\n\n !att.nil?\n end",
"def valid?\n !blank? && rets? && !error?\n end",
"def valid_n3_value?(element)\n return !element.nil? && !element.match(/^[^\"'\\\\]*$/).nil? ? true : false\n end",
"def check_value_boolean(val, default)\n ret = if default == true\n false\n else\n true\n end\n\n if val.nil? || val.empty?\n default\n else\n ret\n end\nend",
"def valid?(value)\n value.kind_of?(primitive) || (value.nil? && nullable?)\n end",
"def skip_blanks?() @skip_blanks end",
"def string?\n !@arg[:textValue].nil?\n end",
"def is_empty(str)\n if str[0] == nil\n return true\n else\n return false\n end\nend",
"def valid?(params = {})\n params.each_value do |arr|\n arr.each do |key, value|\n # hasOtherName always will be correct\n next if key == 'hasOtherName'\n # If the array is empty or the data that has is invalid return false\n # return false if the array is empty\n return false if value.class == Array && value.empty?\n # return false if the information is not correct\n return false if value.class == Array && invalid_interactions?(value)\n next if value.class == Array\n # If the string is empty data not valid\n return false if value == ''\n end\n end\n true\n end",
"def empty?\n @val==nil\n end",
"def hasValue?(x)\n\tcase x\n\twhen nil, [], \"\", 0\n\t\tfalse\n\telse\n\t\ttrue\n\tend\nend",
"def blank?\n true\n end",
"def blank?\n true\n end",
"def blank?\n true\n end",
"def null?(field_info, field)\n field_info[\"notnull\"] == 1 && self.send(field).blank?\n end",
"def valid?\n @value ? true : false\n end",
"def nil_or_empty_string?(obj)\n obj.nil? || obj.empty?\n end",
"def valid_string?(field, param)\n true\n end",
"def blank?\r\n nil? || (respond_to?(:empty?) && empty?)\r\n end",
"def blank?( string )\n string.respond_to?(:empty?) ? !!string.empty? : !string\n end",
"def empty?\n city.blank? && user.blank? && name.blank? && from_date.blank? && to_date.blank?\n end",
"def valid?\n valid = true\n\n if self.name.nil? || self.name == \"\"\n valid = false\n end\n\n return valid\n end",
"def blank_object?(obj)\n return obj.blank? if obj.respond_to?(:blank?)\n case obj\n when NilClass, FalseClass\n true\n when Numeric, TrueClass\n false\n when String\n obj.strip.empty?\n else\n obj.respond_to?(:empty?) ? obj.empty? : false\n end\n end",
"def present?(string)\n return !blank?(string)\n end",
"def blank?\n nil? || (respond_to?(:empty?) && empty?)\n end"
] | [
"0.7355396",
"0.70946455",
"0.7066158",
"0.70298797",
"0.69937193",
"0.6835821",
"0.6831294",
"0.6817792",
"0.681066",
"0.6782073",
"0.67507845",
"0.66956055",
"0.6678011",
"0.6667804",
"0.6585512",
"0.65823436",
"0.6575102",
"0.657127",
"0.656242",
"0.656242",
"0.65614396",
"0.65357023",
"0.6514151",
"0.65140826",
"0.64902073",
"0.6476125",
"0.64494294",
"0.64397734",
"0.6434488",
"0.6428411",
"0.64270043",
"0.6418888",
"0.6371831",
"0.6354964",
"0.6349456",
"0.63332886",
"0.63245165",
"0.6285876",
"0.625994",
"0.6258085",
"0.6256327",
"0.62456524",
"0.6226398",
"0.6223814",
"0.6200541",
"0.6197495",
"0.61946875",
"0.6139889",
"0.6136066",
"0.6112552",
"0.6112552",
"0.6106072",
"0.60827976",
"0.6078598",
"0.6062141",
"0.6046381",
"0.6033753",
"0.6032178",
"0.6016257",
"0.60088724",
"0.59735495",
"0.5959963",
"0.5937087",
"0.59355384",
"0.59355384",
"0.59355384",
"0.59222436",
"0.5921693",
"0.5921693",
"0.5921693",
"0.5918954",
"0.5916994",
"0.5913334",
"0.5910191",
"0.59101295",
"0.5902686",
"0.58886033",
"0.5882683",
"0.58768713",
"0.58752745",
"0.5871982",
"0.5871293",
"0.5869931",
"0.58654994",
"0.58607453",
"0.5855744",
"0.5850705",
"0.5850705",
"0.5850705",
"0.5847444",
"0.58439463",
"0.583955",
"0.5819132",
"0.5814632",
"0.5805592",
"0.58050907",
"0.57958657",
"0.57957345",
"0.5795015",
"0.5782592"
] | 0.85502607 | 0 |
Don't put anything above this | def to_param
to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def placebo?; false end",
"def ignores; end",
"def ignore; end",
"def under; end",
"def before; end",
"def naked_top_level?; end",
"def extra; end",
"def anchored; end",
"def naked_top_level; end",
"def private; end",
"def take_place\n super(1)\n end",
"def before() ; end",
"def possibly_include_hidden?; end",
"def before() nil ; end",
"def skips; end",
"def probers; end",
"def calls_super # :nodoc:\n false\n end",
"def isolated; end",
"def isolated; end",
"def ignore_me\nend",
"def before_all\n super if defined?(super)\n end",
"def skipped; end",
"def before_each\n super if defined?(super)\n end",
"def include_at_top(mod) end",
"def before_appending( state )\n\t\t# Nothing to do\n\t\treturn nil\n\tend",
"def leading; end",
"def isolated?; end",
"def isolated?; end",
"def ignore_parent_exclusion=(_arg0); end",
"def dont_care\n each(&:dont_care)\n myself\n end",
"def under=(_); end",
"def skipped!; end",
"def precedes; [] end",
"def actual_flow_control\n super\n end",
"def exclude; end",
"def begingraphics(*)\n super\n end",
"def guard; end",
"def -@; end",
"def custom; end",
"def custom; end",
"def writethis; end",
"def before_block_boundary?; end",
"def ignore_parent_exclusion; end",
"def sharded?; true; end",
"def included; end",
"def excluded; end",
"def ignore_parent_exclusion?; end",
"def special\n override\n end",
"def before\n end",
"def called_from; end",
"def called_from; end",
"def sharded?; false; end",
"def weber; end",
"def internal; end",
"def ignore\n @ignore = true\n end",
"def tag; raise 'Override this method'; end",
"def semact?; false; end",
"def specialty; end",
"def sticky?() end",
"def overrides; end",
"def used?; end",
"def unused\n end",
"def span?; end",
"def faint; end",
"def faint; end",
"def pre_block\n end",
"def pre_block\n end",
"def internal?; end",
"def nothing; end",
"def before=(_arg0); end",
"def included( hooked_instance )\n \n super if defined?( super )\n \n end",
"def mark; end",
"def missed?; end",
"def main\n super\n return self\n end",
"def original; end",
"def _parent; end",
"def escaper=(_); end",
"def process_fix\n super\n end",
"def skip_after; end",
"def ignore!\n self.ignored = true\n end",
"def skip_backtrace; end",
"def buzzword; end",
"def buzzword; end",
"def before\n\t\t\ttrue\n\t\tend",
"def skipped?; end",
"def skipped?; end",
"def skipped?; end",
"def skipped?; end",
"def prevent_tampering\n self.empathy_level = 0\n self.inner_comments_count = 0\n end",
"def dead?; end",
"def incomplete\r\n\r\n end",
"def silly_adjective; end",
"def extra_state; end",
"def leading=(_); end",
"def pass; end",
"def pass; end",
"def celebration; end",
"def self\n @define_self = true",
"def ignore\n @ignored = true\n self\n end",
"def discard; end",
"def discard; end"
] | [
"0.6982941",
"0.68191576",
"0.656337",
"0.6533704",
"0.65007114",
"0.6333284",
"0.61852795",
"0.6150176",
"0.6148478",
"0.61115336",
"0.6107089",
"0.6101558",
"0.6092218",
"0.6049842",
"0.60453326",
"0.60359615",
"0.60349536",
"0.6019283",
"0.6019283",
"0.6011442",
"0.60073495",
"0.5997847",
"0.5956452",
"0.5933635",
"0.5918444",
"0.5914984",
"0.5902235",
"0.5902235",
"0.5900051",
"0.58904177",
"0.5872629",
"0.5869466",
"0.5861036",
"0.58422434",
"0.58357906",
"0.57881343",
"0.5786837",
"0.5779177",
"0.57746744",
"0.57746744",
"0.57689166",
"0.5764929",
"0.57632196",
"0.5749737",
"0.5743788",
"0.5725261",
"0.5720577",
"0.57134974",
"0.5708557",
"0.56964076",
"0.56964076",
"0.5690509",
"0.5688551",
"0.56810063",
"0.56714565",
"0.5669901",
"0.5666357",
"0.56598103",
"0.5658874",
"0.56443965",
"0.5639828",
"0.56395465",
"0.5633092",
"0.5630705",
"0.5630705",
"0.56302917",
"0.56302917",
"0.56249356",
"0.5624452",
"0.5624411",
"0.5622505",
"0.5622467",
"0.5599219",
"0.5580442",
"0.5579926",
"0.5578774",
"0.55758214",
"0.5571412",
"0.5570454",
"0.5560405",
"0.5557865",
"0.5557251",
"0.5557251",
"0.5555531",
"0.5552044",
"0.5552044",
"0.5552044",
"0.5552044",
"0.55501235",
"0.55489457",
"0.5546537",
"0.55463684",
"0.5538307",
"0.55322725",
"0.55227345",
"0.55227345",
"0.5520316",
"0.5520237",
"0.5518395",
"0.551695",
"0.551695"
] | 0.0 | -1 |
Loads the extensions given by the strings. | def load_extensions(*exts)
exts.each do |ext|
load file_name(ext)
sym = ext_sym(ext)
cfg = @extcfg != nil ? @extcfg[ext] : nil
obj = Object.const_get(sym).new(cfg, @extdb, @server, @irc_proto, @fn_registrar, @botstate, @udb, @cdb)
obj.ext_load if obj.respond_to?(:ext_load)
@extensions[sym] = obj
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_extensions\n # Load the init.rb file\n require root('init.rb') if File.exists?(root('init.rb'))\n\n # Load the gems in the config file\n @config.gems.each { |gem| require gem }\n\n # Load the extensions\n ext_roots = Dir[root(:extensions, '*')].select { |d| File.directory? d }\n ext_roots.each do |dir|\n ext = File.basename(dir)\n\n # Try extensions/name/name.rb\n # Try extensions/name/lib/name.rb\n ext_files = [\n File.join(dir, \"#{ext}.rb\"),\n File.join(dir, 'lib', \"#{ext}.rb\")\n ]\n ext_files.reject! { |f| not File.exists? f }\n require ext_files[0] if ext_files[0]\n end\n end",
"def loadExt(*names)\n\t\tnames.each { |name|\n\t\t\[email protected](name)\n\t\t}\n\tend",
"def extensions\n @extensions ||= @pathname.basename.to_s.scan(/\\.[^.]+/)\n end",
"def load_plugins\n super\n extension_loader.load_extensions\n end",
"def extension(*extensions)\n if extensions[0].is_a?(Array)\n @_ext = extensions[0]\n else\n @_ext = extensions\n end\n end",
"def load_extension_inclusions\n return unless config_hash[\"Extensions\"]\n config_options[:extensions] = config_hash[\"Extensions\"]\n end",
"def register_for_extensions(extensions)\n extensions = [*extensions]\n ExtensionMap.parsers ||= []\n ExtensionMap.parsers << self\n ExtensionMap.extensions_for ||= {}\n ExtensionMap.parsers_for ||= {}\n extensions.each do |extension|\n ExtensionMap.parsers_for[extension] ||= []\n ExtensionMap.parsers_for[extension] << self\n ExtensionMap.extensions_for[self] ||= []\n ExtensionMap.extensions_for[self] << extension\n end\n end",
"def load(*globs)\n skips = globs.grep(/^-/)\n (globs - skips).each do |glob|\n glob += '.rb' if glob =~ /\\*$/\n Dir.glob(glob).sort.each do |path|\n next unless File.file? path\n next if skips.find {|pat| path =~ /#{pat[1..-1]}$/}\n instance_eval(File.read(path), path)\n end\n end\n end",
"def extensions=(extensions); end",
"def load_strings(file_or_url)\n loadStrings(file_or_url).to_a\n end",
"def load_strings(file_or_url)\n loadStrings(file_or_url).to_a\n end",
"def add_extensions(exts)\n if exts.any?\n self.class.wrap(self, extensions + exts.to_a)\n else\n self\n end\n end",
"def add_extensions(exts)\n if exts.any?\n self.class.wrap(self, extensions + exts.to_a)\n else\n self\n end\n end",
"def load_extension path\n instance_eval(File.read(File.join(File.dirname(__FILE__), path)))\n end",
"def load_translations(*filenames); end",
"def load_translations(*filenames); end",
"def extensions\n @extensions ||= Dir[File.join(@ext_dir, '*')]\n end",
"def extensions\n @extensions ||= Dir['ext/**/extconf.rb']\n end",
"def input(extnames)\n extnames = Array(extnames)\n self.extname_list ||= []\n self.extname_list += extnames.map { |e| \".#{e.to_s.downcase}\" }\n end",
"def extensions\n @extensions ||= []\n end",
"def extensions\n @extensions ||= []\n end",
"def extensions=(extensions)\n @extensions = Array extensions\n end",
"def extensions\n @extensions ||= []\n end",
"def add_extensions(*extensions)\n self.extensions += extensions\n end",
"def internal_load_paths(paths)\n load_paths = []\n unless paths.is_a? Array\n paths = [paths]\n end\n \n paths.each do |path|\n expanded_path = File.expand_path(path)\n if File.exists?( expanded_path )\n @class_loader.addPath( expanded_path )\n \n load_paths << expanded_path\n end\n end\n \n load_paths\n end",
"def by_extension(ext); end",
"def load_strings(strings_filename)\n return [{}, {}]\n end",
"def using *extension_names\n extension_names.each do |extension_name|\n if extension = @@__extensions.find{|ext| ext.__name.to_s == extension_name.to_s }\n extension.extension_used self if extension.respond_to? :extension_used\n self.metaclass.send :define_method, :\"#{extension_name}\" do\n return extension\n end\n else\n raise ExtensionNotFoundError, \"Extension not found: #{extension_name}\"\n end\n end\n end",
"def set_extensions(val)\n @extensions = val\n build_path_query\n @extensions\n end",
"def load_files_in(directory_name, options = {})\n get_files_in(directory_name, options).sort.each { |ext| load ext }\n end",
"def extensions=(value)\n @extensions = value\n end",
"def extensions=(value)\n @extensions = value\n end",
"def extensions=(value)\n @extensions = value\n end",
"def load_paths(paths)\n load_paths = []\n unless paths.is_a? Array\n paths = [paths]\n end\n \n paths.each do |path|\n expanded_path = File.expand_path(path)\n if !@loaded_paths.include?( expanded_path ) && File.exists?( expanded_path )\n $CLASSPATH << expanded_path\n load_paths << expanded_path\n @loaded_paths << expanded_path\n end\n end\n \n load_paths\n end",
"def extensions\n _, *segments = name.downcase.split(\".\", -1)\n\n segments.map.with_index do |segment, index|\n \".\" + segments[index..-1].join(\".\")\n end\n end",
"def append_extensions(*extensions)\n self.extensions.push(*extensions)\n end",
"def extensions; end",
"def extensions; end",
"def extensions; end",
"def add_loader(ext, loader)\n ext = \".#{ext}\" unless ext =~ /^\\./\n @loaders[ext] = loader\n end",
"def extensions\n []\n end",
"def extensions\n []\n end",
"def load(module_)\n module_extensions(module_).each do |path|\n load_extension_file(module_, path)\n end\n end",
"def load_files(*sources); end",
"def prepend_extensions(*extensions)\n self.extensions.unshift(*extensions)\n end",
"def loadpath(*paths)\r\n paths.reverse_each do |path|\r\n $LOAD_PATH.unshift File.expand_path(path)\r\n end\r\n \r\n $LOAD_PATH.uniq!\r\n $LOAD_PATH\r\n end",
"def valid_extensions\n %w[.rb .js]\n end",
"def load(*files)\n files.map { |f|\n evaluate(File.read(f).gsub(/\\A#!.*$/, ''), f, 1)\n }.last\n end",
"def interpret(mods)\n @_extensions ||= []\n [mods].flatten.compact.uniq.each { |mod|\n next if @_extensions.include?(mod)\n @_extensions << mod\n extend(mod)\n }\n self\n end",
"def extensions\n TYPE_EXTS[type] || []\n end",
"def file_extensions\n safe_const_get(:FILE_EXTENSIONS) || []\n end",
"def set_load_paths(*paths)\n $:.concat(paths); load_paths.concat(paths)\n $:.uniq!; load_paths.uniq!\n end",
"def load_imports\n while fn = @pending_imports.shift\n next if @imported.member?(fn)\n ext = File.extname(fn)\n loader = @loaders[ext] || @default_loader\n loader.load(fn)\n @imported << fn\n end\n end",
"def register_as_default_for_extensions(extensions)\n ExtensionMap.default_parser_for ||= {}\n extensions = [*extensions]\n extensions.each do |extension|\n ExtensionMap.default_parser_for[extension.to_sym] = self\n end\n end",
"def load_paths=(dirs)\n dirs.each do |dir|\n directory = File.expand_path(dir)\n $LOAD_PATH.unshift(directory) unless $LOAD_PATH.include?(directory)\n Dir[\"#{directory}/*.rb\"].each { |file| require file }\n end\n end",
"def load_translations(*filenames)\n filenames = I18n.load_path if filenames.empty?\n \n @filenames = filenames.flatten\n \n @filenames.each { |filename| load_file(filename) }\n end",
"def add_ext(str,ext)\n ( str.strip=~/\\.#{ext}$/ ) ? str.strip : \"#{str.strip}.#{ext}\"\n end",
"def load_paths\n @load_paths ||= [\"urls.rb\", \"config/urls.rb\", \"mailers/*.rb\", \"controllers/**/*.rb\", \"controllers.rb\", \"helpers/*.rb\"]\n end",
"def load_base_plugin(str)\n if str == 'AttachmentFu'\n load_attachment_fu\n elsif str == 'Paperclip'\n load_paperclip\n else\n raise ScribdFuError, \"Sorry, only Attachment_fu and Paperclip are supported.\"\n end\n end",
"def src_extensions(extensions = nil)\n extensions ? @src_extensions = extensions : get_inherited_attribute(\"@src_extensions\")\n end",
"def engine_for(path)\n path = File.expand_path(path) \n EXTENSIONS[path.match(/\\.([^\\.]*)$/)[1]]\n end",
"def engine_for(path)\n path = File.expand_path(path) \n EXTENSIONS[path.match(/\\.([^\\.]*)$/)[1]]\n end",
"def extension_strings\n\t\treturn nil if @extensions.empty?\n\t\treturn @extensions.compact.join('; ')\n\tend",
"def load(files = T.unsafe(nil), reparse = T.unsafe(nil)); end",
"def cmd_load(*args)\n if args.length.zero?\n args.unshift(\"-h\")\n end\n\n @@load_opts.parse(args) { |opt, idx, val|\n case opt\n when '-h'\n cmd_load_help\n return true\n end\n }\n\n # Load each of the modules\n args.each { |m|\n md = m.downcase\n\n if extensions.include?(md)\n print_error(\"The '#{md}' extension has already been loaded.\")\n next\n end\n\n print(\"Loading extension #{md}...\")\n\n begin\n # Use the remote side, then load the client-side\n #if (client.core.use(md) == true)\n client.add_extension(md) # NOTE: Doesn't work, going to use core instead\n add_extension_client(md)\n #end\n rescue\n print_line\n log_error(\"Failed to load extension: #{$!}\")\n next\n end\n\n print_line(\"success.\")\n }\n\n return true\n end",
"def load_gems_in(*spec_dirs); end",
"def extensions=(value)\n subtags = Array(value).flatten\n self.extensions_sequence = subtags.empty? ? nil : subtags.join(HYPHEN)\n end",
"def ext(ext)\n self.map do |f|\n Neutron.file_to_ext(f, ext)\n end\n end",
"def load_expander(ext_name)\n %w(models helpers).each do |targets|\n Chanko::Loader.directories.each do |directory|\n Pathname.glob(directory.join(\"#{ext_name}/#{targets}/*.rb\")).sort.each do |target|\n require_dependency \"#{target.dirname}/#{target.basename}\"\n end\n end\n end\n\n ext_name.to_s.camelize.constantize.tap do |ext|\n ext.expand!\n end\n end",
"def load_packages\n pattern = File.expand_path(File.join(\"..\", \"*.rb\"), File.dirname(__FILE__)) \n Dir[pattern].each {|f| load f}\n end",
"def load(*languages)\n languages.flatten!\n languages.each do |lang_code|\n lang_file = LangFile.new lang_code, self.lang_file_dirs\n @@languages[lang_code.to_sym] = lang_file\n lang_file.load\n end\n self.use languages.first if current_language.nil?\n end",
"def parse_extensions(fhir_formulary_extensions = [])\n\t\t# extensions = fhir_formulary.extension\n\t\t# if extensions.present?\n fhir_formulary_extensions.each do |extension|\n if extension.url.include?(\"DrugTierID\")\n @drug_tier = coding_to_string(extension.valueCodeableConcept&.coding).downcase\n elsif extension.url.include?(\"PharmacyType\")\n pharmacy_type = coding_to_string(extension.valueCodeableConcept&.coding).downcase\n if pharmacy_type.include?(\"mail\")\n @mailorder = true\n @mail_supplies << pharmacy_type\n end\n elsif extension.url.include?(\"PriorAuthorization-extension\")\n @prior_auth = extension.valueBoolean\n elsif extension.url.include?(\"PriorAuthorizationNewStartsOnly\")\n @prior_auth_newstart = extension.valueBoolean\n elsif extension.url.include?(\"StepTherapyLimit-extension\")\n @step_therapy = extension.valueBoolean\n elsif extension.url.include?(\"StepTherapyLimitNewStartsOnly\")\n @step_therapy_newstart = extension.valueBoolean\n elsif extension.url.include?(\"QuantityLimit-extension\")\n @quantity_limit = extension.valueBoolean\n elsif extension.url.include?(\"AvailabilityPeriod\")\n @availability_period = period_to_string(extension.valuePeriod)\n elsif extension.url.include?(\"FormularyReference\")\n @plan_id = parse_reference_id(extension.valueReference&.reference)\n @plan = formularies_byid[plan_id&.to_sym]\n # @plan_id_path = \"/coverageplans/#{plan_id}\"\n # @plan_id_name = plan[:name]\n end\n end\n\t\t# else\n\t\t\t# @drug_tier = \"Required extensions not specified\"\n\t\t# end\n\tend",
"def extension_loader\n ExtensionLoader.instance { |l| l.initializer = self }\n end",
"def extension_whitelist\n %w[txt csv xls xlsx doc docx gif jpg jpeg png bmp svg pdf ppt pptx]\n end",
"def extensions=(val)\n set_extensions(val)\n val\n end",
"def load_localization!\n reset_l10n_data\n\n # Load the rails localization\n if rails_localization_files\n rails_localization_files.each do |file|\n lang = File.basename(file, '.*')[0,2].downcase.to_sym\n # if a country is defined\n if File.basename(file, '.*')[3,5]\n country = File.basename(file, '.*')[3,5].upcase.to_sym\n @@countries << country if ( country != :* && !@@countries.include?(country) )\n if locales.include?(\"#{lang}-#{country}\".to_sym)\n @@locales[\"#{lang}-#{country}\".to_sym].merge(YAML.load_file(file).symbolize_keys)\n else\n @@locales[\"#{lang}-#{country}\".to_sym] = YAML.load_file(file).symbolize_keys\n @@rails_locales[locale_name(\"#{lang}-#{country}\")] = \"#{lang}-#{country}\".to_sym\n end\n @@languages << lang unless @@languages.include? lang\n else\n @@languages << lang unless @@languages.include? lang\n @f_locale = \"#{lang}-*\".to_sym\n @@locales[@f_locale] = @@locales[@f_locale].merge(YAML.load_file(file).symbolize_keys) if locales.include?(@f_locale)\n @@locales[@f_locale] = YAML.load_file(file).symbolize_keys unless locales.include?(@f_locale)\n end\n end\n end\n alias :load_translations! :load_localization!\n alias :load_localizations! :load_localization!\n\n # Load the UI localization\n if ui_localization_files\n ui_localization_files.each do |file|\n lang = File.basename(file, '.*')[0,2].downcase.to_sym\n if File.basename(file, '.*')[3,5]\n country = File.basename(file, '.*')[3,5].upcase.to_sym\n else\n country = '*'.to_sym\n end\n @@languages << lang unless @@languages.include? lang\n @@countries << country if ( country != :* && !@@countries.include?(country) )\n @file_locale = \"#{lang}-#{country}\".to_sym\n if locales.include?(@file_locale)\n @@locales[@file_locale] = @@locales[@file_locale].merge(YAML.load_file(file).symbolize_keys)\n @@ui_locales[locale_name(\"#{lang}-#{country}\")] = \"#{lang}-#{country}\".to_sym\n else\n @@locales[@file_locale] = YAML.load_file(file).symbolize_keys\n @@ui_locales[locale_name(\"#{lang}-#{country}\")] = \"#{lang}-#{country}\".to_sym\n end\n end\n end\n localize_rails\n # Return the path of the localization files\n return \"#{ui_localization_files} | #{rails_localization_files}\".to_s\n end",
"def extension_whitelist\n %w(mp4 ogv avi)\n end",
"def load(*args)\n args.each do |thing|\n key = File.basename(thing.to_s).sub('.rb', '')\n if(thing.is_a?(String))\n components[key] = self.class.load_component(thing)\n else\n components[key] = sparkle.get(:component, thing)[:block]\n end\n @load_order << key\n end\n self\n end",
"def load_files(filename)\n filename_domain = filename.sub('.yai', '.yad')\n\n content = ''\n content << load_file_to_content(filename_domain)\n content << load_file_to_content(filename)\n end",
"def add_extension(path); end",
"def extensions\n @@extensions\n end",
"def extensions\n @@extensions\n end",
"def register(thing, *extensions)\n return if extensions.empty?\n extensions.map! { |ext| ext[0] == ?. ? ext.downcase : \".#{ext.downcase}\" }\n extensions.each { |ext| REGISTRY[ext] = thing }\n EXTENSIONS[thing] = extensions.first\n nil\n end",
"def file_exts\n [].concat(viewed_exts).concat(edited_exts).concat(convert_exts).concat(fill_forms_exts)\n end",
"def load_classes filename\n constants = Module.constants\n\n # Have to wrap in thread because otherwise causes seg fault in GUI\n t = Thread.new do\n load filename\n end\n t.join\n\n (Module.constants - constants).map do |sym|\n Module.const_get sym\n end\n end",
"def load!(alt_path=nil)\n path = alt_path ? Pathname.new(alt_path) : pathname()\n path.glob('*').each do |file|\n #next if file.to_s.index(/[.]/) # TODO: rejection filter\n name = file.basename #path_to_name(file, path)\n self[name] = get!(file)\n end\n self\n end",
"def add_extension(path, name = T.unsafe(nil)); end",
"def has_ext?(path, *exts)\n exts.include? Pa.ext2(get(path))\n end",
"def lookup!\n $LOAD_PATH.each do |base|\n Dir[File.join(base, *file_lookup_paths)].each do |path|\n path = path.delete_prefix(\"#{base}/\")\n require path\n rescue Exception\n # No problem\n end\n end\n end",
"def initialize(extensions: nil)\n @extensions = extensions || {}\n end",
"def load_backends(path = MDS::DEFAULT_BACKEND_PATHS)\r\n Dir.glob(File.expand_path(path)) do |path|\r\n begin\r\n require path\r\n rescue LoadError\r\n end\r\n end\r\n end",
"def load(name); end",
"def load_gemfiles(directories)\n directories.each do |directory|\n gemfile = File.expand_path(File.join(directory, 'Gemfile'))\n eval(File.read(gemfile), binding) if File.exist?(gemfile)\n end\nend",
"def extensions\n @config[:extensions]\n end",
"def maybe_convert_extension(ext); end",
"def load_autoloaded_constants\n constants.each do |const|\n const_get(const) if autoload?(const)\n end\n end",
"def load_autoloaded_constants\n constants.each do |const|\n const_get(const) if autoload?(const)\n end\n end",
"def load_files\n files = []\n translations = {}\n globals = {}\n I18n.load_path.each do |file|\n data = YAML.load_file(file)\n \n # Try to identify type from file's path name\n # TODO: Try to find a use for that\n case file\n when /\\/gems\\/activesupport-(.*)\\/lib\\/active_support\\/locale\\//:\n type = \"ActiveSupport\"\n when /\\/gems\\/activerecord-(.*)\\/lib\\/active_record\\/locale\\//:\n type = \"ActiveRecord\"\n when /\\/gems\\/actionpack-(.*)\\/lib\\/action_view\\/locale\\//:\n type = \"ActionView\"\n else\n type = \"file\"\n end\n\n if data.is_a? Hash\n # Skip non-hash translation files\n data.keys.collect do |locale|\n files << { :locale => locale, :filename => file, :type => type } \n locale = locale.to_sym\n # Mix in (from simpe I18n backend)\n translations[locale] ||= {}\n sdata = deep_symbolize_keys(data)\n merger = proc { |key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }\n translations[locale].merge!(sdata[locale], &merger)\n # Build global translation keys from all locales\n globals.merge!(sdata[locale],&merger)\n end\n end\n \n end\n \n return {\n :files => files,\n :translations => translations,\n :globals => globals,\n }\n \n return files\n end",
"def register_handler(extensions, handler_class)\n extensions.each do |ext|\n handlers[/\\.#{ext}$/i] = handler_class\n end\n known_extensions.concat extensions\n end",
"def extensions\n data.extensions\n end"
] | [
"0.705724",
"0.6660721",
"0.63811004",
"0.62944615",
"0.62944275",
"0.6149996",
"0.6111337",
"0.61005586",
"0.6092781",
"0.6088871",
"0.60877496",
"0.6082909",
"0.6082909",
"0.6073551",
"0.6064482",
"0.6064482",
"0.603119",
"0.600235",
"0.5991117",
"0.5952136",
"0.5952136",
"0.59503925",
"0.59483385",
"0.59403026",
"0.58882564",
"0.5880681",
"0.5873774",
"0.5824239",
"0.58232003",
"0.58215684",
"0.5790866",
"0.5790866",
"0.5790866",
"0.5771701",
"0.5753581",
"0.5736919",
"0.5730357",
"0.5730357",
"0.5730357",
"0.56894666",
"0.568056",
"0.568056",
"0.5675508",
"0.5674248",
"0.5645343",
"0.5636836",
"0.5629326",
"0.5617477",
"0.5596949",
"0.55922943",
"0.5584109",
"0.5567652",
"0.5555269",
"0.5544324",
"0.55382144",
"0.55264795",
"0.55100965",
"0.5503974",
"0.55038476",
"0.5503782",
"0.54771096",
"0.54771096",
"0.5447935",
"0.5445863",
"0.5430889",
"0.5423621",
"0.54202056",
"0.5418542",
"0.5416878",
"0.5399797",
"0.5395076",
"0.53949875",
"0.53827703",
"0.5371682",
"0.5371061",
"0.5359774",
"0.5347469",
"0.5340928",
"0.5338847",
"0.5337436",
"0.53346467",
"0.53346467",
"0.5317442",
"0.5298377",
"0.5292073",
"0.5286425",
"0.52821344",
"0.52787375",
"0.5273975",
"0.52735734",
"0.52703494",
"0.5268885",
"0.52674633",
"0.5264345",
"0.5251038",
"0.5249343",
"0.5249343",
"0.5239257",
"0.5233828",
"0.52232087"
] | 0.76309234 | 0 |
Unloads a loaded extension. | def unload_extensions(*exts)
exts.each do |ext|
sym = ext_sym(ext)
obj = @extensions[sym]
obj.ext_unload if obj.respond_to?(:ext_unload)
obj.unload
Object.send(:remove_const, sym)
@extensions.delete sym
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_extension(extension)\n self.extensions.delete(extension)\n end",
"def unregister_extension(const)\n @@extensions.delete(const)\n end",
"def unregister_extension(const)\n @@extensions.delete(const)\n end",
"def unregister\n Registry.unregister_loader(self)\n ExplicitNamespace.unregister_loader(self)\n end",
"def unregister(const)\n @@extensions.delete(const)\n end",
"def un_load\n\n NSLog('Whatever hasn\\'t been unloaded and could be better be now!')\n NSLog('We probably don\\'t need this now that we\\'re using RubyMotion and it\\'s awesome!')\n\n end",
"def deregister_extension(name)\n self.ext.aliases.delete(name)\n end",
"def unalias_extension(extension)\n aliases.delete(normalize_extension(extension))\n end",
"def unload name\n raise \"Cannot unload: No such script #{name}\" unless @scripts.key? name\n\n @scripts[name].die if @scripts[name].respond_to? \"die\"\n\n Events.dispatch_for @scripts[name], :unloading\n\n Events.delete_for @scripts[name]\n URL.delete_for @scripts[name] if defined? MODULE_LOADED_URL_HANDLER\n RegexHandlerManager.delete_for @scripts[name] if defined? MODULE_LOADED_REGEX_HANDLER\n\n @scripts[name].unregister_script\n @scripts[name].unregister_commands\n @scripts[name].unregister_events\n\n @scripts.delete name\n end",
"def unshare_extension(extension_name, user)\n extension_path = \"/api/v1/extensions/#{extension_name}\"\n\n header = Mixlib::Authentication::SignedHeaderAuth.signing_object(\n http_method: 'delete',\n path: extension_path,\n user_id: user.username,\n timestamp: Time.now.utc.iso8601,\n body: ''\n ).sign(private_key)\n\n delete extension_path, {}, header\n end",
"def delete(ext_type, name)\n @extensions[ext_type].delete(name)\n end",
"def unload!\n if Native.unload(@path_to)\n @loaded = false\n true\n else\n false\n end\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 stop_registering_extension\n @register_path = nil\n end",
"def unload!(path)\n component_wrap = ComponentWrap.from_path(self, path)\n if component_wrap\n info \"Unloading: #{component_wrap.raw_component.name} from #{path}\"\n component_wrap.unload!\n @loaded_components.delete(component_wrap)\n end\n end",
"def remove_loader(loader)\n @loaders.delete(loader)\n end",
"def unload name\n raise \"Cannot unload: No such script #{name}\" unless @scripts.has_key? name\n\n @scripts[name].die if @scripts[name].respond_to? \"die\"\n\n @scripts[name].unregister_script\n @scripts[name].unregister_commands\n @scripts[name].unregister_events\n\n @scripts.delete name\n end",
"def unload!\n cache.save if @__cache\n __send__ :unloaded if respond_to? :unloaded\n\n @__cache = nil\n end",
"def unregister(*extensions); end",
"def deregister_extension_alias(name)\n self.ext_aliases.aliases.delete(name)\n end",
"def exit_load\n load_stack.pop\n end",
"def unsave_module(valid_uni_module)\n uni_modules.delete(valid_uni_module)\n end",
"def clear\n @extensions_for.clear\n end",
"def unload\n Unit.unload(self.label)\n end",
"def unshare_extension_version(extension_name, version, user)\n extension_version_path = api_v1_extension_version_path(\n username: user.username,\n extension: extension_name,\n version: version)\n\n header = Mixlib::Authentication::SignedHeaderAuth.signing_object(\n http_method: 'delete',\n path: extension_version_path,\n user_id: user.username,\n timestamp: Time.now.utc.iso8601,\n body: ''\n ).sign(private_key)\n\n delete extension_version_path, {}, header\n end",
"def unload\n mutex.synchronize do\n # We are going to keep track of the files that were required by our\n # autoloads to later remove them from $LOADED_FEATURES, thus making them\n # loadable by Kernel#require again.\n #\n # Directories are not stored in $LOADED_FEATURES, keeping track of files\n # is enough.\n unloaded_files = Set.new\n\n autoloads.each do |abspath, (parent, cname)|\n if parent.autoload?(cname)\n unload_autoload(parent, cname)\n else\n # Could happen if loaded with require_relative. That is unsupported,\n # and the constant path would escape unloadable_cpath? This is just\n # defensive code to clean things up as much as we are able to.\n unload_cref(parent, cname)\n unloaded_files.add(abspath) if ruby?(abspath)\n end\n end\n\n to_unload.each do |cpath, (abspath, (parent, cname))|\n # We have to check cdef? in this condition. Reason is, constants whose\n # file does not define them have to be kept in to_unload as explained\n # in the implementation of on_file_autoloaded.\n #\n # If the constant is not defined, on_unload should not be triggered\n # for it.\n if !on_unload_callbacks.empty? && cdef?(parent, cname)\n value = parent.const_get(cname)\n run_on_unload_callbacks(cpath, value, abspath)\n end\n\n unload_cref(parent, cname)\n unloaded_files.add(abspath) if ruby?(abspath)\n end\n\n unless unloaded_files.empty?\n # Bootsnap decorates Kernel#require to speed it up using a cache and\n # this optimization does not check if $LOADED_FEATURES has the file.\n #\n # To make it aware of changes, the gem defines singleton methods in\n # $LOADED_FEATURES:\n #\n # https://github.com/Shopify/bootsnap/blob/master/lib/bootsnap/load_path_cache/core_ext/loaded_features.rb\n #\n # Rails applications may depend on bootsnap, so for unloading to work\n # in that setting it is preferable that we restrict our API choice to\n # one of those methods.\n $LOADED_FEATURES.reject! { |file| unloaded_files.member?(file) }\n end\n\n autoloads.clear\n autoloaded_dirs.clear\n to_unload.clear\n lazy_subdirs.clear\n\n Registry.on_unload(self)\n ExplicitNamespace.unregister_loader(self)\n\n @setup = false\n @eager_loaded = false\n end\n end",
"def exit_load_revision\n load_revision_stack.pop\n end",
"def registry_unloadkey(key)\n if session_has_registry_ext\n meterpreter_registry_unloadkey(key)\n else\n shell_registry_unloadkey(key)\n end\n end",
"def unplug!\n return self unless exist?\n ole.Delete\n self\n end",
"def destroy\n @extension_type = ExtensionType.find(params[:id])\n @extension_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(extension_types_url) }\n format.xml { head :ok }\n end\n end",
"def clear\n @types = nil\n @explicit = nil\n extensions.each do |extension|\n extension.clear\n end\n end",
"def uninstall!(database)\n drop_extension(database)\n make_uninstall(database)\n end",
"def destroy\n @extension.destroy\n respond_to do |format|\n format.html { redirect_to request.referrer, notice: 'Extension was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def unload!\n @versions = nil\n @version_json = {}\n @last_update = {}\n @maps = {}\n @mappings = nil\n end",
"def loaded(path)\n load_map.delete path\n end",
"def unload_all\n @last_unload = []\n loaded_safe.each do |plugin|\n unload_one plugin\n @last_unload << plugin\n end\n unload_one TWG::Core\n 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 uninstall_kext(directives)\n Array(directives[:kext]).each do |kext|\n ohai \"Unloading kernel extension #{kext}\"\n is_loaded = @command.run!(\"/usr/sbin/kextstat\", args: [\"-l\", \"-b\", kext], sudo: true).stdout\n if is_loaded.length > 1\n @command.run!(\"/sbin/kextunload\", args: [\"-b\", kext], sudo: true)\n sleep 1\n end\n @command.run!(\"/usr/sbin/kextfind\", args: [\"-b\", kext], sudo: true).stdout.chomp.lines.each do |kext_path|\n ohai \"Removing kernel extension #{kext_path}\"\n @command.run!(\"/bin/rm\", args: [\"-rf\", kext_path], sudo: true)\n end\n end\n end",
"def remove_extension_item(value)\n @children['extension-item'][:value].delete(value)\n end",
"def unload_plugin(name)\n p = get_plugin(name)\n\n p.unload if p.respond_to?(:unload)\n Capistrano.remove_plugin(name)\n end",
"def unload_scripts!\n @scripts.each do |_name, script|\n script.__send__ :unloaded if script.respond_to? :unloaded\n end.clear\n\n Blur.reset_scripts!\n end",
"def unloading_dup\n d = dup\n d.unload!\n yield d if block_given?\n d\n end",
"def unload(kill:false)\n\t\tputs \"Unloading: #{@file}\"\n\t\t\n\t\tunless @wrapped_object.nil?\n\t\t\tif kill\n\t\t\t\t# (kill now: dont save data, as it may be corrupted)\n\t\t\t\t\n\t\t\telse\n\t\t\t\t# (safe shutdown: save data before unloading)\n\t\t\t\t@wrapped_object.serialize(@save_directory)\n\t\t\tend\n\t\t\t\n\t\t\t@wrapped_object = nil\n\t\tend\n\tend",
"def reload!(path)\n unload! path\n load! path if File.file?(path) # condition to avoid errors when a file is removed or renamed...\n end",
"def unregister_adapter(name)\n @@loaded_adapters.delete(name)\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\n @unload_controller = @controller\n end",
"def destroy\n @extension.destroy\n respond_to do |format|\n format.html { redirect_to menu_extension_2_path, notice: 'La actividad se elimino con exito.' }\n format.json { head :no_content }\n end\n\n end",
"def destroy_import_data\n Managers::MVideo.new(self).delete_localization_folder\n end",
"def unload!\n Origen.app.unload_target!\n end",
"def shell_registry_unloadkey(key)\n key = normalize_key(key)\n shell_registry_cmd_result(\"unload \\\"#{key}\\\"\")\n end",
"def RemoveModuleToLoad(name)\n Builtins.y2milestone(\"Removing module to be loaded at boot: %1\", name)\n @kernel_modules_to_load = Builtins.add(\n @kernel_modules_to_load,\n { \"operation\" => \"remove\", \"name\" => name }\n )\n\n nil\n end",
"def unload_plugins\n en_ete_dw_up\n tool_menu.remove(@menu_item_extract_text)\n end",
"def unstub(url)\n @stubs.delete(url_as_regex(url))\n end",
"def remove_plugin(name)\n @data[\"installed\"].delete(name)\n save!\n end",
"def unloadpath(*paths)\r\n paths.each {|path| $LOAD_PATH.delete File.expand_path(path) }\r\n $LOAD_PATH\r\n end",
"def uninstall_tab\n\t\tself.module\n\t\tself.uninstall_tab_callback \n\t\tself.delete_tab_on_facebook\n\tend",
"def unload\n @members.clear\n @loaded = false\n end",
"def uninstall\n cmd = [:uninstall]\n case (pkg :version).chomp\n when /052adf36c3f4/\n cmd << '-r'\n end\n cmd << @resource[:name]\n self.unhold if self.properties[:mark] == :hold\n begin\n pkg cmd\n rescue StandardError, LoadError => e\n self.hold if self.properties[:mark] == :hold\n raise e\n end\n end",
"def unsave\n client.post('/api/unsave', id: read_attribute(:name))\n end",
"def unbind(url)\n @allocations.delete(url)\n @http_server.unmount(url)\n @http_server.remap\n end",
"def unregister(symbol); end",
"def unload!\n unload_resources!\n reset_menu!\n end",
"def unstage_file(path)\n unstage_files(path)\n end",
"def unregister(path)\n\t\t\t\tpath = path.to_sym\n\t\t\t\tif @@registry[path]\n\t\t\t\t\t@@registry_count[path] -= 1\n\t\t\t\t\tif @@registry_count[path] <= 0\n\t\t\t\t\t\tsub = @@registry.delete(path)\n\t\t\t\t\t\tsub.unsubscribe\n\t\t\t\t\t\t@@registry_count.delete(path)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def unloadable(const_desc)\n Dependencies.mark_for_unload const_desc\n end",
"def clean_load_path\r\n $:.delete @path unless @path.nil?\r\n end",
"def without_extensions\n @lock.with_read_lock do\n return self unless has_extensions?\n @without_extensions ||= self.class.new(language: language, script: script, region: region, variants: variants)\n end\n end",
"def ungem(obj)\n return unless gems?(obj)\n\n run_hook(:before_ungem, obj)\n Recommendable.redis.srem(Recommendable::Helpers::RedisKeyMapper.gemd_set_for(obj.class, id), obj.id)\n Recommendable.redis.srem(Recommendable::Helpers::RedisKeyMapper.gemd_by_set_for(obj.class, obj.id), id)\n run_hook(:after_ungem, obj)\n\n true\n end",
"def unload\n @all = nil\n end",
"def delete(thing)\n REGISTRY.delete_if { |_,v| v == thing }\n EXTENSIONS.delete thing\n end",
"def remove_unloadable_constants!\n log(\"removing unloadable constants\")\n autoloaded_constants.each { |const| remove_constant const }\n autoloaded_constants.clear\n Reference.clear!\n explicitly_unloadable_constants.each { |const| remove_constant const }\n end",
"def clear_persistent_LOADED_FEATURES\n RubyContext.clear_persistent_LOADED_FEATURES\n end",
"def remove_library(lib)\n lib = lib.to_s\n\n @libraries[:start].delete lib\n @libraries[:sub_session].delete lib\n @libraries[:autoload].reject!{|_,e,| e == lib }\n @libraries[:thread].each{ |_,libs| libs.delete lib }\n @libraries[:late].delete lib\n @libraries[:late_thread].each{ |_,libs| libs.delete lib }\n\n @lib_hooks.delete lib\n end",
"def remove_library(lib)\n lib = lib.to_s\n\n @libraries[:start].delete lib\n @libraries[:sub_session].delete lib\n @libraries[:autoload].reject!{|_,e,| e == lib }\n @libraries[:thread].each{ |_,libs| libs.delete lib }\n @libraries[:late].delete lib\n @libraries[:late_thread].each{ |_,libs| libs.delete lib }\n\n @lib_hooks.delete lib\n end",
"def load_extension path\n instance_eval(File.read(File.join(File.dirname(__FILE__), path)))\n end",
"def force_reload\n\t\t\tcall(:on_unload)\n\t\t\[email protected]\n\t\t\treload\n\t\tend",
"def load_and_delete_file( filepath )\n obj = load( filepath )\n delete_file( filepath )\n obj\n end",
"def unload\n Dimensions.unload(self.physical_quantity)\n end",
"def unload_master\n @master_preferences.delete(@master_label)\n @master_preferences\n end",
"def reload name\n raise \"Cannot reload: No such script #{name}\" unless @scripts.key? name\n\n filename = \"#{SCRIPTS_PATH}/#{name}.rb\"\n\n raise \"Script file for #{name} does not exist (#{filename}).\" unless File.exist? filename\n\n @scripts[name].die if @scripts[name].respond_to? 'die'\n\n Events.dispatch_for @scripts[name], :unloading\n\n Events.delete_for @scripts[name]\n URL.delete_for @scripts[name] if defined? MODULE_LOADED_URL_HANDLER\n RegexHandlerManager.delete_for @scripts[name] if defined? MODULE_LOADED_REGEX_HANDLER\n\n @scripts[name].unregister_script\n @scripts[name].unregister_commands\n @scripts[name].unregister_events\n\n @scripts.delete name\n\n load_file filename\n end",
"def deactivate(location_ext_key)\n debug(\"deactivate: #{location_ext_key}\")\n response = set_state(:deactivation, location_res(location_ext_key).location) if can_be_deactivated?(location_ext_key)\n location_res_to_map(response.data.location) if response\n end",
"def reload\n load @filename\n end",
"def load\n instance_eval File.read(@path).tap(&Gem::UNTAINT), @path, 1\n\n self\n end",
"def unlink_dataset(name)\n d = dataset(name)\n return nil if d.nil?\n\n self.metadata[:datasets].delete(name)\n save\n if d.ref? && d.active?\n recalculate_tasks(\"Reference dataset unlinked: #{d.name}\")\n end\n pull_hook(:on_unlink_dataset, name)\n d\n end",
"def reload_app \n return if @klass and @mtime and mtime <= @mtime\n\n if @requires\n @requires.each { |req| $LOADED_FEATURES.delete(req) }\n end\n k = @klass\n Object.send :remove_const, k.name if k\n load_app\n end",
"def unregister_template_handler(*extensions); end",
"def disable_extension(name)\n end",
"def remove\n @download_url = nil\n @latest_version = nil\n System.delete \"#{System.install_dir}/#{file_name.gsub('.exe', '')}.version\"\n System.delete driver_path\n end",
"def reload\n $LOADED_FRAMEWORKS.each do |framework| load framework end\n end",
"def clear\n @autoloaded_classes.to_a.reverse_each do |klass|\n RubyCodeAutoreloader::ClassLoader.remove_constant(klass)\n @autoloaded_classes.delete(klass)\n end\n\n @existing_modules_before_load.clear\n @autoloaded_files = []\n ActiveSupport::DescendantsTracker.clear\n ActiveSupport::Dependencies.clear\n end",
"def deconvert\n # release magic!\n eval(abstract_object[:_magic])\n end",
"def destroy\n @user_ext = UserExt.find(params[:id])\n @user_ext.destroy\n\n respond_to do |format|\n format.html { redirect_to user_exts_url }\n format.json { head :no_content }\n end\n end",
"def remove\n unrealize\n remove_from_dependencies\n remove_from_dependents\n end",
"def strip_ext(path)\n path.rpartition(File.extname(path))[0]\n end",
"def unload_image(image_handle)\n end",
"def unregister(slice_module)\n if (slice = self[slice_module]) && self.paths.delete(module_name = slice.name)\n slice.loadable_files.each { |file| Merb::Slices::Loader.remove_classes_in_file file }\n Object.send(:remove_const, module_name)\n unless Object.const_defined?(module_name)\n Merb.logger.info!(\"Unregistered slice #{module_name}\")\n Merb::Slices::Loader.reload_router!\n end\n end\n end",
"def unlink\n self.class.unlink(@path)\n end",
"def remove_feature(file)\n $LOADED_FEATURES.delete(file) unless feature_excluded?(file)\n end",
"def unsave\n post(\"/api/unsave\", id: fullname)\n end"
] | [
"0.69321036",
"0.6857119",
"0.6857119",
"0.647393",
"0.646589",
"0.64351654",
"0.6433499",
"0.6265598",
"0.6143335",
"0.60911155",
"0.6038763",
"0.5946734",
"0.5945626",
"0.59024876",
"0.58657897",
"0.58336586",
"0.5827383",
"0.582111",
"0.5807627",
"0.57793635",
"0.575354",
"0.5732679",
"0.57286024",
"0.5692356",
"0.562556",
"0.5512989",
"0.5503373",
"0.54389465",
"0.53760177",
"0.5370055",
"0.5316947",
"0.5311242",
"0.5262186",
"0.5257411",
"0.5237426",
"0.5230528",
"0.5225277",
"0.52162135",
"0.51881653",
"0.5177091",
"0.517052",
"0.51695114",
"0.5168298",
"0.51660424",
"0.5151864",
"0.5147847",
"0.5122852",
"0.5120916",
"0.5115655",
"0.51079494",
"0.5105789",
"0.5093943",
"0.5028777",
"0.5013864",
"0.49934086",
"0.49843487",
"0.49689013",
"0.49643934",
"0.49548423",
"0.4948972",
"0.49489677",
"0.494513",
"0.49424666",
"0.49398792",
"0.4937986",
"0.49299145",
"0.49178356",
"0.48998487",
"0.48753858",
"0.48750973",
"0.48736733",
"0.48647767",
"0.48638687",
"0.48611853",
"0.4861146",
"0.48462892",
"0.48395053",
"0.4833183",
"0.48326415",
"0.48317266",
"0.48302972",
"0.48246464",
"0.48238292",
"0.4806931",
"0.48013037",
"0.47916338",
"0.47900778",
"0.4783008",
"0.47820938",
"0.47819817",
"0.47681454",
"0.4767831",
"0.47620848",
"0.47587878",
"0.4755257",
"0.47500467",
"0.47471657",
"0.47462556",
"0.4738165",
"0.4736848"
] | 0.7001064 | 0 |
Returns a list of loaded extensions. | def extensions
e = []
@extensions.each_key do |k|
e.push k
end
return e
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_extensions\n r = []\n manager.Get.each do |ext|\n r << ext\n end\n r\n end",
"def extensions\n []\n end",
"def extensions\n []\n end",
"def extensions\n @extensions ||= []\n end",
"def extensions\n @extensions ||= []\n end",
"def extensions\n @extensions ||= []\n end",
"def extensions\n return @extensions\n end",
"def extensions\n return @extensions\n end",
"def extensions\n return @extensions\n end",
"def list\n @@extensions\n end",
"def extensions\n @extensions ||= Dir[File.join(@ext_dir, '*')]\n end",
"def extensions\n @@extensions\n end",
"def extensions\n @@extensions\n end",
"def get_extensions\n get_siteinfo('extensions')['query']['extensions'].collect { |e| e['name'] }\n end",
"def extensions\n self.class.extensions\n end",
"def extensions\n self.class.extensions\n end",
"def extensions\n @extensions.to_a\n end",
"def extensions\n @extensions ||= @pathname.basename.to_s.scan(/\\.[^.]+/)\n end",
"def extensions\n TYPE_EXTS[type] || []\n end",
"def extension_whitelist\r\n self.class.available_extensions\r\n end",
"def extensions\n @extensions ||= Dir['ext/**/extconf.rb']\n end",
"def extensions\n if wrapper\n (wrapper.extensions + config[:extensions]).uniq\n else\n config[:extensions]\n end\n end",
"def file_extensions\n safe_const_get(:FILE_EXTENSIONS) || []\n end",
"def extensions\n data.extensions\n end",
"def extensions\n @config[:extensions]\n end",
"def extensions\n source_node.xpath('.//Extension').to_a.collect do |node|\n Extension.new(node)\n end\n end",
"def get_extensions\n read_extensions 'storage', @options.model_extensions_dir\n end",
"def extension_modules\n local_extensions =\n class <<self\n included_modules-Object.included_modules\n end\n if local_extensions.size > 0\n local_extensions\n else\n [] # There weren't any; must be a literal node\n end\n end",
"def module_extensions(module_)\n current_module_dir = module_dir(module_)\n\n current_module_dir_length = current_module_dir.length + 1\n extensions = Dir[\"#{current_module_dir}/**/*.rb\"].map do |e|\n e[current_module_dir_length..]\n end\n\n extensions.sort!\n extensions\n end",
"def supported_extensions\n\t\treturn self.supported_extension_oids.collect {|oid| EXTENSION_NAMES[oid] || oid }\n\tend",
"def get_extensions\n collection = Occi::Collection.new\n BACKEND_TYPES.each { |backend_type| collection.merge! backend_instances[backend_type].get_extensions }\n collection\n end",
"def load_extensions(*exts)\r\n exts.each do |ext|\r\n load file_name(ext)\r\n sym = ext_sym(ext)\r\n cfg = @extcfg != nil ? @extcfg[ext] : nil\r\n obj = Object.const_get(sym).new(cfg, @extdb, @server, @irc_proto, @fn_registrar, @botstate, @udb, @cdb)\r\n obj.ext_load if obj.respond_to?(:ext_load)\r\n @extensions[sym] = obj\r\n end\r\n end",
"def extensions\n trail.extensions.dup\n end",
"def get_extensions\n # no extensions to include\n ::Occi::Collection.new\n end",
"def load_extensions\n # Load the init.rb file\n require root('init.rb') if File.exists?(root('init.rb'))\n\n # Load the gems in the config file\n @config.gems.each { |gem| require gem }\n\n # Load the extensions\n ext_roots = Dir[root(:extensions, '*')].select { |d| File.directory? d }\n ext_roots.each do |dir|\n ext = File.basename(dir)\n\n # Try extensions/name/name.rb\n # Try extensions/name/lib/name.rb\n ext_files = [\n File.join(dir, \"#{ext}.rb\"),\n File.join(dir, 'lib', \"#{ext}.rb\")\n ]\n ext_files.reject! { |f| not File.exists? f }\n require ext_files[0] if ext_files[0]\n end\n end",
"def extensions; end",
"def extensions; end",
"def extensions; end",
"def get_extensions\n read_extensions 'compute', @options.model_extensions_dir\n end",
"def extensions\n unless @extensions\n @extensions={}\n cert.extensions.each {|e| @extensions[e.oid]=e.value} if cert.extensions\n end\n @extensions\n end",
"def get_allowed_file_extensions\n get_siteinfo('fileextensions')['query']['fileextensions'].collect { |e| e['ext'] }\n end",
"def file_extensions\n [@file_extensions].flatten.compact.uniq\n end",
"def kextlist\n plists = Dir['{/System,}/Library/Extensions/**/*.kext/Contents/Info.plist']\n len, vec, idx = plists.length, [], -1\n jobs, pool, lock = options.jobs, [], Mutex.new\n\n # Threaded parsing of system kexts; ~35% speedup over single thread with\n # empty disk cache, and 100% more fun!\n jobs.times do |n|\n pool << Thread.new do\n loop do\n i = lock.synchronize { idx += 1 }\n break if i >= len\n id, deps = Plist.parse_xml(plists[i]).values_at 'CFBundleIdentifier', 'OSBundleLibraries'\n vec[i] = [id, (deps || {}).keys]\n end\n end\n end\n\n # `kextstat` shows all loaded kexts, including those not found in the\n # System \"Extension\" directories (kernel components, for example)\n kstat = kextstat\n\n pool.each &:join\n Hash[vec].merge kstat\n end",
"def list(*extensions)\n all_files.keep_if do |filename|\n extensions.include?(Pathname.new(filename).extname)\n end\n all_files.reject! { |file| excluded_file?(file) }\n all_files\n end",
"def extension_strings\n\t\treturn nil if @extensions.empty?\n\t\treturn @extensions.compact.join('; ')\n\tend",
"def get_extensions\n read_extensions 'network', @options.model_extensions_dir\n end",
"def load_plugins\n super\n extension_loader.load_extensions\n end",
"def extensions\n @trail.extensions.dup\n end",
"def extension_dependencies\n latest_extension_version.try(:extension_dependencies) || []\n end",
"def extensions\n\t\t(self.sip_accounts || []).map{ |sip_account| sip_account.extensions }.flatten\n\tend",
"def gl_extensions\n Array.new(glGetInteger(GL_NUM_EXTENSIONS)) do |index|\n glGetStringi(GL_EXTENSIONS, index)\n end\n end",
"def template_extensions\n EXTENSIONS.keys\n end",
"def load_extension_inclusions\n return unless config_hash[\"Extensions\"]\n config_options[:extensions] = config_hash[\"Extensions\"]\n end",
"def include_extensions\n @included_extensions ||= include_extensions!\n end",
"def get_loaded_extension_commands(extension_name)\n request = Packet.create_request(COMMAND_ID_CORE_ENUMEXTCMD)\n\n start = Rex::Post::Meterpreter::ExtensionMapper.get_extension_id(extension_name)\n request.add_tlv(TLV_TYPE_UINT, start)\n request.add_tlv(TLV_TYPE_LENGTH, COMMAND_ID_RANGE)\n\n begin\n response = self.client.send_packet_wait_response(request, self.client.response_timeout)\n rescue\n # In the case where orphaned shells call back with OLD copies of the meterpreter\n # binaries, we end up with a case where this fails. So here we just return the\n # empty list of supported commands.\n return []\n end\n\n # No response?\n if response.nil?\n raise RuntimeError, 'No response was received to the core_enumextcmd request.', caller\n elsif response.result != 0\n # This case happens when the target doesn't support the core_enumextcmd message.\n # If this is the case, then we just want to ignore the error and return an empty\n # list. This will force the caller to load any required modules.\n return []\n end\n\n commands = []\n response.each(TLV_TYPE_UINT) { |c|\n commands << c.value\n }\n\n commands\n end",
"def extension_methods\n @@extension_methods\n end",
"def file_exts\n [].concat(viewed_exts).concat(edited_exts).concat(convert_exts).concat(fill_forms_exts)\n end",
"def collect_loaded_features\n @loaded_features = []\n $LOADED_FEATURES.each {|file|\n $LOAD_PATH.each {|dir|\n file_path = File.join(dir, file)\n if File.identical?(file_path, @me)\n next\n end\n if File.file?(file_path)\n @loaded_features << file_path\n next\n end\n }\n }\n end",
"def extensions\n if @extensions.nil?\n @extensions = Hash.new\n @cert.extensions.to_a.each { |extension|\n extension = extension.to_a\n if(!@extensions[extension[0]].kind_of?(Array)) then\n @extensions[extension[0]] = []\n end\n hash = {'value' => extension[1], 'critical' => extension[2]}\n @extensions[extension[0]].push hash\n }\n end\n @extensions\n end",
"def list_addons\n Dir.glob(\"/var/lib/apollo/addons/*.gem\")\n end",
"def extensions\n _, *segments = name.downcase.split(\".\", -1)\n\n segments.map.with_index do |segment, index|\n \".\" + segments[index..-1].join(\".\")\n end\n end",
"def gl_extensions()\n (0 ... glGetInteger(GL_NUM_EXTENSIONS)).map { |index| glGetStringi(GL_EXTENSIONS, index) }\n end",
"def wix_light_extensions\n @wix_light_extensions ||= []\n end",
"def extensions\n form_data = { 'action' => 'query', 'meta' => 'siteinfo', 'siprop' => 'extensions' }\n res = make_api_request(form_data)\n REXML::XPath.match(res, \"//ext\").inject(Hash.new) do |extensions, extension|\n name = extension.attributes[\"name\"] || \"\"\n extensions[name] = extension.attributes[\"version\"]\n extensions\n end\n end",
"def extensions\n extensions_size = MemoryPointer::new( :size_t )\n error = OpenCL.clGetPlatformInfo( self, EXTENSIONS, 0, nil, extensions_size)\n error_check(error)\n ext = MemoryPointer::new( extensions_size.read_size_t )\n error = OpenCL.clGetPlatformInfo( self, EXTENSIONS, extensions_size.read_size_t, ext, nil)\n error_check(error)\n ext_string = ext.read_string\n return ext_string.split(\" \")\n end",
"def extension_methods\n @@extension_methods\n end",
"def engine_extensions\n exts = extensions\n\n if offset = extensions.index(format_extension)\n exts = extensions[offset+1..-1]\n end\n\n exts.select { |ext| @environment.engines(ext) }\n end",
"def available_data_extensions\n @available_data_extensions ||= DataExtensionCollection.new\n end",
"def extension_white_list\n EXTENSIONS\n end",
"def extension_white_list\n EXTENSIONS\n end",
"def unknown_extensions\n Extensions.get_unknown_extensions(self.cert.extensions)\n end",
"def extensions=(extensions); end",
"def extensions=(value)\n @extensions = value\n end",
"def extensions=(value)\n @extensions = value\n end",
"def extensions=(value)\n @extensions = value\n end",
"def extension_whitelist\n %w(mp4 ogv avi)\n end",
"def extension_whitelist; end",
"def all_loaded_constants\n constants.map { |c| const_get(c) }.\n select { |a| a.respond_to?(:loaded?) && a.loaded? }\n end",
"def eager_load_all\n Registry.loaders.each(&:eager_load)\n end",
"def get_extension_tags\n get_siteinfo('extensiontags')['query']['extensiontags']\n end",
"def list_installed_addons()\n list = Array.new\n addons = Array.new\n \n Dir.foreach(@addons) {|x| list.push x }\n \n list.each do |l|\n if !@no_way.index(l)\n addons.push l\n end\n end\n \n return addons\n end",
"def valid_extensions\n %w[.rb .js]\n end",
"def file_extensions\n Dir.glob('**/*').map do |x|\n ext = File.extname(x)\n if ext == ''\n 'folders'\n else\n ext[1..-1]\n end\n end\nend",
"def files\n modules = (changed?) ? tag_configuration_plugins.collect {|p| p.plugin.modules} : \n plugins.collect {|p| p.modules}\n modules << Plugin::JshubCore.instance.modules\n modules.flatten!\n modules.sort!\n modules.uniq.collect { |m| m.name }\n end",
"def extensions\n @extensions ||= Protocol.const_get(:\"Version#{version}\")::Extensions.new(context, logger: logger)\n end",
"def extensions\n @extensions ||= Protocol.const_get(:\"Version#{version}\")::Extensions.new(context, logger: logger)\n end",
"def names\n $LOAD_MANAGER.keys\n end",
"def loaded_languages\n @@languages.keys\n end",
"def dump_extension_tree()\n items = []\n items.concat(self.ext.dump_alias_tree('client.ext'))\n items.concat(self.ext_aliases.dump_alias_tree('client'))\n\n return items.sort\n end",
"def loaders\n @loaders ||= profile.loaders\n end",
"def extensions_missing(exts)\n Set.new(exts.flatten).difference extensions.to_set\n end",
"def singletons\n return nil unless @extensions\n keys = @extensions.keys\n keys.sort!\n keys\n end",
"def singletons\n return nil unless @extensions\n keys = @extensions.keys\n keys.sort!\n keys\n end",
"def append_extensions(*extensions)\n self.extensions.push(*extensions)\n end",
"def extension_conf_files\n manifest.grep( /extconf.rb\\Z/ )\n end",
"def require_paths\n return raw_require_paths unless have_extensions?\n\n [extension_dir].concat raw_require_paths\n end",
"def extension_whitelist\n %w(jpg jpeg gif png tif tiff avi m4v mov mp4 mpg mpeg mpeg wmv qt)\n end",
"def no_extension_files(base_dir, wildcard, non_exts = [])\n list = []\n unless non_exts.empty?\n list = Dir.glob(File.join(base_dir, wildcard, \"{#{non_exts.join(',')}}\"))\n end\n list\n end",
"def loaded_languages\n @@cached_language_data.keys\n end",
"def available_plugins\n @plugins.keys\n end"
] | [
"0.8276",
"0.8246343",
"0.8246343",
"0.8075223",
"0.8075223",
"0.798756",
"0.7868441",
"0.7868441",
"0.7868441",
"0.78668505",
"0.77586883",
"0.76802033",
"0.76802033",
"0.7484522",
"0.7459382",
"0.7459382",
"0.7419214",
"0.7335917",
"0.7332636",
"0.7269066",
"0.719918",
"0.7189022",
"0.71669996",
"0.70738953",
"0.7039419",
"0.6962705",
"0.69388556",
"0.6875812",
"0.6856663",
"0.6854036",
"0.6832695",
"0.68286294",
"0.6823208",
"0.6751503",
"0.67304814",
"0.6730224",
"0.6730224",
"0.6730224",
"0.6687005",
"0.6644945",
"0.6642034",
"0.6634007",
"0.6618117",
"0.6586118",
"0.65788525",
"0.6572245",
"0.65333647",
"0.64941645",
"0.64869714",
"0.6465594",
"0.6428773",
"0.64043725",
"0.6398688",
"0.6388241",
"0.6382026",
"0.636035",
"0.6358976",
"0.6357698",
"0.63508946",
"0.6314955",
"0.62962973",
"0.62958074",
"0.62673056",
"0.62574697",
"0.62572664",
"0.62497747",
"0.6189564",
"0.61567944",
"0.61540973",
"0.61540973",
"0.6149351",
"0.6134135",
"0.6104258",
"0.6104258",
"0.6104258",
"0.61035174",
"0.60938734",
"0.6093241",
"0.6069732",
"0.606011",
"0.60549235",
"0.6044066",
"0.60418093",
"0.60173225",
"0.60063845",
"0.60063845",
"0.6003114",
"0.59972507",
"0.5982249",
"0.59727234",
"0.5926979",
"0.5922284",
"0.5922284",
"0.5916061",
"0.59037614",
"0.588359",
"0.58810383",
"0.58692217",
"0.5865909",
"0.58628106"
] | 0.7652824 | 13 |
Gets an extension object by it's name. | def extension(key)
return nil unless @extensions.has_key?(key)
return @extensions[key]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ext_field_by_name(name)\n extension_fields.values.find {|field| field.name == name.to_sym}\n end",
"def get_ext_field_by_name(name)\n name = name.to_sym\n extension_fields.values.find {|field| field.name == name}\n end",
"def by_name( name )\n available.each { |addon| return addon if addon['filename'] == name }\n return nil\n end",
"def extension_from_path(path)\n @extensions.find {|e| e.path == path}\n end",
"def get_object(name)\n gtk_builder_get_object(@builder, name)\n end",
"def get_plugin(name)\n raise \"Unknown plugin: #{ name }\" unless Capistrano::EXTENSIONS.keys.include?(name)\n self.send(name)\n end",
"def getExtension(eType)\n return @langProfile.getExtension(eType)\n end",
"def getExtension(eType)\n return @langProfile.getExtension(eType)\n end",
"def using *extension_names\n extension_names.each do |extension_name|\n if extension = @@__extensions.find{|ext| ext.__name.to_s == extension_name.to_s }\n extension.extension_used self if extension.respond_to? :extension_used\n self.metaclass.send :define_method, :\"#{extension_name}\" do\n return extension\n end\n else\n raise ExtensionNotFoundError, \"Extension not found: #{extension_name}\"\n end\n end\n end",
"def getExtension(eType)\r\n return @langProfile.getExtension(eType)\r\n end",
"def get_extension_by_oid(cert, oid)\n cert.extensions.each do |extension|\n return extension if extension.oid == oid\n end\n nil\n end",
"def get(name)\n name.downcase!\n parts = name.split('::')\n name = name.to_sym\n\n @mutex.synchronize do\n object = @objects[name]\n unless object || @objects.include?(name)\n @directories.each do |directory|\n path = File.join(directory, @subdir, *parts) + '.rb'\n next unless File.exists?(path)\n object = load_file(parts.last, path)\n break\n end\n # Set even if not found to record misses\n @objects[name] = object\n end\n object\n end\n end",
"def extension_setting(name)\n extension_settings.find{ |setting| setting.key == name.to_s }\n end",
"def extension\n name.downcase\n end",
"def by_extension(ext); end",
"def extension\n return _meta_data['extension'] if _meta_data.has_key? 'extension'\n ext\n end",
"def find_object(name); end",
"def _extension_for(thing)\n MIMETypes.extension_for(thing) || @_extension\n end",
"def extension(key)\n @extensions[key.to_s]\n end",
"def name\n fail NotImplementedError,\n 'Abstract method must returns extension name'\n end",
"def ext_obj\n \"ext(#{ext_channel}, #{ext_type}, #{ext_id})\"\n end",
"def rex(name)\n RNExtension.extension_named(name).exported\n end",
"def extension_name=(name)\n clear!\n @extension_name = name\n end",
"def find name\n object = objects.find { |o| o.name == name.to_s }\n end",
"def get(name)\n name = camelize(name) if name.downcase == name\n begin\n Object.const_get(name)\n rescue NameError\n nil\n end\n end",
"def [](name)\n detect {|mod| mod.name == name}\n end",
"def get_extensions\n get_siteinfo('extensions')['query']['extensions'].collect { |e| e['name'] }\n end",
"def set_extension\n @extension = Extension.find(params[:id])\n end",
"def set_extension\n @extension = Extension.find(params[:id])\n end",
"def set_extension\n @extension = Extension.find(params[:id])\n end",
"def ext_sym(name)\r\n return name if name.kind_of?(Symbol)\r\n return ext_name(name).to_sym\r\n end",
"def fetch(key, default = nil)\n return nil if super_fetch(key, nil).is_a?(Extension::UnknownExtension)\n\n super_fetch(key, default)\n end",
"def get(name)\n __get(name, false)\n end",
"def extensions\n @extensions ||= Protocol.const_get(:\"Version#{version}\")::Extensions.new(context, logger: logger)\n end",
"def extensions\n @extensions ||= Protocol.const_get(:\"Version#{version}\")::Extensions.new(context, logger: logger)\n end",
"def get_extensions\n read_extensions 'storage', @options.model_extensions_dir\n end",
"def get(name); end",
"def lookup(name)\n if @map[name]\n @map[name]\n else\n # Descendant classes should be loaded for this to work\n @klass.descendants.each do |klass|\n proto_model = klass.factory.lookup(name)\n return proto_model if proto_model\n end\n \n nil\n end\n end",
"def extension? name\n @extensions.include? name\n end",
"def set_extension\n @extension = Fonelator::Extension.find(params[:id])\n end",
"def infer_extension\n return if name.nil?\n\n self.extension ||= File.extname(name)\n end",
"def get_plugin(name); Ricer::Plugin.by_name(name); end",
"def preferred_extension\n @preferred_extension || extensions.first\n end",
"def extension\n extension_from_disk.blank? ? extension_from_feed : extension_from_disk\n end",
"def get_extension(path)\n return path[/^.+(\\.[a-z0-9]+)$/i, 1]\n end",
"def _get(name, obj = @obj)\n return obj[name] if obj[name]\n return _dir(name, obj)\n end",
"def extension\n extensions.last || \"\"\n end",
"def extensions\n @extensions ||= []\n end",
"def extensions\n @extensions ||= []\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 extensions\n @extensions ||= []\n end",
"def extensions\n self.class.extensions\n end",
"def extensions\n self.class.extensions\n end",
"def find_object(name)\n @search_paths.unshift(@cache[name]) if @cache[name]\n @search_paths.unshift(Registry.yardoc_file)\n\n # Try to load it from in memory cache\n log.debug \"Searching for #{name} in memory\"\n obj = try_load_object(name, nil)\n return obj if obj\n\n log.debug \"Searching for #{name} in search paths\"\n @search_paths.each do |path|\n next unless File.exist?(path)\n log.debug \"Searching for #{name} in #{path}...\"\n Registry.load(path)\n obj = try_load_object(name, path)\n return obj if obj\n end\n nil\n end",
"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 get(name)\n @all.find { |e| e.name == name.to_s || e.name == \"#{name}_engine\" }\n end",
"def load_extension path\n instance_eval(File.read(File.join(File.dirname(__FILE__), path)))\n end",
"def get_version!(version)\n version.gsub!('_', '.')\n\n if version == 'latest'\n latest_extension_version\n else\n extension_versions.find_by!(version: version)\n end\n end",
"def name\n \"hipchat-extensions\"\n end",
"def get(name)\n name = camelize(name) if name.downcase == name\n begin\n const_get(name)\n rescue NameError\n nil\n end\n end",
"def extensions\n @@extensions\n end",
"def extensions\n @@extensions\n end",
"def extension(*extensions)\n if extensions[0].is_a?(Array)\n @_ext = extensions[0]\n else\n @_ext = extensions\n end\n end",
"def get(name)\n send(name)\n end",
"def get_extension(cert, oid)\n extension = cert.extensions.select { |ext| ext.oid == oid }[0]\n\n return nil if extension.nil?\n\n value = extension.value\n # Weird ssl cert issue - have to strip the leading dots:\n value = value[2..-1] if value.match(/^\\.\\./)\n\n return value\n end",
"def engine_for(path)\n path = File.expand_path(path) \n EXTENSIONS[path.match(/\\.([^\\.]*)$/)[1]]\n end",
"def engine_for(path)\n path = File.expand_path(path) \n EXTENSIONS[path.match(/\\.([^\\.]*)$/)[1]]\n end",
"def enable_extension(name)\n end",
"def extensions\n data.extensions\n end",
"def get_extensions\n read_extensions 'compute', @options.model_extensions_dir\n end",
"def find(name)\n @@subclasses.fetch(name.to_s, nil)\n end",
"def get_extensions\n # no extensions to include\n ::Occi::Collection.new\n end",
"def plugin(name)\n @plugins[name]\n end",
"def get_instance_by_name\n # return the existing object if any, otherwise return true\n end",
"def find_exchange(name)\n @exchanges[name]\n end",
"def get(name)\n lookup(key(name.to_s))\n end",
"def select_extension_point(point)\n @@extension_points_registry[point]\n end",
"def extension; end",
"def extension; end",
"def extension; end",
"def extension; end",
"def get(name)\n module_name = /^#{name.to_s.dup.delete('_')}(?:helper)?$/i\n\n options.namespaces.each do |namespace|\n found = namespace.constants.grep(module_name).first\n return namespace.const_get(found) if found\n end\n\n nil\n end",
"def lookup(type_name, id)\n try_extensions(:lookup, type_name, id)\n end",
"def get_ext_field(tag_or_name)\n case tag_or_name\n when Integer then get_ext_field_by_tag(tag_or_name)\n when String, Symbol then get_ext_field_by_name(tag_or_name)\n else raise TypeError, tag_or_name.class\n end\n end",
"def ext\n @ext ||= File.extname(path)\n end",
"def extensions\n return @extensions\n end",
"def extensions\n return @extensions\n end",
"def extensions\n return @extensions\n end",
"def get_ext_field(tag_or_name)\n case tag_or_name\n when Integer; get_ext_field_by_tag tag_or_name\n when String, Symbol; get_ext_field_by_name tag_or_name\n else; raise TypeError.new(tag_or_name.class)\n end\n end",
"def extension_item\n return @children['extension-item'][:value]\n end",
"def []( name )\r\n result = @resources[name]\r\n\r\n if result.nil?\r\n result = autoload(name)\r\n if result\r\n self[name] = result\r\n result.name = name\r\n end\r\n end\r\n\r\n return result\r\n end",
"def [](name)\n packages[name]\n end",
"def extension\n @ext ||= ( ( e = File.extname( path ) ).empty? ? nil : e )\n end",
"def get_const_by_name(name)\n consts = name.split(\"::\")\n obj = Object\n begin\n consts.each{|const| \n obj = obj.const_get(const)\n }\n rescue\n Log.logger_for(:configuration).error(\"No such class defined: #{name}\")\n end\n return obj\n end",
"def file_extension\n self.class.file_extension\n end",
"def get_extensions\n read_extensions 'network', @options.model_extensions_dir\n end",
"def register_extension_alias(name, ext)\n self.ext_aliases.aliases[name] = ext\n # Whee! Syntactic sugar, where art thou?\n #\n # Create an instance method on this object called +name+ that returns\n # +ext+. We have to do it this way instead of simply\n # self.class.class_eval so that other meterpreter sessions don't get\n # extension methods when this one does\n (class << self; self; end).class_eval do\n define_method(name.to_sym) do\n ext\n end\n end\n ext\n end",
"def get(name)\n self._list.detect { |entry| entry.name == name.to_sym }\n end",
"def extension\n split_extension(filename)[1] if filename\n end",
"def get(name)\n @j_map.get(name)\n end"
] | [
"0.6599194",
"0.6577669",
"0.6474541",
"0.64701897",
"0.6353642",
"0.6252796",
"0.6221499",
"0.6221499",
"0.6183296",
"0.6164878",
"0.61124986",
"0.6089733",
"0.6027012",
"0.60074896",
"0.60018724",
"0.59965116",
"0.5977263",
"0.5952194",
"0.59495693",
"0.5905685",
"0.5839382",
"0.5739082",
"0.5723125",
"0.5711823",
"0.5710077",
"0.5705412",
"0.56957215",
"0.56809103",
"0.56809103",
"0.56809103",
"0.56530184",
"0.5643136",
"0.56189513",
"0.5617571",
"0.5617571",
"0.5592894",
"0.55596423",
"0.55488396",
"0.55443776",
"0.5536771",
"0.5533313",
"0.55237836",
"0.550733",
"0.5505103",
"0.5497312",
"0.549405",
"0.5405681",
"0.5405105",
"0.5405105",
"0.5405085",
"0.53748924",
"0.53719574",
"0.53719574",
"0.5370164",
"0.5368256",
"0.53494745",
"0.53446376",
"0.5318288",
"0.5317306",
"0.5300723",
"0.5298749",
"0.5298749",
"0.52880675",
"0.52764887",
"0.5268336",
"0.52651095",
"0.52651095",
"0.5260692",
"0.52592885",
"0.52551425",
"0.5242419",
"0.5241862",
"0.52269566",
"0.5225629",
"0.52168924",
"0.5204907",
"0.5203076",
"0.520301",
"0.520301",
"0.520301",
"0.520301",
"0.51989496",
"0.518977",
"0.51826733",
"0.5180985",
"0.51771516",
"0.51771516",
"0.51771516",
"0.5167745",
"0.51654243",
"0.5163768",
"0.5163072",
"0.51471806",
"0.512894",
"0.5120281",
"0.51034695",
"0.50960106",
"0.50922817",
"0.5088088",
"0.50868016"
] | 0.66321516 | 0 |
Converts a class or extension name into a file name. | def file_name(name)
return name.to_s.downcase + '.rb' if name.kind_of?(Symbol)
return ext_name(name).downcase + '.rb'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_filename; class_to_filename(name.gsub(/.*:/, '')); end",
"def class_to_filename (c)\n c.split(/::/).map {|i| i.gsub(/([A-Z])/, '_\\1').sub(/_/, '').downcase}.\n join('/')\nend",
"def to_name\n basename.to_s.sub extname, ''\n end",
"def actionscript_file_to_class_name file\n name = file.dup\n name.gsub!(/^#{path}\\//, '')\n name.gsub!(/^#{test}\\//, '')\n name.gsub!(/^#{src}\\//, '')\n name.gsub!(/.as$/, '')\n name.gsub!(/#{File::SEPARATOR}/, '.')\n return name\n end",
"def extract_class_name(filename)\n filename.split('/')[2..-1].collect { |i| i.camelize }.join('::').chomp(\".rb\")\n end",
"def class_name_for(file_name)\n file_name.split(/\\//).last.sub(/\\.rb$/, '').split(/_/).map do |s|\n s.capitalize\n end.join('')\n end",
"def extract_class_name(filename)\n File.basename(filename).chomp(\".rb\").camelize\n end",
"def class_to_basefile class_name\n\t\t\treturn \"#{base_dir}/#{class_name.gsub(\"::\", \"/\")}\"\n\t\tend",
"def class_name(name)\n name, anchor = name.to_s.split(\"#\", 2)\n name = File.basename(name, \".json\")\n name = name + \"_\" + anchor if anchor.present?\n name.gsub(/[^\\w]/, \"_\").camelcase\n end",
"def class_file_name(prepend_path = false, append_extension = false)\n\t\tjfile_name = file_name\n\t\tjfile_name += \".class\" if append_extension\n\t\tjfile_name = CLASS_PATH + jfile_name if prepend_path\n\t\treturn jfile_name\n\tend",
"def make_file_name aExtension, *aWords #:nodoc:\n aWords.join(' ').to_file_name.ext(aExtension)\n end",
"def classify_name(filename)\n filename.to_s.split(\"_\").map{ |i| i[0...1].upcase + i[1..-1] }.join\n end",
"def klass2file(str)\n\t\t\tstr.split(/::/).map {|c|\n\t\t\t\tc.scan(/[A-Z][a-z0-9]*/).join(\"_\").downcase\n\t\t\t}.join(\"/\")\n\t\tend",
"def filename_to_class (f)\n f.split('/').map {|i| i.capitalize.gsub(/_([a-z])/) {|s| $1.upcase }}.\n join('::')\nend",
"def file_type(file_name)\n @file_class.extname(file_name).gsub( /^\\./, '' ).downcase \n end",
"def ext_name(name)\r\n return name.to_s if name.kind_of?(Symbol)\r\n return name.gsub(/\\s/, '_')\r\n end",
"def actionscript_file_to_class_name(file)\n name = super(file)\n\t\tname.gsub!(/^#{model.spec_dir}\\./, '')\n return name\n end",
"def formatted_class_name(class_name)\n class_name = class_name.split(':')[-1]\n (class_name.gsub!(/(.)([A-Z])/, '\\1_\\2') || class_name).upcase\n end",
"def formatted_filename(name, version, suffix, extension)\n name.gsub(\"#{version}_\", \"\").chomp(File.extname(name)) + \"_#{suffix}.#{extension}\"\n end",
"def file_name\n \"#{@file_name}.#{extension}\"\n end",
"def actionscript_file_to_short_class_name(file)\n return File.basename(file, '.*')\n end",
"def extname( fn )\n ::File.extname(fn).tr('.', '')\n end",
"def filename\r\n Chingu::Inflector.underscore(self.class.to_s)\r\n end",
"def to_class_name\n parts = downcase.split('/')\n parts.each(&:capitalize!)\n parts.join('').gsub(%r{-}, '')\n end",
"def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end",
"def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end",
"def class_name_for_class_file(subtree, class_file)\n the_classes_directory = classes_directory(subtree)\n subpath_string = FilePath.new(class_file).relative_path_from(the_classes_directory).to_s\n subpath_string = $1 if subpath_string =~ /^(.*)\\.class\\s*$/\n subpath_string.gsub!(\"/\", \".\")\n subpath_string.gsub!(\"\\\\\", \".\")\n subpath_string\n end",
"def file_name(name)\n name.to_s.gsub(/-/, \"_\").underscore\n end",
"def file_name\n name.underscore\n end",
"def changeFileExtensionTo(filename, extension)\n return \"#{File.basename(filename, File.extname(filename))}.#{extension}\"\nend",
"def ruby_classname_to_java(class_name:)\r\n\r\n parts = class_name.to_s.split('::')\r\n packageless_class_name = parts.pop\r\n\r\n parts.map! do |package_part|\r\n package_part[0] = package_part[0].downcase\r\n package_part\r\n end\r\n\r\n parts << packageless_class_name\r\n parts.join('.')\r\n end",
"def filename(format)\n \"#{filename_without_extension}.#{format}\"\n end",
"def filename\n return @filename if @filename\n name.downcase.gsub(/\\W/, '_').squeeze('_')\n end",
"def extensionize(fname, ext, opts={})\n extname = File.extname(fname)\n return fname if (extname =~ /\\.?#{ext}$/i) == 0\n fname = fname.gsub(/#{extname}$/, '') if opts[:chomp] == true\n return fname.strip + '.' + ext.to_s.gsub(/^\\./, '')\n end",
"def build_converted_file_name(source, from_lang, to_lang)\n # Get components of filename\n dirname = File.dirname(source)\n basename = File.basename(source, \".*\")\n extname = File.extname(source)\n\n # Blank out the from language\n basename.sub! Regexp.new(\"_#{from_lang}\", \"i\"), \"\"\n \n \"#{dirname}/#{basename}_#{to_lang}#{extname}\"\n end",
"def file_type( file_name )\n File.extname( file_name ).gsub( /^./, '' ).downcase\n end",
"def with_file_extension(name, entry_type)\n return name unless File.extname(name.to_s).empty?\n\n extension = extension_for_type(entry_type)\n extension ? \"#{ name }.#{ extension }\" : name\n end",
"def file2klass(str)\n\t\t\tstr.split(\"/\").map {|c|\n\t\t\t\tc.split(/_/).collect {|i| i.capitalize }.join(\"\")\n\t\t\t}.join(\"::\")\n\t\tend",
"def file_type(file_name)\n File.exname( file_name ).gsub( /^\\./, '').downcase\n end",
"def infer_name_from_contents(obj, opts={})\n begin\n File.split(obj).last.split('.')[0..-2].join('.').titleize\n rescue\n nil\n end\n end",
"def name\n @name ||= filename.split(\".\").first.sub(/^_/, \"\")\n end",
"def rename_with_file_type(ori, nam)\n s = ori.split('.')\n nam + '.' + s[s.length - 1]\n end",
"def filename\n if original_filename\n \"#{model.name.parameterize}-#{secure_token(8)}.#{file.extension}\"\n end\n end",
"def page_file_name(name, format)\n ext = @page_class.format_to_ext(format)\n @page_class.cname(name) + '.' + ext\n end",
"def output_filename_for(filename)\n raise \"Filename not given\" unless filename\n extension = File.extname(filename)[1..-1]\n parser = self.class.for_extension(extension).last\n return filename unless parser\n Pathname.new(\"#{File.dirname(filename)}/#{File.basename(filename, \".*\")}.#{parser.finished_extension}\").cleanpath.to_s\n rescue => e\n filename\n end",
"def _output_filename(file)\n sub_strings = File.basename(file).split('.')\n base_name, extensions = sub_strings.first, sub_strings[1..-1]\n\n if extensions.last == 'haml'\n extensions.pop\n if extensions.empty?\n [base_name, options[:default_ext]].join('.')\n else\n [base_name, extensions].flatten.join('.')\n end\n else\n [base_name, extensions, options[:default_ext]].flatten.compact.join('.')\n end\n end",
"def filename\n \"#{model.name.parameterize}.#{file.extension}\" if original_filename.present?\n end",
"def create_file_name(ext = nil)\n ext ||= self.ext\n return name unless ext\n \"#{unique_key}.#{ext}\"\n end",
"def name\n @name ||= File.basename(file).chomp(File.extname(file))\n end",
"def file_type file_name \n File.extname( file_name ).gsub /^\\./, '' \n end",
"def extension\n filename = File.extname(self.filename.to_s)\n filename[0] = '' # remove the dot, i.e. (.docx or .pptx)\n filename\n end",
"def extension\n name.downcase\n end",
"def file_name_for(*args)\n \"%s.%s\" % [args.compact.join(self.class.thumbnail_separator), extension]\n end",
"def name\n n = self.class.name\n n.gsub!( /::/, '.' )\n n.gsub( /(\\w)\\w+\\./ ) { |m| $1.downcase + '.' }\n end",
"def file_to_name(file)\n return file.split(\"_\").map(&:capitalize).join\n end",
"def file_ext\n File.extname(@file_name).downcase\n end",
"def name_to_file(name)\n array = name.scan(/[A-Z][a-z]*/)\n raise TypeError, Ajaila::Messager.warning(\"The name of variable should start with capital letter: \\\"table:MyTable\\\"\") if array == []\n return array.map(&:downcase).join(\"_\")\n end",
"def processed_filename(filename, extension = nil)\n suffix = \"_#{model.filename_token}\"\n max_processed_filename_size = max_processed_filename_size(suffix)\n filename_without_suffix = filename.slice 0, max_processed_filename_size\n \"#{filename_without_suffix.parameterize}#{suffix}\".tap { |s| s << \".#{extension}\" if extension }\n end",
"def filename\n @name ||= \"#{timestamp}-#{secure_token(8)}.#{file.extension}\" if original_filename.present?\n end",
"def main_name(path)\n File.basename(path).sub(/\\.[^\\.]+$/,'')\n end",
"def name\n path.gsub(/\\./,'_').gsub(%r{/}, '.').gsub(%r{(^\\.|\\.$)},'')\n end",
"def full_filename( for_file )\n super.downcase\n # super.chomp( File.extname( super ) ) + '.jpg'\n end",
"def filename\n \"#{original_filename_without_extension.parameterize}_#{model.filename_token}#{original_extension}\" if original_filename\n end",
"def proper_filename(file)\n file.gsub(/[^\\w]/,'_')\n end",
"def to_wikiname(in_filename)\n in_filename.gsub(/\\.[^\\.]*$/,'')\n end",
"def file_type file_name\n File.extname(file_name).gsub(/^\\./, '').downcase\n end",
"def extname() File.extname(path) end",
"def extname\n File.extname(filename)\n end",
"def full_filename_fu(filename)\n version_prefix = \"#{version_name}_\"\n filename = filename.gsub(version_prefix, \"\")\n ext = nil\n basename = filename.gsub /\\.\\w+$/ do |s|\n ext = s; ''\n end\n \"#{basename}_#{version_name}#{ext}\"\n end",
"def camelize(class_name)\n return class_name if class_name !~ /-/\n class_name.gsub(/(?:-|(\\/))([a-z\\d]*)/) { \"#{$1}#{$2.capitalize}\" }.strip\n end",
"def enum_class_name\n file_name.camelize\n end",
"def sanitize_file_name_as_name\n sanitized_name_array = name.split('.')\n sanitized_name_array.pop if sanitized_name_array.length > 1\n self.name = sanitized_name_array.join('.').tr('-_', ' ').split.map(&:capitalize)*' '\n end",
"def filename(id, extension)\n path = filepath(id)\n return path if extension.nil?\n \"#{path}.#{extension.gsub(/^\\./, '')}\"\n end",
"def file_name\n \"#{name.downcase.gsub(/\\s/, '')}.jpg\"\n end",
"def chop_extension filename\n filename.sub %r{\\.\\w+$}, \"\"\n end",
"def ext_of(filename)\n filename =~ /((\\.[a-z]+)*)$/ ? $1 : ''\n end",
"def class_name_for(object)\n object.name.split('.').first.downcase.tr('_', '-')\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 infer_extension\n return if name.nil?\n\n self.extension ||= File.extname(name)\n end",
"def basename_without_ext; end",
"def name_from_object(class_name)\n class_name.split('::').last\n end",
"def makeObjectFileName(fileName)\n # substitution of '_' with '__' prevents collisions\n @build.buildPath + \"/\" + fileName.gsub('_', '__').gsub('/', '_').gsub('.', '_') + \".o\"\n end",
"def default_file_name\n \"#{klass_name.underscore}_#{id}\"\n end",
"def base file, ext; return File.basename file, ext end",
"def base file, ext; return File.basename file, ext end",
"def extension\n filename = File.extname(self.filename.to_s)\n filename[0] = '' # remove the dot, i.e. (.docx or .pptx)\n filename\n end",
"def filename\n pn = Pathname.new(@source.filename)\n pn.basename(pn.extname).to_s.tap do |s|\n s << \"_\" << @aspect unless @aspect.nil?\n s << \".\" << mime_type.to_sym.to_s\n end\n end",
"def filename\n \"#{folder_id}#{File.extname(super)}\"\n end",
"def file_type file_name \n\t\tFile.extname( file_name ).gsub /^\\./, '' \n\tend",
"def variable_name_to_class_name(name)\n name.to_s.\n gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.\n gsub(/(?:^|_)(.)/) { $1.upcase }\n end",
"def variable_name_to_class_name(name)\n name.to_s.\n gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.\n gsub(/(?:^|_)(.)/) { $1.upcase }\n end",
"def file_ext(filename)\n File.extname( filename ).gsub(\".\", \"\") rescue nil\n end",
"def hash_to_file_name(hash)\n version = \"-#{hash[:version]}\" if hash[:version]\n classifier = \"-#{hash[:classifier]}\" if hash[:classifier]\n \"#{hash[:id]}#{version}#{classifier}.#{extract_type(hash[:type]) || DEFAULT_TYPE}\"\n end",
"def filename(name)\n @filename = name.downcase.strip.gsub(' ', '-')\n end",
"def underscorized_classname\n self.class.name.split(\"::\").last.\n gsub( /([A-Z]+)([A-Z][a-z])/, '\\1_\\2' ).\n gsub( /([a-z\\d])([A-Z])/, '\\1_\\2' ).downcase\n end",
"def extname() File.extname(@path) end",
"def convert_class(klass)\n ::ActiveSupport::Inflector.underscore(klass.name).gsub(\"/\", \"_\")\n end",
"def to_filename(filename, size)\n filename.gsub! /^.*(\\\\|\\/)/, ''\n filename.gsub!(/[^0-9A-Za-z.\\-]/, '') \n filename.downcase.slice! 0..size\nend",
"def filename\n \"#{secure_token(10)+File.extname(original_filename)}\" if original_filename.present?\n end",
"def filename\n return unless original_filename\n\n extension = File.extname(original_filename)\n name = File.basename(original_filename, extension)\n\n \"#{Time.current.to_i.to_s}-#{name.parameterize}#{extension}\"\n end"
] | [
"0.78845537",
"0.7603191",
"0.73912436",
"0.7321306",
"0.72890615",
"0.7227069",
"0.71749526",
"0.7094443",
"0.7049833",
"0.6994771",
"0.69838375",
"0.695167",
"0.68786275",
"0.6873001",
"0.6751018",
"0.6723017",
"0.6705899",
"0.6694793",
"0.6693361",
"0.6681071",
"0.6659569",
"0.6657644",
"0.663121",
"0.6614849",
"0.6614403",
"0.6614403",
"0.66132706",
"0.6606616",
"0.6586319",
"0.657357",
"0.6525063",
"0.650797",
"0.649649",
"0.6438866",
"0.6434894",
"0.64077103",
"0.63997793",
"0.6388285",
"0.6383172",
"0.6360159",
"0.6347634",
"0.63316274",
"0.6331396",
"0.6326845",
"0.63228655",
"0.6317297",
"0.6316062",
"0.630256",
"0.6292613",
"0.62541914",
"0.624018",
"0.623919",
"0.6235956",
"0.62319064",
"0.62305754",
"0.6211367",
"0.6207963",
"0.61992157",
"0.6198937",
"0.6197509",
"0.61965865",
"0.6192963",
"0.61857414",
"0.6185306",
"0.6182933",
"0.6181093",
"0.61770606",
"0.6176195",
"0.617501",
"0.61725384",
"0.6168442",
"0.61675626",
"0.6161383",
"0.61609805",
"0.615898",
"0.61521834",
"0.61442614",
"0.61359644",
"0.61269677",
"0.61269397",
"0.6125014",
"0.61148924",
"0.6100491",
"0.6094035",
"0.6094035",
"0.6091298",
"0.60893697",
"0.6084601",
"0.60840625",
"0.6083994",
"0.6083994",
"0.60668355",
"0.6062125",
"0.606151",
"0.60614014",
"0.60577166",
"0.6041927",
"0.60399294",
"0.6035724",
"0.6033325"
] | 0.7166012 | 7 |
Converts an extension name into a file name. | def ext_sym(name)
return name if name.kind_of?(Symbol)
return ext_name(name).to_sym
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extensionize(fname, ext, opts={})\n extname = File.extname(fname)\n return fname if (extname =~ /\\.?#{ext}$/i) == 0\n fname = fname.gsub(/#{extname}$/, '') if opts[:chomp] == true\n return fname.strip + '.' + ext.to_s.gsub(/^\\./, '')\n end",
"def make_file_name aExtension, *aWords #:nodoc:\n aWords.join(' ').to_file_name.ext(aExtension)\n end",
"def to_name\n basename.to_s.sub extname, ''\n end",
"def changeFileExtensionTo(filename, extension)\n return \"#{File.basename(filename, File.extname(filename))}.#{extension}\"\nend",
"def formatted_filename(name, version, suffix, extension)\n name.gsub(\"#{version}_\", \"\").chomp(File.extname(name)) + \"_#{suffix}.#{extension}\"\n end",
"def processed_filename(filename, extension = nil)\n suffix = \"_#{model.filename_token}\"\n max_processed_filename_size = max_processed_filename_size(suffix)\n filename_without_suffix = filename.slice 0, max_processed_filename_size\n \"#{filename_without_suffix.parameterize}#{suffix}\".tap { |s| s << \".#{extension}\" if extension }\n end",
"def extname( fn )\n ::File.extname(fn).tr('.', '')\n end",
"def extension\n filename = File.extname(self.filename.to_s)\n filename[0] = '' # remove the dot, i.e. (.docx or .pptx)\n filename\n end",
"def chop_extension filename\n filename.sub %r{\\.\\w+$}, \"\"\n end",
"def extension\n filename = File.extname(self.filename.to_s)\n filename[0] = '' # remove the dot, i.e. (.docx or .pptx)\n filename\n end",
"def file_name\n \"#{@file_name}.#{extension}\"\n end",
"def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end",
"def file_name name\n File.basename(name).sub(/\\.[^\\.]*/, '')\n end",
"def extname\n File.extname(filename)\n end",
"def normalize_extension(extension)\n extension = extension.to_s\n if extension[/^\\./]\n extension\n else\n \".#{extension}\"\n end\n end",
"def normalize_extension(extension)\n extension = extension.to_s\n if extension[/^\\./]\n extension\n else\n \".#{extension}\"\n end\n end",
"def file_ext(filename)\n File.extname( filename ).gsub(\".\", \"\") rescue nil\n end",
"def extension\n split_extension(filename)[1] if filename\n end",
"def ext_of(filename)\n filename =~ /((\\.[a-z]+)*)$/ ? $1 : ''\n end",
"def filename(id, extension)\n path = filepath(id)\n return path if extension.nil?\n \"#{path}.#{extension.gsub(/^\\./, '')}\"\n end",
"def file_name(name)\r\n return name.to_s.downcase + '.rb' if name.kind_of?(Symbol)\r\n return ext_name(name).downcase + '.rb'\r\n end",
"def ext_of(filename)\n filename =~ extension_regex ? $2 : ''\n end",
"def with_file_extension(name, entry_type)\n return name unless File.extname(name.to_s).empty?\n\n extension = extension_for_type(entry_type)\n extension ? \"#{ name }.#{ extension }\" : name\n end",
"def replace_extname(path, extension)\n path.sub(/#{File.extname(path)[1..-1]}$/, extension)\n end",
"def extname() File.extname(path) end",
"def file_extension\n filename.split(\".\").last\n end",
"def file_ext\n File.extname(@file_name).downcase\n end",
"def infer_extension\n return if name.nil?\n\n self.extension ||= File.extname(name)\n end",
"def extension\n name.downcase\n end",
"def filename_without_extension\n (@filename_without_extension || original_filename_without_extension).to_s\n end",
"def output_filename_for(filename)\n raise \"Filename not given\" unless filename\n extension = File.extname(filename)[1..-1]\n parser = self.class.for_extension(extension).last\n return filename unless parser\n Pathname.new(\"#{File.dirname(filename)}/#{File.basename(filename, \".*\")}.#{parser.finished_extension}\").cleanpath.to_s\n rescue => e\n filename\n end",
"def file_name(name)\n name.to_s.gsub(/-/, \"_\").underscore\n end",
"def extension_with_delimiter\n File.extname @filename\n end",
"def create_file_name(ext = nil)\n ext ||= self.ext\n return name unless ext\n \"#{unique_key}.#{ext}\"\n end",
"def ext_name(name)\r\n return name.to_s if name.kind_of?(Symbol)\r\n return name.gsub(/\\s/, '_')\r\n end",
"def extname() File.extname(@path) end",
"def real_extension(filename)\n ext = File.extname(filename)\n return ext if ext.empty?\n ext = ext[1, ext.length - 1].sub('.', '_').downcase\n e_s = ext.to_sym\n return ext unless ALT_EXTENSIONS.key?(e_s)\n ALT_EXTENSIONS[e_s].dup\n end",
"def filename(format)\n \"#{filename_without_extension}.#{format}\"\n end",
"def change_extension(file, new_extension)\n file.sub(/\\.[a-zA-Z0-9]+\\z/, new_extension)\n end",
"def ext_to_mp3(filename)\n\t\tfilename_without_ext = filename.gsub(/[.]\\w+$/, \"\")\n\t\tfilename_without_ext + \".mp3\"\n\tend",
"def export_file_name(extension)\n \"CompSage Report on #{@survey.job_title.gsub(/[\\\\\\/:\\*\\?\"<>\\|]/,' ')}.#{extension}\"\n end",
"def ext\n b,e = split_extension(filename)\n e\n end",
"def filename\n \"#{secure_token(10)+File.extname(original_filename)}\" if original_filename.present?\n end",
"def extension\n filename =~ /\\./ ? filename.split('.').last : nil\n end",
"def basename_of(filename)\n filename.sub(extension_regex, '')\n end",
"def remove_file_extension(filename)\r\n extensions = [\"TIF\", \"TIFF\", \"JPEG\", \"JPG\", \"PDF\"]\r\n original_file_extension = filename.split('.').last\r\n if extensions.include?(original_file_extension.upcase)\r\n unwanted_string = \".\"+original_file_extension\r\n filename = filename.chomp(unwanted_string)\r\n end\r\n filename\r\n end",
"def basename\n if extension\n basename = filename.split('.')\n basename.pop\n basename.join('.')\n else\n filename\n end\n end",
"def filename\n return unless original_filename\n\n extension = File.extname(original_filename)\n name = File.basename(original_filename, extension)\n\n \"#{Time.current.to_i.to_s}-#{name.parameterize}#{extension}\"\n end",
"def filename\n @name ||= \"#{timestamp}-#{secure_token(8)}.#{file.extension}\" if original_filename.present?\n end",
"def extname(path)\n File.extname(path)\n end",
"def filename\n @filename = \"#{secure_token}_#{split_extension(original_filename)}.#{file.extension}\" if original_filename.present?\n end",
"def get_file_name_without_ext(full_name)\n return File.basename(full_name, File.extname(full_name))\n rescue Exception => exc\n puts exc\n return full_name\n end",
"def getFileExt(file_name)\n \text = file_name.split('.')\n \tif(ext.length > 1)\n \t\tf_ext = ext[ext.length - 1]\n\t\t\n \t\tif(f_ext)\n \t\t\treturn f_ext\n \t\tend\n \tend\n end",
"def filename_without_extension\n filename.include?('.') ? filename.split('.')[0..-2].join('.') : filename\n end",
"def file_type( file_name )\n File.extname( file_name ).gsub( /^./, '' ).downcase\n end",
"def original_extension\n File.extname(original_filename)\n end",
"def process(name)\n return unless name\n\n self.ext = File.extname(name)\n self.basename = name[0..-ext.length - 1].gsub(%r!\\.*\\z!, \"\")\n end",
"def _output_filename(file)\n sub_strings = File.basename(file).split('.')\n base_name, extensions = sub_strings.first, sub_strings[1..-1]\n\n if extensions.last == 'haml'\n extensions.pop\n if extensions.empty?\n [base_name, options[:default_ext]].join('.')\n else\n [base_name, extensions].flatten.join('.')\n end\n else\n [base_name, extensions, options[:default_ext]].flatten.compact.join('.')\n end\n end",
"def get_filename filename, extension = 'png'\n unless filename.nil?\n file_extension = get_extension filename\n filename = (file_extension.empty?) ? filename + '.' + extension : filename\n else\n false\n end\n end",
"def filename(name)\n @filename = name.downcase.strip.gsub(' ', '-')\n end",
"def build_converted_file_name(source, from_lang, to_lang)\n # Get components of filename\n dirname = File.dirname(source)\n basename = File.basename(source, \".*\")\n extname = File.extname(source)\n\n # Blank out the from language\n basename.sub! Regexp.new(\"_#{from_lang}\", \"i\"), \"\"\n \n \"#{dirname}/#{basename}_#{to_lang}#{extname}\"\n end",
"def add_suffix filename, suffix\n parts = filename.split(\"\\.\")\n base = parts[0..-2]\n parts2 = base << suffix << parts[-1]\n fn = parts2.join(\".\")\n end",
"def add_suffix filename, suffix\n parts = filename.split(\"\\.\")\n base = parts[0..-2]\n parts2 = base << suffix << parts[-1]\n fn = parts2.join(\".\")\n end",
"def filename\n \"#{secure_token(10)}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n \"#{original_filename_without_extension.parameterize}_#{model.filename_token}#{original_extension}\" if original_filename\n end",
"def base file, ext; return File.basename file, ext end",
"def base file, ext; return File.basename file, ext 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 extension\n (options[:convert_to] || 'jpg').to_s.downcase.gsub(\"jpeg\", \"jpg\")\n end",
"def original_filename_without_extension\n @original_filename_without_extension || File.basename(original_filename, original_filename_extension)\n end",
"def filename\n if original_filename\n \"#{model.name.parameterize}-#{secure_token(8)}.#{file.extension}\"\n end\n end",
"def basename(filename)\n value = filename\n known_extensions.each do |str|\n value = value.gsub(/\\.#{str}$/, '')\n end\n value\n end",
"def maybe_convert_extension(ext); end",
"def filename\n return @filename if @filename\n name.downcase.gsub(/\\W/, '_').squeeze('_')\n end",
"def extname\n\t\treturn nil unless src\n\n\t\tFile.extname url.path\n\tend",
"def changeExt(filename, newext) \n\tuseme = filename.dup\n\treturn useme if ['.', '..'].include? filename\n\tif newext != ''\n\t\tnewext = (newext =~ /^\\./) ? newext : (\".\" + newext)\n\tend\n\tuseme.sub!(%r(([^/\\\\])\\.[^./\\\\]*$)) { $1 + newext } || useme + newext\nend",
"def process(name)\n self.ext = File.extname(name)\n self.basename = name.split('.')[0..-2].first\n end",
"def file_type file_name \n File.extname( file_name ).gsub /^\\./, '' \n end",
"def full_filename_fu(filename)\n version_prefix = \"#{version_name}_\"\n filename = filename.gsub(version_prefix, \"\")\n ext = nil\n basename = filename.gsub /\\.\\w+$/ do |s|\n ext = s; ''\n end\n \"#{basename}_#{version_name}#{ext}\"\n end",
"def basename filename, drop_ext = nil\n if drop_ext\n ::File.basename filename, (drop_ext == true ? (extname filename) : drop_ext)\n else\n ::File.basename filename\n end\n end",
"def name\n @name ||= File.basename(file).chomp(File.extname(file))\n end",
"def basename\n filename.chomp(extname)\n end",
"def basename_without_extension(file)\n return File::basename(file.to_s, File::extname(file.to_s))\n end",
"def to_filename(filename, size)\n filename.gsub! /^.*(\\\\|\\/)/, ''\n filename.gsub!(/[^0-9A-Za-z.\\-]/, '') \n filename.downcase.slice! 0..size\nend",
"def to_wikiname(in_filename)\n in_filename.gsub(/\\.[^\\.]*$/,'')\n end",
"def filename\n case File.extname original_filename\n when /.zip/\n \"oag_airlines.xls.zip\"\n when /.xls/\n \"oag_airlines.xls\"\n end\n end",
"def name_without_extension\n tmp = name\n i = tmp.index('.')\n i ? tmp[0...i] : tmp\n end",
"def get_extension filename\n unless filename.nil?\n filename.to_s.scan(/\\.([\\w+-]+)$/).flatten\n else\n false\n end\n end",
"def extension\n File.extname(@io.original_filename)\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 extensions\n _, *segments = name.downcase.split(\".\", -1)\n\n segments.map.with_index do |segment, index|\n \".\" + segments[index..-1].join(\".\")\n end\n end",
"def get_extension(fileName)\n file_extension = File.extname(fileName)\n file_extension = file_extension.split('.')\n file_extension.last\n end",
"def tempfile_extension\n # complexity here is due to supporting mangling non-UTF8 strings (e.g. latin-1 filenames with characters that are illegal in UTF-8)\n b = File.basename(@new_resource.path)\n i = b.index(\".\")\n i.nil? ? \"\" : b[i..].scrub\n end",
"def filename(attachment, style_name)\n [basename(attachment, style_name), extension(attachment, style_name)].delete_if(&:empty?).join(\".\")\n end",
"def filename_from_path(name, content_type)\n return \"#{Time.now.to_i}_#{name}\" if content_type.empty?\n\n extension = content_type.split('/').last\n filename = name.split('/').last\n alternative_name = extension.empty? ? \"#{Time.now.to_i}_#{filename}\" : \"#{Time.now.to_i}_#{filename}.#{extension}\"\n filename = File.extname(filename).empty? ? alternative_name : filename\n CGI.unescape(filename) if filename\n end",
"def filename\n [Digest::SHA1.hexdigest(file.read),file.extension].join('.') if original_filename\n end",
"def genfilename(ext, time = Time.now)\n time.strftime(\"%Y-%m-%d\") + ext\n end",
"def file_suffix\n file_name.split('.').last \n end",
"def extension\n begin\n @file_data.original_filename.split(\".\").last\n rescue\n @file_data.path.split(\".\").last\n end\n end",
"def proper_filename(file)\n file.gsub(/[^\\w]/,'_')\n end",
"def filename(version)\n @file_id.sub(/\\.#{file_type}\\Z/, \".#{version}.#{file_type}\")\n end"
] | [
"0.78093946",
"0.7793086",
"0.77875257",
"0.77566844",
"0.7681191",
"0.76433736",
"0.75623244",
"0.75035405",
"0.74765325",
"0.743516",
"0.7413942",
"0.73812175",
"0.73812175",
"0.7353624",
"0.73470175",
"0.73470175",
"0.73285824",
"0.73034984",
"0.7282757",
"0.7281285",
"0.7271936",
"0.7151951",
"0.7148552",
"0.7108185",
"0.7070441",
"0.70601124",
"0.7052346",
"0.7051543",
"0.70225644",
"0.70182866",
"0.70153666",
"0.7007071",
"0.6964458",
"0.6954916",
"0.6950761",
"0.6927151",
"0.69012403",
"0.68854105",
"0.68636805",
"0.68458873",
"0.68420655",
"0.68418133",
"0.6828237",
"0.68160945",
"0.6808201",
"0.6804175",
"0.6801054",
"0.67948735",
"0.67628616",
"0.67621034",
"0.6761428",
"0.67553014",
"0.6755291",
"0.6726863",
"0.672218",
"0.67083734",
"0.6696847",
"0.6696256",
"0.66891026",
"0.6686011",
"0.6678605",
"0.66678363",
"0.66678363",
"0.6660515",
"0.6653748",
"0.66458726",
"0.66458726",
"0.6641556",
"0.6638577",
"0.6638068",
"0.6637756",
"0.6636693",
"0.6634432",
"0.66292",
"0.6625225",
"0.6622826",
"0.6615339",
"0.66138524",
"0.66122705",
"0.66074836",
"0.66073924",
"0.65987617",
"0.6589207",
"0.65725905",
"0.65717477",
"0.6558465",
"0.6556635",
"0.6554165",
"0.65501624",
"0.65398645",
"0.6528695",
"0.65284294",
"0.6511639",
"0.6511394",
"0.64996415",
"0.6495316",
"0.6489344",
"0.64870656",
"0.6484163",
"0.6483091",
"0.64826053"
] | 0.0 | -1 |
Converts an extension name into a class name. | def ext_name(name)
return name.to_s if name.kind_of?(Symbol)
return name.gsub(/\s/, '_')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variable_name_to_class_name(name)\n name.to_s.\n gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.\n gsub(/(?:^|_)(.)/) { $1.upcase }\n end",
"def variable_name_to_class_name(name)\n name.to_s.\n gsub(/\\/(.?)/) { \"::#{$1.upcase}\" }.\n gsub(/(?:^|_)(.)/) { $1.upcase }\n end",
"def extract_class_name(filename)\n File.basename(filename).chomp(\".rb\").camelize\n end",
"def extract_class_name(filename)\n filename.split('/')[2..-1].collect { |i| i.camelize }.join('::').chomp(\".rb\")\n end",
"def ruby_classname_to_java(class_name:)\r\n\r\n parts = class_name.to_s.split('::')\r\n packageless_class_name = parts.pop\r\n\r\n parts.map! do |package_part|\r\n package_part[0] = package_part[0].downcase\r\n package_part\r\n end\r\n\r\n parts << packageless_class_name\r\n parts.join('.')\r\n end",
"def to_class_name\n parts = downcase.split('/')\n parts.each(&:capitalize!)\n parts.join('').gsub(%r{-}, '')\n end",
"def class_name(name)\n name, anchor = name.to_s.split(\"#\", 2)\n name = File.basename(name, \".json\")\n name = name + \"_\" + anchor if anchor.present?\n name.gsub(/[^\\w]/, \"_\").camelcase\n end",
"def class_name\n Jaspion::Kilza::Class.normalize(@original_name)\n end",
"def class_to_filename (c)\n c.split(/::/).map {|i| i.gsub(/([A-Z])/, '_\\1').sub(/_/, '').downcase}.\n join('/')\nend",
"def base_filename; class_to_filename(name.gsub(/.*:/, '')); end",
"def construct_klass(name)\n name.to_s.split('_').map{|i|i.capitalize}.join\n end",
"def class_name_for(object)\n object.name.split('.').first.downcase.tr('_', '-')\n end",
"def classname(name)\n [@lexer.namespace, name].join(\"::\").sub(/^::/, '')\n end",
"def extension\n name.downcase\n end",
"def class_name_for(file_name)\n file_name.split(/\\//).last.sub(/\\.rb$/, '').split(/_/).map do |s|\n s.capitalize\n end.join('')\n end",
"def class_file_name(prepend_path = false, append_extension = false)\n\t\tjfile_name = file_name\n\t\tjfile_name += \".class\" if append_extension\n\t\tjfile_name = CLASS_PATH + jfile_name if prepend_path\n\t\treturn jfile_name\n\tend",
"def to_class(name)\n return name unless name.is_a? String\n\n # NOTE: DO NOT try to use const_defined? and const_get EVER.\n # This is Rails, use constantize\n name.constantize\n rescue NameError\n Logger.error \"`#{name}` is not a valid Class name.\"\n end",
"def get_class(name)\n name.split(/::/).inject(Object) { |p, n| p.const_get(n) } \n end",
"def filename_to_class (f)\n f.split('/').map {|i| i.capitalize.gsub(/_([a-z])/) {|s| $1.upcase }}.\n join('::')\nend",
"def formatted_class_name(class_name)\n class_name = class_name.split(':')[-1]\n (class_name.gsub!(/(.)([A-Z])/, '\\1_\\2') || class_name).upcase\n end",
"def class_name_for(module_name, name)\n \"#{module_name}::#{class_name(name)}\"\n end",
"def class_from_name\n if model_name.to_s.include? \"_\"\n ns, *klass = model_name.to_s.split(\"_\").collect(&:camelize)\n begin\n \"#{ns}::#{klass.join(\"\")}\".constantize\n rescue NameError\n \"#{ns}#{klass.join(\"\")}\".constantize\n end\n else\n model_name.to_s.camelize.constantize\n end\n end",
"def class_name\n @class_name ||= (@options[:class_name] || @name).to_s.camelize\n end",
"def actionscript_file_to_short_class_name(file)\n return File.basename(file, '.*')\n end",
"def stripped_class_name\n name.demodulize\n end",
"def name_from_object(class_name)\n class_name.split('::').last\n end",
"def parse_classname(full_cname)\n names=full_cname.split(\"::\")\n return names[0..-2].join('::'), names[-1], names.join(\"/\") \n end",
"def underscorized_classname\n self.class.name.split(\"::\").last.\n gsub( /([A-Z]+)([A-Z][a-z])/, '\\1_\\2' ).\n gsub( /([a-z\\d])([A-Z])/, '\\1_\\2' ).downcase\n end",
"def to_class_name\n self.to_method_name.gsub(/\\/(.?)/) { \"#{$1.upcase}\" }.gsub(/(?:^|_)(.)/) { $1.upcase }\n end",
"def actionscript_file_to_class_name file\n name = file.dup\n name.gsub!(/^#{path}\\//, '')\n name.gsub!(/^#{test}\\//, '')\n name.gsub!(/^#{src}\\//, '')\n name.gsub!(/.as$/, '')\n name.gsub!(/#{File::SEPARATOR}/, '.')\n return name\n end",
"def infer_extension\n return if name.nil?\n\n self.extension ||= File.extname(name)\n end",
"def extensions\n _, *segments = name.downcase.split(\".\", -1)\n\n segments.map.with_index do |segment, index|\n \".\" + segments[index..-1].join(\".\")\n end\n end",
"def class_name\n self.fullname[/\\A(.*)([\\.\\#])([^\\.\\#]+)\\z/, 1]\n end",
"def packagize(klass)\n klass = klass.to_s.split('::') unless klass.is_a? Array\n klass_name = klass.pop\n klass.map{|e| underscore(e) }.join('.') + \".#{klass_name}\"\n end",
"def safe_class_name()\n self.class.name.downcase.gsub(/[^\\d\\w]/, '_')\n end",
"def ns_constantize\n to_s.gsub('__', '::').constantize\n end",
"def convert_class(klass)\n ::ActiveSupport::Inflector.underscore(klass.name).gsub(\"/\", \"_\")\n end",
"def name\n has_module?(klass) ? klass[(klass.index(\"::\")+2)..-1] : klass\n end",
"def normalize_extension(extension)\n extension = extension.to_s\n if extension[/^\\./]\n extension\n else\n \".#{extension}\"\n end\n end",
"def normalize_extension(extension)\n extension = extension.to_s\n if extension[/^\\./]\n extension\n else\n \".#{extension}\"\n end\n end",
"def class_name_to_variable_name(name)\n name.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def class_name_to_variable_name(name)\n name.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def extract_class(string)\n uncapitalize(string.split('::').last)\n end",
"def class_name\n @class_name ||= derive_class_name\n end",
"def classname\n @classname ||= self.class.name.split(\"::\")[1..-1].join(\"::\")\n end",
"def namespaced_class_name(name)\n class_name = \"#{name.split('/').map(&:camelize).join('::')}Controller\"\n if @namespaces.empty?\n class_name\n else\n @namespaces.map { |namespace| \"#{namespace.camelize}::\" }.join('') + class_name\n end\n end",
"def wrapper_name(java_classname)\n (\"convert_\" + java_classname.gsub(/\\./, \"_\")).downcase.to_sym\n end",
"def class_name\r\n r = \"\"\r\n up = true\r\n each_byte do |c|\r\n if c == 95\r\n if up\r\n r << \"::\"\r\n else\r\n up = true\r\n end\r\n else\r\n m = up ? :upcase : :to_s\r\n r << (c.chr.send(m))\r\n up = false\r\n end\r\n end\r\n r\r\n end",
"def class_name(subj)\n nm = subj.respond_to?(:class_eval) ? subj.demodulize : subj.class.demodulize\n @class_name = \"#{nm}#{UUIDTools::UUID.random_create.to_s.gsub /-/, ''}\"\n @class_name\n end",
"def camelize(class_name)\n return class_name if class_name !~ /-/\n class_name.gsub(/(?:-|(\\/))([a-z\\d]*)/) { \"#{$1}#{$2.capitalize}\" }.strip\n end",
"def actionscript_file_to_class_name(file)\n name = super(file)\n\t\tname.gsub!(/^#{model.spec_dir}\\./, '')\n return name\n end",
"def classify_name(filename)\n filename.to_s.split(\"_\").map{ |i| i[0...1].upcase + i[1..-1] }.join\n end",
"def class_name\n self.to_s.demodulize.underscore\n end",
"def parse_name(name)\n parts = name.split(/(::|\\#|\\.)/)\n\n if parts[-2] != '::' or parts.last !~ /^[A-Z]/ then\n meth = parts.pop\n parts.pop\n end\n\n klass = parts.join\n\n [klass, meth]\n end",
"def path_to_classname(s)\n sep = File::SEPARATOR\n parts = s.sub(/^test#{sep}((#{test_namespaces*'|'})#{sep})?/, '').sub(/\\.rb$/, '').split(sep)\n modules = parts.map { |path| path.split(/_/).map { |seg| seg.capitalize }.join }\n modules[-1] = \"#{modules.last}Test\" unless modules.last =~ /Test$/\n modules.join('::')\n end",
"def class_name\n self.class.name.split(\"::\").last.downcase\n end",
"def name\n n = self.class.name\n n.gsub!( /::/, '.' )\n n.gsub( /(\\w)\\w+\\./ ) { |m| $1.downcase + '.' }\n end",
"def file2klass(str)\n\t\t\tstr.split(\"/\").map {|c|\n\t\t\t\tc.split(/_/).collect {|i| i.capitalize }.join(\"\")\n\t\t\t}.join(\"::\")\n\t\tend",
"def maybe_convert_extension(ext); end",
"def sanitize_class_name(name)\n name.gsub(/[^_0-9A-Za-z:]/, '')\n end",
"def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end",
"def class_name\n @class_name ||= (options[:class_name] || derive_class_name).to_s\n end",
"def classname_from_file(file)\n the_process_class = File.basename(file)\n\n the_process_class['.rb'] = '' if the_process_class['.rb']\n\n if (/[A-Z]/ =~ the_process_class) != 0\n the_process_class = the_process_class.capitalize\n end\n\n match_found = the_process_class.scan(/_[a-z]/)\n if match_found\n # Ruby 1.8 : 'ab'[1] => 98 and 'ab'[1, 1] => 'b'\n # Ruby 1.9 + : 'ab'[1] => 'b' and 'ab'[1, 1] => 'b'\n match_found.each { |str| the_process_class[str] = str[1, 1].capitalize }\n end\n\n the_process_class\n end",
"def to_class_name\n to_s.gsub('&', 'and').gsub(/[\\- ]/, '_').camelize(:upper)\n end",
"def class_name_to_attribute_name(name)\n name.gsub(/([a-z]+)([A-Z])/, '\\1_\\2').gsub('-', '_').downcase\n end",
"def class_name_to_attribute_name(name)\n name.gsub(/([a-z]+)([A-Z])/, '\\1_\\2').gsub('-', '_').downcase\n end",
"def class_by_name name\n # http://stackoverflow.com/questions/14070369/how-to-instantiate-class-from-name-string-in-rails\n Object.const_get name.to_s\n\n end",
"def model_name_to_constant(name)\n name = name.gsub(/_/,' ') if name =~ /_/ # convert <underscore> to <space>\n name.singularize.split(/ |_/).collect(&:capitalize).join.constantize\n end",
"def klass_name\n \"#{params[:klass_name].classify}\"\n end",
"def to_name\n basename.to_s.sub extname, ''\n end",
"def class_name_for_class_file(subtree, class_file)\n the_classes_directory = classes_directory(subtree)\n subpath_string = FilePath.new(class_file).relative_path_from(the_classes_directory).to_s\n subpath_string = $1 if subpath_string =~ /^(.*)\\.class\\s*$/\n subpath_string.gsub!(\"/\", \".\")\n subpath_string.gsub!(\"\\\\\", \".\")\n subpath_string\n end",
"def klass\n name.gsub(module_name+\"::\",\"\")\n end",
"def class_name_to_attribute_name(name)\r\n name.gsub(/([a-z]+)([A-Z])/, '\\1_\\2').gsub('-', '_').downcase\r\n end",
"def class_name_to_attribute_name(name)\r\n name.gsub(/([a-z]+)([A-Z])/, '\\1_\\2').gsub('-', '_').downcase\r\n end",
"def name_and_class\n [name, self['class']].compact.join('.')\n end",
"def extensionize(fname, ext, opts={})\n extname = File.extname(fname)\n return fname if (extname =~ /\\.?#{ext}$/i) == 0\n fname = fname.gsub(/#{extname}$/, '') if opts[:chomp] == true\n return fname.strip + '.' + ext.to_s.gsub(/^\\./, '')\n end",
"def locale_klass_name\n @locale_klass_name ||= self.class.name.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr('-', '_').\n downcase\n end",
"def class_path klass_name\n File.join @path, *klass_name.split('::')\n end",
"def combined_class_name\n @combined_class_name ||= \"Combined::\" + my_class_name.to_s.sub(/.*::/, \"\")\n end",
"def class_from_string(class_name)\n parts = class_name.split('::')\n constant = Object\n parts.each do |part|\n constant = constant.const_get(part)\n end\n constant\nend",
"def make_file_name aExtension, *aWords #:nodoc:\n aWords.join(' ').to_file_name.ext(aExtension)\n end",
"def class_to_basefile class_name\n\t\t\treturn \"#{base_dir}/#{class_name.gsub(\"::\", \"/\")}\"\n\t\tend",
"def synthesize_job_name\n klass_name = name.scan(/[^:]+/).last\n klass_name = klass_name[/(.+)Job/, 1] || klass_name\n klass_name.scan(/[A-Z][a-z]+/).map(&:downcase).join('_').to_sym\n end",
"def get_as_class_name ruby_class_name\n mapping = @ruby_mappings[ruby_class_name]\n return mapping.nil? ? nil : mapping.as\n end",
"def pretty_class_name\n return self.class.to_s.split(/(?=[A-Z])/).join(' ')\n end",
"def to_const_name(name)\nconst_name = name.to_s.gsub(/[^a-z0-9_]/i,'_').squeeze('_').upcase\n if const_name =~ /^[^a-z]/i\n const_name = \"T_\"+const_name\n end\n const_name.to_sym\n end",
"def json_class_name\n [self.class.domain_module, self.class.name.demodulize].join('::')\n end",
"def classify(string)\n camelize(string.to_s.sub(/.*\\./, ''))\n end",
"def extname( fn )\n ::File.extname(fn).tr('.', '')\n end",
"def full_class_name\n @class_names.join(\"::\")\n end",
"def name_without_extension\n tmp = name\n i = tmp.index('.')\n i ? tmp[0...i] : tmp\n end",
"def class_name\n (self.type.to_s || self.class.name).demodulize\n end",
"def changeFileExtensionTo(filename, extension)\n return \"#{File.basename(filename, File.extname(filename))}.#{extension}\"\nend",
"def get_class(cname, mdl = Processor)\n mdl.const_get(cname.split(/[\\,\\_]/).map { |p| p.capitalize }.join)\n rescue NameError\n return nil\n end",
"def add_class(name); end",
"def add_class(name); end",
"def validate_class_name(name)\n only_basic_type(name) || name.gsub(/-/, \"_\").camelcase\n end",
"def class_name\n fetch('heroes_of_the_storm.class_names')\n end",
"def class_name_id object\n return object.class.to_s.split(/(?=[A-Z])/).join('-').downcase\n end",
"def worker_class_constantize(worker_class)\n return worker_class unless worker_class.is_a?(String)\n worker_class.constantize\n rescue NameError\n worker_class\n end"
] | [
"0.70029724",
"0.70029724",
"0.6962108",
"0.6958684",
"0.68134195",
"0.66921586",
"0.6637349",
"0.6609027",
"0.6589456",
"0.65865016",
"0.65243304",
"0.65216833",
"0.64948285",
"0.64929676",
"0.64029235",
"0.6382814",
"0.63123375",
"0.62973875",
"0.62798995",
"0.6276466",
"0.6158933",
"0.61544985",
"0.61412066",
"0.6137194",
"0.61366063",
"0.6119138",
"0.6104523",
"0.61007404",
"0.6055535",
"0.6042966",
"0.60401225",
"0.6030665",
"0.60225284",
"0.60182667",
"0.5999475",
"0.5995439",
"0.5979227",
"0.597142",
"0.59680283",
"0.59680283",
"0.59619457",
"0.59619457",
"0.5957961",
"0.5957471",
"0.5956053",
"0.5941814",
"0.5935041",
"0.5932672",
"0.592008",
"0.59179765",
"0.5914571",
"0.5902258",
"0.5895455",
"0.5847927",
"0.58455795",
"0.5843652",
"0.5843538",
"0.5841255",
"0.5832961",
"0.58211726",
"0.58183694",
"0.58183694",
"0.5816983",
"0.5799655",
"0.5782987",
"0.5782987",
"0.5771569",
"0.57671964",
"0.57607746",
"0.5760481",
"0.5759094",
"0.5758274",
"0.57549274",
"0.57549274",
"0.5753579",
"0.5753379",
"0.57466173",
"0.5737756",
"0.573377",
"0.57337594",
"0.57312495",
"0.5726572",
"0.5713471",
"0.57092166",
"0.57055527",
"0.57020354",
"0.57001626",
"0.5688276",
"0.5684442",
"0.56714624",
"0.56713593",
"0.56701744",
"0.5664217",
"0.5660145",
"0.5656671",
"0.5656671",
"0.56533927",
"0.5645493",
"0.56447387",
"0.5634896"
] | 0.6474285 | 14 |
Cleans the load path dirtied by this instance of ExtensionHost. | def clean_load_path
$:.delete @path unless @path.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup\n File.delete(@path) if @path.is_a?(String) && File.exist?(@path)\n end",
"def clean\n @paths = {}\n @paths[''] = Path.new(self, '')\n @prepares = []\n self\n end",
"def cleanup\n cleanup_unpack_path\n cleanup_download_path\n end",
"def clear!\n Padrino.clear_middleware!\n Padrino.mounted_apps.clear\n @_load_paths = nil\n @_dependency_paths = nil\n @_global_configuration = nil\n Padrino.before_load.clear\n Padrino.after_load.clear\n Padrino::Reloader.clear!\n Thread.current[:padrino_loaded] = nil\n end",
"def clean_up\n pathname.delete if pathname.exist?\n end",
"def clear_path\n self.path = []\n end",
"def clear_paths\n @paths.clear\n end",
"def clear!\n @paths = []\n end",
"def stop_registering_extension\n @register_path = nil\n end",
"def remove_location_from_context(iLocation)\n # * *iLocation* (_String_): Directory\n $LOAD_PATH.delete_if do |iLoadDir|\n (iLoadDir == iLocation)\n end\n end",
"def finalize!\n all_files.each { |f| Kernel.require f } if eager_load\n all_files.clear\n self\n end",
"def purge\n\n FileUtils.remove_dir(@basepath)\n end",
"def cleanup\n FileUtils.rm_rf(sfx_cache_path)\n end",
"def cleanup!\n f = pids_file_for(Loader.current_type)\n FileUtils.rm_f(f) if (pids_from(f) - Process.pid).blank?\n 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 load_path\n # TODO: Could this be used to load app dir and blueprint.yml?\n # If not remove it\n owner.before_load_path(rootpath, self) if owner.respond_to?(:before_load_path)\n create_assets\n validate_if_segment\n create_components\n end",
"def clear\n @extensions_for.clear\n end",
"def reset_paths\n @public_path = nil\n @view_path = nil\n end",
"def clear_atomic_path_cache\n self.path = nil\n _base.instance_variable_set(\"@atomic_paths\", nil)\n end",
"def clear_paths\n mutate_config(:paths) do |paths|\n paths.clear\n end\n end",
"def bootstrap_cleanup\n end",
"def clean_installation\n clean_paths.each { |path| FileUtils.rm_rf(path) }\n end",
"def unloadpath(*paths)\r\n paths.each {|path| $LOAD_PATH.delete File.expand_path(path) }\r\n $LOAD_PATH\r\n end",
"def clean_path path\n Sprout::System.create.clean_path path\n end",
"def unload\n mutex.synchronize do\n # We are going to keep track of the files that were required by our\n # autoloads to later remove them from $LOADED_FEATURES, thus making them\n # loadable by Kernel#require again.\n #\n # Directories are not stored in $LOADED_FEATURES, keeping track of files\n # is enough.\n unloaded_files = Set.new\n\n autoloads.each do |abspath, (parent, cname)|\n if parent.autoload?(cname)\n unload_autoload(parent, cname)\n else\n # Could happen if loaded with require_relative. That is unsupported,\n # and the constant path would escape unloadable_cpath? This is just\n # defensive code to clean things up as much as we are able to.\n unload_cref(parent, cname)\n unloaded_files.add(abspath) if ruby?(abspath)\n end\n end\n\n to_unload.each do |cpath, (abspath, (parent, cname))|\n # We have to check cdef? in this condition. Reason is, constants whose\n # file does not define them have to be kept in to_unload as explained\n # in the implementation of on_file_autoloaded.\n #\n # If the constant is not defined, on_unload should not be triggered\n # for it.\n if !on_unload_callbacks.empty? && cdef?(parent, cname)\n value = parent.const_get(cname)\n run_on_unload_callbacks(cpath, value, abspath)\n end\n\n unload_cref(parent, cname)\n unloaded_files.add(abspath) if ruby?(abspath)\n end\n\n unless unloaded_files.empty?\n # Bootsnap decorates Kernel#require to speed it up using a cache and\n # this optimization does not check if $LOADED_FEATURES has the file.\n #\n # To make it aware of changes, the gem defines singleton methods in\n # $LOADED_FEATURES:\n #\n # https://github.com/Shopify/bootsnap/blob/master/lib/bootsnap/load_path_cache/core_ext/loaded_features.rb\n #\n # Rails applications may depend on bootsnap, so for unloading to work\n # in that setting it is preferable that we restrict our API choice to\n # one of those methods.\n $LOADED_FEATURES.reject! { |file| unloaded_files.member?(file) }\n end\n\n autoloads.clear\n autoloaded_dirs.clear\n to_unload.clear\n lazy_subdirs.clear\n\n Registry.on_unload(self)\n ExplicitNamespace.unregister_loader(self)\n\n @setup = false\n @eager_loaded = false\n end\n end",
"def clean_up\n FileUtils.rm_rf \"#{@path}\" unless create_in_current_directory?\n FileUtils.rm_rf \"#{@cache}\"\n end",
"def teardown\n FileUtils.remove_dir(TEMP_SITE_PATH, true) if Dir.exists? TEMP_SITE_PATH\n Ruhoh::Manager.reset\nend",
"def loaded(path)\n load_map.delete path\n end",
"def reset!\n @base_dir = @path = nil\n end",
"def cleanup_unpack_path\n if unpack_path.exist?\n unpack_path.rmtree\n end\n end",
"def cleanup\n super\n # Whoever registered BrowserProfilePrefix should do the cleanup\n clear_browser_profiles unless self.datastore['BrowserProfilePrefix']\n end",
"def reset!\n @file_path = nil\n load force: true\n end",
"def clear\n if loaded?\n orphan_resources(self)\n end\n super\n end",
"def unload!(path)\n component_wrap = ComponentWrap.from_path(self, path)\n if component_wrap\n info \"Unloading: #{component_wrap.raw_component.name} from #{path}\"\n component_wrap.unload!\n @loaded_components.delete(component_wrap)\n end\n end",
"def clear_paths\n @trail.paths.dup.each { |path| @trail.remove_path(path) }\n end",
"def clean_environment\n `rm -rf /tmp/#{@upload_id}` # all sliced pages of the source file\n end",
"def clear!\n defined_settings.each {|setting| instance_variable_set(\"@#{setting}\", nil)}\n @storage_adapters = []\n @cached_paths = {}\n end",
"def remove_paths(*args)\n args.each {|arg| load_paths.delete(arg)}\n end",
"def cleanup_dirs\n @cleanup_dirs ||= ['.']\n end",
"def cleaned_relative_path\n @cleaned_relative_path ||=\n relative_path[0..-extname.length - 1]\n .sub(collection.relative_directory, \"\")\n .gsub(%r!\\.*\\z!, \"\")\n end",
"def clean!\n return false unless @path\n\n @cache[:paths].delete_if do |key, _|\n not @path.dirname.join(key).file? or\n # Remove any path to a file not in a subtree (:data_uri images).\n key[0..2] == NON_SUBTREE\n end\n\n sprite_keys = @project.sprites.map { |sprite| key(sprite) }\n\n @cache[:sprites].delete_if do |key, _|\n not sprite_keys.include?(key)\n end\n end",
"def clean!\n stop\n remove_instance_dir!\n FileUtils.remove_entry(config.download_path) if File.exists?(config.download_path)\n FileUtils.remove_entry(config.tmp_save_dir, true) if File.exists? config.tmp_save_dir\n md5.clean!\n FileUtils.remove_entry(config.version_file) if File.exists? config.version_file\n end",
"def cleanup\n FileUtils.rm_f(@path)\n delete\n end",
"def run_on_removal(paths)\n super\n end",
"def clear!\n context_manager.clear!\n breadcrumbs.clear!\n end",
"def load_path=(load_path); end",
"def cleanup_script_execution\n FileUtils.rm_rf(InstanceConfiguration::CACHE_PATH)\n end",
"def clear\n @autoloaded_classes.to_a.reverse_each do |klass|\n RubyCodeAutoreloader::ClassLoader.remove_constant(klass)\n @autoloaded_classes.delete(klass)\n end\n\n @existing_modules_before_load.clear\n @autoloaded_files = []\n ActiveSupport::DescendantsTracker.clear\n ActiveSupport::Dependencies.clear\n end",
"def cleanup\n super\n end",
"def prepare_load_paths\n t = @target\n t = @target.parent unless @target.parent.nil?\n unless t.is_a?(Fetchers::Local)\n return # no need to mess with load-paths if this is not on disk\n end\n\n rel_dirs = (@libraries.keys + @tests.keys)\n .map { |x| File.dirname(x) }.uniq\n\n abs_dirs = rel_dirs.map { |x| @target.abs_path(x) }\n .find_all { |x| File.directory?(x) }\n .map { |x| File.expand_path(x) }\n\n abs_dirs.each do |dir|\n $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)\n end\n end",
"def cleanup\n\tsh 'del /F /Q .\\_site\\*'\n\t# sh 'rm -rf ./_site'\nend",
"def unload!\n if Native.unload(@path_to)\n @loaded = false\n true\n else\n false\n end\n end",
"def clear_base_location\n tmpdir = dir + \"base_removed\"\n base_location.move(tmpdir)\n base_location.mkdir\n tmpdir.delete\n end",
"def erase(storage_path)\n super\n file = absolute_path(storage_path)\n FileUtils.rm file if File.exists?(file)\n\n dir = File.dirname(file)\n while File.expand_path(parent = File.dirname(dir)).size > File.expand_path(options[:absolute_base] || '.').size\n FileUtils.rm_rf(dir) if File.exists?(dir) && directory_empty?(dir)\n dir = parent\n end\n FileUtils.rm_rf(dir) if File.exists?(dir) && directory_empty?(dir)\n end",
"def set_load_path!\n load_paths = configuration.load_paths || [] # TODO: from script/console the configuration isn't ran.\n load_paths.reverse_each { |dir| $LOAD_PATH.unshift(dir) if File.directory?(dir) } unless Rucola::RCApp.test? # FIXME: why??\n $LOAD_PATH.uniq!\n end",
"def restore_globals\n # Restore the original $LOAD_PATH to negate any changes made.\n $LOAD_PATH.replace @@load_path_org\n # Could restore the original $LOADED_FEATURES ($\"), but this worker process\n # acculumates many gems and modules over time and it's not practical to\n # reload them every time.\n # So, just deleting those in @sitelibbase or @sourcebase directory.\n $LOADED_FEATURES.reject! {|x| x.start_with?(@sitelibbase, @sourcebase)}\n end",
"def cleanup\n end",
"def cleanup\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 clear(path)\n set_internal(path, nil)\n end",
"def remove_check_load(opts)\n opts = check_params(opts,[:load_info])\n super(opts)\n end",
"def clean!\n stop\n FileUtils.remove_entry(download_path) if File.exists? download_path\n FileUtils.remove_entry(tmp_save_dir, true) if File.exists? tmp_save_dir\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n FileUtils.remove_entry(md5sum_path) if File.exists? md5sum_path\n FileUtils.remove_entry(version_file) if File.exists? version_file\n end",
"def clean!\n stop\n FileUtils.remove_entry(download_path) if File.exists? download_path\n FileUtils.remove_entry(tmp_save_dir, true) if File.exists? tmp_save_dir\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n FileUtils.remove_entry(md5sum_path) if File.exists? md5sum_path\n FileUtils.remove_entry(version_file) if File.exists? version_file\n end",
"def clean_paths\n FileUtils.rm_rf(tmp_path)\n FileUtils.mkdir_p(tmp_path)\n end",
"def remove\n remove_checkpoints\n remove_config\n remove_hiera_template\n end",
"def mina_cleanup!\n super\n @cleanup_called = true\n end",
"def clear_paths\n expire_index!\n @trail.paths.each { |path| @trail.remove_path(path) }\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 clear\n raise \"unsafe test stage directory -- #{Dir.pwd}\" unless /#{Dir.tmpdir}/ =~ Dir.pwd\n Dir['*'].each do |path|\n FileUtils.rm_r(path)\n end\n end",
"def clean(path)\n add_rule('clean', Platform.rm(Platform.pathspec(path)))\n end",
"def clean(path)\n add_rule('clean', Platform.rm(Platform.pathspec(path)))\n end",
"def teardown\n FileUtils.rm_rf(data_path)\n end",
"def cleanup(config_store, verbose, cache_root = T.unsafe(nil)); end",
"def clear\n FileUtils.rm_rf(path)\n end",
"def cleanup\n super\n end",
"def clear_host!\n @host_key_files = []\n @known_host_identities = nil\n self\n end",
"def clean_dir\n\n path = self.get_dir\n _clean_dir(path)\n end",
"def cleanup(path)\n Monsove.logger.info(\"Cleaning up local path #{path}\")\n\n FileUtils.rm_rf(path)\n File.delete(\"#{path}.tar.bz2\")\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def cleanup\n end",
"def unload\n @all = nil\n end",
"def clear\n lazy_load # lazy load so that targets are always orphaned\n super\n end",
"def clear\n lazy_load # lazy load so that targets are always orphaned\n super\n end",
"def loaded_path; end",
"def unregister\n Registry.unregister_loader(self)\n ExplicitNamespace.unregister_loader(self)\n end",
"def clean_up\n FileUtils.rm_rf @temp_root\n end",
"def destroy_all\n destroy(load_target).tap do\n reset\n loaded!\n end\n end",
"def cleanup!; end",
"def cleanup!; end",
"def cleanup!\n # This method may be left unimplemented if that is applicable\n end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup; end",
"def cleanup_hook; end",
"def cleanup\r\n end",
"def load_path; end",
"def load_paths\n @load_paths ||= Config::LoadPaths.new\n end"
] | [
"0.6458723",
"0.63510746",
"0.6335118",
"0.6253226",
"0.6168288",
"0.6093034",
"0.60341704",
"0.600311",
"0.595398",
"0.594671",
"0.5926544",
"0.58760077",
"0.5852982",
"0.5819992",
"0.57998955",
"0.5796202",
"0.5782216",
"0.57819444",
"0.5767308",
"0.57594824",
"0.5752692",
"0.574636",
"0.5741901",
"0.5729108",
"0.5718902",
"0.5717532",
"0.57170826",
"0.5709109",
"0.5696794",
"0.5694909",
"0.5690467",
"0.5687592",
"0.5686122",
"0.56460875",
"0.5621718",
"0.56084394",
"0.559865",
"0.5597797",
"0.5548629",
"0.55436254",
"0.5518355",
"0.55035746",
"0.5493242",
"0.54908824",
"0.5467606",
"0.545908",
"0.54590493",
"0.5431549",
"0.5427853",
"0.5426455",
"0.5408283",
"0.53907716",
"0.5390461",
"0.5385697",
"0.53773594",
"0.5370207",
"0.5369251",
"0.5369251",
"0.5365413",
"0.5364087",
"0.5363653",
"0.535389",
"0.535389",
"0.53522",
"0.5351645",
"0.5347391",
"0.53378683",
"0.5333526",
"0.5326957",
"0.5325428",
"0.5325428",
"0.5322137",
"0.53132683",
"0.53065264",
"0.5298915",
"0.52940625",
"0.5285028",
"0.52850014",
"0.52831244",
"0.52831244",
"0.52831244",
"0.52831244",
"0.5281476",
"0.5276061",
"0.5276061",
"0.52742755",
"0.52659297",
"0.5261348",
"0.52584666",
"0.5252472",
"0.5252472",
"0.5250547",
"0.52476496",
"0.52476496",
"0.52476496",
"0.52476496",
"0.52418774",
"0.5238448",
"0.5236135",
"0.52028203"
] | 0.7962232 | 0 |
Responds to .sort method | def <=>(schema)
sort_key <=> schema.sort_key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_entries; end",
"def sort\n return @sort\n end",
"def sorted_results\n results.sort\n end",
"def sort()\n\t\t@events = @events.sort do |a,b| a[0] <=> b[0] end\n\tend",
"def sort!\n sort_if_needed\n self\n end",
"def sort\n @pokers.sort.reverse\n end",
"def sorting(numbers)\n numbers.sort\nend",
"def bigSorting(unsorted)\n\nend",
"def sort\n @cards.sort\n end",
"def sort_data\n store.sort_data!\n end",
"def bubble_sort_rec(&prc)\n end",
"def sort_files!; end",
"def using_sort(array)\narray.sort\nend",
"def using_sort(array)\narray.sort\nend",
"def sort\n\t@events = @events.sort_by { | e | e.time_from_start }\n\trecalc_delta_from_times()\n end",
"def sort\n super { |x, y| x.file_name <=> y.file_name }\n end",
"def sort(&block)\n self.map{|*val| val.__svalue}.sort(&block)\n end",
"def sorted_data &block\n @data.to_a.sort(&block)\n end",
"def sortme( names )\n names.sort\nend",
"def sort1(array)\n\nend",
"def sort\n @items.sort { |x,y| x.rank <=> y.rank }\n end",
"def sort\n @entries = DependencySorter.new(@entries).sorted_items\n end",
"def sort\n @books.sort.each {|item| puts \"#{item[0]} (#{item[1]})\" }\n end",
"def sort_entries=(_arg0); end",
"def test_sort\n\n a_plus = Grade.new(\"A+\")\n a = Grade.new(\"A\")\n b_minus = Grade.new(\"B-\")\n\n ordered = [a_plus,b_minus, a].sort # should return [a, a_plus]\n\n assert(ordered[0] == b_minus)\n assert(ordered[1] == a)\n assert(ordered[2] == a_plus)\n\n end",
"def sort_params; end",
"def sort_params; end",
"def sort a\r\n sort_rec a, []\r\nend",
"def sort a\r\n sort_rec a, []\r\nend",
"def grand_sorting_machine(array)\n\n\n\nend",
"def my_array_sorting_method(source)\n # Your code here!\nend",
"def my_array_sorting_method(source)\n # Your code here!\nend",
"def my_array_sorting_method(source)\n # Your code here!\nend",
"def my_array_sorting_method(source)\n # Your code here!\nend",
"def my_array_sorting_method(source)\n # Your code here!\nend",
"def my_array_sorting_method(source)\n # Your code here!\nend",
"def my_array_sorting_method(source)\n # Your code here!\nend",
"def sortme(names)\n names.sort\nend",
"def sortme( names )\n names.sort\nend",
"def sortme( names )\n names.sort\nend",
"def sort(array_of_nodes, order); end",
"def using_sort(array)\n array.sort\nend",
"def using_sort(array)\n array.sort\nend",
"def using_sort(array)\n array.sort\nend",
"def stable_sort_by(list); end",
"def sort\n self[:sort]\n end",
"def sort(*arguments, &block)\n data.sort(*arguments, &block)\n end",
"def sorted_events\n events.sort\n end",
"def merge_sort(&prc)\n end",
"def sort\n @hits = all.sort {|x,y| y.score <=> x.score }\n end",
"def bubble_sort!(&prc)\n\n end",
"def bubble_sort!(&prc)\n \n end",
"def sort!\r\n @tabs.sort! { |x,y| x.name <=> y.name }\r\n end",
"def apply_sorting(chain)\n chain\n end",
"def count_sort(a)\n\t\nend",
"def sort\n @cards.sort_by {|card| card.poker_value}\n end",
"def bubble_sort!(&prc)\n end",
"def bubble_sort!(&prc)\n end",
"def sort(companies)\n companies.sort_by do |company|\n -company.size\n end \nend",
"def bubble_sort(&prc)\n self.dup.bubble_sort!(&prc)\n end",
"def my_array_sorting_method(array)\n\t@array=array\n\[email protected]\n\treturn @array\nend",
"def sort some_array \n\tsortingRec some_array, []\nend",
"def bubble_sort(&prc)\n prc ||= Proc.new { |a, b| a <=> b }\n self.sort! &prc\n end",
"def perform\n kahn_sorting if @sorted_list.empty?\n\n @sorted_list\n end",
"def bubble_print_sort\n @bubble.print_sort\n end",
"def sean_sort(numbers)\n\n\nend",
"def sortable_sort\n @sortable_sort\n end",
"def e5115_sublinear_sort(values)\n end",
"def sortwords(words\n return words.sort\nend",
"def sort arr\r\n\trec_sort arr, []\r\nend",
"def orderly(array)\n p array.sort\nend",
"def sort(*args, &blk)\n self.dup{ @contents = @contents.sort(*args, &blk) }\n end",
"def using_sort(array)\n sorted_array=array.sort\nend",
"def sort\r\n @roster.each do |key, value|\r\n value.sort!\r\n end\r\n end",
"def my_array_sorting_method(source)\n p source.sort {|x,y| x.to_s <=> y.to_s}\nend",
"def sort\[email protected] do |key,value|\n value.sort!\nend \nend",
"def my_array_sorting_method(source)\n puts source.map{|x| x.to_s}.sort \n\n #return source.sort_by{|x| x.to_s} => see comment A below regarding this line\nend",
"def sort some_array # This \"wraps\" rec_sort so you don't have to pass rec_sort an empty array each iteration \n rec_sort some_array, []\nend",
"def sort(block)\n @content.sort(block)\n end",
"def sort(versions)\n self::usort(versions, self::SORT_ASC)\n end",
"def dub_sort(arr)\nend",
"def bubble_sort(&prc)\n prc ||= Proc.new{ |ele1, ele2| ele1 <=> ele2 }\n\n sorted = false\n while !sorted\n sorted = true\n # check every pair in array and sort it if necessary \n (0...self.length - 1).each do |i|\n # if prc.call == 1: sort incr; prc.call == -1: sort decr \n if prc.call(self[i], self[i+1]) == 1\n self[i], self[i+1] = self[i+1], self[i]\n sorted = false\n end\n end\n end\n\n self\n end",
"def sorted_by_age(people)\nend",
"def sort!\n @tabs.sort! { |x,y| x.text <=> y.text }\n end",
"def bubble_sort(&prc)\n sorted = true\n if prc == nil #sort by increasing order probably numbers\n while sorted\n sorted = false\n self.each_with_index do |ele,idx|\n if (self[idx+1] !=nil) && (self[idx] > self[idx+1])\n self[idx] , self[idx+1] = self[idx+1] , self[idx]\n sorted = true\n end\n end\n end\n else\n while sorted\n sorted= false\n self.each_with_index do |ele,idx|\n if (self[idx+1] !=nil) && prc.call(self[idx],self[idx+1]) == 1\n self[idx] , self[idx+1] = self[idx+1] , self[idx]\n sorted = true\n end\n end\n end\n end\n self\n end",
"def rec_sort unsorted, sorted \n\tif unsorted.length <= 0\n\n# sorted is an array\n\treturn sorted \n\tend\n\n# So if we got here, then it means we still have work to do.\n# take last one out of unsorted, call it smallest\nsmallest = unsorted.pop\n#create en empty 'still unsorted' array \nstill_unsorted = []\n\n#testing if each object in unsorted is smaller than 'smallest' \n\tunsorted.each do |tested_object| \n\t#if tested object is smaller than smallest then push them in still unsorted\n\t\tif tested_object.downcase < smallest.downcase\n\t\t\tstill_unsorted.push smallest\n\t\t\tsmallest = tested_object\n\t\telse\n\t\t\tstill_unsorted.push tested_object\n\t\tend \n\tend\n# Now \"smallest\" really does point to the\n# smallest element that \"unsorted\" contained,\n# and all the rest of it is in \"still_unsorted\". \nsorted.push smallest\n\nrec_sort still_unsorted, sorted\nend",
"def my_array_sorting_method(source)\n p source.sort_by { |a| a.to_s }\nend",
"def sort arr \n\trec_sort arr, []\nend",
"def patched_bogo_sort!\n return self if empty?\n\n bogo_private\n end",
"def my_array_sorting_method(source)\n source.sort { |a, b| a.to_s <=> b.to_s } \nend",
"def sort!\n @que.sort! do |a,b|\n case @cmp.call(a,b)\n when 0, nil then 0\n when 1, true then 1\n when -1, false then -1\n else\n warn \"bad comparison procedure in #{self.inspect}\"\n 0\n end\n end\n self\n end",
"def sort\n self.roster.each do |grade, students|\n students.sort!\n end\n self.roster\n end",
"def my_array_sorting_method(array, number)\n\nend",
"def sort(objects)\n objects.sort_by {|x| x.to_s }\nend",
"def sort(objects)\n objects.sort_by {|x| x.to_s }\nend",
"def sort!\n\t\tquick!(self, 1, length)\n\tend",
"def test_sort_proc\n ct = []\n @@conn.search( @@naming_context, LDAP::LDAP_SCOPE_ONELEVEL,\n '(objectClass=*)', [ 'createTimestamp' ] ) do |x|\n ct << x['createTimestamp']\n end\n ct.flatten!\n\n sorted_ct = []\n s_proc = proc { |a,b| b <=> a }\n @@conn.search( @@naming_context, LDAP::LDAP_SCOPE_ONELEVEL,\n '(objectClass=*)', [ 'createTimestamp' ], nil, 0, 0,\n 'createTimestamp', s_proc ) do |x|\n sorted_ct << x['createTimestamp']\n end\n sorted_ct.flatten!\n\n assert_not_equal( ct, sorted_ct )\n assert_equal( ct.sort( &s_proc ), sorted_ct )\n end",
"def my_array_sorting_method(source)\n source.sort_by { |element|\n element.to_s\n }\nend",
"def bubble_sort(&prc)\n prc ||= Proc.new { |a, b| a <=> b }\n sorted = false \n while !sorted \n sorted = true \n (0...self.length-1).each do |i|\n if prc.call(self[i], self[i+1]) == 1\n self[i], self[i+1] = self[i+1], self[i]\n sorted = false \n end \n end \n end \n self \n end",
"def gnomesort(a)\n a.start_logging\n\n i = 0\n while i < a.length\n if i == 0 || a[i] > a[i - 1]\n i += 1\n else\n a[i], a[i - 1] = a[i - 1], a[i]\n a.log\n i -= 1\n end\n end\n\n a\nend",
"def sort\n @sort ||= Vidibus::Words.sort_by_occurrence(list)\n end"
] | [
"0.7760054",
"0.7525783",
"0.7390166",
"0.7366337",
"0.7306448",
"0.72786736",
"0.719479",
"0.71871525",
"0.7109617",
"0.7104191",
"0.7056097",
"0.70484453",
"0.70437247",
"0.70437247",
"0.69962436",
"0.6992695",
"0.6980701",
"0.6948855",
"0.6933568",
"0.6928496",
"0.69251096",
"0.69057137",
"0.6902572",
"0.6899873",
"0.6893063",
"0.6888056",
"0.6888056",
"0.68784666",
"0.68784666",
"0.6877633",
"0.6841858",
"0.6841858",
"0.6841858",
"0.6841858",
"0.6841858",
"0.6841858",
"0.6841858",
"0.6837095",
"0.68341374",
"0.68341374",
"0.68292266",
"0.68143207",
"0.68143207",
"0.68143207",
"0.68124366",
"0.681136",
"0.6806175",
"0.677541",
"0.67682165",
"0.67626166",
"0.6751808",
"0.67464805",
"0.6713109",
"0.6708805",
"0.67019343",
"0.6700989",
"0.66968733",
"0.66968733",
"0.6685032",
"0.6678561",
"0.66754997",
"0.6674661",
"0.6669885",
"0.6668027",
"0.66619354",
"0.66613454",
"0.6656741",
"0.6653334",
"0.66520476",
"0.66510487",
"0.66391766",
"0.6635527",
"0.66307884",
"0.6629007",
"0.66261566",
"0.66238356",
"0.6617324",
"0.6605102",
"0.66037256",
"0.66031754",
"0.6594566",
"0.6594273",
"0.6582253",
"0.6580107",
"0.65687746",
"0.6561481",
"0.6559939",
"0.65598756",
"0.655808",
"0.6547358",
"0.6542177",
"0.65389925",
"0.6537731",
"0.6536977",
"0.6536977",
"0.6533565",
"0.6533205",
"0.6527448",
"0.6526847",
"0.6526565",
"0.6525089"
] | 0.0 | -1 |
Adds query string if a link has a schema property and method is GET | def query_string
if method == "GET" && !request_parameters.empty?
"?#{request_parameters.to_query}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_params\n CGI::parse(URI.parse(self['href']).query)\n end",
"def add_href\n return if attributes.key?(\"href\")\n return unless attributes.key?(\"id\")\n attributes[\"href\"] = client.connection.api_path(\"#{collection.name}/#{attributes['id']}\")\n end",
"def query_params\n ref_path = request.path_info;\n ref_query = URI.decode(request.query_string)\n query_options = ref_query.split('&').select{|r| !r.blank?}\n res = []\n query_path = []\n \n query_options[0..-2].each do |qo|\n qo.match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n found = false\n res << link_to(\"#{attribute.humanize}: #{condition}\", ref_path+\"?\"+query_path.join(\"&\"))\n query_path << qo\n \n end\n \n query_options[-1].match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n res << \"#{attribute.humanize}: #{condition}\"\n \n return res.join(' > ')\n end",
"def href(options = {})\n \"https://#{HREF_BASE_URL}/?\" + href_options(options[:directions]).to_query\n end",
"def skip_query_string?(link)\n @opts[:skip_query_strings] && link.query\n end",
"def skip_query_string?(link)\n @opts[:skip_query_strings] && link.query\n end",
"def query_params\n ref_path = request.path_info;\n ref_query = URI.decode(request.query_string)\n query_options = ref_query.split('&').select{|r| !r.blank?}\n res = []\n query_path = []\n\n query_options[0..-2].each do |qo|\n qo.match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n found = false\n res << link_to(\"#{attribute.humanize}: #{condition}\", ref_path+\"?\"+query_path.join(\"&\"))\n query_path << qo\n\n end\n\n query_options[-1].match(/q\\[(\\w+)\\]\\[\\]=(.+)/)\n attribute = $1\n condition = $2\n res << \"#{attribute.humanize}: #{condition}\"\n\n return res.join(' > ')\n end",
"def manipulate_url(options = {})\n params_to_remove = options[:remove_query_param]\n page = options[:page]\n l_d_exp = options[:l_d_exp]\n me_d_exp = options[:me_d_exp]\n escape = options[:escape]\n path = options[:path] || request.path\n query_params = request.query_parameters.deep_dup\n if params_to_remove && query_params.present?\n params_to_remove.each do |param|\n query_params.delete(param.to_s)\n end\n end\n query_params[:page] = page if page\n query_params[:lessons_expanded] = l_d_exp if l_d_exp\n query_params[:media_elements_expanded] = me_d_exp if me_d_exp\n query_string = get_recursive_array_from_params(query_params).join('&')\n return path if query_string.blank?\n url = \"#{path}?#{query_string}\"\n url = URI.escape(url)\n escape ? CGI.escape(url) : url\n end",
"def skip_query_string?(link)\n @opts[:skip_query_strings] && link.query\n end",
"def skip_query_string?(link)\n @opts[:skip_query_strings] && link.query\n end",
"def shorten_link\n \t\tinput_link = params[:link][:given_link]\n \t\trender json: shorten_my_link(input_link)\n \tend",
"def current_request_url_with_merged_query_params(params)\n request_url = URI::parse(request.url)\n link_query_params = URI::decode_www_form(request_url.query || '').to_h.merge(params.stringify_keys)\n link_url = request_url.dup\n link_url.query = URI::encode_www_form(link_query_params)\n link_url.to_s\n end",
"def custom_get_request_with_params?\n request.method =~ /get/i && !%w(index show).include?(params[:action]) && !params.nil?\n end",
"def link_params\n params[:link]\n end",
"def check_is_add_link_request\n if params[:add_link]\n link_text = \" link(#{t(:visible_text)}, #{t(:invisible_url)}) \"\n p = Paragraph.find(params[:add_link].keys.first)\n p.update_attributes({title: p.get_title, body: p.get_body + link_text})\n end\n end",
"def method\n link_schema['method'].downcase.to_sym\n end",
"def get\n @options[:ajax] ? ajax_get : anchor # standard_get\n end",
"def construct_link_header(updated_query_parameters)\n query_string = '?'\n\n # Construct query string with updated_query_parameters.\n request.query_parameters.merge(updated_query_parameters).each { |x, y| query_string += \"#{x}=#{y}&\" }\n url = url_for(only_path: false) + query_string.chop # concatenate url & chopped query string\n \"<#{url}>; rel=\\\"next\\\"\"\n end",
"def query_path\n @attributes[:query_path]\n end",
"def query_string\n end",
"def get(href, additional_parameters = \"\")\n rest_connect do |base_uri,headers|\n href = \"#{base_uri}/#{href}\" unless begins_with_slash(href)\n params = requestify(additional_parameters) || \"\"\n new_path = URI.escape(href + @settings[:extension] + \"?\") + params\n Net::HTTP::Get.new(new_path, headers)\n end\n end",
"def get\n request_object.get_query\n end",
"def transform(link)\n link = Filters::Util.make_URI(link)\n return link unless (link != nil && link.query != nil)\n link.query = nil\n link\n end",
"def url\n endpoint+'?'+query_string\n end",
"def getter_url\n\t self.class.resource_url + @id.to_s + '?' + self.class.getter_include.to_s\n end",
"def url_for_params( options = {} )\n new_params = request.POST.merge( request.GET ).merge( options )\n if without = new_params.delete(:without)\n without = [without] unless without.is_a?(Array)\n without.map!(&:to_s)\n new_params = new_params.reject {|k,v| without.include?(k) }\n end\n url_for( new_params )\n end",
"def parameters\n resolve_parameters(link_schema['href'].scan(PARAMETER_REGEX))\n end",
"def query_string\n nil\n end",
"def url_with_query_string\n if query_string && query_string.size > 0\n base_url + \"?#{query_string}\"\n else\n base_url\n end\n end",
"def generate_link(params)\n q = params.reduce([]) do |m,(k,v)|\n if v.is_a?(Hash)\n m + v.reduce([]) do |mm,(kk,vv)|\n mm + [ \"#{k}[#{kk}]=#{URI.escape(vv.to_s)}\" ]\n end\n else\n m + [ \"#{k}=#{URI.escape(v.to_s)}\" ]\n end\n end\n\n q.empty? ?\n @request.uri :\n \"#{@request.uri}?#{q.join('&')}\"\n end",
"def streamlined_auto_discovery_link_tag()\n return if @syndication_type.nil? || @syndication_actions.nil?\n \n if @syndication_actions.include? params[:action]\n \"<link rel=\\\"alternate\\\" type=\\\"application/#{@syndication_type.downcase}+xml\\\" title=\\\"#{@syndication_type.upcase}\\\" href=\\\"#{params[:action]}/xml\\\" />\"\n end\n end",
"def url_query_string(leading_slash = true)\n (leading_slash ? \"/?\" : \"?\") << URI.escape(self.collect{|k,v| \"#{k}=#{v}\"}.join('&'))\n end",
"def links\n return nil unless @item and self.type == :query and @item['entry']['link']\n @item['entry']['link']\n end",
"def url_with_params\n url + \"/?\" + URI.encode_www_form(@options[:request_params])\n end",
"def modify_url(request, path)\n url = \"#{request.base_url}#{path}\"\n url += \"?#{request.query_string}\" unless request.query_string.empty? \n url\n end",
"def GET; end",
"def path_with_query\n uri = URI.parse(page.current_url)\n [uri.path, uri.query].map{|s| s if s.present? }.compact.join('?')\n end",
"def url_options\n [ filter_url, columns_url, order_url, column_count_url].compact.join('/')\n end",
"def url_options; end",
"def add_link_header(query_parameters)\n response.headers['Link'] = construct_link_header(query_parameters)\n end",
"def link_with_preserved_display_settings(**)\n \"#{request.path}?#{current_display_settings_query_string(**)}\"\n end",
"def link_params\n if json_request?\n params.permit(:source_link)\n else\n params.require(:link).permit(:source_link, :key)\n end\n end",
"def get_link(link,args={})\n link = BASE_URL + link\n get_request(link,args)\n end",
"def rewrite_query(path)\n options[:body] ? \"#{path}?body=1\" : path\n end",
"def link_to_query(query)\n p = params.except(:page, :action)\n p[:q]=query\n link_url = search_action_path(p)\n link_to(query, link_url)\n end",
"def enable_get\n add option: \"-get=true\"\n end",
"def http_method\n :get\n end",
"def request_path(*args)\n if has_attribute? :uri then uri else super end\n end",
"def streamlined_auto_discovery_link_tag\n # return if @syndication_type.nil? || @syndication_actions.nil?\n # \n # if @syndication_actions.include? params[:action]\n # \"<link rel=\\\"alternate\\\" type=\\\"application/#{@syndication_type.downcase}+xml\\\" title=\\\"#{@syndication_type.upcase}\\\" href=\\\"#{params[:action]}/xml\\\" />\"\n # end\n end",
"def add_uri_to_options(options)\n if @object\n options[:predicate] = @and_predicate && @and_predicate[:uri]\n options[:object_term] = @and_object ?\n [@term[:uri], @and_object[:uri]] :\n @term[:uri]\n else\n options[:predicate] = @and_predicate ?\n [@term[:uri], @and_predicate[:uri]] :\n @term[:uri]\n options[:object_term] = @and_object && @and_object[:uri]\n end\n end",
"def link_to_query(query)\n p = params.dup\n p.delete :page\n p.delete :action\n p[:q]=query\n link_url = catalog_index_path(p)\n link_to(query, link_url)\n end",
"def custom_query(options)\n form_data = {}\n options.each {|k,v| form_data[k.to_s] = v.to_s }\n form_data['action'] = 'query'\n make_api_request(form_data).first.elements['query']\n end",
"def decorate_path path, options={}\n assert_query path, redirect_params( options )\n end",
"def get?\r\nHTTP_METHOD_LOOKUP[request_method] == :get\r\nend",
"def method\n options[:method] || :get\n end",
"def get_url\n \"http://#{self.domain}/#{self.path}#{self.params.it_keys_to_get_param}\"\n end",
"def to_query\n query = @uri.query\n query ? Wgit::Url.new(query) : nil\n end",
"def similar_list_page options_changed\n param_hash_to_link_hash params.merge( options_changed )\n end",
"def uri\n \"#{query_uri}?#{query_options.to_query}\"\n end",
"def omit_query\n query = to_query\n omit_query_string = query ? gsub(\"?#{query}\", '') : self\n\n Wgit::Url.new(omit_query_string)\n end",
"def is_query? ; !metadata[:ref] ; end",
"def query_options; end",
"def [](value)\n if value == :links\n return false\n end\n\n super\n end",
"def amend origin_url\n origin_url.sub! /^\"?([^\"]*)\"?/, '\\\\1' # Remove any enclosing quotes\n query_str = (match = origin_url.match /^[^?]*\\?(.*)/ ) ? match[1] : \"\"\n query_params = query_str.empty? ? {} : Hash[ CGI.parse(query_str).map { |elmt| [elmt.first.to_sym, elmt.last.first] } ]\n # Format refers to how to present the content: within a dialog, or on a page\n @mode = query_params[:mode]\n end",
"def get_full_url(req_params)\n full_url=self.url\n\n if self.input_params.size>0\n full_url+=\"?\"\n\n self.input_params.each do |param|\n #puts \"name:\"+param.name+\"->value:\"+param.value\n if req_params.has_key? param.name #this was a dynamic param -> overwrite\n value=req_params[param.name]\n else\n value=param.value\n end\n\n full_url+=encode(param.name)+\"=\"+encode(value)+\"&\"\n end\n full_url=full_url[0..-2] #remove last &\n end\n\n return full_url\n end",
"def onliner_url\n @url ||= (CONSTANT_URL + @options.to_query)\n end",
"def query_parameters\n request.GET\n end",
"def to_query_string\n query = @uri.query\n query ? Wgit::Url.new(\"?#{query}\") : nil\n end",
"def qs\n if @r && @r['QUERY_STRING'] && !@r['QUERY_STRING'].empty?\n '?' + @r['QUERY_STRING']\n elsif query && !query.empty?\n '?' + query\n else\n ''\n end\n end",
"def bundle_search_link_url(search_params, resource_type, target_page)\n param_str = ''\n index = 0\n search_params.each do |option, search|\n param_str += \"#{index.zero? ? '?' : '&'}#{option}=#{search}\"\n index += 1\n end\n param_str += \"#{index.zero? ? '?' : '&'}page=#{target_page}\"\n \"#{root_url}fhir/r4/#{resource_type}#{param_str}\"\n end",
"def _url path = request.path, options = {}\n\t\tstr = path\n\t\tunless options.empty?\n\t\t\tstr += '?'\n\t\t\toptions.each do | k, v |\n\t\t\t\tstr = str + k.to_s + '=' + v.to_s + '&'\n\t\t\tend\n\t\tend\n\t\tstr\n\tend",
"def request_attributes(opts = {})\n { resource: self, uri: link, params: {} }.merge(opts)\n end",
"def url path, query={}, server=graph_server, opts={}\n \"#{server}#{path}#{build_query_string(query, opts)}\"\n end",
"def link\n @link ||= uri.to_s\n end",
"def display_link_attributes(link)\n # Interface method\n end",
"def request_method\n {:filter => :post,\n :sample => :get,\n :firehose => :get,\n :retweet => :get\n }.fetch(@path, :get)\n end",
"def query_params; end",
"def request_get?\n request.get?\n end",
"def url_field(object_name, method, options = T.unsafe(nil)); end",
"def active_link_with_query(text = nil, path = nil, **opts, &block)\n link = block ? text : path # because positional\n content = block ? capture(&block) : text\n\n active_link_to(add_query_param(link), **opts) { content }\n end",
"def generate_next_url\n if eds_session.has_key? :query_string\n url = HTMLEntities.new.decode eds_session[:query_string]\n\n #blacklight expects the search term to be in the parameter 'q'.\n #q is moved back to 'query-1' in 'generate_api_query'\n #should probably pull from Info method to determine replacement strings\n #i could turn the query into a Hash, but available functions to do so delete duplicated params (Addressable)\n url.gsub!(\"query-1=AND,TI:\", \"q=\")\n url.gsub!(\"query-1=AND,AU:\", \"q=\")\n url.gsub!(\"query-1=AND,SU:\", \"q=\")\n url.gsub!(\"query-1=AND,\", \"q=\")\n\n #Rails framework doesn't allow repeated params. turning these into arrays fixes it.\n url.gsub!(\"facetfilter=\", \"facetfilter[]=\")\n url.gsub!(\"limiter=\", \"limiter[]=\")\n\n #i should probably pull this from the query, not the URL\n if (params[:search_field]).present?\n url << \"&search_field=\" << params[:search_field].to_s\n end\n return url\n else\n return ''\n end\n end",
"def links\n json_hyperschema[\"links\"] || []\n end",
"def link(param)\n if param.is_a? String\n param\n else\n \"#{Starwars::Base::BASE_URL}/#{const_get('RESOURCE_NAME')}/#{param}/\"\n end\n end",
"def test_parameters_without_parameters\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n link = schema.resource('resource').link('list')\n assert_equal([], link.parameters)\n end",
"def api_url_method\n if params[:public_api_request]\n method(:content_item_api_url)\n else\n method(:content_item_url)\n end\n end",
"def test_format_path_with_path_and_body\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n link = schema.resource('resource').link('update')\n assert_equal(['/resource/44724831-bf66-4bc2-865f-e2c4c2b14c78',\n {'new' => 'resource'}],\n link.format_path(['44724831-bf66-4bc2-865f-e2c4c2b14c78',\n {'new' => 'resource'}]))\n end",
"def edit_link\n _link = self[\"link\"].find { |l| l.rel == \"edit\" }\n _link ? _link.href : nil\n end",
"def edit_link\n _link = self[\"link\"].find { |l| l.rel == \"edit\" }\n _link ? _link.href : nil\n end",
"def link\n @link\n end",
"def options_to_url_params # :nodoc:\n params = DEFAULT_OPTIONS.keys.map(&:to_s).sort.inject([]) do |params, attr|\n primary_getter = \"#{attr}_to_be_used_in_param\"\n secondary_getter = attr\n\n value = send(primary_getter) rescue send(secondary_getter)\n params << \"#{attr}:#{URI::DEFAULT_PARSER.escape(value.to_s)}\" unless value.nil?\n params\n end\n\n params.join('|')\n end",
"def show\n \t\tshort_url = 'http://localhost:3000/'+params[:shortened_link]\n \t\turl = Link.find_by(shortened_link: short_url)\n \t\tif url\n \t\t\toriginal_url = url.given_link\n \t\t\tredirect_to \"#{original_url}\"\n \t\telse\n \t\t\trender json: \"Not found\"\n \t\tend\n \tend",
"def href; end",
"def link_to_document_query(doc, options={:label=>Blacklight.config[:index][:show_link].to_sym})\n label = case options[:label]\n when Symbol\n doc.get(options[:label])\n when String\n options[:label]\n else\n raise 'Invalid label argument'\n end \n if params[:f].nil? or params[:f]['worknum_s'].nil? \n link_to_unless(options[:suppress_link], label, add_facet_params_and_redirect(\"worknum_s\", doc[\"id\"])) \n else\n doc[\"worktitle_display\"]\n end\n end",
"def update\n update_and_respond(@link, link_params)\n end",
"def request_uri\n return nil if absolute? && scheme !~ /^https?$/\n res = path.to_s.empty? ? \"/\" : path\n res += \"?#{self.query}\" if self.query\n return res\n end",
"def test_parameter_details_without_parameters\n schema = Heroics::Schema.new(SAMPLE_SCHEMA)\n link = schema.resource('resource').link('list')\n assert_equal([], link.parameter_details)\n end",
"def get_querystring\n request_object.querystring\n end",
"def fix_custom_request_options(object)\n return unless custom_get_request_with_params?\n action = object.respond_to?(:to_ary) ? 'index' : 'show'\n @request.send(\"setup_#{action}_action\", params)\n end",
"def uri_with_authentication\t\t\t\n\t\turi = base_uri.to_s + \"?\" + query_string\n\t\tmethod_hack = \"&_method=\" + @method \n\t\t# some clients (such as flash, and explorer) have an issue with PUT and delete methods. \n\t\t# method_hack insures that the right method gets through.\n\t\tURI.parse( uri + method_hack )\n\tend",
"def request_uri\n return unless @path\n\n url = @query ? \"#@path?#@query\" : @path.dup\n url.start_with?(?/.freeze) ? url : ?/ + url\n end"
] | [
"0.58647037",
"0.5649685",
"0.55826855",
"0.55436486",
"0.5525937",
"0.5525937",
"0.5506832",
"0.5469202",
"0.54567957",
"0.54567957",
"0.5449152",
"0.5438172",
"0.5403801",
"0.54030675",
"0.5379981",
"0.53741306",
"0.5366104",
"0.536471",
"0.5351713",
"0.53465235",
"0.5330518",
"0.53050834",
"0.52936196",
"0.5275619",
"0.52731323",
"0.5257473",
"0.5226294",
"0.5206962",
"0.51802784",
"0.51760244",
"0.51542306",
"0.5153317",
"0.515088",
"0.5149788",
"0.51467955",
"0.5145591",
"0.5116209",
"0.51100576",
"0.5105048",
"0.5103974",
"0.5103243",
"0.5100795",
"0.509366",
"0.5082331",
"0.50796175",
"0.50784147",
"0.5074395",
"0.5060832",
"0.503939",
"0.503686",
"0.50273365",
"0.50207305",
"0.5020188",
"0.50054544",
"0.49980333",
"0.49932808",
"0.49851465",
"0.498333",
"0.49830905",
"0.49816066",
"0.49809128",
"0.4979495",
"0.4976724",
"0.49766612",
"0.4974254",
"0.49705216",
"0.49693504",
"0.49674064",
"0.49645495",
"0.49582085",
"0.49551123",
"0.49536783",
"0.49528477",
"0.4942839",
"0.49414584",
"0.4929438",
"0.4924783",
"0.49177015",
"0.49086663",
"0.49064553",
"0.49063495",
"0.49030137",
"0.48957846",
"0.4887153",
"0.48866674",
"0.4862681",
"0.48554814",
"0.48554814",
"0.4854438",
"0.48524377",
"0.48485342",
"0.48474553",
"0.484422",
"0.48366356",
"0.483398",
"0.48325422",
"0.48304078",
"0.48176268",
"0.48139864",
"0.48127872"
] | 0.53904843 | 14 |
We have a policy that we should not return response body to PUT and DELETE requests. | def has_response_body?
@raw_link.media_type != "null"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_policy\n json_response({ message: I18n.t('authenticate.forbidden_access') }, :forbidden)\n end",
"def forbidden\n respond_with 403\n end",
"def forbidden\n respond_with 403\n end",
"def skip_authorization; end",
"def without_access_control\n previous_state = Authorization.ignore_access_control\n Authorization.ignore_access_control(true)\n result = yield\n ensure\n Authorization.ignore_access_control(previous_state)\n result\n end",
"def filter_response(response, request)\n # nothing to do\n end",
"def deny_access\n respond_to do |format|\n format.json {\n # Some schools of thought advocate the use of 404 (:not_found). See\n # http://www.bennadel.com/blog/2400-handling-forbidden-restful-requests-401-vs-403-vs-404.htm\n render json: {}, status: :unauthorized\n }\n end\n end",
"def status_forbidden\n respond_to do |format|\n format.any { head :forbidden }\n end\n end",
"def forbidden\n head :forbidden\n end",
"def forbidden_response(env)\n if head_request?(env)\n [ 403, { \"content-type\" => \"text/plain\", \"content-length\" => \"0\" }, [] ]\n else\n [ 403, { \"content-type\" => \"text/plain\", \"content-length\" => \"9\" }, [ \"Forbidden\" ] ]\n end\n end",
"def skip_policy_scope; end",
"def skip_authorization\n @_authorization_performed = true\n end",
"def render_forbidden(obj)\n render json: nil_protection(obj), status: :forbidden\n end",
"def unauthorized_response\n respond_to do |format|\n format.json { render json: {error: 'admin_required'}, status: :unauthorized }\n format.any { head :unauthorized }\n end\n end",
"def render_unauthorized(obj)\n render json: nil_protection(obj), status: :unauthorized\n end",
"def response_for_nonget(request, resource_location, response_body)\n if request.url_format || (request.method == :delete && request.headers[\"Accept\"])\n headers = { \"Location\" => resource_location }\n headers.merge!(\"Content-Type\" => MIMETYPES_BY_FORMAT[request.response_format]) if request.method != :delete\n { :body => response_body,\n :status => (request.method == :post) ? 201 : 204,\n :headers => headers\n }\n else\n { :body => body_for_redirect(resource_location),\n :status => 302,\n :headers => { \"Location\" => resource_location }\n }\n end\n end",
"def unauthorized_request(e)\n render json: jsonData(e), status: :unauthorized\n end",
"def unauthorized\n render_json error: 'Access Not Authorized', status: :forbidden\n end",
"def method_not_allowed(verbs)\n res = response\n res.status = 405\n res[RodaResponseHeaders::ALLOW] = verbs\n nil\n end",
"def policy; end",
"def unauthorized_request(e)\n json_response({ message: e.message }, :unauthorized)\nend",
"def not_modified!\n body.close if body.respond_to?(:close)\n self.status = 304\n self.body = []\n NOT_MODIFIED_OMIT_HEADERS.each { |name| headers.delete(name) }\n nil\n end",
"def expect_forbidden_status\n is_expected.to respond_with 403\n end",
"def policy_class\n nil\n end",
"def unauthorized_entity(entity_name)\n render json: {error: 'Unauthorized request'}, status:\n :unauthorized\n end",
"def unauthorized_entity(entity_name)\n render json: { error: \"Unauthorized request\" }, status:\n :unauthorized\n end",
"def on_unauthorized_request\n if block_given? && !authorized?\n @response = yield\n end\n end",
"def skip_http_headers; end",
"def ignore_request_unless_permitted\n return if permitted?\n flash_notice(:permission_denied.t)\n redirect_to(action: \"index_article\") and return\n end",
"def deny_un_encrypted_inflight_operations_statement(\n bucket_name\n )\n {\n effect: 'Deny',\n principal: '*',\n action: 's3:*',\n resource: \"arn:aws:s3:::#{bucket_name}/*\",\n condition: {\n 'Bool' => {\n 'aws:SecureTransport' => 'false'\n }\n }\n }\n end",
"def content_security_policy_report_only; end",
"def content_security_policy_report_only; end",
"def unauthorized\n end",
"def response\n { nothing: true }\n end",
"def status_forbidden\n @status = 403\n end",
"def deny\n throw(:return)\n end",
"def forbidden(exception)\n # can improve these messages by simply adding to the translations bundle\n # see https://github.com/varvet/pundit#creating-custom-error-messages\n render json: {\n errors: [{\n code: JSONAPI::FORBIDDEN,\n detail: I18n.t(\n \"#{exception.policy.class.to_s.underscore}.#{exception.query}\", scope: 'pundit', default: :default\n ),\n sources: {\n pointer: '/data/forbidden'\n },\n status: JSONAPI::FORBIDDEN,\n title: 'Forbidden'\n }]\n }, status: :forbidden\n end",
"def forbidden!\n render_api_error!('403 Forbidden', 403)\n end",
"def filter_self\n if @user && !current_user.can_edit?(@user)\n respond_to do |format|\n format.html {\n render :nothing => true, :status => 403\n }\n format.json {\n render :json => {:status => 'failure'}, :status => 403\n }\n end\n end\n end",
"def unauthorized_request(e)\n\t\tjson_response({ message: e.message }, :unauthorized)\n\tend",
"def api_behavior\n if post?\n display resource, :status => :created\n # render resource instead of 204 no content\n elsif put? || delete?\n display resource, :status => :ok\n else\n super\n end\n end",
"def unauthorized_request(e)\n json_response({ message: e.message }, :unauthorized)\n end",
"def unauthorized_request(e)\n json_response({ message: e.message }, :unauthorized)\n end",
"def api_only; end",
"def api_only; end",
"def api_only; end",
"def unauthorized\n head :unauthorized\n end",
"def unauthorized_entity(entity_name)\n render json: { error: \"Unauthorized request\" }, status: :unauthorized\n end",
"def require_authorization( message=\"You are not authorized to access this resource.\" )\n\t\tfinish_with( HTTP::FORBIDDEN, message )\n\tend",
"def policies; end",
"def unauthorized_entity(entity_name)\r\n render json: [\"You are unauthorized to access this.\"], status: :unauthorized\r\n end",
"def unauthorized_request(e)\n json_response({ message: e.message }, :unauthorized)\n end",
"def permission_denied\n respond_to do |format|\n format.html { render :template => \"shared/forbidden\", :status => :forbidden }\n format.any { head :forbidden }\n end\n end",
"def policy(resource)\n if authorization_enabled?\n super(resource)\n else\n Authorization::Policy.new(nil, nil, default: true)\n end\n end",
"def unauthenticated\n render_json status: :unauthorized\n end",
"def noop\n write_noop\n multi_response\n end",
"def not_authorized(response)\n NotAuthorized.new.tap { |exception| exception.response = response }\n end",
"def not_final\n @resp[:expectUserResponse] = true\n end",
"def negate(policy)\n clazz = Class.new(Walruz::Policy) do # :nodoc:\n extend PolicyCompositionHelper\n \n # :nodoc:\n def authorized?(actor, subject)\n result = self.class.policy.new.set_params(params).safe_authorized?(actor, subject)\n result[0] = !result[0]\n result\n end\n \n \n def self.policy_keyword # :nodoc:\n keyword = self.policy.policy_keyword.to_s[0..-2]\n :\"not(#{keyword})?\"\n end\n \n end\n clazz.policy = policy\n clazz\n end",
"def non_get_methods\n [:post, :put, :delete]\n end",
"def skip\n redirect_to claim_url(current_policy_routing_name, \"name\")\n end",
"def unauthorized_request(e)\n render json: { message: e.message }, status: :unauthorized\n end",
"def unauthorized_request(e)\n render json: { message: e.message }, status: :unauthorized\n end",
"def unauthorized_entity(entity_name)\n render json: { error: \"Unauthorized request\" }, status:\n :unauthorized\n end",
"def on_ignored_request\n end",
"def flush\n Puppet.debug(\"Calling flush method of security_policy_cloakingprovider: \")\n if @property_hash != {}\n login_instance = Login.new\n auth_header = login_instance.get_auth_header\n security_policy_cloaking_instance = SwaggerClient::SecurityPolicyCloakingApi.new\n policyName=@resource[:name]\n data,status_code,headers= security_policy_cloaking_instance.security_policies_policy_name_cloaking_put(auth_header,policyName,message(resource),{})\n Puppet.debug(\"WAF services PUT response: #{data}\")\n end\n return data\nend",
"def ignore_request(_team, _user)\n # stub\n end",
"def blocklisted_response; end",
"def deny_uploads_without_server_side_aws_kms_encryption?(s3_client, bucket_name)\r\n policy = {\r\n 'Version': '2012-10-17',\r\n 'Id': 'PutObjPolicy',\r\n 'Statement': [\r\n {\r\n 'Sid': 'DenyIncorrectEncryptionHeader',\r\n 'Effect': 'Deny',\r\n 'Principal': '*',\r\n 'Action': 's3:PutObject',\r\n 'Resource': 'arn:aws:s3:::' + bucket_name + '/*',\r\n 'Condition': {\r\n 'StringNotEquals': {\r\n 's3:x-amz-server-side-encryption': 'aws:kms'\r\n }\r\n }\r\n },\r\n {\r\n 'Sid': 'DenyUnEncryptedObjectUploads',\r\n 'Effect': 'Deny',\r\n 'Principal': '*',\r\n 'Action': 's3:PutObject',\r\n 'Resource': 'arn:aws:s3:::' + bucket_name + '/*',\r\n 'Condition': {\r\n 'Null': {\r\n 's3:x-amz-server-side-encryption': 'true'\r\n }\r\n }\r\n }\r\n ]\r\n }.to_json\r\n s3_client.put_bucket_policy(\r\n bucket: bucket_name,\r\n policy: policy\r\n )\r\n return true\r\nrescue StandardError => e\r\n puts \"Error adding policy: #{e.message}\"\r\n return false\r\nend",
"def policy_document\n return @policy if @policy\n \n ret = { \n expiration: 30.minutes.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z'),\n conditions: [ \n { bucket: ENV['S3_BUCKET'] },\n { acl: \"public-read\" },\n [\"starts-with\", \"$key\", \"#{@picture.user.email}/#{@picture.type}/\"],\n [\"starts-with\", \"$Content-Type\", \"\"],\n { success_action_status: '201' }\n ]\n }\n @policy = Base64.encode64(ret.to_json).gsub(/\\n|\\r/, '')\n end",
"def user_not_authorized\n respond_to do |format|\n format.json do\n render json: ErrorReport.generate( { id: [t(\"errors.messages.not_authorized\")] }, 403 ), status: :forbidden\n end\n end\n end",
"def unprotect()\n res = super(context,self)\n return res\n end",
"def restrict_access\n head :unauthorized and return false unless current_user\n end",
"def allow_client_to_handle_unauthorized_status\n headers.delete('WWW-Authenticate')\n end",
"def permission_denied\n # render :status => 403, :json => {:message => \"You don't have permission to do that.\"}\n end",
"def make_not_acceptable_body( response )\n\t\t# :TODO: Unless it was a HEAD request, the response SHOULD include\n\t\t# an entity containing a list of available entity characteristics and\n\t\t# location(s) from which the user or user agent can choose the one\n\t\t# most appropriate. The entity format is specified by the media type\n\t\t# given in the Content-Type header field. Depending upon the format\n\t\t# and the capabilities of the user agent, selection of the most\n\t\t# appropriate choice MAY be performed automatically. However, this\n\t\t# specification does not define any standard for such automatic\n\t\t# selection. [RFC2616]\n\t\treturn \"No way to respond given the requested acceptance criteria.\"\n\tend",
"def access_forbidden\n if [email protected]?\n send_response_document :forbidden\n else\n flash.keep\n authentication_needed!\n end\n end",
"def generate_policy\n {}\n end",
"def access_denied\n end",
"def response_body\n nil\n end",
"def error_403\n end",
"def deny_access\n respond_to do |format|\n format.html {\n flash[:alert] = 'You are not authorized to perform this action'\n\n redirect_to root_path\n }\n\n format.json {\n # Some schools of thought advocate the use of 404 (:not_found). See\n # http://www.bennadel.com/blog/2400-handling-forbidden-restful-requests-401-vs-403-vs-404.htm\n render json: {}, status: :unauthorized\n }\n end\n end",
"def conditional_requests; end",
"def conditional_requests; end",
"def respond_with_no_content\n render nothing: true, status: 204\n return false\n end",
"def deny_publish client, &block\n control_request(\"deny_publish\", client, &block)\n end",
"def handle_unverified_request; end",
"def handle_unverified_request; end",
"def always_deny(permission, properties = [])\n deny(permission, properties)\n end",
"def access_denied(body = nil)\n error 403, body\n end",
"def content_security_policy_report_only=(_arg0); end",
"def content_security_policy_report_only=(_arg0); end",
"def reject!(response_data={})\n @client.post(\"#{path}/reject\", response_data)\n end",
"def access_denied\n\n end",
"def whitelist\n if cannot_access_api?\n render json: [], status: :unauthorized\n end\n end",
"def response_ignored_variables\n Gatekeeper.configuration.response_ignored_variables | [\n :@marked_for_same_origin_verification, :@browser,\n :@behavior, :@options, :@args, :@shell, :@destination_stack ]\n end",
"def api_only=(_); end",
"def unauthorized\n render :json => \"You are not authorized for access.\", :status => :unauthorized\n end",
"def unauthorized_request\n Rails.logger.debug \"------ 'Unauthorized' response from resource server ------\"\n\n authorize_path = @organization.authorization_server.authorize_path(callback_url)\n Rails.logger.debug \"------ Redirecting to: #{authorize_path} ------\"\n redirect_to authorize_path\n end",
"def destroy\n render json: {}, status: :method_not_allowed\n end",
"def post(request, response)\n raise HTTPStatus::Forbidden\n end"
] | [
"0.660943",
"0.629914",
"0.6221209",
"0.6154061",
"0.6000024",
"0.5998815",
"0.5961199",
"0.5937003",
"0.5880941",
"0.58737653",
"0.58244115",
"0.5822505",
"0.5808664",
"0.5742009",
"0.57401615",
"0.57388943",
"0.5734784",
"0.57271534",
"0.57220745",
"0.5694782",
"0.569335",
"0.56862223",
"0.5681181",
"0.5674376",
"0.5661768",
"0.5635293",
"0.5626285",
"0.5622754",
"0.5613282",
"0.5611192",
"0.5605299",
"0.5605299",
"0.55831",
"0.55697227",
"0.55611145",
"0.555208",
"0.5548993",
"0.5548276",
"0.5537861",
"0.5534951",
"0.55337113",
"0.55192375",
"0.55192375",
"0.5517384",
"0.5517384",
"0.5517384",
"0.5506254",
"0.5500897",
"0.5496753",
"0.5494911",
"0.5493974",
"0.5487136",
"0.54782796",
"0.5478154",
"0.5477294",
"0.54727864",
"0.54703426",
"0.5468727",
"0.5465247",
"0.54576457",
"0.5446322",
"0.54438937",
"0.54438937",
"0.5440076",
"0.54387486",
"0.543503",
"0.54305744",
"0.54289705",
"0.5416735",
"0.54164374",
"0.5412641",
"0.5407737",
"0.5401566",
"0.5398973",
"0.53962874",
"0.5393497",
"0.5386151",
"0.537546",
"0.537437",
"0.5370759",
"0.5368451",
"0.5362936",
"0.53609604",
"0.53609604",
"0.5357605",
"0.5355868",
"0.535392",
"0.535392",
"0.5334977",
"0.53295493",
"0.53207314",
"0.53207314",
"0.5319041",
"0.531872",
"0.53073",
"0.5306088",
"0.5305572",
"0.5293919",
"0.52931523",
"0.5288768",
"0.5286212"
] | 0.0 | -1 |
Listens to an input | def listen(klass, *args)
supervise klass, name, handlers, *args
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listen_for_input\n @log.info \"start listening\"\n while true\n line = @client.gets.chop\n break if !line\n \n msg = JSON.parse(line, :create_additions => true)\n\n case msg.type.to_sym\n when :update_direction\n @lastInput = msg.msg.to_sym\n end\n end\n end",
"def drb_input!\n Vedeu.bind(:_drb_input_) do |data, type|\n Vedeu.log(type: :drb, message: \"Sending input (#{type})\")\n\n case type\n when :command then Vedeu.trigger(:_command_, data)\n when :keypress then Vedeu.trigger(:_keypress_, data)\n else Vedeu.trigger(:_keypress_, data)\n end\n end\n end",
"def input_listener\n print \"'Ctrl-C' to quit...\\n\"\n while true do\n input = gets.chomp.to_s.downcase\n if ['v','version'].include?(input)\n puts \"Netservate #{@version}\"\n else\n puts \"\\nNot a valid input.\"\n end\n end\n end",
"def input_handler\n STDIN.read.split(\"\\n\").each do |line|\n process_line(line)\n end\n end",
"def register_input_callbacks( io=$stdin )\n\t\tself.on_byte_input( &io.method(:read) )\n\t\tself.on_line_input( &io.method(:gets) )\n\tend",
"def send_input(input)\n EM.connect('127.0.0.1', RightScale::CommandConstants::SOCKET_PORT, OutputHandler, input)\n end",
"def read_input\n end",
"def handle_input(*input)\n while ch = next_ch(input)\n quit = QUIT_CONTROLS.include?(ch)\n enter = ENTER_CONTROLS.include?(ch)\n inc = INC_CONTROLS.include?(ch)\n dec = DEC_CONTROLS.include?(ch)\n\n break if shutdown? ||\n (quit && (!enter || quit_on_enter?))\n\n if enter\n on_enter\n\n elsif inc\n on_inc\n\n elsif dec\n on_dec\n end\n\n if key_bound?(ch)\n invoke_key_bindings(ch)\n end\n\n on_key(ch)\n end\n\n ch\n end",
"def input; end",
"def input; end",
"def input; end",
"def handle_input key_value\n\n @key_value = key_value.to_sym\n changed\n notify_observers self\n\n end",
"def run_input_thread; end",
"def input; @input; end",
"def input; @input; end",
"def receive_input\n STDIN.gets.strip\n end",
"def on_line_input( &callback )\n\t\traise LocalJumpError, \"no block given\" unless callback\n\t\tself.line_input_callback = callback\n\tend",
"def read_input; end",
"def handle_input(input)\n return \"Invalid input\" unless self.respond_to? input\n self.send input\n end",
"def on_byte_input( &callback )\n\t\traise LocalJumpError, \"no block given\" unless callback\n\t\tself.byte_input_callback = callback\n\tend",
"def input(inputItem)\n @input = inputItem\n end",
"def input_events\n raise NotImplementedError\n end",
"def listen\n # if the user resizes the screen we redraw it to fit the new dimensions\n Console.set_console_resized_hook! do\n draw\n end\n\n # create an interaction object to handle user input\n interaction = Interaction.new\n\n # call draw here because interaction blocks until it gets input\n draw\n\n # loop over user input (individual keypresses)\n interaction.loop do |key|\n @last_key = key\n if key == \"q\" then\n interaction.quit!\n end\n draw\n end\n end",
"def handle(input)\n search(input)\n end",
"def run\n input_listener_thread = Thread.new{input_listener();}\n main_thread = Thread.new{main();}\n input_listener_thread.join\n main_thread.join\n end",
"def execute(input: $stdin, output: $stdout)\n heading 'Only press [a,s,d,f or x]'\n\n reader = TTY::Reader.new\n\n exiting = false\n\n reader.on(:keypress) do |event|\n prompt.say event.value if event.value == 'a'\n prompt.warn event.value if event.value == 's'\n prompt.error event.value if event.value == 'd'\n prompt.ok event.value if event.value == 'f'\n\n if event.value == 'x'\n prompt.warn 'e[x]iting....'\n exiting = true\n end\n end\n\n until exiting do reader.read_keypress end\n\n heading 'Press any key or ^x or Esc to exit'\n\n reader = TTY::Reader.new\n\n exiting = false\n\n reader.on(:keypress) do |event|\n puts event.value\n end\n reader.on(:keyctrl_x, :keyescape) do\n prompt.warn 'e[x]iting....'\n exiting = true\n end\n\n until exiting do reader.read_keypress end\n\n :gui\n end",
"def update_input\n @inputs.each {|i|\n # else if not succeeded\n if !i[3]\n # decrease counter\n i[2] -= 1 if i[2] > 0\n # initialize success\n i[3] = true\n i[0].each {|k|\n # check for success based on trigger type\n case i[1]\n when INPress then i[3] = i[3] && Input.press?(k)\n when INTrigger then i[3] = i[3] && Input.trigger?(k)\n when INRelease then i[3] = i[3] && Input.release?(k)\n end}\n end}\n end",
"def input_handler(input)\n case input\n when \"w\"\n update_direction(\"N\")\n when \"s\"\n update_direction(\"S\")\n when \"a\"\n update_direction(\"O\")\n when \"d\"\n update_direction(\"W\")\n end\nend",
"def call(input)\n process(input)\n end",
"def input(name)\n SideJob::Port.new(self, :in, name)\n end",
"def listen\n #Start listening for input.\n start_listen\n\n #Start listening for errors.\n start_listen_errors\n end",
"def get_input\n #Get input from the user\nend",
"def initialize_input\r\n initialize_buffer\r\n API.enable_input(@device)\r\n @start_time = Time.now.to_f\r\n initialize_listener\r\n true\r\n end",
"def listen_to(io, &callback); end",
"def input?; @input; end",
"def listen(p0) end",
"def listen(p0) end",
"def listen(p0) end",
"def listen\n @logger.debug(\"Waiting for play/start message from sequencer..\")\n message_1 = @translator.translate(@input.gets)\n while message_1 != \"play\"\n message_1 = @translator.translate(@input.gets)\n end\n @logger.debug(\"Play/start message received from sequencer..\")\n action\n end",
"def read\n Vedeu.log(type: :input, message: \"Waiting for user input...\\n\")\n\n if raw_mode?\n Vedeu.trigger(:_keypress_, keypress)\n\n elsif fake_mode?\n @key ||= keypress\n\n if @key.nil?\n nil\n\n elsif click?(@key)\n Vedeu.trigger(:_mouse_event_, @key)\n\n elsif Vedeu::Input::Mapper.registered?(@key, name)\n Vedeu.trigger(:_keypress_, @key, name)\n\n elsif interface.editable?\n Vedeu.trigger(:_editor_, @key)\n\n else\n Vedeu.trigger(:key, @key)\n\n end\n\n elsif cooked_mode?\n Vedeu.trigger(:_command_, command)\n\n end\n end",
"def stdin; end",
"def get_input;\t@input \t\tend",
"def each_input_line\n with_input_io{|io| io.each_line(&Proc.new)}\n end",
"def listen_for_changes\n Listen.to(input_dir.to_s) do\n sync\n end.start\n end",
"def set_text_input(input); end",
"def input(question, options = {})\n speaker_receiver.input(question, options)\n end",
"def input=(_input)\n end",
"def stdin(*); end",
"def stdin(*); end",
"def test_recognize_input_class\n sleep(0.5)\n TestInput.open do |input|\n listener = Listener.new(input)\n assert_equal(UniMIDIInput, listener.sources.first.class)\n end\n end",
"def handle_input\n @controls.handle\n end",
"def emit_ln(input)\n emit(input)\n print \"\\n\"\nend",
"def send_input(string)\n @stdin.print string\n end",
"def listening?; end",
"def listen\r\n end",
"def stdin\n raise \"Not implemented\"\n end",
"def run_with_input(input, *args)\n @p4.input = input\n run(*args)\n end",
"def run\n loop do\n new_value = @serial_port.gets\n unless (@value == new_value) \n @value = new_value\n changed\n notify_observers(@value) \n end\n end\n end",
"def update_input!(new_input)\n @input = new_input\n end",
"def text_input; end",
"def asking_getchar\n Fiber.yield :input\n end",
"def receive_input\n input = ''\n controls = %w(a s d w)\n until controls.include?(input)\n input = STDIN.getch\n abort 'escaped' if input == \"\\e\"\n end\n input\n end",
"def input=(_arg0); end",
"def gets\n @input.gets\n end",
"def connect_input!\n raise NotImplementedError, 'Raw connections do not support connect_input. Please subclass and define a connect_input method.'\n end",
"def key_pressed\n if STDIN.ready?\n input = STDIN.read_nonblock(1) rescue nil\n if input == \"\\e\" \n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n end\n # STDIN.cooked!\n input\n\nend",
"def on_keypress &b\n on :keypress, &b\n end",
"def read_input\n begin\n @in.flush\n chars = @in.sysread(255)\n rescue EOFError, IOError, Errno::ECONNRESET, Errno::ENOTSOCK\n chars = nil\n end\n if chars.nil?\n stop\n else\n mutex.synchronize { @buffer.concat chars }\n changed\n notify_observers self\n end\n end",
"def input=(io)\n @input = io\n reset\n end",
"def on_key(ch)\n end",
"def do_event\n=begin\n\n event = Events.new(@resources[:luck])\n # starts an event\n event.start\n decision = gets.chomp\n\n until event.accepts? decision # Requires valid input\n UiHandler.print_error(event.valid_range)\n decision = gets.chomp\n end\n\n # event.dispatch accepts player decision and affects the world\n # returning new number of resources\n @resources = event.dispatch(decision)\n\n=end\n end",
"def input_port?\n @type == :input\n end",
"def run_input_thread\n Thread.new do\n read_input until stopped?\n end\n end",
"def input=(input_text)\n engine.input = input_text\n end",
"def get_input\n @input = gets.chomp\n end",
"def listen\n loop do\n self.listen_loop\n \n #Break out if something is wrong.\n break if !@out_mutex or (@in and @in.closed?) or (@out and @out.closed?)\n end\n end",
"def listen(patch, &callback)\n ensure_socket.on_message do |data|\n handle_input(patch, data, &callback)\n end\n true\n end",
"def with_input_io(key)\n raise \"subclass responsibility\"\n end",
"def listen()\r\n STDIN.gets.chomp().downcase.gsub(/[^a-z\\s]/, '')\r\nend",
"def input(pin)\n Native.gpio_function(pin, Native::GPIO_FSEL_INPT)\n end",
"def stdinput\n @input\n end",
"def input\n print '>> '\n $input = gets.chomp.downcase\n end",
"def input\n @input ||= STDIN.readlines\nend",
"def process(input)\n add_input(input)\n flush_context_stack\n end",
"def user_input\n\tgets\nend",
"def write(input)\n @stdin.write input\n end",
"def process_input\n if state.current_input == :star\n input_star\n elsif state.current_input == :target\n input_target\n elsif state.current_input == :remove_wall\n input_remove_wall\n elsif state.current_input == :add_wall\n input_add_wall\n end\n end",
"def input(thing)\n print \"Enter #{thing}: \"\n gets.chomp\nend",
"def read_input()\n print \"> \"\n $stdout.flush\n gets\n end",
"def user_input_capture\n print \">>: \"\n response = gets.chomp\n response\n end",
"def input\n # If the mouse was lifted this tick\n if inputs.mouse.up\n # Set current input to none\n state.user_input = :none\n end\n\n # If the mouse was clicked this tick\n if inputs.mouse.down\n # Determine what the user is editing and edit the state.user_input variable\n determine_input\n end\n\n # Process user input based on user_input variable and current mouse position\n process_input\n end",
"def input(pos)\n # num = param_val(param)\n # @program[num] = num\n @program[pos.value] = @input\n end",
"def input\n keys = Vedeu::Input::Raw.read\n\n if click?(keys)\n Vedeu::Input::Mouse.click(keys)\n\n else\n keys\n\n end\n end",
"def get_user_input\n Termbox.tb_poll_event(@event)\n ascii_to_symbol @event[:ch]\n end",
"def input?; @link_type == 'IN'; end",
"def _input(*a)\n Input.new(self, *a)\n end",
"def listen()\n STDIN.gets.chomp().downcase.gsub(/[^a-z\\s]/, '')\nend",
"def listen()\n STDIN.gets.chomp().downcase.gsub(/[^a-z\\s]/, '')\nend",
"def source\n visit(input)\n end",
"def call(input)\r\n process(*input)\r\n end",
"def accept\r\n end"
] | [
"0.69116414",
"0.6876235",
"0.6870691",
"0.68183935",
"0.6740275",
"0.6538641",
"0.6488872",
"0.6460713",
"0.64464045",
"0.64464045",
"0.64464045",
"0.6428034",
"0.6426924",
"0.64252806",
"0.64252806",
"0.64188474",
"0.6402984",
"0.6374152",
"0.6352623",
"0.6302852",
"0.63018256",
"0.62853897",
"0.6271797",
"0.62630224",
"0.62313056",
"0.61775553",
"0.6173076",
"0.6046999",
"0.60457504",
"0.6039772",
"0.6028154",
"0.60152096",
"0.6008596",
"0.600547",
"0.60035145",
"0.6001463",
"0.6001463",
"0.6001463",
"0.59962773",
"0.59874314",
"0.59748715",
"0.59543705",
"0.59467787",
"0.5905695",
"0.5899263",
"0.58930445",
"0.5892696",
"0.5885312",
"0.5885312",
"0.5878802",
"0.58750486",
"0.586983",
"0.5857903",
"0.5853485",
"0.58430225",
"0.5827131",
"0.5824869",
"0.58108205",
"0.58066756",
"0.579884",
"0.5792077",
"0.5788534",
"0.5787303",
"0.5786096",
"0.5770839",
"0.57632273",
"0.57512313",
"0.57426214",
"0.5741697",
"0.5738597",
"0.5737483",
"0.5732383",
"0.57272154",
"0.57239574",
"0.57192796",
"0.57146245",
"0.56957614",
"0.5691743",
"0.5666745",
"0.5664342",
"0.56534827",
"0.56517816",
"0.56516796",
"0.5619808",
"0.5611988",
"0.5605722",
"0.56011266",
"0.55988985",
"0.55935806",
"0.55918217",
"0.55908746",
"0.55693215",
"0.55629426",
"0.55619615",
"0.55472803",
"0.5541517",
"0.55401516",
"0.55401516",
"0.5537229",
"0.55180025",
"0.5515157"
] | 0.0 | -1 |
This action sets values that are used by the list of items page Story: Display list of items( | def index
@items=Item.where(:activated => true) #TODO: Add availability
@categories = Category.all
@search = Item.search(params[:search])
@keyword = params[:search]
@items = @search.where(:activated => true) # or @search.relation to lazy load in view
@items = @items.paginate(:per_page=>16, :page=>params[:page]) #@category.items
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_item_list\n @item_list = ItemList.find(params[:id])\n end",
"def list_items_preview\n end",
"def show\n set_item\n end",
"def make_item_list\n end",
"def index\n @list_items = @list.list_items\n end",
"def render_items(items)\n @list.items = case @footer.filters.selected.value\n when :active\n items.reject { |item| item[:done] }\n when :completed\n items.select { |item| item[:done] }\n else\n items\n end.sort_by { |item| item[:text] }\n end",
"def set_PopulateItems(value)\n set_input(\"PopulateItems\", value)\n end",
"def set_PopulateItems(value)\n set_input(\"PopulateItems\", value)\n end",
"def set_list_item\n\t @list_item = ListItem.find(params[:id])\n\t end",
"def set_item\n @item = model.find(params[:id])\n\n @url_back = url_list\n end",
"def set_list_item\n @list_item = ListItem.find(params[:id])\n end",
"def set_list_item\n @list_item = ListItem.find(params[:id])\n end",
"def set_list_item\n @list_item = ListItem.find(params[:id])\n end",
"def set_list_item\n @list_item = ListItem.find(params[:id])\n end",
"def get_list\n \t@items\n end",
"def manage_items\n end",
"def index\n @list_items = ListItem.all\n end",
"def index\n @list_items = ListItem.all\n end",
"def items=(value)\n @items = value\n end",
"def items=(value)\n @items = value\n end",
"def set_list_item\n @list_item = ListItem.find(params[:id])\n end",
"def set_list(list)\n @item_list = list\n end",
"def index\n @item_lists = ItemList.all\n end",
"def heading\n\t\t\"Items\"\n\tend",
"def get_list_items\n get_field_config['items']\n end",
"def index\n @listitems = @todolist.listitems\nend",
"def show\n initLists\n end",
"def get_items\r\n @list\r\n end",
"def list_items\r\n begin\r\n expand_combo\r\n get(:type => :list_item, :scope => :children, :how_many => :all)\r\n ensure\r\n collapse_combo\r\n end\r\n end",
"def render_list(title, items, options = Hash.new)\n options, push_options = Kernel.filter_options options, :filter => false, :id => nil\n if options[:filter] && !options[:id]\n raise ArgumentError, \":filter is true, but no :id has been given\"\n end\n html = load_template(LIST_TEMPLATE).result(binding)\n push(title, html, push_options.merge(:id => options[:id]))\n end",
"def update\n @list.append_items!(params.dig(:list, :items), current_user)\n redirect_to [@project, @randomization_scheme], notice: \"Items successfully added.\"\n end",
"def show\n @value_items = @value_list.value_items.order(:position)\n @new_item = @value_list.value_items.build\n end",
"def item_results\n set_item_results_ivars\n render partial: \"items/listing\"\n end",
"def start_special_list_item\n end",
"def li; self.list_item = true; self; end",
"def display\n \t@items= Item.sorted\n end",
"def get_items\n @items\n end",
"def list_item_params\n params[:list_item]\n end",
"def list options = {} \n render_partial :list, template_locals(:list_item, options)\n end",
"def detail_item= item\n @detail_item = item\n configure_view\n end",
"def view_items_in_tab\n resource_type = params[:resource_type]\n resource_ids = (params[:resource_ids] || []).split(',')\n render :update do |page|\n if !resource_type.blank?\n clazz = resource_type.constantize\n resources = clazz.find_all_by_id(resource_ids)\n if clazz.respond_to?(:authorized_partial_asset_collection)\n resources = clazz.authorized_partial_asset_collection(resources,\"view\")\n else\n resources = resources.select &:can_view?\n end\n\n page.replace_html \"#{resource_type}_list_items_container\",\n :partial => \"assets/resource_list\",\n :locals => {:collection => resources,\n :narrow_view => true,\n :authorization_for_showing_already_done => true,\n :actions_partial_disable=>false}\n page.visual_effect :toggle_blind, \"view_#{resource_type}s\", :duration => 0.05\n page.visual_effect :toggle_blind, \"view_#{resource_type}s_and_extra\", :duration => 0.05\n end\n end\n end",
"def setup(list_name, items_text, current_user, current_admin = nil)\n self.current_user = current_user\n self.current_admin = current_admin\n self.list_name = list_name\n return unless authorized? == true\n\n raise(FphsGeneralError, 'no items selected') if items_text.blank? || items_text.empty?\n\n # Parse the items_text to get an array of hashes, each item representing a user selection change\n # This follows the JSON represented in the complex report column value, formatted as\n # {\"list_id\": \"<list_id>\",\n # \"type\":\"q2_datadic\",\n # \"id\": <source.id>,\n # \"from_master_id\": -1,\n # \"init_value\": true | false }\n self.items = items_text.map { |i| JSON.parse(i) }\n item_ids = items.map { |i| i['id'] }\n\n # Ensure there is only a single type being represented in the list\n source_types = items.map { |i| i['type'] }.uniq\n self.source_type = source_types.first\n raise(FphsGeneralError, 'source type not specified') unless source_types.length == 1 && source_type\n\n # Ensure there is only a single list ID being represented in the list\n list_ids = items.map { |i| i['list_id'] }.uniq\n self.list_id = list_ids.first\n raise(FphsGeneralError, 'list id not specified') unless list_ids.length == 1 && list_id\n\n # Use the optional *on_attr:* value to specify an alternative field to check the list against.\n # For example, this allows master_id to be specified, tying lists to master records rather than\n # dynamic definition records. By default we assume the id field will be used.\n self.list_on_attr = items.first['on_attr'] || 'id'\n\n check_authorizations!\n check_valid_list_id!\n\n # Remove the initial item that provides details about the list if nothing else is returned\n items.delete_if { |i| i['id'].nil? }\n item_ids.compact!\n\n items_in_list_record_ids = items_in_list.pluck(:record_id)\n items_in_list_ids = items_in_list.pluck(:id)\n\n self.item_ids_in_list = item_ids & items_in_list_ids\n self.new_item_ids = item_ids - items_in_list_record_ids\n self.removed_item_ids = items_in_list_record_ids - item_ids\n\n self\n end",
"def show\n dummy_item\n end",
"def set_list_form\n @states = [{\"name\":\"DISPONIBLE\"},{\"name\":\"OBSOLETO\"}]\n @hometowns = [{\"name\":\"PRODUCCION\"},{\"name\":\"SEGREGADO\"},{\"name\":\"INVENTARIO\"},{\"name\":\"DEVOLUCIONES\"},{\"name\":\"OTROS\"}]\n @dispositions = [{\"name\":\"SOBRANTES\"},{\"name\":\"MOLINO\"}]\n end",
"def show\n @list = current_user.list\n @item = Item.new\n end",
"def index\n @items = Item.all\n\n set_order\n end",
"def update!(**args)\n @list_items = args[:list_items] if args.key?(:list_items)\n end",
"def index\n\t\t@item = current_user.items\n\n\tend",
"def index\n @item_type = params[:type] = \"C\"\n \n params[:id] = nil\n \n # 찜한 상품, 콜렉션\n @collections = Collection.itemList(params)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n \n end",
"def set_list\n @list = List.friendly.find(params[:id])\n end",
"def show\n @items = Item.all\n end",
"def items _args\n \"items _args;\" \n end",
"def index \n\t\t@items = Item.all\n\tend",
"def update_item_button_list\n @item_button_list.item_list = @item_list\n @item_button_list.index = @index\n end",
"def show_posted_items_page\n \t@user_items = current_user.posted_items\n end",
"def new_items_list\n @items = Item.where(:activated => true).sort{ |b,a| a.created_at <=> b.created_at } #TODO: Add availability\n @items = @items.first(16)\n #TODO: Once we have populated more data, maybe show 12 items instead of four\n @categories = Category.all\n @search = Item.search(params[:search])\n @keyword = params[:search]\n end",
"def edit_list\n # TODO Change to active: false when draft/active and permissions are implemented\n @docs = Document.where(active: true).order(:title)\n @action = 'edit'\n @title = 'Contribution'\n render 'list'\n end",
"def list_items_list(page_id = current_page_id, list_id = current_list_id)\n request \"page/#{page_id}/lists/#{list_id}/items/list\"\n end",
"def items\n load_selection\n import_selection or render_select\n end",
"def checklist_items=(value)\n @checklist_items = value\n end",
"def set_actionlist\n @actionlist = Actionlist.find(params[:id])\n end",
"def items\n @items\n end",
"def items\n @items\n end",
"def items\n @items\n end",
"def items\n @items\n end",
"def index\n\t\t@items = Item.all\n end",
"def show_list\n\t\t\t@my_list.show\n\t\tend",
"def index\n @scaffolding2_items = Scaffolding2Item.all\n end",
"def render_item(name, value = nil)\n if value\n \"<li><b>#{name}</b>: #{value}</li>\"\n else\n \"<li><b>#{name}</b></li>\"\n end\n end",
"def list(items)\n items = items.map do |item|\n new_item = {title: {text: item[:text], highlight: item[:highlight] || false}}\n new_item.merge!(description: item[:description]) unless item[:description].nil?\n new_item.merge!(label: item[:label]) unless item[:label].nil?\n new_item\n end\n self.push(items)\n end",
"def show_list\n process_show_list\n end",
"def show\n @include_order_items = true\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def set_list\n @list = List.find(params[:id])\n end",
"def list\n @view.listing\n end",
"def items(**items)\n const_set(:ITEMS, items)\n end",
"def set_item\n @item = Item.friendly.find(params[:id])\n end",
"def set_item\n @item = Item.friendly.find(params[:id])\n end",
"def set_list_item\n @list_item = @list.list_items.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to(root_url, :notice => 'Record not found')\n end",
"def index\n @items = Item.all\n end",
"def render_item(name, value = nil)\n if value\n \"<li><b>#{name}</b>: #{value}</li>\"\n else\n \"<li>#{name}</li>\"\n end\n end"
] | [
"0.683831",
"0.661873",
"0.65930694",
"0.6591053",
"0.65603405",
"0.64788187",
"0.644307",
"0.644307",
"0.63845944",
"0.63803864",
"0.63773334",
"0.63773334",
"0.63773334",
"0.6377309",
"0.6356068",
"0.63508",
"0.63489425",
"0.63489425",
"0.6271861",
"0.6271861",
"0.62625396",
"0.61760706",
"0.6167451",
"0.6163956",
"0.6145154",
"0.6104633",
"0.60749185",
"0.60374403",
"0.6013724",
"0.60031945",
"0.5998907",
"0.59942687",
"0.59899044",
"0.59765244",
"0.5975378",
"0.5955942",
"0.5951098",
"0.5950092",
"0.59472615",
"0.5940436",
"0.59313595",
"0.5926211",
"0.5924707",
"0.59141016",
"0.5913796",
"0.59122074",
"0.59103966",
"0.5901216",
"0.5896301",
"0.5893698",
"0.5887768",
"0.5886871",
"0.5879633",
"0.58720684",
"0.586738",
"0.58634526",
"0.5853131",
"0.58478767",
"0.5847165",
"0.5845914",
"0.5844018",
"0.58415794",
"0.58415794",
"0.58415794",
"0.58415794",
"0.58412975",
"0.58358544",
"0.58229285",
"0.58188397",
"0.58182424",
"0.58113116",
"0.5781118",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5764347",
"0.5761548",
"0.57608426",
"0.5759465",
"0.5759465",
"0.57539403",
"0.57426006",
"0.5741349"
] | 0.0 | -1 |
This action sets values that are used by new items page Story: Display new products( | def new_items_list
@items = Item.where(:activated => true).sort{ |b,a| a.created_at <=> b.created_at } #TODO: Add availability
@items = @items.first(16)
#TODO: Once we have populated more data, maybe show 12 items instead of four
@categories = Category.all
@search = Item.search(params[:search])
@keyword = params[:search]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_new_product\n array_product = @view.new_product_info\n new_product = Product.new(array_product[0],array_product[1],array_product[2])\n @seller.save_product_info(new_product)\n input = @view.menu(\"2\")\n seller_actions(input)\n end",
"def products\n end",
"def add_new_product_menu\n puts \"Enter Product Title:\"\n p \">\"\n @product_title = set_field\n puts \"Enter The Produs's Price:\"\n p \">\"\n @product_price = set_field\n puts \"Enter The Customer's ID:\"\n p \">\"\n @customer_id = set_field\n\n add_new_product\n end",
"def set_product\n @product = Product.find(params[:id])\n @item = Product.find(params[:id])\n end",
"def set_product\n \n end",
"def new\n\t\t@item = Product.new\n\tend",
"def new\n @site_element.show_on_public_site = true\n if params[:products].present?\n @site_element.products = params[:products].split(',').map{|k| Product.find(k)}\n @site_element.is_document = true\n end\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @site_element }\n end\n end",
"def set_product\n\t\t@product = Item.find(params[:id])\n\tend",
"def new\n @product = Product.init.with_user(current_user.id).first || Product.new\n @product.user = current_user\n @product.force_save\n\n return redirect_to(edit_product_path(@product))\n\n @page_title = \"Sell your product\"\n @product = Product.new\n @tags = Tag.main.with_children.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def set_products\n @product = Product.find(params[:id])\n end",
"def new\n @pagetitle = \"New product category\"\n @products_category = ProductsCategory.new\n @company = Company.find(params[:company_id])\n @products_category[:company_id] = @company.id\n \n end",
"def set_productitem\n @productitem = Productitem.find(params[:id])\n end",
"def new\n @product = Product.new\n assign_lovs\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @product }\n end\n end",
"def index\n @product = Product.new\n set_products\n end",
"def set_Product(value)\n set_input(\"Product\", value)\n end",
"def create\n @product = Product.new(@editable_params)\n\n if @product.save\n @product_section = 'options'\n render :template => 'manage/products/options_images_form' and return\n else\n prepare_products(25,'any')\n render :template => 'manage/products/index' and return\n end\n end",
"def set_product\n @products = Product.find(params[:id])\n end",
"def set_product\n #クライアントから入力された商品IDの情報をすでに登録されているDBから取ってくる \n #/product/1\n @product = Product.find(params[:id])\n \n end",
"def set_product_item\n @product_item = @brand.items.find(params[:id])\n end",
"def new\n session[:section] = 'new'\n @product = Product.new\n end",
"def create\n @product = Product.new(product_params)\n @product.save\n set_products\n end",
"def new\n @pagetitle = \"New product\"\n \n @product = Product.new\n @product[:cost] = 0\n @product[:quantity] = 0\n\n @product[:quantity_transit] = 0\n @product[:company_id] = params[:company_id]\n @product[:price] = 0\n \n @company = Company.find(params[:company_id])\n @suppliers = @company.get_suppliers()\n @marcas = @company.get_marcas()\n @modelos = @company.get_modelos()\n @categories = @company.get_categories()\n @unidades = Unidad.all\n\n @product[:tax1_name] = @company.get_last_tax_name(1)\n @product[:tax2_name] = @company.get_last_tax_name(2)\n @product[:tax2_name] = @company.get_last_tax_name(3)\n \n if(@company.get_last_tax(1))\n @product[:tax1] = @company.get_last_tax(1)\n else\n @product[:tax1] = 0\n end\n \n if(@company.get_last_tax(2))\n @product[:tax2] = @company.get_last_tax(2)\n else\n @product[:tax2] = 0\n end\n \n if(@company.get_last_tax(3))\n @product[:tax3] = @company.get_last_tax(3)\n else\n @product[:tax3] = 0\n end\n \n if(not @company.can_view(current_user))\n errPerms()\n end\n end",
"def new\r\n\t\t@current_area = 'products'\r\n\t\tif request.post?\r\n\t\t\t@current_menu = 'products'\r\n\r\n\t\t\tif params[:product][:categories]\r\n\t\t\t\tproduct_categories = params[:product][:categories].map { |c| Category.find(c.to_i) }\r\n\t\t\telse\r\n\t\t\t\tproduct_categories = []\r\n\t\t\tend\r\n\t\t\tparams[:product][:categories] = []\r\n\t\t\tparams[:product][:expiry_date] = ffs_parse_date(params[:product][:expiry_date])\r\n\t\t\t@product = Product.new(params[:product])\r\n\t\t\tif @product.save\r\n\t\t\t\[email protected] = product_categories\r\n\r\n\t\t\t\tif params[:image] and params[:image][:image]\r\n\t\t\t\t\t# != '' works, but .empty? doesn't - .empty? isn't defined for IOString's :x\r\n\t\t\t\t\tif params[:image][:image] != ''\r\n\t\t\t\t\t\tif params[:image][:image].original_filename\r\n\t\t\t\t\t\t\tif !params[:image][:image].original_filename.empty?\r\n\t\t\t\t\t\t\t\[email protected] ||= Image.new\r\n\t\t\t\t\t\t\t\[email protected] = params[:image][:image]\r\n\t\t\t\t\t\t\t\[email protected]\r\n\t\t\t\t\t\t\tend\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\r\n\t\t\t\tif params[:product][:product_type_id].to_i > 0\r\n\t\t\t\t\tthe_product_type = ProductType.find(params[:product][:product_type_id])\r\n\t\t\t\tend\r\n\r\n\t\t\t\tif the_product_type\r\n\t\t\t\t\tthe_product_type.quirks.each do |cur_quirk|\r\n\t\t\t\t\t\tquirk_value = QuirkValue.new({ :product_id => @product[:id], :quirk_id => cur_quirk[:id], :value => params[:quirk][cur_quirk[:id].to_s] })\r\n\t\t\t\t\t\tquirk_value.save\r\n\r\n\t\t\t\t\t\tif cur_quirk[:required] && (!params[:quirk][cur_quirk[:id].to_s] || params[:quirk][cur_quirk[:id].to_s].empty?)\r\n\t\t\t\t\t\t\[email protected] \"product_type_id\", \" #{the_product_type[:name]} is missing the #{cur_quirk[:name]} attribute\"\r\n\t\t\t\t\t\tend\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\r\n\t\t\t\tflash[:notice] = 'Product successfully created'\r\n\t\t\t\tredirect_to :action => :product, :id => @product.id, :anchor => 'options'\r\n\t\t\tend\r\n\r\n\t\t\[email protected] = product_categories\r\n\t\telse\r\n\t\t\t@current_menu = 'products'\r\n\r\n\t\t\t@product = Product.new\r\n\t\t\t@image = Image.new\r\n\t\t\t@category_id = params[:category_id]\r\n\t\tend\r\n\r\n\t\tall_product_types = ProductType.find(:all)\r\n\r\n\t\t@product_types = Array.new\r\n\t\t@quirks = Hash.new\r\n\r\n\t\t@product_types << [0, \"(none)\"]\r\n\t\tall_product_types.each do |cur_product_type|\r\n\t\t\t@product_types << [cur_product_type.id, cur_product_type.to_s]\r\n\r\n\t\t\tif [email protected]_key?(cur_product_type.id)\r\n\t\t\t\t@quirks[cur_product_type.id] = Hash.new\r\n\t\t\tend\r\n\r\n\t\t\tcur_product_type.quirks.each do |cur_quirk|\r\n\t\t\t\tif !@quirks[cur_product_type.id].has_key?(cur_quirk.id)\r\n\t\t\t\t\t@quirks[cur_product_type.id][cur_quirk.id] = Hash.new\r\n\t\t\t\tend\r\n\r\n\t\t\t\t@quirks[cur_product_type.id][cur_quirk.id][\"name\"] = cur_quirk[:name]\r\n\t\t\t\t@quirks[cur_product_type.id][cur_quirk.id][\"type\"] = cur_quirk[:type]\r\n\t\t\t\t@quirks[cur_product_type.id][cur_quirk.id][\"required\"] = cur_quirk[:required]\r\n\t\t\tend\r\n\t\tend\r\n\tend",
"def products_list\n\t\[email protected]_list\n\t\tproducts = @store.products\n\t\tproducts.each do |product|\n\t\t\tputs \"Name: #{product.name} ---> Price: #{product.price}\"\n\t\tend\n\t\[email protected]_view(@current_user, @current_user.actions)\n\tend",
"def new\n params[:selected_product_id] = params[:set_selected_to] || @products.first\n @line_item = LineItem.new(quantity: params[:quantity])\n end",
"def create\n @product_item = @brand.items.new(product_item_params)\n\n if @product_item.save\n render :show, status: :created, location: [:partner, @brand, @product_item]\n else\n render json: @product_item.errors, status: :unprocessable_entity\n end\n end",
"def product\n if PRODUCT_UPDATE_MUST_HAVE.include?(Employee.where(id: session[\"found_user_id\"]).first.admin_rights)\n id = params[\"product_id\"]\n if id == \"new\"\n @product = Product.new\n @product.items_per_bunch = 100\n @product.markup = 100\n else\n @product = Product.where(florist_id: session[\"found_florist_id\"]).where(id: id).first\n end\n render(:product_updates) and return\n else\n redirect_to \"/products\" and return\n end\n end",
"def add_params\n product = self.product\n\n self.name = product.name\n self.original_price = product.current_price\n self.alert_price = product.current_price\n end",
"def set_products\n @products_ordered = Product.where(\"id = ?\", params[:product_id]) \n end",
"def set_info_product\n @info_product = InfoProduct.find(params[:id])\n end",
"def setup_products\n\t\t@controller = ProductsController.new\n\tend",
"def create\n @product = Product.new(params[:product])\n render_after_save('new')\n end",
"def set_product\n @product = Product.friendly.find params[:id]\n end",
"def set_productinfo\n @productinfo = Productinfo.find(params[:id])\n end",
"def fill_catalogue()\n @@products.clear\n add_product(Fruit.new(\"Apples\", 10))\n add_product(Fruit.new(\"Oranges\", 5))\n add_product(Fruit.new(\"Banana\", 20))\n add_product(Fruit.new(\"Watermelon\", 1))\n add_product(Houseware.new(\"Vacuum cleaner\", 150))\n add_product(Product.new(\"Anchovies\",2))\n end",
"def show\n # to add tools to product\n if params[:select].present? \n @new_parent = Product.find(params[:select])\n if @new_parent\n ProductToTool.find_or_create_by_product_id_and_tool_id(@product.id,@new_parent.id)\n end\n end\n @products = Product.admin_grid(params).order(sort_column + \" \" + sort_direction).\n paginate(:page => pagination_page, :per_page => pagination_rows)\n @product_variants = @product.product_variants\n \n if params[:show_products].present? \n @show_products = true\n end \n end",
"def new\n if request.post?\n @customers = Customer.find(:all).sort\n @vendor_product_items = PurchaseOrderItem.avail_items\n @store_product_items = StoreProductItem.avail_items\n\n @sale_order = SaleOrder.new\n purchase_order_items = params[:purchase_order_items] || { }\n purchase_order_items.each_key do |id|\n poi = PurchaseOrderItem.find(id)\n @sale_order.sale_order_items <<\n SaleOrderItem.new(:purchase_order_item_id => poi.id,\n :quantity => 1)\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sale_order }\n end\n else\n respond_to do |format|\n flash[:notice] = 'Please select some products to create a sale order.'\n format.html { redirect_to :controller => :store, :action => :sale }\n end\n end\n end",
"def new\n\t\t@product = Product.new\n\tend",
"def new\n\t\t@product = Product.new\n\tend",
"def new\n\t\t@product = Product.new\n\tend",
"def new\n\t\t@product = Product.new\n\tend",
"def new\n\t\t@product = Product.new\n\tend",
"def new\n @product.brand = website.brand\n @product.layout_class = website.brand.default_layout_class_for_products\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product }\n end\n end",
"def set_product\n\t\t@product = params[:id]\n\tend",
"def create_product\n\t\tproduct_attributes = @view.creando_producto\n\t\[email protected]_product(product_attributes[0], product_attributes[1])\n\t\toption = @view.second_view(@current_user, @current_user.actions)\n\t\tlist(option)\n\tend",
"def new\n if params[:product_title].nil? or params[:product_title]==\"\"\n\trender :text=>\"Products require a title\",:status=>500\n\treturn\n end\n if params[:series_id].nil? or params[:series_id]==\"\"\n\trender :text=>\"Products require a series\"\n\treturn\n end\n @product=Product.new\n @product.name=params[:product_title]\n @product.series_id=params[:series_id]\n @product.save \n render :layout=>false, :action=>\"form\"\n end",
"def product_info_seller\n products = @seller.show_product_info \n choice = @view.display_info_product(products)\n choice == \"1\" ? buy_product : input = @view.menu(\"2\") \n seller_actions(input)\n end",
"def set_product\n\t @product = Product.friendly.find(params[:id])\n\t end",
"def set_product\n @product = Product.friendly.find(params[:product_id])\n # logger.debug \"product #{@product.id}\"\n end",
"def set_product\n @product = Product.friendly.find(params[:id])\n # logger.debug \"product #{@product.id}\"\n end",
"def set_product\n @product = Product.friendly.find(params[:id])\n end",
"def set_product\n @product = Product.friendly.find(params[:id])\n end",
"def set_product\n @product = Product.friendly.find(params[:id])\n end",
"def set_product\n @product = Product.friendly.find(params[:id])\n end",
"def set_product\n @product = Product.friendly.find(params[:id])\n end",
"def set_product\n @product = Product.friendly.find(params[:id])\n end",
"def set_prod\n @product = Product.find(params[:id])\n end",
"def products=(dummy)\n end",
"def product_params\n params.require(:product).permit(:name, :image, :nature, :menu_parent, :variant_name, :video, :how2fix, :description, :meta_description, :meta_keyword, :views, :active,:tool_id, :new_parent_map => ['product_id', 'select'])\n end",
"def set_products\n @products = Product.all\n end",
"def new\n @price_override = PriceOverride.new\n @items = Item.find(:all, :select => 'id, description', :order => 'description', :conditions => [\"isaugmented = ? and soulboundtrigger <> ? and rarity <> ?\", false, \"BindOnPickup\", \"Trash\"])\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @price_override }\n end\n end",
"def set_product\r\n @product = Product.find(params[:id])\r\n end",
"def set_product\r\n @product = Product.find(params[:id])\r\n end",
"def create \n create! { products_path } #return to list, pass over show action\n end",
"def set_product\n @post = Post.find(params[:id])\n end",
"def update_products_details; end",
"def new\n\t \t# @product = Product.create( name: params[:name], description: params[:description])\n\t \t# redirct_to '/products/index'\n \tend",
"def product_params\n params.require(:product).permit(:item_id, :image, :item_type, :user_id, :name, :price, :active, :category, :priority, :description, :start_datetime, :end_datetime, :stock, :sale_or_show)\n end",
"def new\n \t@product = Product.new()\n \t@categories = Category.all\n \trender 'new';\n end",
"def set_product\n\t\t @product = Product.find(params[:id])\n\t\t end",
"def set_product\r\n\t\t\t@product = @application.products.find(params[:id])\r\n\t\tend",
"def set_add_product\n @add_product = AddProduct.find(params[:id])\n end",
"def set_product\n @product = current_seller.product.find(params[:id])\n end",
"def make_item_list\n @data = $game_temp.forge_shop.products\n end",
"def new\n @shop_product = ShopProduct.new\n #@shop_product.product_id = 1\n end",
"def set_product\n #@product = Product.find(params[:id])\n end",
"def set_product\n @product = product.find(params[:id])\n end",
"def new\n @record = Product.new \n @product_types = ProductType.all\n @entities = [current_user.entity]\n\n respond_to do |format|\n format.html {render :layout => 'popup'}\n format.json { \n response = {}\n render json: response \n }\n end \n end",
"def new\n @product_detail = ProductDetail.new\n \n # support for user contribute organization role and name\n 1.times do \n @product_detail.product_detail_organizations.build\n end\n \n # support for user contribute key/value pair entries\n 3.times do \n @product_detail.product_detail_entries.build\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_detail }\n end\n end",
"def items\n if params[:update] == \"true\"\n ## Invariant: we are about to update all of the items in the library.\n logger.debug(\"Updating Items.\")\n Product.find(:all).each do |product|\n @name_call = product.id.to_s + \".name\"\n product.update_name(params[@name_call])\n @price_call = product.id.to_s + \".price\"\n product.update_price(params[@price_call])\n @inventory_call = product.id.to_s + \".inventory\"\n product.update_inventory(params[@inventory_call])\n @description_call = product.id.to_s + \".description\"\n product.update_description(params[@description_call])\n end\n ## Now we have to add any new items that were written in.\n if params[:added] != 0\n for i in 1..params[:added].to_i\n @n = \"name.new.\" + i.to_s\n @p = \"price.new.\" + i.to_s\n @inv = \"inventory.new.\" + i.to_s\n @des = \"description.new.\" + i.to_s\n if params[@n] && params[@p] && params[@inv] && params[@des]\n Product.create(:name => params[@n].to_s, :price => params[@p].to_f, :inventory => params[@inv].to_i, :description => params[@des].to_s)\n end\n end\n end\n end\n end",
"def generate_sales_entry_add_product_form\n @item= Item.find_by_id params[:selected_item_id]\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n @new_object = SalesEntry.new \n end",
"def set_product\n @product = Product.find_by( :id => params[:id] )\n end",
"def set_product\n @product = @products.find(params[:id])\n end",
"def display_product\n STDOUT.puts \"--\"*50\n STDOUT.puts \"title: \\t\\t#{$title}\"\n STDOUT.puts \"seller: \\t#{$seller}\"\n STDOUT.puts \"price: \\t\\t#{$price}\"\n STDOUT.puts \"stars: \\t\\t#{$stars}\"\n STDOUT.puts \"reviews: \\t#{$reviews}\"\n STDOUT.puts \"image url: \\t#{$image_href}\"\n STDOUT.puts \"product url: \\t#{$url}\"\n end",
"def set_product\n @product = Product.find(params[:product_id])\n end",
"def new\n @product_item = ProductItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product_item }\n end\n end",
"def product_information\n super\n end",
"def new\n @object = Spree::Product.new()\n @status = true\n @suppliers = Supplier.all\n end",
"def set_product\n \t@product = Product.find(params[:id])\n end",
"def new\n\t@product_set = ProductSet.new\n\t@categories = Category.find(:all)\n \n\t#logger.debug_variables(binding)\n \n\trespond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_set }\n end\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end"
] | [
"0.6945211",
"0.6942863",
"0.68183595",
"0.6817491",
"0.68064654",
"0.67684484",
"0.66934466",
"0.66751987",
"0.66279954",
"0.6503202",
"0.64691997",
"0.6463287",
"0.6455975",
"0.6454887",
"0.6416835",
"0.6388168",
"0.638555",
"0.6374035",
"0.6357163",
"0.63545334",
"0.63499194",
"0.63413817",
"0.6333935",
"0.63058037",
"0.6304307",
"0.6295528",
"0.62873495",
"0.6281093",
"0.62747926",
"0.6273716",
"0.6258718",
"0.62540036",
"0.6253111",
"0.6248368",
"0.6223838",
"0.6219559",
"0.62059516",
"0.62031555",
"0.62031555",
"0.62031555",
"0.62031555",
"0.62031555",
"0.61997974",
"0.6170427",
"0.6169353",
"0.61686957",
"0.6166657",
"0.6164242",
"0.61445564",
"0.6140082",
"0.6135345",
"0.6135345",
"0.6135345",
"0.6135345",
"0.6135345",
"0.6135345",
"0.6135174",
"0.61347073",
"0.6131158",
"0.61240774",
"0.61229134",
"0.61168057",
"0.61168057",
"0.61165965",
"0.61135256",
"0.6107224",
"0.60990566",
"0.6098917",
"0.6098223",
"0.6097142",
"0.6096336",
"0.6094891",
"0.60910815",
"0.6090235",
"0.60893595",
"0.60851836",
"0.6082955",
"0.607952",
"0.60781264",
"0.6073134",
"0.6069535",
"0.60651463",
"0.6058822",
"0.60570556",
"0.6056541",
"0.6055656",
"0.6045603",
"0.6045243",
"0.6044716",
"0.60431284",
"0.6038574",
"0.6038574",
"0.6038574",
"0.6038574",
"0.6038574",
"0.6038574",
"0.6038574",
"0.6038574",
"0.6038574",
"0.6038574",
"0.6038574"
] | 0.0 | -1 |
This action delete an item from database Story: Display new products( | def user_delete_item
@item = Item.find_by_id(params[:id])
if @item.auction_flag
#@auction = Auction.find(@item.auction_id)
#@auction.destroy
redirect_to item_path(@item),:notice => "You can't delete this item, because its auctioned and it has a bidder"
else
@item.destroy
redirect_to(:action => 'user_items_list')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_product\n product_to_delete = @view.delete_product\n @seller.delete_product(product_to_delete)\n input = @view.menu(\"2\")\n seller_actions(input) \n end",
"def destroy\n @product_item.destroy\n end",
"def delete\n \t@item = Item.find(params[:id])\n \[email protected]\n \tredirect_to :action => 'index'\n\tend",
"def destroy\n @item.destroy\n redirect_to items_url, notice: \"This item was removed from the system.\"\n end",
"def product_delete\n\t\t@task_data = Product.find(params[:id])\n\t\t@task_data.destroy\n\t\tredirect_to product_index_path\n\tend",
"def destroy\n @product_item = ProductItem.find(params[:id])\n @product_item.destroy\n\n respond_to do |format|\n format.html { redirect_to product_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n prepare_products(25,'any')\n render :template => 'manage/products/index' and return\n end",
"def destroy\r\n @item = Item.find(params[:id])\r\n @item.destroy\r\n redirect_to items_url\r\n end",
"def destroy\n \n @company = Company.find(1)\n \n title =@orden_product.avisodetail.descrip \n \n if @orden_product.destroy\n flash[:notice]= \"Item fue eliminado satisfactoriamente \"\n redirect_to @orden \n else\n flash[:error]= \"Item ha tenido un error y no fue eliminado\"\n render :show \n end \n \n end",
"def delete\n Product.destroy(params[:id])\n redirect_to dashboard_path\n end",
"def destroy\n @my_product.destroy\n end",
"def destroy\n title = Item.find(params[:id]).title\n Item.destroy(params[:id]) \n flash[:notice] = \"#{title} was removed from the Shop\"\n redirect_to shop_path\n end",
"def destroy\n title = @customer_event_product.product.product_name\n\n if @customer_event_product.destroy\n flash[:notice] = \"#{title} was removed successfully.\"\n redirect_to :back\n else\n flash[:error] = \"There was an error removing the item\"\n render :show\n end\n end",
"def destroy\n @product.destroy\n\n head :no_content\n end",
"def destroy\n @product.destroy\n end",
"def destroy\n @product.destroy\n head :no_content\n end",
"def destroy\n @product.destroy\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"El producto ha sido eliminado.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story = Story.find(params[:id])\n @story.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_stories_url(@product)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to(admin_products_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted product: #{@product.name}\")\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to(admin_products_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted product: #{@product.name}\")\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n redirect_to :action => 'list'\n end",
"def destroy\n\t@item = Item.find_by_id( params[:id] )\n\[email protected]\n\tflash[:notice] = \"#{@item.name} was removed from your inventory.\"\n\tredirect_to items_url \n end",
"def destroy\n @product.destroy\n set_products\n end",
"def destroy\n Product.find(@params[:id]).destroy\n redirect_to :action => 'list'\n end",
"def destroy\n\t\[email protected]\n\t\thead :no_content\n\tend",
"def delete\n self.class.delete_product_by_id(self.id)\n end",
"def destroy\n @item.destroy\n redirect_to items_url, notice: 'Item was successfully destroyed.'\n #head :no_content\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n redirect_to :action => :index\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to root_url(:item => 3), notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_buy_click.destroy\n\n head :no_content\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n \n redirect_to :action => 'index'\n \n end",
"def destroy\n @item.destroy\n head :no_content\n end",
"def destroy\n @product = Product.find params[:id]\n @product.destroy\n redirect_to products_path\n end",
"def destroy\n @product = Product.find params[:id]\n @product.destroy\n flash[:success] = \"Product deleted\"\n redirect_to admin_products_path\n end",
"def destroy\n @product_management.destroy\n\n head :no_content\n end",
"def destroy\n unread\n\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy!\n end",
"def destroy\n @orden_item.destroy\n respond_to do |format|\n format.html { redirect_to orden_items_url, notice: 'Orden item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n redirect_to items_path, notice: 'Item was successfully destroyed.'\n end",
"def destroy\n\t\t@product = Product.find(params[:id])\n\t\[email protected]\n\t\tredirect_to products_path, notice: \"The product has deleted successfully\"\n\tend",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n redirect_to products_path\n end",
"def destroy\n @item.destroy\n redirect_to items_url, notice: 'Item was successfully destroyed.'\n end",
"def destroy\n @itemtipo.destroy\n\n head :no_content\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n params.delete(:id)\n load_index()\n end",
"def destroy\n @art_item.destroy\n respond_to do |format|\n format.html { redirect_to art_items_url, notice: 'Art item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n redirect_to root_path\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n redirect_to root_path\n end",
"def destroy\n get_product\n @product_detail = @product.details.find(params[:id])\n @product_detail.destroy\n end",
"def destroy\n @toodoo_item.destroy\n respond_to do |format|\n format.html { redirect_to toodoo_items_url, notice: 'Toodoo item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mixed_product = MixedProduct.find(params[:id])\n @product = @mixed_product.parent\n @mixed_product.destroy\n flash[:notice] = \"Successfully removed\"\n end",
"def destroy\n\t\t@product = Product.find(params[:id])\n\t\[email protected]\n\t\tredirect_to products_path, notice:\"the product was successfully destroyed\"\t \n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url, notice: \"カートから商品が削除されました\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n head :no_content\n end",
"def destroy\n @tekniskitem.destroy\n redirect_to tekniskcategories_path , notice: 'Greia er sletta'\n end",
"def destroy\n @item.destroy\n flash[:success] = \"Item successfully destroyed\"\n redirect_to items_path\n end",
"def destroy\n @item.destroy\n redirect_to root_path\n end",
"def item_destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to item_index_path, notice: 'O item foi removido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @add_product = AddProduct.find(params[:id])\n @add_product.destroy\n\n respond_to do |format|\n format.html { redirect_to add_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n flash[:success] = \"Item foi excluído com sucesso!\"\n respond_to do |format|\n format.html { redirect_to itens_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@product=Product.find(params[:id])\n\t\[email protected]\n\t\tredirect_to products_path\n\tend",
"def remove\n product = Product.find(params[:id])\n wishlist = Wishlist.get_current(current_user, session)\n wishlist.products.delete(product)\n render :update do |page| \n page.remove(\"dg_#{product.id}\")\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Изделие успешно удалено.' }\n @product = Product.find(params[:id])\n end\n end",
"def destroy\r\n @product = Product.find_by_urlname(params[:id])\r\n @product.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(:controller => :admin, :action => :product_list) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @food_product.destroy\n end",
"def destroy\n @item.destroy\n flash[:success] = \"項目已刪除!\"\n redirect_to session[:last_page]\n end",
"def destroy\n @addon_list_item.destroy\n respond_to do |format|\n format.html { redirect_to addon_list_items_url, notice: 'Product add on list item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = @course.items.find(:first, :conditions => ['lower(name) = ?', params[:id].downcase.gsub('_', ' ')])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(course_items_url(@course)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to site_path(@site), notice: '商品を削除しました' }\n format.json { head :no_content }\n end\n end",
"def destroy\n item = @item.name\n @item.deleted = true\n @item.deleted_at = Time.now\n @item.save\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"#{item} was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @closet_item = ClosetItem.find(params[:id])\n @closet_item.destroy\n\n respond_to do |format|\n format.html { redirect_to closet_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\tif @product.destroy\n\t\t\tflash[:notice] = \"Successfully deleted product!\"\n\t\t\tredirect_to products_path\n\t\telse\n\t\t\tflash[:alert] = \"Error updating product!\"\n\t\tend\n\tend",
"def destroy\n @cart = current_cart\n @item = @cart.find_cart_item(params[:id])\n @product = @item.product\n @item.destroy\n flash[:warning] = \"#{@product.name} removed with success!\"\n redirect_to :back\n end",
"def destroy\n\t\t@product = Product.find(params[:id])\n\t\[email protected]\n\t\tredirect_to products_path, notice: \"The product was successfully destroyed\"\n\tend",
"def destroy\n\t\t@product = Product.find(params[:id])\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t format.html { redirect_to products_url }\n\t\t format.json { head :no_content }\n\t\tend\n end",
"def destroy\n @product = @product_image.product\n @product_image.destroy\n @product.reload\n render :partial => \"plain_index\", :object => @product and return\n end",
"def destroy\n @item ||= Item.find_by_id_or_name(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.destroy\n redirect_to user_products_path\n end",
"def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_items_url, :notice => 'Item was deleted.') }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product.destroy\n\n render json: @product, status: :ok#, location: @collection\n end",
"def destroy\n begin\n @price.destroy!\n render partial: 'list', layout: nil, locals: {product:@price.product}\n rescue ActiveRecord::InvalidForeignKey => e\n render partial:'layouts/flash_message',\n locals: {type:'error', message: t('errors.messages.delete_fail.being_used', model:'this price'), details: e},\n layout: nil, status: :unprocessable_entity\n return\n rescue ActiveRecord::StatementInvalid => e\n render partial:'layouts/flash_message',\n locals: {type:'error', message: t('errors.messages.ops'), details: e},\n layout: nil, status: :unprocessable_entity\n return\n end\n end",
"def destroy\n @food_item.destroy!\n head :no_content\n end",
"def destroy\n @ordereditem.destroy\n respond_to do |format|\n format.html { redirect_to ordereditems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item_product.destroy\n respond_to do |format|\n format.html { redirect_to line_item_products_url, notice: 'Line item product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @shop_for_item = @item.shop\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(@shop_for_item) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @news_item.destroy\n \n respond_to do |format|\n format.html { redirect_to news_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @lendingitem.destroy\n respond_to do |format|\n format.html { redirect_to lendingitems_url, notice: \"登録商品を削除しました.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @item = Item.find(params[:id])\r\n\r\n @item.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(items_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: '削除に成功しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to my_board_path, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Inventory.where(product: @product).delete_all\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_path, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove\n if @item.quantity == 1\n @item.destroy!\n else\n @item.decrement(:quantity)\n @item.save!\n end\n\n refresh\n end",
"def delete_item(item)\n @chores.delete(item)\n end",
"def destroy\n @ps = ProductsStore.find(params[:id])\n @ps.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product was successfully removed from store.' }\n format.json { head :ok }\n end\n end",
"def destroy\n @goods_item = Goods::Item.find(params[:id])\n @goods_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(goods_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @listitem.destroy\n head :no_content\nend",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to cart_path, notice: 'Item was successfully deleted.' }\n end\n end",
"def destroy\n @release_item.destroy\n respond_to do |format|\n format.html { redirect_to release_items_url, notice: 'Release item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | [
"0.7680399",
"0.72190475",
"0.7195138",
"0.70908844",
"0.7073573",
"0.7057036",
"0.7052004",
"0.70447594",
"0.701848",
"0.699856",
"0.6971172",
"0.69702005",
"0.69683886",
"0.69674927",
"0.6961126",
"0.6961052",
"0.69568515",
"0.694398",
"0.69366264",
"0.6933725",
"0.6905222",
"0.6905222",
"0.689319",
"0.6890824",
"0.686697",
"0.68489265",
"0.68434244",
"0.6835815",
"0.6833738",
"0.6833079",
"0.68177575",
"0.6791596",
"0.67896986",
"0.6778856",
"0.67644185",
"0.67620784",
"0.6741958",
"0.6737078",
"0.6733184",
"0.6731719",
"0.6729753",
"0.6721471",
"0.6718936",
"0.671276",
"0.67081887",
"0.66968393",
"0.66941017",
"0.6686779",
"0.6686779",
"0.66862816",
"0.6686124",
"0.6685932",
"0.6684487",
"0.6675809",
"0.6672627",
"0.66714424",
"0.6659043",
"0.66581935",
"0.66544646",
"0.6651265",
"0.66474336",
"0.66430086",
"0.66380525",
"0.6629946",
"0.6621869",
"0.6619666",
"0.66192615",
"0.6613698",
"0.6608605",
"0.6608244",
"0.66059107",
"0.660462",
"0.65980643",
"0.65978605",
"0.6594809",
"0.6594694",
"0.65892184",
"0.65855753",
"0.658316",
"0.6582058",
"0.65804565",
"0.65746385",
"0.6573054",
"0.657007",
"0.65672785",
"0.6566841",
"0.65660113",
"0.65624285",
"0.6560027",
"0.6558214",
"0.65565073",
"0.6556157",
"0.65554804",
"0.6553675",
"0.6548246",
"0.6546779",
"0.6537557",
"0.65349996",
"0.6534018",
"0.6524562",
"0.65200365"
] | 0.0 | -1 |
This action retrieve item value from database Story: Display new products( | def user_edit_item
@item = Item.find_by_id(params[:id])
@disable_auction_flag = true
@categories = Category.all
@item_categories = ItemCategory.find_all_by_item_id(@item.id)
@category_ids = @item_categories.collect{|c| c.category_id}
if(!@category_ids) then @category_ids=[] end
@search = Item.search(params[:search])
@keyword = params[:search]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getItem\n Product.select(:product).find(params[:id])\n end",
"def new\n\t\t@item = Product.new\n\tend",
"def products\n end",
"def item\n @item = Item.find(params[:id])\n end",
"def item\n @new = New.find(params[:id])\n end",
"def new\n @product = Product.init.with_user(current_user.id).first || Product.new\n @product.user = current_user\n @product.force_save\n\n return redirect_to(edit_product_path(@product))\n\n @page_title = \"Sell your product\"\n @product = Product.new\n @tags = Tag.main.with_children.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def make_item_list\n @data = $game_temp.forge_shop.products\n end",
"def product\n FarMar::Product.find(@product_id)\n end",
"def description\nitem=params[:item]\n@product=Product.where(\"item=?\",item).first;\n\nrender 'description', :layout => false\nend",
"def add_new_product\n array_product = @view.new_product_info\n new_product = Product.new(array_product[0],array_product[1],array_product[2])\n @seller.save_product_info(new_product)\n input = @view.menu(\"2\")\n seller_actions(input)\n end",
"def show\n \t@item = @orden_item.item\n end",
"def show\n @item \n end",
"def show\n @product = Product.find(params[:id])\n @[email protected]\n @[email protected]\n @cart_item = @current_cart.cart_items.new(product_id: @product.id, quantity:1)\n end",
"def item_show\n @item = Item.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n @pagetitle = \"Products - #{@product.name}\"\n \n end",
"def show\n @title = @gallery.title\n @shopping_cart_item = ShoppingCartItem.new\n end",
"def product\n nic_view.product\n end",
"def get_product\n @product = Product.find(params[:id])\n end",
"def set_product\n\t\t@product = Item.find(params[:id])\n\tend",
"def show \n \t@item = Item.find(params[:id])\n end",
"def show\r\n @product = Product.find(params[:id])\r\n end",
"def set_productitem\n @productitem = Productitem.find(params[:id])\n end",
"def show\n @item = Item.find(params[:id])\n end",
"def show\n @item = Item.find(params[:id])\n end",
"def show\n @item = Item.find(params[:id])\n end",
"def show\n @item = Item.find(params[:id])\n end",
"def show\n @item = Item.find(params[:id])\n end",
"def show\n @item = Item.find(params[:id])\n end",
"def show\n @item = Item.find(params[:id])\n end",
"def new\n @product_item = ProductItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product_item }\n end\n end",
"def new\n @item = Item.new \n @item.create_date = current_user.new_item_date\n @tags_to_display = \"\"\n end",
"def new\n get_product\n @product_detail = @product.details.new\n end",
"def show\n set_item\n end",
"def show\n @products = Product.find(params[:id])\n end",
"def show\n @product = Product.find_by(productID: params[:productID])\n end",
"def product(product)\n products.find(product.id)\n end",
"def get_result\n @product\n end",
"def product\n\t\t@product = Product.find( params[:id] )\n\t\tindex\n\t\trender :action => 'index'\n\tend",
"def show\n @products = @category.products\n end",
"def product\n FarMar::Product.find(self.product_id)\n end",
"def set_product\n @product = Product.find(params[:id])\n @item = Product.find(params[:id])\n end",
"def product\n @product ||= Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def show\n @product = Product.find(params[:id])\n end",
"def item\n fetch('sword_art_online.item')\n end",
"def show\n @product_item = ProductItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_item }\n end\n end",
"def index\n @product = Product.new\n set_products\n end",
"def show\n begin\n @product = Product.published.find(params[:id])\n rescue\n return render_not_found\n end\n @title = \"КАТАЛОГ // #{@product.name}\"\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @product }\n end\n end",
"def products\n find_products\n end",
"def item_new\n @brief = Brief.find(params[:brief_id])\n @item = Item.new\n @item.kind = params[:kind]\n @action_to = vendor_item_create_path(@brief,@item.kind)\n end",
"def show\n @item = find_item(params[:id])\n end",
"def show\n # @product = Product.find(params[:id])\n end",
"def show\n @line_item_products = LineItemProduct.all\n end",
"def show\n @title = @material_item.title\n @meta_keywords = @material_item.meta_keywords\n @meta_description = @material_item.meta_description\n end",
"def show\n @item=Item.find(params[:id])\n end",
"def show\n @product = Product.find(@params[:id])\n end",
"def fetch_product\n @product = Product.visible.find(params[:id]) if params[:id]\n end",
"def products_list\n\t\[email protected]_list\n\t\tproducts = @store.products\n\t\tproducts.each do |product|\n\t\t\tputs \"Name: #{product.name} ---> Price: #{product.price}\"\n\t\tend\n\t\[email protected]_view(@current_user, @current_user.actions)\n\tend",
"def title\n \"line item for #{product.name}\"\n end",
"def display_product\n STDOUT.puts \"--\"*50\n STDOUT.puts \"title: \\t\\t#{$title}\"\n STDOUT.puts \"seller: \\t#{$seller}\"\n STDOUT.puts \"price: \\t\\t#{$price}\"\n STDOUT.puts \"stars: \\t\\t#{$stars}\"\n STDOUT.puts \"reviews: \\t#{$reviews}\"\n STDOUT.puts \"image url: \\t#{$image_href}\"\n STDOUT.puts \"product url: \\t#{$url}\"\n end",
"def show\n \n @product = []\n @order.product_id.each do |z|\n a = Product.find(z[0])\n @product << a\n end\n @product\n @order\n end",
"def new\n @product = Product.find(params[:product_id])\n @line_item = LineItem.new(:product_id => @product.id)\n end",
"def new\n if params[:product_id]\n @badge.product = Product.find(params[:product_id])\n end\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @badge }\n end\n end",
"def set_new_item\n @new_item = NewItem.find(params[:id])\n end",
"def show\n @productshow = Product.find_by_id(params[:product_id])\n \n end",
"def add_new_product_menu\n puts \"Enter Product Title:\"\n p \">\"\n @product_title = set_field\n puts \"Enter The Produs's Price:\"\n p \">\"\n @product_price = set_field\n puts \"Enter The Customer's ID:\"\n p \">\"\n @customer_id = set_field\n\n add_new_product\n end",
"def set_product_item\n @product_item = @brand.items.find(params[:id])\n end",
"def show\n @product = Product.find_by(id: @order.product_id)\n end",
"def show\n @mt_product = MtProduct.find(params[:id])\n @product = @mt_product.product\n \n add_breadcrumb _(\"My products\").html_safe, :products_url\n add_breadcrumb @mt_product.product.name, edit_product_url(@mt_product.product)\n add_breadcrumb _(\"Environmental Assessment\").html_safe, mt_production_init_path(@mt_product)\n add_breadcrumb _(\"Data Quality\").html_safe, mt_data_quality_path(@mt_product)\n \n @step = 2\n if !@mt_product.mt_data_quality\n mt_data_quality = MtDataQuality.new \n mt_data_quality.mt_product_id = @mt_product.id\n mt_data_quality.save\n @mt_product.mt_data_quality = mt_data_quality\n end\n @mt_data_quality = @mt_product.mt_data_quality \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mt_data_quality }\n end\n end",
"def show\r\n @se_product = SeProduct.find(params[:id])\r\n @product = @se_product.product\r\n\r\n add_breadcrumb _(\"My products\").html_safe, :products_url\r\n add_breadcrumb @se_product.product.name, edit_product_url(@se_product.product)\r\n add_breadcrumb _(\"Environmental Assessment\").html_safe, se_production_init_path(@se_product)\r\n add_breadcrumb _(\"Data entry\").html_safe, se_manufacturing_url(@se_product)\r\n\r\n @se_use_product_datas = @se_product.se_use_product_datas\r\n\r\n if @se_product \r\n @step = 3\r\n if !@se_product.se_use_product\r\n se_use_product = SeUseProduct.new \r\n se_use_product.se_product_id = @se_product.id\r\n se_use_product.save\r\n @se_product.se_use_product = se_use_product \r\n end \r\n \r\n @se_use_product = @se_product.se_use_product\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @se_use_product }\r\n end\r\n end \r\n end",
"def show\n @products = @vendor.products\n end",
"def show\n @product = Product.find(params[:id])\n @line_item = LineItem.create!\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def new\n\t\t@product = Product.new\n\tend",
"def new\n\t\t@product = Product.new\n\tend",
"def new\n\t\t@product = Product.new\n\tend",
"def new\n\t\t@product = Product.new\n\tend",
"def new\n\t\t@product = Product.new\n\tend",
"def new\n @story = Story.new\n @sprints = Sprint.new\n @products = Product.find(:all, :select => \"id, name\")\n @sprints = Sprint.find(:all, :select => 'id, title')\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @story }\n end\n end",
"def load_product\n @product = Product.find(params[:product_id])\n end",
"def show\n @product = Product.find_by(serial_number: @lamp_stat.serial_num)\n end",
"def name\n @product.name\n end",
"def item;\n @item;\n end",
"def new\n session[:section] = 'new'\n @product = Product.new\n end",
"def catalog_item\n \tif params[:search]\n \t\t @products = Product.search(params[:search])\n \telse\n \t\t@products=Product.all\n \tend\n end",
"def create_product\n\t\tproduct_attributes = @view.creando_producto\n\t\[email protected]_product(product_attributes[0], product_attributes[1])\n\t\toption = @view.second_view(@current_user, @current_user.actions)\n\t\tlist(option)\n\tend",
"def show\n @order_product_histories = @order_product.order_product_histories\n end",
"def show\n begin\n set_product\n rescue ActiveRecord::RecordNotFound\n logger.error \"Attempt to access invalid product #{params[:id]}\"\n redirect_to products_path, :notice => 'Invalid product'\n end\n end",
"def product\n id = self.product_id\n found_product = FarMar::Product.find(id)\n return found_product\n end",
"def show\n @product = Product.all\n end",
"def load_item_data\n\n \n @product = CurrentInventory.find_by(product_id: params[:product_id])\n \n \n render :json => [@product.product.price, @product.current_quantity,@product.product.unit]\n end"
] | [
"0.70317197",
"0.6960265",
"0.6883615",
"0.6618395",
"0.66169274",
"0.6557527",
"0.654522",
"0.6531211",
"0.6527399",
"0.65147793",
"0.64786893",
"0.6449036",
"0.6445181",
"0.6443501",
"0.6425824",
"0.6416941",
"0.6393103",
"0.63783216",
"0.6374156",
"0.6348328",
"0.6342286",
"0.634052",
"0.6319983",
"0.6319983",
"0.6319983",
"0.6319983",
"0.6319983",
"0.6319983",
"0.6319983",
"0.63089305",
"0.63084906",
"0.63072497",
"0.6301676",
"0.62760127",
"0.6262112",
"0.6260222",
"0.6255219",
"0.62476206",
"0.62454635",
"0.6243684",
"0.6227137",
"0.6224521",
"0.62224025",
"0.62224025",
"0.62224025",
"0.62224025",
"0.62224025",
"0.62224025",
"0.62224025",
"0.62224025",
"0.62224025",
"0.62224025",
"0.62224025",
"0.62224025",
"0.62224025",
"0.62214655",
"0.6219261",
"0.6212016",
"0.62040234",
"0.61941344",
"0.6184905",
"0.6184897",
"0.61844903",
"0.6179395",
"0.6172653",
"0.61603737",
"0.6160033",
"0.6149056",
"0.6144895",
"0.6138953",
"0.613419",
"0.61321694",
"0.61292845",
"0.6129245",
"0.6128512",
"0.61166835",
"0.61097175",
"0.61044174",
"0.6102246",
"0.6093441",
"0.60908955",
"0.6087782",
"0.60852826",
"0.60773784",
"0.60773784",
"0.60773784",
"0.60773784",
"0.60773784",
"0.6074992",
"0.6072385",
"0.607012",
"0.60572225",
"0.60559285",
"0.6042039",
"0.60375756",
"0.6023244",
"0.6021334",
"0.6020474",
"0.6014353",
"0.6011916",
"0.6005846"
] | 0.0 | -1 |
This action retrieves all the items belonged to the user Story: Display new products( | def user_items_list
@items = Item.find_all_by_user_id(current_user.id)
@categories = Category.all
@search = Item.search(params[:search])
@keyword = params[:search]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_items_list\n @items = Item.where(:activated => true).sort{ |b,a| a.created_at <=> b.created_at } #TODO: Add availability\n @items = @items.first(16)\n #TODO: Once we have populated more data, maybe show 12 items instead of four\n @categories = Category.all\n @search = Item.search(params[:search])\n @keyword = params[:search]\n end",
"def make_item_list\n @data = $game_temp.forge_shop.products\n end",
"def products\n end",
"def products_list\n\t\[email protected]_list\n\t\tproducts = @store.products\n\t\tproducts.each do |product|\n\t\t\tputs \"Name: #{product.name} ---> Price: #{product.price}\"\n\t\tend\n\t\[email protected]_view(@current_user, @current_user.actions)\n\tend",
"def index\n @products = Product.salable_items\n end",
"def new\n @user= User.new\n @products= Product.limit(2)\n end",
"def index\n @product = Product.new\n set_products\n end",
"def index\n @products = current_user.products.all\n end",
"def home\n @products = Product.all\n end",
"def show\n @products = current_user.products\n @products_bidded = []\n bids = current_user.bids\n bids.each { |bid| @products_bidded.push(Product.find_by(id: bid.product_id)) }\n end",
"def index\n @kitchen_items = KitchenItem.all\n end",
"def new\n @product = Product.init.with_user(current_user.id).first || Product.new\n @product.user = current_user\n @product.force_save\n\n return redirect_to(edit_product_path(@product))\n\n @page_title = \"Sell your product\"\n @product = Product.new\n @tags = Tag.main.with_children.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def index\n @tb_products = Tb::Product.find_mine(params).paginate(page: params[:page])\n end",
"def index\n @products = current_user.products\n end",
"def index\n @product_items = @brand.items.all\n end",
"def new\n unread\n\n @product = Product.new\n @sellers = Seller.order('sellers.name ASC')\n @branches = Branch.order('branches.branch_name ASC')\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def index\n @bought_items = BoughtItem.all\n end",
"def show\n @line_item_products = LineItemProduct.all\n end",
"def products\n request :public, :get, :products\n end",
"def index\n @products = @site.products.all\n end",
"def show\n @items = Item.all\n end",
"def products\n Product.all\n end",
"def new\n @items = DoubleDog.db.all_items\n end",
"def new\n\t\t@item = Product.new\n\tend",
"def index\n @items = @sale.items\n end",
"def index\n @products = current_seller.product.all\n end",
"def new\n @users_products_wanted_action = UsersProductsWantedAction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users_products_wanted_action }\n end\n end",
"def index\n @matter_products = MatterProduct.all\n end",
"def index\n @products = @co.products\n end",
"def landing_page\n @products = Product.limit(3) \n end",
"def index\n @add_products = AddProduct.all\n end",
"def new\n @user = current_user\n @item = current_user.items.build\n respond_to do |format|\n format.json { render :json => @item }\n format.xml { render :xml => @item }\n format.html\n end\n end",
"def admin_view\n @products = Product.all\n end",
"def index\n @release_items = ReleaseItem.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n @products = Product.find_products_for_sale\n end",
"def index\n @shopping_items = ShoppingItem.all\n end",
"def index\n @items = Item.find_all_by_user_id(current_user.id)\n end",
"def index\n @own_products = OwnProduct.all\n end",
"def index\n @info_products = InfoProduct.all\n end",
"def index\n # Get all the products\n @products = Product.all\n end",
"def index\n @products = Product.all\n end",
"def index\n\t\t @items = Item.find_my_items(current_user) \n end",
"def index\n\t\t@products = Product.all\n\tend",
"def index\n @toodoo_items = ToodooItem.all\n end",
"def products\n find_products\n end",
"def new\n @item = Item.new\n @item.item_attachments.build\n @panels = Panel.where(\"active=?\", true)\n @items = Item.where(\"active=?\", true).order(\"title asc\")\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def new\n @item = current_user.items.build\n end",
"def items\n @items = current_user.items.paginate(:page => params[:page])\n end",
"def show\n @products = @merk_lensa.products.order(\"created_at ASC\").paginate(:page => params[:page], :per_page => 9)\n end",
"def all\n @products = Product.get_list_active_products.page(params[:page]).per(10)\n if @products.present?\n @products\n else\n @object = 'product'\n render \"api/v1/errors/404\", status: 401\n end\n end",
"def index\n @bugzillaproducts = Bugzillaproduct.all\n end",
"def index\n @saved_products = SavedProduct.all\n end",
"def index\n @inventory_products = InventoryProduct.all\n end",
"def index\n @basket_items = current_user.basket_items.includes(:product)\n @user = current_user\n end",
"def index\n @purchased_items = PurchasedItem.all\n end",
"def index\n @art_items = ArtItem.all\n end",
"def index\n @users_items = UsersItem.all\n end",
"def catalog_item\n \tif params[:search]\n \t\t @products = Product.search(params[:search])\n \telse\n \t\t@products=Product.all\n \tend\n end",
"def new\n @item = current_user.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @products = @category.products\n end",
"def get_items(product_id, params={})\n self.client.get(\"products/#{product_id}/items\", params)\n end",
"def index\n @hair_products = HairProduct.all\n end",
"def index\n @user_interactive_products = UserInteractiveProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_interactive_products }\n end\n end",
"def index\n @items = @user.items\n end",
"def show\n @order_item = current_order.order_items.new\n @add_texts = AddText.all\n @upload_logos = UploadLogo.all\n end",
"def index\n @items = Item.all\n end",
"def index\n @order = current_order\n @order_items = current_order.order_items\n @products = current_order.products\n end",
"def index\n @items = Item.all\n\n end",
"def new\n @item = Item.new\n @items = Item.all\n @tags = Tag.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def index\n @items = Item.all\n end",
"def index\n @items = Item.all\n end"
] | [
"0.67705184",
"0.6741289",
"0.6701766",
"0.6624291",
"0.6446135",
"0.643651",
"0.64198846",
"0.6419644",
"0.63942975",
"0.6392516",
"0.6390748",
"0.6375287",
"0.6348402",
"0.6347544",
"0.6347471",
"0.63335294",
"0.6318895",
"0.63040113",
"0.62916076",
"0.628253",
"0.62755126",
"0.62748706",
"0.62430036",
"0.6228559",
"0.62177795",
"0.62051654",
"0.61991245",
"0.61925507",
"0.619156",
"0.61892295",
"0.6187036",
"0.6178349",
"0.6178161",
"0.6178047",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.6175499",
"0.61648476",
"0.6157716",
"0.6154481",
"0.61534566",
"0.61509514",
"0.6146925",
"0.61254567",
"0.6124517",
"0.6122105",
"0.6113282",
"0.6108325",
"0.6104071",
"0.6098789",
"0.6092625",
"0.60871005",
"0.60809827",
"0.60795784",
"0.60795367",
"0.6075793",
"0.6071868",
"0.6071013",
"0.6069135",
"0.6052546",
"0.60408753",
"0.60401815",
"0.60337114",
"0.6032",
"0.6031417",
"0.60312325",
"0.6020919",
"0.60207057",
"0.60194385",
"0.60185003",
"0.6015467",
"0.60148364",
"0.6008325",
"0.6008325"
] | 0.0 | -1 |
This action create the item adding form for users Story: Display new products( | def new_item
@item=Item.new
@categories = Category.all
if(!@category_ids) then @category_ids=[] end
@search = Item.search(params[:search])
@keyword = params[:search]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @product = Product.find(params[:product_id])\n @item = current_user.items.new(item_params)\n if @item.save\n redirect_to @product, success: 'Item was successfully created.'\n else\n redirect_to @product, alert: 'Все проебал'\n end\n end",
"def add_new_product\n array_product = @view.new_product_info\n new_product = Product.new(array_product[0],array_product[1],array_product[2])\n @seller.save_product_info(new_product)\n input = @view.menu(\"2\")\n seller_actions(input)\n end",
"def create\n\t\t@item = Product.create(product_params)\n\t\tif @item.errors.empty?\n\t\t\tredirect_to product_path(@item)\n\t\telse\n\t\t\trender \"new\"\n\t\tend\n\tend",
"def new\n\t\t@item = Product.new\n\tend",
"def new\n @item = current_user.items.build\n end",
"def create\n @item = Item.new(item_params)\n if @item.save\n flash[:success] = \"項目已新增!\"\n redirect_to root_url\n else\n flash[:danger] = \"新增失敗!\"\n @submit_text = \"新增\"\n render 'new'\n end\n end",
"def create\n @item = current_user.items.build(item_params)\n if @item.save\n redirect_to items_path, notice: 'Item was successfully created.'\n else\n render :new, notice: 'Something went wrong try again.'\n end\n end",
"def create\n\t \t@item = Item.new(item_params)\n\t \tif @item.save\n\t \t\tredirect_to items_path\n\t \telse\n\t \t\trender action: \"new\"\n\t \tend\n\t end",
"def create\n @user = User.find(current_user.id)\n @item = @user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/items', notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_new_product_menu\n puts \"Enter Product Title:\"\n p \">\"\n @product_title = set_field\n puts \"Enter The Produs's Price:\"\n p \">\"\n @product_price = set_field\n puts \"Enter The Customer's ID:\"\n p \">\"\n @customer_id = set_field\n\n add_new_product\n end",
"def add(product)\n items.create(product: product)\n end",
"def new\n @user = current_user\n @item = current_user.items.build\n respond_to do |format|\n format.json { render :json => @item }\n format.xml { render :xml => @item }\n format.html\n end\n end",
"def create\r\n @item = Item.new(params[:item])\r\n if @item.save\r\n redirect_to @item, notice: 'Item was successfully created.'\r\n else\r\n render action: \"new\"\r\n end\r\n end",
"def create\n @item = current_user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to root_path, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n @toy = Toy.new(item_params) \n if @toy.save \n flash[:notice] = 'Product added!' \n redirect_to \"toys#new\" \n else \n flash[:error] = 'Failed to edit product!' \n render :new \n end \n end",
"def new\n\t@item = Item.new(:number => 1, :user_id => current_user.id )\n\trender :layout => 'form' \n end",
"def create\n # @item = Item.new(item_params)\n @item = current_user.items.build(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_item = ProductItem.new(params[:product_item])\n\n respond_to do |format|\n if @product_item.save\n format.html { redirect_to @product_item, :notice => 'Product item was successfully created.' }\n format.json { render :json => @product_item, :status => :created, :location => @product_item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def item_create\n @brief = Brief.find(params[:brief_id])\n @brief_vendor = @brief.brief_vendors.find_by_org_id(@cur_user.org_id)\n invalid_op unless @brief_vendor\n @brief_vendor.items << Item.new(params[:item]){|r|r.kind = params[:kind]}\n redirect_to vendor_show_brief_path(@brief)\n end",
"def create\n @part_types = Constants::PART_TYPES\n @item = Item.new(item_params.merge(user_id: current_user.id))\n \n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(params[:product])\n respond_to do |format|\n if @product.save\n current_user.user_info.products.push @product\n Shopify.create @product\n format.html { redirect_to :action => 'index' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = current_user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n \n if @item.save\n redirect_to @item\n else\n render :new\n end\n end",
"def create\n \t\n \t@item=Item.new(item_params)\n \t\n \tif @item.save\n \t\tredirect_to(:action=>'display')\n \telse\n \t\trender('new')\n \tend\t\n \n end",
"def create\n @users_item = UsersItem.new(users_item_params)\n\n respond_to do |format|\n if @users_item.save\n format.html { redirect_to @users_item, notice: 'Users item was successfully created.' }\n format.json { render :show, status: :created, location: @users_item }\n else\n format.html { render :new }\n format.json { render json: @users_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @addon_list_item = AddonListItem.new(product_add_on_list_item_params)\n\n respond_to do |format|\n if @addon_list_item.save\n format.html { redirect_to @addon_list_item, notice: 'Product add on list item was successfully created.' }\n format.json { render :show, status: :created, location: @addon_list_item }\n else\n format.html { render :new }\n format.json { render json: @addon_list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @current_user = current_user\n\n # @product = Product.new(product_params)\n @product = @current_user.products.new(product_params)\n\n if @product.save\n redirect_to @product\n else\n render 'new'\n end\n end",
"def create\n @item = Item.new(item_params)\n @item.save\n redirect_to @item\n end",
"def create\n @product = current_user.products.build(product_params)\n if @product.save\n flash[:success] = 'Contato criado com sucesso.'\n redirect_to user_products_path\n else\n render 'new'\n end\n end",
"def create\n @item = current_user.items.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html do\n flash[:alert] = 'Something went wrong while creating an item.'\n render action: \"new\"\n end\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = current_user.items.build(item_params)\n\n\n respond_to do |format|\n if @item.save\n\n format.html { redirect_to edit_pics_path(:id => @item.id), notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n @item.user = current_user\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(@params[:product])\n if @product.save\n flash['notice'] = 'Product was successfully created.'\n redirect_to :action => 'list'\n else\n render_action 'new'\n end\n end",
"def new\n @product = Product.init.with_user(current_user.id).first || Product.new\n @product.user = current_user\n @product.force_save\n\n return redirect_to(edit_product_path(@product))\n\n @page_title = \"Sell your product\"\n @product = Product.new\n @tags = Tag.main.with_children.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product }\n end\n end",
"def create\n @add_product = AddProduct.new(add_product_params)\n\n respond_to do |format|\n if @add_product.save\n format.html { redirect_to @add_product, notice: 'Add product was successfully created.' }\n format.json { render :show, status: :created, location: @add_product }\n else\n format.html { render :new }\n format.json { render json: @add_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @add_product = AddProduct.new(params[:add_product])\n\n respond_to do |format|\n if @add_product.save\n format.html { redirect_to @add_product, notice: 'Add product was successfully created.' }\n format.json { render json: @add_product, status: :created, location: @add_product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @add_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params.require(:item).permit(:name, :description, :image_tag))\n if @item.save\n flash[:notice] = \"아이템이 등록되었습니다\"\n redirect_to items_path\n else\n render 'new'\n end\n end",
"def item_new\n @brief = Brief.find(params[:brief_id])\n @item = Item.new\n @item.kind = params[:kind]\n @action_to = vendor_item_create_path(@brief,@item.kind)\n end",
"def create\n @intowel = Intowel.find(params[:intowel_id])\n \n #verifica se o produto foi selecionado\n if item_params[:product_id].blank?\n flash[:warning] = 'Selecione o item desejado!'\n redirect_to intowel_path(@intowel) and return\n end\n \n #verifica se já existe o mesmo item adicionado na venda\n check_item = Item.where(intowel_id: @intowel.id, product_id: item_params[:product_id])\n if check_item.present?\n flash[:warning] = 'Este item já foi adicionado!'\n redirect_to intowel_path(@intowel) and return\n end\n \n if item_params[:qnt].blank?\n flash[:warning] = 'Informe uma quantidade para o item selecionado!'\n redirect_to intowel_path(@intowel) and return\n end\n \n @item = @intowel.items.create(item_params)\n redirect_to intowel_path(@intowel)\n end",
"def generate_sales_entry_add_product_form\n @item= Item.find_by_id params[:selected_item_id]\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n @new_object = SalesEntry.new \n end",
"def create\n @item = Item.new(params[:item])\n @item.user = current_user\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @item = Item.new \n @item.create_date = current_user.new_item_date\n @tags_to_display = \"\"\n end",
"def create\n @item = current_owner.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'Item was created successfully' }\n format.json { render :show, status: :created, location: items_path }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def single_item_action_add_form_fields(form, document)\n single_item_action_form_fields(form, document, 'add')\n end",
"def create\n\n \t\t@item = current_user.items.build(item_params)\n \t\tif @item.save\n \t\t\tflash[:success] = \"Item created!\"\n \t\t\tredirect_to items_path\n \t\telse\n \t\t\t@feed_items = []\n \t\t\trender 'static_pages/home'\n \t\tend\n \tend",
"def create\n @item = Item.new(item_params)\n @item.user_id = current_user.id\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n begin\n params[:subproduct][:created_by_user_id] = current_user.id\n @subproduct = Subproduct.new(params[:subproduct])\n if @subproduct.save\n flash[:notice] = \"#{t(:text_module)} \" \"#{t(:flash_was_successful)} \"\" #{t(:text_created)}\"\n redirect_to :action => 'index'\n else\n render :action=> 'new'\n end\n rescue => ex\n end\n end",
"def create\n @item = current_user.items.build(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to home_path }\n format.xml { head :created, :location => item_url(@item) }\n else\n format.html { render :action=>:new }\n format.xml { render :xml=>@item.errors.to_xml }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n @category = Category.find(params[:category]) unless params[:category].nil?\n respond_to do |format|\n if @item.save\n @category.items << @item if @category\n current_user.items << @item\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n# authorize @item\n @item.user = current_user \n if @item.save\n flash[:notice] = \"\\\"#{@item.name}\\\" was added to your registry.\"\n else\n flash[:error] = \"There was a problem adding the item to your registry. Please try again.\"\n end\n redirect_to user_registry_path(current_user.link_id)\n end",
"def create\n\n @item = Item.new(params[:item])\n @item.user_id = current_user.id\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/main', :notice => 'Item was successfully created.' }\n format.json { render :json => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @release_item = ReleaseItem.new(release_item_params)\n\n respond_to do |format|\n if @release_item.save\n format.html { redirect_to @release_item, notice: 'Release item was successfully created.' }\n format.json { render :show, status: :created, location: @release_item }\n else\n format.html { render :new }\n format.json { render json: @release_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_interactive_product = UserInteractiveProduct.new(params[:user_interactive_product])\n\n respond_to do |format|\n if @user_interactive_product.save\n format.html { redirect_to @user_interactive_product, notice: 'User interactive product was successfully created.' }\n format.json { render json: @user_interactive_product, status: :created, location: @user_interactive_product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_interactive_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wish_list = current_user.wish_list\n product = Product.find(params[:product_id])\n @wish_list_item = @wish_list.add_product(product.id, @wish_list)\n\n if @wish_list_item.present?\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_list,\n :notice => 'Wish list item was successfully created.') }\n format.json { render :show, status: :created, location: @wish_list_item }\n else\n format.html { render :new }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to wish_list_path(@wish_list)\n end\n end",
"def create\n @form_item = @template.form_items.build(form_item_params)\n\n respond_to do |format|\n if @form_item.save\n format.html { redirect_to template_path(@template, anchor: :additem), notice: 'Form item was successfully created.' }\n format.json { render :show, status: :created, location: @form_item }\n else\n format.html { render :new }\n format.json { render json: @form_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = build_item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'アップロードしたでー' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_product\n\t\tproduct_attributes = @view.creando_producto\n\t\[email protected]_product(product_attributes[0], product_attributes[1])\n\t\toption = @view.second_view(@current_user, @current_user.actions)\n\t\tlist(option)\n\tend",
"def add_item\n\t\tcurrent_user.saved.items.push(Item.find(params[:item]))\n\t\tredirect_to :back\n\tend",
"def create\n @product = current_user.products.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_item = @brand.items.new(product_item_params)\n\n if @product_item.save\n render :show, status: :created, location: [:partner, @brand, @product_item]\n else\n render json: @product_item.errors, status: :unprocessable_entity\n end\n end",
"def new\n # only cause i use a form_for in the view\n @new_product = Product.new\n end",
"def create\n @product = Product.new(params[:product])\n render_after_save('new')\n end",
"def create\n @item = Item.new(params[:item])\n @item.user = current_user\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, :notice => 'Item was successfully created.' }\n format.json { render :json => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t#binding.pry\n\t\t@product = Product.new(product_params)\n\t\tif @product.save\n\t\t\tredirect_to products_path(@product.id)\n\t\telse\n\t\t\trender action: \"new\"\n\t\tend\n\tend",
"def create\n @product = Product.new(product_params)\n if @product.save\n flash[:notice] = \"successfully\"\n redirect_to owners_product_path\n else\n render :new\n end\n end",
"def add_new_product\n aProduct = Product.new(@product_title, @product_price, @customer_id)\n aProduct.create_new_product\n end",
"def create\n @product = Product.new(params[:product])\n\n if @product.save\n flash[:notice] = 'Product was successfully created.'\n redirect_to :action => 'list'\n else\n render :action => \"new\"\n end\n end",
"def new\n @item = current_user.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end",
"def create\n @product = Product.new(params[:product].merge :user_id => current_user.id)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to root_url, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def item_create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to item_index_path, notice: 'O item foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :item_new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item\n else\n render json: { error: t('story_create_error') }, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@product = Product.new(product_params)\n\t\tif @product.save\n\t\t\tredirect_to product_path(@product.id), notice: \"The product has successfully created\"\n\t\telse\n\t\t\trender action: 'new'\n\t\t\t\n\t\tend\n\tend",
"def create\n if !self.auth_admin\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to item_path(@item), notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n end\n end\n end\n end",
"def new\n if current_user.inventory\n redirect_to edit_inventory_path(current_user.inventory)\n return\n end\n \n @inventory = Inventory.new\n @inventory.user = current_user\n @inventory.build_suggested_items\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @inventory }\n end\n end",
"def create\n @product = Product.new(@editable_params)\n\n if @product.save\n @product_section = 'options'\n render :template => 'manage/products/options_images_form' and return\n else\n prepare_products(25,'any')\n render :template => 'manage/products/index' and return\n end\n end",
"def add_product(product)\n products << product\n # save\n end",
"def create\n @item = Item.new(item_params) #Remember to add Session[user_id]\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n product = Product.find(params[:product_id])\n qty = (params[:qty] || '1').to_i\n @line_item = @cart.add_product(product, qty)\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to cart_url,\n notice: \"#{product.title} wurde in Deinen Warenkorb gelegt.\" }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n if @product.save\n flash[:success] = \"New product created\"\n redirect_to admin_products_path\n else\n render :'admin/products/new'\n end\n end",
"def create\n\t\t@product = Product.new(product_params)\n\t\tif @product.save\n\t\t\t\n\t\t\tredirect_to product_path(@product.id)\n\t\telse\n\t\t\trender action: \"new\"\n\t\tend\n\tend",
"def create \n #whitelist params and save them to a variable \n item_params = params.require(:item).permit(:name, :category, :image, :price)\n #create a new item from 'item_params'\n @item = Item.new(item_params)\n #if item saves, render the new item in JSON\n if @item.save \n render json: @item\n end\n end",
"def create\n @item = current_user.items.create(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to [current_user, @item], notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n @item.pictures.build\n format.html { render action: 'new', :locals => {item:@item} }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @my_product = current_user.products.new(my_product_params)\n\n if @my_product.save\n render :show, status: :created\n else\n render json: @my_product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @tuhu_product = Tuhu::Product.new(tuhu_product_params)\n\n respond_to do |format|\n if @tuhu_product.save\n format.html { redirect_to @tuhu_product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @tuhu_product }\n else\n format.html { render :new }\n format.json { render json: @tuhu_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:item][:user_id] = current_user.id\n # @user = User.find(params[:id])\n\n @item = Item.create(item_params)\n\n redirect_to \"/items/#{@item.id}\"\n end",
"def add_item\n\t\tputs \"Welcome to the Jones market\"\n\t\tputs \" \"\n\t\tputs \"please input product name\"\n\t\tproduct_name = gets.chomp\n\t\tputs \"please input the price\"\n\t\tprice = gets.chomp.to_i\n\n\t\tproduct_type(product_name, price)\n\tend",
"def labAddProduct\n @productos = Producto.all\n render :template => \"lab_fars/productoadd\"\n end",
"def create\n @item = Item.new(item_params)\n @item.user_id = current_user.id\n @item.price = @item.price.to_i * 10\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end",
"def new\n @product = Product.new\n end"
] | [
"0.71805793",
"0.70713043",
"0.6925698",
"0.68977505",
"0.6861191",
"0.6843004",
"0.6742233",
"0.6736598",
"0.670994",
"0.66938066",
"0.6651783",
"0.66513383",
"0.6647978",
"0.6633054",
"0.65940845",
"0.6587499",
"0.6557523",
"0.65314007",
"0.6524832",
"0.65247834",
"0.6523391",
"0.65233433",
"0.65063596",
"0.6492964",
"0.6482767",
"0.64528877",
"0.64379215",
"0.6430829",
"0.6426906",
"0.64161485",
"0.64084595",
"0.640633",
"0.640594",
"0.64058244",
"0.6405554",
"0.6403599",
"0.63915265",
"0.63872486",
"0.63864374",
"0.6378165",
"0.63736886",
"0.6366248",
"0.63661015",
"0.63652736",
"0.6363112",
"0.63626945",
"0.63615054",
"0.6360253",
"0.6350548",
"0.6328386",
"0.6314244",
"0.630854",
"0.6305845",
"0.6298654",
"0.62950176",
"0.6293738",
"0.6293664",
"0.62929493",
"0.62801313",
"0.6278599",
"0.62782925",
"0.6271732",
"0.62715507",
"0.6267799",
"0.6265459",
"0.62469095",
"0.6240016",
"0.62293243",
"0.62153304",
"0.62150276",
"0.6214758",
"0.6214158",
"0.6210934",
"0.6203525",
"0.6202981",
"0.6190647",
"0.6187705",
"0.6186759",
"0.61859363",
"0.6185929",
"0.61800885",
"0.61760515",
"0.61727434",
"0.6169204",
"0.6165588",
"0.6162879",
"0.61620176",
"0.6158893",
"0.6157936",
"0.6157936",
"0.6157936",
"0.6157936",
"0.6157936",
"0.6157936",
"0.6157936",
"0.6157936",
"0.6157936",
"0.6157936",
"0.6157936",
"0.6157936",
"0.6157936"
] | 0.0 | -1 |
This action sets values that are used by detail of item page Story: Display detail of item( | def show
@item=Item.find(params[:id])
@search = Item.search(params[:search])
@keyword = params[:search]
if @item.nil? or @item.activated==false
redirect_to(:controller => 'home',:action => 'index')
else
@categories=Category.all
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detail_item= item\n @detail_item = item\n configure_view\n end",
"def show\n set_item\n end",
"def show\n @title = @material_item.title\n @meta_keywords = @material_item.meta_keywords\n @meta_description = @material_item.meta_description\n end",
"def show\n \t@item = @orden_item.item\n end",
"def set_item\n @item = Item.friendly.find(params[:id])\n end",
"def set_item\n @item = Item.friendly.find(params[:id])\n end",
"def show\n @item \n end",
"def set_item\n @item = model.find(params[:id])\n\n @url_back = url_list\n end",
"def show \n \t@item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n #Rails.logger.debug \"DEBUG: params are #{@item}\"\n end",
"def set_action_item\n @action_item = ActionItem.find(params[:id])\n end",
"def set_item\r\n @item = Item.find(params[:id])\r\n end",
"def item_show\n @item = Item.find(params[:id])\n end",
"def show\n dummy_item\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n\t\t@item = Item.find(params[:id])\n\tend",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end"
] | [
"0.78373253",
"0.73783684",
"0.68501735",
"0.6783934",
"0.6762676",
"0.6762676",
"0.66243714",
"0.648726",
"0.64572513",
"0.6456295",
"0.6452428",
"0.64067936",
"0.6402815",
"0.637275",
"0.6359945",
"0.6357888",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706",
"0.63498706"
] | 0.0 | -1 |
This action retrieves the item information from new item for a seller page and stores it in the database This will be used in a future story card | def create
@item = Item.new(params[:item])
@message = @item.validate();
if(@message)
redirect_to(user_items_new_path,:notice => @message)
else
@search = Item.search(params[:search])
@categories = Category.all
@mycategories = params[:category]
if(!@mycategories) then @mycategories = [] end
int_array = @mycategories.collect{|s| s.to_i}
puts "___________________________________________"
puts @item
if @item.save
@categories.each do|category|
if(int_array.include?(category.id))
then
ItemCategory.create(:category_id=>category.id, :item_id=>@item.id)
end
end
if(@item.auction_flag==true)
@auction = Auction.create(:bid_amount=>@item.price, :item_id=>@item.id, :seller_id=>current_user.id, :state=>0, :end_time=> Time.now+ 1000)
#TODO: Do not hard code end time
@item.auction_id = @auction.id
if [email protected]
end
end
redirect_to(:action => 'show', :id => @item.id)
else
render action: "new_item"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @item = Item.new(item_params)\n @item.seller_id = current_seller.id\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n @item.seller_id = current_user.id\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if current_user && current_user.seller\n create_item\n else\n redirect_to root_path\n end\n end",
"def create\n @household_item = HouseholdItem.new(household_item_params)\n @household_item.seller = current_user\n respond_to do |format|\n if @household_item.save\n format.html { redirect_to @household_item, notice: 'Household item was successfully listed.' }\n format.json { render :show, status: :created, location: @household_item }\n else\n format.html { render :new }\n format.json { render json: @household_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_new_item\n @new_item = NewItem.find(params[:id])\n end",
"def create\n i = Item.new\n i.title = params[\"title\"]\n i.description = params[\"desc\"]\n i.save\n redirect_to recommendations_url\n end",
"def create\n\n \t\t@item = current_user.items.build(item_params)\n \t\tif @item.save\n \t\t\tflash[:success] = \"Item created!\"\n \t\t\tredirect_to items_path\n \t\telse\n \t\t\t@feed_items = []\n \t\t\trender 'static_pages/home'\n \t\tend\n \tend",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n @item.save_info\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end \n end",
"def get_new_barcode\n # @item = Item.new\n # redirect_to get_new_item_info_path(@item)\n end",
"def create\n @item = Item.new(item_params)\n @user = User.find_by_id(session[:user_id]) if session[:user_id]\n\n @item.rating = 0\n @item.rating_count = 0\n @item.current_amount = item_params[:max_amount]\n @item.user = @user #This is the owner of the item\n respond_to do |format|\n if @item.save\n format.html { redirect_to user_supplier_path_url(@user)}\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = current_owner.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'Item was created successfully' }\n format.json { render :show, status: :created, location: items_path }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def item\n @item = Item.find(params[:id])\n end",
"def create\n @bought_item = BoughtItem.new(bought_item_params)\n\n respond_to do |format|\n if @bought_item.save\n format.html { redirect_to @bought_item.apartment, notice: 'Bought item was successfully created.' }\n format.json { render :show, status: :created, location: @bought_item }\n else\n format.html { render :new }\n format.json { render json: @bought_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def giveItem\n toLocation = Company.where(name: params[:recepCompany]).first.locations.where(address: params[:recepLocation]).first\n location = current_company.locations.where(id: params[:locationId]).first\n if(location.is_supplier === true)\n updatedItem = location.items.where(name: params[:name]).first\n toUpdatedItem = toLocation.items.where(name: params[:name]).first\n if(toUpdatedItem.present? && updatedItem.amount > params[:amount].to_i)\n updatedItem.increment!(:amount, -params[:amount].to_i)\n toUpdatedItem.increment!(:amount, params[:amount].to_i)\n elsif(updatedItem.amount > params[:amount].to_i)\n updatedItem.increment!(:amount, -params[:amount].to_i)\n item = Item.create(name: params[:name], amount:params[:amount].to_i, price: updatedItem.price, autoRestock: false, lastSupplier:location.id)\n toLocation.items << item\n end\n if(updatedItem.amount <= updatedItem.restockPoint)\n changeItemSupplier(updatedItem.id)\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n @item.save\n redirect_to @item\n end",
"def create\n\n @item = Item.new(params[:item])\n\n if([email protected]? && @item.borrower != \"\")\n UserMailer.loaned_notification_email(current_user, @item).deliver\n end\n\n current_user.items.push @item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(root_path, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\r\n @item = Item.new(params[:item])\r\n\r\n respond_to do |format|\r\n if @item.save\r\n format.html { render :action => \"initauction\"}\r\n format.xml { render :xml => @item, :status => :created, :location => @item }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n\r\n end",
"def new\n @item = Item.new \n @item.create_date = current_user.new_item_date\n @tags_to_display = \"\"\n end",
"def create\r\n @item = Item.new(params[:item])\r\n if @item.save\r\n redirect_to @item, notice: 'Item was successfully created.'\r\n else\r\n render action: \"new\"\r\n end\r\n end",
"def create\n @product_item = @brand.items.new(product_item_params)\n\n if @product_item.save\n render :show, status: :created, location: [:partner, @brand, @product_item]\n else\n render json: @product_item.errors, status: :unprocessable_entity\n end\n end",
"def create\n @item = Item.new(item_params)\n \n if @item.save\n redirect_to @item\n else\n render :new\n end\n end",
"def new\n @item = Item.new\n end",
"def new\n @item = Item.new\n end",
"def new\n @item = Item.new\n end",
"def new\n @item = Item.new\n @shop = Shop.find(params[:shop_id])\n @item.shop = @shop\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def create\n @item = Item.new(item_params) #Remember to add Session[user_id]\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_info = ItemInfo.new(params[:item_info])\n\n respond_to do |format|\n if @item_info.save\n format.html { redirect_to @item_info, notice: 'Item info was successfully created.' }\n format.json { render json: @item_info, status: :created, location: @item_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t \t@item = Item.new(item_params)\n\t \tif @item.save\n\t \t\tredirect_to items_path\n\t \telse\n\t \t\trender action: \"new\"\n\t \tend\n\t end",
"def new\n @item = Item.find(params[:item_id])\n @booking = Booking.new\n end",
"def create\n @item = Item.new(params[:item])\n\n if @item.save\n redirect_to :back\n end\n end",
"def set_item\n @item = Item.find_by(identifier: params[:id])\n end",
"def create\n @item = Item.from_url(item_params[:url])\n @item.user = current_user\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def buying_item item_name\n @buying_results_parser.read @querier.buying_item(item_name)\n end",
"def set_bought_item\n @bought_item = BoughtItem.find(params[:id])\n end",
"def create_item(name, price)\r\n new_item = Models::Item.created( name, price, self )\r\n self.item_list.push(new_item)\r\n new_item.save\r\n return new_item\r\n end",
"def item\n @new = New.find(params[:id])\n end",
"def create\n \t\n \t@item=Item.new(item_params)\n \t\n \tif @item.save\n \t\tredirect_to(:action=>'display')\n \telse\n \t\trender('new')\n \tend\t\n \n end",
"def create\n @user = User.find(current_user.id)\n @item = @user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/items', notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def new\n @item = current_user.items.build\n end",
"def new\n set_seller_listing\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seller_listing }\n end\n end",
"def create\n @item = current_user.items.build(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to home_path }\n format.xml { head :created, :location => item_url(@item) }\n else\n format.html { render :action=>:new }\n format.xml { render :xml=>@item.errors.to_xml }\n end\n end\n end",
"def new\n @item = Item.new\n end",
"def create\n @bid_item = BidItem.new(bid_item_params)\n @bid_item.seller_id = current_user.id\n @bid_item.current_price = @bid_item.starting_price\n respond_to do |format|\n if @bid_item.save\n format.html { redirect_to @bid_item, notice: 'Bid item was successfully created.' }\n format.json { render :show, status: :created, location: @bid_item }\n else\n format.html { render :new }\n format.json { render json: @bid_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_item\r\n @item = Item.find(params[:id])\r\n end",
"def create\n if params[:item].present?\n # TODO - see impact\n @item = Item.new(params[:item])\n @item.user_id = current_user.id if current_user.present?\n\n # TODO Commented shipping information because of REQUIREMENT CHANGE (https://www.pivotaltracker.com/story/show/62299176)\n \n # @item.bring_it_to_you = params[:item][:bring_it_to_you] if params[:item][:bring_it_to_you].present?\n # @item.come_and_get_it = params[:item][:come_and_get_it] if params[:item][:come_and_get_it].present?\n # @item.lets_meet_up = params[:item][:lets_meet_up] if params[:item][:lets_meet_up].present?\n # @item.come_to_you = params[:item][:come_to_you] if params[:item][:come_to_you].present?\n # @item.come_to_me = params[:item][:come_to_me] if params[:item][:come_to_me].present?\n # @item.done_remotely = params[:item][:done_remotely] if params[:item][:done_remotely].present?\n # @item.ship_it = params[:item][:ship_it] if params[:item][:ship_it].present?\n # @item.lets_meet_service = params[:item][:lets_meet_service] if params[:item][:lets_meet_service]\n\n if @item.user.nil? and params[:user_id] and params[:user_id] != ''\n @item.user_id = params[:user_id]\n end\n if not @item.user_id.present? and session[:guest_user_id].to_i > 0\n @item.user_id = session[:guest_user_id].to_i\n end\n # if params[:multi_trade] and params[:multi_trade] == \"on\"\n # @item.is_single_tradeya = false\n # end\n if params[:item][:tod_id].blank?\n @item.exp_date = Item.get_expiry_date_for_tod\n @item.status = \"LIVE\"\n else\n @item.tod = false\n @item.status = \"ACTIVE\"\n end\n respond_to do |format|\n if ((params[:captcha] and params[:item][:tod_id]) or params[:item][:tod_id].nil?) and not @item.user_id.blank?\n if @item.desc == \"Add more details about your good or service here...\" then @item.desc = \"\" end\n if @item.save\n\n # sbx tracking pixel fire\n if current_user.tracking_infos.where(affiliate:'sbx').present?\n Resque.enqueue(FireTrackingPixelJob, current_user.id, 'post')\n end\n\n chk = false\n # Case 1 - Old Offer - edit\n\n # Case 2 - New Tradeya/Offer but item selected from dropdown\n if params[:item][:selected_item_id].to_i > 0 or params[:item][:have].to_i > 0\n create_new = true\n # Create new record for item photos\n end\n # Case 3 - New Tradeya/Offer\n if params[:item_photos].present?\n photos = JSON.parse(params[:item_photos])\n if photos and photos.count > 0\n photos.each_with_index do |photo,index|\n existing_ph = ItemPhoto.find(photo[\"id\"])\n if create_new and existing_ph.item_id.present?\n ph = ItemPhoto.new\n ph.photo = existing_ph.photo\n ph.width = existing_ph.width; ph.height = existing_ph.height;\n ph.crop_x = existing_ph.crop_x; ph.crop_y = existing_ph.crop_y;\n ph.crop_w = existing_ph.crop_w; ph.crop_h = existing_ph.crop_h;\n else\n ph = existing_ph\n end\n if ph.present?\n ph.item_id = @item.id\n if index == 0\n ph.main_photo = true\n end\n ph.save\n chk = true\n end\n end\n end\n end\n if params[:item_videos].present?\n videos = JSON.parse(params[:item_videos])\n if videos and videos.count > 0\n videos.each do |video|\n existing_vi = ItemVideo.find(video[\"id\"])\n if create_new and existing_vi.item_id.present?\n vi = ItemVideo.new\n vi.video = existing_vi.vi\n else\n vi = existing_vi\n end\n if vi.present?\n vi.item_id = @item.id\n vi.save\n chk = true\n end\n end\n end\n end\n # TODO - read below and make it like below\n\n # if params[:file_type] == \"photo\"\n # if params[:item][:item_photo] and params[:item][:item_photo][:id] and params[:item][:item_photo][:id].to_i > 0\n # ip = ItemPhoto.find(params[:item][:item_photo][:id])\n # ip.item_id = @item.id\n # ip.save\n # chk = true\n # elsif params[:item][:item_photo]\n # if params[:item][:item_photo][:photo]\n # o = ItemPhoto.new(params[:item][:item_photo])\n # o.item_id = @item.id\n # o.save\n # chk = true\n # end\n # end\n # elsif params[:file_type] == \"video\"\n # if params[:item][:item_video] and params[:item][:item_video][:id] and params[:item][:item_video][:id].to_i > 0\n # o = ItemVideo.find(params[:item][:item_video][:id])\n # o.item_id = @item.id\n # o.save\n # chk = true\n # elsif params[:item][:item_video]\n # if params[:item][:item_video][:video]\n # o = ItemVideo.new(params[:item][:item_video])\n # o.item_id = @item.id\n # o.save\n # chk = true\n # end\n # end\n # end\n\n if not chk and params[:item][:selected_item_id].to_i > 0\n itm = Item.find(params[:item][:selected_item_id])\n if itm.item_videos and itm.item_videos.count > 0\n o = ItemVideo.new\n if File.exist?(itm.item_videos[0].video.path)\n o.video = File.open(itm.item_videos[0].video.path)\n else\n o.video_from_url(itm.item_videos[0].video.url)\n end\n o.item_id = @item.id\n o.save\n elsif itm.item_photos and itm.item_photos.count > 0\n o = ItemPhoto.new\n if File.exist?(itm.item_photos[0].photo.path)\n o.photo = File.open(itm.item_photos[0].photo.path)\n else\n o.photo_from_url(itm.item_photos[0].photo.url)\n end\n o.item_id = @item.id\n o.save\n end\n end\n\n # if params[:item_wants] and params[:item_wants].present?\n # os = JSON.parse(params[:item_wants])\n # os.each do |iwa|\n # o = ItemWant.new\n # o.title = iwa[0]\n # o.category_id = iwa[1]\n # o.desc = iwa[2]\n # o.item = @item\n # o.user = current_user\n # o.save\n # end\n # end\n if params[:item][:have].present?\n Have.create(:item_id => params[:item][:have].to_i,:user_id => current_user.id )\n end\n\n flash[:notice] = \"item created\"\n # Send mail when item created\n if (InfoAndSetting.sm_on_trd_live and @item.user.notify_tradeya_begins)\n if (@item.user.items.count == 1)\n ItemMailer.item_added_first(@item.id,@item.user.id).deliver\n elsif (@item.user.items.count < 6)\n ItemMailer.item_added(@item.id,@item.user.id).deliver\n end\n # Activity Feed\n @item.create_activity key: @item.id, owner: @item.user, recipient: @item.user\n end\n\n\n if params[:item][:tod_id] # check if the request is coming from an offer or just item\n trade = Trade.new(:item_id => params[:item][:tod_id].to_i, :offer_id => @item.id, :status => 'ACTIVE')\n trade.save!\n if params[:item][:tod] and params[:item][:tod] == \"1\"\n offer_as_tod = Item.new\n offer_as_tod.title = @item.title\n offer_as_tod.desc = @item.desc\n offer_as_tod.tod = true\n offer_as_tod.exp_date = Item.get_expiry_date_for_tod\n offer_as_tod.category_id = @item.category_id\n offer_as_tod.user_id = @item.user_id\n offer_as_tod.status = 'INCOMPLETE'\n offer_as_tod.is_single_tradeya = @item.is_single_tradeya\n if offer_as_tod.save\n session[:offer_as_tod] = offer_as_tod.id\n chk = false\n if params[:file_type] == \"photo\"\n if params[:item][:item_photo]\n if params[:item][:item_photo] and params[:item][:item_photo][:id] and params[:item][:item_photo][:id].to_i > 0\n ip = ItemPhoto.find(params[:item][:item_photo][:id])\n o = ItemPhoto.new\n if File.exist?(ip.photo.path)\n o.photo = File.open(ip.photo.path)\n else\n o.photo_from_url(ip.photo.url)\n end\n o.item_id = offer_as_tod.id\n o.save\n chk = true\n elsif params[:item][:item_photo]\n if params[:item][:item_photo][:photo]\n o = ItemPhoto.new(params[:item][:item_photo])\n o.item_id = offer_as_tod.id\n o.save\n chk = true\n end\n end\n end\n elsif params[:file_type] == \"video\"\n if params[:item][:item_video] and params[:item][:item_video][:id] and params[:item][:item_video][:id].to_i > 0\n iv = ItemVideo.find(params[:item][:item_video][:id])\n o = ItemVideo.new\n if File.exist?(iv.video.path)\n o.video = File.open(iv.video.path)\n else\n o.video_from_url(iv.video.url)\n end\n o.item_id = offer_as_tod.id\n o.save\n chk = true\n elsif params[:item][:item_video]\n if params[:item][:item_video][:video]\n o = ItemVideo.new(params[:item][:item_video])\n o.item_id = offer_as_tod.id\n o.save\n chk = true\n end\n end\n end\n\n if not chk and params[:archive_id].present?\n o = ItemVideo.new\n o.video_from_url(@url)\n o.item_id = offer_as_tod.id\n o.save\n chk = true\n end\n\n if not chk and params[:item][:selected_item_id].to_i > 0\n itm = Item.find(params[:item][:selected_item_id])\n if itm.item_videos and itm.item_videos.count > 0\n o = ItemVideo.new\n if File.exist?(itm.item_videos[0].video.path)\n o.video = File.open(itm.item_videos[0].video.path)\n else\n o.video_from_url(itm.item_videos[0].video.url)\n end\n o.item_id = offer_as_tod.id\n o.save\n else\n o = ItemPhoto.new\n if File.exist?(itm.item_photos[0].photo.path)\n o.photo = File.open(itm.item_photos[0].photo.path)\n else\n o.photo_from_url(itm.item_photos[0].photo.url)\n end\n o.item_id = offer_as_tod.id\n o.save\n end\n end\n if session[:guest_user_id].to_i > 0\n session[:guest_offer_as_tod] = true\n end\n end\n else\n session[:guest_user_id] = nil\n session[:is_guest_user] = nil\n end\n\n # Alert.add_2_alert_q(ALERT_TYPE_TRADEYA, NEW_OFFER_ON_TRADEYA, trade.item.user.id, nil, trade.id)\n\n # if InfoAndSetting.sm_on_o_made then EventNotificationMailer.offer_is_made(trade).deliver end\n if InfoAndSetting.sm_on_o_made and trade.item.user.notify_received_offer then EventNotification.add_2_notification_q(NOTIFICATION_TYPE_USER_SETTING, NOTIFICATION_OFFER_MADE, trade.item.user.id, {:trade_id => trade.id}) end\n # if InfoAndSetting.sm_on_trd_live and params[:item][:tod] == '1' then EventNotificationMailer.tradeya_is_live(@item).deliver end\n # if InfoAndSetting.sm_on_trd_live and @item.user.notify_tradeya_begins?(MAIL) and params[:item][:tod] == '1' then EventNotification.add_2_notification_q(NOTIFICATION_TYPE_USER_SETTING, NOTIFICATION_TRADEYA_IS_LIVE, @item.user.id, {:item_id => @item.id}) end\n #if InfoAndSetting.sm_on_trd_live and @item.user.notify_tradeya_begins and params[:item][:tod] == '1' then EventNotification.add_2_notification_q(NOTIFICATION_TYPE_USER_SETTING, NOTIFICATION_TRADEYA_IS_LIVE, @item.user.id, {:item_id => @item.id}) end\n\n # if offer is submitted from new offer flow, id and title of offer is needed\n if params[:new_offer_flow].present? and params[:item][:is_tod].present? and (params[:item][:is_tod] == 'false') and current_user\n session[:new_offer_title] = @item.title\n session[:new_offer_id] = @item.id\n else\n session[:item_saved_offer] = true\n end\n finished(\"make_offer_form\")\n # if current_user and !current_user.showed_onboarding\n # format.html { redirect_to profile_url }\n # else\n format.html { redirect_to item_path(Item.find(params[:item][:tod_id])) }\n # end\n else\n session[:guest_user_id] = nil\n session[:is_guest_user] = nil\n # Alert.add_2_alert_q(ALERT_TYPE_TRADEYA, TRADEYA_LIVE, @item.user.id, @item.id)\n\n # if InfoAndSetting.sm_on_trd_live then EventNotificationMailer.tradeya_is_live(@item).deliver end\n # if InfoAndSetting.sm_on_trd_live and @item.user.notify_tradeya_begins?(MAIL) then EventNotification.add_2_notification_q(NOTIFICATION_TYPE_USER_SETTING, NOTIFICATION_TRADEYA_IS_LIVE, @item.user.id, {:item_id => @item.id}) end\n #if InfoAndSetting.sm_on_trd_live and @item.user.notify_tradeya_begins then EventNotification.add_2_notification_q(NOTIFICATION_TYPE_USER_SETTING, NOTIFICATION_TRADEYA_IS_LIVE, @item.user.id, {:item_id => @item.id}) end\n\n # if not session[:ipad_mini_contest].nil? and session[:ipad_mini_contest] = 5\n # format.html{ redirect_to contest_url}\n # else\n\n if params[:item][:offer_for]\n if params[:item][:offer_for].include? \"?\"\n format.html { redirect_to my_offers_item_path(Item.find(params[:item][:offer_for]))+ \"&item_saved=\" + @item.id.to_s}\n else\n format.html { redirect_to my_offers_item_path(Item.find(params[:item][:offer_for]))+ \"?item_saved=\" + @item.id.to_s}\n end\n elsif params[:item][:referer_page]\n session[:have_saved] = params[:item][:referer_page]\n if params[:item][:referer_page].include? \"?\"\n format.html {redirect_to params[:item][:referer_page]+ \"&item_saved=\" + @item.id.to_s}\n else\n format.html {redirect_to params[:item][:referer_page]+ \"?item_saved=\" + @item.id.to_s}\n end\n elsif params[:item][:have_add_page]\n if params[:item][:have_add_page].include? \"?\"\n format.html {redirect_to params[:item][:have_add_page]+ \"&item_saved=\" + @item.id.to_s}\n else\n format.html {redirect_to params[:item][:have_add_page]+ \"?item_saved=\" + @item.id.to_s}\n end\n elsif params[:item][:referer_browse_page]\n if params[:item][:referer_browse_page].include? \"?\"\n format.html {redirect_to params[:item][:referer_browse_page]+ \"&item_saved=\" + @item.id.to_s}\n else\n format.html {redirect_to params[:item][:referer_browse_page]+ \"?item_saved=\" + @item.id.to_s}\n end\n else\n # session[:item_saved] = {:title => @item.title, :url => item_path(@item)}\n format.html { redirect_to new_item_path + \"?item_saved=\" + @item.id.to_s }\n end\n # format.html { redirect_to @item.item_url }\n # end\n end\n else\n format.html { redirect_to new_item_path }\n end\n else\n if params[:item][:tod_id]\n format.html { redirect_to item_path(Item.find(params[:item][:tod_id])) }\n else\n format.html { redirect_to new_item_path }\n end\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to new_item_path }\n end\n end\n end",
"def show\n @transaction = Transaction.new\n @item = Item.find(params[:id])\n @seller = User.find(@item.seller_id)\n\n\t\tif user_signed_in?\n\t\t\t#create new bid entry regardless of whether\n\t\t\t#the buyer have already bid or not\n\t\t\t@bid = @item.bids.build\n\n\t\t\t#search the buyer's previous bid\n\t\t\t@bid_existing = Bid.user_highest_bid(@item.id,current_user.id)\n\t\tend\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def set_item\n @item = Item.find(params[:item_id])\n end",
"def set_item\n @bid_offer = BidOffer.find(params[:id])\n end",
"def create\n\n @item = Item.new(params[:item])\n @item.user_id = current_user.id\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/main', :notice => 'Item was successfully created.' }\n format.json { render :json => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def sell(item)\r\n self.add_credits(item.price * item.quantity)\r\n Marketplace::Activity.create(Activity.ITEM_SOLD, item, \"#{item.name} has been sold by #{self.name}\")\r\n Marketplace::Activity.create(Activity.USER_SOLD_ITEM, self, \"#{self.name} sold #{item.name}\")\r\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def create\n @purchased_item = PurchasedItem.new(purchased_item_params)\n\n respond_to do |format|\n if @purchased_item.save\n format.html { redirect_to @purchased_item, notice: 'Purchased item was successfully created.' }\n format.json { render :show, status: :created, location: @purchased_item }\n else\n format.html { render :new }\n format.json { render json: @purchased_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def reserved(item, buyer)\n @item = item\n @buyer = buyer\n @greeting = \"Hi\"\n @name = item.owner.name\n\n mail to: @buyer.email\n end",
"def create\n @item = current_user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to root_path, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @rentable_item = RentableItem.new(rentable_item_params)\n @rentable_item.save\n end",
"def create\n @item = Item.new(item_params)\n @item.user_id = current_user.id\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def add_item\n\t\tcurrent_user.saved.items.push(Item.find(params[:item]))\n\t\tredirect_to :back\n\tend",
"def create\n @supplier_item = SupplierItem.new(supplier_item_params)\n\n respond_to do |format|\n if @supplier_item.save\n format.html { redirect_to @supplier_item, notice: 'Supplier item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @supplier_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @supplier_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pickup_item\n if status == :confirmed \n transaction do\n update(:status => :in_progress)\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'pickup_item',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.picked_up_item)\n end \n end\n self\n end",
"def new\n @crafted_item = CraftedItem.new\n @craft_item_ids = Item.find(:all, :conditions => [\"is_crafted = ?\", true], :select => \"id, description\", :order => \"description\")\n @item_ids = Item.find(:all, :select => \"id, description\", :order => \"description\")\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crafted_item }\n end\n end",
"def create\n @item = @deal.items.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to deal_items_url(@deal), notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n# authorize @item\n @item.user = current_user \n if @item.save\n flash[:notice] = \"\\\"#{@item.name}\\\" was added to your registry.\"\n else\n flash[:error] = \"There was a problem adding the item to your registry. Please try again.\"\n end\n redirect_to user_registry_path(current_user.link_id)\n end",
"def create\n @item = current_user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @item_info = ItemInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_info }\n end\n end",
"def create\n @item = Item.new(item_save_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @title = t('view.sellers.new_title')\n @seller = Seller.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seller }\n end\n end",
"def item_new\n @brief = Brief.find(params[:brief_id])\n @item = Item.new\n @item.kind = params[:kind]\n @action_to = vendor_item_create_path(@brief,@item.kind)\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end"
] | [
"0.7415695",
"0.7310675",
"0.6945493",
"0.6739858",
"0.66920424",
"0.6540826",
"0.65333796",
"0.65223837",
"0.65217274",
"0.649256",
"0.64877504",
"0.648455",
"0.6466218",
"0.6460836",
"0.64532584",
"0.6442505",
"0.64223987",
"0.64099085",
"0.64001113",
"0.63991034",
"0.639878",
"0.63834155",
"0.63834155",
"0.63834155",
"0.6382379",
"0.6377835",
"0.6375551",
"0.6375303",
"0.6359792",
"0.6355923",
"0.6351301",
"0.6331617",
"0.632646",
"0.63229537",
"0.63094735",
"0.6300533",
"0.63004726",
"0.62970734",
"0.62952226",
"0.62830913",
"0.6277101",
"0.6274974",
"0.6268217",
"0.62641615",
"0.6263786",
"0.6262845",
"0.6261791",
"0.62503064",
"0.6247846",
"0.624532",
"0.6242035",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6239015",
"0.6238996",
"0.6237638",
"0.62349504",
"0.62322176",
"0.6224805",
"0.62234586",
"0.6219539",
"0.6216435",
"0.621261",
"0.6212078",
"0.62110615",
"0.6209492",
"0.62028533",
"0.61994797",
"0.61988634",
"0.6192548",
"0.6191848",
"0.61886877",
"0.61864185",
"0.61864185",
"0.61864185",
"0.61864185",
"0.61864185",
"0.61864185",
"0.61864185",
"0.61864185",
"0.61864185",
"0.61864185",
"0.61864185",
"0.61864185",
"0.61864185"
] | 0.0 | -1 |
This action sets values of item and updates the database This will be used in a future story card | def update
@item = Item.find(params[:id])
int_array = params[:category].collect{|s| s.to_i}
#REset categories
#delete current
@itemcats = ItemCategory.find_all_by_item_id(@item.id)
@itemcats.each{|itemcat|itemcat.destroy}
#add new
#Insert and delete is less expensive than each check probably..TODO: Check
@categories = Category.all
@categories.each do|category|
if(int_array.include?(category.id))
then
ItemCategory.create(:category_id=>category.id, :item_id=>@item.id)
end
end
if @item.update_attributes(params[:item])
redirect_to(:action => 'show', :id => @item.id)
else
redirect_to(:action => 'user_edit_item', :id => @item.id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def item_update(item)\n @item = item\n end",
"def update\n @item.update!(item_params)\n end",
"def update\n item = Item.find(params[:item_id])\n\n item.name = params[:name]\n item.details = params[:details]\n item.save\n end",
"def set_item\n # 出品機能未実装のため仮置き\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:item_id])\n end",
"def set_item\n @item = Item.find(params[:item_id])\n end",
"def set_item\r\n @item = Item.find(params[:id])\r\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end",
"def set_item\n @item = Item.find(params[:id])\n end"
] | [
"0.7432029",
"0.7349575",
"0.734418",
"0.7265189",
"0.72412217",
"0.72068214",
"0.7197743",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647",
"0.71254647"
] | 0.0 | -1 |
Apply the good records from an uploaded import file | def apply_imports
assert_privileges("ops_settings")
if session[:imports]
begin
session[:imports].apply
rescue => bang
add_flash(_("Error during 'apply': %{error}") % {:error => bang}, :error)
@sb[:show_button] = true
else
add_flash(_("Records were successfully imported"))
@sb[:show_button] = false
session[:imports] = @sb[:imports] = nil
end
else
add_flash(_("Use the Choose file button to locate CSV file"), :error)
@sb[:show_button] = true
end
flash_to_session
redirect_to(:action => 'explorer', :no_refresh => true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import(file = nil)\n # A Hash containthe returning messages (one message for each row)\n # The values are Arrays containing the importing results for each row\n msg = {success: [], info: []} \n\n # If file is nil or blank (nil != blank)\n if file.nil? or file == \"\"\n msg[:success] << false \n msg[:info] << \"File name is nil or blank!\" \n return msg\n end\n\n # If the file is non-existant ...\n if file.instance_of?(String) and !(File.file?(file)) \n msg[:success] << false \n msg[:info] << \"File doesn't exist!\" \n return msg\n end\n\n # ??File submitted through html file doesn't exist!\n # http://guides.rubyonrails.org/form_helpers.html#uploading-files\n # 5.1 What Gets Uploaded\n # The object in the params hash is an instance of a subclass of IO.\n # Depending on the size of the uploaded file it may in fact be a StringIO\n # or an instance of File backed by a temporary file.\n if file.instance_of?(StringIO)\n msg[:success] << true \n msg[:info] << \"File is an instance of StringIO!\" \n elsif file.instance_of?(File) \n msg[:success] << true \n msg[:info] << \"File is an instance of File!\" \n else # ActionDispatch::Http::UploadedFile by html form \n msg[:success] << true \n msg[:info] << \"Must be the ActionDispatch::Http::UploadedFile type?\" \\\n \" #{file.class}\" \n end\n\n # Gets the file path\n file_path = file\n file_path = file.path unless file.instance_of?(String)\n #puts \"file_path = #{file_path}\"\n\n # TODO: Checks to see if the headers are correct\n # Imports row after row\n # CSV::Row is part Array & part Hash\n CSV.foreach(file_path, headers: true) do |row|\n vhash = row.to_hash # temporary VLAN record hash\n\n # Find FK lan_id\n # Note: Do not use Symbol :lan_name, Or it will not be found. Very weird!\n # Hence, use String instead of Symbol as the Hash key where necessary\n lan_id = find_lan_id(vhash[\"lan_name\"])\n \n # Go to the next row if an invalid lan_id was found \n unless lan_id > 0\n msg[:success] << false \n msg[:info] << \"Cannot find FK lan_id\" \n next\n end\n\n # Remove lan_name field from the row as it's not a field of table vlans\n vhash.delete(\"lan_name\")\n # and appends the FK lan_id\n vhash[\"lan_id\"] = lan_id\n #puts vhash\n \n # TODO: Need to feedback the result to the user in the future release\n s1 = \"lan_id: \" << lan_id.to_s # a temporary string\n tv = Vlan.new(vhash) # temporary VLAN record\n if tv.invalid? # invalid? triggers the model validation\n msg[:success] << false\n s1 << \", invalid Vlan\"\n else\n msg[:success] << true\n s1 << \", saved\"\n tv.save\n end\n\n msg[:info] << s1\n end\n return msg\n end",
"def perform\n import = TransportPassengerImport.find self.id\n import.update_attributes(:status => 1)\n load_all_data\n @rollback = false\n @errors = Array.new\n ActiveRecord::Base.transaction do\n import_csv(import.attachment.to_file)\n raise ActiveRecord::Rollback if @rollback\n end\n if @errors.present?\n import.update_attributes(:status => 4, :last_message => @errors)\n else\n import.update_attributes(:status => 2, :last_message => nil)\n end\n rescue Exception => e\n import.update_attributes(:status => 3, :last_message => ['-', e.message])\n end",
"def import\n @parsed_file=CSV::Reader.parse(params[:dump][:file])\n n=0\n @parsed_file.each do |row|\n c=Ad.new\n c.name=row[1]\n c.phone=row[2]\n c.company=row[3]\n c.business_item=row[4]\n c.copy1=row[5]\n c.copy2=row[6]\n c.phone2=row[7]\n c.fax=row[8]\n c.www=row[9]\n c.hp=row[10]\n c.kind=row[11]\n c.size=row[12]\n c.template=row[13]\n end\n if c.save\n n=n+1\n GC.start if n%50==0\n end\n flash.now[:message]=\"CSV Import Successful, #{n} new records added to data base\"\n \n end",
"def upload\n importer = ::PicaReportImporter.new(params.require(:data_file))\n creation_results = importer.evaluation_hashes.map do |eval_attrs|\n key_attrs, other_attrs = split_attributes(eval_attrs)\n\n Evaluation.create_if_needed_and_update(key_attrs, other_attrs)\n end\n\n num_new_records = creation_results.count { |result| result == true }\n num_updated_records = creation_results.length - num_new_records\n\n flash[:notice] = \"#{num_new_records} new evaluations imported. #{num_updated_records} evaluations updated.\"\n redirect_to evaluation_index_path\n end",
"def import_file_table\n @error = true\n scanned_data = ReadFile.scan(sale_params[:file_table], Sale.regex_read_file_table)\n if scanned_data\n begin\n sales_mapped = Sale.map_scanned_data scanned_data\n Sale.create(sales_mapped)\n @total_gross_income = Sale.calc_total_gross_income sales_mapped\n @error = false\n rescue\n end\n end\n end",
"def _parse_file_using_import(file, layout, model)\n attributes = {}\n count = 0\n value_sets = []\n column_names = model.columns.map{ |column| column.name }\n not_nces_fields = column_names.select { |name| name[/id/] }\n field_names = column_names - not_nces_fields\n options = { :validate => false }\n mstate_index = field_names.index(\"MSTATE\")\n while (line = file.gets) do\n next if line.strip == ''\n values = []\n layout.each do |label, start_pos, end_pos, length, data_type, description|\n data_str = line[(start_pos-1)..(end_pos-1)].strip.gsub(/[^[:print:]]/, '')\n data_value = case data_type\n when 'N'\n data_str.to_i\n when 'D'\n data_str.to_f\n else\n data_str\n end\n values << data_value\n end\n if @states_and_provinces\n if @states_and_provinces.include?(values[mstate_index])\n value_sets << values\n end\n else\n value_sets << values\n end\n if value_sets.length >= 10\n records = model.import(field_names, value_sets, options)\n value_sets = values = []\n end\n count += 1\n if count % 500 == 0\n print '.'\n STDOUT.flush\n end\n end\n if value_sets.length > 0\n model.import(field_names, value_sets, options)\n end\n puts \"\\n#{count} records processed from #{file.path}\"\n end",
"def import_csv\n @records = CSV.read(@filename, :headers => true, :row_sep => :auto)\n unless @records.blank?\n @linenum = 0\n if @filename.index('att') || @filename.index('Att')\n @school_year = Time.parse(@records[0][\"AbsenceDate\"]).year\n end\n @records.each { |rec |\n @linenum += 1\n @record = rec\n next unless check_record(@record)\n seed_record(@record)\n process_record(@record, rec2attrs(@record)) if rec2attrs(@record) != false\n }\n end \n end",
"def assign_csv_values_to_genericfile(row, generic_file)\n field_mappings = @import.import_field_mappings.where('import_field_mappings.key != ?', 'image_filename')\n field_mappings.each do |field_mapping|\n\n key_column_number_arr = @import.import_field_mappings.where(key: field_mapping.key).first.value.reject!{|a| a.blank? } \n key_column_value_arr = []\n\n # For certain fields the values in the csv are comma delimeted and need to be parsed\n if field_mapping.key == 'subject'\n key_column_number_arr.each do |num|\n key_column_value_arr = key_column_value_arr + (row[num.to_i].try(:split, ',') || [])\n end\n elsif field_mapping.key == 'collection_identifier'\n # it's not a multivalue field so let's just get the first mapping\n key_column_number_arr.each do |num|\n generic_file.collection_identifier = row[num.to_i]\n break\n end\n\n elsif field_mapping.key == 'measurements'\n key_column_number_arr.each do |num|\n measurement_hash = measurement_format_for(row[num.to_i].try(:strip))\n unless measurement_hash.nil?\n #insert field as a measurement object\n measurement = Osul::VRA::Measurement.create(measurement: measurement_hash[:width], measurement_unit: measurement_hash[:unit], measurement_type: \"width\") \n \n generic_file.measurements << measurement\n measurement = Osul::VRA::Measurement.create(measurement: measurement_hash[:height], measurement_unit: measurement_hash[:unit], measurement_type: \"height\") \n generic_file.measurements << measurement\n end\n end\n\n elsif field_mapping.key == 'materials'\n key_column_number_arr.each do |num|\n material_hash = material_format_for(row[num.to_i].try(:strip))\n unless material_hash.nil?\n material = Osul::VRA::Material.create(material_hash)\n generic_file.materials << material\n end\n end\n\n else\n key_column_number_arr.each do |num|\n key_column_value_arr << row[num.to_i]\n end\n end\n\n # materials and measurements are associations so they are updated differently \n unless field_mapping.key == 'materials' or field_mapping.key == 'measurements' or field_mapping.key == 'collection_identifier'\n key_column_value_arr = key_column_value_arr.map.reject{|a| a.blank?}\n generic_file.send(\"#{field_mapping.key}=\".to_sym, key_column_value_arr)\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 import\n @imported = false\n\n if (!params[:attachment].blank?)\n flash.now[:notice] = \"File uploaded\"\n\n import_batch = ImportBatch.create\n\n CSV.parse(params[:attachment].read).each do |row|\n entry = Entry.new(\n :date => Date.strptime(row[0], '%m/%d/%Y'),\n :raw_name => row[2],\n :amount => row[7],\n :account_id => params[:account_id],\n :import_batch_id => import_batch.id)\n entry.save\n end\n end\n end",
"def import_users\n @file = params[:upload]\n return render_error :upload unless @file && @file.try(:content_type)\n\n if @file.content_type =~ /^text\\/csv|^application\\/vnd.ms-excel/\n importer = Importing::Importer.new(@file.read)\n\n if importer.failed?\n # if failed\n Rails.logger.warn \"*** Import failed: #{importer.error.message}\\nBacktrace: #{importer.error.backtrace[0,5].join(\"\\n\")}\"\n render_error :import\n else\n # \"full_name\", \"abbreviation\", \"email\", \"status\", \"staff_number\", \"group\"\n @records = importer.results\n # puts @records.inspect\n\n @records.reject! { |c| c.blank? }\n\n count = 0\n\n require_headers = [\"full_name\", \"abbreviation\", \"email\", \"status\", \"staff_number\", \"group\"]\n\n headers = importer.headers\n\n if @records.length > 0\n headers = @records.first.keys\n end\n\n if headers.nil?\n render_error :header\n return\n end\n\n # headers.each do |e|\n # unless require_headers.index(e)\n # render_error :header\n # return\n # end\n # end\n\n result = true\n headers.each do |h|\n result = require_headers.include?(h.to_s)\n unless result\n render_error :header\n return\n end\n end\n\n @records.each do |user|\n next if user.blank?\n\n puts user.inspect\n\n created_user = User.new({\n full_name: user[:full_name],\n abbreviation: user[:abbreviation],\n email: user[:email],\n username: user[:abbreviation],\n password: \"1qazxsw2\",\n password_confirmation: \"1qazxsw2\",\n status: user[:status],\n staff_number: user[:staff_number],\n organization_id: current_user.organization_id\n })\n group_name = user[:group].downcase\n group_id = UserGroup.find_by_sql(\"Select * from user_groups where lower(name) ='#{group_name}'\")[0].id\n \n\n created_user.user_group_ids = group_id\n\n # created_user.skip_confirmation!\n count += 1 if created_user.save\n puts created_user.errors.inspect\n end\n \n flash[:notice] = \"There are #{count} users have been created.\"\n redirect_to organization_users_path(current_user.organization_id)\n end\n else\n render_error :content_type, :type => @file.content_type\n end\n end",
"def process_data_file!\n filename = self.attachment.file.file\n data = CSV.read(filename, col_sep: \"\\t\")\n data.delete_at(0)\n\n sales_attrs = data.map do |row|\n row.each_with_index.map do |value, index|\n Hash[ CSV_HEADERS[index], value ]\n end.reduce(&:merge)\n end\n\n sales_attrs.each do |sale_attr|\n self.sales.create(sale_attr)\n end\n\n total_revenue = self.sales.map{|sale| sale.amount * sale.unit_price }.reduce(:+)\n self.update_attributes({\n processed: true,\n revenue: total_revenue,\n batch_code: SecureRandom.uuid\n })\n end",
"def import_learners_from_csv\n assessment_id = params[:user][:assessment_id]\n unless params[:import][:excel].nil? or params[:import][:excel].blank? then\n @import = Import.new(params[:import])\n mime = (MIME::Types.type_for(@import.excel.path)[0])\n unless mime.nil? or mime.blank? then\n mime_obj = mime.extensions[0]\n #dont process further if the uploaded file is other than xls,xls,csv\n if (!mime_obj.nil? and !mime_obj.blank?) and (mime_obj.include? \"xls\" or mime_obj.include? \"xlsx\" or mime_obj.include? \"ods\" or mime_obj.include? \"csv\" ) then\n if @import.save!\n #check for virus\n if no_virus(@import.excel.path) then\n #If mime_obj is not csv only then create roo_instace\n unless mime_obj.include? \"csv\" then\n @roo = create_roo_instance(@import.excel.path,mime_obj)\n else\n #so, its a csv format\n @roo = \"csv format\"\n end\n #if the uploaded\n unless @roo == \"Upload correct excel format.\" then\n if @roo == \"csv format\" then\n lines = parse_csv_file(@import.excel.path)\n else\n lines = parse_excel_file_roo(@roo)\n end\n \n if lines.size > 0\n @import.processed = lines.size\n i = 1\n failed_to_upload = Array.new\n lines.each do |line|\n if valid_assign(params[:id])\n if valid_learners_excel_upload(line)\n else\n failed_to_upload << i\n end\n else\n flash[:learner_limit_exceeds] = \"You cannot assign more learners\"\n end\n i = i + 1\n end\n @import.save\n\n delete_csv(@import.excel.path)\n\n @import.destroy\n if params.include? 'from_assign_learners_page' then\n redirect_to(\"/assessments/assign_learners/\" + assessment_id.to_s)\n else\n total_failed_to_upload = failed_to_upload.join(\",\")\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}?failed_to_upload=#{total_failed_to_upload}\")\n end\n else\n flash[:error] = \"CSV data processing failed.\"\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:virus_error] = \"The file is Infected with virus.\"\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:error] = 'CSV data import failed.'\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n else\n redirect_to(\"/assessments/manage_learners/#{assessment_id.to_s}\")\n end\n end",
"def import_bien_par_correspondance\n goods_img_clear = Hash.new\n good_medias = []\n\tmatcher_good_and_medias = Hash.new\n\n\t# Reference all 'bien' who matched with media's name\n @medias.sort.map{ |a| a[0]}.each do |name|\n next unless (good = get_good_by_media_name(name))\n goods_img_clear[good.id] = good\n good_medias.push @medias[name]\n\t matcher_good_and_medias[@medias[name].id] = good\n end\n \n # Before import media, clear media for new good who's medias is update\n goods_img_clear.each do |id, good|\n\t# un-associate the photos to the goods (equivalent to clear, but not destroy the photos.\n good.bien_photos.each{ |photo|\n\t\t photo.bien = nil\n\t\t photo.save!\n\t }\n end\n\t\n\tmatcher_good_and_medias.each{ |media_id,good|\n\t\tbegin\n\t\t\tm = BienPhoto.find media_id\n\t\trescue\n\t\t\tLogger.send(\"warn\", \"No corresponding bien_photo to this id : #{media_id}\")\n\t\t\t@result[:description] << \"No corresponding bien_photo to this id : #{media_id}\"\n\t\t\tnext\n\t\tend\n\t\tnext if m.nil?\n\t\tnext if good.bien_photos.include? m\n\t\tm.bien = good\n\t\tm.save!\n\t}\n\t\n return goods_img_clear.size \n end",
"def import\n if current_user.items.import(params[:file]) == false\n #False encountered means atleast one invalid item\n flash[:danger] = \"Error Encountered. No Items Imported. Please check CSV File.\"\n redirect_to spage3_path\n else \n #True means all valid items so save all of them\n current_user.items.import1(params[:file])\n flash[:success] = \"All Items Imported Successfully.\"\n redirect_to spage3_path\n end\n end",
"def import_files\n\t\tif(params[:file].present?)\n begin\n\t\t\t\tNcQuestion.build_from_import(params[:file], current_company)\n redirect_to new_audit_nc_question_path, :flash => { :notice => MESSAGES[\"nc_question\"][\"csv_upload\"][\"success\"]}\n rescue\n redirect_to new_audit_nc_question_path, :flash => { :error => MESSAGES[\"csv_upload\"][\"error\"]}\n end\n else\n redirect_to new_audit_nc_question_path , :flash => { :notice => MESSAGES[\"csv_upload\"][\"presence\"]}\n end\n end",
"def import_csv\n before_count = BgMeasurement.where(:user_id => current_user.id).count\n BgMeasurement.import_csv(params[:file], current_user)\n after_count = BgMeasurement.where(:user_id => current_user.id).count\n redirect_to bg_measurements_path, :notice => \"#{(after_count-before_count)} readings successfully uploaded into database\"\n end",
"def transform_files\n extract\n reorder_files\n transform @attendance_file, 'att' unless @attendance_file.blank?\n transform @enroll_file, 'enroll' unless @enroll_file.blank?\n transform @ili_file, 'ili' unless @ili_file.blank?\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 perform(bulk_action_id, params)\n super\n csv = CSV.parse(params[:csv_file], headers: true)\n with_csv_items(csv, name: \"Import descriptive metadata\", filename: params[:csv_filename]) do |cocina_object, csv_row, success, failure|\n next failure.call(\"Not authorized\") unless ability.can?(:update, cocina_object)\n\n DescriptionImport.import(csv_row:)\n .bind { |description| validate_input(cocina_object, description) }\n .bind { |description| validate_changed(cocina_object, description) }\n .bind { |description| open_version(cocina_object, description) }\n .bind { |description, new_cocina_object| save(new_cocina_object, description) }\n .bind { |new_cocina_object| close_version(new_cocina_object) }\n .either(\n ->(_updated) { success.call(\"Successfully updated\") },\n ->(messages) { failure.call(messages.to_sentence) }\n )\n end\n end",
"def import_package_learners_from_csv\n assessment_id = params[:user][:package_id]\n unless params[:import][:excel].nil? or params[:import][:excel].blank? then\n @import = Import.new(params[:import])\n mime = (MIME::Types.type_for(@import.excel.path)[0])\n unless mime.nil? or mime.blank? then\n mime_obj = mime.extensions[0]\n #dont process further if the uploaded file is other than xls,xls,csv\n if (!mime_obj.nil? and !mime_obj.blank?) and (mime_obj.include? \"xls\" or mime_obj.include? \"xlsx\" or mime_obj.include? \"ods\" or mime_obj.include? \"csv\" ) then\n if @import.save!\n #check for virus\n if no_virus(@import.excel.path) then\n #If mime_obj is not csv only then create roo_instace\n unless mime_obj.include? \"csv\" then\n @roo = create_roo_instance(@import.excel.path,mime_obj)\n else\n #so, its a csv format\n @roo = \"csv format\"\n end\n #if the uploaded\n unless @roo == \"Upload correct excel format.\" then\n if @roo == \"csv format\" then\n lines = parse_csv_file(@import.excel.path)\n else\n lines = parse_excel_file_roo(@roo)\n end\n\n if lines.size > 0\n @import.processed = lines.size\n i = 1\n failed_to_upload = Array.new\n lines.each do |line|\n if valid_assign(params[:id])\n if valid_learners_excel_upload(line)\n else\n failed_to_upload << i\n end\n else\n flash[:learner_limit_exceeds] = \"You cannot assign more learners\"\n end\n i = i + 1\n end\n @import.save\n\n delete_csv(@import.excel.path)\n\n @import.destroy\n if params.include? 'from_assign_learners_page' then\n redirect_to(\"/packages/assign_learners/\" + assessment_id.to_s)\n else\n total_failed_to_upload = failed_to_upload.join(\",\")\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}?failed_to_upload=#{total_failed_to_upload}\")\n end\n else\n flash[:error] = \"CSV data processing failed.\"\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:virus_error] = \"The file is Infected with virus.\"\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:error] = 'CSV data import failed.'\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n else\n redirect_to(\"/packages/manage_learners/#{assessment_id.to_s}\")\n end\n end",
"def import(task = nil)\n raise 'Another import is in progress.' unless self.class.import_authorized?\n\n task_args = {\n name: 'Importing MARCXML records',\n service: Service::LOCAL_STORAGE,\n status: Task::Status::RUNNING\n }\n if task\n Rails.logger.info('RecordSource.import(): updating provided Task')\n task.update!(task_args)\n else\n Rails.logger.info('RecordSource.import(): creating new Task')\n task = Task.create!(task_args)\n end\n\n begin\n config = Configuration.instance\n client = Aws::S3::Client.new\n\n num_invalid_files = file_index = record_index = 0\n batch = []\n client.list_objects(\n bucket: config.book_bucket,\n prefix: config.book_key_prefix).each do |list_response|\n list_response.contents.each do |object|\n next unless object.key.downcase.end_with?('.xml')\n\n Rails.logger.debug(\"RecordSource.import(): getting object #{object.key}\")\n\n get_response = client.get_object(\n bucket: config.book_bucket,\n key: object.key)\n data = get_response.body.read\n\n begin\n doc = Nokogiri::XML(data, &:noblanks)\n doc.encoding = 'utf-8'\n\n doc.xpath('//marc:record', MARCXML_NAMESPACES).each do |record|\n Rails.logger.debug(\"RecordSource.import(): reading record #{record_index}\")\n\n batch << Book.params_from_marcxml_record(object.key, record)\n upsert_if_necessary(batch)\n\n record_index += 1\n if record_index % 100 == 0\n task.update(name: \"Importing MARCXML records: \"\\\n \"scanned #{record_index} records in #{file_index + 1} files \"\\\n \"(no progress available)\")\n print \"#{task.name.ljust(80)}\\r\"\n end\n end\n rescue => e\n # This is probably an undefined namespace prefix error, which means\n # it's either an invalid MARCXML file or, more likely, a non-\n # MARCXML XML file, which is fine.\n num_invalid_files += 1\n Rails.logger.info(\"#{object}: #{e}\")\n ensure\n file_index += 1\n end\n end\n end\n upsert(batch)\n rescue SystemExit, Interrupt => e\n task.update(name: 'Import aborted',\n status: Task::Status::FAILED)\n puts task.name\n raise e\n rescue => e\n task.update(name: \"Import failed: #{e}\",\n status: Task::Status::FAILED)\n puts task.name\n puts e.backtrace\n else\n task.update(name: sprintf('Importing MARCXML records: %d records added, '\\\n 'updated, or unchanged; %d skipped files',\n record_index, num_invalid_files),\n status: Task::Status::SUCCEEDED)\n puts task.name\n ensure\n Book.analyze_table\n end\n end",
"def import_course_learners_from_csv\n assessment_id = params[:user][:course_id]\n unless params[:import][:excel].nil? or params[:import][:excel].blank? then\n @import = Import.new(params[:import])\n mime = (MIME::Types.type_for(@import.excel.path)[0])\n unless mime.nil? or mime.blank? then\n mime_obj = mime.extensions[0]\n #dont process further if the uploaded file is other than xls,xls,csv\n if (!mime_obj.nil? and !mime_obj.blank?) and (mime_obj.include? \"xls\" or mime_obj.include? \"xlsx\" or mime_obj.include? \"ods\" or mime_obj.include? \"csv\" ) then\n if @import.save!\n #check for virus\n if no_virus(@import.excel.path) then\n #If mime_obj is not csv only then create roo_instace\n unless mime_obj.include? \"csv\" then\n @roo = create_roo_instance(@import.excel.path,mime_obj)\n else\n #so, its a csv format\n @roo = \"csv format\"\n end\n #if the uploaded\n unless @roo == \"Upload correct excel format.\" then\n if @roo == \"csv format\" then\n lines = parse_csv_file(@import.excel.path)\n else\n lines = parse_excel_file_roo(@roo)\n end\n\n if lines.size > 0\n @import.processed = lines.size\n i = 1\n failed_to_upload = Array.new\n lines.each do |line|\n if valid_assign(params[:id])\n if valid_learners_excel_upload(line)\n else\n failed_to_upload << i\n end\n else\n flash[:learner_limit_exceeds] = \"You cannot assign more learners\"\n end\n i = i + 1\n end\n @import.save\n\n delete_csv(@import.excel.path)\n\n @import.destroy\n if params.include? 'from_assign_learners_page' then\n redirect_to(\"/courses/assign_learners/\" + assessment_id.to_s)\n else\n total_failed_to_upload = failed_to_upload.join(\",\")\n redirect_to(\"/courses/manage_learners/#{assessment_id.to_s}?failed_to_upload=#{total_failed_to_upload}\")\n end\n else\n flash[:error] = \"CSV data processing failed.\"\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/courses/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:virus_error] = \"The file is Infected with virus.\"\n redirect_to(\"/courses/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:error] = 'CSV data import failed.'\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/courses/manage_learners/#{assessment_id.to_s}\")\n end\n else\n flash[:upload_error] = 'Upload correct excel format.'\n redirect_to(\"/courses/manage_learners/#{assessment_id.to_s}\")\n end\n else\n redirect_to(\"/courses/manage_learners/#{assessment_id.to_s}\")\n end\n end",
"def import_csv_full\n \n end",
"def csv_uploader(infile, organisationid)\n require 'csv'\n require 'timeout'\n# counter = 1\n begin \n CSV.parse(infile).drop(1).each do |row| \n# puts \"************************************\"\n# puts \"Started reading #{counter} row and inserting row in the table\"\n Customer.customer_build_from_csv(row, organisationid) \n# puts \"Ended the process of inserting #{counter} row in the table\"\n# puts \"************************************\"\n# counter += 1 \n end \n rescue\n retry\n# puts \"*****************************************\"\n# puts \"Anup got timeout error\"\n# puts \"*****************************************\" \n end\n end",
"def process_updates(table_name, field, rows)\n ActiveRecord::Base.transaction do\n mass_import(rows)\n mass_update(table_name, field)\n end\n end",
"def csv_import\n if can?(:>, \"4\")\n name = params[:kit_bom_bulk_operation][:file].original_filename\n file_status = Kitting::KitBomBulkOperation.find_by_file_path( name )\n repeat = 0\n until file_status.nil? do\n repeat = 1 if repeat == 0\n file_status = Kitting::KitBomBulkOperation.find_by_file_path(\"#{name}(#{repeat})\")\n repeat +=1\n end\n @part_cup_count_upload = current_customer.kit_bom_bulk_operations.create(:operation_type => \"PART CUP COUNT\",:file_path => name,:status => \"UPLOADING\")\n directory = APP_CONFIG[\"csv_import_path\"]\n file_path = repeat == 0 ? name : \"#{name}(#{repeat-1})\"\n if @part_cup_count_upload.update_attributes(:file_path => file_path,:status => \"UPLOADED\")\n path = File.join(directory, file_path)\n @file_status = File.open(path, \"wb\") { |f| f.write(params[:kit_bom_bulk_operation][:file].read) }\n if File.exists?(File.join(directory,@part_cup_count_upload.file_path))\n # Check if Header present and is in correct format\n csv_text = File.read(File.join(directory,@part_cup_count_upload.file_path))\n header = CSV.parse_line(csv_text)\n if header == [\"PART NUMBER\", \"LARGE CUP COUNT\", \"MEDIUM CUP COUNT\", \"SMALL CUP COUNT\"]\n flash[:success] = \"File Uploaded and will be processed Shortly.\"\n redirect_to upload_parts_path\n else\n flash[:error] = \"INVALID HEADERS/DOWNLOAD SAMPLE CSV FOR HEADER FORMAT.\"\n FileUtils.rm_rf File.join(directory,@part_cup_count_upload.file_path)\n @part_cup_count_upload.destroy\n redirect_to upload_parts_path\n end\n else\n flash[:error] = \"INVALID FILE FORMAT.\"\n @part_cup_count_upload.destroy\n redirect_to upload_parts_path\n end\n else\n flash[:error] = \"INVALID FILE FORMAT.\"\n @part_cup_count_upload.destroy\n redirect_to upload_parts_path\n end\n else\n redirect_to main_app.unauthorized_url\n end\n end",
"def import\n att_file_name = File.join(@dir, \"attendance_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n enr_file_name = File.join(@dir, \"enrollment_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n ili_file_name = File.join(@dir, \"ili_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n EnrollmentImporter.new(@enroll_file).import_csv unless @enroll_file.blank?\n AttendanceImporter.new(@attendance_file).import_csv unless @attendance_file.blank?\n IliImporter.new(@ili_file).import_csv unless @ili_file.blank?\n File.rename(@enroll_file, enr_file_name) unless @enroll_file.blank?\n File.rename(@attendance_file, att_file_name) unless @attendance_file.blank?\n File.rename(@ili_file, ili_file_name) unless @ili_file.blank?\n FileUtils.mv(enr_file_name, File.join(@dir, \"archive\")) unless @enroll_file.blank?\n FileUtils.mv(att_file_name, File.join(@dir, \"archive\")) unless @attendance_file.blank?\n FileUtils.mv(ili_file_name, File.join(@dir, \"archive\")) unless @ili_file.blank?\n end",
"def import!\n import_binary_files\n member_ids = []\n source_metadata_adapter.query_service.find_members(resource: source_resource).each do |member|\n member = self.class.import(source_resource: member, source_metadata_adapter: source_metadata_adapter, change_set_persister: change_set_persister)\n source_change_set.created_file_sets += [member] if member.is_a?(FileSet)\n member_ids << member.id\n end\n # Get rid of non-preserved members.\n source_change_set.try(:member_ids=, member_ids)\n output = change_set_persister.save(change_set: source_change_set)\n output\n end",
"def process_and_import(data_file)\n items = JSON.load(File.open(data_file))[\"result\"]\n\n items.each do |item|\n date = item[\"/film/film/initial_release_date\"]\n\n next unless date\n\n case date.length\n when 4\n date = date + \"-01-01\"\n when 7\n date = date + \"-01\"\n end\n\n date = Date.parse(date)\n\n # Query current database so that we backfill/update information if the\n # film already exists\n film = Film.where(\n freebase_id: item[\"/type/object/mid\"]\n ).first\n film = Film.where(\n title: item[\"/type/object/name\"],\n year: date.year\n ).first unless film\n\n film = Film.new unless film\n film.title = valid_item?(item[\"/type/object/name\"]) unless film.title\n film.release_date = valid_item?(date) unless film.release_date\n film.year = date.year unless film.year\n film.freebase_id = item[\"/type/object/mid\"] unless film.freebase_id\n film.freebase_guid = item[\"/type/object/guid\"] unless film.freebase_guid\n film.save\n end\n end",
"def import(date, file, min_page = 0, max_page)\r\n\r\n \tputs \"Importing data from: #{file}\"\r\n\r\n # Load date\r\n @date = date\r\n\r\n # Regex patterns\r\n id_regex = /^(0|\\d{6,9}|\\d{12,13}|X{13}|UPI\\d{8,10}(?:\\/\\d)?|U\\/I-\\d{4}\\/\\d{2}|UF\\/I\\d{4}\\/\\d{2}|\\d{2,3}-\\d{1,7}-\\d{1,7}(?:[\\/|\\-|\\s]\\d{1,4})?)$/\r\n\r\n # output dir\r\n out_dir = File.join(Rails.root, \"db\", \"export\")\r\n Dir.mkdir(out_dir) if !Dir.exist?(out_dir)\r\n\r\n @banks = Set.new\r\n\r\n # Output CSV files\r\n @result_csv = CSV.open(File.join(out_dir, \"#{date}.csv\"), \"w\")\r\n\r\n owner_lines = []\r\n\r\n # Statistics\r\n @total = {}\r\n @total.default = 0\r\n\r\n @cases = [0, 0, 0, 0, 0, 0]\r\n\r\n start = Time.now\r\n \tPDF::Reader.new(file).pages.each_with_index do |page, page_num|\r\n \t\t#Skip first min_page\r\n next if page_num < min_page\r\n\r\n # Stop after max_page \r\n \t\tbreak if page_num > max_page\r\n\r\n @total[:pages] += 1\r\n\r\n \t\t\tpage.text.lines.each do |line|\r\n # skip empty lines\r\n \t\t\t\tif !line.strip!.blank?\r\n\r\n \t\t\t\t\t# Match owner ID - this is new owner\r\n \t\t\t\t\tif line =~ id_regex\r\n \t\t\t\t\t\t# parse and save owner info but skip first line\r\n \t\t\t\t\t\tparse(owner_lines) if !owner_lines.empty?\r\n\r\n \t\t\t\t\t\t# start capturing data for new owner\r\n \t\t\t\t\t\towner_lines = [$~[1]]\r\n # skip strings which are not accounts: headers and footers\r\n \t\t\t\t\telsif !(line =~ /Broj racuna/i || line =~ /^\\d{2}\\/\\d{2}\\/\\d{4}/ || line =~ /^JIB/) && (!owner_lines.empty?)\r\n \t\t\t\t\t\towner_lines << line.gsub(/\\s{2,}/,'\\t')\r\n \t\t\t\t\tend\r\n \t\t\t\tend\r\n \t\t\tend\r\n \t\tend\r\n\r\n @result_csv.close\r\n\r\n puts \"Statistics: #{@total.to_yaml}\\n#{@cases}\"\r\n puts \"Loading finished in: %3d:%04.2f\"%(Time.now-start).divmod(60.0)\r\n \tend",
"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 process!\n if valid?\n # get the csv rows as an array of hashes\n setup_data\n raw_csv_data = compute_csv_data\n # remove duplicate rows in the csv file (by email or name)\n prefilterted_csv_data = prefilter_csv_data raw_csv_data\n # remove the rows that match emails in the database\n new_data = filter_data_through_db prefilterted_csv_data\n\n # crate a new users\n resolved_data = create_new_user_records new_data\n end\n @rejected_user_data\n end",
"def import\n table = params[:tablename]\n upload_file = ApplicationUpload.new(params[:file])\n ActiveRecord::Base.connection.execute(\"update sqlite_sequence set seq=0 where name='\" + table + \"'\")\n# ActiveRecord::Base.connection.execute(\"alter table \" + table + \" auto_increment=1\")\n ActiveRecord::Base.connection.execute(\"delete from \" + table)\n upload_msgs = upload_file.import_by_sql(table)\n\n flash[:notice] = t(:success_default) unless upload_msgs.blank?\n redirect_to(:controller => :databases, :action => :index, :tablename=> table)\n end",
"def import_statement\n if params[:file_upload] && params[:file_upload][:file]\n csv_text = params[:file_upload][:file].read\n file_name = params[:file_upload][:file].original_filename\n StatementImportHelper.process_statement(current_user, @ledger_account, csv_text, file_name)\n flash[:notice] = \"File has been uploaded successfully\"\n end\n respond_with @ledger_account\n end",
"def import\n scan_files\n # import non-imported files\n\tto_be_executed = Execution.where(:passerelle_id => @passerelle.id, :statut => \"nex\").order('created_at')\n\tto_be_executed.each{ |execution|\n\t\texecution.statut = \"ece\" #note : En Cours d'Execution\n\t\texecution.save!\n\t}\n\tto_be_executed.each{ |execution|\n\t\n\t\n\tbegin\n\t import_exe execution\n\t statut = \"ok\"\n\trescue Exception => e\n\t\t @rapport_import << \"Fail<\\br>\"\n\t\t @rapport_import << \"Error message => : #{e.message}<\\br>\"\n\t\t @rapport_import << \"Error backtrace => #{e.backtrace}<\\br>\"\n\t\t Logger.send(\"warn\",\"[Passerelle] Import FAIL !\")\n\t\t Logger.send(\"warn\",\"[Passerelle] Rapport : #{@rapport_import}\")\n\t\t statut = \"err\"\n\tend\n\t\t\n\t\texe_to_save = Execution.find execution.id\n\t\texe_to_save.statut = statut\n\t\texe_to_save.description = @result[:description]\n\t\texe_to_save.save!\n\t}\n @passerelle.updated_at = DateTime.now\n @passerelle.save!\n\t\n\tres = Hash.new\n\tres[\"updated\"] = true\n\t# res[\"message\"] = \"desc\"\n\t\n\treturn res\n end",
"def transform index_file\n InputBatch.log.info \"Opened txt file for processing\"\n puts \"Opened txt file for processing\"\n InputBatch.log.info \">>Index Transformation Starts \" + Time.now.to_s\n puts \">>Index Transformation Starts \" + Time.now.to_s\n @jobs = []\n @txt_lines = File.readlines(index_file)\n txt_lines.each do |row|\n @row = row.chomp\n save_records\n end\n\n puts \">>Index Transformation Ends \" + Time.now.to_s\n InputBatch.log.info \">>Index Transformation Ends \" + Time.now.to_s\n end",
"def import\n if @options[:clear_existing]\n print_step 'Clearing all ratings'\n ratings = []\n @acase.queries.each do |query|\n query.ratings.each do |rating|\n ratings << rating.id\n end\n end\n Rating.delete ratings\n end\n\n if @options[:drop_header]\n @ratings = @ratings.drop(1) # get rid of header row\n end\n #\n # 2 ways to import ratings:\n # i. The naive way:\n # a. Loop through each row\n # b. Create or fetch the query based on the query text (cache the query)\n # c. Create or update the rating\n # ii. The less naive way, which we are using:\n # a. Map from the rows all the unique queries\n # b. Fetch all the existing queries\n # c. Determine which queries do not already exist\n # d. Create remaining queries in bulk\n # e. Updating existing ratings if needed\n # f. Create remaining ratings in mass\n #\n\n # a. Map from the rows all the unique queries\n normalized_rows = @ratings.map { |row| extract_rating_info row }\n query_texts = normalized_rows.pluck(:query_text)\n unique_queries = query_texts.uniq\n\n # b. Fetch all the existing queries\n queries_params = {\n query_text: unique_queries,\n case_id: @acase.id,\n }\n indexed_queries = Query.where(queries_params)\n .all\n .index_by(&:query_text)\n\n # c. Determine which queries do not already exist\n existing_queries = indexed_queries.keys\n non_existing_queries = unique_queries - existing_queries\n\n if non_existing_queries.empty?\n @queries = indexed_queries\n else\n # d. Create remaining queries in bulk\n queries_to_import = []\n print_step 'Importing queries'\n block_with_progress_bar(non_existing_queries.length) do |i|\n query_text = non_existing_queries[i]\n query = Query.new query_text: query_text, case_id: @acase.id\n\n queries_to_import << query\n end\n\n # Mass insert queries\n Query.import queries_to_import\n\n # Refetch the queries now that we've created new ones\n queries_params = {\n query_text: unique_queries,\n case_id: @acase.id,\n }\n @queries = Query.where(queries_params)\n .all\n .index_by(&:query_text)\n end\n\n # e. Create or update ratings\n ratings_to_import = []\n ratings_to_update = []\n print_step 'Importing ratings'\n\n block_with_progress_bar(normalized_rows.length) do |i|\n row = normalized_rows[i]\n query_text = row[:query_text]\n doc_id = row[:doc_id]\n rating = row[:rating]\n\n if doc_id.present? && rating.present? # queries are always created.\n print_step \"Importing rating: #{rating} for query: #{query_text} and doc: #{doc_id}\"\n\n query = @queries[query_text]\n exists = query.ratings.where(doc_id: doc_id).first\n\n if exists.present? && @options[:force]\n exists.rating = rating\n ratings_to_update << exists\n elsif exists.blank?\n ratings_to_import << query.ratings.build(doc_id: doc_id, rating: rating)\n end\n end\n end\n\n # Mass update ratings\n ActiveRecord::Base.transaction do\n ratings_to_update.each(&:save)\n end\n\n # Mass insert ratings\n Rating.import ratings_to_import\n\n return unless @options[:clear_existing]\n\n print_step 'Clearing unused queries'\n\n @acase.queries.each do |query|\n query.destroy if @queries[query.query_text].blank?\n end\n end",
"def import\n csv = CSV.parse(file, headers: true)\n ActiveRecord::Base.transaction do\n csv.each do |product|\n begin\n category = Category.find_or_create_by(title: product[1])\n product_obj = Product.find_or_create_by(pid: product[0])\n product_obj.update(name: product[2], price: product[3].to_i, category_id: category.id)\n rescue => e\n Rails.logger.error \"Error: Error in creating following products - #{product.inspect} - #{e.message} - #{e.backtrace.join(\"\\n\")}\"\n end\n end\n end\n end",
"def process\n uploaded_workbook = Spreadsheet.open self.path\n @records_matched = 0\n @records_updated = 0\n @records_failed = 0\n @failed_queries = 0\n @skipped_records = 0\n\n product_sheet = uploaded_workbook.worksheet(0)\n perform(product_sheet)\n\n if not uploaded_workbook.worksheet(1).nil?\n variant_sheet = uploaded_workbook.worksheet(1)\n perform(variant_sheet)\n end\nend",
"def do_feature_import(filename)\n country_type = Category.find_by_title('Nation')\n country_type_id = country_type.id\n current = 0\n feature_ids_with_changed_relations = Array.new\n feature_ids_with_object_types_added = Array.new\n puts \"#{Time.now}: Starting importation.\"\n self.do_csv_import(filename) do\n current+=1\n next unless self.get_feature(current)\n #begin\n self.add_date('features', self.feature)\n self.process_names(44)\n self.process_kmaps(15)\n feature_ids_with_object_types_added += self.process_feature_types(4)\n self.process_geocodes(4)\n feature_ids_with_changed_relations += self.process_feature_relations(15)\n self.process_contestations(3)\n self.process_shapes(3)\n self.process_descriptions(3)\n self.feature.update_attributes({:is_blank => false, :is_public => true})\n #rescue Exception => e\n # puts \"Something went wrong with feature #{self.feature.pid}!\"\n # puts e.to_s\n #end\n if self.fields.empty?\n puts \"#{Time.now}: #{self.feature.pid} processed.\"\n else\n puts \"#{Time.now}: #{self.feature.pid}: the following fields have been ignored: #{self.fields.keys.join(', ')}\"\n end\n end\n puts \"Updating cache...\"\n # running triggers on feature_relation\n feature_ids_with_changed_relations.each do |id| \n feature = Feature.find(id)\n feature.update_cached_feature_relation_categories\n feature.update_hierarchy\n end\n\n # running triggers for feature_object_type\n feature_ids_with_object_types_added.each do |id|\n feature = Feature.find(id)\n feature.update_cached_feature_relation_categories if !feature_ids_with_changed_relations.include? id\n feature.update_object_type_positions\n end\n puts \"#{Time.now}: Importation done.\"\n end",
"def csv_import\n @parsed_file=CSV::Reader.parse(params[:dump][:file], \";\")\n n=0\n @parsed_file.each do |row|\n c=Peca.new\n c.produto_id=row[0]\n c.codigo=row[1]\n c.descr=row[2]\n c.acab=row[3]\n c.larg=row[4]\n c.alt=row[5]\n c.prof=row[6]\n c.qtde=row[7]\n c.total=row[8]\n c.custo=row[9]\n c.fita=row[10]\n c.pino=row[11]\n c.embal=row[12]\n c.mdf=row[13]\n c.mdf2=row[14]\n c.ferr=row[15]\n c.ferr2=row[16]\n if c.save\n n=n+1\n GC.start if n%50==0\n end\n flash.now[:message]=\"Arquivo de peças importado com sucesso, #{n} registros adicionados à tabela.\"\n end\n end",
"def upload_file_record\n initalize_breadcrumb(\"Uploaded File(s)\", uploadedfile_datauploaders_path)\n @table_record = {data:[], draw: 1, recordsTotal:\"0\", recordsFiltered:\"0\",columns:[]}\n @table_name = params[:table_name]\n @summary = {total_record: 0, success_record: 0, error_record: 0}\n user_file_mappings = UserFileMapping.where(:table_name => @table_name).first\n #\n @summary[:total_record] = user_file_mappings.total_records ? user_file_mappings.total_records : 0\n @summary[:success_record] = user_file_mappings.success_records ? user_file_mappings.success_records : 0\n @summary[:error_record] = user_file_mappings.error_records ? user_file_mappings.error_records : 0\n if @summary[:total_record] >= 0 then\n @summary[:success_record] = @summary[:success_record] == 0 ? 0 : ((@summary[:success_record].to_f/@summary[:total_record])*100).round(2)\n @summary[:error_record] = @summary[:error_record] == 0 ? 0 : ((@summary[:error_record].to_f/@summary[:total_record])*100).round(2)\n end\n page_size = 10\n page_index = 0\n draw = 1\n search_value = '' \n order_column_index=0\n order_column_name =''\n order_type =\"ASC\"\n if params[:search] != nil then\n search_value = params[:search][\"value\"]\n end\n\n if (params[:length])\n page_size = params[:length]\n end\n\n if (params[:start])\n page_index = params[:start]\n end\n\n if (params[:draw])\n draw = params[:draw]\n @table_record[:draw]=draw\n end \n\n if params[:columns] != nil then\n params[:columns].each do |columns| \n @table_record[:columns].append(columns[1][\"data\"])\n end\n end\n if params[:order] != nil then\n params[:order].each do |order| \n order_column_index = order[1][\"column\"]\n order_type = order[1][\"dir\"] \n end \n end \n \n if @table_record[:columns].size > 0 \n order_column_name=@table_record[:columns][order_column_index.to_i]\n end \n\n response = DataUploader.get_table_data(@table_name, page_size, page_index, order_column_name,order_type,search_value, @table_record[:columns])\n if response.to_a.size > 0 then \n table_column_information = get_user_table_column_info(@table_name)\n response.each do |record|\n @table_record[:recordsTotal] = record[\"totalrecord\"]\n @table_record[:recordsFiltered] = record[\"filterrecord\"]\n puts \"%%%%%%%%%%%%%%%%%%%%%%%% record %%%%%%%%%%%%%%%%%%%%%%%%%%%%555\"\n puts record\n table_column_information.each do |column_info|\n if record.has_key?(column_info[:column_name])\n if column_info[:money_format] != '' then\n record[column_info[:column_name]] = record[column_info[:column_name]].to_s + column_info[:money_format].to_s\n elsif column_info[:percentage_format] == true then\n record[column_info[:column_name]] = record[column_info[:column_name]].to_s + \"%\" \n end \n end\n end\n\n uploaded_schema = DataUploader.get_uploaded_schema(@table_name)\n uploaded_schema.each do |table_schema|\n if ((record.has_key?(table_schema[:Field])) && (table_schema[:Type] == \"bool\")) then\n if (record[table_schema[:Field]] == \"t\") then\n record[table_schema[:Field]] = \"TRUE\"\n elsif (record[table_schema[:Field]] == \"f\") then\n record[table_schema[:Field]] = \"FALSE\"\n end\n end\n end\n\n @table_record[:data].append(record)\n end \n end\n initalize_breadcrumb(\"Uploaded File Record(s)\", uploadfilerecord_datauploaders_path) \n respond_to do |format| \n format.html \n format.js \n format.json { render :json => @table_record}\n end\n end",
"def import\n \tbegin #This might fail if input is incorrect. So put it in the begin block\n \t\tProduct.import(params[:file]) #Refer to the import method defined in the product model\n \t\tredirect_to root_url, notice: \"Products imported successfully\" #Give a success flash message if import is successful.\n rescue #Catch the failure here by displaying the suitable error message.\n \tredirect_to root_url, notice: \"Please upload valid csv\" #Give a failure message if import is unsuccessful\n \tend\n end",
"def import\n DispensarySourceProduct.import(params[:file])\n flash[:success] = 'Dispensary Source Products were successfully imported'\n redirect_to dispensary_source_products_admin_path \n end",
"def import!(path)\n data = self.class.read_text_file(path)\n # Only process 20 data rows now\n # TODO: Remove limit of the number of data rows later\n data = data[0...20]\n total_income = 0\n total_expense = 0\n transactions = []\n # Cache found categories\n categories = {}\n data.each do |d|\n # Find category which transaction belongs to\n category_name = d.delete(:category_name)\n category = categories[category_name] || Category.find_by_name(category_name)\n categories[category_name] = category\n\n # Not support yet creating user's category\n # TODO: Need to allow user to create own category of user\n d.merge! :category => category, :account_id => self.id\n transaction = Transaction.new(d)\n # Not support yet transfer type of transaction\n valid = transaction.valid?\n next if !valid || (valid && transaction.is_transfer?)\n transactions << transaction\n if transaction.is_income?\n total_income += transaction.amount\n else # transaction.is_expense?\n total_expense += transaction.amount\n end\n end\n self.class.transaction do\n transactions.each(&:save!)\n self.update_attributes! :income => total_income, :expense => total_expense\n end\n self\n end",
"def importTransactionsFile(filename)\n rules = Rule.all\n accounts={}\n numberTrans=0\n book = Spreadsheet.open filename\n book.worksheets.each do |worksheet|\n skipfirst = true\n cachedId=nil\n cachedName=nil\n worksheet.each do |row|\n if skipfirst \n skipfirst = false\n next\n end\n accountId=cachedId\n theAccountId=row[0].to_i\n if (theAccountId!=cachedName)\n puts(\"#########Account name #{theAccountId}\")\n accountId=findAccount(accounts,theAccountId)\n if accountId.nil?\n next\n else\n cachedId=accountId\n cachedName=theAccountId\n end\n end\n puts(accounts)\n Transaction.where( account_id: accountId, transaction_date: row[2], description: row[7] ).first_or_create( ) do |transaction|\n transaction.start_saldo = row[4]\n transaction.end_saldo = row[5]\n transaction.amount = row[6]\n transaction.category_id = setCategory(rules,row[7])\n transaction.save\n end\n accounts[cachedName][:number] +=1\n accounts[cachedName][:lastdate]=row[2]\n end\n storeAccountLastImport( accounts )\n File.delete(filename)\n end\n end",
"def upload_csv\n @title=\"Import Users\"\n if request.post?\n CSV.parse(params[:file].read, :encoding=>\"UTF-8\") do |row|\n row = row.collect(&:to_s).collect(&:strip).collect{|s| s.gsub(\"\\\"\", \"\")}\n # row = row[0].to_s.split(\"\\t\").collect(&:strip)\n\n\t Businessnew.create({:address=>row[3], :category=>row[10], :city=>row[4], :id=>row[0],\n :latitude=>row[9], :longitude=>row[8], :name=>row[1], :phone=>row[7],\n :postal_code=>row[6].split(\" \").join(''), :state=>row[5], :url=>row[2]}) if Businessnew.present?\n\n#force_encoding(\"UTF-8\")\n#.encode(\"ISO-8859-1\")\n#.force_encoding(\"ISO-8859-1\").encode(\"UTF-8\")\n#force_encoding(\"BINARY\")\n\n # CsvBusiness.create({\n # :address=>row[5],\n #:city=>row[6],\n #:company_name=>row[4],\n #:contact_name=>row[9],\n #:employee=>row[12],\n #:fax_number=>row[15],\n #:gender=>row[10],\n # :major_division_description=>row[0],\n # :phone_number=>row[14],\n # :province=>row[7],\n # :sales=>row[13],\n # :sic_2_code_description=>row[1],\n # :sic_4_code=>row[2],\n # :sic_4_code_description=>row[3],\n #:title=>row[11],\n #:zip_code=>row[8]\n # })\n\n=begin\n#20130615051307\n\t\tStoreTiming.create({:id=>row[0], :business_id=>row[1], :mon_from=>row[2], :mon_to=>row[3], :tue_from=>row[4], :tue_to=>row[5], :wed_from=>row[6], :wed_to=>row[7], :thur_from=>row[8], :thur_to=>row[9],\n :fri_from=>row[10], :fri_to=>row[11], :sat_from=>row[12], :sat_to=>row[13],\n :sun_from=>row[14], :sun_to=>row[15]})\n=end\n end\n\n flash[:notice] = \"Uploading completed.\"\n redirect_to root_path\n else\n render :layout => false\n end\n\n end",
"def import(filename)\n csv = SmarterCSV.process(filename, key_mapping: @mapping)\n progressbar = ProgressBar.create(total: csv.size, title: filename, format: '%t %c of %C |%B|')\n csv.each do |attrs|\n progressbar.increment\n attrs = Import.normalize_stamps(attrs)\n record = @klass.new(attrs)\n next unless record.valid? # skip invalid records\n\n record.save!\n end\n progressbar.finish\n end",
"def import_input_data(data)\n\n # clear all the old data\n #InputRecord.delete_all\n\n # grab the table out of the data file\n table = /<table.*?>(.*)<\\/table>/im.match(data.squish)\n # split into array rows based on <tr></tr> and do some cleanup\n tabledata = table[1].gsub(/\\ /,\" \").gsub(/ </,\"<\").gsub(/> /,\">\").gsub(/<b>|<\\/b>|<img.*?>|<\\/img>|<span.*?>|<\\/span>|<td.*?>|<a .*?>|<\\/a>/,\"\").scan(/<tr.*?>.*?<\\/tr>/im)\n # split by columns and remove extraneous tags\n tabledata.map!{ |row| row.gsub(/<tr.*?>/,\"\").gsub(/<\\/td><\\/tr>/,\"\").force_encoding(\"UTF-8\").gsub(/\\u{a0}/,\"\").split(\"</td>\")}\n\n data_columns = {\n \"Acronym\" => :acronym,\n \"Title\" => :title,\n \"Organization\" => :organization,\n \"Department\" => :department,\n \"Agency\" => :agency,\n \"RFP #\" => :rfp_number,\n \"Solicitation #\" => :rfp_number,\n \"Program Value\" => :program_value,\n \"Value($k)\" => :program_value,\n \"RFP Date\" => :rfp_date,\n \"Solicitation Date\" => :rfp_date,\n \"Status\" => :status,\n \"User List\" => :user_list,\n \"Project Award Date\" => :project_award_date,\n \"Projected Award Date\" => :project_award_date,\n \"Opportunity Id\" => :input_opportunity_number,\n \"Opp Id\" => :input_opportunity_number,\n \"Contract Type\" => :contract_type,\n \"Contract Type (Combined List)\" => :contract_type_combined,\n \"Primary Service\" => :primary_service,\n \"Contract Duration\" => :contract_duration,\n \"Last Updated\" => :last_updated,\n \"Competition Type\" => :competition_type,\n \"NAICS\" => :naics,\n \"Primary State of Perf.\" => :primary_state_of_performance,\n \"Summary\" => :summary,\n \"Comments\" => :comments,\n \"Latest News\" => :comments,\n \"DOD/Civil\" => :dod_civil,\n \"Incumbent\" => :incumbent,\n \"Contractor\" => :incumbent,\n \"Contractor (Combined List)\" => :contractor_combined,\n \"Incumbent Value\" => :incumbent_value,\n \"Contract Value($k)\" => :incumbent_value,\n \"Incumbent Contract #\" => :incumbent_contract_number,\n \"Contract Number\" => :incumbent_contract_number,\n \"Incumbent Award Date\" => :incumbent_award_date,\n \"Contract Award Date\" => :incumbent_award_date,\n \"Incumbent Expire Date\" => :incumbent_expire_date,\n \"Contract Expire Date\" => :incumbent_expire_date,\n \"Priority\" => :priority,\n \"Vertical\" => :vertical,\n \"Vertical (Combined List)\" => :vertical_combined,\n \"Segment\" => :segment,\n \"Segment (Combined List)\" => :segment_combined,\n \"Key Contacts\" => :key_contacts\n }\n\n # figure out which input columns map to which data columns\n keys = []\n cols = {}\n tabledata[0].each_index do |column|\n keys[column] = data_columns[tabledata[0][column].strip]\n cols[data_columns[tabledata[0][column]]] = column\n# puts \"found #{keys[column]} in #{cols[data_columns[tabledata[0][column]]]}\"\n end\n\n record_count = 0\n\n # load the data\n for row in 1..(tabledata.length-1) # for each row (except the header row)\n# puts \"loading row #{row}\"\n opportunity_number_column = cols[:input_opportunity_number]\n opportunity_number = tabledata[row][opportunity_number_column]\n record = InputRecord.find_or_create_by_input_opportunity_number(opportunity_number) # get the record or make a new one\n keys.each_index do |column| # for each column in the input file, update the attribute\n case keys[column]\n when :title #need special processing for title to split URL from actual title\n if tabledata[row][column] =~ /<a/\n data = /<a href=\"(.*?)\">(.*?)<\\/a>/i.match(tabledata[row][column])\n record.input_url = data[1] unless data[1].nil?\n record.title = data[2] unless data[2].nil?\n else\n record.title = tabledata[row][column]\n end\n when :department\n @dept = tabledata[row][column]\n when :agency\n if tabledata[row][column].nil?\n record.send(\"organization=\", \"#{@dept}\")\n else\n record.send(\"organization=\", \"#{@dept}/#{tabledata[row][column]}\")\n end\n when :rfp_date, :project_award_date, :last_updated, :incumbent_award_date, :incumbent_expire_date\n record.send(\"#{keys[column]}=\",GovwinIQ.fix_input_date(tabledata[row][column]))\n else\n record.send(\"#{keys[column]}=\", tabledata[row][column]) unless keys[column].nil?\n end\n end\n record.save!\n record_count += 1\n end\n\n return record_count\n end",
"def import_reading_lookup_values lines, types=@lookup_attributes, validate=false, delete_all=true\n ActiveRecord::Base.transaction do |transaction|\n #returns a hash of arrays of values\n unique_values = get_unique_values types, lines\n unique_values.each_pair do |column,values|\n #assume model name same as attribute name\n table = eval(column.to_s.capitalize)\n table.delete_all if delete_all\n #make assumption name that e.g. kunyomi is column\n #Kunyomi is model, with exception of skip_pattern\n if column == :skip\n column = :skip_pattern\n end\n if values.any?\n #convert values array to 2D array for ar-extensions import\n values2d =[]\n values.each do |v|values2d<<[v];end\n puts \"importing #{table}\"\n table.import [column],values2d, :validate=>validate\n puts \"imported #{table}\"\n end\n\n end\n end\n\n generate_lookups()\n end",
"def import_data path, file_type\n if file_type == :csv\n csv_parse(path).each { |params| Product.new(params).save }\n elsif file_type == :xls\n #xls_parse(path)\n end\nend",
"def parse_file(src, dest)\n create_table(dest)\n\n puts \"***** Importing #{dest}\"\n\n count = 0\n# names = File.foreach(src).collect do |line|\n names = open(src).collect do |line| \n count += 1\n if count % 2000 == 0\n puts count\n end\n\n data = line.split\n\n name = data.first.capitalize\n freq = data[2].to_f\n\n name = if dest == \"surname\"\n cleanup_surname(name)\n else\n cleanup_firstname(name)\n end\n\n {:name => name, :freq => freq}\n end\n\n puts \"loading into db\"\n\n # remove any existing records\n @db[dest.to_sym].truncate\n\n # insert!\n @db[dest.to_sym].multi_insert(names)\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 import!(data)\n pointer = 0\n date_format_checked = false\n time_format_checked = false\n record_count = nil\n actual_record_count = 0\n \n Measurement.transaction do\n begin\n cells = []\n cells_count, pointer = CSV.parse_row(data, pointer, cells)\n unless date_format_checked\n date_format_checked = raise_if_unsupported_date_format(cells.first)\n next\n end\n unless time_format_checked\n time_format_checked = raise_if_unsupported_time_format(cells.first)\n next\n end\n unless record_count\n record_count = extract_measurements_count(cells.first) \n next\n end\n measurement = extract_measurement(cells)\n if measurement\n measurement.save! unless measurement == :not_a_measurement\n actual_record_count += 1\n end\n end while cells_count > 0\n \n if record_count || (actual_record_count > 0)\n unless record_count == actual_record_count\n raise Importers::ConflictingRecordCountError.new(record_count,\n actual_record_count)\n end\n end\n end\n \n self\n end",
"def import!\n Version.transaction do\n Version.delete_all\n records.each do |record|\n begin\n import_record(record)\n rescue ActiveRecord::RecordNotFound\n Rails.logger.warn \"Unable to import #{record.primary_identifier} - no matching Book entry for DCL dcl:#{record.dcl_number}\"\n rescue ActiveRecord::RecordInvalid => e\n Rails.logger.warn \"Unable to import #{record.primary_identifier} - failed validations: #{e}\"\n end\n end\n end\n reindex!\n end",
"def importx(file, name, attr=nil)\n\n case File.extname(file)\n when '.csv' then spreadsheet = Roo::Csv.new(file) #, nil, :ignore)\n when '.xls' then spreadsheet = Roo::Excel.new(file, nil, :ignore)\n when '.xlsx' then spreadsheet = Roo::Excelx.new(file) #, nil, :ignore)\n else raise \"Unknown file type: #{file}\"\n end\n\n if name != 'ApplicationRecord'\n begin\n spreadsheet.default_sheet = name\n rescue\n raise \"ya, you're gonna need a spreadsheet tab labeled '#{name}' for this to work\\r\\n\"\n end\n end\n model = name.constantize\n header = spreadsheet.row(1)\n types = spreadsheet.row(2)\n\n #print \"file=#{file}, model=#{model} name=#{name} header=#{header} def=#{spreadsheet.default_sheet}\\n\"\n\n # @todo WISE!! restrict accessible columns for import\n attr = attr.map { |str| str.to_s} if !attr.nil?\n (3..spreadsheet.last_row).each do |i|\n row = Hash[[header, spreadsheet.row(i)].transpose]\n begin\n item = model.find_by_id(row['id']) || model.new\n rescue\n print \"ya, you're gonna need a dB table '#{model.name.downcase.pluralize}' for this to work\\r\\n\"\n exit\n end\n\n item.attributes = attr.nil? ? row : row.to_hash.slice(*attr)\n item.attributes['password'] = item.attributes['password'].to_s if spreadsheet.default_sheet == 'User'\n item.save!\n end\n\n begin\n name = model.name.underscore.pluralize\n result = model.maximum(:id).next\n cmd = \"ALTER SEQUENCE #{name}_id_seq RESTART WITH #{result}\"\n ActiveRecord::Base.connection.execute(cmd)\n puts \"#{spreadsheet.last_row-2} records imported into #{model.name}, #{name}_id_seq=#{result}\"\n rescue\n puts \"Warning: not procesing table #{name.name}. Id is missing?\"\n end\n\n spreadsheet.last_row-2 # this is how many rows we imported\n end",
"def run\n start_time = Time.now\n\n setup\n\n importer_run.update_attributes( started_at: start_time,\n source_model: source_model.name,\n destination_model: destination_model.name,\n importer_version: VERSION )\n\n # get a total count of records to process, bail out if none are found\n count = base_query(false).count\n\n logger.info \"\"\n if count == 0\n logger.info \"no #{source_model.name.pluralize} to import, exiting\"\n return\n end\n\n logger.info \"Starting import from #{source_model.table_name} into #{destination_model.name}...\"\n\n # step through the records in batches\n (0..count).step(batch_size) do |offset|\n thread_pool.schedule do\n with_connections do\n batch_elapsed_time = Benchmark.realtime do\n logger.info \"Importing from #{source_model.table_name} into #{destination_model.name} (#{offset / batch_size + 1}/#{count / batch_size + 1})\"\n\n # wipe the slate from the last batch\n prepare_for_new_batch\n\n benchmarks[:source_db] << Benchmark.realtime do\n # grab this batch of records from source\n fetch_records(offset)\n end\n\n # bail if there aren't any\n next if records.empty?\n\n logger.info \" #{records.count} source records fetched in #{benchmarks[:source_db].last}s\"\n if source_order_by\n logger.info \" #{source_order_by}: from #{records.first.read_attribute(source_order_by)} to #{records.last.read_attribute(source_order_by)}\"\n end\n\n # process this batch of records\n process_batch(records)\n\n logger.info \" #{records.count} records processed in #{benchmarks[:processing].last}s\"\n\n insert_and_update_batch\n end\n logger.info \" batch processed in #{batch_elapsed_time}s\"\n end\n end\n end\n thread_pool.shutdown\n \n print_validation_errors\n\n logger.info \"-------------------------------------------------\"\n logger.info \"Processing: #{benchmarks[:processing].sum}s total, #{benchmarks[:processing].sum / count}s per record\"\n logger.info \"source Database: #{benchmarks[:source_db].sum}s total, #{benchmarks[:source_db].sum / count}s per record\"\n logger.info \"dest Database: #{benchmarks[:destination_db].sum}s total, #{benchmarks[:destination_db].sum / count}s per record\"\n logger.info \"Total: #{Time.now - start_time}s elapsed\"\n importer_run.update_attributes( completed_at: Time.now )\n rescue Exception => e\n importer_run.update_attributes( error_trace: \"#{e.class} - #{e.message}\\n#{e.backtrace.join(\"\\n\")}\" )\n raise e\n ensure\n importer_run.update_attributes( records_created: records_created,\n records_updated: records_updated,\n duration: ((Time.now - start_time) * 1000).round,\n validation_errors: validation_errors )\n end",
"def import!\n import_binary_files\n member_ids = []\n source_metadata_adapter.query_service.find_members(resource: source_resource).each do |member|\n member = self.class.import(source_resource: member, source_metadata_adapter: source_metadata_adapter, change_set_persister: change_set_persister)\n # Set this property so derivatives will run, acts like a FileAppender.\n source_change_set.created_file_sets += [member] if member.is_a?(FileSet)\n member_ids << member.id\n end\n # Get rid of non-preserved members. If they're not preserved, it was\n # probably a bug - e.g. page 3 didn't make it into preservation.\n source_change_set.try(:member_ids=, member_ids)\n output = change_set_persister.save(change_set: source_change_set, external_resource: true)\n output\n end",
"def import \n NewBiosensor.import(params[:file])\n redirect_to root_url, notice: \"Biosensors imported\" \n end",
"def import\n log.debug(\"Importing from #{@location}\")\n id = File.basename(@location)\n record = storage_engine.get_by_id(id)\n raise MainControllerError, \"Cannot import a non-exist record\" if record.nil?\n record.whitelist = file_rw_manager.read(\"#{@location}/whitelist\")\n record.blacklist = file_rw_manager.read(\"#{@location}/blacklist\")\n record.qual = \"true\"\n record.auditor = @auditor\n storage_engine.update(record)\n log.info(\"Qualified record #{id} has been successfully imported\")\n end",
"def import_efforts\n authorize @event\n file_url = FileStore.public_upload('imports', params[:file], current_user.id)\n if file_url\n if Rails.env.production?\n ImportEffortsJob.perform_later(file_url, @event, current_user.id, params.slice(:time_format, :with_times, :with_status))\n render json: {message: 'Import in progress.'}\n else\n ImportEffortsJob.perform_now(file_url, @event, current_user.id, params.slice(:time_format, :with_times, :with_status))\n render json: {message: 'Import complete.'}\n end\n else\n render json: {errors: ['Import file too large.']}, status: :bad_request\n end\n end",
"def import_data\n begin\n #Get products *before* import - \n @products_before_import = Product.all\n @products_before_import.each { |p| p.destroy }\n OptionType.all.each{ |p| p.destroy }\n\n columns = ImportProductSettings::COLUMN_MAPPINGS\n rows = FasterCSV.read(self.data_file.path, :col_sep => '|')\n \n \n log(\"Importing products for #{self.data_file_file_name}, path is #{self.data_file.path} began at #{Time.now}\")\n num_imported = 0\n\n rows[ImportProductSettings::INITIAL_ROWS_TO_SKIP..-1].each do |row|\n product_information = {}\n num_imported += 1\n #next if (row[columns['Fabricante']] =~ /FAST/).nil?\n \n #Easy ones first\n product_information[:sku] = row[columns['PN']]\n product_information[:name] = row[columns['Referencia']]\n # remove commas from prices, assume the point is the decimal separator\n product_information[:price] = format_price row[columns['Precio']] unless row[columns['Precio']].nil?\n product_information[:cost_price] = format_price row[columns['Coste']] unless row[columns['Coste']].nil?\n product_information[:available_on] = DateTime.now - 1.day #Yesterday to make SURE it shows up\n product_information[:description] = row[columns['Descripcion-es']] unless row[columns['Descripcion-es']].nil?\n product_information[:on_hand] = row[columns['Stock']] unless row[columns['Stock']].nil?\n\n log(\"Importing #{product_information[:sku]}, named #{product_information[:name]}, price #{product_information[:price]}\")\n\n #Create the product skeleton - should be valid\n product_obj = Product.new(product_information)\n unless product_obj.valid?\n log(\"A product could not be imported - here is the information we have:\\n #{ pp product_information}\", :error)\n next\n end\n \n #Save the object before creating asssociated objects\n product_obj.save\n\n # apply the properties if relevant\n find_and_assign_property_value('Volumen', row[columns['Volumen']], product_obj)\n\n #Now we have all but images and taxons loaded\n # Seccion + Fabricante\n associate_taxon('Productos', seccion(row[columns['Seccion']]), product_obj)\n associate_taxon('Marcas', row[columns['Fabricante']], product_obj)\n \n #Just images \n ipath = ImportProductSettings::PRODUCT_IMAGE_PATH \n imagefiles = Dir.new(ipath).entries.select{|f|f.include?(row[columns['PN']])}\n imagefiles.each{|f| find_and_attach_image(f, product_obj)} unless imagefiles.empty?\n log(\"#{imagefiles.size} found for #{product_information[:sku]}, named #{product_information[:name]}\")\n #find_and_attach_image(row[columns['Image Main']], product_obj)\n #find_and_attach_image(row[columns['Image 2']], product_obj)\n #find_and_attach_image(row[columns['Image 3']], product_obj)\n #find_and_attach_image(row[columns['Image 4']], product_obj)\n\n # now the variants (this works, but can be implemented more elegant :)\n variants_name = File.basename(self.data_file_file_name, \".csv\") + \"_variants.csv\"\n variantsfile = ImportProductSettings::VARIANTS_PATH + variants_name \n File.open(variantsfile).readlines.each do |l|\n mpn,pn,ot,val,stock,price = l.split('|').map{|e|e.gsub('\"','')}\n price = format_price price.chomp unless price.nil?\n #log \"check if variant #{product_obj.sku} belongs to #{mpn}\"\n if product_obj.sku == mpn then\n log \"variant #{pn} belongs to #{mpn}\"\n opt_type = product_obj.option_types.select{|o| o.name == ot}.first\n\t opt_type = product_obj.option_types.create(:name => ot, :presentation => ot.capitalize) if opt_type.nil?\n new_value = opt_type.option_values.create(:name => val, :presentation => val)\n\t ovariant = product_obj.variants.create(:sku => pn)\n ovariant.count_on_hand = stock\n ovariant.price = price unless price.nil?\n\t ovariant.option_values << new_value\n imagefiles = Dir.new(ipath).entries.select{|f|f.include?(pn)}\n unless imagefiles.empty?\n imagefiles.each{|f| find_and_attach_image(f, ovariant)} \n log(\"#{imagefiles.size} found for variants of #{product_information[:sku]},named #{product_information[:name]}\")\n end\n log(\" variant priced #{ovariant.price} with sku #{pn} saved for #{product_information[:sku]},named #{product_information[:name]}\")\n\t ovariant.save!\n end\n end\n \n log(\"product #{product_obj.sku} was imported at #{DateTime.now}\")\n end\n \n rescue Exception => exp\n log(\"An error occurred during import, please check file and try again. (#{exp.message})\\n#{exp.backtrace.join('\\n')}\", :error)\n return [:error, \"The file data could not be imported. Please check that the spreadsheet is a CSV file, and is correctly formatted.\"]\n end\n \n #All done!\n return [:notice, \"Product data was successfully imported by fer.\"]\n end",
"def transaction_import_process(send_transaction)\n readcsv\n check\n save\n send_to_acx if send_transaction\n end",
"def import\n respond_to do |format|\n begin\n # process upload file, must be xls/xlsx(better, 'cause xls only can upload 65000 rows)\n @asset_categorization = AssetCategorization.import(params[:file])\n format.html { render action: \"new\" }\n rescue => e\n format.html { redirect_to upload_asset_categorizations_url, flash: { error: e.message } } \n end\n end\n end",
"def import\n @imported_count = 0\n\n # Reject if the file attribute is nil or empty.\n if file.blank?\n errors.add(:base, \"No file is specified\") and return\n end\n\n CSV.foreach(file.path, headers: true, header_converters: :symbol) do |row|\n # Crete a user in memory.\n user = User.assign_from_row(row)\n\n # Try to save it in the database.\n if user.save\n @imported_count += 1\n else\n # The magic variable $. keeps track of the last line read in a file.\n errors.add(:base, \"Line #{$.} - #{user.errors.full_messages.join(', ')}\")\n end\n end\n end",
"def import\n DispensarySource.import(params[:file])\n flash[:success] = 'Dispensary Sources were successfully imported'\n redirect_to dispensary_sources_admin_path \n end",
"def transform index_file\n @config_hash = YAML.load(ERB.new(File.read(@config_yml)).result(binding))\n InputBatch::Log.write_log \"Opened csv file for processing\"\n InputBatch::Log.write_log \"Batch type to load : #{facility.batch_load_type.upcase}\"\n\n @index_file_name = File.basename(index_file).downcase\n load_flag = true\n @corresp_flag = true\n @version = facility.index_file_parser_type.downcase.include?('_bank') ? 'BANK_OF_AMERICA' : 'GENERAL'\n begin\n @csv = CSV.read(index_file, :col_sep => config_hash['COL_SEP'] )\n rescue\n raise \">>>>>>>> Invalid index file.....\"\n end\n @type = call_parser_specific_method \"find_type\"\n @image_folder = Dir.glob(\"#{@location}/**/#{config['IMAGE']['image_folder']}*\", File::FNM_CASEFOLD)\n unless @image_folder.blank?\n @image_path = @image_folder.first.split('/')[0..-2].join('/')\n\n raise \"Image Folder Mismatch : Please check for folder (case insensitive)\n '#{config['IMAGE']['image_folder']}' in batch zip \" if @image_folder.blank?\n\n @image_ext =File.extname(@image_folder[0]).delete(\".\")\n end\n InputBatch::Log.write_log \">>>>>Index Transformation Starts \" + Time.now.to_s\n @jobs = []\n header_row = config[\"HEADER_ROW\"]\n csv.shift(header_row) #skipping rows upto header\n unless csv.blank?\n raise \">>>> Error in date field. Dates should be unique for all the batches\" unless unique_date?\n\n if (@sitecode == '00Q49' && type == 'CORRESP' && csv[0][config['IMAGE']['image_file_name']].to_s.strip =~ /^\\d+$/) # DAP Correspondence logic\n @single_image_batch = true\n current_job_image = image_folder.detect{|file| File.extname(file) =~ /^.[t,T][i,I][f,F]$/ }\n dir_name = File.dirname(current_job_image)\n file_name = File.basename(current_job_image).split('.').first\n @page_count = %x[identify #{current_job_image}].split(File.basename(current_job_image)).length-1 rescue nil\n system(\"tiffsplit #{current_job_image} #{dir_name}/#{file_name}\")\n end\n csv.each_with_index do |row, index|\n @row_index = index + 1\n @row = row\n if !@row[0].blank?\n load_flag = eval(\"InputBatch.is_#{type.downcase}_process(facility)\") if job_condition\n if load_flag\n InputBatch::Log.status_log.info \"**** Processing index file row #{@row_index} ****\"\n save_records if valid_record?\n end\n end\n end\n @inbound_file_information.associate_to_report_check_informations if !@inbound_file_information.blank?\n end\n InputBatch::Log.write_log \">>>>>Index Transformation Ends \" + Time.now.to_s\n\n end",
"def run (hdin)\n i = 0;\n dups = 0;\n puts \"Reading from #{hdin.path}\";\n\n # Opens temporary loadfile. Overwrites existing file.\n @loadfiles.values.each do |hdout|\n hdout.open('w');\n end\n\n # Open infile and process line.\n hdin.open('r').file.each_line do |line|\n i += 1;\n\n # Skip stuff that doesn't look like json.\n if !line.start_with?('{') then\n STDERR.puts \"Skipping line: #{line}\";\n next;\n # For testing purposes.\n # elsif i > 2000 then\n # puts \"ok we are done here\";\n # break;\n elsif i % 1000 == 0 then\n puts \"#{i} ...\";\n end\n\n # gd_id is the id used as primary key in hathi_gd\n # and foreign key in all other tables, connecting the snowflake.\n gd_id = nil;\n item_id = nil;\n line_hash = JSON.parse(line);\n\n # The file where the data originally came from, not the file currently being read.\n infile = line_hash['infile'];\n file_id = get_infile_id(infile);\n # We don't want to include lineno or mongo_id in digest, so we delete them from the hash.\n lineno = line_hash.delete('lineno');\n mongo_id = line_hash.delete('mongo_id');\n # hashsum goes in hathi_gd to make sure we don't put total dups in there.\n hashsum = @sha_digester.hexdigest(line_hash.to_json);\n\n # Not all records have a record id.\n rec_id = 'N/A';\n if !line_hash['record_id'].nil? then\n rec_id = line_hash['record_id'].first.values.first;\n\n if rec_id.length > @max_record_id_len then\n rec_id = rec_id[0..(@max_record_id_len-1)];\n end\n\n\n end\n\n if !line_hash['item_id'].nil? then\n if line_hash['item_id'].first.class == {}.class then\n item_id = line_hash['item_id'].first.values.first;\n if item_id.size > 50 then\n # Make sure we fit in the column.\n item_id = item_id[0..49];\n end\n end\n end\n\n # Get a gd_id from mysql.\n # Use it as primary key in hathi_gd.\n # Use it in all the tables (except hathi_str) as foreign key.\n begin\n @hathi_gd_insert_q.execute(1, file_id, lineno, mongo_id, hashsum, rec_id, item_id);\n @last_id_q.query() do |row|\n gd_id = row[:id];\n end\n rescue Java::ComMysqlJdbcExceptionsJdbc4::MySQLIntegrityConstraintViolationException => e\n if (e.to_s =~ /Duplicate entry.+for key 'hashsum'/) == 0 then\n dups += 1;\n next;\n else\n puts e;\n puts line;\n end\n end\n # If we got a gd_id, proceed to insert the rest.\n insert_line(line_hash, gd_id);\n end\n hdin.close();\n\n # When all the lines in the file have been read and the loadfiles are done,\n # use the loadfiles for their intended purpose.\n @loadfiles.keys.each do |suffix|\n loadfile = @loadfiles[suffix];\n loadfile.close();\n sql = \"LOAD DATA LOCAL INFILE ? REPLACE INTO TABLE hathi_#{suffix} (gd_id, str_id, marc_field)\";\n puts sql;\n query = @conn.prepare(sql);\n query.execute(loadfile.path);\n # loadfile.delete();\n end\n\n puts @bench.prettyprint();\n puts \"#{dups} dups\";\nend",
"def create\n unless params[:import].present?\n flash[:error] = \"A file must be selected for upload\"\n redirect_to imports_path\n return\n end\n if params[:replace].present?\n Minute.destroy_all\n Request.destroy_all\n Item.destroy_all\n Meeting.destroy_all\n Import.destroy_all\n Minst.destroy_all # NOTE: initial values are seeded. Reading from a spreadsheet replaces these.\n end\n Rails.application.config.importing = true # Supress validation checks for Minutes during import.\n @import = Import.new(import_params)\n uploaded_io = params[:import][:filename]\n filepath = Rails.root.join(\"public\", \"uploads\", uploaded_io.original_filename)\n @import.filename = filepath\n @import.content_type = uploaded_io.content_type\n if @import.content_type == \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"\n File.open(filepath, \"wb\") do |file|\n file.write(uploaded_io.read)\n end\n book = RubyXL::Parser.parse filepath\n totals = book[\"Totals\"]\n master = book[\"Master\"]\n minutes = book[\"Minutes\"]\n\n #\n # Import from the TOTALS tab\n #\n\n # Read columns B and D, where column C is a hyphen, to populate the possible Status values\n # of minutes (stored in minst_id) and items (stored in ??).\n totals.each do |totalsrow|\n next unless totalsrow && totalsrow[2] && totalsrow[2].value == \"-\"\n next unless totalsrow[1] && !totalsrow[1].value.blank?\n next unless totalsrow[3] && !totalsrow[3].value.blank?\n\n Minst.find_or_create_by(code: totalsrow[1].value) do |m|\n m.name = totalsrow[3].value.gsub(/<[bB][rR]>/, \" \")\n end\n end\n\n #\n # Import from the MASTER tab\n #\n\n # Read the second row, containing the meeting names, and create Meeting objects for them.\n # Associate the column numbers with the Meeting objects.\n meetings = []\n meetnamerow = master[1]\n meetnamerow[(j = 6)..meetnamerow.cells.count - 1].each do |mtgcell|\n mtgname = mtgcell.value\n break if mtgname.nil? || mtgname.length <= 1 || mtgname.blank?\n\n # Date.parse will parse a date from the start of the string.\n # If of the form \"Mar 2013 interim\" the date will be 2013-03-01.\n\n meetingdate = Date.parse(mtgname)\n meeting = Meeting.find_or_create_by(date: meetingdate) do |m|\n m.date = meetingdate\n # Pick one of these words as the meeting type if present\n mtgtype = mtgname.match(/[iI]nterim|[Pp]lenary|[tT]elecon\\w*|[cC]on\\w*|[cC]all/)\n m.meetingtype = mtgtype && mtgtype[0].capitalize\n # Otherwise, go for the word after the word containing the year\n if mtgtype.nil?\n words = mtgname.split(\"\\s\")\n pos = words.index { |word| word =~ /\\d{4}/ }\n if pos\n word = words[pos + 1]\n m.meetingtype = word.capitalize if word\n end\n end\n end\n meetings[j] = {name: mtgname, mtg: meeting}\n j += 1\n end\n\n # Read each row of the MASTER tab starting at the third row. Identify rows with a valid item number\n # and create (or find) Items for each.\n i = 0\n\n master.to_a[2..].each do |itemrow| # the 2 says skip the first two rows.\n i += 1\n next unless itemrow[0] && itemrow[0].value =~ /\\d\\d\\d\\d/\n\n # NOTE: the items inside the \"do\" will not be updated on a merge import.\n item = Item.find_or_create_by!(number: itemrow[0].value) do |it|\n it.number = itemrow[0].value\n it.date = Date.parse(itemrow[1].value)\n it.standard = itemrow[2].value\n it.clause = itemrow[3].value\n end\n # These fields should be updated on a merge input.\n # They aren't part of the original Maintenance Request, and may have changed.\n item.subject = itemrow[4].value\n item.draft = itemrow[5].value\n\n # Iterate over the columns (starting at the 7th) in the row and create a Minute entry per column.\n # Record the status and the Meeting in the minutes entry.\n itemrow[(j = 6)..itemrow.cells.count - 1].each do |stscell|\n j += 1\n next if stscell.nil?\n\n sts = stscell.value\n next if sts == \"-\"\n\n break if sts == \"#\"\n\n if meetings[j - 1].nil?\n ref = RubyXL::Reference.ind2ref(stscell.row, stscell.column)\n raise SyntaxError, \"No meeting exists in Master tab corresponding to status entry #{sts} in #{ref}\"\n end\n\n min = item.minutes.find_or_initialize_by(meeting_id: meetings[j - 1][:mtg].id) do |m|\n m.minst = Minst.where(code: sts).first\n m.meeting = meetings[j - 1][:mtg]\n end\n item.minutes << min if min.new_record?\n next if min.save\n\n min.errors.full_messages.each do |e|\n puts e\n end\n raise \"Can't save minute\"\n end\n\n next if item.save\n\n item.errors.full_messages.each do |e|\n puts e\n end\n raise \"Can't save item\"\n end\n\n #\n # Import from the MINUTES tab\n #\n\n # Rows in the MINUTES tab come in sets of three, starting with the second row in the tab.\n # 1. Contains the item number and for each meeting, the date of the minutes entry.\n # 2. For each meeting, contains the text of the minutes.\n # 3. Contains nothing of use.\n rowno = 1\n while (inum = minutes[rowno][1].value) =~ /\\d\\d\\d\\d/\n item = Item.where(number: inum).first\n raise \"Missing entry on Master sheet for item #{inum} from Minutes tab\" if item.nil?\n\n datesrow = minutes[rowno]\n textrow = minutes[rowno + 1]\n j = 3\n while j < [datesrow.cells.count, textrow.cells.count].max\n mindate = datesrow[j]&.value\n # If there's no existing minute entry but the spreadsheet has one, we create one\n # This logic seems tortuous - there must be a better way to do it.\n if meetings[j + 3].nil?\n ref = RubyXL::Reference.ind2ref(rowno, j)\n raise SyntaxError, \"No meeting exists on Master tab corresponding to cell #{ref} on Minutes tab\"\n end\n\n min = item.minutes.where(meeting_id: meetings[j + 3][:mtg].id).first\n changed = false\n if min.nil? && (!mindate.blank? || !(textrow[j].nil? || textrow[j].value.blank?))\n min = item.minutes.create(meeting: meetings[j + 3][:mtg])\n changed = true\n end\n if !mindate.blank? && min.date.blank?\n min.date = mindate\n changed = true\n end\n if !(textrow[j].nil? || textrow[j].value.blank?) && min.text.blank?\n min.text = textrow[j].value\n min.date = meetings[j + 3][:mtg].date if min.date.blank? && !min.text.blank?\n changed = true\n end\n\n if changed && !min.save\n min.errors.full_messages.each do |e|\n puts e\n end\n raise \"Can't save minute\"\n end\n # If there's an existing minute entry, we don't change it even if the spreadsheet has no entry.\n j += 1\n end\n rowno += 3\n end\n\n # Annoyingly, we have to go through all the items and save them, so that the minsts gets updated.\n Item.all.each(&:save)\n @import.imported = true\n else\n @import.errors.add(:imports, \"must be an Excel spreadsheet (not #{@import.content_type})\")\n flash[:error] = @import.errors.full_messages.to_sentence\n puts \"#{filepath}: not an Excel spreadsheet (#{@import.content_type})\"\n end\n Rails.application.config.importing = false\n\n respond_to do |format|\n if @import.errors.count.zero? && @import.save\n format.html { redirect_to imports_url, notice: \"File was successfully imported\" }\n format.json { render :show, status: :created, location: @import }\n else\n format.html { render :new }\n format.json { render json: @import.errors, status: :unprocessable_entity }\n end\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 parse\n\t\tresults = []\n\t\tif !self.csv_file_file_name.blank? &&\n\t\t\t\tFile.exists?(self.csv_file.path)\n\t\t\t(f=FasterCSV.open( self.csv_file.path, 'rb',{\n\t\t\t\t:headers => true })).each do |line|\n\n#\t\"Masterid\",\"Motherid\",\"Record_Owner\",\"Datereceived\",\"Lastatt\",\"Lastdisp\",\"Currphone\",\"Vacauthrecd\",\"Recollect\",\"Needpreincentive\",\"Active_Phone\",\"Recordsentformatching\",\"Recordreceivedfrommatching\",\"Sentpreincentive\",\"Releasedtocati\",\"Confirmedcaticontact\",\"Refused\",\"Deceasednotification\",\"Eligible\",\"Confirmationpacketsent\",\"Catiprotocolexhausted\",\"Newphonenumreleasedtocati\",\"Pleanotificationsent\",\"Casereturnedtoberkeleyfornewinf\",\"Casereturnedfromberkeley\",\"Caticomplete\",\"Kitmothersent\",\"Kitinfantsent\",\"Kitchildsent\",\"Kitadolescentsent\",\"Kitmotherrefusedcode\",\"Kitchildrefusedcode\",\"Noresponsetoplea\",\"Responsereceivedfromplea\",\"Senttoinpersonfollowup\",\"Kitmotherrecd\",\"Kitchildrecvd\",\"Thankyousent\",\"Physrequestsent\",\"Physresponsereceived\"\n\n#\n#\tThe IcfMasterTracker will include an after_save or something that will\n#\tdetermine what has changed and update appropriately. It may also\n#\tcreate OperationalEvents to document the data changes. As it is\n#\ttheoretically possible that the Masterid does not exist in the identifiers\n#\ttable, perhaps add a successfully_updated_models flag which could\n#\tbe used?\n#\n\t\t\t\ticf_master_tracker = IcfMasterTracker.find_or_create_by_Masterid(line['Masterid'])\n\t\t\t\t#\tNO BANG. Don't want to raise any errors.\n\t\t\t\tsuccessfully_updated = icf_master_tracker.update_attributes(line.to_hash)\n#\n#\terrors = icf_master_tracker.errors.full_messages.to_sentence\n#\tThese won't be validation errors as there shouldn't be any.\n#\tPerhaps \"no column by that name\" errors if csv file changes?\n#\n#\tAdd successfully_updated value?\n#\t\ticf_master_tracker.update_attribute(:sucessfully_updated, successfully_updated)\n#\twill the above include the line's attributes?\n#\n#\tAdd update_errors column?\n#\t\ticf_master_tracker.update_attribute(:update_errors, errors)\n#\n\n\t\t\t\tresults.push(icf_master_tracker)\n\n\t\t\tend\t#\t(f=FasterCSV.open( self.csv_file.path, 'rb',{ :headers => true })).each\n\t\tend\t#\tif !self.csv_file_file_name.blank? && File.exists?(self.csv_file.path)\n\t\tresults\t#\tTODO why am I returning anything? will I use this later?\n\tend",
"def process\n validate_file_type(@file_name, 'csv')\n convert_csv_file_to_object\n end",
"def update(uploaded_file)\n super\n record.save(raise_on_failure: true)\n end",
"def import\n\n output = ''\n\n country_src = 'tmp/Countries.txt'\n \n rs = File.open(country_src)\n rs.gets # <-- remove first line (columns header) \"CountryID:Title\"\n countries = {}\n City.delete_all\n Region.delete_all\n Country.delete_all\n\n while (row = rs.gets) \n row = row.split(':')\n row[0].gsub!(/\\n/, '')\n row[1].gsub!(/\\n/, '')\n countries[row[0]] = {:name => row[1], :regions => {}, :model => nil}\n c = Country.new\n c.iso = row[0]\n c.name = row[1]\n c.save\n countries[row[0]][:model] = c\n end\n\n regions_src = 'tmp/Regions.txt'\n \n rs = File.open(regions_src)\n rs.gets # <-- remove the 1st line (header row) #CountryID:RegionID:Title\n while (row = rs.gets) \n row = row.split(':')\n row[0].gsub!(/\\n/, '')\n row[1].gsub!(/\\n/, '')\n row[2].gsub!(/\\n/, '')\n c = countries[row[0]][:model]\n r = Region.new\n r.iso = row[1]\n r.country_id = c.id\n\n # magic trick to ignore UTF-8 chars for now.\n ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')\n r.name = ic.iconv(row[2] + ' ')[0..-2]\n r.save\n countries[row[0]][:regions][row[1]] = r\n\n end\n\n cities_src = 'tmp/Cities.txt'\n \n rs = File.open(cities_src)\n rs.gets # <-- remove 1st row (header) #CountryID:RegionID:Title:Latitude:Longitude\n while(row = rs.gets)\n row = row.split(':')\n row[1].gsub!(/\\n/, '')\n row[2].gsub!(/\\n/, '')\n row[3].gsub!(/\\n/, '')\n row[4].gsub!(/\\n/, '')\n \n r = countries[row[0]][:regions][row[1]]\n if (!r.nil?) \n c = City.new\n ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')\n c.name = ic.iconv(row[2] + ' ')[0..-2] \n c.region_id = r.id\n c.lat = row[3]\n c.lng = row[4]\n c.save\n end\n end\n\n output += '<h1>Import complete</h1>'\n render(:text => output, :layout => false)\n end",
"def perform\n check_file # checks if the file uploaded is valid\n save_file_entry # Uploads the file to the server and saves a entry to database\n end",
"def process_upload!\n init_error_report\n\n if fail_on_error?\n handle_save_nothing_on_error\n else\n handle_save_clean_orders\n end\n\n store_error_report if result.failed?\n self.processed_at = Time.zone.now\n save!\n end",
"def run\n parse do\n self.current_sheet.processing!\n ss = Roo::Spreadsheet.open(self.new_file_path)\n current_uploader = Uploader.find(self.uploader_id)\n total_count = ss.last_row - 1\n current_uploader.update_total_row(total_count)\n case current_uploader.category\n when Uploader::TYPES[:default]\n upload_indicator(ss, current_uploader)\n when Uploader::TYPES[:indicator_2_0]\n upload_health_care_indicators(ss, current_uploader)\n when Uploader::TYPES[:resources]\n upload_resources(ss, current_uploader)\n when Uploader::TYPES[:indicator_map_color]\n upload_indicators_map_color(ss, current_uploader)\n else\n upload_description_template(ss, current_uploader)\n end\n end\n self.current_sheet.completed!\n end",
"def upload\n logger.info{\"AT THE BEGINNING OF UPLOAD\"}\n first_row = Array.new\n flash_error = Hash.new\n name = Time.now.to_s + params[:datafile].original_filename \n directory = \"data/\" + @project.id + \"/\" + Date.today.to_s\n unless Dir.exists?(directory)\n unless Dir.exist?(\"data/\" + @project.id)\n Dir.mkdir(\"data/\" + @project.id)\n end\n Dir.mkdir(directory)\n end\n @new_file = File.join(directory,name)\n File.open(@new_file, \"wb\"){ |f| f.write(params['datafile'].read)}\n begin \n #data_stream_template = Voeis::DataStream.get(params[:data_template_id])\n start_line = parent.managed_repository{Voeis::DataStream.get(params[:data_template_id]).start_line}\n data_col_count = parent.managed_repository{Voeis::DataStream.get(params[:data_template_id]).data_stream_columns.count}\n site_id = parent.managed_repository{Voeis::DataStream.get(params[:data_template_id]).sites.first.id}\n logger.info {\"FETCHED ******* Data Template start line:\" + start_line.to_s}\n csv = CSV.open(@new_file, \"r\")\n (0..start_line).each do\n first_row = csv.readline\n end\n csv.close()\n if first_row.count == data_col_count\n flash_error = flash_error.merge(parent.managed_repository{Voeis::SensorValue.parse_logger_csv(@new_file, params[:data_template_id], site_id)})\n else\n #the file does not match the data_templates number of columns\n flash_error[:error] = \"File does not match the data_templates number of columns.\"\n logger.info {\"File does not match the data_templates number of columns.\"}\n end\n rescue Exception => e\n logger.info {e.to_s}\n #problem parsing file\n flash_error[:error] = \"There was a problem parsing this file.\"\n logger.info {\"There was a problem parsing this file.\"}\n end\n #parent.publish_his\n respond_to do |format|\n if params.has_key?(:api_key)\n format.json\n end\n if flash_error[:error].nil?\n flash[:notice] = \"File was parsed succesfully.\"\n else\n flash[:warning] = flash_error[:error]\n end\n format.html { redirect_to(project_path(parent)) }\n end\n end",
"def reprocess\n ids = params[:id]\n errorExists = false\n ids.each do |id|\n itemerror = Itemerror.find(id.to_i)\n error = is_row_valid itemerror \n if error.blank?\n \n itemHash = {:client_id => itemerror.attribute1, \n :item_number => itemerror.attribute2, \n :velocity => itemerror.attribute3,\n :daily_avg_sales =>itemerror.attribute4, \n :weekly_avg_sales => itemerror.attribute5,\n :monthly_avg_sales => itemerror.attribute6,\n :daily_forecast => itemerror.attribute7,\n :case_quantity => itemerror.attribute8,\n :case_split_allowed => itemerror.attribute9,\n :attribute1 => itemerror.attribute10,\n :short_description => itemerror.attribute11,\n :long_description => itemerror.attribute12, \n :item_category1 => itemerror.attribute13,\n :item_category2 => itemerror.attribute14,\n :item_category3 => itemerror.attribute15,\n :unit_length => itemerror.attribute16,\n :unit_breadth => itemerror.attribute17,\n :unit_height => itemerror.attribute18,\n :unit_volume => itemerror.attribute19,\n :unit_weight => itemerror.attribute20,\n :case_length => itemerror.attribute21,\n :case_breadth => itemerror.attribute22,\n :case_height => itemerror.attribute23,\n :case_volume => itemerror.attribute24,\n :case_weight => itemerror.attribute25,\n :stocking_UOM => itemerror.attribute26\n }\n \n \n existitem = Itemmaster.where(\"client_id = ? and item_number = ? \" , itemerror.attribute1 , itemerror.attribute2).first\n \n if existitem.nil?\n items= Itemmaster.new(itemHash) \n items.save \n \n else\n existitem.update_attributes(itemHash) \n end\n \n Itemerror.destroy(id.to_i)\n upload_file = Uploadfile.find(itemerror.uploadfile_id)\n upload_file.no_of_error_records -= 1\n upload_file.no_of_processed_records += 1\n upload_file.save \n \n else\n\n itemerror.update_attributes({\n \n :error_description => error\n \n })\n \n errorExists = true \n end\n \n return (errorExists ? \"Error Exists in processing\" : \"Processed Successfully\") \n end \n \n end",
"def update(uploaded_file)\n super\n record.save_changes(validate: false)\n end",
"def import \n if params[:file].blank? \n flash[:error] = 'Please Upload File.'\n redirect_to upload_path \n else \n AdminuserLog.import(params[:file],current_user.id) \n @user = User.import(params[:file],current_user)\n redirect_to admin_user_path, notice: \"Users imported.\" \n \n end\n end",
"def import\n @uploaded_io = params[:q].read()\n Hash.from_xml(@uploaded_io).each do |key, value|\n value.each do |column|\n column.delete(\"id\")\n puts column\n @quote_db = QuoteDb.new(column)\n \n @quote_db.save \n \n \n #puts params[:column][:quote] \n end\n \n end\n \n end",
"def import\n CSV.foreach(@file.path, :converters => :all, :return_headers => false, :headers => :first_row) do |row|\n source, first_name, last_name, _, company, phone, *address = *row.to_hash.values\n\n street, city, state, zip, _ = *address\n address = Address.new(:street1 => street, :city => city, :state => state, :zipcode => zip)\n\n lead = Lead.new(:source => source, :first_name => first_name, :last_name => last_name,\n :company => company, :phone => phone)\n\n lead.first_name = \"FILL ME\" if lead.first_name.blank?\n lead.last_name = \"FILL ME\" if lead.last_name.blank?\n lead.access = \"Private\"\n lead.addresses << address\n\n lead.assignee = @assigned if @assigned.present?\n\n lead.save!\n end\n end",
"def create\r\n logger.debug \"In UploadController#create\"\r\n @batch = params[:batch]\r\n @type = params[:type]\r\n \r\n #variables for printing suitable flash messages\r\n r = 0\r\n l = 0\r\n # modification starts here\r\n \r\n if @type=='payer'\r\n j = 0\r\n @parsed_file=CSV::Reader.parse(params[:upload][:file])\r\n n = 0\r\n @parsed_file.each do |row|\r\n \r\n c = Payer.new\r\n c.gateway = row[0]\r\n c.payid = row[2]\r\n c.payer = row[1]\r\n # TODO: Find out why below isn't row[3]\r\n c.gr_name = \"\"\r\n c.pay_address_one = row[4]\r\n c.pay_address_two = row[5]\r\n c.pay_address_three = row[6]\r\n c.pay_address_four = row[7]\r\n c.phone = row[8]\r\n id = row[2]\r\n \r\n person = Payer.find_by_payid(id) \r\n if person.blank?\r\n # for skipping first line from csv\r\n if (j>=1)\r\n if c.save\r\n r = r + 1\r\n n = n + 1\r\n end\r\n end\r\n \r\n GC.start if n%50 == 0\r\n \r\n else\r\n t = person.payid \r\n @p1 = Payer.find_by_payid(t)\r\n @p1.gateway = row[0]\r\n @p1.payid = row[2]\r\n @p1.payer = row[1]\r\n # TODO: Find out why below isn't row[3]\r\n @p1.gr_name = \"\"\r\n @p1.pay_address_one = row[4]\r\n @p1.pay_address_two = row[5]\r\n @p1.pay_address_three = row[6]\r\n @p1.pay_address_four = row[7]\r\n if !row[1].blank?\r\n @p1.save\r\n l = l + 1\r\n end \r\n end\r\n\r\n #flash.now[:message]=\"CSV Import Successful, #{n} new records added to data base\"\r\n # end \r\n j = j + 1\r\n \r\n end \r\n if r>0 and l==0\r\n flash[:notice] = \"CSV Import Successful, #{n} New Records Added to Data Base\"\r\n elsif r>0 and l>0\r\n flash[:notice] = \" #{n} New Records Added to Data Base and Remaining are Updated\"\r\n elsif r==0 and l>0\r\n flash[:notice] = \"Updated\"\r\n end\r\n redirect_to :controller => '/admin/upload', :action => 'upload' , :batch => @batch, :type => @type\r\n \r\n \r\n #modification ends here\r\n \r\n # from these 'else' working same as with switch case\r\n else\r\n \r\n if request.post?\r\n data = params[:upload][:file].read\r\n logger.debug \"Read data from #{params[:upload][:file]}\"\r\n end\r\n \r\n file = params[:upload][:file]\r\n i = 0\r\n bad_record_count = 0\r\n flash[:notice] = \" \"\r\n begin\r\n \r\n data.each do |line|\r\n \r\n \r\n i = i + 1\r\n unless i == 1 # TODO: Dirty hack to skip the first line (HEADER).\r\n case params[:type]\r\n # Parse the user CSV file.\r\n when 'user'\r\n # Expected column order for user CSV file\r\n # Name, Userid, Password, Role, Shift\r\n user = User.new\r\n name,userid,password,role,shift,triad_client,other_client = line.split(',')\r\n \r\n user.name = strip(name,'\"')\r\n puts strip(name,'\"')\r\n user.userid = strip(userid,'\"')\r\n user.password = strip(password,'\"')\r\n user.role = strip(role,'\"')\r\n user.shift = strip(shift,'\"')\r\n user.processing_rate_triad = strip(triad_client,'\"')\r\n user.processing_rate_others = strip(other_client,'\"')\r\n if user.processing_rate_triad == nil\r\n user.processing_rate_triad = 5\r\n end\r\n if user.processing_rate_others == nil\r\n user.processing_rate_others = 8\r\n end\r\n if user.role != 'Processor'\r\n user.rating = 'NA'\r\n end\r\n user.save\r\n \r\n if user.errors.entries.size > 0\r\n bad_record_count = bad_record_count + 1\r\n user.errors.entries.each do |error|\r\n flash[:notice] = flash[:notice] + \" User #{user.name} has an error : #{error}<br/>\"\r\n end\r\n end\r\n \r\n # Parse the batch CSV file.\r\n when 'batch'\r\n # Expected column order for batch CSV file\r\n # Batchid, Date, Facility Code, Expected EOB, Arrival Time\r\n logger.debug \"In batch upload case\"\r\n batch = Batch.new\r\n batch.batchid, batch_date, facility, batch.eob, arrival_time,batch.correspondence = line.split(',')\r\n puts facility\r\n batch.facility = Facility.find_by_sitecode(facility)\r\n batch.date = batch_date\r\n batch.source = file.original_filename\r\n batch.arrival_time = Time.parse(arrival_time)\r\n # Target Time = Arrival Time + TAT count\r\n batch.target_time = batch.arrival_time + batch.facility.client.tat.hours unless batch.facility.nil?\r\n batch.contracted_time = batch.arrival_time + batch.facility.client.contracted_tat.hours unless batch.facility.nil?\r\n success = batch.save\r\n logger.debug \"Result of batch.save was #{success}\"\r\n tat = Tat.new\r\n batch.tat = tat\r\n batch.update\r\n \r\n if batch.errors.entries.size > 0\r\n bad_record_count = bad_record_count + 1\r\n batch.errors.entries.each do |error|\r\n flash[:notice] = flash[:notice] + \" Batch #{batch.batchid} has an error : #{error}<br/>\"\r\n logger.debug \"Batch #{batch.batchid} has an error : #{error}\"\r\n end\r\n end\r\n \r\n # Parse the Job CSV file.\r\n when 'job'\r\n # Expected column order for job CSV file\r\n # Check number, Tiff number, Estimated EOB\r\n batch = Batch.find(params[:batch])\r\n job = Job.new\r\n job.check_number, job.tiff_number, job.estimated_eob, payid = line.split(',')\r\n job_payer = Payer.find_by_payer('DEFAULT PAYER')\r\n job.payer = job_payer\r\n job.batch = batch\r\n job.save\r\n if job.errors.entries.size > 0\r\n bad_record_count = bad_record_count + 1\r\n job.errors.entries.each do |error|\r\n flash[:notice] = flash[:notice] + \" Job with check number #{job.check_number} has an error : #{error}<br/>\"\r\n end\r\n end\r\n \r\n # Parse the Payer CSV file.\r\n # when 'payer'\r\n # Expected column order for payer CSV file\r\n # Date Added Initials From? GATEWAY PAY_ID PAYOR GR NAME// SUPPORT PAYORS\r\n # PAY_ADD1 PAY_ADD2 PAY_ADD3 PAY_ADD4 Phone\r\n # payer = Payer.new\r\n #gate_way_no, payer_name, pay_no, var_ge, add1, add2, add3, add4 = line.split(',')\r\n # payer.gateway = strip(gate_way_no,'\"')\r\n # payer.gr_name = strip(var_ge,'\"')\r\n # payer.payid = strip(pay_no,'\"')\r\n # payer.payer = strip(payer_name,'\"')\r\n # payer.pay_address_one = strip(add1,'\"')\r\n # payer.pay_address_two = strip(add2,'\"')\r\n # payer.pay_address_three = strip(add3,'\"')\r\n # payer.pay_address_four = strip(add4,'\"')\r\n #payer.save\r\n #if payer.errors.entries.size > 0\r\n # bad_record_count = bad_record_count + 1\r\n #payer.errors.entries.each do |error|\r\n # flash[:notice] = flash[:notice] + \" payer #{payer.payid} has an error : #{error}<br/>\"\r\n #end \r\n #end \r\n \r\n \r\n end #case\r\n \r\n end\r\n end\r\n if @type == 'job'\r\n flash[:notice] = flash[:notice] + \"<BR> Total records : #{i-1} Imported Successfuly : #{i- bad_record_count-1} Import Failed : #{bad_record_count} \"\r\n redirect_to :controller => '/admin/batch', :action => 'add_job', :id => params[:batch]\r\n \r\n #else\r\n #flash[:notice] = flash[:notice] + \"<BR> Total records : #{i-1} Imported Successfuly : #{i- bad_record_count-1} Import Failed : #{bad_record_count} \"\r\n #redirect_to :controller => '/admin/upload', :action => 'upload' , :batch => @batch, :type => @type\r\n #this the code before,anoop modified else with elsif\r\n elsif @type == 'user'\r\n flash[:notice] = flash[:notice] + \"<BR> Total records : #{i-1} Imported Successfuly : #{i- bad_record_count-1} Import Failed : #{bad_record_count} \"\r\n redirect_to :controller => '/admin/upload', :action => 'upload' , :batch => @batch, :type => @type\r\n elsif @type == 'batch'\r\n flash[:notice] = flash[:notice] + \"<BR> Total records : #{i-1} Imported Successfuly : #{i- bad_record_count-1} Import Failed : #{bad_record_count} \"\r\n redirect_to :controller => '/admin/upload', :action => 'upload' , :batch => @batch, :type => @type\r\n \r\n end\r\n \r\n rescue\r\n flash[:notice] = \"A problem occured while uploading the records. Please check the file format!\"\r\n flash[:notice] = flash[:notice] + \"<BR> Total records : #{i-1} Imported Successfuly : #{i- bad_record_count-1} Import Failed : #{bad_record_count} \"\r\n redirect_to :controller => '/admin/upload', :action => 'upload' , :batch => @batch, :type => @type\r\n end\r\n end\r\n end",
"def transform_enrollment_file\n #puts \"Transforming enrollment file for #{@district.name}\"\n att_array = []\n enr_array = []\n tmp_array = []\n #Load up the attendance and enrollment files into arrays\n for file_path in @files\n if !File.directory?(file_path)\n IO.foreach(file_path, sep_string = get_sep_string(file_path)) do |line|\n unless line.blank?\n line.gsub!(/[\"][^\"]*[\"]/) { |m| m.gsub(',','|') }\n att_array.push(line) if file_path.downcase.index('att')\n enr_array.push(line) if file_path.downcase.index('enroll')\n end \n end\n end\n end\n #Process enrollment file for rewrite\n @file_to_write = File.open(File.join(@dir, \"tmp_e.tmp\"),\"w\")\n #Run through each attendance record, when tea_id matches, use enrollment value to re-build enrollment file\n #with report dates\n att_array.each do |rec|\n date,@tmp_tea_id,absent = rec.split(\",\") if @allowed_attendance_headers.length == 3\n date,@tmp_tea_id,school_name,absent = rec.split(\",\") if @allowed_attendance_headers.length == 4\n if date.downcase.index(\"date\").blank?\n enr_array.each do |line|\n @enrolled = 0\n tmp_line = line.split(@delimiter)\n if tmp_line.length == 3\n if is_date?(tmp_line.first.gsub('\"',''))\n enroll_date,tea_id,enrolled = tmp_line\n else\n tea_id,name,enrolled = tmp_line\n end \n elsif tmp_line.length == 4\n enroll_date,tea_id,name,enrolled = tmp_line \n end\n unless @six_digit_campus_id\n tea_id = \"0#{value}\" if tea_id.length == 2\n tea_id = \"00#{value}\" if tea_id.length == 1\n tea_id = \"#{@district.district_id}#{tea_id}\"\n end\n @tmp_tea_id.gsub!('\"',\"\")\n tea_id.gsub!('\"',\"\")\n @tmp_tea_id.gsub!(\"'\",\"\")\n tea_id.gsub!(\"'\",\"\")\n tea_id.strip!\n @tmp_tea_id.strip!\n enrolled.strip!\n enrolled.gsub!('\"',\"\")\n enrolled.gsub!(\"'\",\"\")\n enrolled.gsub!(\"|\",\"\")\n if tea_id.to_i != @tmp_tea_id.to_i\n next\n else\n @enrolled = enrolled.to_i\n break\n end\n end\n tmp_array.push('\"'+date.gsub('\"',\"\")+'\"')\n tmp_array.push('\"'+@tmp_tea_id.gsub('\"',\"\")+'\"')\n tmp_array.push('\"'+school_name.gsub('\"',\"\").gsub('|',',')+'\"') unless school_name.blank?\n tmp_array.push('\"'+\"#{@enrolled}\"+'\"')\n @file_to_write.puts tmp_array.join(\",\")\n tmp_array = [] \n end\n end\n @file_to_write.close\n for file_path in @files\n if file_path.downcase.index('enroll')\n #Delete file just read\n File.delete(file_path)\n #Rename temp file to previously read file\n File.rename(File.join(@dir, \"tmp_e.tmp\"), file_path)\n end\n end\n end",
"def upload # be ready for when we can accept an actual file directly uploaded instead of copy/paste\n array_of_hashes = Contact.parse_tab_delimited(params[:import])\n \n respond_to do |format|\n if Contact.import(array_of_hashes, @group)\n format.html { redirect_to [@hub, @group], :notice => 'Contacts were successfully imported.' }\n format.json { render :json => @group, :status => :created, :location => @group }\n else\n format.html { render :action => \"import\" }\n format.json { render :json => @group.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def import\n VendorProduct.import(params[:file])\n flash[:success] = 'Vendor Products were successfully imported'\n redirect_to vendor_products_admin_path \n end",
"def do_user_status_csv_import\n if params[:import].nil?\n flash[:message] = 'Please upload a csv file'\n redirect_to admin_user_status_csv_import_path\n return\n end\n file = CSV.parse(params[:import][:csv].read)\n @failures = []\n file.each do |row|\n user_id = row[0]\n # If the user id isn't actually a number, skip this row\n # because that means it is probably a header or a blank line\n # http://stackoverflow.com/questions/10577783/ruby-checking-if-a-string-can-be-converted-to-an-integer\n begin\n user_id = Integer user_id\n rescue\n next\n end\n\n begin\n user = User.find(user_id)\n user.exclude_from_reporting = row[1]\n user.relationship_manager = row[2]\n user.associated_program = row[3]\n user.active_status = row[4]\n user.save!\n rescue\n @failures << user_id\n end\n end\n end",
"def import_user_bikes\n begin\n raise \"Please select File\" unless params[:file]\n User.import_user_bikes(params[:file])\n flash[:success] = \"Users With Bikes Uploaded Successfully\"\n redirect_to :back\n rescue StandardError => e\n flash[:error] = \"Uploading Failed with error::#{e.message}\"\n redirect_to :back \n end \nend",
"def import(filename=\"import/study_units.csv\")\n require 'csv'\n CSV.foreach(filename, headers: true) do |row|\n @row = row.to_hash\n @study_unit = StudyUnit.where(study_id: id, name: @row[\"study_unit.name\"]).first ||\n StudyUnit.create(study_id: id, name: @row[\"study_unit.name\"])\n @logical_product = LogicalProduct.where(study_unit_id: @study_unit.id, name: @row[\"logical_product.name\"]).first ||\n LogicalProduct.create(study_unit_id: @study_unit.id, name: @row[\"logical_product.name\"])\n @concept = Concept.find_or_create_by_name(@row[\"concept.name\"])\n @variable_group = VariableGroup.where(logical_product_id: @logical_product.id, concept_id: @concept.id,\n name: @row[\"variable_group.name\"]).first ||\n VariableGroup.create(logical_product_id: @logical_product.id, concept_id: @concept.id,\n name: @row[\"variable_group.name\"], label: @row[\"variable_group.label\"])\n end\n end",
"def import\n Article.import(params[:file])\n flash[:success] = 'Articles were successfully imported'\n redirect_to article_admin_path \n end",
"def import\n Item.import( params[:file])\n redirect_to '/items', notice: 'Items Imported.'\n end",
"def import_master\n begin\n if request.post?\n raise \"Please attach an excel file for import master tables\" if params[:import_file].blank? \n status = \"\"\n set_original_path(params[:import_file]) \n data = Roo::Spreadsheet.open(@original_path) \n data.each_with_pagename do |name, sheet|\n table_name = name.downcase\n case table_name\n when \"bill_footer_setting\" \n status = FooterSetting.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"bill_group\" \n status = BillGroup.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"combooffer\" \n status = ComboOffer.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"creditcard_master\" \n status = CreditCard.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"cust_detail\"\n status = Customer.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"item_groups\" \n status = ItemGroup.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"item_groups_kot_print\" \n status = ItemGroupsKotPrint.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"item_sub_group\" \n status = ItemSubGroup.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"items\" \n status = Item.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"table_master\"\n status = Table.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"settings\" \n status = Setting.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"remarksmaster\"\n status = RemarkMaster.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"table_section\" \n status = TableSection.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"tax\"\n status = Tax.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"user_validation\" \n status = StaffSubMenuSetting.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"usermainmenu\" \n status = StaffMenuSetting.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"waiter\" \n status = Waiter.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"outlet_master\" \n status = Outlet.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"combopackage\" \n status = ComboPackage.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"user_master\" \n status = Staff.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"strtable\" \n status = Company.checked_attributes(sheet)\n raise status[1] if status [0] == false \n when \"happyhour\" \n status = HappyHour.checked_attributes(sheet)\n raise status[1] if status [0] == false \n end \n end \n \n begin\n data.default_sheet = \"Outlet_Master\"\n status = Outlet.import(data, current_location)\n rescue Exception => e \n end \n raise status[1] if status [0] == false\n begin\n data.default_sheet = \"ComboPackage\"\n status = ComboPackage.import(data, current_location)\n rescue Exception => e \n end \n raise status[1] if status [0] == false \n begin\n data.default_sheet = \"Table_Section\"\n status = TableSection.import(data, current_location)\n rescue Exception => e \n end \n raise status[1] if status [0] == false \n begin\n data.default_sheet = \"User_Master\"\n status = Staff.import(data, current_location)\n rescue Exception => e \n end \n raise status[1] if status [0] == false\n \n data.each_with_pagename do |name, sheet|\n table_name = name.downcase\n case table_name\n when \"bill_footer_setting\"\n status = FooterSetting.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"bill_group\" \n status = BillGroup.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"combooffer\"\n status = ComboOffer.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"creditcard_master\"\n status = CreditCard.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"cust_detail\"\n status = Customer.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"item_groups\"\n status = ItemGroup.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"item_groups_kot_print\"\n status = ItemGroupsKotPrint.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"item_sub_group\" \n status = ItemSubGroup.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"items\"\n status = Item.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"table_master\"\n status = Table.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"settings\"\n status = Setting.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"remarksmaster\"\n status = RemarkMaster.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false\n when \"tax\"\n status = Tax.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"user_validation\" \n status = StaffSubMenuSetting.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"usermainmenu\" \n status = StaffMenuSetting.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"waiter\" \n status = Waiter.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"strtable\" \n status = Company.import(sheet, current_client) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n when \"happyhour\" \n status = HappyHour.import(sheet, current_location) unless sheet.last_row <= 1\n raise status[1] if status [0] == false \n end \n end\n flash[:notice] = \"Master data is imported successfully.\"\n redirect_to client_path\n end\n rescue Exception => e\n flash.now[:info] = e.message\n render :import_master\n end\n end",
"def process_and_upload_csv\n\n @has_data = get_data_from_db do |data|\n formatted_data = format_data(data)\n c_add formatted_data\n end\n\n if @has_data\n zip_folder\n upload_to_s3\n delete_local_files\n end\n\n end",
"def import\n Trick.import params[:file]\n redirect_to root_path, notice: \"Imported!!\"\n end",
"def import\n begin\n file = params[:file]\n if params[:user_id]\n user = User.find_by_id(params[:user_id])\n else\n user = current_user\n end\n CSV.foreach(file.path, headers: true) do |row|\n Product.create!(\n :brand => row['brand'],\n :name => row['model'],\n :description => row['description'],\n :status => false,\n :user_id => user.id,\n :size_details => row['size_details'],\n :product_return_policy => row['return_policy'],\n :usd_price => row['usd_price'].to_i,\n :cad_price => row['cad_price'].to_i,\n :factory_sku => row['sku'],\n :cad_domestic_shipping => user.cad_domestic_shipping,\n :cad_foreign_shipping => user.cad_foreign_shipping,\n :usd_domestic_shipping => user.usd_domestic_shipping,\n :usd_foreign_shipping => user.usd_foreign_shipping)\n end # end CSV.foreach\n redirect_to admin_products_url, notice: \"Products successfully imported.\"\n rescue\n redirect_to admin_products_new_import_url, alert: \"There was an error. Check your file and try again.\"\n end\n end",
"def upload_data_file(upload, current_user_guid, options = {})\n self.init_uploaded_file(upload, 'Upload', current_user_guid, options)\n stixish = is_file_upload ? is_stix_file?(@file_path) : is_stix?(upload)\n\n if stixish\n if options[:human_review_approved]\n raw_xml = upload\n IngestUtilities.add_warning(self, \"Human Review approved, full ingestion starting at #{Time.now}\")\n oi = self.original_inputs.active.first\n else\n if is_file_upload\n oi = XmlSaving.store_original_file(@file_path, self.guid, @input_category, @mime_type)\n source_oi = XmlSaving.store_original_file(@file_path, self.guid, 'SOURCE', @mime_type)\n else\n oi = XmlSaving.store_original_input(upload, self.guid, @input_category, @mime_type)\n source_oi = XmlSaving.store_original_input(upload, self.guid, 'SOURCE', @mime_type)\n end\n\n # This is not \"Sanitization\" per se...it's fixing invalid ID's, so it\n # gets run every time\n s = Sanitization.new\n s.sanitize_id_format_raw_xml(oi) unless\n Stix::Stix111::PackageInfo.is_ciscp?(oi.raw_content,\n Setting.CISCP_ID_PATTERNS) \n \n raw_xml = oi.utf8_raw_content\n IngestUtilities.add_warning(self, s.get_warnings, true) if s.get_warnings\n if s.get_errors\n IngestUtilities.add_error(self, s.get_errors, true)\n end\n end\n\n if self.validate_only || self.overwrite || self.read_only || !IngestUtilities.already_loaded?(self)\n parse_and_load_stix(raw_xml, options)\n \n package=self.stix_packages.first\n\n unless package.nil?\n \n # Store the the source feed received from FLARE if FLARE sent this\n # information with the file. This ultimately comes from a string\n # property in the AMQP message received from FLARE. For HR files,\n # this is stored in the uploaded_file and added to the package\n # upon full ingestion after HR approval.\n package.src_feed = self.src_feed if self.src_feed.present?\n audit = Audit.basic\n audit.message = \"Package created from STIX upload: #{self.file_name}.\"\n audit.details = \"#{package.uploaded_file.guid}\"\n audit.item = package\n audit.audit_type = :upload\n package.audits << audit\n package.updated_at = Time.now\n package.save\n end\n else\n IngestUtilities.add_error(self, \"STIX Package has already been successfully loaded.\")\n end\n else\n IngestUtilities.add_error(self, \"Not a STIX XML File: #{self.file_name}\")\n end\n\n # if its an api upload, try and set the name to the name of the package title\n if self.file_name == 'API Upload'\n if self.stix_packages.first.present?\n self.file_name = \"API Upload (#{self.stix_packages.first.title})\"\n else\n if [\n OriginalInput::XML_DISSEMINATION_ISA_FILE,\n OriginalInput::XML_DISSEMINATION_AIS_FILE,\n OriginalInput::XML_DISSEMINATION_CISCP_FILE,\n OriginalInput::XML_DISSEMINATION_TRANSFER,\n OriginalInput::XML_AIS_XML_TRANSFER\n ].include?(oi.input_sub_category)\n stix_id = options[:stix_id] ||\n /id=[\"'](.+?)[\"']/.match(oi.raw_content)\n stix_id = \"#{stix_id} - #{oi.input_sub_category}\"\n else\n stix_id = /id=[\"'](.+?)[\"']/.match(oi.raw_content)\n end\n\n self.file_name = \"API Upload (#{stix_id})\"\n end\n end\n\n # set the uploaded files portion marking when all done.\n self.set_portion_marking\n\n self.save\n IngestUtilities.cleanup(self, @file_path)\n rescue Exception => e\n ExceptionLogger.debug(\"exception: #{e}, message: #{e.message}, backtrace: #{e.backtrace}\")\n IngestUtilities.add_error(self, \"#{e.backtrace.first}: #{e.message} (#{e.class})\")\n self.save\n IngestUtilities.cleanup(self, @file_path)\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 transform_and_load_compounds!\n compound_records.each_slice(batch_size) do |compound_records_batch|\n transformer_worker_klass.perform_async(\n compound_records_batch,\n solr_config,\n cdm_endpoint,\n oai_endpoint,\n field_mappings,\n batch_size\n )\n end\n end"
] | [
"0.6513984",
"0.64694023",
"0.63949186",
"0.6226247",
"0.6215294",
"0.6192514",
"0.61721045",
"0.6145368",
"0.61234444",
"0.6103219",
"0.60713553",
"0.6064272",
"0.60252553",
"0.602221",
"0.60043424",
"0.5984261",
"0.59840196",
"0.5983988",
"0.5975014",
"0.5971082",
"0.59527254",
"0.593003",
"0.5928492",
"0.59249604",
"0.59242606",
"0.5920158",
"0.59161645",
"0.5905228",
"0.589855",
"0.5892102",
"0.5889501",
"0.5888505",
"0.58721155",
"0.58611363",
"0.58542466",
"0.5843168",
"0.58430684",
"0.58427685",
"0.58372927",
"0.58223885",
"0.5815285",
"0.5804818",
"0.5804743",
"0.57827896",
"0.57800186",
"0.5779593",
"0.5778509",
"0.57743764",
"0.57629085",
"0.5762274",
"0.57617396",
"0.57571375",
"0.5753655",
"0.5729614",
"0.57262033",
"0.5723763",
"0.5711413",
"0.57112825",
"0.57073903",
"0.5700191",
"0.5695739",
"0.56944156",
"0.5694144",
"0.5691301",
"0.5680505",
"0.56752104",
"0.5669002",
"0.56688946",
"0.5666377",
"0.5664039",
"0.5657027",
"0.5657027",
"0.56524163",
"0.56519437",
"0.5644673",
"0.5644111",
"0.56260663",
"0.56237453",
"0.56236804",
"0.5621571",
"0.56209725",
"0.56087387",
"0.56059635",
"0.5605629",
"0.56052595",
"0.5600331",
"0.55951315",
"0.5583597",
"0.55810285",
"0.5577702",
"0.5573449",
"0.5573229",
"0.5573172",
"0.5569562",
"0.556764",
"0.5561866",
"0.555657",
"0.55547196",
"0.5553959",
"0.5553166",
"0.55526567"
] | 0.0 | -1 |
AJAX driven routine to select a classification entry | def forest_select
assert_privileges("ops_settings")
forest_get_form_vars
if params[:ldaphost_id] == "new"
render :update do |page|
page << javascript_prologue
page.replace("flash_msg_div", :partial => "layouts/flash_msg")
page << "miqScrollTop();" if @flash_array.present?
page.replace("forest_entries_div", :partial => "ldap_forest_entries", :locals => {:entry => "new", :edit => true})
end
session[:entry] = "new"
else
entry = nil
@edit[:new][:authentication][:user_proxies].each do |f|
entry = f if f[:ldaphost] == params[:ldaphost_id]
end
render :update do |page|
page << javascript_prologue
page.replace("flash_msg_div", :partial => "layouts/flash_msg")
page << "miqScrollTop();" if @flash_array.present?
page.replace("forest_entries_div", :partial => "ldap_forest_entries", :locals => {:entry => entry, :edit => true})
end
session[:entry] = entry
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_classification_code\n @classification_code = ClassificationCode.find(params[:id])\n end",
"def classification=(value)\n @classification = value\n end",
"def classification=(value)\n @classification = value\n end",
"def show_add_classification_to_item\n # retrieve @repositories for instant additions\n @item = Item.find(params[:id])\n @subjects = Subject.concept_list\n @max_position = Classification.maximum(:position, :conditions => ['item_id = ?', params[:id]] ) || 0\n @classification = Classification.new(\n :item_id => params[:id],\n :publish => true,\n :position => @max_position + 1\n )\n respond_to do |format|\n format.html { render :action => \"show\", :id => @item }\n format.js\n end\n end",
"def set_recipe_classify\n @recipe_classify = RecipeClassify.find(params[:id])\n end",
"def set_item_classification\n @item_classification = ItemClassification.find(params[:id])\n end",
"def set_clasification\n @clasification = Clasification.find(params[:id])\n end",
"def set_taxon_name_classification\n @taxon_name_classification = TaxonNameClassification.find(params[:id])\n end",
"def set_project_classification\n @project_classification = ProjectClassification.find(params[:id])\n end",
"def set_classified\n @classified = Classified.find(params[:id])\n end",
"def set_classified\n @classified = Classified.find(params[:id])\n end",
"def set_classifier\n @classifier = Classifier.find(params[:id])\n end",
"def show\n @classification = Classification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @classification }\n end\n end",
"def classification\n return @classification\n end",
"def classification\n return @classification\n end",
"def classification(query, set=nil)\n is_valid_with_error(__method__, [:ipv4, :domain], query)\n if domain?(query)\n query = normalize_domain(query)\n end\n if set.nil?\n get('actions/classification', {'query' => query})\n else\n is_valid_with_error(__method__.to_s, [:classification], set)\n post('actions/classification', { 'query' => query, 'classification' => set })\n end\n end",
"def set_investigationclassification\n @investigationclassification = Investigationclassification.find(params[:id])\n end",
"def show\n @program_classification = ProgramClassification.find params[:id]\n end",
"def _parent_selection\n if @selector_for\n render :js => select_record_js(selector_field_value) + js_choose_id(selector_field_value)\n else\n render :js => update_recordset_js\n end\n end",
"def rdp_classify\n redirect_to root_url if @project.miga.nil?\n @ds_name = params[:ds_name]\n @result = @project.rdp_classify(@ds_name)\n end",
"def set_business_classification\n @business_classification = BusinessClassification.find(params[:id])\n end",
"def classifications(classification)\n params = {\n classification: classification\n }.compact\n\n _get(\"/account/classifications\", params) { |json| json }\n end",
"def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end",
"def update\n respond_to do |format|\n if @classification.update(classification_params)\n format.html { redirect_to @classification, notice: t('controller.successfully_updated', model: t('activerecord.models.classification')) }\n format.json { head :no_content }\n else\n @classification_types = ClassificationType.all\n format.html { render action: \"edit\" }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classification = Classification.new(params[:classification])\n @items = Item.select_list\n @subjects = Subject.concept_list\n @genres = Subject.genre_list\n @item = @classification.item\n @add_concept = params[:classification][:add_concept] == 'true'\n\n # figure out which template to show\n if @classification.subject.subject_type_id == 8\n @js_template = 'admin/items/add_genre_to_item'\n else\n @js_template = 'admin/items/add_classification_to_item'\n end\n\n respond_to do |format|\n if @classification.save\n @max_position = Classification.maximum(:position, :conditions => ['item_id = ?', @item.id] ) || 0\n @new_classification = Classification.new(\n :item_id => @item.id,\n :publish => true,\n :position => @max_position + 1\n )\n format.html { redirect_to(admin_classification_path(@classification), :notice => 'Classification was successfully created.') }\n format.xml { render :xml => @classification, :status => :created, :location => @classification }\n format.js { render :template => @js_template }\n else\n @new_classification = @classification\n format.html { render :action => \"new\" }\n format.xml { render :xml => @classification.errors, :status => :unprocessable_entity }\n format.js { render :template => @js_template }\n end\n end\n end",
"def set_code\n @code = Core::ClassificationCode.find(params[:id])\n end",
"def select_category\n puts \"Please select from the following catagories:\\n\\n\"\n category_lister\n puts \"\\n\\n\"\n fact_input\n end",
"def add_classification\n @bib.classification.each do |c|\n case c.type\n when \"type\" then @item[\"type\"] = c.value\n when \"mendeley\" then @item[\"mendeley-tags\"] = c.value\n end\n end\n end",
"def select_question_type(qtype)\n frm.select(:id=>\"_id1:selType\").select(qtype)\n frm.button(:value=>\"Save\").click\n\n page = case(qtype)\n when \"Multiple Choice\" then MultipleChoice.new(@browser)\n when \"True False\" then TrueFalse.new(@browser)\n when \"Survey\" then Survey.new(@browser)\n when \"Short Answer/Essay\" then ShortAnswer.new(@browser)\n when \"Fill in the Blank\" then FillInBlank.new(@browser)\n when \"Numeric Response\" then NumericResponse.new(@browser)\n when \"Matching\" then Matching.new(@browser)\n when \"Audio Recording\" then AudioRecording.new(@browser)\n when \"File Upload\" then FileUpload.new(@browser)\n else puts \"nothing selected\"\n end\n\n return page\n\n end",
"def request_select\n end",
"def select_question_type\n set_user_input\n if @user_input == 0\n @response = Registration.question_type_selection(@screen_id)\n @session.update_attributes(question_type_id: nil, req_no: @req_no - 1)\n else\n @question_type = QuestionType.find_by_ussd_id(@user_input)\n if @question_type\n @session.update_attributes(question_type_id: @question_type.id, req_no: @req_no)\n if URI.escape(@question_type.name) == URI.escape(\"Révision scolaire\")\n @response = Registration.select_academic_level(@screen_id)\n else\n @response = Registration.confirm_registration(@session, @screen_id)\n end\n else\n @response = Error.invalid_question_type(@screen_id)\n end\n end\n end",
"def load_search_conservation_form\n click_search_link\n click_clear_button\n select_record_type_option 'Conservation Treatments'\n end",
"def select_request_by_user(user)\n page.execute_script(\"$('#training_request_requested_by_user_id').val(#{user.id})\")\n end",
"def select_exam\n end",
"def rdp_classify_as\n rdp_classify\n render partial: 'rdp_classify',\n locals: { project: @project, ds_name: @ds_name, result: @result },\n layout: false\n end",
"def classification\n classifications = @data[\"spData\"][\"classifications\"]\n if classifications.empty?\n raise Holdings::Error, NO_CLASSIFICATIONS_ERROR\n end\n Classification.new(classifications.first)\n end",
"def classify(text)\n choose classifications(text)\n end",
"def select_by_class(class_name)\n @browser.select_list(:class, cuke_class(class_name))\nend",
"def choose_forum\n values = get_forum_list\n sel = ctrlp values\n #return unless sel\n #display_forum sel\n return sel\nend",
"def set_category_classified\n @category_classified = CategoryClassified.find(params[:id])\n end",
"def select_recipe_from_search(recipe_titles)\n puts ''\n selection = @prompt.select(\"Please select a recipe:\".colorize(:color => :blue), (recipe_titles))\n @selected_rec = recipe_instances.find { |recipe| recipe.title == selection }\n puts ''\n puts @selected_rec.content\n end",
"def refresh_selected_data\n entry = extract_entry_by_entry_id(params[:entry_id])\n\n parameter = \"\"\n if entry[:parameter] # Parameter erwähnt (erwartet als Array)\n entry[:parameter].each do |p|\n parameter << \"<div title='#{my_html_escape(p[:title])}'>#{my_html_escape(p[:name])} <input name='#{p[:name]}' size='#{p[:size]}' value='#{p[:default]}' type='text'></div><br/>\"\n end\n end\n respond_to do |format|\n format.js {render :js => \"$('#show_selection_header_area').html('<b>#{j my_html_escape(entry[:name]) }</b>');\n $('#show_selection_hint_area').html('#{j my_html_escape(entry[:desc]) }');\n $('#show_selection_param_area').html('#{j parameter }');\n $('#dragnet_show_selection_do_selection').prop('disabled', #{entry[:sql] ? 'false' : 'true'});\n $('#dragnet_show_selection_show_sql').prop('disabled', #{entry[:sql] ? 'false' : 'true'});\n $('#dragnet_drop_personal_selection_button').#{entry[:personal] ? 'show' : 'hide'}();\n $('#dragnet_hidden_entry_id').val('#{params[:entry_id]}');\n \"\n }\n end\n end",
"def selectCategory(data = {})\n self.has_expected_element?\n data = data_for('homepage',data)\n case data['category'].downcase.gsub(/\\s+/, '')\n when 'news&politics'\n news_and_politics_element.click\n when 'style'\n style_element.click\n end\n end",
"def selection\n eval_param(:selection)\n end",
"def main_selector\n print \"What would you like to do? Create, List, Update, or Vote: \"\n main_decision = gets.chomp.downcase\n main_decision = main_decision[0]\n case main_decision\n when \"c\"\n create_person_or_politician\n when \"l\"\n list_characters_created\n when \"u\"\n update_character\n when \"v\"\n vote\n else\n puts \"That is not a valid entry please try again!\"\n main_selector\n end\n end",
"def selected_class_cards\n logger.info \"class_info: #{params[:class_selected_id]}\"\n @class_deck = SkillCard.where(class_id: params[:class_selected_id])\n render \"user/_class_selected\",\n locals: { selected_class: @class_deck },\n layout: false\n end",
"def create\n @classification = Classification.new(classification_params)\n\n respond_to do |format|\n if @classification.save\n format.html { redirect_to @classification, notice: t('controller.successfully_created', model: t('activerecord.models.classification')) }\n format.json { render json: @classification, status: :created, location: @classification }\n else\n @classification_types = ClassificationType.all\n format.html { render action: \"new\" }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def select_category\n #Parbauda vai ekrans ir redzams\n @screens.screen_create_filter.visible?\n #Pievieno kategoriju no filtra datiem\n @screens.screen_create_filter.select_row(@filter_data.category)\n end",
"def set_classication\n @classication = Classication.find(params[:id])\n end",
"def classification=(value)\n case value\n when \"\"\n value = \"admitted\"\n when \"认可的\", \"допустимый\", \"admitido\"\n value = \"admitted\"\n when \"首选的\", \"suositettava\", \"suositeltava\", \"рекомендуемый\", \"preferente\"\n value = \"preferred\"\n when %w(preferred admitted deprecated)\n # do nothing\n end\n @classification = value\n end",
"def selected; end",
"def classification\n @line1[07]\n end",
"def selector\n search_params = Observation.get_search_params(params,\n current_user: current_user)\n search_params = Observation.apply_pagination_options(search_params)\n @observations = Observation.latest.query(search_params).paginate(\n page: search_params[:page], per_page: search_params[:per_page])\n Observation.preload_for_component(@observations, logged_in: !!current_user)\n respond_to do |format|\n format.html { render :layout => false, :partial => 'selector'}\n # format.js\n end\n end",
"def index\n search = Sunspot.new_search(Classification)\n query = params[:query].to_s.strip\n if query.present?\n @query = query.dup\n search.build do\n fulltext query\n end\n end\n unless params[:mode] == 'add'\n subject = @subject\n classification_type = @classification_type\n search.build do\n with(:subject_ids).equal_to subject.id if subject\n with(:classification_type_id).equal_to classification_type.id if classification_type\n end\n end\n\n page = params[:page] || 1\n search.query.paginate(page.to_i, Classification.default_per_page)\n @classifications = search.execute!.results\n\n session[:params] = {} unless session[:params]\n session[:params][:classification] = params\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def donable_selected\n @donable = donable_class_constant(params[:donable_type]).new\n render_donable_partial\n end",
"def update\n @classification = Classification.find(params[:id])\n @items = Item.select_list\n @subjects = Subject.concept_list\n @genres = Subject.genre_list\n respond_to do |format|\n if @classification.update_attributes(params[:classification])\n format.html { redirect_to(admin_classification_path(@classification), :notice => 'Classification was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_biocuration_classification\n @biocuration_classification = BiocurationClassification.find(params[:id])\n end",
"def set_classname\n @classname = Classname.find(params[:id])\n end",
"def choose(classification)\n sorted = classification.sort_by{|k,v| -v }\n\n case sorted.size\n when 0\n return classification\n when 1\n return sorted[0][0]\n when 2\n delta_choose(*sorted)\n else\n delta_choose(*sorted.first(2))\n end\n end",
"def set_selection_criterium\n @selection_criterium = SelectionCriterium.find(params[:id])\n end",
"def show\n @sellable = Sellable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sellable }\n end\n end",
"def set_class_type\n @class_type = ClassType.find(params[:id])\n end",
"def set_classificacao\n @classificacao = Classificacao.find(params[:id])\n end",
"def set_class\n @class = Class.find(params[:id])\n end",
"def parse_classification(str = nil)\n self.class.parse_classification(str || classification)\n end",
"def forest_select\n forest_get_form_vars\n if params[:ldaphost_id] == \"new\"\n render :update do |page|\n page << javascript_prologue\n page.replace(\"flash_msg_div\", :partial => \"layouts/flash_msg\")\n page.replace(\"forest_entries_div\", :partial => \"ldap_forest_entries\", :locals => {:entry => \"new\", :edit => true})\n end\n session[:entry] = \"new\"\n else\n entry = nil\n @edit[:new][:authentication][:user_proxies].each do |f|\n entry = f if f[:ldaphost] == params[:ldaphost_id]\n end\n render :update do |page|\n page << javascript_prologue\n page.replace(\"flash_msg_div\", :partial => \"layouts/flash_msg\")\n page.replace(\"forest_entries_div\", :partial => \"ldap_forest_entries\", :locals => {:entry => entry, :edit => true})\n end\n session[:entry] = entry\n end\n end",
"def show\n @selection = Selection.find(params[:id])\n if @selection.nil?\n @user_name = params[:user_name]\n @selection_name = params[:selection_name]\n @selection = Selection.first(:public_url => \"#{@user_name}/#{@selection_name}\")\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @selection }\n end\n end",
"def show\n @occupationclassification = Occupationclassification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @occupationclassification }\n end\n end",
"def set_class_test\n @class_test = current_school_branch.class_tests.find(params[:id])\n end",
"def set_classification_fund\n @classification_fund = ClassificationFund.find(params[:id])\n end",
"def referClass\n result = Hash.new\n result['status'] = true\n begin # try\n @lang = Helper.getLang\n @class = HomePage.referClass(params[:id].to_i)\n if @class != nil\n result['status'] = true\n result['html'] = render_to_string(partial: \"home/course_details\")\n else\n result['status'] = false\n end\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end",
"def classification_params\n params.require(:classification).permit(:company_id, :text, :category)\n end",
"def new\n @classification = Classification.new\n @items = Item.select_list\n @subjects = Subject.select_list\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classification }\n end\n end",
"def select_question_type(qtype)\n frm.select(:id=>\"assesssmentForm:changeQType\").select(qtype)\n\n page = case(qtype)\n when \"Multiple Choice\" then MultipleChoice.new(@browser)\n when \"True False\" then TrueFalse.new(@browser)\n when \"Survey\" then Survey.new(@browser)\n when \"Short Answer/Essay\" then ShortAnswer.new(@browser)\n when \"Fill in the Blank\" then FillInBlank.new(@browser)\n when \"Numeric Response\" then NumericResponse.new(@browser)\n when \"Matching\" then Matching.new(@browser)\n when \"Audio Recording\" then AudioRecording.new(@browser)\n when \"File Upload\" then FileUpload.new(@browser)\n else puts \"#{qtype} is not a valid question type\"\n end\n\n return page\n\n end",
"def classification\n return nil if tracking_is_empty\n\n delivery_status_details_box ||= @tracking_page.css(\".indent table[summary='配達状況詳細']\")\n classification = delivery_status_details_box.css(\"tr:last .w_380\").text.strip\n return classification\n end",
"def master_category_particulars_edit\n @tax_slabs = TaxSlab.all if @tax_enabled\n include_associations = @tax_enabled ? [:tax_slabs] : []\n @finance_fee_particular= FinanceFeeParticular.find(params[:id],\n :include => include_associations)\n @master_fee_particulars = MasterFeeParticular.core\n @student_categories = StudentCategory.active\n unless @finance_fee_particular.student_category.present? and @student_categories.collect(&:name).include?(@finance_fee_particular.student_category.name)\n current_student_category=@finance_fee_particular.student_category\n @student_categories << current_student_category if current_student_category.present?\n end\n respond_to do |format|\n format.js { render :action => 'master_category_particulars_edit' }\n end\n end",
"def select_by_class_set_value(class_name, value)\n select_by_class(class_name).select value\nend",
"def set_request_class_lab\n @request_class_lab = RequestClassLab.find(params[:id])\n end",
"def show\n @current_selection = params[:current_selection] or \"activities\"\n end",
"def ajax_category\n case params[:category]\n when Reporting::ALL\n @query_hash = {:category_all => true}\n when Reporting::PROVIDER\n @query_hash = {:category_provider => true}\n when Reporting::PATIENT\n @query_hash = {:category_patient => true}\n when Reporting::CLAIM\n @query_hash = {:category_claim => true}\n when Reporting::BALANCE\n @query_hash = {:category_balance => true}\n when Reporting::INVOICES\n @query_hash = {:category_invoice => true}\n when Reporting::USER\n @query_hash = {:category_user => true}\n when Reporting::SYSTEM\n @query_hash = {:category_system => true}\n end\n @reporting = Reporting.without_status(:deleted).where(@query_hash)\n end",
"def ask_classes\n format=\"rdoc\"\n str = get_string_with_history(\"Enter a class name: \")\n if str && str != \"\"\n #lines = `ri -f #{format} #{str}`.split(\"\\n\")\n lines = get_data str\n if lines.size == 0\n alert \"Nothing came through for #{str}\"\n ## Nothing returned, lets see if we can match something from the class list\n li = @form.by_name[\"mylist\"]; \n values = li.list\n values = values.grep(/^#{str}/i)\n if values.size > 0\n ix = popuplist(values)\n if ix\n str = values[ix]\n #lines = `ri -f #{format} #{str}`.split(\"\\n\")\n lines = get_data str\n end\n else\n alert \"Nothing came through for #{str}\"\n $message.value = \"Nothing came through for #{str}\"\n end\n elsif lines.first.index(\".#{str} not found\")\n ## we are returned something with some choices, lets prompt user with choices\n lines.shift\n lines.shift\n ix = popuplist(lines)\n if ix\n str = lines[ix]\n #lines = `ri -f #{format} #{str}`.split(\"\\n\")\n lines = get_data str\n end\n end\n return if lines.size == 0\n w = @form.by_name[\"tv\"]; \n w.add_content(lines, :content_type => :ansi, :title => str)\n #w.add_content(lines, :title => str)\n w.buffer_last\n set_focus_on str\n end\nend",
"def display_selected_matter\n params[:search] ||= {} #to set params[:search] if params is nil Bug 9871\n @matters =[]\n @mode_type = params[:mode_type] #passed from the application.js to set the mode type in view\n data = params\n @matters = matter_search # Common search\n @perpage = params[:per_page].present? ? params[:per_page] : 25 # added for changing pagination limit - do not remove -- Supriya\n @matters = @matters.paginate :page => data[:page], :per_page => @perpage\n respond_to do |format|\n format.js {render :partial=> 'matter'}\n end\n end",
"def index\n @training_class_id=params[:tclassid]\n @member_class = MemberClass.find_by_sql [\"SELECT *\n FROM Member_classes\n WHERE training_class_id=?\",\n @training_class_id]\n end",
"def set_product_classify\n @product_classify = ProductClassify.find(params[:id])\n end",
"def fork_in_road(main_menu_choice) # takes in user topic choice as 1,2 or 3 and loads the user's chosen domain\n\n if main_menu_choice == 1\n trilogy_fact_choice = get_trilogy_fact_choice\n display_trilogy_fact(trilogy_fact_choice)\n elsif main_menu_choice == 2\n films_fact_choice = get_films_fact_choice\n display_films_fact(films_fact_choice)\n elsif main_menu_choice == 3\n char_fact_choice = get_characters_fact_choice\n display_characters_fact(char_fact_choice)\n else\n\n end\n\n end",
"def load_favorite_client\r\n select_from_favorite = @browser.select_list(:xpath, \"//div[2]/div/div[1]/div[2]/div/div/div/select\")\r\n if select_from_favorite.enabled?\r\n select_from_favorite.select(\"John Kenedy\")\r\n return \"Selected a existing favorite client.\"\r\n else\r\n raise Exception.new \"Select drop down is disabled\"\r\n end\r\nend",
"def set_class\n # begin\n @class = SchoolClass.find_by_class_name(params[:class_name])\n # rescue ActiveRecord::RecordNotFound\n # redirect_to classes_url, :flash => { :error => \"Record not found.\" }\n # end\n end",
"def set_classwork\n @classwork = Classwork.find(params[:id])\n end",
"def select_xml_nfe\n\t\t\t\n\tend",
"def create\n Rails.logger.debug \"[ClassificationsController.create] params.class: #{params.class}, params: #{params}\"\n @classifaction = Classification.new transaction_data: params\n @classifaction.classifiers << StatusCodeClassifier.classify( @classifaction.transaction_data )\n @classifaction.classify\n\n if @classifaction.save\n render json: @classifaction.as_jsonapi, status: :created\n else\n render json: { error: 'oops' }, status: 500\n end\n end",
"def load_search_condition_check_form\n click_search_link\n click_clear_button\n select_record_type_option 'Condition Checks'\n end",
"def get_selector\n if params[:smb_id].present?\n @selector = Smb.find_by_auth_token(params[:smb_id])\n elsif params[:username].present? # for customer#new (referral form) use.\n @ref_form_selector = Smb.find_by_username(params[:username])\n elsif params[:friend_id].present?\n if admin?\n @selector = Friend.find(params[:friend_id]) # TODO just a reminder: if not admin, a 500 page will pop up\n end\n end\n \n end",
"def set_class_detail\n @class_detail = ClassDetail.find(params[:id])\n end",
"def mechanics\n Mechanic.all.select do |mechanic_ob|\n #binding.pry\n mechanic_ob.specialty == self.classification\n end\nend",
"def set_klass\n @klass = Klass.find(params[:id])\n end",
"def set_klass\n @klass = Klass.find(params[:id])\n end",
"def ajax_find_by_ln\n \t@listing = Listing.where(:LN => params[:ln]).first\n \tputs @listing.inspect\n \t\n \t# get gmap for the property location\n \t@gmaps = @listing.to_gmaps4rails unless @listing.nil?\n \tputs \"GMAPS JSON: #{@gmaps}\"\n \t\n \tif @listing.nil? then\n \t\t# catch non-existent listing numbers, redirect to home\n \t\tredirect_to '/'\n \telse\n\t \trender :template => 'listings/show_ajax', :layout => false\n \tend\n end",
"def result\n case params[:search_type]\n when \"purchaseorders\"\n @class = PurchaseOrder\n @name = \"Purchase Orders\"\n when \"keys\"\n @class = Key\n @name = \"Key Codes\"\n when \"endusers\"\n @class = EndUser\n @name = \"End Users\"\n when \"purchasers\"\n @class = Purchaser\n @name = \"Purchasers\"\n end\n \n @css_class = params[:search_type]\n @search = @class.search(params[:q])\n @list = @search.result\n\n respond_to do |format|\n format.js\n end\n end",
"def set_selection\n @selection = Selection.find(params[:id])\n end",
"def show_add_genre_to_item\n # retrieve @repositories for instant additions\n @item = Item.find(params[:id])\n @genres = Subject.genre_list\n @max_position = Classification.maximum(:position, :conditions => ['item_id = ?', params[:id]] ) || 0\n @classification = Classification.new(\n :item_id => params[:id],\n :publish => true,\n :position => @max_position + 1\n )\n respond_to do |format|\n format.html { render :action => \"show\", :id => @item }\n format.js\n end\n end"
] | [
"0.5955622",
"0.5804568",
"0.5804568",
"0.5722311",
"0.56871134",
"0.5668467",
"0.55925167",
"0.55884546",
"0.5582199",
"0.5573716",
"0.5573716",
"0.55556834",
"0.5533747",
"0.55024284",
"0.55024284",
"0.5476848",
"0.5441608",
"0.544021",
"0.54254407",
"0.53907776",
"0.5382856",
"0.53631127",
"0.5356731",
"0.53566986",
"0.53517497",
"0.5340728",
"0.5336888",
"0.5330685",
"0.53174525",
"0.53082854",
"0.5304363",
"0.52954984",
"0.5285164",
"0.5278241",
"0.5267399",
"0.5262988",
"0.52322793",
"0.5221178",
"0.5212779",
"0.5211795",
"0.5199665",
"0.5184206",
"0.51689225",
"0.51683074",
"0.515755",
"0.51535654",
"0.51446307",
"0.5134824",
"0.51339775",
"0.5121877",
"0.5110359",
"0.5096411",
"0.5091521",
"0.50886804",
"0.50885475",
"0.50538677",
"0.5042038",
"0.50375986",
"0.50252265",
"0.5013409",
"0.50084436",
"0.500139",
"0.5000277",
"0.49884728",
"0.49838024",
"0.4981944",
"0.49750388",
"0.49623692",
"0.49487302",
"0.4946085",
"0.4944491",
"0.49412856",
"0.49323788",
"0.4927227",
"0.49225408",
"0.49117616",
"0.4908164",
"0.4894807",
"0.4877246",
"0.48740175",
"0.48634046",
"0.48621535",
"0.48220307",
"0.48212737",
"0.48145977",
"0.480898",
"0.48055407",
"0.47985247",
"0.47959664",
"0.47917476",
"0.4788263",
"0.47871712",
"0.47843936",
"0.47820273",
"0.47770944",
"0.47770944",
"0.4776961",
"0.477206",
"0.47699124",
"0.47697887"
] | 0.48506686 | 82 |
AJAX driven routine to delete a classification entry | def forest_delete
assert_privileges("ops_settings")
forest_get_form_vars
idx = nil
@edit[:new][:authentication][:user_proxies].each_with_index do |f, i|
idx = i if f[:ldaphost] == params[:ldaphost_id]
end
@edit[:new][:authentication][:user_proxies].delete_at(idx) unless idx.nil?
@changed = (@edit[:new] != @edit[:current])
render :update do |page|
page << javascript_prologue
page.replace("flash_msg_div", :partial => "layouts/flash_msg")
page << "miqScrollTop();" if @flash_array.present?
page << javascript_for_miq_button_visibility(@changed)
page.replace("forest_entries_div", :partial => "ldap_forest_entries", :locals => {:entry => nil, :edit => false})
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @classification = Classification.find(params[:id])\n @classification.destroy\n\n respond_to do |format|\n format.html { redirect_to classifications_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.classification')) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @risk_classification = RiskClassification.find(params[:id])\n @risk_classification.destroy\n\n respond_to do |format|\n format.html { redirect_to risk_classifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_classification.destroy\n respond_to do |format|\n format.html { redirect_to item_classifications_url, notice: 'Classificação destruída com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @occupationclassification = Occupationclassification.find(params[:id])\n @occupationclassification.destroy\n\n respond_to do |format|\n format.html { redirect_to occupationclassifications_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @taxon_name_classification.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Taxon name classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classification = Classification.find(params[:id])\n @item = @classification.item\n \n # figure out which template to show\n if @classification.subject.subject_type_id == 8\n @js_template = 'admin/items/remove_genre_from_item'\n else\n @js_template = 'admin/items/remove_classification_from_item'\n end\n \n @classification.destroy\n @classification = nil\n \n respond_to do |format|\n format.html { redirect_to(admin_classifications_url) }\n\n format.js { render :template => @js_template }\n format.xml { head :ok }\n end\n end",
"def destroy\n @incomeclassification = Incomeclassification.find(params[:id])\n @incomeclassification.destroy\n\n respond_to do |format|\n format.html { redirect_to incomeclassifications_url }\n format.xml { head :ok }\n end\n end",
"def ajax_delete_node\n\n # Get the Node from the DB\n node = Node.find(params[:node_id])\n\n # If node exits, then remove the node\n if !node.nil?\n node.destroy\n end\n\n end",
"def destroy\n @classified = Classified.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to(cyberstock_admin_classifieds_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @classified = @user.classifieds.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to classifieds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classified = Classified.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to(classifieds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @business_classification.destroy\n respond_to do |format|\n format.html { redirect_to business_classifications_url, notice: 'Business classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clclass = Clclass.find(params[:id])\n @clclass.destroy\n\n respond_to do |format|\n format.html { redirect_to clclasses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_training_class.destroy\n respond_to do |format|\n format.html { redirect_to([:admin, @product_training_class.training_class]) }\n format.xml { head :ok }\n format.js\n end\n website.add_log(user: current_user, action: \"Removed training class from #{@product_training_class.product.name}\")\n end",
"def destroy\n @class_type.destroy\n respond_to do |format|\n format.html { redirect_to class_types_url, notice: 'Class type was successfully destroyed.' }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n @classification_code.destroy\n respond_to do |format|\n format.html { redirect_to classification_codes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @training_class.destroy\n respond_to do |format|\n format.html { redirect_to(admin_training_classes_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted training class\")\n end",
"def delete\n if request.xhr?\n existed_feature = Feature.find_by_id(params[\"id\"])\n existed_feature.destroy\n return render :js =>\"success_delete(true)\"\n else\n return render :js =>\"success_delete(false)\"\n end\n end",
"def destroy\n @staffclassification = Staffclassification.find(params[:id])\n @staffclassification.destroy\n\n respond_to do |format|\n format.html { redirect_to(staffclassifications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @clasification.destroy\n respond_to do |format|\n format.html { redirect_to clasifications_url, notice: \"Clasification was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classifier.destroy\n respond_to do |format|\n format.html { redirect_to classifiers_url, notice: 'Classifier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classified.destroy\n respond_to do |format|\n format.html { redirect_to classifieds_url, notice: 'Classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classified.destroy\n respond_to do |format|\n format.html { redirect_to classifieds_url, notice: 'Classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classtable = Classtable.find(params[:id])\n @classtable.destroy\n\n respond_to do |format|\n format.html { redirect_to classtables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_classification.destroy\n respond_to do |format|\n format.html { redirect_to project_classifications_url, notice: 'Project classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @software_training_class.destroy\n respond_to do |format|\n format.html { redirect_to([:admin, @software_training_class.training_class]) }\n format.xml { head :ok }\n format.js\n end\n end",
"def destroy\n @investigationclassification.destroy\n respond_to do |format|\n format.html { redirect_to investigationclassifications_url, notice: 'Investigationclassification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clazz = Clazz.find(params[:id])\n @clazz.destroy\n\n respond_to do |format|\n format.html { redirect_to clazzs_url }\n #format.json { head :no_content }\n format.js { render :nothing => true }\n end\n end",
"def destroy\n @class_taken = ClassTaken.find(params[:id])\n @class_taken.destroy\n\n respond_to do |format|\n format.html { redirect_to class_takens_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @training_class.destroy\n respond_to do |format|\n format.html { redirect_to([:admin, @training_course]) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted training class\")\n end",
"def destroy\n @mscore_classification.destroy\n flash[:success] = 'Mscore classification was successfully deleted.'\n redirect_to :back\n end",
"def destroy\n @request_class_lab.destroy\n respond_to do |format|\n format.html { redirect_to request_class_labs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gg_classlist.destroy\n respond_to do |format|\n format.html { redirect_to gg_classlists_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @category_classified.destroy\n respond_to do |format|\n format.html { redirect_to category_classifieds_url, notice: 'Category classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dnd_class.destroy\n respond_to do |format|\n format.html { redirect_to dnd_classes_url, notice: 'Dnd class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @klass.destroy\n respond_to do |format|\n format.html { redirect_to management_klasses_url, notice: 'Class was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discipline_class_exam_type = DisciplineClassExamType.find(params[:id])\n @discipline_class_exam_type.destroy\n\n respond_to do |format|\n format.html { redirect_to discipline_class_exam_types_url, :notice => 'Tipo de Exame de Classe de Disciplina excluída com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clasificacion = Clasificacion.find(params[:id])\n @clasificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(clasificaciones_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @iclass = Iclass.find(params[:id])\n @iclass.destroy\n\n respond_to do |format|\n format.html { redirect_to iclasses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @klass.destroy\n respond_to do |format|\n format.html { redirect_to klasses_url, notice: 'Class was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trainclass.destroy\n respond_to do |format|\n format.html { redirect_to trainclasses_url, notice: 'Trainclass was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cg_entry = CgEntry.find(params[:id])\n @cg_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to cg_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n head :no_content\n end",
"def destroy\n @label = @project.labels.find_by_id(params[:id])\n\n @label.destroy\n respond_with(@label) do |format|\n format.js { render {} }\n end\n end",
"def destroy\n @classe = Classe.find(params[:id])\n @classe.destroy\n\n respond_to do |format|\n format.html { redirect_to classi_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @class = Classe.find(params[:id])\n @class.destroy\n\n respond_to do |format|\n format.html { redirect_to classes_url }\n format.json { head :no_content }\n end\n end",
"def delete_regexpression\n @regexpression = Regexpression.find(params[:id])\n @regexpression.delete\n\n respond_to do |format|\n format.js { render 'demo/delete_regexpression' }\n end\n end",
"def destroy\n @classification_fund.destroy\n respond_to do |format|\n format.html { redirect_to classification_funds_url, notice: 'Classification fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_class.destroy\n respond_to do |format|\n format.html { redirect_to data_classes_url, notice: 'Data class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @class_request = ClassRequest.find(params[:id])\n @class_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(class_requests_url) }\n format.xml { head :ok }\n end\n end",
"def advising_ajax_delete\n\t\t@user = @current_user\n\t\t@course = Course.find(params[:id])\n\n\t\t# check prerequisites error upon the remove\n\t\terror_messages = check_prerequisites_on_change(@plan, @course, 'remove')\n\n\t\t# if there is no prerequisite error then delete the course\n\t\tif error_messages.length == 0\n\t\t\[email protected](@course)\n\t\t\t@json_response = get_plans_courses_completion_json(@plan)\n\t\t\trespond_to do |format|\n\t\t\t\tformat.json { render json: @json_response }\n\t\t\tend\n\t\t# if there is a prerequisite error then send json error and the error messages back\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tformat.json { render json: { :error => true, :error_messages => error_messages } }\n\t\t\tend\n\t\tend\n\tend",
"def destroy\n @biocuration_classification.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Biocuration classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @registration_klass.destroy\n respond_to do |format|\n format.html { redirect_to school_registration_klasses_path(@school), notice: 'Class was successfully destroyed.' }\n format.json { head :no_content }\n format.js { }\n end\n end",
"def destroy\n @classname.destroy\n respond_to do |format|\n format.html { redirect_to classnames_url, notice: 'Classname was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @districtclass = Districtclass.find(params[:id])\n @districtclass.destroy\n\n respond_to do |format|\n format.html { redirect_to districtclasses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @klass = Klass.find(params[:id])\n @klass.destroy\n\n respond_to do |format|\n format.html { redirect_to(klasses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @inclass.destroy\n respond_to do |format|\n format.html { redirect_to inclasses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classifield.destroy\n respond_to do |format|\n format.html { redirect_to @classifield, notice: 'Classifield was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @training_category = TrainingCategory.find(params[:id])\n if authorized?(:new, :training_categories, @training_category.ministry)\n if @training_category.training_questions.empty?\n @training_category.destroy\n flash[:notice] = 'Training Category was successfully deleted.'\n respond_to do |format|\n format.html { redirect_to(training_categories_url) }\n format.xml { head :ok }\n format.js\n end\n else\n respond_to do |format|\n format.js do \n render :update do |page|\n page.alert(\"You can't delete a category that still has questions in it. Please remove the questions from this category before deleting it.\")\n page.hide('spinnertc')\n end\n end\n end\n end\n else\n render :nothing => true\n end\n end",
"def destroy\n @education_class.destroy\n respond_to do |format|\n format.html { redirect_to education_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @myclass = Myclass.find(params[:id])\n @myclass.destroy\n\n respond_to do |format|\n format.html { redirect_to myclasses_url }\n format.json { head :no_content }\n end\n end",
"def master_category_delete\n @error=false\n @batches=Batch.find(params[:batch_id])\n @finance_fee_category = FinanceFeeCategory.find(params[:id])\n @catbatch=CategoryBatch.find_by_finance_fee_category_id_and_batch_id(params[:id], params[:batch_id])\n unless @catbatch.destroy\n @catbatch.errors.add_to_base(t('fee_collection_exists_cant_delete_this_category'))\n @error=true\n end\n @finance_fee_category.update_attributes(:is_deleted => true) unless @finance_fee_category.category_batches.present?\n #@finance_fee_category.delete_particulars\n fy_id = current_financial_year_id\n @master_categories = @batches.finance_fee_categories.for_financial_year(fy_id).all_active\n respond_to do |format|\n format.js { render :action => 'master_category_delete' }\n end\n end",
"def destroy\n @text_entry = TextEntry.find(params[:id])\n @statute_type_id = @text_entry.statute_type_id\n @text_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to statute_type_url(@statute_type_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n respond_to do |format|\n format.html { redirect_to criteria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @labelling = Labelling.find(params[:id])\n @labelling.destroy\n\n respond_to do |format|\n format.html { redirect_to labellings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_thread_label.destroy\n respond_to do |format|\n format.html { redirect_to backend_post_thread_labels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_class = TestClass.find(params[:id])\n @test_class.destroy\n\n respond_to do |format|\n format.html { redirect_to test_classes_url }\n format.json { head :no_content }\n end\n end",
"def disassociate\n @discipline = Discipline.find(params[:discipline_id])\n\n respond_to do |format|\n current_user.notebook.disciplines.delete(@discipline)\n format.js\n end\n end",
"def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @interview = Interview.find(params[:id])\n @interview.destroy\n return if request.xhr?\n render :nothing => true\n end",
"def destroy\n @post_label = PostLabel.find(params[:id])\n @post_label.destroy\n\n respond_to do |format|\n format.html { redirect_to post_labels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classified_person_category = ClassifiedPersonCategory.find(params[:id])\n @classified_person_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(classified_person_categories_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @classtime.destroy\n respond_to do |format|\n format.html { redirect_to admin_classtimes_url, notice: 'Classtime was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @class_detail.destroy\n respond_to do |format|\n format.html { redirect_to class_details_url, notice: 'Class detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @sector\n @name = @sector.name\n @sector.destroy\n respond_to do |format|\n flash.now[:success] = \"La nota entrante número \"+@name+\" se ha eliminado correctamente.\"\n format.js\n end\n end",
"def destroy\n @discipleship_class.destroy\n respond_to do |format|\n format.html { redirect_to discipleship_classes_url, notice: 'Discipleship class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @group_label = GroupLabel.find(params[:id])\n @group_label.destroy\n\n respond_to do |format|\n format.html { redirect_to group_labels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @risk_class = RiskClass.find(params[:id])\n @risk_class.destroy\n\n respond_to do |format|\n format.html { redirect_to(risk_classes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @label = Label.find(params[:id])\n @label.destroy\n\n respond_to do |format|\n format.html { redirect_to labels_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @citizenship_class = @grantee.citizenship_classes.find(params[:id])\n @citizenship_class.destroy\n\n respond_to do |format|\n format.html { redirect_to grantee_path(@grantee) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entity = @klass.find(params[:id])\n @entity.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_entities_url(entity: @klass_path) }\n format.json { head :no_content }\n end\n end",
"def destroy # for DELETE request\n @tasklabel = TaskLabel.find(params[:id])\n @tasklabel.destroy\n render json: {status: 'SUCCESS', message:'Deleted TaskLabel relationship', \n data: @tasklabel},status: :ok\n end",
"def destroy\n @critical_success_factor_type = CriticalSuccessFactorType.find(params[:id])\n @critical_success_factor_type.destroy\n\n respond_to do |format|\n format.html { redirect_to critical_success_factor_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flag_class.destroy\n respond_to do |format|\n format.html { redirect_to flag_classes_url, notice: 'Flag class was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @class.destroy\n respond_to do |format|\n format.html { redirect_to classes_url }\n flash.now[:notice] = \"Class was successfully destroyed.\"\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n end",
"def destroy\n @classwork = Classwork.find(params[:id])\n @classwork.update_attributes(:deleted => @classwork.deleted ? false : true)\n #@classwork.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_classworks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clasificacion_pegi = ClasificacionPegi.find(params[:id])\n @clasificacion_pegi.destroy\n\n respond_to do |format|\n format.html { redirect_to clasificacion_pegis_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @classwork.destroy\n respond_to do |format|\n format.html { redirect_to classworks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sellable = Sellable.find(params[:id])\n @sellable.destroy\n\n respond_to do |format|\n format.html { redirect_to sellables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @selection_criterium.destroy\n respond_to do |format|\n format.html { redirect_to selection_criteria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classs.destroy\n respond_to do |format|\n format.html { redirect_to classses_url, notice: 'Classs was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @requirement = Requirement.find(params[:id])\n @instance = @requirement.instance\n @requirement.destroy\n respond_to do |format|\n format.html { redirect_to instance_path(@instance) }\n format.js\n format.xml { head :ok }\n end\n end",
"def destroy\n @regiment = Regiment.find(params[:id])\n @regiment.destroy\n\n respond_to do |format|\n format.html { redirect_to(regiments_url) }\n format.xml { head :ok }\n format.js { render :nothing => true }\t\t# Fading out deleted regiment instead of reloading page\n end\n end",
"def destroy\n @glossary_label.destroy\n respond_to do |format|\n format.html { redirect_to glossary_labels_url, notice: 'Glossary label was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @leaf.destroy\n respond_to do |format|\n format.html { redirect_to leafs_url, notice: DELETE_SUCCESS }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ezr_content_class_attribute = EzrContentClassAttribute.find(params[:id])\n @ezr_content_class_attribute.destroy\n\n respond_to do |format|\n format.html { redirect_to(ezr_content_class_attributes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @info_class = InfoClass.find(params[:id])\r\n @info_class.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(info_classes_url) }\r\n format.xml { head :ok }\r\n format.json { render :text => '{status: \"success\"}'}\r\n end\r\n end",
"def destroy\n @taxonomy_category = TaxonomyCategory.find(params[:id])\n @taxonomy_category.destroy\n\n respond_to do |format|\n format.html { redirect_to taxonomy_categories_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @subcriterion = Subcriterion.find(params[:id])\n @subcriterion.destroy\n\n respond_to do |format|\n format.html { redirect_to subcriteria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject_class.destroy\n respond_to do |format|\n format.html { redirect_to subject_classes_url }\n format.json { head :no_content }\n end\n end"
] | [
"0.7312839",
"0.69070196",
"0.68694365",
"0.68410945",
"0.6817031",
"0.6805132",
"0.6684812",
"0.66745853",
"0.66630816",
"0.6612515",
"0.66072005",
"0.6603169",
"0.6567192",
"0.65652436",
"0.655926",
"0.6550945",
"0.6550208",
"0.654281",
"0.65408593",
"0.6539321",
"0.65017915",
"0.6489758",
"0.6489758",
"0.64892834",
"0.6470645",
"0.6469891",
"0.6447481",
"0.6414527",
"0.6386878",
"0.63645595",
"0.6356587",
"0.6352261",
"0.6346717",
"0.6339633",
"0.6314737",
"0.63056463",
"0.62976485",
"0.6291745",
"0.6278211",
"0.6271645",
"0.62671685",
"0.6262898",
"0.6251947",
"0.62433594",
"0.62366945",
"0.6235744",
"0.62327814",
"0.6232221",
"0.6223234",
"0.6216256",
"0.6205573",
"0.6204336",
"0.6190692",
"0.61888456",
"0.6187086",
"0.6184283",
"0.617983",
"0.6173047",
"0.61625737",
"0.61589676",
"0.6154159",
"0.6153235",
"0.6152962",
"0.6139749",
"0.61377627",
"0.61357385",
"0.6128916",
"0.61261827",
"0.6105604",
"0.60995656",
"0.60963845",
"0.609291",
"0.60872334",
"0.60773045",
"0.607398",
"0.6070467",
"0.6065332",
"0.6064064",
"0.6046732",
"0.604584",
"0.60439104",
"0.6041892",
"0.60413754",
"0.6038379",
"0.60331523",
"0.60329634",
"0.6025257",
"0.60237324",
"0.6022057",
"0.6021564",
"0.60203856",
"0.6015076",
"0.6006267",
"0.6000967",
"0.6000726",
"0.59976083",
"0.5990923",
"0.59882265",
"0.5987391",
"0.59871846",
"0.5986511"
] | 0.0 | -1 |
AJAX driven routine to add/update a classification entry | def forest_accept
assert_privileges("ops_settings")
forest_get_form_vars
no_changes = true
if @ldap_info[:ldaphost] == ""
add_flash(_("LDAP Host is required"), :error)
no_changes = false
elsif @edit[:new][:authentication][:user_proxies].blank? || @edit[:new][:authentication][:user_proxies][0].blank? # if adding forest first time, delete a blank record
@edit[:new][:authentication][:user_proxies].delete_at(0)
else
@edit[:new][:authentication][:user_proxies].each do |f|
# check to make sure ldaphost already doesn't exist and ignore if existing record is being edited.
next unless f[:ldaphost] == @ldap_info[:ldaphost] && session[:entry] == 'new'
no_changes = false
add_flash(_("LDAP Host should be unique"), :error)
break
end
end
if no_changes
if session[:entry] == "new"
@edit[:new][:authentication][:user_proxies].push(@ldap_info)
else
@edit[:new][:authentication][:user_proxies].each_with_index do |f, i|
@edit[:new][:authentication][:user_proxies][i] = @ldap_info if f[:ldaphost] == session[:entry][:ldaphost]
end
end
end
@changed = (@edit[:new] != @edit[:current])
render :update do |page|
page << javascript_prologue
page << javascript_for_miq_button_visibility(@changed)
page.replace("flash_msg_div", :partial => "layouts/flash_msg")
page << "miqScrollTop();" if @flash_array.present?
page.replace("forest_entries_div", :partial => "ldap_forest_entries", :locals => {:entry => nil, :edit => false}) if no_changes
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_add_classification_to_item\n # retrieve @repositories for instant additions\n @item = Item.find(params[:id])\n @subjects = Subject.concept_list\n @max_position = Classification.maximum(:position, :conditions => ['item_id = ?', params[:id]] ) || 0\n @classification = Classification.new(\n :item_id => params[:id],\n :publish => true,\n :position => @max_position + 1\n )\n respond_to do |format|\n format.html { render :action => \"show\", :id => @item }\n format.js\n end\n end",
"def update\n respond_to do |format|\n if @classification.update(classification_params)\n format.html { redirect_to @classification, notice: t('controller.successfully_updated', model: t('activerecord.models.classification')) }\n format.json { head :no_content }\n else\n @classification_types = ClassificationType.all\n format.html { render action: \"edit\" }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classification = Classification.new(params[:classification])\n @items = Item.select_list\n @subjects = Subject.concept_list\n @genres = Subject.genre_list\n @item = @classification.item\n @add_concept = params[:classification][:add_concept] == 'true'\n\n # figure out which template to show\n if @classification.subject.subject_type_id == 8\n @js_template = 'admin/items/add_genre_to_item'\n else\n @js_template = 'admin/items/add_classification_to_item'\n end\n\n respond_to do |format|\n if @classification.save\n @max_position = Classification.maximum(:position, :conditions => ['item_id = ?', @item.id] ) || 0\n @new_classification = Classification.new(\n :item_id => @item.id,\n :publish => true,\n :position => @max_position + 1\n )\n format.html { redirect_to(admin_classification_path(@classification), :notice => 'Classification was successfully created.') }\n format.xml { render :xml => @classification, :status => :created, :location => @classification }\n format.js { render :template => @js_template }\n else\n @new_classification = @classification\n format.html { render :action => \"new\" }\n format.xml { render :xml => @classification.errors, :status => :unprocessable_entity }\n format.js { render :template => @js_template }\n end\n end\n end",
"def create\n Rails.logger.debug \"[ClassificationsController.create] params.class: #{params.class}, params: #{params}\"\n @classifaction = Classification.new transaction_data: params\n @classifaction.classifiers << StatusCodeClassifier.classify( @classifaction.transaction_data )\n @classifaction.classify\n\n if @classifaction.save\n render json: @classifaction.as_jsonapi, status: :created\n else\n render json: { error: 'oops' }, status: 500\n end\n end",
"def update\n @classification = Classification.find(params[:id])\n @items = Item.select_list\n @subjects = Subject.concept_list\n @genres = Subject.genre_list\n respond_to do |format|\n if @classification.update_attributes(params[:classification])\n format.html { redirect_to(admin_classification_path(@classification), :notice => 'Classification was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_classification\n @bib.classification.each do |c|\n case c.type\n when \"type\" then @item[\"type\"] = c.value\n when \"mendeley\" then @item[\"mendeley-tags\"] = c.value\n end\n end\n end",
"def create\n @classification = Classification.new(classification_params)\n\n respond_to do |format|\n if @classification.save\n format.html { redirect_to @classification, notice: t('controller.successfully_created', model: t('activerecord.models.classification')) }\n format.json { render json: @classification, status: :created, location: @classification }\n else\n @classification_types = ClassificationType.all\n format.html { render action: \"new\" }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @taxon_name_classification.update(taxon_name_classification_params)\n format.html { redirect_to :back, notice: 'Taxon name classification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, notice: 'Taxon name classification was NOT successfully updated.' }\n format.json { render json: @taxon_name_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @class_type.update(class_type_params)\n format.html { redirect_to @class_type, notice: 'Class type was successfully updated.' }\n format.json { render :show, status: :ok, location: @class_type }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @class_type.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n respond_to do |format|\n if @item_classification.update(item_classification_params)\n format.html { redirect_to @item_classification, notice: 'Classificação atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @item_classification }\n else\n format.html { render :edit }\n format.json { render json: @item_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def associate\n @discipline = Discipline.find(params[:discipline_id])\n\n respond_to do |format|\n current_user.notebook.disciplines << @discipline\n format.js\n end\n end",
"def update\n respond_to do |format|\n if @project_classification.update(project_classification_params)\n format.html { redirect_to project_classifications_path, notice: 'Project classification was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_classification }\n else\n format.html { render :edit }\n format.json { render json: @project_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clasification.update(clasification_params)\n format.html { redirect_to @clasification, notice: \"Clasification was successfully updated.\" }\n format.json { render :show, status: :ok, location: @clasification }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @clasification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @occupationclassification = Occupationclassification.find(params[:id])\n\n respond_to do |format|\n if @occupationclassification.update_attributes(params[:occupationclassification])\n flash[:success] = \"Occupation classification was successfully updated.\"\n format.html { redirect_to @occupationclassification }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @occupationclassification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classifier.update(classifier_params)\n format.html { redirect_to @classifier, notice: 'Classifier was successfully updated.' }\n format.json { render :show, status: :ok, location: @classifier }\n else\n format.html { render :edit }\n format.json { render json: @classifier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @clazz = current_user.clazzs.build(params[:clazz])\n\n respond_to do |format|\n if @clazz.save\n @clazz_amt = current_user.clazzs.size - 1\n format.html { redirect_to(@clazz, :notice => 'class created.') } \n format.js\n else\n @clazz_amt = \"error\"\n format.html { render :action => \"new\" } \n #format.json { render json: @clazz.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n @classified = @user.classifieds.find(params[:id])\n\n respond_to do |format|\n if @classified.update_attributes(params[:classified])\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classified.update(classified_params)\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @classified }\n else\n format.html { render :edit }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classified.update(classified_params)\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @classified }\n else\n format.html { render :edit }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @mscore_classification.update(mscore_classification_params)\n flash[:success] = 'Mscore classification was successfully updated.'\n redirect_to :back\n\n else\n flash[:danger] = 'Mscore classification was not updated.'\n redirect_to :back\n end\n\n end",
"def update\n respond_to do |format|\n if @category_classified.update(category_classified_params)\n format.html { redirect_to @category_classified, notice: 'Category classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @category_classified }\n else\n format.html { render :edit }\n format.json { render json: @category_classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classification_code.update(classification_code_params)\n format.html { redirect_to @classification_code, notice: 'Classification code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classification_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_classification_code\n @classification_code = ClassificationCode.find(params[:id])\n end",
"def classification=(value)\n @classification = value\n end",
"def classification=(value)\n @classification = value\n end",
"def update\n @incomeclassification = Incomeclassification.find(params[:id])\n\n respond_to do |format|\n if @incomeclassification.update_attributes(params[:incomeclassification])\n flash[:success] = \"Income classification was successfully updated.\"\n format.html { redirect_to @incomeclassification }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incomeclassification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @classified = Classified.find(params[:id])\n\n respond_to do |format|\n if @classified.update_attributes(params[:classified])\n flash[:notice] = 'Cyberstock was successfully updated.'\n format.html { redirect_to(cyberstock_admin_classifieds_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classified.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @training_class.update_attributes(training_class_params)\n format.html { redirect_to([:admin, @training_class], notice: 'Training class was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated training class\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @training_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_classified\n @classified = Classified.find(params[:id])\n end",
"def set_classified\n @classified = Classified.find(params[:id])\n end",
"def update\n @risk_classification = RiskClassification.find(params[:id])\n\n respond_to do |format|\n if @risk_classification.update_attributes(params[:risk_classification])\n format.html { redirect_to @risk_classification, notice: 'Risk classification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @risk_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @business_classification.update(business_classification_params)\n format.html { redirect_to @business_classification, notice: 'Business classification was successfully updated.' }\n format.json { render :show, status: :ok, location: @business_classification }\n else\n format.html { render :edit }\n format.json { render json: @business_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gg_classlist.update(gg_classlist_params)\n format.html { redirect_to @gg_classlist, notice: 'Gg classlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gg_classlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_item_classification\n @item_classification = ItemClassification.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @training_class.update(training_class_params)\n format.html { redirect_to([:admin, @training_course], notice: 'Training class was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated training class\")\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @training_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_recipe_classify\n @recipe_classify = RecipeClassify.find(params[:id])\n end",
"def classification_params\n params.require(:classification).permit(:company_id, :text, :category)\n end",
"def update\n respond_to do |format|\n if @registration_klass.update(registration_klass_params)\n format.html { redirect_to [@school, @registration_klass], notice: 'Class was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration_klass }\n format.js { }\n else\n format.html { render :edit }\n format.json { render json: @registration_klass.errors, status: :unprocessable_entity }\n format.js { render layout: false, content_type: 'text/javascript' }\n end\n end\n end",
"def update\n @iclass = Iclass.find(params[:id])\n\n respond_to do |format|\n if @iclass.update_attributes(params[:iclass])\n format.html { redirect_to @iclass, :notice => 'Iclass was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @iclass.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @class_type = ClassType.new(class_type_params)\n\n respond_to do |format|\n if @class_type.save\n format.html { redirect_to class_types_path, notice: 'Class type was successfully created.' }\n format.json { render :show, status: :created, location: @class_type }\n format.js\n else\n format.html { render :new }\n format.json { render json: @class_type.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @risk_classification = RiskClassification.new(params[:risk_classification])\n\n respond_to do |format|\n if @risk_classification.save\n format.html { redirect_to @risk_classification, notice: 'Risk classification was successfully created.' }\n format.json { render json: @risk_classification, status: :created, location: @risk_classification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @risk_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_clasification\n @clasification = Clasification.find(params[:id])\n end",
"def create\n @training_category = @ministry.training_categories.new(params[:training_category])\n \n respond_to do |format|\n if @training_category.save\n flash[:notice] = 'Training Category was successfully created.'\n format.html { redirect_to(training_categories_path) }\n format.js\n format.xml { render :xml => @training_category, :status => :created, :location => @training_category }\n else\n format.js { render :action => \"new\" }\n format.html { render :action => \"new\" }\n format.xml { render :xml => @training_category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show_add_genre_to_item\n # retrieve @repositories for instant additions\n @item = Item.find(params[:id])\n @genres = Subject.genre_list\n @max_position = Classification.maximum(:position, :conditions => ['item_id = ?', params[:id]] ) || 0\n @classification = Classification.new(\n :item_id => params[:id],\n :publish => true,\n :position => @max_position + 1\n )\n respond_to do |format|\n format.html { render :action => \"show\", :id => @item }\n format.js\n end\n end",
"def update\n @clclass = Clclass.find(params[:id])\n\n respond_to do |format|\n if @clclass.update_attributes(params[:clclass])\n format.html { redirect_to @clclass, notice: 'Clclass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_classification = ItemClassification.new(item_classification_params)\n\n respond_to do |format|\n if @item_classification.save\n format.html { redirect_to @item_classification, notice: 'Classificação criada com sucesso.' }\n format.json { render :show, status: :created, location: @item_classification }\n else\n format.html { render :new }\n format.json { render json: @item_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @biocuration_classification.update(biocuration_classification_params)\n format.html { redirect_to :back, notice: 'Biocuration classification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to :back, notice: 'Biocuration classification was NOT successfully updated.' }\n format.json { render json: @biocuration_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ajax_save_edit_node\n\n # Get the Node from the DB\n node = Node.find(params[:id])\n\n node.name = params[:name]\n node.email_template_id = params[:email_template_id]\n node.delay_unit = params[:delay_unit]\n node.delay_time = params[:delay_time]\n\n # Save and verify Node and return correct JSON response\n node.put('', {\n :name => node.name,\n :email_template_id => node.email_template_id,\n :delay_unit => node.delay_unit,\n :delay_time => node.delay_time,\n })\n\n # Return Success Response\n response = {\n success: true,\n message: 'Node Updated!'\n }\n render json: response\n\n\n\n end",
"def update\n respond_to do |format|\n if @klass.update(klass_params)\n format.html { redirect_to @klass, notice: 'Class was successfully updated.' }\n format.json { render :show, status: :ok, location: @klass }\n else\n format.html { render :edit }\n format.json { render json: @klass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classname.update(classname_params)\n format.html { redirect_to @classname, notice: 'Classname was successfully updated.' }\n format.json { render :show, status: :ok, location: @classname }\n else\n format.html { render :edit }\n format.json { render json: @classname.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @clasification = Clasification.new(clasification_params)\n\n respond_to do |format|\n if @clasification.save\n format.html { redirect_to @clasification, notice: \"Clasification was successfully created.\" }\n format.json { render :show, status: :created, location: @clasification }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @clasification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @speciality = Speciality.new(params[:speciality])\n @speciality.speciality_id = params[:lab_id]\n @speciality.speciality_type = \"lab\"\n\n respond_to do |format|\n \t format.js { render :content_type => 'text/javascript', :layout => false}\n end\n end",
"def set_category_classified\n @category_classified = CategoryClassified.find(params[:id])\n end",
"def create\n @classified = Classified.new(classified_params)\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def propagate_classification\n raise(\"Name#propagate_classification only works on genera for now.\") \\\n if rank != \"Genus\"\n\n subtaxa = subtaxa_whose_classification_needs_to_be_changed\n Name.where(id: subtaxa).\n update_all(classification: classification)\n NameDescription.where(name_id: subtaxa).\n update_all(classification: classification)\n Observation.where(name_id: subtaxa).\n update_all(classification: classification)\n end",
"def create\n @project_classification = ProjectClassification.new(project_classification_params)\n\n respond_to do |format|\n if @project_classification.save\n format.html { redirect_to project_classifications_path, notice: 'Project classification was successfully created.' }\n format.json { render :show, status: :created, location: @project_classification }\n else\n format.html { render :new }\n format.json { render json: @project_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_classification\n Notifications::Base.build_classified_notifications\n @pending_notifications = Notifications::Base.filtered_classified_notifications\n end",
"def update_feature\n if request.xhr?\n existed_feature = Feature.find_by_id(params[\"hidden_feature_id\"])\n return render :json =>{\"success\" =>false} if existed_feature.blank?\n updated = existed_feature.update_attributes(:description => params[\"description\"], :status =>params[\"status\"])\n return render :js =>\"success_update(true)\" if updated ==true\n return render :js =>\"success_update(false)\"\n else\n return render :js =>\"success_update(false)\"\n end\n end",
"def update\n @staffclassification = Staffclassification.find(params[:id])\n\n respond_to do |format|\n if @staffclassification.update_attributes(params[:staffclassification])\n flash[:notice] = 'Staffclassification was successfully updated.'\n format.html { redirect_to(@staffclassification) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @staffclassification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n s_id = Allotment.where(user_id: current_user.id).pluck(:school_id).first\n standard_id = Standard.where(name: params[:class_mapping][:standard]).pluck(:id).first\n section_id = Section.where(name: params[:class_mapping][:section]).pluck(:id).first\n @classes = ClassMapping.new({:section_id => section_id, :standard_id => standard_id, :school_id => s_id})\n @saved_class = { id:@classes.id, standard: params[:class_mapping][:standard], section: params[:class_mapping][:section], school: s_id}\n if @classes.save\n render :json => @saved_class\n end\n end",
"def create\n @iclass = Iclass.new(params[:iclass])\n\n respond_to do |format|\n if @iclass.save\n format.html { redirect_to @iclass, :notice => 'Iclass was successfully created.' }\n format.json { render :json => @iclass, :status => :created, :location => @iclass }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @iclass.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_classifier\n @classifier = Classifier.find(params[:id])\n end",
"def create\n @classifier = Classifier.new(classifier_params)\n\n respond_to do |format|\n if @classifier.save\n format.html { redirect_to @classifier, notice: 'Classifier was successfully created.' }\n format.json { render :show, status: :created, location: @classifier }\n else\n format.html { render :new }\n format.json { render json: @classifier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @class_taken = ClassTaken.find(params[:id])\n\n respond_to do |format|\n if @class_taken.update_attributes(params[:class_taken])\n format.html { redirect_to @class_taken, notice: 'Class taken was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @class_taken.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @occupationclassification = Occupationclassification.new(params[:occupationclassification])\n\n respond_to do |format|\n if @occupationclassification.save\n flash[:success] = \"Occupation classification was successfully created.\"\n format.html { redirect_to @occupationclassification }\n format.xml { render :xml => @occupationclassification, :status => :created, :location => @occupationclassification }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @occupationclassification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @classtable = Classtable.find(params[:id])\n\n respond_to do |format|\n if @classtable.update_attributes(params[:classtable])\n format.html { redirect_to @classtable, notice: 'Classtable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classtable.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @object = referenced_object\n @attribute = params[:attribute]\n @form_element = params[:form_element]\n @sub_id = params[:sub_id]\n @update_span = params[:update]\n send(\"#{@form_element.to_s}_update\", @object, @attribute)\n @object.save\n respond_to do |format|\n format.html { } unless @Klass.not_accessible_through_html?\n format.js { }\n end\n end",
"def update\n add_breadcrumb \"Classes\", classes_url\n add_breadcrumb \"Edit\"\n respond_to do |format|\n if @class.update(class_params)\n format.html { redirect_to classes_url, notice: 'Class was successfully updated.' }\n format.json { render :show, status: :ok, location: @class }\n else\n format.html { render :edit }\n flash[:alert] = @class.errors.full_messages.to_sentence\n format.json { render json: @class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def master_category_new\n @finance_fee_category = FinanceFeeCategory.new\n @batches = Batch.active\n respond_to do |format|\n format.js { render :action => 'master_category_new' }\n end\n end",
"def create\n self.done_add_button\n wait_for_ajax\n end",
"def teacher_updated_class_list_json\n params.require(:workspace_id)\n params.require(:school_id)\n params.require(:grade_level_next_year)\n params.require(:list_type_text)\n params.require(:json)\n params.require(:submitted)\n workspace_id = params[:workspace_id]\n school_id = params[:school_id].to_i\n grade_level_next_year = params[:grade_level_next_year]\n list_type_text = params[:list_type_text]\n json = params[:json]\n submitted = ActiveModel::Type::Boolean.new.cast(params[:submitted])\n\n # Check that they are authorized for grade level\n grade_level_now = GradeLevels.new.previous(grade_level_next_year)\n raise Exceptions::EducatorNotAuthorized unless queries.is_authorized_for_grade_level_now?(school_id, grade_level_now)\n\n # Check that they are authorized to write to this particular workspace (eg, not submitted yet).\n raise Exceptions::EducatorNotAuthorized unless queries.is_authorized_for_writes?(workspace_id)\n\n # Write a new record\n class_list = ClassList.create!({\n workspace_id: workspace_id,\n created_by_teacher_educator_id: current_educator.id,\n school_id: school_id,\n grade_level_next_year: grade_level_next_year,\n list_type_text: list_type_text,\n submitted: submitted,\n json: json # left opaque for UI to iterate\n })\n class_list_json = serialize_class_list(class_list)\n render json: {\n class_list: class_list_json\n }\n end",
"def add_findings\n @pattern = Pattern.find(params[:id])\n @pattern.update_attribute(:status, \"needs_approval\")\n respond_to do |format|\n format.html # add_finding.html.erb\n end\n end",
"def create\n @category_classified = CategoryClassified.new(category_classified_params)\n\n respond_to do |format|\n if @category_classified.save\n format.html { redirect_to @category_classified, notice: 'Category classified was successfully created.' }\n format.json { render :show, status: :created, location: @category_classified }\n else\n format.html { render :new }\n format.json { render json: @category_classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classs.update(classs_params)\n format.html { redirect_to @classs, notice: 'Classs was successfully updated.' }\n format.json { render :show, status: :ok, location: @classs }\n else\n format.html { render :edit }\n format.json { render json: @classs.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @registration_klass = @school.registration_klasses.build(registration_klass_params)\n\n respond_to do |format|\n if @registration_klass.save\n format.html { redirect_to [@school, @registration_klass], notice: 'Class was successfully created.' }\n format.json { render :show, status: :created, location: @registration_klass }\n format.js { }\n else\n format.html { render :new }\n format.json { render json: @registration_klass.errors, status: :unprocessable_entity }\n format.js { render layout: false, content_type: 'text/javascript' }\n end\n end\n end",
"def set_taxon_name_classification\n @taxon_name_classification = TaxonNameClassification.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @product_classify.update(product_classify_params)\n format.html { redirect_to :product_classifies, notice: '产品分类修改成功。' }\n format.json { render :show, status: :ok, location: @product_classify }\n else\n format.html { render :edit }\n format.json { render json: @product_classify.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add\n active_content_div.button(:text=>\"Add\").click\n wait_for_ajax\n end",
"def update\r\n respond_to do |format|\r\n if @scenario.update(scenario_params.merge(labels: Scenario.parse_labels(scenario_params[:labels_text], @scenario.project_id)))\r\n set_scenarios_grid(issue_id: @scenario.issue_id)\r\n format.html { redirect_to redirect_url, notice: t('activerecord.success.messages.updated', model: Scenario.model_name.human) }\r\n format.js\r\n else\r\n format.html { render :edit }\r\n format.js { render :edit }\r\n end\r\n end\r\n end",
"def ajax_add_node\n\n # Create a new Node Instance\n node = Node.new\n\n # Update the fields of Node Instance\n node.app_id = params[:app_id]\n node.funnel_id = params[:funnel_id]\n\n if params[:email_template_id] == '0'\n # Create a new Email Template\n template = EmailTemplate.new\n template.app_id = params[:app_id]\n template.name = params[:name] + ' Email Template'\n template.description = ''\n template.email_subject = ''\n template.color = '#3498db'\n\n # Save blank Email Template\n template.save\n\n node.email_template_id = template.id\n\n else\n node.email_template_id = params[:email_template_id]\n\n end\n\n node.name = params[:name]\n node.delay_time = params[:delay_time]\n node.delay_unit = params[:delay_unit]\n node.top = 60\n node.left = 500\n node.num_emails = 0\n node.num_emails_sent = 0\n node.num_revenue = 0.0\n node.num_emails_opened = 0\n node.num_emails_clicked = 0\n\n\n\n node.save\n\n response = {\n success: true,\n message: 'Node Saved',\n id: node.id,\n email_template_id: node.email_template_id\n\n }\n\n render json: response\n\n\n\n end",
"def create\n @incomeclassification = Incomeclassification.new(params[:incomeclassification])\n\n respond_to do |format|\n if @incomeclassification.save\n flash[:success] = \"Income classification was successfully created.\"\n format.html { redirect_to @incomeclassification }\n format.xml { render :xml => @incomeclassification, :status => :created, :location => @incomeclassification }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incomeclassification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n json_update(category,category_params, Category)\n end",
"def create\n @clclass = Clclass.new(params[:clclass])\n\n respond_to do |format|\n if @clclass.save\n format.html { redirect_to @clclass, notice: 'Clclass was successfully created.' }\n format.json { render json: @clclass, status: :created, location: @clclass }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def recipe_classify_params\n params.require(:recipe_classify).permit(:name, :recipe_classify_id)\n end",
"def update\n respond_to do |format|\n if @investigationclassification.update(investigationclassification_params)\n format.html { redirect_to @investigationclassification.investigation, notice: 'Investigationclassification was successfully updated.' }\n format.json { render :show, status: :ok, location: @investigationclassification }\n else\n format.html { render :edit }\n format.json { render json: @investigationclassification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:bookmark][:category_ids].each do |cID| \n if cID != \"\"\n @bookmarkcategory = BookmarkCategory.new\n @bookmarkcategory.category_id= cID\n @bookmarkcategory.bookmark_id = @bookmark.id\n @bookmarkcategory.save\n end \n end \n\n params[:bookmark][:kind_ids].each do |kID| \n if kID != \"\"\n @bookmarkcategory = BookmarkKind.new\n @bookmarkcategory.kind_id= kID\n @bookmarkcategory.bookmark_id = @bookmark.id\n @bookmarkcategory.save\n end \n end \n respond_to do |format|\n if @bookmark.update(bookmark_params)\n format.js { redirect_to bookmarks_path, notice: \"title was successfully created.\" }\n format.html { redirect_to @bookmark, notice: \"Bookmark was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bookmark }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bookmark.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @analisis = Analisis.new(params[:analisis])\n\n respond_to do |format|\n if @analisis.save\n @class_index = 'new'\n format.js\n else\n format.js { render :form }\n end\n end\n end",
"def update\n @instruction_factory = InstructionFactory.find(params[:id]) \n @instruction_factory.classname = params[:instruction_factory][:classname]\n @instruction_factory.name = params[:instruction_factory][:name]\n respond_to do |format|\n \n if @instruction_factory.save\n format.html { redirect_to @instruction_factory, notice: 'instruction_factory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instruction_factory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @clazz = Clazz.find(params[:id])\n\n respond_to do |format|\n if @clazz.update_attributes(params[:clazz])\n format.html { redirect_to @clazz, notice: 'Clazz was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clazz.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n frm.button(:value=>\"Update\").click\n AssessmentTotalScores.new(@browser)\n end",
"def set_classication\n @classication = Classication.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @request_class_lab.update(request_class_lab_params)\n format.html { redirect_to @request_class_lab }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_class_lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ajax_item_save\n #TODO translate & DOC\n @current_object = params[:item_type].classify.constantize.find(params[:id])\n\t\tif @current_object.update_attribute(\"body\", params[:content])\n\t\t message = \"Saved\"\n\t\telse\n\t\t message = \"Unable to Save\"\n\t\tend\n\t\t\n\t\trender :text => message, :layout => false\n end",
"def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classified }\n end\n end",
"def create\n @classification_code = ClassificationCode.new(classification_code_params)\n\n respond_to do |format|\n if @classification_code.save\n format.html { redirect_to @classification_code, notice: 'Classification code was successfully created.' }\n format.json { render action: 'show', status: :created, location: @classification_code }\n else\n format.html { render action: 'new' }\n format.json { render json: @classification_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@classified = Classified.new(classified_params)\n @classified = current_user.classifieds.new(classified_params)\n\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @business_classification = BusinessClassification.new(business_classification_params)\n\n respond_to do |format|\n if @business_classification.save\n format.html { redirect_to @business_classification, notice: 'Business classification was successfully created.' }\n format.json { render :show, status: :created, location: @business_classification }\n else\n format.html { render :new }\n format.json { render json: @business_classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def addClassifications(filename)\n\t# open the file with classifications\n\tclassificationTypes = File.open(Rails.root.join(\"db\", \"seed_data\", filename))\n\t# Each line of the file contains a classification description. Iterate through the file and create a classification for each line.\n\tclassificationTypes.each do |curClassificationType|\n\t\tClassification.find_or_create_by({ :classification_description => curClassificationType.strip })\n\tend\nend",
"def update\n respond_to do |format|\n if @trainclass.update(trainclass_params)\n format.html { redirect_to @trainclass, notice: 'Trainclass was successfully updated.' }\n format.json { render :show, status: :ok, location: @trainclass }\n else\n format.html { render :edit }\n format.json { render json: @trainclass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @feature.save\n flash[:notice] = 'Feature was successfully created.'\n @changed << @feature.id\n \n format.html { redirect_to features_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { render json: @feature, status: :created, location: @feature }\n else\n @edited << 'new'\n @expanded << 'new'\n\n format.html { render action: 'new', template: 'shared/new' }\n format.js { render 'feature' }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def classification=(value)\n case value\n when \"\"\n value = \"admitted\"\n when \"认可的\", \"допустимый\", \"admitido\"\n value = \"admitted\"\n when \"首选的\", \"suositettava\", \"suositeltava\", \"рекомендуемый\", \"preferente\"\n value = \"preferred\"\n when %w(preferred admitted deprecated)\n # do nothing\n end\n @classification = value\n end"
] | [
"0.6391685",
"0.6298906",
"0.60974646",
"0.5986699",
"0.5980225",
"0.5844179",
"0.5788076",
"0.573864",
"0.5698284",
"0.56306034",
"0.562303",
"0.56141925",
"0.56114835",
"0.5580266",
"0.5577854",
"0.5577463",
"0.55705833",
"0.5520212",
"0.5520212",
"0.55184036",
"0.55140805",
"0.54994345",
"0.5486736",
"0.5476048",
"0.5476048",
"0.5467616",
"0.5462455",
"0.544461",
"0.54371154",
"0.54371154",
"0.54256135",
"0.54038703",
"0.5346604",
"0.532707",
"0.5324959",
"0.53218883",
"0.5318853",
"0.5317255",
"0.53070366",
"0.529845",
"0.52953565",
"0.5293322",
"0.52740324",
"0.52607447",
"0.5242843",
"0.5237603",
"0.52254623",
"0.52109",
"0.5209822",
"0.51918614",
"0.5180687",
"0.5176759",
"0.5176452",
"0.5169611",
"0.5167605",
"0.5157783",
"0.5145792",
"0.5130387",
"0.5130357",
"0.51267457",
"0.51181275",
"0.5114544",
"0.5105339",
"0.5103276",
"0.5099825",
"0.50991803",
"0.50954497",
"0.5093886",
"0.50923705",
"0.50854445",
"0.50834584",
"0.5077061",
"0.5068384",
"0.5048005",
"0.50454277",
"0.504494",
"0.50446206",
"0.5036549",
"0.50352246",
"0.5029524",
"0.5027447",
"0.50265855",
"0.5019315",
"0.5011428",
"0.5010658",
"0.5006962",
"0.5002937",
"0.49967512",
"0.4993402",
"0.49926582",
"0.49820843",
"0.49800318",
"0.49713922",
"0.495438",
"0.49528354",
"0.49428472",
"0.49399313",
"0.49395958",
"0.49392763",
"0.49381965",
"0.49327"
] | 0.0 | -1 |
this method get the swaps near the ip parameter. Its called from the static_pages_controller | def swaps_feed(ip)
Swap.near_ip(ip)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rack_ip_offsets # These Rack base addresses get added to 10.31.0.0 and 172.31.0.0\n base = IPv4.new('0.0.80.0').to_i\n @ip_offset ||= { # Rack, and IP address offset from base\n 'b15'=> (IPv4.new('0.0.82.100') - base).to_i, \n 'd15'=> (IPv4.new('0.0.81.150') -base).to_i ,\n 'e15'=> (IPv4.new('0.0.81.50') - base).to_i,\n 'h15'=> (IPv4.new('0.0.83.150') - base).to_i,\n 'i15'=> (IPv4.new('0.0.83.50') - base).to_i,\n 'b18'=> (IPv4.new('0.0.82.0') - base).to_i,\n 'd18'=> (IPv4.new('0.0.81.100') - base).to_i,\n 'e18'=> (IPv4.new('0.0.81.0') - base).to_i,\n 'h18'=> (IPv4.new('0.0.83.100') - base).to_i,\n 'i18'=> (IPv4.new('0.0.83.0') - base).to_i\n }\nend",
"def to_ranges(ips)\n\t\t\t ips = ips.map {|ip| IPAddr.new(ip).to_i }.uniq.sort\n\n\t\t\t prev = ips[0]\n\t\t\t ips\n\t\t\t .slice_before {|e|\n\t\t\t prev2, prev = prev, e\n\t\t\t prev2 + 1 != e\n\t\t\t }\n\t\t\t .map {|addrs| if addrs.length > 1 then [addrs[0], addrs[-1]] else addrs end }\n\t\t\t .map {|addrs| addrs.map{|ip| IPAddr.new(ip, Socket::AF_INET)}.join(\" - \") }\n\t\t\tend",
"def ranges(ips)\n ranges, start, prev = [], ips.first, ips.first\n ips.each_with_index do |ip, i|\n prev = ips[i-1] if i > 0\n if ip == ips.last\n ranges << [start, ip]\n elsif ip.to_i - prev.to_i > 1\n ranges << [start, prev]\n start = ip\n end\n end\n ranges\n end",
"def ips\n self\n end",
"def getNeighboringIPs()\n @neighborIPs = Array.new\n \n @interfaces.each { |interface|\n # get IPs that are connected to this outgoing interface, and add them\n # to our list of neighbors\n connectedIPs = @allWeights.ipMap[interface].keys\n @neighborIPs.concat(connectedIPs)\n }\n end",
"def used_ips\n existing_kvms.map do |name|\n kvm_ip(name)\n end\nend",
"def handle_addrs count = 32\n @node.addrs.weighted_sample(count.to_i) do |addr|\n Time.now.tv_sec + 7200 - addr.time\n end.map do |addr|\n [addr.ip, addr.port, Time.now.tv_sec - addr.time] rescue nil\n end.compact\n end",
"def ip_statistics\n super\n end",
"def ip_list\n super\n end",
"def ip_ranges\n data.ip_ranges\n end",
"def snag_ip\n java.net.NetworkInterface.network_interfaces.each do |networkInterface|\n networkInterface.inet_addresses.each do |inet|\n addr = inet.address\n if addr[0] == 10 && addr.length == 4 && addr[1] < 100 && addr[2] < 100 # TODO: will fail for alt 10.4.151.x\n teamn = addr[1] * 100 + addr[2]\n return teamn\n end\n end\n end\n end",
"def compare_ips(detected, requested)\n Chef::Log.warn(\" Detected ip '#{detected}'; Requested ip:'#{requested}'\")\n detected == requested\nend",
"def ip_ranges_for_ip(lines, ip)\n total = lines.size\n i = 0\n while i < total and lines.at(i) <= ip\n i += 2\n end\n [[lines.at(i-2), lines.at(i)]]\n end",
"def available_ips\n range = conf['addresses']['range']\n unless(range.to_s.empty?)\n range = (range.split('-').first.split('.').last..range.split('-').last).map{|oct|\n \"#{range.split('-').first.split('.').slice(0,3).join('.')}.#{oct}\"\n }\n else\n range = []\n end\n (conf['addresses']['static'] + range).compact\nend",
"def static_ip_score; end",
"def two_factor_excluded_ip_addresses\n []\n end",
"def used_ips\n @used_ips ||= Host.used_ips\n end",
"def ipsource\n lanconfig[\"ip address source\"].downcase!\n end",
"def set_ips\n array = []\n @machines.each do |machine|\n name = machine['name']\n ip = machine['ip']\n array.push(\"#{ip}\\t#{name}\")\n end\n array\n end",
"def ip\n @vps.ip \n end",
"def arp_src_ip= i; typecast \"arp_src_ip\", i; end",
"def ipsBetween(start, ending)\n def parse_to_array(num)\n num = num.split(\".\")\n num.each_index {|index| num[index] = num[index].to_i }\n end\n \n start = parse_to_array(start)\n ending = parse_to_array(ending)\n diff_3 = ending[3]- start[3]\n diff_2 = 256*(ending[2]-start[2])\n diff_1 = 65536*(ending[1]-start[1])\n diff_0 = 16777216*(ending[0]-start[0])\n total = diff_3 + diff_2 + diff_1 + diff_0 \nend",
"def get_ip_sites\n\t\tputs \"Getter to retrieve sites contain an IP instead of a host-name .\" if @verbose\n\t\tsites=Array.new\n\t\t@known_sites.keys.map do |key|\n\t\t\thost=url_2_host(key)\n\t\t\tif is_ip?(host)\n\t\t\t\tsites.push(key)\n\t\t\tend\n\t\tend\n\t\tsites.sort!\n\t\treturn sites\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\treturn nil\n\tend",
"def proc_swaps\n swaps = []\n io = File.open(\"/proc/swaps\")\n entries = io.readlines\n fields = entries.shift.split.map { |f| f.downcase.strip.to_sym }\n entries.each do |line|\n entry = {}\n row = line.split\n fields.each_with_index do |key, i|\n entry[key] = row[i]\n end\n swaps << entry\n end\n io.close\n swaps\nend",
"def net_switch_port_lookup(site, node_uid, interface='')\n site[\"networks\"].each do |switch_uid, switch|\n #pp switch_uid\n switch[\"linecards\"].each do |lc_uid,lc|\n lc[\"ports\"].each do |port_uid,port|\n if port.is_a?(Hash)\n switch_remote_port = port[\"port\"] || lc[\"port\"] || \"\"\n switch_remote_uid = port[\"uid\"]\n else\n switch_remote_port = lc[\"port\"] || \"\"\n switch_remote_uid = port\n end\n if switch_remote_uid == node_uid and switch_remote_port == interface\n # Build port name from snmp_naming_pattern\n # Example: '3 2 GigabitEthernet%LINECARD%/%PORT%' -> 'GigabitEthernet3/2'\n port_name = lc[\"snmp_pattern\"].sub(\"%LINECARD%\",lc_uid.to_s).sub(\"%PORT%\",port_uid.to_s)\n return switch_uid, port_name\n end\n end\n end\n end\n return nil\nend",
"def sort_ips (ips)\n\t\tbegin\n\t\t\t\"Sort the list of IP address in the ascendant order: #{ips}\" if @verbose\n\t\t\treturn NetAddr.sort(ips)\n\t\trescue => ee\n\t\t\tputs \"Exception on method sort_ips for IPs #{ips}: #{ee}\" # if @verbose\n\t\tend\n\tend",
"def arp_dest_ip= i; typecast \"arp_dest_ip\", i; end",
"def getNeighborToInterface() \n @neighborToInterface = Hash.new\n\n # match each neighbor IP to its outgoing interface\n @interfaces.each { |interface|\n @allWeights.collection.each { |weight|\n if (interface == weight.srcIp)\n @neighborToInterface[weight.dstIp] = interface\n end\n }\n }\n end",
"def dedicated_ips\n @attributes[:dedicated_ips]\n end",
"def show_like_ip\n return if table != 254\n\n str = \"\"\n if dst_len == 0\n str = \"default via #{extract_gateway_address_from_attrs} dev #{extract_oif_from_attrs}\"\n elsif dst_len == 32\n str = \"#{extract_dst_from_attrs} dev #{extract_oif_from_attrs}\"\n else\n end\n\n puts str unless str == \"\"\n end",
"def device_ipaddress; end",
"def device_ipaddress; end",
"def zabbix_get_backup_ips\n @config[:groups].each do |group, parameter|\n if parameter[:enable]\n ips = @zabbix.get_ips_by_group(parameter[:name])\n @config[:groups][group.to_sym][:ips] = ips\n end\n end\n return @config\n end",
"def user_ip\n \trequest.location\n end",
"def useRouteInfo( routeTable )\n for addr in routeTable\n addr2 = { :node_id => addr[\"node_id\"], :ip_address => addr[\"ip_address\"], :port => addr[\"port\"] }\n m, n = getMnN(addr[\"node_id\"])\n if @routing_table.has_value?(addr)\n if halfDiff( @routing_table[[0,m,n]][\"node_id\"] ) < halfDiff( @routing_table[[0,m,n]][\"node_id\"] )\n @routing_table[[0,m,n]] = addr2\n end\n else\n @routing_table[[0,m,n]] = addr2\n end\n end\n end",
"def all_hops_adjacent_to_dst_as\n adjacent_hops = []\n return adjacent_hops unless valid?\n\n dst_as = @hops[0].asn\n\n return adjacent_hops if dst_as.nil?\n\n @hops.each do |hop| \n adjacent_hops << hop\n break if hop.asn != dst_as \n end\n\n adjacent_hops\n end",
"def get_ip_address \t\t\t\n\t\trequest.remote_ip \n\tend",
"def lag_ports(switch)\n out = %x(snmpwalk -v2c -c public #{SWITCH} IF-MIB::ifType)\n lagports = out.split(\"\\n\").select do |line|\n line.match(\"ieee8023adLag\")\n end.map do |line|\n line.match(/[0-9]+/)\n end\nend",
"def index\n \n @ip_joins = @ipobject.saveIP(@virtualmachine.RemoteID,@virtualmachine.id)\n @ipaddresses = @virtualmachine.ipaddresses\n end",
"def on_getaddr\n #addrs = @node.addrs.select{|a| a.time > Time.now.to_i - 10800 }.shuffle[0..250]\n #p \"<< addr (#{addrs.size})\"\n #send_data P::Addr.pkt(*addrs)\n end",
"def hashed_ip\n Hmac.instance.hash request.remote_ip\n end",
"def determine_ips\n ips = @info[:ip] = {private: [], public: []}\n\n ifc_cmd = \"/sbin/ifconfig|grep 'inet addr'|grep -v ':127'|sed -e \" \\\n \"'s/.*addr:\\([0-9.]*\\) .*/\\\\1/'\"\n ifconfig = @shell.query('IFCONFIG', ifc_cmd)\n\n ifconfig.each_line do |ip|\n ip.strip!\n ips[rfc1918?(ip)] << ip\n end\n end",
"def ip_restrict\n allow_ips = Settings.ip_addresses.monstarlab.to_h.values.flatten\n allow_ips << \"::1\" if Rails.env.development?\n remote_ip = request.remote_ip\n\n return render_404 unless allow_ips.include? remote_ip\n end",
"def net_switch_port_lookup(site, node_uid, interface='')\n site[\"networks\"].each do |switch_uid, switch|\n switch[\"linecards\"].each do |lc_uid,lc|\n lc[\"ports\"].each do |port_uid,port|\n if port.is_a?(Hash)\n switch_remote_port = port[\"port\"] || lc[\"port\"] || \"\"\n switch_remote_uid = port[\"uid\"]\n else\n switch_remote_port = lc[\"port\"] || \"\"\n switch_remote_uid = port\n end\n if switch_remote_uid =~ /([a-z]*-[0-9]*)-(.*)/\n n, p = switch_remote_uid.match(/([a-z]*-[0-9]*)-(.*)/).captures\n switch_remote_uid = n\n switch_remote_port = p\n end\n if switch_remote_uid == node_uid and switch_remote_port == interface\n # Build port name from snmp_naming_pattern\n # Example: '3 2 GigabitEthernet%LINECARD%/%PORT%' -> 'GigabitEthernet3/2'\n pattern = port[\"snmp_pattern\"] || lc[\"snmp_pattern\"]\n port_name = pattern.sub(\"%LINECARD%\",lc_uid.to_s).sub(\"%PORT%\",port_uid.to_s)\n return switch_uid, port_name\n end\n end\n end\n end\n return nil\nend",
"def historical_revtrs_dst2vps(merged_outage)\n symmetric_outages = merged_outage.symmetric_outages\n return [] if symmetric_outages.empty?\n\n historical_path_suspects = []\n\n symmetric_outages.each do |o|\n # select all historical hops on traceroutes where source is o.src\n # can be liberal, since it's for initializing, not pruning\n site = FailureIsolation.Host2Site[o.dst_hostname]\n\n if site.nil?\n @logger.warn { \"site for #{o.dst_hostname} not specified!\" } if site.nil?\n else\n historical_path_suspects += @site2outgoing_hops[site].map { |ip| Suspect.new(ip, o) }\n\n if @site2outgoing_hops[site].empty?\n @logger.warn { \"no outgoing hops for site...\" }\n else\n @logger.debug { \"found outgoing hops for site!\" } \n end\n end\n end\n\n return historical_path_suspects\n end",
"def routeInfo(routeTable)\n for addr in routeTable\n addr2 = {:node_id => addr[\"node_id\"], :ip_address => addr[\"ip_address\"], :port => addr[\"port\"]}\n m, n = getMnN(addr[\"node_id\"])\n if @routing_table.has_value?(addr)\n if halfDiffering(@routing_table[[0, m, n]][\"node_id\"]) < halfDiffering(@routing_table[[0, m, n]][\"node_id\"])\n @routing_table[[0, m, n]] = addr2\n end\n else\n @routing_table[[0, m, n]] = addr2\n end\n end\n end",
"def canonical_instance_ips(opennebula_instance)\n fail 'Instance object not provided!' unless opennebula_instance\n ips = []\n\n opennebula_instance.each('TEMPLATE/NIC') { |nic| ips << nic['IP'] }\n ips.compact!\n\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Assigning IPs #{ips.inspect} \" \\\n \"to #{opennebula_instance['ID'].inspect}\"\n ips\n end",
"def calculate_unique_page_views\n ip_frequency_per_page = calculate_ip_frequency_per_page\n ip_frequency_per_page.transform_values { |value| value.uniq.length }.sort_by { |_key, value| value }.reverse.to_h\n end",
"def show\n @ips = Ip.where(:mini_url_id => @mini_url.id).select(:ip, :num_visits)\n end",
"def flags_for_ip\n only_provides :js\n\n params[:ip] ||= request.remote_ip\n flags = Flag.find_all_by_ip(params[:ip]).map(&:entry_id)\n \n render \"var flags = [#{flags.join(',')}];\", :layout => false\n end",
"def all_ips_for(vm)\n vm.guest.net.map(&:ipAddress).flatten\n end",
"def show\n @ip = AllowedIpAddress.find(params[:id])\n #@stages = @host.stages.uniq.sort_by{|x| x.project.name}\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @ip.to_xml }\n end\n end",
"def locate_by_ip\n request.location\n end",
"def get_pg_inside\n pg_inside = {}\n\n # Get pnics in use in standard switches\n @item.config.network.vswitch.each do |vs|\n pg_inside[vs.name] = []\n vs.portgroup.each do |pg|\n pg.slice!(\"key-vim.host.PortGroup-\")\n pg_inside[vs.name] << pg\n end\n end\n\n pg_inside\n end",
"def san_interfaces\n if san_nics.length == sans.length \n ports = san_network_ports().sort\n ips = san_nodes.map{|x| x.ip_address.to_s }.sort\n #return [] if ports.length != ips.length \n ports.zip(ips)\n else\n []\n end\n end",
"def tem_ports\n @proxy_ports.values.sort\n end",
"def get_gaps (array)\n return [] if array.empty?\n (array.first .. array.last).to_a - array\nend",
"def connectivity_monitoring_destinations\r\n ConnectivityMonitoringDestinationsController.instance\r\n end",
"def traffic_shaping\n Puppet.debug \"Entering traffic_shaping\"\n @networksystem=host.configManager.networkSystem\n portg=find_portgroup\n if ( resource[:traffic_shaping_policy] == :enabled )\n avgbandwidth = resource[:averagebandwidth].to_i * 1000\n peakbandwidth = resource[:peakbandwidth].to_i * 1000\n burstsize = resource[:burstsize].to_i * 1024\n enabled = 1\n\n hostnetworktrafficshapingpolicy = RbVmomi::VIM.HostNetworkTrafficShapingPolicy(:averageBandwidth => avgbandwidth, :burstSize => burstsize, :enabled => enabled, :peakBandwidth => peakbandwidth)\n\n elsif ( resource[:traffic_shaping_policy] == :disabled)\n enabled = 0\n hostnetworktrafficshapingpolicy = RbVmomi::VIM.HostNetworkTrafficShapingPolicy(:enabled => enabled)\n end\n\n hostnetworkpolicy = RbVmomi::VIM.HostNetworkPolicy(:shapingPolicy => hostnetworktrafficshapingpolicy)\n\n actualspec = portg.spec\n if (actualspec.policy != nil )\n actualspec.policy.shapingPolicy = hostnetworktrafficshapingpolicy\n else\n actualspec.policy = hostnetworkpolicy\n end\n @networksystem.UpdatePortGroup(:pgName => resource[:portgrp], :portgrp => actualspec)\n return true\n end",
"def dynamic_range \n\t\tpage\n\t\tframes\n\t\tnum = 0\n\t\twhile num < 4 \n\t\t\tif page == frames[num] \n\t\t\t\t@destination = frames[num] \n\t\t\tend \n\t\t\tnum += 1 \n\t\tend\n\tend",
"def arp_src_ip; self[:arp_src_ip].to_s; end",
"def next_diff_reserved\n if self.reserved_until then\n Ip.find(:first, :conditions =>\n ['address_i > ? AND ((reserved_until != ? OR reserved_until is null) AND \n (reserved_by != ? or reserved_by is null) AND\n (reserved_reason != ? or reserved_reason is null))',\n self.address_i, self.reserved_until, self.reserved_by, self.reserved_reason], :order => 'address_i')\n else\n Ip.find(:first, :conditions => ['reserved_until is not null'])\n end\n end",
"def index\n @vms = Vm.order(:ip).page params[:page]\n end",
"def ports_in_lag(switch)\n out = %x(snmpwalk -v2c -c public #{SWITCH} IEEE8023-LAG-MIB::dot3adAggPortListPorts)\n lines = out.split(\"\\n\").select { |line| line.match(\"Hex-STRING\") }\n # Example line of data:\n # IEEE8023-LAG-MIB::dot3adAggPortListPorts.54 = Hex-STRING: 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00\n binlines = lines.map do |line|\n line.split(\":\")[3]\n end.map do |line|\n line.delete(' ')\n end.map do |line|\n line.hex.to_s(2).rjust(line.size*4, '0')\n end\n\n portsinlag = []\n binlines.each do |line|\n binline = line.split(\"\")\n binline.each_index do |index|\n portsinlag.push(index + 1) if binline[index] == \"1\"\n end\n end\n portsinlag.sort.uniq\nend",
"def ip; end",
"def ip; end",
"def trace_hops_src_to_dst(suspect_set, merged_outage)\n # we have some set of preexisting pings.\n trace_hops = merged_outage.map { |o| o.tr }.find_all { |trace| trace.valid? }\\\n .map { |trace| trace.hops.map { |hop| hop.ip } }.flatten.to_set.to_a\n end",
"def getlist\n @uniphash = Hash.new\n @unUsedIps = @vm.unassigned_ip_addresses(params[:intIDp])\n @unUsedIps.each do |unUsedIps|\n @uniphash[unUsedIps[\"id\"]] = unUsedIps[\"descriptor\"] \n end\n respond_to do |format|\n format.js\n end \n end",
"def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end",
"def ip(value)\n merge(bkip: value.to_s)\n end",
"def get_ip(ip)\n\n #Recorremos todas las reservaciones del usuario\n Reservation.all.each do |reservation|\n #Si la ip de la reservacion es igual a la ip solicitante y tiene un asiento reservado\n # entonces le asigna una ip\n if reservation.ip == ip && (reservation.seat.reserved)\n #se le asigna una nueva ip\n ip = get_ip(add_number(ip))\n end\n end\n return ip\n end",
"def ip_range\n ip = @resource[:name].split('-')\n ip_range = NetAddr.range NetAddr::CIDR.create(ip.first), NetAddr::CIDR.create(ip.last)\n ip_range.unshift(ip.first).push(ip.last)\n end",
"def find\n addrs = Socket.ip_address_list.select do |addr|\n addr.ipv4? and not(addr.ipv4_loopback?) and not(addr.ipv4_multicast?)\n end\n if not(addrs.empty?)\n privates = addrs.select{|addr| addr.ipv4_private?}\n not_privates = addrs - privates\n privates = privates.sort{|a,b| a.ip_address <=> b.ip_address}\n not_privates = not_privates.sort{|a, b| a.ip_address <=> b.ip_address}\n (privates + not_privates).map {|addr| addr.ip_address}\n else\n Socket.ip_address_list.select{|addr| addr.ipv4_loopback?}.map{|addr| addr.ip_address}\n end\n end",
"def getIp()\n return @ip\n\tend",
"def info_for_paper_trail\n { :ip => request.remote_ip }\n end",
"def migrate\n metrics_list = []\n timestamp = Time.now.to_i.to_s\n ipstring = @option[:ip_address].gsub '.', '-'\n\n # @result.each_pair do |key, value|\n # puts \"|#{key}|\"\n # value.each_pair do |ifname, ifvalue|\n # puts \"|#{ifname}|#{ifvalue}|\"\n # end\n # end\n [[:InSpeed, :InOctets], [:OutSpeed, :OutOctets]].each do |item|\n @result.each_pair do |vlannm, vlanvalue|\n #puts \"|#{vlannm}|\"\n if @exvlan.include? vlannm\n next\n end\n sorted = Hash[vlanvalue.sort_by {|a, b| -b[item[1]].to_i}]\n index = 0\n sorted.each_pair do |ifname, ifvalue|\n if @tops.to_i > 0 && index >= @tops.to_i\n break\n end\n index += 1\n\n #puts \"--#{ifname}, #{ifvalue}\"\n info = {\n :sn => ipstring + \"-\" + timestamp + \"-\" + ifname,\n :target => @option[:org_env] + \".\" + @option[:basetarget] +\n \".#{ipstring}.traffic.#{vlannm}.#{item[0]}\",\n :instance => ifname,\n :status => ifvalue[item[0]],\n :details => \"top#{index}\",\n :timestamp => Time.now().to_i() * 1000,\n :duration => 0,\n :attachments => []\n }\n #puts info\n metrics = Metrics.new(@option[:pin_code], info)\n #puts metrics\n metrics_list << metrics\n end\n end\n end\n\n merged = Metrics.merge(metrics_list)\n end",
"def overlay_ip\n self.overlay_cidr.split('/')[0] if self.overlay_cidr\n end",
"def getIpToHostname()\n @ipToHostname = Hash.new\n \n @interfaces.each { |interface|\n @allWeights.collection.each { |weight|\n if (interface == weight.dstIp || @hostname == weight.srcHostname)\n @ipToHostname[weight.srcIp] = weight.srcHostname\n end\n }\n }\n end",
"def bypass_site_allowed_ips\n @attributes[:bypass_site_allowed_ips]\n end",
"def address_count\n\t\tIP.parse(self.end_ip).to_i - IP.parse(self.start_ip).to_i + 1\n\tend",
"def hop_on_hop_off\n if params[:route_id].present? && params[:type] == \"From\"\n @current_route = MainRoute.find_by_id(params[:route_id]) \n #@cities=(MainRoute.joins(:line_color_routes).joins('LEFT OUTER JOIN \"city_routes\" ON \"city_routes\".\"line_color_route_id\" = \"line_color_routes\".\"id\" LEFT OUTER JOIN \"cities\" ON \"cities\".\"id\" = \"city_routes\".\"city_id\"').select(\"main_routes.id\",\"main_routes.name\",\"cities.name as city_name\",\"cities.id as city_id\").where(:main_routes => {id: @current_route.id}).distinct.pluck(\"cities.id,cities.name\") + City.where(name: MainRoute.find_by_id(@current_route.id).start_point.downcase!).pluck(:id,:name)).sort{|a,b| a[1] <=> b[1]}\n city = []\n @current_route.line_color_routes.each do |a|\n a.city_routes.pluck(:city_id).each do |b|\n city << b\n end\n end\n @cities = City.where(id: city.uniq).pluck(:id,:name)\n\n \n\n #@cities = []\n @cities.each do |city| \n city[1] = city[1].titleize if city.present?\n\n end\n\n\n\n\n end \n if params[:route_id].present? && params[:type] == \"To\"\n #@city= City.find_by_id(params[:city_id])\n # @cities = City.where(name: Bus.where(start_point: @city.name).pluck(:end_point)).pluck(:id,:name) \n #@cities = (City.where(name: Bus.where(start_point: @city.name).pluck(:end_point)).pluck(:id,:name)).sort{|a,b| a[1] <=> b[1]}\n \n\n #my code starts here...\n\n @current_route = MainRoute.find_by_id(params[:route_id]) \n cit = []\n @current_route.line_color_routes.each do |a|\n a.city_routes.pluck(:city_id).each do |b|\n cit << b\n end\n end\n arr = cit.uniq\n arr.delete(params[:city_id].to_i)\n # p \"------#{arr}--#{params[:city_id].to_i}-------\"\n @cities = City.where(id: arr).pluck(:id,:name)\n @cities.each do |city| \n city[1] = city[1].titleize if city.present?\n\n end\n end \n respond_to do |format|\n format.html \n format.json { render :json => {:cities=>@cities } }\n end\n end",
"def addresses network=nil\n if network\n data = on_network network\n ips = data.map { |v| (v.has_key? :ip) ? v[:ip] : nil }\n else\n vips.each_key.map { |k| vips[k][:ip] }\n end\n end",
"def sort_snps\n @snps.sort!{|x,y| x.location <=> y.location}\n end",
"def index\n where = {}\n @url_params = {}\n @sort_by = nil\n @sort_dir = nil\n order_clause = nil\n if session[:tablen].nil?\n\tsession[:tablen] = 20\n end\n\n if not params[:sort_by].nil?\n\n if params[:sort_by] == \"ip_address\"\n @sort_by = \"ip_address\"\n end\n\n if params[:sort_by] == \"test_area_name\"\n @sort_by = \"test_area_name\"\n end\n\n if params[:sort_by] == \"icmp_name\"\n @sort_by = \"icmp_name\"\n end\n\n if not @sort_by.nil?\n if params[:sort_dir] == \"desc\"\n @sort_dir = \"desc\"\n else\n @sort_dir = \"asc\"\n end\n\n order_clause = \"#{@sort_by} #{@sort_dir}\"\n end\n end\n\n if not params[:host_id_v].nil?\n @host_menu = 1\n @host = Host.find_by_host_id(params[:host_id_v])\n @page_title=\"ICMP Info #{@host.ip_address} in area #{@host.test_area_name}\"\n where[:host_id] = params[:host_id_v]\n @url_params[:host_id_v] = params[:host_id_v]\n end\n\n if not params[:type_v].nil?\n where[:icmp_name] = params[:type_v]\n @url_params[:type_v] = params[:type_v]\n end\n\n\n # @icmps = Icmp.find(:all, :order => \"icmp\")\n if session[:test_area].nil?\n @record_count = Icmp.find(:all, :conditions => where).length\n @pager = Paginator.new(@record_count, session[:tablen]) do |offset, per_page|\n Icmp.find(:all, :order => order_clause, :limit => per_page, :offset => offset, :conditions => where)\n end\n else\n @record_count = Icmp.find_all_by_test_area_id(session[:test_area], :conditions => where).length\n @pager = Paginator.new(@record_count, session[:tablen]) do |offset, per_page|\n Icmp.find_all_by_test_area_id(session[:test_area], :order => order_clause, :limit => per_page, :offset => offset, :conditions => where)\n end\n end\n @icmps = @pager.page(params[:page])\n # TODO: order by hosts.ip_address, icmp\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @icmps }\n end\n end",
"def peer_ip; end",
"def fixed_ports(switch)\n out = %x(snmpwalk -v2c -c public #{switch} IF-MIB::ifType)\n lines = out.split(\"\\n\")\n # Some example lines of data:\n # IF-MIB::ifType.24 = INTEGER: ethernetCsmacd(6)\n # IF-MIB::ifType.53 = INTEGER: other(1)\n # IF-MIB::ifType.54 = INTEGER: ieee8023adLag(161)\n lines.select do |line|\n line.match(\"ethernetCsmacd\")\n end.map do |line|\n line.match(/[0-9]+/)\n end\nend",
"def minimumSwaps(arr)\n swaps = 0\n alen = arr.length\n index_lookup = {}\n 0.upto(alen-1) do |i|\n index_lookup[arr[i]] = i\n end\n 0.upto(alen-1) do |i|\n if arr[i] == i+1\n # puts \"nothing to do\"\n next\n end\n k = index_lookup[i+1]\n index_lookup[arr[i]] = k\n p [i, k]\n arr[i],arr[k] = arr[k],arr[i]\n swaps +=1\n end\n return swaps\nend",
"def get_rackspace_values\n cloud[:public_ip][0] = rackspace['public_ip']\n cloud[:private_ip][0] = rackspace['private_ip']\n cloud[:provider] = \"rackspace\"\nend",
"def arp_dest_ip; self[:arp_dest_ip].to_s; end",
"def location\n \t#@ip = request.remote_id\n \t@ip = '118.113.226.34'\n \t@location = Rails.cache.read(@ip)\n end",
"def arp_saddr_ip\n\t\tself[:arp_src_ip].to_x\n\tend",
"def get_all(ip)\n\t\tself.v4 = ip.length == 4 && self.ip_version == 4\n\t\tipnum = ip.unpack(\"N\")[0] + 0\n\t\tmid = self.count/2\n\t\tcol_length = columns * 4\n\t\tlow = 0\n\t\thigh = count\n\t\treturn self.record = bsearch(low, high, ipnum, self.base_addr, col_length)\n\tend",
"def check4targetswecontrol(srcdst2outage, registered_hosts)\n dstsrc2outage = {}\n\n srcdst2outage.each do |srcdst, outage|\n src, dst = srcdst\n if FailureIsolation.SpooferTargets.include? dst\n # Need to convert dst IP -> hostname, and source hostname -> IP\n dst_hostname = @db.ip2hostname[dst]\n @logger.info { \"check4targetswecontrol: dst ip is: #{dst}, dst_hostname is: #{dst_hostname}. ip mismap?\" } if dst_hostname.nil?\n\n if registered_hosts.include? dst_hostname\n outage.symmetric = true\n # TODO: Possible problem with ip2hostname mappings? This\n # might be the cause of the missing ground truth data\n outage.src_ip = @db.hostname2ip[src]\n outage.dst_hostname = dst_hostname\n dstsrc2outage[[outage.dst_hostname, outage.src_ip]] = outage\n end\n end\n end\n\n dstsrc2outage\n end",
"def wip\n end",
"def configured_management_ip_information\n if management_ip_static_configured?\n match_data = running_config.match(%r{interface ManagementEthernet \\d+/\\d+.*?\\s+ip address\\s+(\\d+.\\d+.\\d+.\\d+)\\/(\\d+)})\n [match_data[1], match_data[2]]\n end\n end",
"def index\n @swaps = @round.swaps\n end",
"def get_arpa(c,ip)\narpa = ip\n\tif c >= 8 && c < 16\n\t\tarpa = ip.split(\".\")\n\t\tarpa = arpa.last(3).reverse\n\t\tarpa = arpa.join(\".\").to_s\n\telsif c >= 16 && c < 24\n\t\tarpa = ip.split(\".\").last(2).reverse\n\t\tarpa= arpa.join(\".\").to_s\n\telse c >= 24\n\t\tarpa = arpa.split(\".\").last\n\t\treturn arpa\n\t\t\n\tend\n\t\t \nend",
"def wanted_ips\n ips = [new_resource.address, nic.IPAddress].flatten.compact\n\n # Return only IPv4 IPs\n ips.select { |ip| ip =~ /\\./ }\n end",
"def ip\n @data[\"ip\"]\n end",
"def canonocalize_hops!()\n # Sort\n @hops = @hops.sort_by { |hop| hop.ttl }\n\n # Fill in gaps\n return if @hops.empty?\n return if @hops[-1].ttl > 45 # packet corruption perhaps...\n @hops.each_with_index do |hop, i|\n return if i+1 == @hops.size\n # look ahead to the next hop\n next_hop = @hops[i+1]\n if next_hop.ttl != hop.ttl + 1\n filler_hop = Hop.new\n filler_hop.ip = \"0.0.0.0\"\n filler_hop.ttl = hop.ttl + 1\n # on next iteration, this will be the current hop\n @hops.insert(i+1, filler_hop)\n end\n end\n end"
] | [
"0.6140601",
"0.5965152",
"0.55639493",
"0.5558459",
"0.545419",
"0.5447818",
"0.544545",
"0.54413706",
"0.54301363",
"0.5379883",
"0.5376038",
"0.53602946",
"0.5344832",
"0.533376",
"0.53124964",
"0.53105015",
"0.52475834",
"0.52310044",
"0.5225074",
"0.52078164",
"0.51962125",
"0.5171612",
"0.51263654",
"0.51163703",
"0.51038677",
"0.50953496",
"0.5091978",
"0.5084769",
"0.5078542",
"0.50695837",
"0.50599706",
"0.50599706",
"0.50577736",
"0.50529426",
"0.50394005",
"0.5029205",
"0.5012863",
"0.5011621",
"0.5010847",
"0.5003687",
"0.49871105",
"0.4985739",
"0.4984499",
"0.497956",
"0.4965291",
"0.4961463",
"0.49608392",
"0.4959674",
"0.49544376",
"0.49470705",
"0.49412394",
"0.4938107",
"0.4936568",
"0.49360567",
"0.49308383",
"0.49290127",
"0.49091905",
"0.49084517",
"0.4900191",
"0.4898131",
"0.48880315",
"0.48817402",
"0.48768762",
"0.4875984",
"0.48745438",
"0.48745438",
"0.48701215",
"0.4865321",
"0.4864428",
"0.48618126",
"0.48586777",
"0.48575982",
"0.4850762",
"0.48505384",
"0.48451847",
"0.48446345",
"0.4838528",
"0.4836619",
"0.48355523",
"0.48335057",
"0.48290646",
"0.4827436",
"0.48260313",
"0.48184872",
"0.4817278",
"0.48149863",
"0.48148528",
"0.48132995",
"0.481314",
"0.48079002",
"0.48009455",
"0.47964504",
"0.47928253",
"0.47838694",
"0.4772055",
"0.47703034",
"0.47634363",
"0.47582948",
"0.47512597",
"0.4748232"
] | 0.66772705 | 0 |
def select_category_from_projects "SELECT category FROM projects;" end Make sure each ruby method returns a string containing a valid SQL statement. | def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name
"SELECT title, SUM(amount)
FROM projects
INNER JOIN pledges
ON projects.id = pledges.project_id
GROUP BY projects.title
ORDER BY projects.title;"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_category_from_projects\n\"SELECT category FROM projects;\"\nend",
"def selects_the_category_names_and_pledge_amounts_of_all_pledges_in_the_music_category\n\"SELECT projects.category, pledges.amount\nFROM pledges\nINNER JOIN projects\nON projects.id = pledges.project_id\nWHERE projects.category = 'music';\n\"\nend",
"def current_categories(db)\r\n\tretrieve_categories = '\r\n\tSELECT name FROM categories'\r\n\tcategories = db.execute(retrieve_categories)\r\nend",
"def selects_the_category_name_and_the_sum_total_of_the_all_its_pledges_for_the_books_category\n\"SELECT projects.category, SUM(pledges.amount)\nFROM pledges\nINNER JOIN projects\nON pledges.project_id = projects.id \nWHERE projects.category = 'books';\"\nend",
"def selects_the_category_name_and_the_sum_total_of_the_all_its_pledges_for_the_books_category\n\"SELECT Projects.category, SUM(Pledges.amount) FROM Projects JOIN Pledges ON Pledges.project_id = Projects.id WHERE Projects.category = 'books';\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"Write your SQL query Here\"\nend",
"def categories()\n db = connect()\n db.execute('SELECT * FROM categories')\n end",
"def category()\n sql = \"SELECT * FROM categories WHERE id = $1 ORDER BY name;\"\n values = [@category_id]\n sql_result = SqlRunner.run(sql, values)\n return Category.new(sql_result[0])\n end",
"def get_category_name(category_id)\n db = SQLite3::Database.new \"#{$script_dir}/cfps.db\"\n category = db.get_first_value(\"select name from category where id = ?\", [category_id])\n\n return categor\nend",
"def projects\n where(:_type => ProjectCategory.name)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"Write your SQL query Here\"\n \"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title ORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n \"SELECT projects.title, SUM(amount) FROM projects\n INNER JOIN pledges ON project_id = projects.id\n GROUP BY title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title, SUM(amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id\nGROUP BY title\nORDER BY title\"\n\n# FROM owners\n# INNER JOIN cats_owners\n# ON owners.id = cats_owners.owner_id\n# JOIN cats ON cats_owners.cat_id = cats.id\n# WHERE cats_owners.owner_id = 2;\n\nend",
"def current_categorized_expenses(db, user_name)\r\n\tretrieve_categorized_expenses = '\r\n\tSELECT categories.name, amount FROM expenses\r\n\tJOIN users ON expenses.user_id = users.id\r\n\tJOIN categories ON expenses.category_id = categories.id\r\n\tWHERE users.name = ?'\r\n\tcategorized_expenses = db.execute(retrieve_categorized_expenses, [user_name])\r\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n\"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id GROUP BY(projects.title) ;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n sql = <<-SQL\n SELECT projects.title, SUM(pledges.amount) FROM projects JOIN pledges ON pledges.project_id = projects.id GROUP BY projects.title;\n SQL\n\nend",
"def getCategories(_, _, _)\n @db.categories\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n <<-SQL\n SELECT projects.title , sum(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY pledges.project_id\n ORDER BY projects.title\n SQL\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"Write your SQL query Here\"\n \n\"SELECT projects.title, SUM(amount) \nFROM pledges \nINNER JOIN projects \nON pledges.project_id = projects.id GROUP BY projects.title;\"\nend",
"def category(id)\n db = connect()\n return db.execute('SELECT Id,Title FROM discussions WHERE CatId=?', id), db.execute('SELECT * FROM categories WHERE Id=?', id)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n \"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON pledges.project_id = projects.id GROUP BY projects.title ORDER BY title\"\nend",
"def list_projects # :nologin:\n query = create_query(:Project, :all, :by => :title)\n show_selected_projects(query)\n end",
"def get_category_id(category)\n db = SQLite3::Database.new \"#{$script_dir}/cfps.db\"\n category_id = db.get_first_value(\"select id from category where name = ?\", [category])\n\n return category_id\nend",
"def select(db); end",
"def select(db); end",
"def get_records_for_category categ\n if categ.nil? or categ == \"\"\n #return @records\n get_data \"select * from todo\"\n else\n #return @records.select { |row| row[0] == categ }\n get_data \"select * from todo where categ = '#{categ}' \"\n end\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n <<-SQL \n SELECT projects.title, SUM(pledges.amount)\n FROM projects \n INNER JOIN pledges on projects.id = pledges.project_id \n GROUP BY projects.title\n ORDER BY projects.title\n SQL\nend",
"def project_statement\n project_clauses = []\n active_subprojects_ids = []\n\n active_subprojects_ids = project.descendants.active.map(&:id) if project\n if active_subprojects_ids.any?\n if has_filter?(\"subproject_id\")\n case operator_for(\"subproject_id\")\n when '='\n # include the selected subprojects\n ################\n # Smile specific : [project.id] + removed\n ids = values_for(\"subproject_id\").map(&:to_i)\n project_clauses << \"#{Project.table_name}.id IN (%s)\" % ids.join(',')\n when '!'\n # exclude the selected subprojects\n\n ################\n # Smile specific : [project.id] + removed\n ids = active_subprojects_ids - values_for(\"subproject_id\").map(&:to_i)\n project_clauses << \"#{Project.table_name}.id IN (%s)\" % ids.join(',')\n when '!*'\n # main project only\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n else\n # all subprojects\n project_clauses << \"#{Project.table_name}.lft >= #{project.lft} AND #{Project.table_name}.rgt <= #{project.rgt}\"\n end\n elsif Setting.display_subprojects_issues?\n project_clauses << \"#{Project.table_name}.lft >= #{project.lft} AND #{Project.table_name}.rgt <= #{project.rgt}\"\n else\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n end\n elsif project\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n end\n project_clauses.any? ? project_clauses.join(' AND ') : nil\n end",
"def select(sql, name = nil)\n raise NotImplementedError, \"select is an abstract method\"\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\n SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\nSQL\nend",
"def index\n\n # @sql = \"Projects.name ILIKE '#{'%'+params[:name]+'%'}' \" if params[:name].present?\n @sql = params[:name].present? ? \"Projects.name ILIKE '#{'%'+params[:name]+'%'}' \" : \"Projects.name ILIKE '%' \"\n @sql += \"OR Projects.description ILIKE '#{'%'+params[:name]+'%'}' \" if params[:name].present?\n\n @sql += \"and Projects.category ILIKE '#{'%'+params[:categorysdigital]+'%'}' \" if params[:categorysdigital].present?\n if params[:categorysdigital].present?\n @sql += \"or Projects.category ILIKE '#{'%'+params[:categorysmarketing]+'%'}' \" if params[:categorysmarketing].present?\n else\n @sql += \"And Projects.category ILIKE '#{'%'+params[:categorysmarketing]+'%'}' \" if params[:categorysmarketing].present?\n end\n\n if params[:categorysdigital].present? || params[:categorysmarketing].present?\n @sql += \"or Projects.category ILIKE '#{'%'+params[:categorysdesign]+'%'}' \" if params[:categorysdesign].present?\n else\n @sql += \"And Projects.category ILIKE '#{'%'+params[:categorysdesign]+'%'}' \" if params[:categorysdesign].present?\n end\n\n @sql += \"and Projects.progress = #{params[:progresspropose].to_i} \" if params[:progresspropose].present?\n if params[:progresspropose].present?\n @sql += \"or Projects.progress = #{params[:progressselected].to_i} \" if params[:progressselected].present?\n else\n @sql += \"and Projects.progress = #{params[:progressselected].to_i} \" if params[:progressselected].present?\n end\n\n if params[:progressselected].present?\n @sql += \"or Projects.progress = #{params[:progressclose].to_i} \" if params[:progressclose].present?\n else\n @sql += \"and Projects.progress = #{params[:progressclose].to_i} \" if params[:progressclose].present?\n end\n\n # @sql += \"ORDER progress\"\n @projects = Project.where(@sql).order(:progress)\n @count = @projects.count\n @count_tt = Project.count\n end",
"def projects_countries(site, category_id = nil)\n if category_id.present? && category_id.to_i > 0\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id\n inner join projects as p on p.id=pr.project_id\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n #{category_join}\n where p.primary_organization_id=#{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end",
"def projects_countries(site, category_id = nil)\n if category_id.present?\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id\n inner join projects as p on p.id=pr.project_id and (p.end_date is null OR p.end_date > now())\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n #{category_join}\n where p.primary_organization_id=#{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM pledges\nINNER JOIN projects \nON pledges.project_id = projects.id\nGROUP BY project_id\nORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n# Select projects title column and the sum of the pledges amount column\n# from the projects database,\n# join the pledges (Join table)\n# with projects.id and the pledges project id. Match these numbers\n# Group the tables together by Projects title and then\n# sort by projects.title\n\"SELECT Projects.title, SUM(Pledges.amount)\n FROM Projects\n JOIN Pledges\n ON Projects.id = Pledges.project_id\n GROUP BY Projects.title\n ORDER BY Projects.title;\n\"\nend",
"def get_project_name(id)\n con = PG::Connection.connect(\"localhost\",5432,nil,nil,\"aaa\",\"admin\")\n sql = \"SELECT name \"\n sql += \"FROM projects \"\n sql += \"WHERE id='#{id}' \"\n res = con.exec(sql)\n con.close\n name = \"NA\"\n name = res[0]['name'] if res.num_tuples > 0\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\n SELECT DISTINCT title ,SUM(amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title\n SQL\nend",
"def sql\n <<-SQL\n -- Search learning paths\n SELECT DISTINCT\n c.id,\n c.name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_path' AS content_type,\n c.id AS learning_path_id,\n 0 AS learning_objective_id\n FROM courses c\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = c.id AND ts.taggable_type = 'LearningPath'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = c.id AND cc.contentable_type = 'LearningPath'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_course_worklow_clause}\n #{construct_name_sql}\n #{construct_all_tags_search('t', 'name')}\n UNION ALL\n -- Search learning objectives\n SELECT DISTINCT\n cm.id,\n cm.name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_objective' AS content_type,\n cm.context_id::bigint AS learning_path_id,\n cm.id::bigint AS learning_objective_id\n FROM context_modules cm\n INNER JOIN courses c\n ON c.id = cm.context_id\n AND cm.context_type = 'Course'\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = cm.id AND ts.taggable_type = 'LearningObjective'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = cm.id AND cc.contentable_type = 'LearningObjective'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_generic_workflow_clause('cm')}\n #{construct_name_sql('cm')}\n #{construct_all_tags_search('t', 'name')}\n UNION ALL\n -- Search learning learning_event\n SELECT DISTINCT\n ct.id,\n ct.title AS name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_event' AS content_type,\n ct.context_id::bigint AS learning_path_id,\n ct.context_module_id::bigint AS learning_objective_id\n FROM content_tags ct\n INNER JOIN courses c\n ON c.id = ct.context_id\n AND ct.context_type = 'Course'\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = ct.id AND ts.taggable_type = 'LearningEvent'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = ct.id AND cc.contentable_type = 'LearningEvent'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_generic_workflow_clause('ct')}\n #{construct_name_sql('ct', 'title')}\n #{construct_all_tags_search('t', 'name')}\n SQL\n end",
"def get_category_name\n Category.find(:first, :select => ['name'],:conditions=>['has_complexity=?',false]).name rescue ''\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"\nSELECT \nProjects.title,\nSUM(Pledges.amount)\nFROM Pledges\nINNER JOIN Projects\nON Pledges.project_id = Projects.id\nGROUP BY Projects.title\nORDER BY Projects.title\n\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT Projects.title, SUM(pledges.amount) \nFROM projects \nJOIN pledges \nON Projects.id = pledges.project_id \nGROUP BY title\"; \nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nINNER JOIN pledges \nON projects.id=pledges.project_id\nGROUP BY projects.id\nORDER BY projects.title;\"\nend",
"def makeQueryTableAll(tableName)\n #sql = \"SELECT * FROM [\" << tableName << \"]\"\n sql = \"SELECT * FROM [\" << tableName << \"]\" << \" WHERE id < 3\"\n #puts(sql) #debug\n return sql\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"SELECT projects.title, sum_pledges FROM (SELECT pledges.project_id, SUM(pledges.amount) AS sum_pledges FROM pledges GROUP BY pledges.project_id) INNER JOIN projects ON projects.id = project_id ORDER BY projects.title\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\nSELECT projects.title, SUM(pledges.amount) \nFROM projects \nINNER JOIN pledges on projects.id = pledges.project_id\nGROUP BY (pledges.project_id)\nORDER BY projects.title;\nSQL\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\r\n\"SELECT title, SUM(pledges.amount) FROM projects\r\nJOIN pledges ON projects.id = pledges.project_id\r\nGROUP BY projects.id\r\nORDER BY title ASC\"\r\nend",
"def category_totals(db, user_name, number)\r\n\tretrieve_totals = '\r\n\tSELECT categories.name, SUM(amount) FROM expenses\r\n\tJOIN users ON expenses.user_id = users.id\r\n\tJOIN categories ON expenses.category_id = categories.id\r\n\tWHERE categories.id = ?\r\n\tAND users.name = ?'\r\n\ttotals = db.execute(retrieve_totals, [number, user_name])[0]\r\nend",
"def add_category(db, category)\r\n\tnew_category = '\r\n\tINSERT INTO categories (name)\r\n\tVALUES (?)'\r\n\tdb.execute(new_category, [category])\r\nend",
"def select_category\n #Parbauda vai ekrans ir redzams\n @screens.screen_create_filter.visible?\n #Pievieno kategoriju no filtra datiem\n @screens.screen_create_filter.select_row(@filter_data.category)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Select title, amount from projects, pledges where projects.id = pledges.id order by title ASC;\"\nend",
"def projects_countries(site, category_id = nil, organization_id = nil, location_id = nil)\n if category_id.present? && category_id.to_i > 0\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n if organization_id.present? && organization_id.to_i > 0\n organization_filter = \"and p.primary_organization_id = #{organization_id}\"\n end\n\n if location_id.present?\n location_filter = \"and c.id IN (#{location_id})\"\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id #{location_filter}\n inner join projects as p on p.id=pr.project_id and (p.end_date is null OR p.end_date > now()) #{organization_filter}\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n inner join donations as dn on dn.project_id = p.id\n #{category_join}\n where dn.donor_id = #{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount) FROM pledges INNER JOIN projects ON projects.id=pledges.project_id GROUP BY projects.title;\"\n## FROM - where are they talking to each other - where is the scotch tape\nend",
"def select(componentName, text, componentInfo=nil)\n $marathon.select(ComponentId.new(componentName, componentInfo), text.to_s)\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title,\n SUM(pledges.amount)\n FROM pledges\n INNER JOIN projects\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\n\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, \nSUM(pledges.amount) \nFROM projects\nJOIN pledges ON pledges.project_id = projects.id\nGROUP BY projects.title\nORDER BY projects.title ASC;\"\nend",
"def select_all(sql, name = nil) end",
"def select\n @pds_projects = PdsProject.includes(:company).where('ProjectID in (?)', PROJECT_LIST)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, sum(amount) AS pledge_amount\nFROM pledges\nJOIN projects\nWHERE pledges.project_id = projects.id\nGROUP BY project_id\nORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n <<-SQL\n SELECT\n title, sum(amount)\n FROM\n projects\n JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY\n title\n ORDER BY\n title\n SQL\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount )\nFROM projects \nJOIN pledges\nON projects.id = pledges.project_id \nGROUP BY projects.title \nORDER BY projects.title \";\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"SELECT projects.title,(SELECT SUM(pledges.amount))\n FROM projects\n INNER JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, sum(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY pledges.project_id\n ORDER BY projects.title ASC;\n \"\nend",
"def db_fetch\n \"SELECT *\" + from_table_where + sql_match_conditions\n end",
"def get_category(cate, limitl, limitr)\n return Product.find_by_sql(\"select * from products where tag like '%#{cate}%' order by id limit #{limitl}, #{limitr}\")\n end",
"def select_project\n @projects = Project.find(:all)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount) FROM pledges INNER JOIN projects ON projects.id = pledges.project_id GROUP BY projects.title ORDER BY projects.title \"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend",
"def sql_statement_find\n @sql_statement_find ||=\n <<-SQL\n SELECT\n applications.id AS id,\n teams.name AS team_name,\n projects.name AS project_name,\n (application_data -> :project_id)::int AS project_id,\n application_data -> :project_plan AS project_plan,\n application_data -> :why_selected_project AS why_selected_project,\n application_data -> :signed_off_at AS signed_off_at,\n (application_data -> :signed_off_by)::int AS signed_off_by,\n application_data -> :mentor_fav AS mentor_fav,\n CASE WHEN :project_id::text = 'project1_id' THEN 1 ELSE 2 END AS choice,\n hstore_to_json_loose(slice(application_data, ARRAY[:student0_attrs])) AS student0,\n hstore_to_json_loose(slice(application_data, ARRAY[:student1_attrs])) AS student1\n FROM applications\n INNER JOIN teams\n ON teams.id = applications.team_id\n INNER JOIN projects\n ON projects.id::text = applications.application_data -> :project_id\n WHERE (application_data -> :project_id)::int IN (:project_ids)\n AND applications.season_id = :season_id\n AND applications.id = :id;\n SQL\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT Projects.title, SUM(Pledges.amount)\n FROM projects\n JOIN pledges\n ON Projects.id = Pledges.project_id\n GROUP BY project_id\n ORDER BY Projects.title\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\n FROM pledges\n INNER JOIN projects\n ON pledges.project_id = projects.id\n GROUP BY projects.title\n ORDER BY projects.title\n\"\nend",
"def select(componentName, text, componentInfo=nil)\n $marathon.select(ComponentId.new(componentName, componentInfo), text.to_s)\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nJOIN pledges\nON projects.id = pledges.project_id\nGROUP BY projects.title;\"\nend",
"def sql\n @sql ||= begin\n bind_params = []\n 1.upto(selector_keys.length + setter_keys.length) { |i| bind_params << \"$#{i}\" }\n %{SELECT #{name}(#{bind_params.join(', ')})}\n end\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM (pledges.amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id\nGROUP BY title\nORDER BY title ASC;\"\nend",
"def getCat \n\t\tputs ''\n\t\tputs 'Fetching categories . . '\n\t\[email protected]('ul.dropdown li a').each do |cat|\n\t\t\tarr=[]\n\t\t\tarr.push cat.text\n\t\t\tarr.push cat['href']\n\t\t\t@arr_cat.push arr\n\t\t\tprint '. '\n\t\tend\n\t\ti=0\n\t\t@arr_cat.each do |pair|\n\t\t\[email protected] 'insert into category values (?, ? ,?)', i, pair[0], pair[1]\n \t\t\ti +=1\n \t\tend\n\tend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT Projects.title, SUM(Pledges.amount) FROM Projects JOIN Pledges ON Pledges.project_id = Projects.id GROUP BY Projects.title;\"\nend",
"def add_project_name_to_jql jql_string\n unless jql_string.empty?\n jql_string.insert(0, \"project=#{@project} AND \")\n else\n \"project=#{@project}\"\n end\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title, SUM(amount) FROM pledges INNER JOIN projects ON projects.id = pledges.project_id GROUP BY projects.id ORDER BY title;\"\nend",
"def search(category, query_term)\nresult = @conn.exec(\"SELECT * FROM students WHERE #{category} = '#{query_term}';\");\n puts student\n result.each do |student|\n puts \"#{k}: #{v}\"\n end\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY(projects.title);\"\nend",
"def show_categories(html_dsl)\r\n categories = Category.where(\"user_id = #{session[:user_id]} and category_id is null\").order('name ASC')\r\n category_html = create_category_table(categories)\r\n html_dsl.inject(category_html)\r\n end",
"def show_categories(html_dsl)\r\n categories = Category.where(\"user_id = #{session[:user_id]} and category_id is null\").order('name ASC')\r\n category_html = create_category_table(categories)\r\n html_dsl.inject(category_html)\r\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, sum(pledges.amount) FROM projects INNER JOIN pledges on pledges.project_id=projects.id group by pledges.project_id ORDER BY projects.title ASC\"\nend",
"def selects_all_female_bears_return_name_and_age\n <<-SQL \n SELECT \n bears.name, \n bears.age \n FROM bears \n WHERE sex='F';\n SQL\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, SUM(pledges.amount) FROM projects\n JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON pledges.project_id=projects.id GROUP BY projects.title ORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id GROUP BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n # SELECT titles, amounts FROM projects, pledges ORDER BY titles ASC\n #SELECT titles.projects, pledges.amounts ORDER BY titles ASC\n \"SELECT projects.title, SUM(pledges.amount) FROM projects\n JOIN pledges \n ON pledges.project_id = projects.id \n GROUP BY(pledges.project_id)\n ORDER BY projects.title ASC\n \";\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges ON pledges.project_id = projects.id\n GROUP BY title\n ORDER BY title ASC;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id GROUP BY projects.title ORDER BY projects.title ASC;\"\nend",
"def sql_statement_all\n @sql_statement_all ||=\n <<-SQL\n SELECT\n applications.id AS id,\n teams.name AS team_name,\n projects.name AS project_name,\n (application_data -> :project_id)::int AS project_id,\n application_data -> :signed_off_at AS signed_off_at,\n (application_data -> :signed_off_by)::int AS signed_off_by,\n application_data -> :mentor_fav AS mentor_fav,\n CASE WHEN :project_id::text = 'project1_id' THEN 1 ELSE 2 END AS choice\n FROM applications\n INNER JOIN teams\n ON teams.id = applications.team_id\n INNER JOIN projects\n ON projects.id::text = applications.application_data -> :project_id\n WHERE (application_data -> :project_id)::int IN (:project_ids)\n AND applications.season_id = :season_id;\n SQL\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"select\nprojects.title,\nsum(pledges.amount) as sum_all_pledges\nfrom projects\ninner join pledges\non projects.id = pledges.project_id\ngroup by projects.title\norder by projects.title;\n\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, SUM(pledges.amount) \n FROM projects\n JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY projects.title;\"\nend",
"def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nLEFT JOIN pledges\nON projects.id=pledges.project_id\nGROUP BY projects.title\nORDER BY projects.title;\"\nend",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n #SELECT title, SUM(quantity) FROM groceries GROUP BY aisle ORDER BY SUM(quantity);\n\n \"SELECT projects.title, sum( pledges.amount)\nFROM projects\nJOIN pledges\nwhere projects.id=pledges.project_id\ngroup by projects.title order by projects.title\n;\"\n\nend",
"def frey_example\n # Find all the cats that are the same color as the cat named 'Freyja'.\n # Including 'Freyja' in the results.\n # DO NOT USE A SUBQUERY\n\n execute(<<-SQL)\n SELECT\n color_cats.name\n FROM\n cats AS freyja_cats\n JOIN\n cats AS color_cats ON freyja_cats.color = color_cats.color\n WHERE\n freyja_cats.name = 'Freyja';\n SQL\nend",
"def select &blck\n @projects.select(&blck)\n end",
"def select &blck\n @projects.select(&blck)\n end",
"def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT p.title, SUM(pl.amount) FROM pledges pl INNER JOIN projects p ON pl.project_id = p.id GROUP BY pl.project_id ORDER BY p.title\"\nend"
] | [
"0.9198338",
"0.70682496",
"0.69904196",
"0.6651116",
"0.66223687",
"0.65146846",
"0.6485764",
"0.63234603",
"0.6060352",
"0.5941194",
"0.59390724",
"0.59370667",
"0.590154",
"0.58815116",
"0.58714",
"0.58550173",
"0.5852973",
"0.58412963",
"0.581997",
"0.5783239",
"0.5782976",
"0.57011104",
"0.56960315",
"0.569237",
"0.569237",
"0.5689417",
"0.56838167",
"0.56806046",
"0.56353253",
"0.5629387",
"0.56200033",
"0.5618696",
"0.56149894",
"0.559033",
"0.55831563",
"0.557559",
"0.5574347",
"0.55719095",
"0.55680233",
"0.5545095",
"0.5541744",
"0.5528615",
"0.5487226",
"0.5481274",
"0.5480359",
"0.5476821",
"0.54766655",
"0.5463803",
"0.546089",
"0.5460355",
"0.545047",
"0.5448632",
"0.54346156",
"0.5431548",
"0.543099",
"0.5428841",
"0.54256636",
"0.5424348",
"0.54234964",
"0.5416798",
"0.5408596",
"0.5393962",
"0.53864336",
"0.53840905",
"0.53838676",
"0.53827757",
"0.53818816",
"0.5362231",
"0.5352718",
"0.5352468",
"0.5349987",
"0.5348932",
"0.53478634",
"0.5341626",
"0.5340264",
"0.5333667",
"0.53322285",
"0.5322873",
"0.5320641",
"0.5320308",
"0.5310639",
"0.5310639",
"0.53078747",
"0.5300074",
"0.5297389",
"0.52918303",
"0.5287697",
"0.5285565",
"0.52852917",
"0.52844286",
"0.52835405",
"0.52773756",
"0.5274405",
"0.52723247",
"0.5269553",
"0.5265295",
"0.52593756",
"0.5259368",
"0.5259368",
"0.52560556"
] | 0.5374029 | 67 |
Setup all fixtures in test/fixtures/.yml for all tests in alphabetical order. fixtures :all Helper to create users in the database to being used in the tests to check privilege levels. | def create_users
@user_admin = User.create(:email => "[email protected]", :name => "Admin user", :password => "testtest", :password_confirmation => "testtest", :level => User::LEVEL_ADMINISTRATOR)
@user_normal = User.create(:email => "[email protected]", :name => "Normal user", :password => "testtest", :password_confirmation => "testtest", :level => User::LEVEL_NORMAL)
@user_guest = User.create(:email => "[email protected]", :name => "Guest user", :password => "testtest", :password_confirmation => "testtest", :level => User::LEVEL_GUEST)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_all_fixtures\n \n end",
"def setup_default_fixtures(files = ['sample_actors' , 'users', 'wiki_entries'])\n Fixtures.reset_cache\n files.each do |f|\n Fixtures.create_fixtures( File.dirname(__FILE__) + '/../fixtures' , File.basename( f , '.*'))\n end\nend",
"def load_fixtures\n # fixtures = ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(File.dirname(__FILE__), 'test', 'fixtures', '*.{yml,csv}')) \n fixtures = [ 'active_sources', 'semantic_relations', 'semantic_properties' 'data_records']\n fixtures.reverse.each { |f| ActiveRecord::Base.connection.execute \"DELETE FROM #{f}\" }\n fixtures.each do |fixture_file|\n Fixtures.create_fixtures(File.join('test', 'fixtures'), File.basename(fixture_file, '.*')) \n end \n end",
"def setup\n # Retrieve fixtures via their name\n # @first = accounts(:first)\n end",
"def load_fixtures\n load(*fixture_table_names)\n end",
"def setup\r\n\t\t@controller = Admin::UserController.new\r\n\t\t@request = ActionController::TestRequest.new\r\n\t\t@response = ActionController::TestResponse.new\r\n\t\t# Retrieve fixtures via their name\r\n\t\t# @first = users(:first)\r\n\t\t@first = User.find_first\r\n\tend",
"def setup_with_fixtures\n ActiveRecord::Base.send :increment_open_transactions\n ActiveRecord::Base.connection.begin_db_transaction\n load_fixtures\n end",
"def setup\n load_users\n end",
"def setup\r\n # Retrieve fixtures via their name\r\n # @first = categories(:first)\r\n end",
"def setup_all\n setup_all_options\n save_validate_user { setup_successfull }\n end",
"def setup\r\n # Retrieve fixtures via their name\r\n # @first = category(:first)\r\n end",
"def setup\n @admin = users(:admin)\n @user = users(:user)\n end",
"def setup\n # Retrieve fixtures via their name\n # @first = volunteer_tasks(:first)\n end",
"def fixtures\n @fixtures ||= Dir[Rails.root.join(\"spec\", \"fixtures\", \"*/*\")]\n end",
"def setup\n # reload the fixtures since each test is NOT wrapped in a transaction\n self.class.fixtures :all\n self.class.open_browser(@@testing_browser)\n end",
"def load_users_fixture\n self.class.load_users_fixture\n end",
"def preload_fixtures\n return if @options.fetch(:no_fixtures)\n\n fixtures = (ActiveSupport::VERSION::MAJOR == 3 ? ActiveRecord::Fixtures : ActiveRecord::FixtureSet)\n\n # reuse our pre-loaded fixtures even if we have a different connection\n fixtures_eigenclass = class << fixtures; self; end\n fixtures_eigenclass.send(:define_method, :cache_for_connection) do |_connection|\n fixtures.class_variable_get(:@@all_cached_fixtures)[:unique]\n end\n\n ActiveSupport::TestCase.fixtures :all\n\n fixtures.create_fixtures(\n ActiveSupport::TestCase.fixture_path,\n ActiveSupport::TestCase.fixture_table_names,\n ActiveSupport::TestCase.fixture_class_names\n )\n end",
"def before_setup\n Account.connection.drop_table :accounts, if_exists: true\n Account.connection.exec_query(\"CREATE SEQUENCE accounts_id_seq\")\n Account.connection.exec_query(\"\n CREATE TABLE accounts (\n id BIGINT PRIMARY KEY DEFAULT nextval('accounts_id_seq'),\n firm_id bigint,\n firm_name character varying,\n credit_limit integer\n )\n \")\n\n Company.connection.drop_table :companies, if_exists: true\n Company.connection.exec_query(\"CREATE SEQUENCE companies_nonstd_seq\")\n Company.connection.exec_query(\"\n CREATE TABLE companies (\n id BIGINT PRIMARY KEY DEFAULT nextval('companies_nonstd_seq'),\n type character varying,\n firm_id bigint,\n firm_name character varying,\n name character varying,\n client_of bigint,\n rating bigint,\n account_id integer,\n description character varying\n )\n \")\n\n Course.connection.drop_table :courses, if_exists: true\n Course.connection.exec_query(\"CREATE SEQUENCE courses_id_seq\")\n Course.connection.exec_query(\"\n CREATE TABLE courses (\n id INT PRIMARY KEY DEFAULT nextval('courses_id_seq'),\n name character varying,\n college_id integer\n )\n \")\n\n self.class.fixtures :accounts\n self.class.fixtures :companies\n self.class.fixtures :courses\n end",
"def setup\n # Retrieve fixtures via their name\n # @first = <%= plural_name %>(:first)\n end",
"def install_fixtures\n fixtures = String.new\n if @config[@origin].has_key?('fixtures')\n fixtures = @config[@origin]['fixtures'].to_yaml.chop.gsub(\"---\\n\", '').gsub(\"\\n\", \"\\n \")\n end\n\n subs = {\n '##FIXTURES##' => fixtures,\n '##SHORT_NAME##' => @short_name,\n }\n\n install_template(\n [\"#{@templates}/.fixtures.yml\"], '.fixtures.yml', subs)\n end",
"def setup\n # Retrieve fixtures via their name\n # @first = contacts(:first)\n end",
"def setup\n # Retrieve fixtures via their name\n # @first = gizmo_types(:first)\n end",
"def setup\n # Retrieve fixtures via their name\n # @first = vr_cc_solicituds(:first)\n end",
"def fixtures(name)\n entry = YAML::load_file(File.dirname(__FILE__) + \"/spec/fixtures/#{name}.yaml\")\n klass = begin\n Kernel::const_get(Inflector.classify(Inflector.singularize(name)))\n rescue\n nil\n end\n\n unless klass.nil?\n database.logger.debug { \"AUTOMIGRATE: #{klass}\" }\n klass.auto_migrate!\n\n (entry.kind_of?(Array) ? entry : [entry]).each do |hash|\n if hash['type']\n Object::const_get(hash['type'])::create(hash)\n else\n klass::create(hash)\n end\n end\n else\n table = database.table(name.to_s)\n table.create! true\n table.activate_associations!\n\n #pp database.schema\n\n (entry.kind_of?(Array) ? entry : [entry]).each do |hash|\n table.insert(hash)\n end\n end\nend",
"def load_users_fixture\n unless @users_fixture_loaded\n self.method(:fixtures).call(user_symbol.to_s.pluralize.to_sym)\n @users_fixture_loaded = true\n end\n end",
"def load_fixtures(name)\n data = YAML.load_file File.join(File.dirname(__FILE__), \"#{name}.yml\")\n # hmm, how do I dynamically add instance variables? data.each { |k,v| @`k` = User.new data[k] }\n @user_1 = User.new data['user_1']\n @user_2 = User.new data['user_2']\n end",
"def setup\n make_config\n make_users_file\n end",
"def create_fixtures\n # An unown model linked to a tenant\n @linked_to_tenant = UnownedModel.create!\n @tenant_model = TenantModel.create! unowned_model: @linked_to_tenant\n @other_tenant_model = TenantModel.create!\n # Add to the user\n user.add_tenant @tenant_model\n\n # Another user\n @other_user = User.create!\n # A owned model, owned\n @owned_model = OwnedModel.create! user: user,\n tenant_model: @tenant_model\n # An model not owned\n @unowned_model = OwnedModel.create! user: @other_user,\n tenant_model: @tenant_model\n # Other tenant model\n @unmanaged_model = OwnedModel.create! tenant_model: @other_tenant_model\n # An unownable model\n @model = UnownedModel.create!\n\n # Child\n @child_model = @owned_model.child_models.create!\n\n # The user belong to a group\n @group = Strongbolt::UserGroup.create! name: 'Normal'\n @group.users << user\n\n # That has a role\n @guest_role = Strongbolt::Role.create! name: 'Guest'\n @parent_role = Strongbolt::Role.create! name: 'Basic', parent_id: @guest_role.id\n @other_role = Strongbolt::Role.create! name: 'Admin'\n @role = @group.roles.create! name: 'Normal', parent_id: @parent_role.id\n\n # Which has capabilities\n\n # User can update self\n @parent_role.capabilities.create! model: 'User', action: 'update', require_ownership: true\n\n # User can read all owned models\n @parent_role.capabilities.create! model: 'OwnedModel', action: 'find'\n\n # And create some\n @role.capabilities.create! model: 'OwnedModel', action: 'create', require_ownership: true\n\n # But can delete only owned models\n @role.capabilities.create! model: 'OwnedModel', action: 'destroy', require_ownership: true\n\n # User can read any unowned models\n @guest_role.capabilities.create! model: 'UnownedModel', action: 'find'\n\n # But can create setting only the attribute name\n @role.capabilities.create! model: 'UnownedModel', action: 'create', attr: 'name',\n require_tenant_access: false\n\n # Admin can do whatever\n @other_role.capabilities.create! model: 'UnownedModel', action: 'create'\n end",
"def setup\n # Retrieve fixtures via their name\n # @first = vr_cc_solicitudes(:first)\n end",
"def alter_fixtures(&block)\n @fixtures = adjust_fixtures(\n @options, &block\n )\n end",
"def testFixtureSetup()\n @windows = []\n # setup your objects for the tests (if needed)\n end",
"def testFixtureSetup()\n @windows = []\n # setup your objects for the tests (if needed)\n end",
"def build_test_fixtures \n \n return if skip_method(__method__)\n \n puts \"build Rails fixture for #{model_name} in test/fixtures\"\n \n filename = \"#{plural_table_name}.yml\"\n template = File.read(template(\"rails/test/fixtures.yml\"))\n # #text = ERB.new(template, nil, '-').result(binding)\n text = Erubis::Eruby.new(template).evaluate( self )\n\n path = File.join(\"test\",\"fixtures\",filename)\n write_artifact(path,text) \n end",
"def setup\n @user = users(:user1)\n @other_user = users(:user2)\n @admin = users(:admin1)\n @other_admin = users(:admin2)\n\n @admin_role = roles(:admin)\n @user_role = roles(:user)\n end",
"def load_setup( name )\n reader = create_fixture_reader( name ) ### \"virtual\" method - required by concrete class\n\n reader.each do |fixture_name|\n load( fixture_name )\n end\n end",
"def setup\n @useradmin3 = useradmins(:useradmin3)\n @user3 = users(:three)\n end",
"def setup\n create(:admin)\n log_user(\"sazor_test_admin\", \"foo\")\n gitlab_destroy_all({ token: User.current.gitlab_token })\n end",
"def setup\n super\n @default_provider_id = register_default_provider\n @default_consumer_id = register_default_consumer\n\n # Define some dummy items\n @default_items = [\n { name: \"Item1\", price: 39.99, provider: @default_provider_id },\n { name: \"Item2\", price: 10, provider: @default_provider_id }\n ]\n\n # Check everything is empty\n assert_equal(0, get_registered_number(\"api/items\"),\n \"There are registered items at test setup\")\n\n assert_equal 0, count_orders, \"There are registered orders at test setup\"\n\n # TODO: Rename the files\n Item.db_filename = \"tests/test_files/test_items.json\"\n Order.db_filename = \"tests/test_files/test_orders.json\"\n end",
"def read_fixtures\n # Read in all the files\n @file_list = Dir[\"#{@fixture_directory}/*.foxml.xml\"]\n \n # Get the PID for each one\n @file_list.each do |file|\n @pid_list << Hydra::FixtureUtils.extract_pid(file)\n end\n end",
"def setup\n templates = ['default']\n templates << @opts[:testkitchen] if @opts[:testkitchen]\n\n templates.each { |type| create_file(type) }\n end",
"def load_default_test_data_to_db_before_suite\n community1 = FactoryGirl.create(:community, :ident => \"test\", :consent => \"test_consent0.1\", :settings => {\"locales\" => [\"en\", \"fi\"]}, :real_name_required => true)\n community1.community_customizations.create(name: \"Yelo\", locale: \"fi\")\n community2 = FactoryGirl.create(:community, :ident => \"test2\", :consent => \"KASSI_FI1.0\", :settings => {\"locales\" => [\"en\"]}, :real_name_required => true, :allowed_emails => \"@example.com\")\n community3 = FactoryGirl.create(:community, :ident => \"test3\", :consent => \"KASSI_FI1.0\", :settings => {\"locales\" => [\"en\"]}, :real_name_required => true)\n\n [community1, community2, community3].each { |c| TestHelpers::CategoriesHelper.load_test_categories_and_listing_shapes_to_db(c) }\n end",
"def setup\n @frank = users(:frank)\n @mike = users(:mike)\n end",
"def clear_all_fixtures\n Company.destroy_all\n end",
"def setup_data\n user = create(:user)\n another_user = create(:user)\n recipe_type = create(:recipe_type)\n another_recipe_type = create(:recipe_type)\n cuisine = create(:cuisine)\n torta_morango = create(:recipe, title: 'Torta de Morango', difficulty: 'Médio',\n recipe_type: recipe_type, cuisine: cuisine, cook_time: 120,\n ingredients: 'Morango, farinha, ovos',\n cook_method: 'Misture tudo e coloque no forno',\n user: user)\n create(:recipe, title: 'Torta de Limão', difficulty: 'Médio',\n recipe_type: recipe_type, cuisine: cuisine, cook_time: 120,\n ingredients: 'Limão, farinha, ovos',\n cook_method: 'Misture tudo e coloque no forno',\n user: user)\n create(:recipe, title: 'Torta de Abacate', difficulty: 'Médio',\n recipe_type: another_recipe_type, cuisine: cuisine, cook_time: 120,\n ingredients: 'Abacate, farinha, ovos, decoracoes',\n cook_method: 'Misture tudo, coloque no forno, e apos retirar decore a torta',\n user: another_user)\n sobremesas = create(:list, name: 'Sobremesas', user: user)\n create(:list_recipe, list: sobremesas, recipe: torta_morango)\n login_as(user, scope: :user)\n end",
"def setup\n @admin = users(:admin)\n @user = users(:user)\n @mission = missions(:mission1)\n end",
"def load_fixtures\n Firefly::Url.destroy\n urls = YAML::load(File.open('spec/fixtures/urls.yml'))\n urls.each { |key, url| Firefly::Url.create(url) }\n end",
"def setup\n # runs before every test\n # wipe and recreate .test directory, switch pwd \n Dir.chdir(@@start_dir)\n if File.exist?('.test')\n FileUtils.rm_rf('.test')\n end\n \n Dir.mkdir('.test')\n Dir.chdir('.test')\n end",
"def setup\n\t\t# If there's no test database, we'll use the return statement to stop\n\t\t# executing the rest of this code block.\n\t\treturn unless File.exists?('test.sqlite3')\n\t\t# We'll delete everything in our database so that the results of one\n\t\t# test don't affect other tests.\n\t\tdb = SQLite3::Database.new('test.sqlite3')\n\t\tdb.execute \"DELETE FROM guestbook WHERE 1;\"\n\tend",
"def setup\n @michael = users(:michael)\n @archer= users(:archer)\n end",
"def fixtures(number_of_directories = 1)\n current_pwd = Dir.pwd\n paths = 1.upto(number_of_directories).map { mk_fixture_tmp_dir }\n\n FileUtils.cd(paths.first) if number_of_directories == 1\n\n yield(*paths)\nensure\n FileUtils.cd current_pwd\n paths.map { |p| FileUtils.rm_rf(p) if File.exist?(p) }\nend",
"def setup\n @admin = users(:admin)\n @user = users(:user)\n @user2 = users(:user2)\n @user3 = users(:user3)\n @user4 = users(:user4)\n @user5 = users(:user5) #資料不完整的使用者\n @instance = instances(:instance_teaming)\n end",
"def setup(&block)\n before(:each, &block)\n end",
"def setup\n @admin = users(:admin)\n @user = users(:user)\n @user2 = users(:user2)\n @user3 = users(:user3)\n @user4 = users(:user4)\n @instance_teaming = instances(:instance_teaming)\n @instance_in_progress = instances(:instance_in_progress)\n @instance_complete = instances(:instance_complete)\n end",
"def load_all_seeds\n puts \"Loading db/seeds/*\"\n Dir[File.join(Rails.root, 'db', 'seeds', '*.rb')].sort.each { |seed| load seed }\nend",
"def setup\n @user = users(:one)\n @other_user = users(:two)\n end",
"def setup\n \n @user = users(:david)\n \n end",
"def for_each_fixture(name, &block)\n Fixtures.all_loaded_fixtures[name].keys.each {|key| block.call key } \n end",
"def enable_fixtures_for(tests = nil, &block)\n outcome = disable_fixtures_for(tests, &block)\n @fixtures_disabled_tests_negated = true\n outcome\n end",
"def generate_fixtures_data\n # Determine if there are symlinks, either for the default modulename, or for anything in the modulepath\n symlinks = []\n modulepath = ''\n if (File.exists?('environment.conf') and environment_conf = File.read('environment.conf'))\n puts \"\\nGenerating .fixtures.yml for a controlrepo.\" unless @options[:silent]\n\n environment_conf.split(\"\\n\").each do |line|\n modulepath = (line.split('='))[1].gsub(/\\s+/,'') if line =~ /^modulepath/\n end\n\n paths = modulepath.split(':').delete_if { |path| path =~ /^\\$/ }\n paths.each do |path|\n Dir[\"#{path}/*\"].each do |module_location|\n next unless File.directory?(module_location)\n module_name = File.basename(module_location)\n module_path = module_location\n symlinks << {\n :name => module_name,\n :path => '\"#{source_dir}/' + module_path + '\"',\n }\n end\n end\n else\n puts \"\\nGenerating .fixtures.yml using module name #{@options[:modulename]}.\" unless @options[:silent]\n\n symlinks << { \n :name => @options[:modulename],\n :path => '\"#{source_dir}\"',\n }\n end\n\n # Header for fixtures file creates symlinks for the controlrepo's modulepath, or for the current module\"\n fixtures_data = \"fixtures:\\n\"\n if symlinks\n fixtures_data += \" symlinks:\\n\"\n symlinks.sort_by!{|symlink| symlink[:name]}.each do |symlink|\n fixtures_data += \" #{symlink[:name]}: #{symlink[:path]}\\n\"\n end\n end\n\n unless @repository_data.empty?\n fixtures_data += \" repositories:\\n\"\n @repository_data.sort_by!{|repo| repo[:name]}.each do |repodata|\n # Each repository has two or pieces of data\n # Mandatory: the module name, the URI/location\n # Optional: the type (ref, branch, commit, etc.) and ID (tag, branch name, commit hash, etc.)\n name = repodata[:name]\n location = repodata[:location]\n type = repodata[:type]\n id = repodata[:id]\n\n data = <<-EOF\n #{name}:\n repo: \"#{location}\"\n EOF\n data += \" #{type}: \\\"#{id}\\\"\\n\" unless @options[:latest_versions] || !type || !id\n\n fixtures_data += data\n end\n end\n\n\n unless @module_data.empty?\n fixtures_data += \" forge_modules:\\n\"\n @module_data.keys.sort_by!{|mod| mod.split(/[\\/-]/)[1]}.each do |modulename|\n shortname = modulename.split(/[\\/-]/)[1]\n version = @module_data[modulename] \n data = <<-EOF\n #{shortname}:\n repo: \"#{modulename}\"\n EOF\n data += \" ref: \\\"#{version}\\\"\\n\" unless @options[:latest_versions] || version.nil?\n\n fixtures_data += data\n end\n end\n\n fixtures_data\n end",
"def reset\n callbacks[:before_fixtures_reset].each(&:call)\n\n clean\n tables_cache.clear\n cache.clear\n\n callbacks[:after_fixtures_reset].each(&:call)\n callbacks.clear\n end",
"def add_testing\n setup_rspec\n setup_rspec_generators\n setup_rails_helper\n setup_factories_file\nend",
"def load(*fixture)\n FixtureDependencies.load(*fixture)\n end",
"def runFixtureAndTests(testDirPath, collectionName, fixtureFileName)\n setFixture(collectionName,fixtureFileName) {runTests(testDirPath)}\nend",
"def write_to_file\n newline\n say \"Writing fixtures to YAML files\"\n records_by_table_name = {}\n\n self.models.each do |model_class, table_name|\n # Load all records of this model.\n records_by_table_name[table_name] ||= []\n records_by_table_name[table_name] += model_class.all\n end\n\n records_by_table_name.each do |table_name, records|\n yaml_data = \"\"\n\n if records.any?\n # Sequence number for records for which we do not have names.\n i = \"0\"\n data_array = []\n\n records.uniq.each do |record|\n # Get the name given for this record while populating. If not\n # available (autogenerated through callbacks), use a sequence number\n # prefixed by the table name.\n fixture_name = self.fixture_name_map[record] || \"#{table_name}_#{i.succ!}\"\n attrs = record.attributes\n attrs['delta'] = false if attrs.key?('delta')\n data_array << {fixture_name => attrs}.to_yaml.gsub(/--- \\n/, \"\")\n end\n\n yaml_data = data_array.join(\"\\n\")\n\n File.open(\"#{RAILS_ROOT}/test/fixtures/#{table_name}.yml\", \"w\") do |file|\n file.write yaml_data\n end\n end\n dot\n end\n end",
"def setup()\n create_directories\n end",
"def before_load(test_files); end",
"def setup\n @user = users(:tommy)\n end",
"def setup\n @mike = users(:mike)\n @admin = users(:frank)\n @issue = issues(:one)\n @update = updates(:one)\n end",
"def setup\n\n create_new_user({id: 1,\n username: \"user1\",\n email: \"[email protected]\",\n password: \"password\",\n password_confirmation: \"password\"})\n create_new_user({id: 2,\n username: \"user2\",\n email: \"[email protected]\",\n password: \"password\",\n password_confirmation: \"password\"})\n create_new_user({id: 3,\n username: \"user3\",\n email: \"[email protected]\",\n password: \"password\",\n password_confirmation: \"password\"})\n create_new_user({id: 4,\n username: \"user4\",\n email: \"[email protected]\",\n password: \"password\",\n password_confirmation: \"password\"})\n end",
"def prepare_suites\n base = File.join(config[:test_base_path], config[:suite_name])\n debug(\"Creating local sandbox of all test suite files in #{base}\")\n local_suite_files.each do |src|\n dest = File.join(sandbox_suites_dir, src.sub(\"#{base}/\", ''))\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp(src, dest, :preserve => true)\n end\n end",
"def load_seeds(*files)\n env = Rails.env\n\n `cp -R ./spec/fixtures/seeds/#{env}/files ./spec/fixtures/db/seeds/#{env}`\n\n files.each do |file|\n `cp ./spec/fixtures/seeds/#{env}/#{file} ./spec/fixtures/db/seeds/#{env}`\n end\n\n yield\n\n `rm -R ./spec/fixtures/db/seeds/#{env}/files`\n\n files.each do |file|\n `rm ./spec/fixtures/db/seeds/#{env}/#{file}`\n end\nend",
"def assert_generated_fixtures_for(name)\n assert_generated_yaml \"test/fixtures/#{name.to_s.underscore}\" do |yaml|\n yield yaml if block_given?\n end\n end",
"def default_setup(*args)\n options = args.last.is_a?(Hash) ? args.last.dup : {}\n args.each { |arg| options[arg] = true if arg.is_a?(Symbol) }\n method_name = \"#{options[:prefix]}setup\".to_sym\n unless options[:without_login]\n load_users_fixture\n define_method(method_name) do\n @controller = self.class.target.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n login options\n end\n else\n define_method(method_name) do\n @controller = self.class.target.new\n @request = ActionController::TestRequest.new\n @response = ActionController::TestResponse.new\n end\n end\n end",
"def fixture_directories\n @_fixture_directories ||= absolute_paths_for('fixtures')\n end",
"def create_everything\n create_users\n create_user_keys\n create_comments\n create_filters\n create_columns\n create_organizations\n create_approvals\n create_whitelists\n create_user_key_columns\n create_user_key_organizations\n end",
"def yaml_files\n Dir.glob(root.join(\"{test,spec}/fixtures/**/*.{yaml,yml}\").to_s)\n end",
"def teardown\n User.delete_all\n end",
"def already_loaded_fixtures\n begin\n self.class.send(:class_variable_get, :@@already_loaded_fixtures)\n rescue NameError # might get here on first run in a single test\n nil #{ self.class => {} }\n end\n end",
"def generate_alltest\n\n end",
"def og_fixture(*classes)\n fixture(*classes)\n\n for klass in classes\n f = Glue::Fixtures[klass]\n\n for obj in f.objects\n obj.save\n end\n end\n end",
"def setup\n @admin = users(:admin)\n @user = users(:user)\n @user2 = users(:user2)\n @user3 = users(:user3)\n @user4 = users(:user4)\n @instance = instances(:instance_teaming)\n @invitation = invitations(:invitation1)\n end",
"def destroy_fixtures\n temporary_registration.destroy if defined?(@temporary_registration)\n registration.destroy if defined?(@registration)\n event_subscriber.destroy if defined?(@event_subscriber)\n event.destroy if defined?(@event)\n lesson.destroy if defined?(@lesson)\n end",
"def setup\n @user = users(:tom)\n end",
"def fixtures_path\n root_path.join('spec', 'fixtures')\nend",
"def setup\n login_user\n end",
"def each_schema_file(&block)\n Dir[File.expand_path(\"../fixtures/*.yaml\", __FILE__)].each(&block)\n end",
"def setup\n @suite.p \"\\n:: [SETUP]\\n\"\n # -- let's print the description of each test first:\n Dir.glob(\"#{@suite.suite_root}/tests/**/*_test.rb\") {|f|\n file_contents = File.read(f)\n @suite.p \"\\n [description] : \" + /^#.*@description(.*$)/.match(file_contents)[0].gsub(/^#.*@description/, '') + \"\\n\\n\" if /#{self.class.name}/.match(file_contents)\n }\n end",
"def setup_admins_users\n begin\n click_on('Logout')\n rescue\n print\n end\n\n Warden.test_reset!\n\n @a1 = admins(:elle_woods)\n @a2 = admins(:vivian_kensington)\n @a3 = admins(:emmett_richmond)\n\n @u1 = users(:connery)\n @u2 = users(:moore)\n @u3 = users(:brosnan)\nend",
"def setup\n setup_test_database\n drop_and_create_schema_migrations_table\n end",
"def setup\n unless @admin_session.log_in('[email protected]', 'mit')\n unless @admin_session.sign_up('[email protected]', 'mit')\n raise 'Failed to sign up [email protected]'\n end\n unless @admin_session.log_in('[email protected]', 'mit')\n raise 'Failed to log in after signing up [email protected]'\n end\n end\n unless @admin_session.view_course_home(@course)\n unless @admin_session.create_course(@course)\n raise 'Failed to create course'\n end\n end\n\n @staff_session = LoadTestSession.new @root_url\n unless @staff_session.log_in('[email protected]', 'mit')\n unless @staff_session.sign_up('[email protected]', 'mit')\n raise 'Failed to sign up [email protected]'\n end\n unless @staff_session.log_in('[email protected]', 'mit')\n raise 'Failed to log in after signing up [email protected]'\n end\n unless @staff_session.register_staff(@course)\n raise 'Failed to register [email protected] as course staff'\n end\n unless @admin_session.approve_staff_requests(@course) >= 1\n raise 'Failed to approve [email protected] as course staff'\n end\n end\n\n assignment_id = nil\n unless assignments = @staff_session.list_assignments(@course)\n raise 'Failed to list course assignments'\n end\n unless assignment_id = assignments['Load Lab']\n analyzer_path = File.expand_path(\n '../../fixtures/files/analyzer/fib_small.zip', __FILE__)\n unless assignment_id = @staff_session.create_load_test_assignment(\n @course, 'Load Lab', analyzer_path)\n raise 'Failed to create load test assignment'\n end\n unless @staff_session.release_assignment(@course, assignment_id)\n raise 'Failed to release load test assignment'\n end\n end\n\n @assignment_id = assignment_id\n end",
"def resetFixture\n\t\tUser.delete_all\n\t\trender(json: {errCode: 1})\n\tend",
"def setup\n @user = users(:user)\n @user2 = users(:user2)\n @user3 = users(:user3)\n @invitation = invitations(:invitation1)\n end",
"def create_default_config_files\n create_default_database_yml\n end",
"def basic_test_data\n sf = FactoryGirl.create(:city, name: \"San Francisco\")\n ch = FactoryGirl.create(:city, name: \"Chicago\")\n FactoryGirl.create(:business_type)\n\n # Admin user\n FactoryGirl.create(:user, admin: true, city_id: sf.id)\n\n # Need some businesses in each city\n 3.times do\n FactoryGirl.create(:business, city: sf.name, state: \"CA\")\n FactoryGirl.create(:business, city: ch.name, state: \"IL\")\n end\n\n %w(a b c d e f g h i j k).each do |tag|\n FactoryGirl.create(:tag, name: tag)\n end\n end",
"def setup\n @automator = ArmAutomator.instance\n create_test_user :login_id_prefix => \"test\", :external_user_id_suffix => \"@gmail.com\", :group => \"training\", :country => \"United States\"\n perform_login\n end",
"def setup\n @user = users(:brock)\n end",
"def run\n\t\t\tflush_database\n\t\t\tseed_countries\n\t\t\tseed_group_organizations\n\t\t\tseed_organizations\n\t\t\tseed_locations\n\t\t\tseed_admin\n\t\t\tseed_api_key\n\t\tend",
"def setup\n @user = users(:michael)\n end",
"def destroy_all_test_users\n test_users.each(&:destroy)\n self.test_users = []\n end",
"def load_into_database(options={})\n # necessary to make multiple invocations possible in a single test\n # case possible\n ActiveRecord::Fixtures.reset_cache\n\n # Filter down the models to load if specified\n the_tables = if options.has_key?(:only)\n self.table_names.select {|x| Array(options[:only]).map(&:to_s).include?(x) }\n elsif options.has_key?(:except)\n self.table_names.select {|x| !Array(options[:except]).map(&:to_s).include?(x) }\n else\n self.table_names\n end\n raise \"No models to load, relax your :only or :except filters (or don't bother calling this method)\" if the_tables.empty?\n\n\n #This wraps all the inserts into a single transaction allowing the constraint check to happen at the end.\n ActiveRecord::Base.transaction do\n\n the_tables.each do |table_name|\n class_name = if self.table_name_to_model_name_hash.kind_of?(Hash)\n self.table_name_to_model_name_hash[table_name]\n else\n ActiveSupport::Deprecation.warn \"your fe_manifest.yml does not contain a table_name_to_model_name_hash (as found in 1.0.0 or earlier). Version 2.0.0 will require this. See test cases for how to manually jigger your fe_manifest.ymls to function.\"\n nil\n end\n if options[:map].nil?\n # Vanilla create_fixtures will work fine when no mapping is being used\n ActiveRecord::Fixtures.create_fixtures(self.target_path, table_name)\n else\n # Map table_name via a function (great for prefixing)\n new_table_name = if options[:map].kind_of?(Proc)\n options[:map].call(table_name)\n # Map table_name via a Hash table name mapping\n elsif options[:map][table_name].kind_of? String\n options[:map][table_name]\n else\n table_name # No mapping for this table name\n end\n fixtures = ActiveRecord::Fixtures.new( ActiveRecord::Base.connection,\n new_table_name,\n class_name,\n ::File.join(self.target_path, table_name))\n fixtures.table_rows.each do |the_table_name,rows|\n rows.each do |row|\n ActiveRecord::Base.connection.insert_fixture(row, the_table_name)\n end\n end\n end\n # FIXME: The right way to do this is to fork the oracle enhanced adapter\n # and implement a reset_pk_sequence! method, this is what ActiveRecord::Fixtures\n # calls. aka this code should be eliminated/live elsewhere.\n case ActiveRecord::Base.connection.adapter_name\n when /oracle/i\n model = class_name.constantize\n if model.column_names.include? \"id\"\n sequence_name = model.sequence_name.to_s\n max_id = model.maximum(:id)\n next_id = max_id.nil? ? 1 : max_id.to_i + 1\n begin\n ActiveRecord::Base.connection.execute(\"drop sequence #{sequence_name}\")\n rescue\n puts \"[Iron Fixture Extractor] WARNING: couldnt drop the sequence #{sequence_name}, (but who cares!)\"\n end\n begin\n q=\"create sequence #{sequence_name} increment by 1 start with #{next_id}\"\n ActiveRecord::Base.connection.execute(q)\n rescue\n puts \"[Iron Fixture Extractor] WARNING: couldnt create the sequence #{sequence_name}\"\n end\n end\n else\n # Do nothing, only oracle adapters need this\n end\n end\n end # End transaction\n end"
] | [
"0.7683536",
"0.75340164",
"0.7358778",
"0.7003613",
"0.69804454",
"0.6745109",
"0.67060196",
"0.6660457",
"0.6622344",
"0.649012",
"0.6478721",
"0.6460157",
"0.6448435",
"0.64466983",
"0.6407922",
"0.63956076",
"0.6387204",
"0.6349539",
"0.63235945",
"0.62902397",
"0.6258356",
"0.6257784",
"0.62068933",
"0.6138952",
"0.6119349",
"0.6117914",
"0.60644656",
"0.5988895",
"0.59780174",
"0.5976784",
"0.59737206",
"0.59737206",
"0.5945512",
"0.5900415",
"0.5897672",
"0.5892959",
"0.5880674",
"0.5842558",
"0.58417964",
"0.5837839",
"0.5814012",
"0.5805945",
"0.5736868",
"0.57316035",
"0.56923336",
"0.5687185",
"0.56764",
"0.5666455",
"0.56643784",
"0.56528306",
"0.564557",
"0.5644113",
"0.5643369",
"0.5637709",
"0.56306124",
"0.56244475",
"0.5604919",
"0.5600623",
"0.55938774",
"0.559037",
"0.5579786",
"0.55655956",
"0.5562071",
"0.5548775",
"0.55481434",
"0.55432856",
"0.5518768",
"0.5511455",
"0.5507825",
"0.55073786",
"0.5507174",
"0.55043364",
"0.5502959",
"0.55015826",
"0.5487891",
"0.54854184",
"0.5482881",
"0.54744136",
"0.5465595",
"0.5463741",
"0.5460571",
"0.54572266",
"0.5444255",
"0.54292476",
"0.54211587",
"0.54081935",
"0.5397995",
"0.5378537",
"0.5376773",
"0.5374335",
"0.5364616",
"0.53575283",
"0.5347661",
"0.5346818",
"0.5342249",
"0.5313819",
"0.5313387",
"0.5312064",
"0.53109324",
"0.5304296"
] | 0.55140275 | 67 |
Helper function to create a host in the DB [Parameters] data The data to create a host | def create_host(data=nil)
if (!data.blank? && data.is_a?(Hash))
@host = Host.create(data)
else
@host = Host.create(:name => "Test Host #{rand(1..1000)}", :type => Host::TYPE_ROUTER, :address => "192.168.0.#{rand(1..200)}", :description => "Test host description.", :active => true)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lsepoch_create_host_record(params, record, _host)\n# site_id is valid, since the operation is invoked from the \"Site\" screen - inherited!!!\n _host = Host.new(params[:host])\n _host[:site_id] = record[:site_id]\n# ironically record[:host_id] holds the hostname value parsed from the epoch table (at this time)\n _host[:hostname] = record[:host_id] \n _host[:os] = \"Unknown\"\n _host[:description] = \"Orphaned from the epoch table\"\n _host.save\n return _host\n end",
"def create\n @host = Host.new(host_params)\n respond_to do |format|\n if @host.save\n format.html { redirect_to data_source_hosts_path(@host.data_source_id), notice: 'Host was successfully created.' }\n format.json { render :show, status: :created, location: @host }\n else\n format.html { render :new }\n format.json { render json: @host.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_host(host, args = {})\n raise ArgumentError, \"Must specify ip and port\" unless \\\n args.include? :ip and args.include? :port\n\n modify_host(host, args, 'create')\n end",
"def load_host_data\n JSON.parse(this_payload(@flag)).each do |h|\n execute_sql_statement(\n \"INSERT INTO hosts \\n\" \\\n \"(hostname, short_name, ip_address, host_group) \\n\" \\\n \"values \\n\" \\\n \"('#{h['hostname']}', '#{h['short_name']}', \" \\\n \"'#{h['ip_address']}', '#{h['host_group']}');\"\n )\n end\n end",
"def qos_add_host(rule_name,data)\n host_list = data.split(',')\n self.msg(rule_name, :debug, 'qos_add_host', \"host_list\" +host_list.to_s)\n host_list.each do |host|\n self.msg(rule_name, :debug, 'qos_add_host', \"processing host\" +host.to_s)\n @ff.link(:href, 'javascript:mimic_button(\\'add: ...\\', 1)').click\n @ff.select_list(:name, 'net_obj_type').select_value('8')\n if host.size > 0\n self.msg(rule_name, :debug, 'qos_add_host', \"set host\" +host)\n @ff.text_field(:name, 'hostname').set(host.strip)\n @ff.link(:text, 'Apply').click\n end\n end\n end",
"def network_objects_add_host(rule_name,data)\n \n host_list = data.split(',')\n self.msg(rule_name, :debug, 'network_objects_add_host', \"host_list\" +host_list.to_s)\n host_list.each do |host|\n self.msg(rule_name, :debug, 'network_objects_add_host', \"processing host\" +host.to_s)\n \n @ff.link(:href, 'javascript:mimic_button(\\'add: ...\\', 1)').click\n @ff.select_list(:name, 'net_obj_type').select_value('8')\n \n if host.size > 0\n self.msg(rule_name, :debug, 'network_objects_add_host', \"set host\" +host)\n @ff.text_field(:name, 'hostname').set(host.strip)\n @ff.link(:text, 'Apply').click\n end\n \n end\n \n end",
"def create\n @host = Host.new(params[:host])\n\n if @host.save\n render json: @host, status: :created, location: @host\n else\n render json: @host.errors, status: :unprocessable_entity\n end\n end",
"def create\n @host = Host.new(host_params)\n\n if @host.save\n render json: @host, status: :created, location: @host\n else\n render json: @host.errors, status: :unprocessable_entity\n end\n end",
"def create\n begin\n enterMaintenanceMode\n rescue\n Puppet.err 'Could not find Host system.Either Host is not exist or disconnected'\n end\n end",
"def run\n super\n # create an ip\n ip_address = \"#{rand(255)}.#{rand(255)}.#{rand(255)}.#{rand(255)}\"\n x = create_entity Entities::Host, { :name => ip_address }\n end",
"def create\n @redes = Rede.all\n @host = Host.new(host_params)\n @horario = Time.zone.now - 10800\n respond_to do |format|\n @host.usuario_alteracao = @current_user.id\n if @host.save\n format.html { redirect_to @host, notice: 'Host criado com sucesso!!' }\n format.json { render :show, status: :created, location: @host }\n else\n format.html { render :new }\n format.json { render json: @host.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @host = Host.new(params[:host])\n @host.deleted = false\n\n respond_to do |format|\n if @host.save\n format.html { redirect_to hosts_path, notice: 'Host was successfully created.' }\n format.json { render json: @host, status: :created, location: @host }\n else\n format.html { render :new }\n format.json { render json: @host.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @host = Host.new(params[:host])\n\n respond_to do |format|\n if @host.save\n flash[:notice] = 'Host was successfully created.'\n format.html { redirect_to host_url(@host) }\n format.xml { head :created, location: host_url(@host) }\n else\n format.html { render action: 'new' }\n format.xml { render xml: @host.errors.to_xml }\n end\n end\n end",
"def create\n @host = Host.new(params[:host])\n\n respond_to do |format|\n if @host.save\n flash[:notice] = 'Host was successfully created.'\n format.html { redirect_to host_url(@host) }\n format.xml { head :created, :location => host_url(@host) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @host.errors.to_xml }\n end\n end\n end",
"def add_host(data)\n result = @client.api_request(\n :method => \"hostgroup.massAdd\", \n :params => {\n :groups => [{:groupid => data[:groupid]}],\n :hosts => data[:hostids].map { |h| {:hostid => h} }\n }\n )\n result ? result['groupids'][0].to_i : nil\n end",
"def create data\n data = validate_path validate_code(data)\n\n row = TABLE.\n returning.\n insert(data).\n first\n\n Computer.new(row)\n end",
"def create\n @hostela = Hostela.new(params[:hostela])\n\n respond_to do |format|\n if @hostela.save\n format.html { redirect_to @hostela, notice: 'Hostela was successfully created.' }\n format.json { render json: @hostela, status: :created, location: @hostela }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hostela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize(host, data)\n @host = host\n @data = data\n end",
"def create\n @host = Host.new(params[:host])\n\n respond_to do |format|\n if @host.valid? && @host.save\n flash[:notice] = 'Host was successfully created.'\n format.html { redirect_to(@host) }\n format.xml { render :xml => @host, :status => :created, :location => @host }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @host.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def run\n super\n # create an ip\n ip_address = \"#{rand(255)}.#{rand(255)}.#{rand(255)}.#{rand(255)}\"\n x = create_entity Entities::Host, { :name => ip_address }\nend",
"def make_host\n unless self.host.host\n self.host.update(:host => true)\n end\n end",
"def host( *args )\n props = args.last.is_a?( Hash ) && args.pop || {}\n name = args.first.is_a?( String ) && args.shift\n props = props.merge( name: name ) if name\n raise \"Missing required name parameter\" unless props[ :name ]\n host = @hosts[ props[ :name ] ] ||= Host.new( self )\n host.merge_props( props )\n host.add( *args )\n host\n end",
"def add(host)\n\t\tputs \"Add entry to the local host repository: #{host}\"\n\t\thost=host.strip.downcase unless host.nil?\n\t\troot=get_domain_root(host)\n\t\tunless @known_hosts.key?(host)\n\t\t\tip=host_2_ip(host)\n\t\t\trecord=Hash.new\n\t\t\tif is_ip?(ip)\n\t\t\t\t# filter host to known domains only\n\t\t\t\tif is_trusted?(host)\n\t\t\t\t\trecord[host]=ip\n\t\t\t\t\trecord[ip]=host\n\t\t\t\t\tputs \"Host data repository entry loaded: #{host} <=> #{ip}\"\n\t\t\t\t\t# Replace instance with the class variable to avoid potential race condition under parallel engine\n\t\t\t\t\t# add additional logic to update the sub-domain table as well, 02/10/2014\n\t\t\t\t\tsub=get_sub_domain(host)\n\t\t\t\t\tif sub!=nil\n\t\t\t\t\t\ttracker=Wmap::DomainTracker::SubDomain.instance\n\t\t\t\t\t\ttracker.data_dir=@data_dir\n\t\t\t\t\t\ttracker.sub_domains_file = tracker.data_dir + \"sub_domains\"\n\t\t\t\t\t\ttracker.known_internet_sub_domains=tracker.load_domains_from_file(tracker.sub_domains_file)\n\t\t\t\t\t\tunless tracker.domain_known?(sub)\n\t\t\t\t\t\t\ttracker.add(sub)\n\t\t\t\t\t\t\ttracker.save!\n\t\t\t\t\t\tend\n\t\t\t\t\t\ttracker=nil\n\t\t\t\t\tend\n\t\t\t\t\t@known_hosts.merge!(record)\n\t\t\t\t\treturn record\n\t\t\t\telse\n\t\t\t\t\tdomain_tracker=nil\n\t\t\t\t\tputs \"Error - host #{host} has an untrusted internet root domain: #{root}\\nPlease update the trusted domain seeds file first if necessary.\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tputs \"Problem resolve host #{host} - unknown IP: #{ip}\"\n\t\t\tend\n\t\telse\n\t\t\tputs \"Host is already exist. Skip: #{host}\"\n\t\tend\n\t#rescue => ee\n\t#\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend",
"def create\n \n # Create integer copy of IP address\n params[:host][:ip_int] = Host.ip_as_int params[:host][:ip]\n\n @search = Host.search params[:search]\n @host = Host.new(params[:host])\n\n respond_to do |format|\n if @host.save\n flash[:notice] = 'Host was successfully created.'\n format.html { redirect_to(@host) }\n format.xml { render :xml => @host, :status => :created, :location => @host }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @host.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_or_create(data)\n unless (templateid = get_id(:host => data[:host]))\n templateid = create(data)\n end\n templateid\n end",
"def create_alert(data=nil)\n if (!data.blank? && data.is_a?(Hash))\n @alert = Alert.create(data)\n else\n create_service\n create_host\n\n @service.hosts << @host\n @service.save\n \n @alert = Alert.create(:name => \"Test Alert #{rand(1..1000)}\", :description => \"Test alert description.\", :active => true, :limit => 600, :condition => :greater_than, :condition_target => Alert::CONDITION_TARGET_ALL, :error_control => true, :service_id => @service.id, :hosts => [@host])\n end\n end",
"def create_db name\n \n req = Net::HTTP::Put.new \"/#{name}\"\n ret = @http.request req\n \n puts \"Creating Database #{name} => #{ret.msg} (#{ret.code})\\n\"\n \n end",
"def create_guild(data)\n ensure_server(data)\n end",
"def create_resource(kind, data, body, pr)\n\n if body.size > 0\n result = parse_json(body,kind)\n data = result if !OpenNebula.is_error?(result)\n end\n\n resource = case kind\n when \"vdc\" then\n vdc_data = Hash.new\n data.each{|key,value|\n vdc_data[key.downcase.to_sym]=value if key!=\"pool\"\n }\n\n mandatory_params = [:vdcadminname, :vdcadminpass,\n :zoneid, :name, :hosts]\n\n mandatory_params.each { |param|\n if !vdc_data[param]\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}. \" +\n \"Mandatory attribute '#{param}' is missing.\").to_json]\n end\n }\n\n # Check if the referenced zone exists\n zone=OZones::Zones.get(vdc_data[:zoneid])\n if !zone\n error = OZones::Error.new(\"Error: Zone \" +\n \"#{vdc_data[:zoneid]} not found, cannot create Vdc.\")\n return [404, error.to_json]\n end\n\n if (!defined? vdc_data[:force] or\n (defined? vdc_data[:force] and vdc_data[:force]!=\"yes\")) and\n !host_uniqueness?(zone, vdc_data[:hosts])\n return [403, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}. \" +\n \"One or several hosts belong to a different VDC \"+\n \"and no force option was provided.\").to_json]\n end\n\n vdcadminname = vdc_data[:vdcadminname]\n vdcadminpass = vdc_data[:vdcadminpass]\n vdc_data.delete(:zoneid)\n vdc_data.delete(:vdcadminpass)\n vdc_data.delete(:force)\n\n begin\n vdc = OZones::Vdc.create(vdc_data)\n rescue Exception => e\n msg = e.message\n msg[\"accessible in OZones::Vdc\"] = \"supported.\"\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}.\" +\n \" #{msg}\").to_json]\n end\n\n zone.vdcs << vdc\n zone.save\n\n if zone.saved? and vdc.saved?\n vdcadminpass = Digest::SHA1.hexdigest(vdcadminpass)\n rc = @ocaInt.create_vdc_in_zone(zone,\n vdc,\n vdcadminname,\n vdcadminpass)\n if OpenNebula.is_error?(rc)\n vdc.destroy\n return [400, OZones::Error.new(\n \"Error: Couldn't create #{kind}. Reason: \" +\n rc.message).to_json]\n else\n vdc.acls = rc[0]\n vdc.group_id = rc[1]\n vdc.save\n\n pr.update # Rewrite proxy conf file\n return [200, vdc.to_json]\n end\n else\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}.\" +\n \" Maybe duplicated name?\").to_json]\n end\n\n when \"zone\" then\n zone_data=Hash.new\n data.each{|key,value|\n zone_data[key.downcase.to_sym]=value if key!=\"pool\"\n }\n\n mandatory_params = [:onename, :onepass, :endpoint, :name]\n\n mandatory_params.each { |param|\n if !zone_data[param]\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}. \" +\n \"Mandatory attribute '#{param}' is missing.\").to_json]\n end\n }\n\n # Digest and check credentials\n zone_data[:onepass] =\n Digest::SHA1.hexdigest(zone_data[:onepass])\n\n rc = @ocaInt.check_oneadmin(zone_data[:onename],\n zone_data[:onepass],\n zone_data[:endpoint])\n\n if OpenNebula.is_error?(rc)\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind}. Reason: \"+\n rc.message).to_json]\n end\n\n # Create the zone\n zone = OZones::Zones.create(zone_data)\n rc = zone.save\n\n if rc\n pr.update # Rewrite proxy conf file\n return [200, zone.to_json]\n else\n return [400, OZones::Error.new(\n \"Error: Couldn't create resource #{kind.upcase}.\" +\n \" Maybe duplicated name?\").to_json]\n end\n else\n error = OZones::Error.new(\n \"Error: #{kind.upcase} resource not supported\")\n return [404, error.to_json]\n end\n end",
"def create\n return unless restrict_to_admin\n\n @event_host = @event.event_hosts.new(event_host_params)\n\n respond_to do |format|\n if @event_host.save\n format.html { redirect_to [@event, @event_host], notice: 'Event host was successfully created.' }\n format.json { render :show, status: :created, location: [@event, @event_host] }\n else\n format.html { render :new }\n format.json { render json: @event_host.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sync_host_table\n uri = foreman_uri('/hosts?per_page=9999999')\n debug \"Loading hosts from #{uri}\"\n json = RestClient.get uri\n debug \"Got JSON: #{json}\"\n JSON.parse(json)['results'].each do |rec|\n @db.execute \"insert into host (id,name) values ( ?, ? )\",\n rec['id'], rec['name']\n end\n end",
"def create(data, options = {})\n @@grid.put(data, options)\n end",
"def create\n @hostname = user_signed_in? ? current_user.hostnames.build(hostname_params) : Hostname.new(hostname_params)\n\n respond_to do |format|\n if @hostname.save\n format.html { redirect_to @hostname, notice: 'Alias was successfully created.' }\n format.json { render :show, status: :created, location: @hostname }\n else\n format.html { render :new }\n format.json { render json: @hostname.errors, status: :unprocessable_entity }\n end\n end\n end",
"def initialize_host\n self.host = (Host.find(:name => settings['host']) || Host.new(:name => settings['host']))\n\n current_host_group_names = (host.host_groups || []).map(&:name)\n current_template_names = (host.templates || []).map(&:name)\n\n host_groups_to_add, templates_to_add = [], []\n\n (self.host_groups || []).each do |hg|\n host_groups_to_add << hg unless current_host_group_names.include?(hg.name)\n end\n\n (self.templates || []).each do |t|\n templates_to_add << t unless current_template_names.include?(t.name)\n end\n\n host.host_groups = ((host.host_groups || []) + host_groups_to_add).flatten.compact.uniq\n host.templates = ((host.templates || []) + templates_to_add).flatten.compact.uniq\n host.save\n host\n end",
"def modify_host(host, args = {}, action = 'create')\n args[:host] = host\n ! @backend.send(\"#{action}_host\", args).nil?\n end",
"def set_host\n @host = Host.find(params[:id])\n end",
"def set_host\n @host = Host.find(params[:id])\n end",
"def set_host\n @host = Host.find(params[:id])\n end",
"def set_host\n @host = Host.find(params[:id])\n end",
"def create_host_cmd(options,passwd)\n hammer_cmd = \"hammer\"\n if options[:debug] == true\n hammer_cmd = hammer_cmd + \" --debug\"\n end\n if passwd !=nil\n hammer_cmd = hammer_cmd + \" --password #{passwd}\"\n end\n hammer_cmd = hammer_cmd + \" host create --name #{options[:name]}\"\n if options[:build] == true\n hammer_cmd = hammer_cmd + \" --build true\"\n else\n hammer_cmd = hammer_cmd + \" --build false\"\n end\n hammer_cmd = hammer_cmd + \" --hostgroup-id #{options[:host_group]}\"\n hammer_cmd = hammer_cmd + \" --architecture-id #{options[:arch]}\"\n hammer_cmd = hammer_cmd + \" --operatingsystem-id #{options[:os]}\"\n hammer_cmd = hammer_cmd + \" --medium-id #{options[:media]}\"\n hammer_cmd = hammer_cmd + \" --partition-table-id #{options[:ptable]}\"\n hammer_cmd = hammer_cmd + \" --compute-resource-id #{options[:compute_resource]}\"\n hammer_cmd = hammer_cmd + \" --compute-attributes guest_id='#{options[:guest_type]}',cpus=#{options[:cpus]},memory_mb=#{options[:memory]},cluster='#{options[:cluster]}',path='#{options[:path]}',start=#{options[:start]}\"\n if options[:nic_ip] != nil\n hammer_cmd = hammer_cmd + \" --ip #{options[:nic_ip]}\"\n end\n if options[:nic_mac] != nil\n hammer_cmd = hammer_cmd + \" --mac #{options[:nic_mac]}\"\n end\n hammer_cmd = hammer_cmd + \" --interface=compute_type=#{options[:nic_type]},compute_network=#{options[:nic_network]},name=#{options[:name]},primary=true,identifier=#{options[:nic_name]},managed=#{options[:nic_managed]},provision=true\"\n hammer_cmd = hammer_cmd + \" --volume datastore=#{options[:volume_datastore]},size_gb=#{options[:volume_size]},name=#{options[:name]}\"\n\n return hammer_cmd\nend",
"def set_host\n @host = Host.find(params[:id])\n end",
"def add_host(name, folder = '', options = {})\n raise ArgumentError, 'host already exists' if host_exists?(name)\n \n # Lookup the IP address of the FQDN\n # TODO: catch the exception if it doesn't exist\n in_addr = Resolv.getaddress(name)\n \n params = {\n filled_in: 'edithost',\n _transid: '-1',\n host: name,\n _change_ipaddress: 'on',\n attr_ipaddress: in_addr,\n attr_tag_agent: 'cmk-agent%7Ctcp',\n attr_tag_networking: 'lan',\n save: 'Save+%26+Finish',\n folder: folder,\n mode: 'newhost',\n _do_confirm: 'yes',\n _do_actions: 'yes',\n }\n params.merge! options\n\n response = http_request(@uri + '/wato.py', params)\n raise 'An error occured' if response =~ /div class=error/\n end",
"def get_host(context, address, comm='')\n\t\thost = Host.find(:first, :conditions => [ \"address = ? and comm = ?\", address, comm])\n\t\tif (not host)\n\t\t\thost = Host.create(:address => address, :comm => comm, :state => HostState::Unknown, :created => Time.now)\n\t\t\thost.save\n\t\t\tframework.events.on_db_host(context, host)\n\t\tend\n\n\t\treturn host\n\tend",
"def host_child_new(host_name, pub_name, prefix, website, email)\n send_req({\n act: :host_child_new,\n pub_name: pub_name,\n prefix: prefix,\n website: website,\n email: email\n })\n end",
"def create_guild(data)\n ensure_server(data, true)\n end",
"def new_host\n load_service\n return if (@service.blank?)\n\n @host = Host.where(:_id => params[:host_id]).first\n\n # Does the host exists?\n if (@host.blank?)\n flash[:error] = t(\"services.error.host_not_found\")\n redirect_to service_hosts_path()\n return\n end\n\n # is the host already assigned?\n if (@service.host_ids.include?(@host.id))\n flash[:notice] = t(\"services.notice.host_already_added\", :name => @host.name, :service => @service.name)\n redirect_to service_hosts_path()\n return\n end\n\n # Assign it\n @service.hosts << @host\n\n respond_to do |format|\n format.html{\n if (@service.save)\n flash[:notice] = t(\"services.notice.host_added\", :name => @host.name, :service => @service.name)\n else\n flash[:error] = t(\"services.error.host_not_added\", :name => @host.name, :service => @service.name)\n end\n redirect_to service_hosts_path()\n return\n }\n end\n end",
"def create\n @host_address = HostAddress.new(host_address_params)\n respond_to do |format|\n if @host_address.save\n format.html { redirect_to @host_address, notice: 'Host address was successfully created.' }\n format.json { render :show, status: :created, location: @host_address }\n else\n format.html { render :new }\n format.json { render json: @host_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_host\n raise \"Unknown guest host! You must set current_host_id before creating\" unless current_host_id > 0\n user = User.find(current_host_id) # Raise error if not found\n user.add_guest(self, @circle)\n self.is_emergency_contact_for(user) if @emergency_contact\n true\n end",
"def create_host_template attrs={}\n ZerigoDNS::HostTemplate.create(attrs.merge(zone_template_id: id))\n end",
"def host name, security_groups, runlist, options={}\n host_namespace = HostRecord.define name, security_groups, runlist, options\n CloudRunner.add_component host_namespace\n end",
"def create(sObjectType, hParams)\n case sObjectType\n when :public_ip\n required?(hParams, :compute_connection)\n required?(hParams, :server)\n HPCompute.server_assign_address(hParams[:compute_connection],\n hParams[:server])\n when :server\n required?(hParams, :compute_connection)\n required?(hParams, :image)\n required?(hParams, :network)\n required?(hParams, :flavor)\n required?(hParams, :keypairs)\n required?(hParams, :security_groups)\n required?(hParams, :server_name)\n\n options = {\n :name => hParams[:server_name],\n :flavor_id => hParams[:flavor].id,\n :image_id => hParams[:image].id,\n :key_name => hParams[:keypairs].name,\n :security_groups => [hParams[:security_groups].name],\n :networks => [hParams[:network].id]\n }\n\n HPCompute.create_server(hParams[:compute_connection], options,\n hParams[:user_data], hParams[:meta_data])\n when :image\n required?(hParams, :compute_connection)\n required?(hParams, 'server#image_name')\n\n HPCompute.get_image(hParams[:compute_connection],\n hParams['server#image_name'])\n when :network\n required?(hParams, :network_connection)\n required?(hParams, :network_name)\n\n HPNetwork.create_network(hParams[:network_connection],\n hParams[:network_name])\n when :subnetwork\n required?(hParams, :network_connection)\n required?(hParams, :network)\n required?(hParams, :subnetwork_name)\n\n HPNetwork.create_subnetwork(hParams[:network_connection],\n hParams[:network],\n hParams[:subnetwork_name])\n when :security_groups\n required?(hParams, :network_connection)\n required?(hParams, :security_group)\n\n HPSecurityGroups.create_sg(hParams[:network_connection],\n hParams[:security_group], hParams[:sg_desc])\n when :keypairs\n required?(hParams, :compute_connection)\n required?(hParams, 'credentials#keypair_name')\n required?(hParams, :public_key)\n\n HPKeyPairs.create_keypair(hParams[:compute_connection],\n hParams['credentials#keypair_name'],\n hParams[:public_key])\n when :router\n required?(hParams, :network_connection)\n required?(hParams, :router_name)\n\n # Forcelly used admin_status_up to true.\n hParams[:hdata] = hParams[:hdata].merge(:admin_state_up => true)\n\n HPNetwork.create_router(hParams[:network_connection], hParams[:hdata])\n when :rule\n required?(hParams, :network_connection)\n required?(hParams, :security_groups)\n HPSecurityGroups.create_rule(hParams[:network_connection],\n hParams[:hdata])\n when :router_interface\n required?(hParams, :router)\n required?(hParams, :subnetwork)\n HPNetwork.add_interface(hParams[:router], hParams[:subnetwork])\n else\n controller_error \"'%s' is not a valid object for 'create'\", sObjectType\n end\n end",
"def add(host_template)\n raise('wrong type: Centreon::HostTemplate required') unless host_template.is_a?(::Centreon::HostTemplate)\n raise('wrong value: host template must be valid') unless host_template.valid\n @client.post({\n 'action' => 'add',\n 'object' => 'htpl',\n 'values' => '%s;%s;%s;%s;;' % [host_template.name, host_template.description, host_template.address, host_template.templates_to_s],\n }.to_json)\n\n # Set extra parameters\n set_param(host_template.name, 'comment', host_template.comment) unless host_template.comment.nil?\n set_param(host_template.name, 'snmp_community', host_template.snmp_community) unless host_template.snmp_community.nil?\n set_param(host_template.name, 'snmp_version', host_template.snmp_version) unless host_template.snmp_version.nil?\n set_param(host_template.name, 'timezone', host_template.timezone) unless host_template.timezone.nil?\n set_param(host_template.name, 'check_command', host_template.check_command) unless host_template.check_command.nil?\n set_param(host_template.name, 'check_command_arguments', '!' + host_template.check_command_args.join('!')) unless host_template.check_command_args.empty?\n set_param(host_template.name, 'check_interval', host_template.check_interval) unless host_template.check_interval.nil?\n set_param(host_template.name, 'retry_check_interval', host_template.retry_check_interval) unless host_template.retry_check_interval.nil?\n set_param(host_template.name, 'max_check_attempts', host_template.max_check_attempts) unless host_template.max_check_attempts.nil?\n set_param(host_template.name, 'check_period', host_template.check_period) unless host_template.check_period.nil?\n active_check = case host_template.active_checks_enabled\n when 'false'\n '0'\n when 'true'\n '1'\n when 'default'\n '2'\n else\n nil\n end\n set_param(host_template.name, 'active_checks_enabled', active_check) unless active_check.nil?\n passive_check = case host_template.passive_checks_enabled\n when 'false'\n '0'\n when 'true'\n '1'\n when 'default'\n '2'\n else\n nil\n end\n set_param(host_template.name, 'passive_checks_enabled', passive_check) unless passive_check.nil?\n set_param(host_template.name, 'notes_url', host_template.note_url) unless host_template.note_url.nil?\n set_param(host_template.name, 'action_url', host_template.action_url) unless host_template.action_url.nil?\n set_param(host_template.name, 'notes', host_template.note) unless host_template.note.nil?\n set_param(host_template.name, 'icon_image', host_template.icon_image) unless host_template.icon_image.nil?\n\n # Disable it if needed\n disable(host_template.name) unless host_template.activated\n\n # Set macros\n host_template.macros.each do |macro|\n set_macro(host_template.name, macro)\n end\n end",
"def create\n @hostel = Hostel.new(params[:hostel])\n\n respond_to do |format|\n if @hostel.save\n format.html { redirect_to(@hostel, :notice => 'Hostel was successfully created.') }\n format.xml { render :xml => @hostel, :status => :created, :location => @hostel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @hostel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_database(name, host:)\n add_host(host) unless hosts[host]\n if hosts.dig host, :databases, name\n raise \"Database '#{name}' on '#{host}' already configured\"\n end\n db = hosts[host][:databases][name] = db_template\n yield(db) if block_given?\n @saved = false\n end",
"def addHost(host)\n\t\[email protected](host)\n\tend",
"def addhost(host_name)\n call_rpc_for_target(ZONE_METHODS[:addhost], host_name)\n end",
"def create\n @host_tpl = HostTpl.new(params[:host_tpl])\n\n respond_to do |format|\n if @host_tpl.save\n format.html { redirect_to @host_tpl, notice: 'Host tpl was successfully created.' }\n format.json { render json: @host_tpl, status: :created, location: @host_tpl }\n else\n format.html { render action: \"new\" }\n format.json { render json: @host_tpl.errors, status: :unprocessable_entity }\n end\n end\n end",
"def on_db_host(context, host)\n\tend",
"def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end",
"def on_db_host(host)\n\tend",
"def create\n database.command({ :create => name }.merge(options))\n end",
"def create_task(data)\n pid = data[\"project_id\"]\n priority = data[\"priority\"]\n description = data[\"description\"]\n status = false\n\n response = @db.exec_params(%Q[\n INSERT INTO tasks(project_id, priority, description, status)\n VALUES ($1, $2, $3, $4)\n RETURNING id;\n ], [pid, priority, description, status])\n\n response.first[\"id\"]\n end",
"def create_dns_record(domain, hostname, type, content, ttl, priority = nil)\n body = {\n 'hostname' => hostname,\n 'type' => type,\n 'content' => content,\n 'ttl' => ttl\n }\n body.update!(:priority => priority) if priority\n connection.post \"/dns/create/#{domain}\", body\n end",
"def create_pg(one_vnet, esx_host)\n begin\n # Get parameters needed to create the network\n pnics = one_vnet['TEMPLATE/PHYDEV']\n pg_name = one_vnet['TEMPLATE/BRIDGE']\n sw_name = one_vnet['TEMPLATE/VCENTER_SWITCH_NAME']\n mtu = one_vnet['TEMPLATE/MTU']\n vlan_id = one_vnet['VLAN_ID'] || 0\n\n if one_vnet['TEMPLATE/VCENTER_SWITCH_NPORTS']\n nports = one_vnet['TEMPLATE/VCENTER_SWITCH_NPORTS']\n else\n nports = 128\n end\n esx_host.lock # Exclusive lock for ESX host operation\n\n pnics_available = nil\n pnics_available = esx_host.get_available_pnics if pnics\n\n # Get port group if it exists\n pg = esx_host.pg_exists(pg_name)\n\n # Disallow changes of switch name for existing pg\n if pg && esx_host.pg_changes_sw?(pg, sw_name)\n err_msg = 'The port group already exists in this host '\\\n 'for a different vCenter standard switch and '\\\n 'this kind of hange is not supported.'\n raise CreateNetworkError, err_msg\n end\n\n # Pg does not exist\n if !pg\n # Get standard switch if it exists\n vs = esx_host.vss_exists(sw_name)\n\n if !vs\n sw_name = esx_host.create_vss(sw_name,\n pnics,\n nports,\n mtu,\n pnics_available)\n end\n\n new_pg = esx_host.create_pg(pg_name, sw_name, vlan_id)\n else\n err_msg = \"Port group #{pg_name} already exists\"\n raise CreateNetworkError, err_msg\n end\n new_pg\n ensure\n esx_host.unlock if esx_host # Remove lock\n end\nend",
"def create_schema\n Apartment::Database.create(subdomain)\n end",
"def create_record(fqdn, type, ipdata)\n unless @dnss.is_valid?\n Puppet.crit dns.cstatus\n end\n priority = {} # TODO: research how to implement priority for puppet\n# priority = priority[0]\n# if priority.nil?\n# priority = {}\n# else\n# priority = { :priority => priority.to_i }\n# end\n record = @dnss.create_record(fqdn, type, ipdata, priority)\n if record.nil?\n Puppet.err dns.cstatus\n end\n Puppet.notice \"Created dns record '#{fqdn}' with id '#{record[:id]}'.\"\n end",
"def create_db(database)\n @conn.query({url_path: database, method: :put})\n end",
"def create_pg\n #-----------------------------------------------------------------------\n # Get parameters needed to create the network\n #-----------------------------------------------------------------------\n vlan_id = self['VLAN_ID'] || \"0\"\n pg_name = self['BRIDGE']\n pnics = self['TEMPLATE/PHYDEV']\n sw_name = self['TEMPLATE/VCENTER_SWITCH_NAME']\n mtu = self['TEMPLATE/MTU']\n nports = self['TEMPLATE/VCENTER_SWITCH_NPORTS']\n\n nports = 128 if nports.empty?\n mtu = nil if mtu.empty?\n pnics = nil if pnics.empty?\n\n esxs = []\n newpgs = []\n errors = []\n\n #-----------------------------------------------------------------------\n # Initialize a ESX references for all ESX in all Clusters\n #-----------------------------------------------------------------------\n @clusters.each do |cluster|\n cli = cluster[:cli]\n\n cluster[:ccr]['host'].each do |host|\n esxs << VCenterDriver::ESXHost.new_from_ref(host._ref, cli)\n end\n end\n\n #-----------------------------------------------------------------------\n # Check PG does not exists and create it on all ESX hosts\n #-----------------------------------------------------------------------\n esxs.each do |esx|\n pg = esx.pg_exists(pg_name)\n raise \"Port Group #{pg_name} already exists\" if pg\n end\n\n esxs.each do |esx|\n begin\n apnic = nil\n apnic = esx.available_pnics if pnics\n\n vs = esx.vss_exists(sw_name)\n\n esx.create_vss(sw_name, nports, pnics, mtu, apnic) unless vs\n\n newpgs << esx.create_pg(pg_name, sw_name, vlan_id)\n rescue StandardError => e\n msg = \"\\tHost #{esx['name']}. Reason: \\\"#{e.message}\\\".\\n\"\n msg << \"#{e.backtrace}\\n\" if @debug\n\n errors << msg\n end\n end\n\n #-----------------------------------------------------------------------\n # Sanity Check all new_pg references should be the same\n # Rollback PG creation in case of any error\n #-----------------------------------------------------------------------\n unless errors.empty?\n message = \"Error adding port group to hosts:\\n\"\n message << errors.join\n\n esxs.each do |esx|\n begin\n esx.network_rollback\n rescue StandardError => e\n message << \"Error in rollback for #{esx['name']}: #{e.message}\\n\"\n end\n end\n\n raise message\n end\n\n raise \"Different PG refs!:\\n#{newpgs}\" if newpgs.uniq.length != 1\n\n \"VCENTER_NET_REF = \\\"#{newpgs[0]}\\\"\\n\"\\\n \"VCENTER_INSTANCE_ID = \\\"#{@clusters[0][:uuid]}\\\"\\n\"\n end",
"def create_dpg\n #-----------------------------------------------------------------------\n # Get parameters needed to create the network\n #-----------------------------------------------------------------------\n vlan_id = self['VLAN_ID'] || \"0\"\n pg_name = self['BRIDGE']\n pnics = self['TEMPLATE/PHYDEV']\n sw_name = self['TEMPLATE/VCENTER_SWITCH_NAME']\n mtu = self['TEMPLATE/MTU']\n nports = self['TEMPLATE/VCENTER_SWITCH_NPORTS']\n\n nports = 128 if nports.empty?\n mtu = nil if mtu.empty?\n pnics = nil if pnics.empty?\n\n #-----------------------------------------------------------------------\n # Use first cluster/dc to check the distributed portgroup\n #-----------------------------------------------------------------------\n dc = @clusters[0][:dc]\n\n raise \"vCenter Dataceter not initialized\" unless dc\n\n net_folder = dc.network_folder\n net_folder.fetch!\n\n dpg = dc.dpg_exists(pg_name, net_folder)\n\n # Disallow changes of switch name for existing pg\n raise \"Port group #{pg_name} already exists\" if dpg\n\n # Get distributed virtual switch if it exists\n dvs = dc.dvs_exists(sw_name, net_folder)\n dvs = dc.create_dvs(sw_name, pnics, mtu) unless dvs\n\n raise \"Cannot create Distributed Virtual Switch\" unless dvs\n\n # Creates distributed port group\n # TODO raise?\n new_dpg = dc.create_dpg(dvs, pg_name, vlan_id, nports)\n\n #-----------------------------------------------------------------------\n # Attach dpg to esxi hosts for each cluster\n #-----------------------------------------------------------------------\n errors = []\n\n @clusters.each do |cluster|\n cli = cluster[:cli]\n\n cluster[:ccr]['host'].each do |host|\n begin\n esx = VCenterDriver::ESXHost.new_from_ref(host._ref, cli)\n\n avail_pnics = nil\n avail_pnics = esx.available_pnics if pnics\n\n esx.assign_proxy_switch(dvs, sw_name, pnics, avail_pnics)\n rescue StandardError => e\n msg = \"\\tHost #{host._ref}. Reason: \\\"#{e.message}\\\".\\n\"\n msg << \"#{e.backtrace}\\n\" if @debug\n\n errors << msg\n end\n end\n end\n\n #-----------------------------------------------------------------------\n # Rollback DPG creation in case of any error\n #-----------------------------------------------------------------------\n unless errors.empty?\n message = \"Error adding distributed port group to hosts:\\n\"\n message << errors.join\n\n dc.network_rollback\n\n raise message\n end\n\n \"VCENTER_NET_REF = \\\"#{new_dpg}\\\"\\n\"\\\n \"VCENTER_INSTANCE_ID = \\\"#{@clusters[0][:uuid]}\\\"\\n\"\n end",
"def host_params\n params.require(:host).permit(:mac, :nome, :descricao, :ativo, :validade, :rede_id, :memorando)\n end",
"def create_house_info(db, address, price, years_of_mortgage, interest_rate, monthly_pmt)\n\tdb.execute(\"INSERT INTO house_info (address, price, years_of_mortgage, interest_rate, monthly_pmt) VALUES (?, ?, ?, ?, ?)\", [address, price, years_of_mortgage, interest_rate, monthly_pmt])\nend",
"def create_node(quorum_hosts, path, data)\n # walk tree creating any necessary znodes:\n unless get_node_data(quorum_hosts, path)\n Chef::Log.debug \"Did not find node: #{path}\"\n\n # affect a mkdir -p equivalent\n pieces = path.split(File::SEPARATOR)\n pieces = pieces.map.with_index do |_, i|\n # create an ascending list of paths e.g.\n # ['/foo', '/foo/bar', '/foo/bar/baz', etc.]\n pieces.slice(0, i + 1).join(File::SEPARATOR)\n end\n pieces = pieces.select do |p|\n !p.empty? && !get_node_data(quorum_hosts, p)\n end\n\n # create parent nodes\n run_zk_block(quorum_hosts) do |zk|\n pieces.slice(0, pieces.length - 1).each do |p|\n ret = zk.create(path: p, data: '')\n Chef::Log.debug \"Tried to create node: #{p}; #{ret}\"\n unless ret[:rc].zero?\n raise ::LockingResource::Helper::LockingResourceException,\n \"Failed to create: #{p}\"\n end\n end\n end\n end # unless get_node_Data(quorum_hosts, parent_path)\n\n run_zk_block(quorum_hosts) do |zk|\n ret = zk.create(path: path, data: data)\n Chef::Log.debug \"Tried to create node: #{path}; #{ret}\"\n ret[:rc].zero?\n end ? true : false\n end",
"def create_vhost(vhost_name)\n `curl -s -i -L \\\n -u Conn[:creds] \\\n -H 'content-type:application/json' \\\n -XPUT #{[Conn[:host_api], 'vhosts', vhost_name].join('/')}`\n end",
"def create\n @database = Database.new(database_params)\n @database.name = @database.name.downcase\n @database.user = @user[\"uid\"]\n @database.password = SecureRandom.urlsafe_base64(16)\n result = true\n if @database.postgres?\n result = create_postgresql_db(@database.name, @database.password)\n end\n\n if @database.mysql?\n result = create_mysql_db(@database.name, @database.password)\n end\n\n if result then\n result = @database.save\n end\n\n respond_to do |format|\n if result\n format.html { redirect_to @database, notice: 'La base de données à bien été créée.' }\n format.json { render :show, status: :created, location: @database }\n else\n format.html { render :new }\n format.json { render json: @database.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_eth_address_in_db\n\n ClientAddress.create(\n client_id: @client_id,\n ethereum_address: @encrypted_eth_address,\n hashed_ethereum_address: @hashed_eth_address,\n address_salt: @address_salt[:ciphertext_blob],\n status: GlobalConstant::ClientAddress.active_status\n )\n\n CacheManagement::ClientAddress.new([@client_id]).clear\n\n success\n\n end",
"def new\n @host = Host.new\n end",
"def create_hotel(name:, address:)\n Hotel.create(\n name: name,\n address: address\n )\nend",
"def create_target(host,port,ssl,sel)\n\t\ttar = Target.create(\n\t\t\t\t:host => host, \n\t\t\t\t:port => port, \n\t\t\t\t:ssl => ssl, \n\t\t\t\t:selected => sel\n\t\t\t)\n\t\ttar.save\t\n\t\t#framework.events.on_db_target(context, rec)\n\tend",
"def create(data)\n @planet_model.create(data)\n end",
"def add_host(name, port = nil)\n raise \"Host '#{name}' already configured\" if hosts[name]\n hosts[name] = { port: port, databases: {} }\n @saved = false\n end",
"def run_host(ip)\n\t\tuser = datastore['USERNAME']\n\t\tpass = postgres_password\n\t\tdo_fingerprint(user,pass,datastore['DATABASE'],datastore['VERBOSE'])\n\tend",
"def create\n chef_server_rest.post(\"data/#{data_bag}\", self)\n self\n end",
"def add_host(new_host)\n @hosts.push(new_host)\n end",
"def find_or_create_host(opts)\n host = get_host(opts.clone)\n return host unless host.nil?\n\n report_host(opts)\n end",
"def host=(new_host); end",
"def host_params\n params.fetch(:host, {}).permit(:ip, :fqdn, :netbios_name, :mac_address, :cpe, :platform, :operating_system, :system_type, :data_source_id)\n end",
"def set_host_address\n @host_address = HostAddress.find(params[:id])\n end",
"def create(data) # rubocop:disable Rails/Delegate\n client.create(data)\n end",
"def host_params\n params.require(:host).permit(:name, :web_link, :market_info)\n end",
"def update_host(host, ip_list)\n validate_list([[\"Host\", host, :presence], [\"IP_List\", ip_list, :presence]])\n options = {\"Host\" => host, \"IP_List\" => ip_list}\n\n connection = Connection.new\n connection.post(\"Domain/Host/Update\", options)\n end",
"def create\n @site = Site.new(params[:site])\n \n # Domain Name\n re='((?:[a-z][a-z\\\\.\\\\d\\\\-]+)\\\\.(?:[a-z][a-z\\\\-]+))(?![\\\\w\\\\.])'\t\n @m=Regexp.new(re,Regexp::IGNORECASE)\n @host = @m.match(@site.linkws)[1] \n @site.host = @host\n \n respond_to do |format|\n if @site.save\n format.html { redirect_to @site, notice: 'Site was successfully created.' }\n format.json { render json: @site, status: :created, location: @site }\n else\n format.html { render action: \"new\" }\n format.json { render json: @site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(data={})\n object = self.new(data)\n object.save\n end",
"def create(database)\n <<-EOS.chomp\n#{database[:id]} = #{database[:database].singularize.capitalize}.new(\n#{indent(field_param(database[:fields]), 1)}\n)\nresponse[:_db_errors][:#{database[:id]}] = #{database[:id]}.errors.full_messages unless #{database[:id]}.save\n EOS\n end",
"def create\n\t @host = Host.new(params[:host])\n\t @domain = Setting.get 'domain'\n\n\t respond_to do |format|\n\t if @host.save\n\t format.html do\n\t \t\t@net = Setting.get('net')\n\t \t\t@self = [@net, Setting.get('self-address')].join '.'\n\t \t\truby_code_from_view.ruby_code_from_view do |rb_from_view|\n ::Temple::Utils.escape_html((@locale_direction)) \n ::Temple::Utils.escape_html((I18n.locale)) \n ::Temple::Utils.escape_html((I18n.locale)) \n ::Temple::Utils.escape_html((full_page_title)) \n ::Temple::Utils.escape_html((stylesheet_link_tag 'application')) \n if theme.name != \"default\" and theme.disable_inheritance == false\n \n ::Temple::Utils.escape_html((stylesheet_link_tag(theme_stylesheet_path('style', theme.default)))) \n ::Temple::Utils.escape_html((stylesheet_link_tag(theme_stylesheet_path('rtl', theme.default)) if rtl?)) \n end \n ::Temple::Utils.escape_html((theme_stylesheet_link_tag 'style')) \n ::Temple::Utils.escape_html((theme_stylesheet_link_tag('rtl') if rtl?)) \n amahi_plugins.each do |p|\n \n ::Temple::Utils.escape_html((stylesheet_link_tag p[:class].underscore)) \n end \n ::Temple::Utils.escape_html((javascript_include_tag 'http://html5shim.googlecode.com/svn/trunk/html5.js')) \n ::Temple::Utils.escape_html((javascript_tag { ::Temple::Utils.escape_html((theme_image_path('ok.png').html_safe)) \n ::Temple::Utils.escape_html((theme_image_path('warning.png').html_safe)) \n})) \n ::Temple::Utils.escape_html((javascript_include_tag 'application')) \n amahi_plugins.each do |p|\n \n ::Temple::Utils.escape_html((javascript_include_tag p[:class].underscore)) \n end \n ::Temple::Utils.escape_html((javascript_tag {'$.fx.off = true;' if Rails.env.test?})) \n for header in theme.headers do\n \n ::Temple::Utils.escape_html((header =~ /\\.js$/ ? javascript_include_tag(header) : header)) \n end \n ::Temple::Utils.escape_html((csrf_meta_tags)) \n ::Temple::Utils.escape_html(( ::Temple::Utils.escape_html((link_to t('amahi'), root_url)) \n ::Temple::Utils.escape_html((link_to t('home'), root_path)) \n ::Temple::Utils.escape_html(( _slim_controls1 = form_tag search_path(action: 'hda'), method: 'get', id: 'searchform' do\n \n ::Temple::Utils.escape_html((text_field_tag 'query', @query, :maxlength => 45, :size => 20, :class => \"ip-input\", :id => 'searchinput')) \n ::Temple::Utils.escape_html((submit_tag 'HDA', :class => 'searchbutton', :name => \"button\" , :id => 'hdasearchbutton')) \n ::Temple::Utils.escape_html((submit_tag t('web'), :class => 'searchbutton', :name => \"button\" , :id => 'websearchbutton')) \n end \n ::Temple::Utils.escape_html((_slim_controls1)) \n)) \n _slim_codeattributes1 = root_path; if _slim_codeattributes1; if _slim_codeattributes1 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes1)) \n end; end \n ::Temple::Utils.escape_html((t('home'))) \n if current_user_is_admin?\n \n _slim_codeattributes2 = users_engine.root_path; if _slim_codeattributes2; if _slim_codeattributes2 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes2)) \n end; end \n ::Temple::Utils.escape_html((t('setup'))) \n ::Temple::Utils.escape_html((t('help'))) \n _slim_codeattributes3 = apps_engine.root_path; if _slim_codeattributes3; if _slim_codeattributes3 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes3)) \n end; end \n ::Temple::Utils.escape_html((t('apps'))) \n else\n \n ::Temple::Utils.escape_html((t('help'))) \n end \n ::Temple::Utils.escape_html((page_title)) \n)) \n ::Temple::Utils.escape_html(( ::Temple::Utils.escape_html((page_title)) \n)) \n ::Temple::Utils.escape_html(( flash.each do |name, msg|\n \n ::Temple::Utils.escape_html((name)) \n ::Temple::Utils.escape_html((msg)) \n end \n)) \n unless @no_tabs\n \n ::Temple::Utils.escape_html(( _temple_html_attributeremover1 = ''; _temple_html_attributemerger1 = []; _temple_html_attributemerger1[0] = \"preftab\"; _temple_html_attributemerger1[1] = ''; _slim_codeattributes1 = nav_class(@tabs); if Array === _slim_codeattributes1; _slim_codeattributes1 = _slim_codeattributes1.flatten; _slim_codeattributes1.map!(&:to_s); _slim_codeattributes1.reject!(&:empty?); _temple_html_attributemerger1[1] << ((::Temple::Utils.escape_html((_slim_codeattributes1.join(\" \")))).to_s); else; _temple_html_attributemerger1[1] << ((::Temple::Utils.escape_html((_slim_codeattributes1))).to_s); end; _temple_html_attributemerger1[1]; _temple_html_attributeremover1 << ((_temple_html_attributemerger1.reject(&:empty?).join(\" \")).to_s); _temple_html_attributeremover1 \n if !_temple_html_attributeremover1.empty? \n _temple_html_attributeremover1 \n end \n @tabs.each do |tab|\n \n _temple_html_attributeremover2 = ''; _slim_codeattributes2 = tab_class(tab); if Array === _slim_codeattributes2; _slim_codeattributes2 = _slim_codeattributes2.flatten; _slim_codeattributes2.map!(&:to_s); _slim_codeattributes2.reject!(&:empty?); _temple_html_attributeremover2 << ((::Temple::Utils.escape_html((_slim_codeattributes2.join(\" \")))).to_s); else; _temple_html_attributeremover2 << ((::Temple::Utils.escape_html((_slim_codeattributes2))).to_s); end; _temple_html_attributeremover2 \n if !_temple_html_attributeremover2.empty? \n _temple_html_attributeremover2 \n end \n _slim_codeattributes3 = tab.url; if _slim_codeattributes3; if _slim_codeattributes3 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes3)) \n end; end \n ::Temple::Utils.escape_html((t tab.label)) \n ::Temple::Utils.escape_html((tab.label.downcase)) \n if @advanced\ntab.advanced_subtabs.each do |subtab|\n \n _temple_html_attributeremover3 = ''; _slim_codeattributes4 = subtab_class(subtab.id,tab.id); if Array === _slim_codeattributes4; _slim_codeattributes4 = _slim_codeattributes4.flatten; _slim_codeattributes4.map!(&:to_s); _slim_codeattributes4.reject!(&:empty?); _temple_html_attributeremover3 << ((::Temple::Utils.escape_html((_slim_codeattributes4.join(\" \")))).to_s); else; _temple_html_attributeremover3 << ((::Temple::Utils.escape_html((_slim_codeattributes4))).to_s); end; _temple_html_attributeremover3 \n if !_temple_html_attributeremover3.empty? \n _temple_html_attributeremover3 \n end \n ::Temple::Utils.escape_html((link_to t(subtab.label), subtab.url)) \n end; else\ntab.basic_subtabs.each do |subtab|\n \n _temple_html_attributeremover4 = ''; _slim_codeattributes5 = subtab_class(subtab.id,tab.id); if Array === _slim_codeattributes5; _slim_codeattributes5 = _slim_codeattributes5.flatten; _slim_codeattributes5.map!(&:to_s); _slim_codeattributes5.reject!(&:empty?); _temple_html_attributeremover4 << ((::Temple::Utils.escape_html((_slim_codeattributes5.join(\" \")))).to_s); else; _temple_html_attributeremover4 << ((::Temple::Utils.escape_html((_slim_codeattributes5))).to_s); end; _temple_html_attributeremover4 \n if !_temple_html_attributeremover4.empty? \n _temple_html_attributeremover4 \n end \n ::Temple::Utils.escape_html((link_to t(subtab.label), subtab.url)) \n end; end \n end \n)) \n if hosts.size > 0 \nt 'name' \nt 'static_ip_address' \n \n\tname = [h(one.host), @domain].join '.'\n\tname = h($1) if one.host =~ /(.*)\\.$/\n\t(base, addr) = case one.address\n\t\t\twhen ''\n\t\t\t\t[@net, @self]\n\t\t\twhen /^\\d+$/\n\t\t\t\t[@net, [@net, h(one.address)].join('.')]\n\t\t\telse\n\t\t\t\t['', h(one.address)]\n\t\tend\n\tdelete_icon = theme_image_tag(\"delete\", :title => t('delete_static_ip'))\n\twake_icon = theme_image_tag(\"wake\", :title => t('awake_this_device_via_wol'))\n\tuid = one.id.to_s\n\ttoggler = update_page do |page|\n\t\t\trow = \"host_row_\" + uid\n\t\t\tinfo = \"host_info_\" + uid\n\t\t\tpage.toggle info\n\t\t\tpage[row].toggle_class_name \"settings-row-open\"\n\t\t end\n\n uid \n h toggler \n link_to(h(name), '') \n uid \n h(addr) \n uid \nt 'edit_static_ip' \n h(one.host) \n spinner uid \nt 'delete_static_ip' \n link_to_remote(delete_icon,\n\t\t\t\t\t:update => 'hosts-table',\n\t\t\t\t\t:confirm => t('are_you_sure_you_want_to_delete_the_static_ip', :name => name),\n\t\t\t\t\t:before => \"Element.show('spinner-#{uid}')\",\n\t\t\t\t\t:success => \"Element.hide('spinner-#{uid}')\",\n\t\t\t\t\t:url => { :controller => 'hosts', :action => 'delete', :id => uid }) \nt 'awake_this_device_via_wol'\n uid \n link_to_remote(wake_icon,\n\t\t\t\t\t\t\t:before => \"Element.show('spinner-#{uid}')\",\n\t\t\t\t\t\t\t:success => \"Element.hide('spinner-#{uid}')\",\n\t\t\t\t\t\t\t:url => { :controller => 'hosts', :action => 'wake_system', :id => uid }) \nt 'ip_address' \n base.blank? ? '' : base + '.' \n editable_content(\n\t\t\t\t\t\t:content => {\n\t\t\t\t\t\t :element => 'span',\n\t\t\t\t\t\t :text => h(one.address),\n\t\t\t\t\t\t :options => {\n\t\t\t\t\t\t :id => \"host_address_#{uid}\",\n\t\t\t\t\t\t :class => 'editable'\n\t\t\t\t\t\t }\n\t\t\t\t\t\t },\n\t\t\t\t\t\t:url => {\n\t\t\t\t\t\t :controller => 'hosts',\n\t\t\t\t\t\t :action => 'update_address',\n\t\t\t\t\t\t :id => uid\n\t\t\t\t\t\t}) \nt 'mac_address' \n editable_content(\n\t\t\t\t\t\t:content => {\n\t\t\t\t\t\t :element => 'span',\n\t\t\t\t\t\t :text => h(one.mac),\n\t\t\t\t\t\t :options => {\n\t\t\t\t\t\t :id => \"host_mac_#{uid}\",\n\t\t\t\t\t\t :class => 'editable'\n\t\t\t\t\t\t }\n\t\t\t\t\t\t },\n\t\t\t\t\t\t:url => {\n\t\t\t\t\t\t :controller => 'hosts',\n\t\t\t\t\t\t :action => 'update_mac',\n\t\t\t\t\t\t :id => uid\n\t\t\t\t\t\t}) \nt 'location' \n link_to h(name), \"http://#{h(name)}\", { :target => \"_blank\" } \n \n else \nt 'there_are_no_static_ips_defined' \n end \n \n button_to \" #{t('new_static_ip')} » \", update_page { |page|\n \tpage.hide 'new-host-to-step1'\n \tpage[:host_host].value = \"\"\n \tpage[:host_address].value = \"\"\n\tpage[:host_address].disabled = true\n \tpage[:host_mac].value = \"\"\n\tpage[:host_mac].disabled = true\n\tpage[:host_create_button].disabled = true\n\tpage.select(\".messages\").each do |item|\n\t\tpage.send 'replace_html', item, \"\"\n\tend\n \tpage.show 'new-host-step1'\n \tpage[:host_host].focus\n }, :id => \"new-host-to-step1\" \n error_messages_for :host \n t 'new_static_ip' \n form_for(newhost) do |f| \n f.error_messages \nt 'name' \n f.text_field :host, :size => 12, :maxlength => 32 \n @domain \nt 'the_name_you_input_above_will_be_added_to_the_DNS_server' \nt 'ip_address' \n @net \n f.text_field :address, :size => 4, :maxlength => 5 \nt('this_ip_address_will_always_be_statically_associated_to_the_mac_address', :max => @max) \nt 'mac_address' \n f.text_field :mac, :size => 17, :maxlength => 22 \nt 'mac_address_of_the_device' \n link_to t('cancel'), update_page { |page|\n\t\t\t\t\tpage.hide 'new-host-step1'\n\t\t\t\t\tpage.show 'new-host-to-step1'\n\t\t\t\t\tpage[:host_host].value = \"\"\n\t\t\t\t\tpage[:host_address].value = \"\"\n\t\t\t\t\tpage[:host_mac].value = \"\"\n\t\t\t\t\tpage.select(\".messages\").each do |item|\n\t\t\t\t\t\tpage.send 'replace_html', item, \"\"\n\t\t\t\t\tend\n\t\t\t\t\tpage[:host_address].disabled = true\n\t\t\t\t\tpage[:host_mac].disabled = true\n\t\t\t\t\tpage[:host_create_button].disabled = true\n\t\t\t\t } \n submit_to_remote \"create_host\", \" #{t('create')} » \",\n\t\t\t\t\t:url => { :controller => 'hosts', :action => 'create' },\n\t\t\t\t\t:html => { :id => \"host_create_button\", :disabled => true },\n\t\t\t\t\t:failure => \"alert('HTTP Error ' + request.status + '!')\",\n\t\t\t\t\t:update => { :success => \"hosts\", :failure => \"create_hosts_error_msgs\" } \n end \n observe_field 'host_host', :frequency => 0.5,\n\t\t\t:url => { :controller => 'hosts', :action => 'new_host_check' },\n\t\t\t:with => \"'host=' + encodeURIComponent(value)\" \n observe_field 'host_address', :frequency => 0.5,\n\t\t\t:url => { :controller => 'hosts', :action => 'new_address_check' },\n\t\t\t:with => \"'address=' + encodeURIComponent(value)\" \n observe_field 'host_mac', :frequency => 0.5,\n\t\t\t:url => { :controller => 'hosts', :action => 'new_mac_check' },\n\t\t\t:with => \"'mac=' + encodeURIComponent(value)\" \n \n \n \n else\n \n if hosts.size > 0 \nt 'name' \nt 'static_ip_address' \n \n\tname = [h(one.host), @domain].join '.'\n\tname = h($1) if one.host =~ /(.*)\\.$/\n\t(base, addr) = case one.address\n\t\t\twhen ''\n\t\t\t\t[@net, @self]\n\t\t\twhen /^\\d+$/\n\t\t\t\t[@net, [@net, h(one.address)].join('.')]\n\t\t\telse\n\t\t\t\t['', h(one.address)]\n\t\tend\n\tdelete_icon = theme_image_tag(\"delete\", :title => t('delete_static_ip'))\n\twake_icon = theme_image_tag(\"wake\", :title => t('awake_this_device_via_wol'))\n\tuid = one.id.to_s\n\ttoggler = update_page do |page|\n\t\t\trow = \"host_row_\" + uid\n\t\t\tinfo = \"host_info_\" + uid\n\t\t\tpage.toggle info\n\t\t\tpage[row].toggle_class_name \"settings-row-open\"\n\t\t end\n\n uid \n h toggler \n link_to(h(name), '') \n uid \n h(addr) \n uid \nt 'edit_static_ip' \n h(one.host) \n spinner uid \nt 'delete_static_ip' \n link_to_remote(delete_icon,\n\t\t\t\t\t:update => 'hosts-table',\n\t\t\t\t\t:confirm => t('are_you_sure_you_want_to_delete_the_static_ip', :name => name),\n\t\t\t\t\t:before => \"Element.show('spinner-#{uid}')\",\n\t\t\t\t\t:success => \"Element.hide('spinner-#{uid}')\",\n\t\t\t\t\t:url => { :controller => 'hosts', :action => 'delete', :id => uid }) \nt 'awake_this_device_via_wol'\n uid \n link_to_remote(wake_icon,\n\t\t\t\t\t\t\t:before => \"Element.show('spinner-#{uid}')\",\n\t\t\t\t\t\t\t:success => \"Element.hide('spinner-#{uid}')\",\n\t\t\t\t\t\t\t:url => { :controller => 'hosts', :action => 'wake_system', :id => uid }) \nt 'ip_address' \n base.blank? ? '' : base + '.' \n editable_content(\n\t\t\t\t\t\t:content => {\n\t\t\t\t\t\t :element => 'span',\n\t\t\t\t\t\t :text => h(one.address),\n\t\t\t\t\t\t :options => {\n\t\t\t\t\t\t :id => \"host_address_#{uid}\",\n\t\t\t\t\t\t :class => 'editable'\n\t\t\t\t\t\t }\n\t\t\t\t\t\t },\n\t\t\t\t\t\t:url => {\n\t\t\t\t\t\t :controller => 'hosts',\n\t\t\t\t\t\t :action => 'update_address',\n\t\t\t\t\t\t :id => uid\n\t\t\t\t\t\t}) \nt 'mac_address' \n editable_content(\n\t\t\t\t\t\t:content => {\n\t\t\t\t\t\t :element => 'span',\n\t\t\t\t\t\t :text => h(one.mac),\n\t\t\t\t\t\t :options => {\n\t\t\t\t\t\t :id => \"host_mac_#{uid}\",\n\t\t\t\t\t\t :class => 'editable'\n\t\t\t\t\t\t }\n\t\t\t\t\t\t },\n\t\t\t\t\t\t:url => {\n\t\t\t\t\t\t :controller => 'hosts',\n\t\t\t\t\t\t :action => 'update_mac',\n\t\t\t\t\t\t :id => uid\n\t\t\t\t\t\t}) \nt 'location' \n link_to h(name), \"http://#{h(name)}\", { :target => \"_blank\" } \n \n else \nt 'there_are_no_static_ips_defined' \n end \n \n button_to \" #{t('new_static_ip')} » \", update_page { |page|\n \tpage.hide 'new-host-to-step1'\n \tpage[:host_host].value = \"\"\n \tpage[:host_address].value = \"\"\n\tpage[:host_address].disabled = true\n \tpage[:host_mac].value = \"\"\n\tpage[:host_mac].disabled = true\n\tpage[:host_create_button].disabled = true\n\tpage.select(\".messages\").each do |item|\n\t\tpage.send 'replace_html', item, \"\"\n\tend\n \tpage.show 'new-host-step1'\n \tpage[:host_host].focus\n }, :id => \"new-host-to-step1\" \n error_messages_for :host \n t 'new_static_ip' \n form_for(newhost) do |f| \n f.error_messages \nt 'name' \n f.text_field :host, :size => 12, :maxlength => 32 \n @domain \nt 'the_name_you_input_above_will_be_added_to_the_DNS_server' \nt 'ip_address' \n @net \n f.text_field :address, :size => 4, :maxlength => 5 \nt('this_ip_address_will_always_be_statically_associated_to_the_mac_address', :max => @max) \nt 'mac_address' \n f.text_field :mac, :size => 17, :maxlength => 22 \nt 'mac_address_of_the_device' \n link_to t('cancel'), update_page { |page|\n\t\t\t\t\tpage.hide 'new-host-step1'\n\t\t\t\t\tpage.show 'new-host-to-step1'\n\t\t\t\t\tpage[:host_host].value = \"\"\n\t\t\t\t\tpage[:host_address].value = \"\"\n\t\t\t\t\tpage[:host_mac].value = \"\"\n\t\t\t\t\tpage.select(\".messages\").each do |item|\n\t\t\t\t\t\tpage.send 'replace_html', item, \"\"\n\t\t\t\t\tend\n\t\t\t\t\tpage[:host_address].disabled = true\n\t\t\t\t\tpage[:host_mac].disabled = true\n\t\t\t\t\tpage[:host_create_button].disabled = true\n\t\t\t\t } \n submit_to_remote \"create_host\", \" #{t('create')} » \",\n\t\t\t\t\t:url => { :controller => 'hosts', :action => 'create' },\n\t\t\t\t\t:html => { :id => \"host_create_button\", :disabled => true },\n\t\t\t\t\t:failure => \"alert('HTTP Error ' + request.status + '!')\",\n\t\t\t\t\t:update => { :success => \"hosts\", :failure => \"create_hosts_error_msgs\" } \n end \n observe_field 'host_host', :frequency => 0.5,\n\t\t\t:url => { :controller => 'hosts', :action => 'new_host_check' },\n\t\t\t:with => \"'host=' + encodeURIComponent(value)\" \n observe_field 'host_address', :frequency => 0.5,\n\t\t\t:url => { :controller => 'hosts', :action => 'new_address_check' },\n\t\t\t:with => \"'address=' + encodeURIComponent(value)\" \n observe_field 'host_mac', :frequency => 0.5,\n\t\t\t:url => { :controller => 'hosts', :action => 'new_mac_check' },\n\t\t\t:with => \"'mac=' + encodeURIComponent(value)\" \n \n \n \n end \n ::Temple::Utils.escape_html(( ::Temple::Utils.escape_html((Date.today.year)) \n ::Temple::Utils.escape_html((link_to \"Amahi\", \"http://www.amahi.org\", :target => \"_blank\")) \n ::Temple::Utils.escape_html((link_to t('your_control_panel'), 'https://www.amahi.org/user', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('feedback'),'https://www.amahi.org/feedback', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('wiki'), 'https://wiki.amahi.org/', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('tracker'), 'https://bugs.amahi.org', :target=>'_blank')) \n if theme.author\n \n ::Temple::Utils.escape_html((t('theme_by'))) \n ::Temple::Utils.escape_html((theme.author_url ? link_to(theme.author, theme.author_url) : \"#{theme.author} \")) \n ::Temple::Utils.escape_html((link_to t('live_help'), 'http://talk.amahi.org', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('forums'), 'https://forums.amahi.org', :target=>'_blank')) \n end; if current_user\n \n ::Temple::Utils.escape_html((link_to (t('logout') + \" \" + current_user.login), logout_path)) \n else\n \n ::Temple::Utils.escape_html((link_to t('log_in'), login_path)) \n end \n)) \n ::Temple::Utils.escape_html((yield :js_templates)) \n\nend\n\n\t \tend\n\t format.xml { render :xml => @host, :status => :created, :location => @host }\n\t else\n\t format.html { ruby_code_from_view.ruby_code_from_view do |rb_from_view|\n ::Temple::Utils.escape_html((@locale_direction)) \n ::Temple::Utils.escape_html((I18n.locale)) \n ::Temple::Utils.escape_html((I18n.locale)) \n ::Temple::Utils.escape_html((full_page_title)) \n ::Temple::Utils.escape_html((stylesheet_link_tag 'application')) \n if theme.name != \"default\" and theme.disable_inheritance == false\n \n ::Temple::Utils.escape_html((stylesheet_link_tag(theme_stylesheet_path('style', theme.default)))) \n ::Temple::Utils.escape_html((stylesheet_link_tag(theme_stylesheet_path('rtl', theme.default)) if rtl?)) \n end \n ::Temple::Utils.escape_html((theme_stylesheet_link_tag 'style')) \n ::Temple::Utils.escape_html((theme_stylesheet_link_tag('rtl') if rtl?)) \n amahi_plugins.each do |p|\n \n ::Temple::Utils.escape_html((stylesheet_link_tag p[:class].underscore)) \n end \n ::Temple::Utils.escape_html((javascript_include_tag 'http://html5shim.googlecode.com/svn/trunk/html5.js')) \n ::Temple::Utils.escape_html((javascript_tag { ::Temple::Utils.escape_html((theme_image_path('ok.png').html_safe)) \n ::Temple::Utils.escape_html((theme_image_path('warning.png').html_safe)) \n})) \n ::Temple::Utils.escape_html((javascript_include_tag 'application')) \n amahi_plugins.each do |p|\n \n ::Temple::Utils.escape_html((javascript_include_tag p[:class].underscore)) \n end \n ::Temple::Utils.escape_html((javascript_tag {'$.fx.off = true;' if Rails.env.test?})) \n for header in theme.headers do\n \n ::Temple::Utils.escape_html((header =~ /\\.js$/ ? javascript_include_tag(header) : header)) \n end \n ::Temple::Utils.escape_html((csrf_meta_tags)) \n ::Temple::Utils.escape_html(( ::Temple::Utils.escape_html((link_to t('amahi'), root_url)) \n ::Temple::Utils.escape_html((link_to t('home'), root_path)) \n ::Temple::Utils.escape_html(( _slim_controls1 = form_tag search_path(action: 'hda'), method: 'get', id: 'searchform' do\n \n ::Temple::Utils.escape_html((text_field_tag 'query', @query, :maxlength => 45, :size => 20, :class => \"ip-input\", :id => 'searchinput')) \n ::Temple::Utils.escape_html((submit_tag 'HDA', :class => 'searchbutton', :name => \"button\" , :id => 'hdasearchbutton')) \n ::Temple::Utils.escape_html((submit_tag t('web'), :class => 'searchbutton', :name => \"button\" , :id => 'websearchbutton')) \n end \n ::Temple::Utils.escape_html((_slim_controls1)) \n)) \n _slim_codeattributes1 = root_path; if _slim_codeattributes1; if _slim_codeattributes1 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes1)) \n end; end \n ::Temple::Utils.escape_html((t('home'))) \n if current_user_is_admin?\n \n _slim_codeattributes2 = users_engine.root_path; if _slim_codeattributes2; if _slim_codeattributes2 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes2)) \n end; end \n ::Temple::Utils.escape_html((t('setup'))) \n ::Temple::Utils.escape_html((t('help'))) \n _slim_codeattributes3 = apps_engine.root_path; if _slim_codeattributes3; if _slim_codeattributes3 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes3)) \n end; end \n ::Temple::Utils.escape_html((t('apps'))) \n else\n \n ::Temple::Utils.escape_html((t('help'))) \n end \n ::Temple::Utils.escape_html((page_title)) \n)) \n ::Temple::Utils.escape_html(( ::Temple::Utils.escape_html((page_title)) \n)) \n ::Temple::Utils.escape_html(( flash.each do |name, msg|\n \n ::Temple::Utils.escape_html((name)) \n ::Temple::Utils.escape_html((msg)) \n end \n)) \n unless @no_tabs\n \n ::Temple::Utils.escape_html(( _temple_html_attributeremover1 = ''; _temple_html_attributemerger1 = []; _temple_html_attributemerger1[0] = \"preftab\"; _temple_html_attributemerger1[1] = ''; _slim_codeattributes1 = nav_class(@tabs); if Array === _slim_codeattributes1; _slim_codeattributes1 = _slim_codeattributes1.flatten; _slim_codeattributes1.map!(&:to_s); _slim_codeattributes1.reject!(&:empty?); _temple_html_attributemerger1[1] << ((::Temple::Utils.escape_html((_slim_codeattributes1.join(\" \")))).to_s); else; _temple_html_attributemerger1[1] << ((::Temple::Utils.escape_html((_slim_codeattributes1))).to_s); end; _temple_html_attributemerger1[1]; _temple_html_attributeremover1 << ((_temple_html_attributemerger1.reject(&:empty?).join(\" \")).to_s); _temple_html_attributeremover1 \n if !_temple_html_attributeremover1.empty? \n _temple_html_attributeremover1 \n end \n @tabs.each do |tab|\n \n _temple_html_attributeremover2 = ''; _slim_codeattributes2 = tab_class(tab); if Array === _slim_codeattributes2; _slim_codeattributes2 = _slim_codeattributes2.flatten; _slim_codeattributes2.map!(&:to_s); _slim_codeattributes2.reject!(&:empty?); _temple_html_attributeremover2 << ((::Temple::Utils.escape_html((_slim_codeattributes2.join(\" \")))).to_s); else; _temple_html_attributeremover2 << ((::Temple::Utils.escape_html((_slim_codeattributes2))).to_s); end; _temple_html_attributeremover2 \n if !_temple_html_attributeremover2.empty? \n _temple_html_attributeremover2 \n end \n _slim_codeattributes3 = tab.url; if _slim_codeattributes3; if _slim_codeattributes3 == true \n else \n ::Temple::Utils.escape_html((_slim_codeattributes3)) \n end; end \n ::Temple::Utils.escape_html((t tab.label)) \n ::Temple::Utils.escape_html((tab.label.downcase)) \n if @advanced\ntab.advanced_subtabs.each do |subtab|\n \n _temple_html_attributeremover3 = ''; _slim_codeattributes4 = subtab_class(subtab.id,tab.id); if Array === _slim_codeattributes4; _slim_codeattributes4 = _slim_codeattributes4.flatten; _slim_codeattributes4.map!(&:to_s); _slim_codeattributes4.reject!(&:empty?); _temple_html_attributeremover3 << ((::Temple::Utils.escape_html((_slim_codeattributes4.join(\" \")))).to_s); else; _temple_html_attributeremover3 << ((::Temple::Utils.escape_html((_slim_codeattributes4))).to_s); end; _temple_html_attributeremover3 \n if !_temple_html_attributeremover3.empty? \n _temple_html_attributeremover3 \n end \n ::Temple::Utils.escape_html((link_to t(subtab.label), subtab.url)) \n end; else\ntab.basic_subtabs.each do |subtab|\n \n _temple_html_attributeremover4 = ''; _slim_codeattributes5 = subtab_class(subtab.id,tab.id); if Array === _slim_codeattributes5; _slim_codeattributes5 = _slim_codeattributes5.flatten; _slim_codeattributes5.map!(&:to_s); _slim_codeattributes5.reject!(&:empty?); _temple_html_attributeremover4 << ((::Temple::Utils.escape_html((_slim_codeattributes5.join(\" \")))).to_s); else; _temple_html_attributeremover4 << ((::Temple::Utils.escape_html((_slim_codeattributes5))).to_s); end; _temple_html_attributeremover4 \n if !_temple_html_attributeremover4.empty? \n _temple_html_attributeremover4 \n end \n ::Temple::Utils.escape_html((link_to t(subtab.label), subtab.url)) \n end; end \n end \n)) \n button_to \" #{t('new_static_ip')} » \", update_page { |page|\n \tpage.hide 'new-host-to-step1'\n \tpage[:host_host].value = \"\"\n \tpage[:host_address].value = \"\"\n\tpage[:host_address].disabled = true\n \tpage[:host_mac].value = \"\"\n\tpage[:host_mac].disabled = true\n\tpage[:host_create_button].disabled = true\n\tpage.select(\".messages\").each do |item|\n\t\tpage.send 'replace_html', item, \"\"\n\tend\n \tpage.show 'new-host-step1'\n \tpage[:host_host].focus\n }, :id => \"new-host-to-step1\" \n error_messages_for :host \n t 'new_static_ip' \n form_for(newhost) do |f| \n f.error_messages \nt 'name' \n f.text_field :host, :size => 12, :maxlength => 32 \n @domain \nt 'the_name_you_input_above_will_be_added_to_the_DNS_server' \nt 'ip_address' \n @net \n f.text_field :address, :size => 4, :maxlength => 5 \nt('this_ip_address_will_always_be_statically_associated_to_the_mac_address', :max => @max) \nt 'mac_address' \n f.text_field :mac, :size => 17, :maxlength => 22 \nt 'mac_address_of_the_device' \n link_to t('cancel'), update_page { |page|\n\t\t\t\t\tpage.hide 'new-host-step1'\n\t\t\t\t\tpage.show 'new-host-to-step1'\n\t\t\t\t\tpage[:host_host].value = \"\"\n\t\t\t\t\tpage[:host_address].value = \"\"\n\t\t\t\t\tpage[:host_mac].value = \"\"\n\t\t\t\t\tpage.select(\".messages\").each do |item|\n\t\t\t\t\t\tpage.send 'replace_html', item, \"\"\n\t\t\t\t\tend\n\t\t\t\t\tpage[:host_address].disabled = true\n\t\t\t\t\tpage[:host_mac].disabled = true\n\t\t\t\t\tpage[:host_create_button].disabled = true\n\t\t\t\t } \n submit_to_remote \"create_host\", \" #{t('create')} » \",\n\t\t\t\t\t:url => { :controller => 'hosts', :action => 'create' },\n\t\t\t\t\t:html => { :id => \"host_create_button\", :disabled => true },\n\t\t\t\t\t:failure => \"alert('HTTP Error ' + request.status + '!')\",\n\t\t\t\t\t:update => { :success => \"hosts\", :failure => \"create_hosts_error_msgs\" } \n end \n observe_field 'host_host', :frequency => 0.5,\n\t\t\t:url => { :controller => 'hosts', :action => 'new_host_check' },\n\t\t\t:with => \"'host=' + encodeURIComponent(value)\" \n observe_field 'host_address', :frequency => 0.5,\n\t\t\t:url => { :controller => 'hosts', :action => 'new_address_check' },\n\t\t\t:with => \"'address=' + encodeURIComponent(value)\" \n observe_field 'host_mac', :frequency => 0.5,\n\t\t\t:url => { :controller => 'hosts', :action => 'new_mac_check' },\n\t\t\t:with => \"'mac=' + encodeURIComponent(value)\" \n \n \n else\n \n button_to \" #{t('new_static_ip')} » \", update_page { |page|\n \tpage.hide 'new-host-to-step1'\n \tpage[:host_host].value = \"\"\n \tpage[:host_address].value = \"\"\n\tpage[:host_address].disabled = true\n \tpage[:host_mac].value = \"\"\n\tpage[:host_mac].disabled = true\n\tpage[:host_create_button].disabled = true\n\tpage.select(\".messages\").each do |item|\n\t\tpage.send 'replace_html', item, \"\"\n\tend\n \tpage.show 'new-host-step1'\n \tpage[:host_host].focus\n }, :id => \"new-host-to-step1\" \n error_messages_for :host \n t 'new_static_ip' \n form_for(newhost) do |f| \n f.error_messages \nt 'name' \n f.text_field :host, :size => 12, :maxlength => 32 \n @domain \nt 'the_name_you_input_above_will_be_added_to_the_DNS_server' \nt 'ip_address' \n @net \n f.text_field :address, :size => 4, :maxlength => 5 \nt('this_ip_address_will_always_be_statically_associated_to_the_mac_address', :max => @max) \nt 'mac_address' \n f.text_field :mac, :size => 17, :maxlength => 22 \nt 'mac_address_of_the_device' \n link_to t('cancel'), update_page { |page|\n\t\t\t\t\tpage.hide 'new-host-step1'\n\t\t\t\t\tpage.show 'new-host-to-step1'\n\t\t\t\t\tpage[:host_host].value = \"\"\n\t\t\t\t\tpage[:host_address].value = \"\"\n\t\t\t\t\tpage[:host_mac].value = \"\"\n\t\t\t\t\tpage.select(\".messages\").each do |item|\n\t\t\t\t\t\tpage.send 'replace_html', item, \"\"\n\t\t\t\t\tend\n\t\t\t\t\tpage[:host_address].disabled = true\n\t\t\t\t\tpage[:host_mac].disabled = true\n\t\t\t\t\tpage[:host_create_button].disabled = true\n\t\t\t\t } \n submit_to_remote \"create_host\", \" #{t('create')} » \",\n\t\t\t\t\t:url => { :controller => 'hosts', :action => 'create' },\n\t\t\t\t\t:html => { :id => \"host_create_button\", :disabled => true },\n\t\t\t\t\t:failure => \"alert('HTTP Error ' + request.status + '!')\",\n\t\t\t\t\t:update => { :success => \"hosts\", :failure => \"create_hosts_error_msgs\" } \n end \n observe_field 'host_host', :frequency => 0.5,\n\t\t\t:url => { :controller => 'hosts', :action => 'new_host_check' },\n\t\t\t:with => \"'host=' + encodeURIComponent(value)\" \n observe_field 'host_address', :frequency => 0.5,\n\t\t\t:url => { :controller => 'hosts', :action => 'new_address_check' },\n\t\t\t:with => \"'address=' + encodeURIComponent(value)\" \n observe_field 'host_mac', :frequency => 0.5,\n\t\t\t:url => { :controller => 'hosts', :action => 'new_mac_check' },\n\t\t\t:with => \"'mac=' + encodeURIComponent(value)\" \n \n \n end \n ::Temple::Utils.escape_html(( ::Temple::Utils.escape_html((Date.today.year)) \n ::Temple::Utils.escape_html((link_to \"Amahi\", \"http://www.amahi.org\", :target => \"_blank\")) \n ::Temple::Utils.escape_html((link_to t('your_control_panel'), 'https://www.amahi.org/user', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('feedback'),'https://www.amahi.org/feedback', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('wiki'), 'https://wiki.amahi.org/', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('tracker'), 'https://bugs.amahi.org', :target=>'_blank')) \n if theme.author\n \n ::Temple::Utils.escape_html((t('theme_by'))) \n ::Temple::Utils.escape_html((theme.author_url ? link_to(theme.author, theme.author_url) : \"#{theme.author} \")) \n ::Temple::Utils.escape_html((link_to t('live_help'), 'http://talk.amahi.org', :target=>'_blank')) \n ::Temple::Utils.escape_html((link_to t('forums'), 'https://forums.amahi.org', :target=>'_blank')) \n end; if current_user\n \n ::Temple::Utils.escape_html((link_to (t('logout') + \" \" + current_user.login), logout_path)) \n else\n \n ::Temple::Utils.escape_html((link_to t('log_in'), login_path)) \n end \n)) \n ::Temple::Utils.escape_html((yield :js_templates)) \n\nend\n }\n\t format.xml { render :xml => @host.errors, :status => :unprocessable_entity }\n\t end\n\t end\n\tend",
"def create\n\t\t@domain = Domain.new(:hostname => params[:hostname])\n\n\t\t# Attempt to save the domain, and return the appropriate JSON or Error\n\t\trespond_to do |format|\n\t\t\tif @domain.save\n\t\t\t\tformat.json { render json: @domain, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @domain.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\t\t\n\t\t# Fetch the hostname IP address and update the record in a new thread\n\t\tt1=Thread.new{fetch_origin_ip()}\n\t\tt1.join\n\tend",
"def player_creator(data_var,name)\r\n\tdata_var.execute(\"INSERT INTO players (name,placing) VALUES (?,?)\",[name,\"no place\"])\r\nend",
"def create\n @host_execution = HostExecution.new(host_execution_params)\n\n respond_to do |format|\n if @host_execution.save\n format.html { redirect_to @host_execution, notice: 'Host execution was successfully created.' }\n format.json { render :show, status: :created, location: @host_execution }\n else\n format.html { render :new }\n format.json { render json: @host_execution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add(host, key); end",
"def create(data = {})\n object = self.new(data)\n object.save\n object\n end",
"def description\n\t\t\"This task creates & associates a host for every object it is given.\"\n\tend"
] | [
"0.6863284",
"0.67643905",
"0.6671525",
"0.6619455",
"0.6499137",
"0.64914644",
"0.6365722",
"0.63007057",
"0.6248843",
"0.62192035",
"0.61798334",
"0.6173487",
"0.61419165",
"0.61309195",
"0.60721093",
"0.6055794",
"0.59897417",
"0.59808457",
"0.5977043",
"0.59646076",
"0.5928724",
"0.5846213",
"0.57986826",
"0.577785",
"0.5753195",
"0.5749308",
"0.5733408",
"0.57311827",
"0.5720335",
"0.57093346",
"0.5707686",
"0.57063466",
"0.56893104",
"0.5676262",
"0.5671521",
"0.5665524",
"0.5665524",
"0.5665524",
"0.5665524",
"0.56584424",
"0.5654289",
"0.56528604",
"0.5652832",
"0.5643041",
"0.5634445",
"0.56226397",
"0.56087995",
"0.5580427",
"0.55799365",
"0.5563977",
"0.55268013",
"0.55175906",
"0.5504278",
"0.54936683",
"0.54696923",
"0.5461984",
"0.54585",
"0.54524577",
"0.5438042",
"0.5411137",
"0.5397366",
"0.5392139",
"0.5387314",
"0.53832483",
"0.53784347",
"0.53444344",
"0.53403",
"0.53350633",
"0.5329174",
"0.5327056",
"0.5318505",
"0.53090346",
"0.5307766",
"0.53031844",
"0.52961624",
"0.5295105",
"0.52819896",
"0.527957",
"0.5259126",
"0.52538735",
"0.5232573",
"0.5229796",
"0.52251977",
"0.5213673",
"0.52123904",
"0.52122915",
"0.52065265",
"0.520595",
"0.52056295",
"0.5203376",
"0.51977736",
"0.51947856",
"0.5192963",
"0.51908517",
"0.5183775",
"0.5174467",
"0.5168224",
"0.5167766",
"0.5164707",
"0.51641285"
] | 0.82091707 | 0 |
Helper function to create a service in the DB [Parameters] data The data to create a service | def create_service(data=nil)
if (!data.blank? && data.is_a?(Hash))
@service = Service.create(data)
else
@service = Service.create(:name => "Test Service #{rand(1..1000)}", :description => "Test service description.", :active => true, :probe => "dummy", :probe_config => {:value => 1}, :interval => 60, :clean_interval => 86400, :priority => Service::PRIORITY_NORMAL, :resume => :mean_value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @service = Service.create(service_params)\n end",
"def create\n service = current_account.services.build\n create_service = ServiceCreator.new(service: service)\n create_service.call(service_params.to_h)\n service.reload if service.persisted? # It has been touched\n respond_with(service)\n end",
"def create\n service = current_account.services.build\n create_service = ServiceCreator.new(service: service)\n create_service.call(service_params)\n service.reload if service.persisted? # It has been touched\n respond_with(service)\n end",
"def create(data) # rubocop:disable Rails/Delegate\n client.create(data)\n end",
"def algolia_new_service\n services = Algolia::Index.new(\"services\")\n res = services.add_object({\"title\" => self.title, \"user_id\" => self.user_id, \"id\" => self.id, \"price\" => self.price, \"due_date\" => self.due_date,\n \"youtube_url\" => self.youtube_url, \"category\" => self.category, \"sub_category\" => self.sub_category, \"description\" => self.description,\n \"refund\" => self.refund, \"status\" => self.status, \"title_seo\" => self.title_seo})\n self.algolia_id = res[\"objectID\"]\n self.save\n end",
"def create\n super(@@service)\n end",
"def create\n submenu_item 'services-new'\n @service = Service.new(params[:service])\n @service_type = @service.type\n service_param\n\n @service.tenant_id = current_user.tenant_id\n\n # service_params = Service.extract_params(params[:service])\n # service_params = Service.extract_thresholds(service_params)\n # @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n flash[:notice] = \"#{@service.name}创建成功\"\n format.html { redirect_to(@service) }\n else\n dictionary\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n # service = params[:service]\n # @service = Service.new(description: service[:description], availablity: service[:availability], more_information: service[:more_information])\n @service = Service.new(service_params)\n @service.user = current_user \n @service.save\n end",
"def addservice\n\n @service = ServiceProvider.find_by(username: params[:serviceprovider][:username]);\n permitted = params[:serviceprovider].permit( :description, :category_id);\n @service.services.create(permitted);\n\n render json: @service\n\n\nend",
"def new_service(service)\n \tOrder.new(\n \t\torderNumber: 37592,\n \t\tservice: service,\n\t\t\torderType: \"установка розетки\",\n\t\t\tnameOrFIO: \"Нибелунг Зигфрид Беовульфыч\",\n\t\t\tstreet: \"бул. Амурский\",\n\t\t\thouse: 10,\n\t\t\tresponsiblePerson: \"Витя Кабан\",\n\t\t\tpersonType: \"Физ лицо\",\n\t\t\tformingDate: \"2013-11-13\")\n end",
"def create(data)\n @create_resource_mixin.create(data)\n end",
"def create\n service = current_account.create_service(service_params)\n service.reload if service.persisted? # It has been touched\n respond_with(service)\n end",
"def create_service_by_names(name, space_guid, service_plan_name, service_type_name)\n service = @client.services.select{ |srv| srv.label == service_type_name }\n\n if service != []\n service_plan_id = @client.service_plans_by_service_guid(service.first.guid).each.find { |current_plan| current_plan.name == service_plan_name }.guid\n create_service_instance(name, space_guid, service_plan_id)\n else\n return false\n end\n end",
"def create_operation(data)\n puts \"Importing Operation #{data[:invoice_num]}\"\n Operation.find_or_create_by(company_id: find_company_id(data[:company]),\n invoice_num: data[:invoice_num],\n invoice_date: parse_date(data[:invoice_date]),\n operation_date: parse_date(data[:operation_date]),\n amount: data[:amount] || 1.0,\n reporter: data[:reporter],\n notes: data[:notes],\n status: data[:status],\n kind: data[:kind] \n )\n end",
"def create\n @service = @page.services.new(params[:service])\n @service.user = current_user\n \n respond_to do |format|\n if @service.save\n format.html { redirect_to service_url(@page, @service), notice: 'Service was successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(data={})\n object = self.new(data)\n object.save\n end",
"def create\n @service = Service.new(service_params)\n if @service.save\n render json: @service, status: :created, location: @service\n else\n render json: @service.errors, status: :unprocessable_entity\n end\n end",
"def create\n @service = @enterprise.services.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to edit_service_path(@service), notice: 'El servicio ha sido creado satisfactoriamente.' }\n format.json { render :edit, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(data = {})\n object = self.new(data)\n object.save\n object\n end",
"def create\n @customer = Customer.find(params[:customer_id])\n @service = @customer.service.new(service_params)\n\n respond_to do |format|\n if @service.save\n \n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def add(data)\n create(data)\n end",
"def add(data)\n create(data)\n end",
"def create\n @service = Service.new(sp_company)\n if @service.save\n flash[:success] = \"A record add been succefully added\"\n redirect_to services_path\n else\n render 'new'\n end\n end",
"def initialize_service_for_create\n @service = service_class.new(hashified_params, service_options)\n end",
"def create(data)\n data.each do |response|\n puts person = @person_repository.create_or_find(response)\n homeworld_response = StarwarsService.get_response(response[\"homeworld\"])\n planet = @planet_repository.find(homeworld_response[\"name\"]).first\n person.planet_id = planet.id\n\n if response[\"species\"].empty? == false\n species_response = StarwarsService.get_response(response[\"species\"].first)\n specie = @specie_repository.find(species_response[\"name\"]).first\n person.specie_id = specie.id\n end\n person.save\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to services_url, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @supplier = Supplier.find(params[:supplier_id])\n @service = @supplier.services.create(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to supplier_path(@supplier), notice: 'Service was successfully created.' }\n format.json { render action: 'show', status: :created, location: @service }\n else\n format.html { render action: 'new' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = current_professional_user.services.build(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to meus_servicos_path }\n flash[:success] = 'Serviço adicionado com sucesso!'\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @vendor = Vendor.new(params[:vendor])\n\t\[email protected]_id = current_user.id\n respond_to do |format|\n if @vendor.save\n\t\t\t\tif params[:service]\n\t\t\t\t\tparams[:service].keys.each do |f| \n\t\t\t\t\t\[email protected](:name=>f,:is_active=>true)\n\t\t\t\t\tend\n\t\t\t\tend\n format.html { redirect_to @vendor, notice: 'Vendor was successfully created.' }\n format.json { render json: @vendor, status: :created, location: @vendor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def service_create(name, display_name, executable_on_host,startup=2)\n\t\tif session_has_services_depend?\n\t\t\tmeterpreter_service_create(name, display_name, executable_on_host,startup)\n\t\telse\n\t\t\tshell_service_create(name, display_name, executable_on_host,startup)\n\t\tend\n\tend",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n @service.user_id = current_user.username\n @service.nombre = @service.nombre.upcase\n @service.tipo = @service.tipo.upcase\n @service.descripcion = @service.descripcion.upcase\n @service.ubicacion = @service.ubicacion.upcase\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to services_url, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_service_contact(service, contact_data)\n contact = service.contacts.find_by(email: contact_data['contact_email']&.strip)\n if contact\n puts \" 👉 NB: contact for this service already exists so not creating them. \\\"#{contact_data['contact_email']}\\\".\"\n return contact.id\n else \n new_contact = service.contacts.new(\n name: contact_data['contact_name']&.strip,\n title: contact_data['contact_title']&.strip,\n visible: contact_data['contact_visible'].present? ? contact_data['contact_visible'] : false,\n email: contact_data['contact_email']&.strip,\n phone: contact_data['contact_phone']&.strip,\n )\n if new_contact.save\n puts \"🟢 Contact: \\\"#{new_contact.name}\\\" created (id: #{new_contact.id}).\"\n return new_contact.id\n else \n abort(\"🔴 Contact: \\\"#{new_contact.name}\\\" was not created. Exiting. #{new_contact.errors.messages}\")\n end\n end \n end",
"def crud_post(resource_name, service_name, primary_key_name, api_options = {})\n api_options = get_defaults(api_options)\n post '/'+resource_name do\n service = settings.send(service_name)\n\n # Get The data\n begin\n data = JSON.parse(request.body.read)\n rescue Exception => e\n return 422\n end\n\n # Valid POST?\n return 422 unless service.valid_insert?(data)\n\n # Already Exists?\n return 409 if service.exists_by_primary_key?(data[primary_key_name])\n\n # Do Insert\n record = service.insert(data)\n\n # Other Error\n return 500 if record.nil?\n\n # Output new record\n JSON.fast_generate record\n end\n end",
"def create\n @service = current_user.services.build(service_params)\n respond_to do |format|\n if @service.save\n format.html { redirect_to dashboard_path, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n chef_server_rest.post(\"data/#{data_bag}\", self)\n self\n end",
"def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n #format.html { redirect_to services_path, notice: 'Service was successfully created.' }\n\tflash[:notice]= 'Service was successfully created.'\n\tformat.html { redirect_to action: 'index'}\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n \n end\n end\n end",
"def create_database\n DATA[:accounts].each do |account|\n CalendarCoordinator::AccountService.create(data: account).save\n end\n\n account = CalendarCoordinator::Account.first\n DATA[:calendars].each do |calendar|\n account.add_owned_calendar(calendar)\n end\n end",
"def create_service(name, description)\n response = @client.post(\"/api/v1/services\", { \"name\" => name, \"description\" => description })\n return JSON.parse(response.body)\n end",
"def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end",
"def create_and_register_service(service_hash)\n # SystemDebug.debug(SystemDebug.services, :attach_ing_create_and_egister_service, service_hash)\n create_and_register_managed_service(service_hash)\n end",
"def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to(admin_service_path(@service), :notice => 'Service was successfully created.') }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @idti_service = IdtiService.new(idti_service_params)\n\n respond_to do |format|\n if @idti_service.save\n format.html { redirect_to @idti_service, notice: 'Idti service was successfully created.' }\n format.json { render :show, status: :created, location: @idti_service }\n else\n format.html { render :new }\n format.json { render json: @idti_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_service = Admin::Service.new(admin_service_regex_params)\n\n respond_to do |format|\n if @admin_service.save\n format.html { redirect_to @admin_service, notice: 'Platform was successfully created.' }\n format.json { render :show, status: :created, location: @admin_service }\n else\n format.html { render :new }\n format.json { render json: @admin_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(name: service_params[:name], current_request: request)\n @service = @service.becomes(service_params[:name].constantize) if @service.valid?\n @service.assign_attributes(service_params.merge({current_request: request}))\n @service.user = current_user\n\n respond_to do |format|\n if @service.save\n @service.authenticate\n format.html { redirect_to @service, notice: get_update_message('created') }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n @service.user_id = current_user.account_id\n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_vuln(context, service, name, data='')\n\t\tvuln = Vuln.find(:first, :conditions => [ \"name = ? and service_id = ?\", name, service.id])\n\t\tif (not vuln)\n\t\t\tvuln = Vuln.create(\n\t\t\t\t:service_id => service.id,\n\t\t\t\t:name => name,\n\t\t\t\t:data => data,\n\t\t\t\t:created => Time.now\n\t\t\t)\n\t\t\tvuln.save\n\t\t\tframework.events.on_db_vuln(context, vuln)\n\t\tend\n\n\t\treturn vuln\n\tend",
"def create(data)\n @planet_model.create(data)\n end",
"def save_services(current_user)\n error_urls = []\n existing_services = []\n new_wsdls = []\n server_data = services_factory().values.flatten\n \n unless server_data.empty?\n server_data.each{ |datum|\n url = datum['location']\n soap_service = SoapService.new({:wsdl_location => url})\n success, data = soap_service.populate\n dup = SoapService.check_duplicate(url, data[\"endpoint\"])\n if success and dup != nil\n existing_services << dup\n unless dup.latest_version.service_versionified.description_from_soaplab\n dup.latest_version.service_versionified.update_description_from_soaplab!(true)\n end\n logger.info(\"This service exists in the database\")\n else\n transaction do\n begin\n if success \n c_success = soap_service.submit_service( data[\"endpoint\"], current_user, {} ) \n if c_success\n new_wsdls << url\n soap_service.update_description_from_soaplab!(true) if soap_service\n logger.info(\"Registered service - #{url}. SUCCESS:\")\n else\n error_urls << url\n logger.error(\"post_create failed for service - #{url}. \")\n end\n end\n rescue Exception => ex\n error_urls << url\n logger.error(\"failed to register service - #{url}. soaplab registration Exception:\")\n logger.error(ex)\n end\n end\n end\n }\n end\n create_relationships(new_wsdls)\n create_tags(find_services_in_catalogue(new_wsdls), current_user)\n self.update_descriptions_from_soaplab!\n return [new_wsdls, existing_services, error_urls]\n end",
"def create\n @service = Service.new(service_params)\n @service.user_id = @user.id\n @service.co_confirmacion = @service.get_cod_confirmacion\n @service.status_id = 1\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to [@user,@service], notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params_map = ActiveSupport::HashWithIndifferentAccess.new(params[:services])\n @service = Service.new(params_map)\n @tenant = Tenant.find(session[:user_id])\n @property = Property.find(@tenant.property_id)\n @manager = Manager.find(@property.manager_id)\n @service.manager_id = @manager.id\n @service.property_id = @property.id\n @service.tenant_id = @tenant.id\n #sets resolved to false, only tenants have the ability to set these to completed\n @service.resolved = false\n if @service.save\n ServiceMailer.reminder(@service).deliver_now\n redirect_to '/tenants/show'\n else\n render \"new\"\n end\n end",
"def new_service_cost_option(service, cost_option_data)\n new_cost_option = service.cost_options.find_or_initialize_by(\n option: cost_option_data['cost_option'],\n amount: cost_option_data['cost_amount'],\n cost_type: cost_option_data['cost_type'],\n )\n if new_cost_option.save\n puts \" 🟢 Cost option: created (id: #{new_cost_option.id}).\"\n return new_cost_option\n else \n abort(\" 🔴 Cost option: was not created. Exiting. #{new_cost_option.errors.messages}\")\n end\n end",
"def create\n\n @service = Service.new(params[:service])\n respond_to do |format|\n if @service.save\n\n format.html { }\n format.xml { render :xml => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n #create line_up\n @lineup = Lineup.create(service: @service, mc: \"MC\")\n format.html { redirect_to services_url, notice: \"Service was successfully created. #{@lineup.id}\" }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_service_location(service, location_data)\n new_location = service.locations.new(\n name: location_data['location_name'],\n latitude: location_data['location_latitude'],\n longitude: location_data['location_longitude'],\n address_1: location_data['location_address_1'],\n city: location_data['location_city'],\n postal_code: location_data['location_postcode'],\n visible: location_data['location_visible'],\n mask_exact_address: location_data['mask_exact_address'],\n preferred_for_post: location_data['preferred_for_post'],\n skip_mongo_callbacks: true\n )\n\n if service.save\n puts \" 🟢 Location: \\\"#{new_location.name}\\\" created (id: #{new_location.id}).\"\n\n if location_data['location_accessibilities'].present?\n location_accessibilities = location_data['location_accessibilities'].split(';').collect(&:strip)\n location_accessibilities.each do |option|\n new_location.accessibilities.find_or_create_by({name: option.downcase.capitalize})\n end\n end\n\n return new_location\n else \n abort(\" 🔴 Location: \\\"#{new_location.name}\\\" was not created. Exiting. #{new_location.errors.messages}\")\n end\n end",
"def create\n @service_record = ServiceRecord.new(service_record_params)\n\n respond_to do |format|\n if @service_record.save\n format.json { render json: @service_record, serializer: ServiceRecordSerializer }\n else\n format.json { render json: @service_record.errors, status: :unprocessable_entity }\n end\n end\n end",
"def data_service\n DataServicesApi::Service.new(url: api_service_url)\n end",
"def create_service_instance(name, space_guid, service_plan_id)\n service_plan_instance = CFoundry::V2::ServicePlan.new(service_plan_id, @client)\n service_instance = @client.managed_service_instance\n service_instance.name = name\n service_instance.service_plan = service_plan_instance\n service_instance.space = @client.space(space_guid)\n service_instance.create!\n service_instance\n end",
"def add_service(service={})\n request :post, '/services', service\n end",
"def create_service_line\n @service_line = ServicePaymentEob.new(:details=>{:date_of_service_from_ocr_output=>\"\"})\n @insurance_payment_eob.service_payment_eobs << @service_line\n @service_line.save(:validate => false)\n return @service_line\n end",
"def create(data, options = {})\n @@grid.put(data, options)\n end",
"def create\n @em_service = EmService.new(em_service_params)\n\n respond_to do |format|\n if @em_service.save\n format.html { redirect_to list_em_services_path, notice: '创建成功.' }\n format.json { render :show, status: :created, location: @em_service }\n else\n drop_breadcrumb(\"员工服务管理\",em_services_path)\n drop_page_title(\"新增\")\n drop_breadcrumb\n flash.now[:alert] = \"操作失败 #{@em_service.errors.full_messages}\"\n format.html { render :new }\n format.json { render json: @em_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n req = VCAP::Services::Api::ServiceOfferingRequest.decode(request_body)\n logger.debug(\"Create service request: #{req.extract.inspect}\")\n\n # Should we worry about a race here?\n\n success = nil\n svc = Service.find_by_label(req.label)\n if svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n attrs = req.extract.dup\n attrs.delete(:label)\n # Keep DB in sync with configs if the token changes in the config\n attrs[:token] = @service_auth_token if svc.is_builtin?\n svc.update_attributes!(attrs)\n else\n # Service doesn't exist yet. This can only happen for builtin services since service providers must\n # register with us to get a token.\n svc = Service.new(req.extract)\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.is_builtin? && svc.verify_auth_token(@service_auth_token)\n svc.token = @service_auth_token\n svc.save!\n end\n\n render :json => {}\n end",
"def space_service_create(entity, opts = {})\n data, _status_code, _headers = space_service_create_with_http_info(entity, opts)\n return data\n end",
"def create\n @service_type = ServiceType.new(params[:service_type])\n\n respond_to do |format|\n if @service_type.save\n format.html { redirect_to @service_type, notice: 'Service type was successfully created.' }\n format.json { render json: @service_type, status: :created, location: @service_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @service_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Validate permissions\n return unless permitted_for_user_type?(Client)\n\n # Extract params\n render_not_found 'missing pet_id' and return false unless (pet_id = params[:pet_id])\n render_not_found \"couldn't find pet with id #{pet_id}\" and return false unless (pet = Pet.find_by_id(pet_id))\n render_not_found 'missing time_start' and return false unless (time_start = params[:time_start])\n render_not_found 'missing time_end' and return false unless (time_end = params[:time_end])\n render_not_found \"location is missing\" and return unless params[:lat].present? and params[:lng].present?\n\n # Validate params\n render_bad_request 'start time is after end time' and return false if time_start.to_i > time_end.to_i\n render_forbidden \"this is not your pet\" and return if pet.owner.id != @current_user.id\n\n # Create new service object\n new_service = {}\n new_service[:client_id] = @current_user.id\n new_service[:pet_id] = params[:pet_id]\n new_service[:type] = params[:type]\n new_service[:time_start] = parse_time(time_start)\n new_service[:time_end] = parse_time(time_end)\n\n # generate location for service\n location = Location.new({:latitude => params[:lat], :longitude => params[:lng], :street_address => params[:address]})\n render_unprocessable_entity \"couldn't save location\" and return unless location.save\n new_service[:location_id] = location.id\n\n @with_client = true\n @with_service_provider = false\n\n # create&save new service active record\n service = Service.new(new_service)\n if service.save\n render 'services/_service', :locals => {:service => service}\n else\n render :json => {:has_errors => true, :errors => service.errors}, :status => :unprocessable_entity\n end\n end",
"def create objid\n DataObj.new @repo, self, objid, true\n end",
"def create_service(opts = {})\n data, _status_code, _headers = create_service_with_http_info(opts)\n data\n end",
"def create(data)\n options = {\n \"url\" => Order.base_uri,\n \"data\" => data\n }\n\n @connector.apply(:post, self, options)\n end",
"def create\n @service_table = ServiceTable.new(service_table_params)\n\n respond_to do |format|\n if @service_table.save\n format.html { redirect_to service_tables_path, notice: 'Gói dịch vụ mới được tạo!' }\n format.json { render :show, status: :created, location: @service_table }\n else\n format.html { render :new }\n format.json { render json: @service_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(params[:service])\n \n respond_to do |format|\n if @service.save\n flash[:notice] = 'Service was successfully created.'\n format.html { redirect_to(@service) }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(service_params)\n drivers_for_select\n clients_for_select\n vehicles_for_select\n\n respond_to do |format|\n \n if @service.save\n format.html { redirect_to @service, notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n @service.build_address\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @value_added_service = ValueAddedService.new(params[:value_added_service])\n\n respond_to do |format|\n if @value_added_service.save\n format.html { redirect_to @value_added_service, notice: '增值服务创建成功' }\n format.json { render json: @value_added_service, status: :created, location: @value_added_service }\n else\n format.html { render action: \"new\" }\n format.json { render json: @value_added_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_service\n # Check signals here to be nice and abort early if possible.\n check_signals!\n # Enable automatically creates the service with Runit.\n directory \"/var/log/#{new_resource.service_name}\" do\n owner 'root'\n group 'root'\n mode '700'\n end\n end",
"def create\n @service = @place.services.new(service_params)\n\n if @service.save\n redirect_to [@client, @place], notice: 'Service was successfully created.'\n else\n render :new\n end\n end",
"def create \n @service = Service.new\n \n # Redirect from Service Selection\n if !params[:query]\n puts \"Redirect from Service Selection\"\n $DATA_SERVICES.each do |serv|\n if params.key?(serv.address)\n puts serv.address\n params[:service_button] = true\n @service.address = serv.address\n end\n end\n end\n \n if params[:service_button]\n puts \"SERVICE BUTTON PRESSED\"\n client = GridClientClass.new\n @query = Query.new(params[:query])\n @service.address ||= params[:query][:endpoint]\n @objects = client.displayDomainObjectNames(@service.address)\n params[:endpoint] = @service.address\n respond_to do |format|\n format.html { render :action => \"object\" }\n format.xml { render :xml => @query }\n end\n \n elsif params[:object_button]\n puts \"OBJECT BUTTON PRESSED\"\n client = GridClientClass.new\n @query = Query.new\n @service.address = params[:endpoint]\n @query.object = params[:Object]\n @attributes = client.displayDomainObjectAttributes(@service.address, @query.object)\n @dmAssociations = client.displayDomainModelAssociations(@service.address)\n @associations = Association.find_all_by_cql_object_id(CqlObject.find_by_objectName(params[:Object]))\n params[:obj] = params[:Object]\n respond_to do |format| \n format.html { render :action => \"parameters\" }\n format.xml { render :xml => @queries }\n end\n elsif params[:change_service_button]\n puts \"CHANGE SERVICE BUTTON PRESSED\"\n # Start a new query\n redirect_to(new_query_path)\n \n elsif params[:change_object_button]\n puts \"CHANGE OBJECT BUTTON PRESSED\"\n # Jump to object.html.erb to change object value\n client = GridClientClass.new\n @query = Query.new\n @service.address = params[:endpoint]\n @objects = client.displayDomainObjectNames(@service.address)\n respond_to do |format|\n format.html { render :action => \"object\" }\n format.xml { render :xml => @query }\n end \n elsif params[:association_button]\n puts \"SAVING ASSOCIATION QUERY\"\n @query = Query.new(params[:query])\n @query.predicate_id = params[:predicate_id][0]\n @query.value = params[:value]\n @query.user_id = current_user.id\n # @query.modifier = \"association\"\n respond_to do |format| \n if @query.save\n format.html { redirect_to(@query, :notice => 'Query was successfully created.') }\n format.xml { render :xml => @query, :status => :created, :location => @query }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @query.errors, :status => :unprocessable_entity }\n end\n end\n elsif params[:xml_query]\n redirect_to(query_xmlResult_path(:url => params[:url], :xml => params[:xml], :version => params[:version]))\n else\n puts \"SAVING QUERY OBJECT\"\n puts params[:obj]\n @query = Query.new(params[:query])\n @query.object = params[:obj]\n @query.endpoint = params[:endpoint]\n @query.user_id = params[:user_id]\n \n # Construct Modifiers\n String mod = params[:modifier]\n if mod.eql?(\"distinct_attribute\")\n attributes = params[:DA].join(',') \n \n elsif mod.eql?(\"selected_attributes\")\n attributes = params[:SA].join(',')\n end\n @query.modifier = mod\n @query.term = attributes\n \n respond_to do |format|\n if @query.save\n format.html { redirect_to(@query, :notice => 'Query was successfully created.') }\n format.xml { render :xml => @query, :status => :created, :location => @query }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @query.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def perform\n # used to make request to get data from AWS API\n response = CurlRequest.new(URL).post\n Rails.logger.info \"==============#{response}============\"\n body = JSON.parse(response.body)\n\n # Calling Service to create data in the database from AWS response\n data = CreateData.new(body)\n data.execute\n end",
"def create\r\n @service = Service.new(service_params)\r\n respond_to do |format|\r\n if @service.save #/enter/companies/:company_id/services/:id/add_stack\r\n format.html { redirect_to \"/enter/companies/#{@service.company_id}/services/#{@service.id}/add_stack\", notice: 'Service was successfully created.' }\r\n format.json { render :add_stack, status: :created, location: @service }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @service.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n failed = false\n params[:service][:done].each{ |member_id,one|\n unless one.to_i != 1\n params[:service][:hours][member_id] = Setting.first.workshare_hours_per_month\n end\n } unless params[:service][:done].nil?\n params[:service][:hours].each{ |member_id,amt|\n next if amt.nil? or (amt.kind_of? String and amt.strip == \"\")\n task = params[:service][:task][member_id]\n did_at = Date.new(params[:service][\"did_at(1i)\"].to_i,params[:service][\"did_at(2i)\"].to_i,params[:service][\"did_at(3i)\"].to_i)\n service = Service.new({:member_id => member_id, :hours => amt, :task => task, \n :observed_by => current_member, :did_at => did_at})\n unless service.save\n failed = true\n break\n end\n } unless params[:service][:hours].nil?\n \n respond_to do |format|\n unless failed\n format.html { redirect_to(services_url, :notice => 'Service was successfully created.') }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def createUser(data)\n\t\tUsuario.create(:login => data['login'], :password => data['password'],\n\t\t\t:nombre => data['nombre'], :apellidos => data['apellidos'])\n\tend",
"def create(data, opts = {})\n data, _status_code, _headers = create_with_http_info(data, opts)\n data\n end",
"def create(data, opts = {})\n data, _status_code, _headers = create_with_http_info(data, opts)\n data\n end",
"def create(data, opts = {})\n data, _status_code, _headers = create_with_http_info(data, opts)\n data\n end",
"def create(data, opts = {})\n data, _status_code, _headers = create_with_http_info(data, opts)\n data\n end",
"def create data\n data = validate_path validate_code(data)\n\n row = TABLE.\n returning.\n insert(data).\n first\n\n Computer.new(row)\n end",
"def call\n @user.projects.find_or_create_by(name: \"Services\")\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 @service_particular = ServiceParticular.new(service_particular_params)\n\n respond_to do |format|\n if @service_particular.save\n format.html { redirect_to service_particulars_url, notice: 'Service particular was successfully created.' }\n format.json { render :show, status: :created, location: @service_particular }\n else\n format.html { render :new }\n format.json { render json: @service_particular.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n flash[:notice] = 'Service was successfully created.'\n format.html { redirect_to(@service) }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def servicio # :doc\n id = params[:service_id]\n if id.present?\n \t\tService.find(params[:service_id]) \n \tend \n end",
"def create\n @tb_servicio = TbServicio.new(tb_servicio_params)\n\n respond_to do |format|\n if @tb_servicio.save\n format.html { redirect_to @tb_servicio, notice: 'Tb servicio was successfully created.' }\n format.json { render :show, status: :created, location: @tb_servicio }\n else\n format.html { render :new }\n format.json { render json: @tb_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n m_requires! [:user_id, :event_id, :good_id, :in_num, :sell_num, :budget_num, :storage_num]\n # optional! :role,:name\n begin\n Datum.create!(datum_params)\n result = [0, '添加成功']\n rescue Exception => ex\n result= [1, ex.message]\n end\n render_json(result)\n end",
"def create\n @project = Project.new(params[:project])\n @project.rating=0\n Service.all.each do |service|\n if defined? params[:services][service.id]\n @Project.services << service\n end\n end\n\n respond_to do |format|\n if @project.save\n format.html { redirect_to administration_project_path(@project), notice: 'Project was successfully created.' }\n format.json { render json: @project, status: :created, location: @project }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end"
] | [
"0.7130991",
"0.6724158",
"0.6688275",
"0.6688111",
"0.6644545",
"0.6494095",
"0.64873683",
"0.6455025",
"0.6434602",
"0.64181685",
"0.6375744",
"0.62965333",
"0.6289928",
"0.62892216",
"0.62685174",
"0.62301797",
"0.6219859",
"0.6197706",
"0.61968666",
"0.6169759",
"0.6162504",
"0.6162504",
"0.61338437",
"0.6128389",
"0.6121949",
"0.6111232",
"0.61101705",
"0.6088042",
"0.6083031",
"0.6077168",
"0.6077168",
"0.6077144",
"0.6066479",
"0.6066479",
"0.6066479",
"0.6066479",
"0.6066479",
"0.6066479",
"0.6063866",
"0.6053368",
"0.60453975",
"0.6035465",
"0.6019671",
"0.6006863",
"0.60068285",
"0.5982174",
"0.5975274",
"0.5968971",
"0.5940414",
"0.59351814",
"0.5906026",
"0.58967614",
"0.5887739",
"0.58743805",
"0.5868446",
"0.5856752",
"0.58485335",
"0.58461046",
"0.5841779",
"0.5839788",
"0.5839754",
"0.58394873",
"0.5835554",
"0.58336866",
"0.58301944",
"0.5826327",
"0.58227736",
"0.58204925",
"0.5815616",
"0.5810576",
"0.58094203",
"0.58081424",
"0.5807274",
"0.58056355",
"0.5789171",
"0.57864374",
"0.5785113",
"0.5784381",
"0.5782592",
"0.5781712",
"0.5765089",
"0.5739824",
"0.57398003",
"0.5735938",
"0.5735813",
"0.57272923",
"0.5726968",
"0.5709766",
"0.5708908",
"0.5708908",
"0.5708908",
"0.57074666",
"0.57058764",
"0.5691809",
"0.56917995",
"0.5690585",
"0.56827766",
"0.56817734",
"0.56711966",
"0.566618"
] | 0.77970856 | 0 |
Helper function to create an alert in the DB [Parameters] data The data to create a service | def create_alert(data=nil)
if (!data.blank? && data.is_a?(Hash))
@alert = Alert.create(data)
else
create_service
create_host
@service.hosts << @host
@service.save
@alert = Alert.create(:name => "Test Alert #{rand(1..1000)}", :description => "Test alert description.", :active => true, :limit => 600, :condition => :greater_than, :condition_target => Alert::CONDITION_TARGET_ALL, :error_control => true, :service_id => @service.id, :hosts => [@host])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n parameters = alert_params\n parameters[:service] = Service.where(:_id => parameters[:service_id]).first\n parameters[:hosts] = Host.where(:_id.in => parameters[:host_ids]).to_a if (!parameters[:host_ids].blank?)\n\n # Delete string'd id's\n parameters.delete(:service_id)\n parameters.delete(:host_ids)\n\n # Apply the params received\n @alert = Alert.new(parameters)\n\n respond_to do|format|\n format.html{\n # Can be saved?\n if (@alert.save)\n flash[:notice] = t(\"alerts.notice.created\", :name => @alert.name)\n redirect_to alert_path(@alert)\n else\n # If an error raises, show the form again.\n render :action => :new\n end\n return\n }\n end\n end",
"def create_alert(obj, alert_type)\n alert = self.alerts.new\n alert.thing = obj\n alert.reason_type = alert_type\n alert.save\n end",
"def create\n alerts = JSON.parse(params[:alert] || params[:deployment]) \n user_application = UserApplication.find_by_name(alerts[\"application_name\"])\n @alert = build_application_alert(user_application,alerts) if params.has_key?(\"alert\")\n # @deploy_alert = build_deployment_alert(params[:deployment]) if params.has_key?(\"deployment\")\n # @alert = ApplicationAlert.new(params[:application_alert])\n @error = {:error => 'Error while creating record'}\n \n if [email protected]? && @alert.save\n respond_to do |format|\n format.json { render :nothing => true, :status => :ok}\n format.xml { render :nothing => true, :status => :ok }\n end\n # elsif @deploy_alert.save\n # respond_to do |format|\n # format.json { render :nothing => true, :status => :ok}\n # format.xml { render :nothing => true, :status => :ok }\n # end\n else\n respond_to do |format|\n format.json { render :json => @error}\n format.xml { render :xml => @error}\n end\n end\n end",
"def create\n @tipo_alerta = TipoAlerta.new(params[:tipo_alerta])\n\n respond_to do |format|\n if @tipo_alerta.save\n format.html { redirect_to @tipo_alerta, notice: 'Tipo alerta was successfully created.' }\n format.json { render json: @tipo_alerta, status: :created, location: @tipo_alerta }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_alerta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @alert = Alert.new(alert_params)\n\n respond_to do |format|\n if @alert.save\n format.html { redirect_to root_path, notice: \"Has creado una nueva alerta. Pronto te avisaremos cuando encontremos lo que buscas\" }\n format.json { render :show, status: :created, location: @alert }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @alert = Alert.new(params[:alert])\n notifiers = Hash.new\n User.find(params[:notifiers]).each{|user| notifiers[user.id] = 0}\n @alert.notifiers = notifiers\n @alert.host = params[:host]\n @alert.trigger = params[:trigger]\n respond_to do |format|\n if @alert.save\n format.html { redirect_to @alert, notice: 'Alert was successfully created.' }\n format.json { render json: @alert, status: :created, location: @alert }\n\t AlertMailer.new_alert(@alert.id).deliver\n else\n format.html { render action: \"new\" }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_alert(project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'POST'\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts'\n\t\targs[:query]['Action'] = 'CreateAlert'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tif optional.key? :alert\n\t\t\targs[:body]['Alert'] = optional[:alert]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create\n m_requires! [:user_id, :event_id, :good_id, :in_num, :sell_num, :budget_num, :storage_num]\n # optional! :role,:name\n begin\n Datum.create!(datum_params)\n result = [0, '添加成功']\n rescue Exception => ex\n result= [1, ex.message]\n end\n render_json(result)\n end",
"def create\n @alert = Alert.new(alert_params)\n\n respond_to do |format|\n if @alert.save\n format.html { redirect_to alerts_path, notice: 'Alert was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @alert }\n else\n format.html { render action: 'new' }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # from mac - state, duration, uuid, major, minor\n # we have - current_employee.id , @beacon.id\n @alert = Alert.new(beacon_id: @beacon.id,\n duration: params[:duration],\n state: params[:state],\n employee_id: current_employee.id)\n if @alert.save\n render json: { success: \"PREY ACQUIRED! TRACKING MODE ACTIVATED! SCREEEEEEEEE!\" }, status: :ok\n else\n render json: { errors: @alert.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"def create\n user = User.find(session[:id])\n \n alert = {:title => alert_params[:title], :city_name => alert_params[:city_name], :alert_time => alert_params[:alert_time], :user => user }\n puts 'ALERT TIME!!!!!!!!!!!!!!!!!!!!!!!!'\n puts alert_params[:alert_time][0]\n @alert = Alert.new(alert)\n respond_to do |format|\n if @alert.save\n # format.html { redirect_to @user, notice: 'Alert was successfully created.' }\n format.html { redirect_to('/alerts', notice: 'Alert was successfully created.') }\n format.json { render :show, status: :created, location: @alert }\n else\n format.html { render :new }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(data) # rubocop:disable Rails/Delegate\n client.create(data)\n end",
"def create_service(data=nil)\n if (!data.blank? && data.is_a?(Hash))\n @service = Service.create(data)\n else\n @service = Service.create(:name => \"Test Service #{rand(1..1000)}\", :description => \"Test service description.\", :active => true, :probe => \"dummy\", :probe_config => {:value => 1}, :interval => 60, :clean_interval => 86400, :priority => Service::PRIORITY_NORMAL, :resume => :mean_value)\n end\n end",
"def create_object(to, data)\n return to if @@redis.set(@@alert_name, self.default(to, data).to_json) == \"OK\"\n raise StandardError.new(\"Status `#{to}` could not be saved\")\n end",
"def create\n @price_alert = PriceAlert.new(price_alert_params)\n\n respond_to do |format|\n if @price_alert.save\n format.html { redirect_to @price_alert, notice: 'Price alert was successfully created.' }\n format.json { render :show, status: :created, location: @price_alert }\n else\n format.html { render :new }\n format.json { render json: @price_alert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def incident_create(statuspage_id, incident_name, incident_details, infrastructure_affected, current_status, current_state, notifications = 0, all_infrastructure_affected = \"0\", message_subject = \"Status Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['incident_name'] = incident_name\n data['incident_details'] = incident_details\n data['infrastructure_affected'] = infrastructure_affected\n data['current_status'] = current_status\n data['current_state'] = current_state\n data['all_infrastructure_affected'] = all_infrastructure_affected\n data['message_subject'] = message_subject\n\n request :method => :post,\n \t :url => @url + 'incident/create',\n \t :payload => data\n end",
"def create\n puts \"==========================\"\n puts \"CREATE\"\n JSON[params[\"updates\"].read].each do |notification|\n user = User.find(notification[\"subscriptionId\"])\n if user\n case notification[\"collectionType\"]\n when \"sleep\"\n user.fitbit.client.sleep_on_date(notification[\"date\"])[\"sleep\"].each do |data|\n sleep_event = { user_id: notification[\"subscriptionId\"], provider: params[:app_id], body: data }\n sleep_logger.info sleep_event\n end\n end\n end\n end\n render text: \"\", status: 204\n end",
"def create\n @alert = Alert.new(alert_params)\n if @alert.save!\n redirect_to alerts_path(@alert)\n else \n render 'new', :notice => \"Uh Oh\"\n end\n end",
"def create\r\n @patient_alert = PatientAlert.new(params[:patient_alert])\r\n @patient_alert.patient = @patient\r\n \r\n respond_to do |format|\r\n if @patient_alert.save\r\n flash[:notice] = 'PatientAlert was successfully created.'\r\n APP_LOGGER_LOG.info \"ALERT CREATED - for PATIENT ID \" + \r\n @patient[:medical_record_number].to_s + \" by USER \" + self.current_user[:login]\r\n format.html { redirect_to(@patient_alert) }\r\n format.xml { render :xml => @patient_alert, :status => :created, :location => @patient_alert }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @patient_alert.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create_operation(data)\n puts \"Importing Operation #{data[:invoice_num]}\"\n Operation.find_or_create_by(company_id: find_company_id(data[:company]),\n invoice_num: data[:invoice_num],\n invoice_date: parse_date(data[:invoice_date]),\n operation_date: parse_date(data[:operation_date]),\n amount: data[:amount] || 1.0,\n reporter: data[:reporter],\n notes: data[:notes],\n status: data[:status],\n kind: data[:kind] \n )\n end",
"def create\n puts alert_params.class\n @alert = Alert.new(alert_params)\n respond_to do |format|\n if @alert.save\n key = ENV['GCMKEY']\n gcm = GCM.new(key)\n client = @alert.client\n options = { data: {msg: \"ALERTA ENVIADA AL ADMINISTRADOR\"}, collapse_key: \"ALERTA\"}\n reg_id = [client.reg_id]\n response = gcm.send(reg_id, options)\n puts response\n format.html { redirect_to @alert, notice: 'Alert was successfully created.' }\n format.json { render json: {msg: \"ALERTA ENVIADA AL ADMINISTRADOR\", response: response} }\n else\n format.html { render :new }\n format.json { render json: @alert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(data)\n @create_resource_mixin.create(data)\n end",
"def create\n @email_alert = EmailAlert.new(email_alert_params)\n\n respond_to do |format|\n if @email_alert.save\n format.html { redirect_to @email_alert, notice: 'Email alert was successfully created.' }\n format.json { render :show, status: :created, location: @email_alert }\n else\n format.html { render :new }\n format.json { render json: @email_alert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n #Se mira si existe el gateway con ese ID\n gateway_id = Gateway.where(\"gateway_id = ?\", params[:gatewayId])\n if gateway.exists?\n gateway_id = gateway.take.id\n else\n gateway_id = nil\n end\n\n #Se guardan los datos recibidos\n hardware = Hardware.create(gateway_id: gateway_id, hardware_id: params[:gatewayId], cpu_percent: params[:cpu][:percent], memory_available: params[:memory][:available], memory_total: params[:memory][:total], memory_percent: params[:memory][:percent], disk_free: params[:disk][:free], disk_total: params[:disk][:total], disk_percent: params[:disk][:percent], temperature: params[:temperature][:value], updated_at: params[:updated_at])\n\n #Se mira si existen alertas para este hardware\n alerts = Alert.where(\"element = ? AND element_id = ?\", \"hardware\", hardware.hardware_id)\n if alerts.present?\n alerts.each do |alert|\n #Se obtiene el valor que esta monitorizando la alerta\n alert_type = alert.alert_type_id.column_name\n alert_type_name = alert.alert_type.name\n hardware_value = hardware[alert_type]\n persistence = alert.persistence\n alert_condition = (alert.sign) ? (hardware_value > alert.limit) : (hardware_value < alert.limit)\n\n #Se mira si se cumple la condicion de alerta\n if alert_condition\n #Si ya la alerta esta activada, no se hace nada\n if alert.triggered\n next\n end\n #Se mira si la alerta exige persistencia\n if persistence.nil? || persistence == 0\n message = create_trigger_message(alert.element_id, alert_type_name, alert.sign, alert.limit, alert.persistence, hardware.updated_at, alert.client.name)\n notification = Notification.create(triggered: true, alert_id: alert.id, message: message, alert_type_id: alert.alert_type_id, client_id: alert.client_id, gateway_id: alert.gateway_id, notify_app: alert.notify_app, notify_email: alert.notify_email, notify_slack: alert.notify_slack, start_time: params[:updated_at], end_time: nil)\n alert.update(triggered:true)\n else\n #Se mira si la condicion lleva cumpliendose mas que la persistencia exigida\n if alert.persistence_since.nil?\n alert.persistence_since = hardware.updated_at\n end\n persistence_since = DateTime.parse(alert.persistence_since.to_s)\n current_time = DateTime.parse(hardware.updated_at.to_s)\n difference = (current_time - persistence_since)*24*60\n if difference >= alert.persistence\n message = create_trigger_message(alert.element_id, alert_type_name, alert.sign, alert.limit, alert.persistence, hardware.updated_at, alert.client.name)\n notification = Notification.create(triggered: true, alert_id: alert.id, message: message, alert_type_id: alert.alert_type_id, client_id: alert.client_id, gateway_id: alert.gateway_id, notify_app: alert.notify_app, notify_email: alert.notify_email, notify_slack: alert.notify_slack, start_time: params[:updated_at], end_time: nil)\n alert.update(triggered:true)\n end\n end\n else\n #Si no se cumple la condicion de alerta y la alerta esta encendida, se apaga\n if alert.triggered\n alert.update(triggered: false, persistence_since: nil)\n notifications = alert.notifications.where(triggered: true)\n if notifications.present?\n notification = notifications.take\n notification.update(triggered: false, end_time: hardware.updated_at)\n end\n end\n end\n\n end\n\n end\n\n render json: hardware.to_json, status: :ok\n end",
"def create_alert(category = nil, email = '[email protected]')\n category ||= Admin::Alert.categories[:breakdown]\n\n Admin::Alert.create!(description: 'test ' * 25,\n category: category,\n email: email)\n end",
"def create\n submenu_item 'services-new'\n @service = Service.new(params[:service])\n @service_type = @service.type\n service_param\n\n @service.tenant_id = current_user.tenant_id\n\n # service_params = Service.extract_params(params[:service])\n # service_params = Service.extract_thresholds(service_params)\n # @service = Service.new(service_params)\n\n respond_to do |format|\n if @service.save\n flash[:notice] = \"#{@service.name}创建成功\"\n format.html { redirect_to(@service) }\n else\n dictionary\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n @item_alert = ItemAlert.new(item_alert_params)\n authorize! :create, ItemAlert\n\n respond_to do |format|\n if @item_alert.save\n format.html do\n redirect_to @item_alert, notice: 'Item alert was successfully created.'\n end\n format.json do\n render json: @item_alert, status: :created, location: @item_alert\n end\n else\n format.html { render 'new' }\n format.json do\n render json: @item_alert.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def new_service_notes(service, note_data)\n user = User.where(admin: true, admin_users: true)\n if user.exists?\n new_note = service.notes.new(body: note_data, user_id: user.first.id)\n if new_note.save\n puts \" 🟢 Note: created (id: #{new_note.id}).\"\n return new_note.id\n else \n abort(\" 🔴 Note: was not created. Exiting. #{new_note.errors.messages}\")\n end\n else \n puts \" 👉 Note: not created as no viable admin user found to give credit to.\"\n end\n end",
"def create\n @alert_trigger_type = AlertTriggerType.new(params[:alert_trigger_type])\n\n respond_to do |format|\n if @alert_trigger_type.save\n flash[:notice] = 'AlertTriggerType was successfully created.'\n format.html { redirect_to(admin_alert_trigger_type_path(@alert_trigger_type)) }\n format.xml { render :xml => @alert_trigger_type, :status => :created, :location => @alert_trigger_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @alert_trigger_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new_alert\n@alert = Alert.new(params[:id])\nend",
"def create\n if current_user.is_admin\n @user_alert = UserAlert.new(params[:user_alert])\n\n respond_to do |format|\n if @user_alert.save\n flash[:notice] = 'UserAlert was successfully created.'\n format.html { redirect_to(@user_alert) }\n format.xml { render :xml => @user_alert, :status => :created, :location => @user_alert }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user_alert.errors, :status => :unprocessable_entity }\n end\n end\n else\n redirect_to new_session_path\n end\n end",
"def add(data)\n create(data)\n end",
"def add(data)\n create(data)\n end",
"def create\n @service = Service.new(sp_company)\n if @service.save\n flash[:success] = \"A record add been succefully added\"\n redirect_to services_path\n else\n render 'new'\n end\n end",
"def create\n seth_server_rest.post_rest(\"data\", self)\n self\n end",
"def create(data = {})\n object = self.new(data)\n object.save\n object\n end",
"def create\n @service = @enterprise.services.new(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to edit_service_path(@service), notice: 'El servicio ha sido creado satisfactoriamente.' }\n format.json { render :edit, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def adding_to_hel_ser(record)\n patient_id = get_patient_id_by_alias(record[:patient_id][:root], record[:patient_id][:extension])\n return Logging.logger.error 'Aborting Post to Consent Service, no Patient Id was retrieved for the above record!'\\\n if patient_id.nil?\n\n aliases = [\n {\n system: ENV['SYSTEM'],\n value: record[:assertion_id]\n }\n ]\n effective_period = {\n start: record[:start_date].to_s,\n end: record[:end_date].to_s\n }\n consent_type = record[:assertion_type]\n organization_group = { id: record[:care_provider_id] }\n organization = { id: record[:care_unit_id] }\n personnel = { id: record[:employee_id] }\n\n provision_scope = {\n organizationGroup: organization_group,\n organization: organization,\n personnel: personnel\n }\n consent_type =\n if consent_type == 'Consent'\n 'PATIENT_GRANTED'\n elsif consent_type == 'Emergency'\n 'EMERGENCY_ACCESS'\n else\n 'NOT_FOUND'\n end\n body = {\n aliases: aliases,\n patientId: patient_id,\n createdBy: record[:employee_id],\n consentReasonType: consent_type,\n effectivePeriod: effective_period,\n provisionScope: provision_scope,\n emergencyConsentReason: consent_type,\n provisionType: ENV['PROVISION_TYPE'],\n category: ENV['CATEGORY_CONCEPT'],\n policyRule: ENV['PR_CONCEPT']\n }\n # Post-url: /patients/{patient_id}/patient-consents:\n new_hel_consents = {\n body: body,\n relativeUrl: \"#{ENV['POP_ID']}/patients/#{patient_id}/patient-consents\",\n assertion_id: record[:assertion_id]\n }\n # Send new mapped consent records to HEL service\n post_hel_consents(new_hel_consents)\n end",
"def create\n chef_server_rest.post(\"data/#{data_bag}\", self)\n self\n end",
"def create\n @enterprise_datum = EnterpriseDatum.new(params[:enterprise_datum])\n\n respond_to do |format|\n if @enterprise_datum.save\n format.html { redirect_to @enterprise_datum, notice: 'Enterprise datum was successfully created.' }\n format.json { render json: @enterprise_datum, status: :created, location: @enterprise_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @enterprise_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(data={})\n object = self.new(data)\n object.save\n end",
"def create\n @alert = Alert.new(params[:alert])\n @alert.sent = false\n\n if @alert.save\n if @alert.hit_web\n @alert.update_attribute(:sent, true)\n redirect_to new_alert_url, notice: \"¡Hey! Ya hay trenes para esta fecha. Visita <a href='http://www.renfe.com'>Renfe</a>\".html_safe\n else\n AlertMailer.created(@alert).deliver\n redirect_to new_alert_url, notice: 'Nueva alerta configurada. Recibirás email cuando haya disponibilidad de trenes'\n end\n else\n render action: \"new\"\n end\n end",
"def nb_create_event(data)\n\t\tsignup_data = nb_add_signup(data)\n\t\tevent_params = build_event_params(data, signup_data['person']['id'])\n\t\tclient = primary_nation_nb_client\n params = {\n site_slug: ENV['PRIMARY_NATION_SITE_SLUG'],\n event: event_params\n }\n\n\t\tbegin\n\t response = client.call(:events, :create, params)\n\n\t if response['status_code'] == 200\n\t \tNotificationsMailer.event_created(signup_data, response['event']).deliver_now\n\n\t \t# if a webhook URL is provided, the new event data is sent to that URL\n\t \tunless ENV['NEW_EVENT_WEBHOOK_URL'].nil? && ENV['NEW_EVENT_WEBHOOK_URL'].blank?\n\t \t\tsend_data_to_external_service(ENV['NEW_EVENT_WEBHOOK_URL'], response['event'])\n\t \tend\n\n\t \tadmins = User.admin_receive_notifications\n\t \tadmins.each do |admin|\n\t \t\tAdminNotificationsMailer.event_created(admin.email, signup_data, response['event']).deliver_now\n\t \tend\n\t end\n\t\trescue => e\n\t\t SupportNotificationsMailer.error_handler(event_params, JSON.parse(e.message)).deliver_now\n\t\tend\n end",
"def add_work_item(data)\n name = @table_name.to_s\n sql = @model.from(name.to_sym).insert_sql(\n description: data[:description],\n guide: data[:guide],\n status: data[:status],\n username: data[:name],\n archived: 0\n )\n sql = _format_sql(sql)\n @logger.info(\"Prepared POST query: #{sql}\")\n response = run_statement(sql, \"post\")\n id = response[0][:long_value]\n @logger.info(\"Successfully created work_item_id: #{id}\")\n id\n end",
"def CreateTrigger params = {}\n \n APICall(path: 'triggers.json',method: 'POST',payload: params.to_json)\n \n end",
"def create\n weather_datum = WeatherDatum.new(weather_datum_params)\n weather_datum.set_sensor_id(request.headers['Authorization'].match(/(Token token=)(.*)/)[2])\n sent = false\n\n if weather_datum.save\n\n if weather_datum.temp > weather_datum.sensor.trigger_temp_max\n\n if Notification.last_notification_status(weather_datum.sensor)\n recipients = []\n notification = Notification.new message: \"Temperature Alert: #{weather_datum.temp}F @ #{weather_datum.location}!\",\n weather_datum_id: weather_datum.id,\n sensor_id: weather_datum.sensor.id,\n contacts: []\n\n Email.all.each do |e|\n e.sensors.each do |id|\n if ( Sensor.find(id).location == weather_datum.location )\n notification.contacts << e.email\n # SensorMailer.temp_email(e.email, l, data.temp, data.humidity).deliver_now\n recipients << e.email\n end\n end\n end\n sent = true\n notification.save!\n\n end\n end\n\n render json: {status: \"Record was created!\", notification: sent}\n else\n render json: {status: \"Record wasn't created!\", errors: weather_datum.errors}\n end\n end",
"def create\n @supplier = Supplier.find(params[:supplier_id])\n @service = @supplier.services.create(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to supplier_path(@supplier), notice: 'Service was successfully created.' }\n format.json { render action: 'show', status: :created, location: @service }\n else\n format.html { render action: 'new' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(data)\n jss = self.get_structure() # For referencing purposes\n\n input = self.query_to_hash(data)\n bad_request = false\n resp = nil\n jss.each do |key, value|\n # Check if we have it on the query too\n unless input.has_key? key\n resp = MIDB::Interface::Server.json_error(400, \"Bad Request - Not enough data for a new resource\")\n @engine.http_status = 400\n bad_request = true\n end\n end\n input.each do |key, value|\n # Check if we have it on the structure too\n unless jss.has_key? key\n resp = MIDB::Interface::Server.json_error(400, \"Bad Request - Wrong argument #{key}\")\n @engine.http_status = 400\n bad_request = true\n end\n end\n \n\n # Insert the values if we have a good request\n unless bad_request\n fields = Hash.new\n inserts = Hash.new\n main_table = self.get_structure.values[0].split('/')[0]\n input.each do |key, value|\n struct = jss[key]\n table = struct.split(\"/\")[0]\n inserts[table] ||= []\n fields[table] ||= []\n inserts[table].push \"\\\"\" + value + \"\\\"\"\n fields[table].push struct.split(\"/\")[1]\n if struct.split(\"/\").length > 2\n match = struct.split(\"/\")[2]\n matching_field = match.split(\"->\")[0]\n row_field = match.split(\"->\")[1]\n fields[table].push matching_field\n if @engine.config[\"dbengine\"] == :mysql\n inserts[table].push \"(SELECT #{row_field} FROM #{main_table} WHERE id=(SELECT LAST_INSERT_ID()))\"\n else\n inserts[table].push \"(SELECT #{row_field} FROM #{main_table} WHERE id=(last_insert_rowid()))\"\n end\n end\n end\n queries = [] \n inserts.each do |table, values|\n queries.push \"INSERT INTO #{table}(#{fields[table].join(',')}) VALUES (#{inserts[table].join(',')});\"\n end\n # Connect to the database\n dbe = MIDB::API::Dbengine.new(@engine.config, @db)\n dblink = dbe.connect()\n results = []\n rid = nil\n # Find the ID to return in the response (only for the first query)\n queries.each do |q|\n results.push dbe.query(dblink, q)\n if @engine.config[\"dbengine\"] == :mysql\n rid ||= dbe.extract(dbe.query(dblink, \"SELECT id FROM #{main_table} WHERE id=(SELECT LAST_INSERT_ID());\"), \"id\")\n else\n rid ||= dbe.extract(dbe.query(dblink, \"SELECT id FROM #{main_table} WHERE id=(last_insert_rowid());\"), \"id\")\n end\n end\n @engine.http_status = \"201 Created\"\n resp = {status: \"201 created\", id: rid}\n end\n return resp\n end",
"def create\n # service = params[:service]\n # @service = Service.new(description: service[:description], availablity: service[:availability], more_information: service[:more_information])\n @service = Service.new(service_params)\n @service.user = current_user \n @service.save\n end",
"def create\r\n\r\n\r\n end",
"def create\n r = Redis.new\n r.publish(params[:key], \"event: alert\\ndata: #{params[:msg]}\\n\\n\")\n r.quit\n render json: {ok: 1}\n end",
"def create\n @service = Service.new(service_params)\n @service.user_id = @user.id\n @service.co_confirmacion = @service.get_cod_confirmacion\n @service.status_id = 1\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to [@user,@service], notice: 'Service was successfully created.' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_notification; end",
"def create\n # @weather_station_alert = WeatherStationAlert.new(weather_station_alert_params)\n #\n # respond_to do |format|\n # if @weather_station_alert.save\n # format.html { redirect_to @weather_station_alert, notice: 'Weather station alert was successfully created.' }\n # format.json { render :show, status: :created, location: @weather_station_alert }\n # else\n # format.html { render :new }\n # format.json { render json: @weather_station_alert.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create_message(data); end",
"def create_message(data); end",
"def new_service_contact(service, contact_data)\n contact = service.contacts.find_by(email: contact_data['contact_email']&.strip)\n if contact\n puts \" 👉 NB: contact for this service already exists so not creating them. \\\"#{contact_data['contact_email']}\\\".\"\n return contact.id\n else \n new_contact = service.contacts.new(\n name: contact_data['contact_name']&.strip,\n title: contact_data['contact_title']&.strip,\n visible: contact_data['contact_visible'].present? ? contact_data['contact_visible'] : false,\n email: contact_data['contact_email']&.strip,\n phone: contact_data['contact_phone']&.strip,\n )\n if new_contact.save\n puts \"🟢 Contact: \\\"#{new_contact.name}\\\" created (id: #{new_contact.id}).\"\n return new_contact.id\n else \n abort(\"🔴 Contact: \\\"#{new_contact.name}\\\" was not created. Exiting. #{new_contact.errors.messages}\")\n end\n end \n end",
"def create\n @data_table = DataTable.new(data_table_params)\n\n respond_to do |format|\n if @data_table.save\n format.html { redirect_to @data_table, notice: 'Data table was successfully created.' }\n format.json { render :show, status: :created, location: @data_table }\n else\n format.html { render :new }\n format.json { render json: @data_table.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 super\n # slack通知\n c = Payment.create_customer(resource.email, resource.name)\n resource.update(pay_customer_id: c.id)\n notifier = Slack::Notifier.new(Rails.application.config.slack_webhook_url)\n notifier.ping(\"新しく管理人が登録されました!\")\n end",
"def create_new_task(data)\n new_task.click\n new_task_title.when_present.set data[:title] if data[:title]\n new_task_description.set data[:description] if data[:description]\n new_task_status.select data[:status] if data[:status]\n save_new_task.click\n end",
"def create\n data = reload(get_series('sleep'), str(Date.strptime(params[:sleep].values.join(\"-\"))))\n saved = false\n get_series('sleep').each do |s|\n data[s].each do |day|\n logger.debug \"data=#{day} date=#{day['dateTime']} value=#{day['value']}\"\n @sleep = for_date(day['dateTime'])\n\t# get variable name from last part of series\n @sleep.send(s.rpartition('/')[2] + '=', day['value'])\n saved = @sleep.save\n if not saved\n flash[:error] = @sleep.errors\n end\n end\n end\n \n respond_to do |format|\n flash[:success] = 'Sleep was successfully created.'\n format.html { redirect_to sleeps_path }\n format.json { render :json => sleeps_path, :status => :created, :location => sleeps_path }\n end\n end",
"def create\n\t\tsite = Site.find_by(hostname: params[:hostname], user_id: current_user.id)\n\t\tdata = params.permit(:time, :sent, :span)\n\t\tdata[:site_id] = site.id\n\t\tdata[:sent] = Time.now.to_i\n\t\tdata[:time] = data[:time].to_i * 3600\n\t\tNotification.create(data)\n\t\tredirect_to request.referer\n\tend",
"def create\n data = params[:event]\n @event = Event.new Fenix::Store::Converter::Flattener.event data\n\n saved = @host.install Fenix::Store::Converter::Flattener.installs(data), @event\n\n respond_to do |format|\n if saved\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n current_user.user_payment_choice = params[:id]\n current_user.save\n if current_user.database.blank?\n @database = Database.new(params[:database])\n @database.name = 'database'\n @database.save\n @database.name = @database.name + @database.id.to_s\n @database.user_id = current_user.id\n @database.save\n Database.create_default_schema(@database) \n \n respond_to do |format|\n if @database.save\n format.html { redirect_to root_path, :notice=> 'Database was successfully created.' }\n format.json { render :json=> @database, :status=>:created, :location=> @database }\n else\n format.html { render :action=> \"new\" }\n format.json { render :json=> @database.errors, :status=> :unprocessable_entity }\n end\n end\n else\n redirect_to redirect_to root_path, :notice=> 'Database was Already created.'\n end\n end",
"def create\n @service_table = ServiceTable.new(service_table_params)\n\n respond_to do |format|\n if @service_table.save\n format.html { redirect_to service_tables_path, notice: 'Gói dịch vụ mới được tạo!' }\n format.json { render :show, status: :created, location: @service_table }\n else\n format.html { render :new }\n format.json { render json: @service_table.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # validating service_pricing_scheme_id, the specified service_pricing_scheme must belong to the current user\n @tid = params[:service_demand_breakdown][:service_pricing_scheme_id]\n if (!(@tid && @tid.to_i > 0))\n @tid = params[:service_pricing_scheme_id]\n end\n if (@tid && @tid.to_i > 0)\n @service_pricing_scheme = current_user.service_pricing_schemes.find(@tid)\n raise AppExceptions::InvalidParameter.new('Security Alert! Invalid service_pricing_scheme_id was specified!') unless @service_pricing_scheme\n end\n\n # validating service_demand_id, the specified service_demand must belong to the current user\n @tid = params[:service_demand_breakdown][:service_demand_id]\n if (!(@tid && @tid.to_i > 0))\n @tid = params[:service_demand_id]\n end\n if (@tid && @tid.to_i > 0)\n @service_demand = current_user.service_demands.find(@tid)\n raise AppExceptions::InvalidParameter.new('Security Alert! Invalid service_demand_id was specified!') unless @service_demand\n end\n\n @service_demand_breakdown = current_user.service_demand_breakdowns.new(params[:service_demand_breakdown])\n @service_demand_breakdown.service_pricing_scheme = @service_pricing_scheme\n @service_demand_breakdown.service_demand = @service_demand\n\n flash.keep\n load_service_demand\n load_service_pricing_scheme\n\n @service_demand_breakdown.save!\n\n # update the time serials associated with attached patterns\n # TODO: dyw - only update this when customer_quantity_baseline has changed.\n @service_demand_breakdown.update_time_serials_service_demand_breakdown(\"service_resource_usage_baseline\", Time.now, Date.today+(REPORT_TIME_SERIALS_DURATION))\n\n respond_to do |format|\n format.html { redirect_to( url = @service_demand_breakdown.nil? ? (params[:guided_workflow].blank? ? service_demand_service_demand_breakdowns_path(@service_demand) : service_demand_service_demand_breakdowns_path(@service_demand, :guided_workflow => params[:guided_workflow])) : (params[:guided_workflow].blank? ? service_demand_service_demand_breakdowns_path(@service_demand_breakdown.service_demand) : service_demand_service_demand_breakdowns_path(@service_demand_breakdown.service_demand, :guided_workflow => params[:guided_workflow])), :flash => {:success => 'Successfully created the specified Service Usage Detail.' })}\n format.json { render :json => @service_demand_breakdown, :status => :created }\n end\n rescue Exception => e\n respond_to do |format|\n warning_message = pre_process_exception(e)\n\n if not warning_message.nil?\n logger.debug(warning_message)\n format.html { redirect_to @service_demand_breakdown.nil? ? (params[:guided_workflow].blank? ? service_demand_service_demand_breakdowns_path(@service_demand) : service_demand_service_demand_breakdowns_path(@service_demand, :guided_workflow => params[:guided_workflow])) : (params[:guided_workflow].blank? ? service_demand_service_demand_breakdowns_path(@service_demand_breakdown.service_demand) : service_demand_service_demand_breakdowns_path(@service_demand_breakdown.service_demand, :guided_workflow => params[:guided_workflow])), :flash => {:error => warning_message} }\n format.json { render :json => @service_demand_breakdown, :status => :unprocessable_entity }\n end\n\n error_message = \"Failed to create the specified Service Usage Detail.\"\n format.html { redirect_to @service_demand_breakdown.nil? ? (params[:guided_workflow].blank? ? service_demand_service_demand_breakdowns_path(@service_demand) : service_demand_service_demand_breakdowns_path(@service_demand, :guided_workflow => params[:guided_workflow])) : (params[:guided_workflow].blank? ? service_demand_service_demand_breakdowns_path(@service_demand_breakdown.service_demand) : service_demand_service_demand_breakdowns_path(@service_demand_breakdown.service_demand, :guided_workflow => params[:guided_workflow])), :flash => {:error => error_message} }\n format.json { render :json => @service_demand_breakdown, :status => :unprocessable_entity }\n end\n\n end",
"def create\n @tmpdatabasae = Tmpdatabasae.new(tmpdatabasae_params)\n\n respond_to do |format|\n if @tmpdatabasae.save\n format.html { redirect_to @tmpdatabasae, notice: 'Tmpdatabasae was successfully created.' }\n format.json { render :show, status: :created, location: @tmpdatabasae }\n else\n format.html { render :new }\n format.json { render json: @tmpdatabasae.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @em_service = EmService.new(em_service_params)\n\n respond_to do |format|\n if @em_service.save\n format.html { redirect_to list_em_services_path, notice: '创建成功.' }\n format.json { render :show, status: :created, location: @em_service }\n else\n drop_breadcrumb(\"员工服务管理\",em_services_path)\n drop_page_title(\"新增\")\n drop_breadcrumb\n flash.now[:alert] = \"操作失败 #{@em_service.errors.full_messages}\"\n format.html { render :new }\n format.json { render json: @em_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # rp - request parameters\n rp = req_params\n\n # сюда будем собирать ошибки при проверке заявки\n errors = {}\n\n model_name(rp, errors)\n aas_names(rp, errors)\n check_human(rp, errors)\n\n if errors.empty?\n export(rp) if PSOFT_DB\n mail(rp)\n render json: { message: format(I18n.t('request.status.ok'), id: rp.id || ' -') }\n else\n render status: :unprocessable_entity, json: errors\n end\n end",
"def create(database)\n <<-EOS.chomp\n#{database[:id]} = #{database[:database].singularize.capitalize}.new(\n#{indent(field_param(database[:fields]), 1)}\n)\nresponse[:_db_errors][:#{database[:id]}] = #{database[:id]}.errors.full_messages unless #{database[:id]}.save\n EOS\n end",
"def store_alert variable_name\r\n command 'storeAlert', variable_name\r\n end",
"def create\n s = Spooge.new()\n create_status = s.save\n n = generate_random_name\n s.name = n\n s.email = \"#{n}@gmail.com\"\n s.touch_date = DateTime.now\n s.status = STATUS[rand(STATUS.length)]\n\n resp = {:create_status => create_status, :record => s}\n render :json => resp\n end",
"def create\n @service = Service.new(service_params)\n\n if @service.save\n redirect_to tool_path(service_params[:tool_id]); gflash :success => 'Service was successfully created.'\n else\n render action: 'new'\n end\n end",
"def crud_post(resource_name, service_name, primary_key_name, api_options = {})\n api_options = get_defaults(api_options)\n post '/'+resource_name do\n service = settings.send(service_name)\n\n # Get The data\n begin\n data = JSON.parse(request.body.read)\n rescue Exception => e\n return 422\n end\n\n # Valid POST?\n return 422 unless service.valid_insert?(data)\n\n # Already Exists?\n return 409 if service.exists_by_primary_key?(data[primary_key_name])\n\n # Do Insert\n record = service.insert(data)\n\n # Other Error\n return 500 if record.nil?\n\n # Output new record\n JSON.fast_generate record\n end\n end",
"def create(data)\n options = {\n \"url\" => Order.base_uri,\n \"data\" => data\n }\n\n @connector.apply(:post, self, options)\n end",
"def create_old\n @alarm_notification = AlarmNotification.new(params[:alarm_notification])\n\n respond_to do |format|\n if @alarm_notification.save\n format.html { redirect_to @alarm_notification, notice: 'Alarm notification was successfully created.' }\n format.json { render json: @alarm_notification, status: :created, location: @alarm_notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @alarm_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_new_booking_business_event!\n BusinessEvents::BusinessEvent.fire_event(:new_booking, \n {:booking_id => id})\n end",
"def algolia_new_service\n services = Algolia::Index.new(\"services\")\n res = services.add_object({\"title\" => self.title, \"user_id\" => self.user_id, \"id\" => self.id, \"price\" => self.price, \"due_date\" => self.due_date,\n \"youtube_url\" => self.youtube_url, \"category\" => self.category, \"sub_category\" => self.sub_category, \"description\" => self.description,\n \"refund\" => self.refund, \"status\" => self.status, \"title_seo\" => self.title_seo})\n self.algolia_id = res[\"objectID\"]\n self.save\n end",
"def create\n @livingexpense = Livingexpense.new(params[:livingexpense])\n a=['City','Country Name','Food Cost','Accomodation Cost','Transportation Cost','User Email']\n b=[params[:livingexpense][:City],params[:livingexpense][:Country_name],params[:livingexpense][:FoodCost],params[:livingexpense][:AccomodationCost],params[:livingexpense][:TransportationCost],params[:livingexpense][:UserID]]\n \n respond_to do |format|\n if Writetocsv.writedata(a,b)\n format.html { redirect_to @livingexpense, notice: 'Thanks for your feedback!' }\n format.json { render json: @livingexpense, status: :created, location: @livingexpense }\n else\n format.html { render action: \"new\" }\n format.json { render json: @livingexpense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sevice = Sevice.new(sevice_params)\n\n respond_to do |format|\n if @sevice.save\n format.html { redirect_to @sevice, notice: 'Sevice was successfully created.' }\n format.json { render :show, status: :created, location: @sevice }\n else\n format.html { render :new }\n format.json { render json: @sevice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service = Service.new(params[:service])\n\n respond_to do |format|\n if @service.save\n #format.html { redirect_to services_path, notice: 'Service was successfully created.' }\n\tflash[:notice]= 'Service was successfully created.'\n\tformat.html { redirect_to action: 'index'}\n format.json { render json: @service, status: :created, location: @service }\n else\n format.html { render action: \"new\" }\n \n end\n end\n end",
"def create_alert_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AlertApi.create_alert ...\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling AlertApi.create_alert\"\n end\n # resource path\n local_var_path = \"/v2/alerts\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['GenieKey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SuccessResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AlertApi#create_alert\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to(@service, :notice => t(\"screens.notice.successfully_created\")) }\n format.xml { render :xml => @service, :status => :created, :location => @service }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @service.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n \n @service = Service.new(service_params)\n\n \n \n respond_to do |format|\n if @service.save\n @user = session[:user]\n @user_nome = @user[\"nome\"]\n \n @user_email = @user[\"email\"]\n contato = @user_nome\n email = @user_email\n puts @service.id\n service = Service.find(@service.id)\n ContactMailer.contact_message(contato, service, email).deliver\n \n format.html { redirect_to root_path, notice: 'Serviço cadastrado com sucesso!' }\n format.json { render :show, status: :created, location: @service }\n else\n format.html { render :new }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_table(payload)\n make_request(payload, 'post')\n [status, body]\n end",
"def create_employee(database, first_name, last_name, wage, title, last_four_ssn, business_id)\n database.execute(\"INSERT INTO employees (first_name, last_name, wage, title, last_four_ssn, business_id) VALUES (?, ?, ?, ?, ?, ?)\", [first_name, last_name, wage, title, last_four_ssn, business_id])\nend",
"def create\n @eve_notification = EveNotification.new(params[:eve_notification])\n\n respond_to do |format|\n if @eve_notification.save\n format.html { redirect_to @eve_notification, notice: 'Eve notification was successfully created.' }\n format.json { render json: @eve_notification, status: :created, location: @eve_notification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @eve_notification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def insert_routine dataset_id, new_routine_gapi\n execute { service.insert_routine @project, dataset_id, new_routine_gapi }\n end",
"def create_alert(body, opts = {})\n data, _status_code, _headers = create_alert_with_http_info(body, opts)\n return data\n end",
"def create\n @alarm = Alarm.new(alarm_params)\n if @alarm.save\n render json: {\n message: 'Alarm was successfully created.',\n alarm: @alarm\n }\n else\n render json: {\n message: \"Alarm does't created\"\n }\n end\n end",
"def create_task(data)\n pid = data[\"project_id\"]\n priority = data[\"priority\"]\n description = data[\"description\"]\n status = false\n\n response = @db.exec_params(%Q[\n INSERT INTO tasks(project_id, priority, description, status)\n VALUES ($1, $2, $3, $4)\n RETURNING id;\n ], [pid, priority, description, status])\n\n response.first[\"id\"]\n end",
"def create\n p = Prospectus.where(company_id: params[:company_id]).first\n do_mission = DoMission.create(prospectus_id: p.id, operator_id: current_user.id, status: 1, expired_at: Time.now + 10.days)\n render json: retval_wrapper({id: do_mission.id.to_s}) and return\n end",
"def create\n @service = Service.create(service_params)\n end",
"def create\n @datatable_dataelement = DatatableDataelement.new(params[:datatable_dataelement])\n\n respond_to do |format|\n if @datatable_dataelement.save\n format.html { redirect_to @datatable_dataelement, notice: 'Datatable dataelement was successfully created.' }\n format.json { render json: @datatable_dataelement, status: :created, location: @datatable_dataelement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @datatable_dataelement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create new_vals, *args\n raise \":create no longer accepts #{new_vals.inspect}\" if new_vals.is_a?(Symbol) \n\n @new_data = new_vals\n\n validate(:ip)\n validate(:pass_word).required('Pass phrase is required.')\n validate(:confirm_pass_word).required(\"Pass phrase confirmation is required.\")\n\n new_vals[:customer] = self\n sn = Screen_Name.create(new_data)\n\n rec = TABLE.\n returning(:id).\n insert({\n pswd_hash: encode_pass_word(clean_data[:pass_word]),\n id: clean_data[:id]\n }).first\n\n c = self.class.new rec\n c\n end",
"def create\n permission_denied and return if current_user.cannot 'create_odt'\n @odt = Odt.new(odt_params)\n\n respond_to do |format|\n if @odt.save\n format.html { redirect_to odts_url, success: @odt.table_name_to_show.concat(' fue creada satisfactoriamente.') }\n format.json { render :show, status: :created, location: @odt }\n else\n format.html { render :new }\n format.json { render json: @odt.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_incident(data)\n incident = Incident.create(data)\n result = @client.create_business_object({\n :busObNameOrId => 'Incident',\n :creationXml => incident.to_xml\n })\n\n # Result contains the public ID of the new incident, or nil if the\n # incident-creation failed.\n if !result.nil?\n incident['IncidentID'] = result\n return incident\n else\n return nil\n end\n end",
"def create\n \t\n end",
"def create\n obtener_datos()\n @ventum = current_user.ventum.new(cliente:@cliente, clave:@clave, fecha:@fecha, iva:@iva, subtotal:@preciofinal ,total:@totalcosto, descuentogeneral: @descglobal, distribuidor: @distribuidor, status: \"En proceso\")\n respond_to do |format|\n if(@ventum.save)\n salvar()\n format.html { redirect_to @ventum, notice: 'Venta almacenada exitosamente!.' }\n else\n format.html { redirect_to eventos_path, notice: 'Fallo el almacenamiento de la venta.' }\n end\n \n end\n end"
] | [
"0.6776906",
"0.6454275",
"0.6393526",
"0.63153845",
"0.62976557",
"0.62765723",
"0.6269094",
"0.6175672",
"0.61017144",
"0.6071836",
"0.60514116",
"0.6040542",
"0.60163593",
"0.6015284",
"0.6005248",
"0.59955287",
"0.5910299",
"0.5845932",
"0.58431375",
"0.5831812",
"0.5791961",
"0.5776359",
"0.57746273",
"0.5767271",
"0.57361734",
"0.57234514",
"0.57227325",
"0.5715494",
"0.57031274",
"0.5681095",
"0.56738114",
"0.5653821",
"0.5653821",
"0.56467503",
"0.564406",
"0.56253004",
"0.56225264",
"0.5579805",
"0.5564848",
"0.5558221",
"0.55551624",
"0.5545619",
"0.55359524",
"0.5523023",
"0.55227554",
"0.55077577",
"0.5503271",
"0.5498665",
"0.54934007",
"0.5492412",
"0.5489145",
"0.54879963",
"0.5482613",
"0.5475244",
"0.54735947",
"0.54735947",
"0.54724026",
"0.5457561",
"0.54490125",
"0.5436789",
"0.543213",
"0.5416449",
"0.5411159",
"0.5406181",
"0.539673",
"0.5395607",
"0.5392772",
"0.53926766",
"0.5384047",
"0.5376749",
"0.53765637",
"0.5374827",
"0.53743017",
"0.5369622",
"0.53617996",
"0.536089",
"0.5360543",
"0.53582525",
"0.5352687",
"0.53440344",
"0.53434163",
"0.5339727",
"0.53362864",
"0.5331916",
"0.53280467",
"0.5322753",
"0.5321192",
"0.53140295",
"0.5313543",
"0.5300387",
"0.5295861",
"0.5295534",
"0.529408",
"0.52930146",
"0.52928716",
"0.52899164",
"0.5286775",
"0.527857",
"0.5277929",
"0.5261212"
] | 0.8190501 | 0 |
Helper function to destroy all the items in the database | def clean_db
Mongoid::Sessions.default.collections.select {|c| c.name !~ /system/}.each {|c| c.find.remove_all}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_all\n all.each(&:destroy)\n end",
"def destroy_all\n ids = self.all.map{|item| item.id}\n bulk_update do\n ids.each do |item|\n find(item).destroy\n end\n end\n # Note collection is not emptied, and next_id is not reset.\n end",
"def destroy_all\n ids = self.all.map{|item| item.id}\n bulk_update do\n ids.each do |item|\n find_by_id(item).destroy\n end\n end\n # Note collection is not emptied, and next_id is not reset.\n end",
"def destroy_all\n all.each(&:destroy)\n end",
"def destroy_all\n all.each do |n|\n n.destroy\n end\n end",
"def destroy_all\n each(&:destroy_all)\n end",
"def clean_database\n [Entry, Room, User].each do |model|\n model.delete_all\n end\nend",
"def delete_all\n self.destroy\n end",
"def clear_db\n DB.from(\"mentees\").delete\n DB.from(\"mentors\").delete\n DB.from(\"admins\").delete\n DB.from(\"users\").delete\n DB.from(\"codes\").delete\n DB.from(\"requests\").delete\n DB.from(\"questions_answers\").delete\nend",
"def deleteItems\n self.items.each do |item|\n item.delete\n end\n end",
"def db_clear\n [Project, Milestone, Category, Version, LoaderRelease].each {|x| x.delete_all}\n end",
"def destroy_everything\n destroy_user_key_columns\n destroy_user_key_organizations\n destroy_whitelists\n destroy_approvals\n destroy_user_keys\n destroy_users\n destroy_comments\n destroy_filters\n destroy_columns\n destroy_organizations\n end",
"def clear_db\n users = User.all\n users.delete_all\n companies = Company.all\n companies.delete_all\n feedbacks = Feedback.all\n feedbacks.delete_all\n co_emp = CompanyEmployee.all\n co_emp.delete_all\n projects = Project.all\n projects.delete_all\n proj_fb = ProjectFeedback.all\n proj_fb.delete_all\nend",
"def remove_all()\n @items.clear()\n end",
"def delete_all\n begin\n db.execute \"TRUNCATE TABLE #{table}\"\n\n rescue SQLite3::Exception => e\n puts \"Database Exception occured\"\n puts e\n \n ensure\n db.close if db\n end\n end",
"def clear_all_in_database\n Tweet.destroy_all\n User.destroy_all\n Follow.destroy_all\n end",
"def clear_all_in_database\n Tweet.destroy_all\n User.destroy_all\n Follow.destroy_all\n end",
"def destroy\n pr = proc{all(&:destroy).length}\n model.use_transactions ? @db.transaction(:server=>opts[:server], &pr) : pr.call\n end",
"def destroy\n pr = proc{all(&:destroy).length}\n model.use_transactions ? @db.transaction(:server=>opts[:server], &pr) : pr.call\n end",
"def clear_database\n User.destroy_all\n Animal.destroy_all\n Report.destroy_all\nend",
"def delete\n @@all_items.delete(@id)\n end",
"def destroy_all\n destroy_users\n puts \"Destroyed users\"\n destroy_comments\n puts \"Destroyed comments\"\n destroy_costs\n puts \"Destroyed costs\"\n destroy_service_locations\n puts \"Destroyed service locations\"\n destroy_service_contacts\n puts \"Destroyed service contacts\"\n destroy_services\n puts \"Destroyed services\"\n destroy_service_types\n puts \"Destroyed service types\"\n destroy_locations\n puts \"Destroyed locations\"\n destroy_contacts\n puts \"Destroyed contacts\"\n destroy_categories\n puts \"Destroyed categories\"\n end",
"def delete_all\n @objects.each do |o|\n o.delete \n end\n\n @objects.clear\n end",
"def destroy_all(conditions = nil)\n find_all(conditions).each { |object| object.destroy }\n end",
"def cleanup\n @models.reverse_each(&:destroy_all)\n end",
"def clean\n transaction do\n connection.delete \"DELETE FROM line_items WHERE event_id IN (SELECT id FROM events WHERE subscription_id = #{id})\"\n connection.delete \"DELETE FROM account_items WHERE event_id IN (SELECT id FROM events WHERE subscription_id = #{id})\"\n connection.delete \"DELETE FROM tagged_items WHERE event_id IN (SELECT id FROM events WHERE subscription_id = #{id})\"\n\n connection.delete \"DELETE FROM buckets WHERE account_id IN (SELECT id FROM accounts WHERE subscription_id = #{id})\"\n connection.delete \"DELETE FROM statements WHERE account_id IN (SELECT id FROM accounts WHERE subscription_id = #{id})\"\n\n connection.delete \"DELETE FROM actors WHERE subscription_id = #{id}\"\n connection.delete \"DELETE FROM events WHERE subscription_id = #{id}\"\n connection.delete \"DELETE FROM accounts WHERE subscription_id = #{id}\"\n connection.delete \"DELETE FROM tags WHERE subscription_id = #{id}\"\n end\n end",
"def purge_db\n\tUser.delete_all\n\tSubscription.delete_all\n\tDorkus.delete_all\nend",
"def delete_all\n records.clear\n end",
"def db_clear\n [Project, Milestone, Category, Version, LoaderRelease].each(&:delete_all)\n end",
"def clean\n\t\t\n\t\[email protected] 'twitter'\n\t\[email protected] 'rpg'\n\t\n\tend",
"def destroy_all\n klass.destroy_all(:conditions => selector)\n end",
"def destroy\n @item.destroy!\n end",
"def clear_all()\n User.destroy_all\n Hashtag.destroy_all\n Mention.destroy_all\n Tweet.destroy_all\n Follow.destroy_all\n # Hashtag_tweets.destroy_all\nend",
"def clean_up!\n puts Item.where(thread_id: self.uid).count\n Item.where(thread_id: self.uid).destroy_all\n @forum_items = []\n self.items = []\n self.items_md5 = nil\n save\n end",
"def destroy_everything\n Event.destroy_all\n Hotel.destroy_all\n Amenity.destroy_all\n Article.destroy_all\n User.destroy_all\nend",
"def destroy_all\n begin\n Location.destroy_all\n Affiliation.destroy_all\n Person.destroy_all\n\n render json: {\n success: 'Deleted all data successfully'\n }\n rescue => e\n render json: {\n error: e\n }\n end\n end",
"def delete_all\n store.delete(KEY)\n self\n end",
"def destroy_rooms\n rooms.destroy_all\n end",
"def clear_db\n\t\tdb = SQLite3::Database.open \"simpl.db\"\n\t\tdb.execute \"DELETE FROM user;\"\n\t\tdb.execute \"DELETE FROM merchant;\"\n\t\tdb.execute \"DELETE FROM transactions;\"\n\tend",
"def clear_db\n\t\tdb = SQLite3::Database.open \"simpl.db\"\n\t\tdb.execute \"DELETE FROM user;\"\n\t\tdb.execute \"DELETE FROM merchant;\"\n\t\tdb.execute \"DELETE FROM transactions;\"\n\tend",
"def delete_all\n\t\t\t@@driver.delete_all\n\t\tend",
"def delete_all(table)\n\t\t\t\ttable.clear\n\t\t\tend",
"def destroy\n # delete object from the DB\n # DB.execute(\"DELETE .....\")\n end",
"def cleanup(args = nil)\n opts = args ? @options.merge(args) : @options\n\n print \"Cleaning database...\"\n\n ProductTest.where({name: \"measureEvaluationTest\"}).each do |test|\n Result.where({\"value.test_id\" => test.id}).destroy_all\n QME::QualityReport.where({\"test_id\" => test.id}).destroy_all\n HealthDataStandards::CQM::QueryCache.where({\"test_id\" => test.id}).destroy_all\n test.destroy\n end\n\n p = Product.where({name: \"MeasureEvaluationProduct\"}).first\n ProductTest.where({_type: \"QRDAProductTest\", product: p}).destroy_all\n\n Vendor.where({name: \"MeasureEvaluationVendor\"}).destroy_all\n Product.where({name: \"MeasureEvaluationProduct\"}).destroy_all\n\n puts \"done\"\n end",
"def finalize\n Pez.destroy_all\n Comida.destroy_all\n Tiburon.destroy_all\n end",
"def delete\n\t\tcurrent_user\n\t\tcurrent_user.regexpressions.destroy_all\n\t\tcurrent_user.tasks.destroy_all\n\t\tcurrent_user.clouds.destroy_all\n\t\tcurrent_user.platforms.destroy_all\n\t\tcurrent_user.demos.destroy_all\n\t\tcurrent_user.favorites.destroy_all\n\tend",
"def after_destroy\n ExhibitItem.destroy_all( [ \"exhibiting_id=? AND exhibiting_type=?\", self.id, self.class.name ] )\n ResourceListItem.destroy_all( [ \"resource_listing_id=? AND resource_listing_type=?\", self.id, self.class.name ] )\n PackageItem.destroy_all( [ \"packaging_id=? AND packaging_type=?\", self.id, self.class.name ] )\n end",
"def delete_purchase_order_items\n purchase_order_items.destroy_all\n end",
"def delete_all\n self.store.delete_keys(find_keys)\n end",
"def delete_all\n @owner.transaction do\n self.each { |obj| obj.delete }\n end\n @members.clear\n end",
"def destroy_all\n repositories.each {|name, repo| repo.destroy}\n end",
"def delete_all_recipes(db)\n q = \"DELETE FROM recipes;\"\n return db.execute(q)\nend",
"def destroy\n all.each { |file| FileUtils.rm_f(file) }\n end",
"def clear_db\n @@db.clear_db\n end",
"def destroy_all\n @order = current_order\n @basket_items = @order.basket_items\n @basket_items.clear\n redirect_to(:back)\n end",
"def clear!\n transaction do\n Schema::TABLES.each do |table|\n execute(\"DELETE FROM #{table}\")\n execute(\"DELETE FROM sqlite_sequence WHERE name = '#{table}'\") # reset the auto-increment sequence\n end\n end\n self\n end",
"def truncate_all\n Content::Version.all.map(&:destroy)\n ContentKey::Version.all.map(&:destroy)\n Content.all.map(&:destroy)\n ContentKey.all.map(&:destroy)\n end",
"def purge!\n\n fetch_all({}).each { |hwi| @context.storage.delete(hwi) }\n end",
"def wipe!\n resource_factory.orm_class.delete_all\n end",
"def destroy_entities entities; end",
"def delete_all!\n delete(query: \"*:*\")\n end",
"def deleteAll(xs)\n xs.each do |x|\n x.destroy\n end\n end",
"def teardown\n Allergy.destroy_all\n Recipe.destroy_all\n Ingredient.destroy_all\n end",
"def clear_teams\n\t@table_array.each do |each_table_name|\n\t\[email protected](\"DROP TABLE IF EXISTS \" + each_table_name)\n\tend\nend",
"def destroy_simple_game\n Zone.destroy_all\n ZoneHolder.destroy_all\n User.destroy_all\n Team.destroy_all\n Task.destroy_all\n Hint.destroy_all\n Code.destroy_all\n CodeString.destroy_all\n TeamCode.destroy_all\n TeamHint.destroy_all\n Log.destroy_all\n Game.destroy_all\nend",
"def cleanup\n self.objectives.destroy_all\n end",
"def delete_all(name); end",
"def clear_database_table\n <%= class_name %>.delete_all\n end",
"def destroyAll\n Staging.all.each do |staging|\n\tStaging.destroy(staging)\n end\n\tredirect_to :action => 'index'\n end",
"def clear_all\n Test.all.each do |test|\n test.clear_all\n test.save\n end\n \n redirect_to admin_root_path\n end",
"def destroy_questions\n self.questions.each(&:destroy)\n end",
"def clear\n @db.clear\n self\n end",
"def delete_all_titles\n $db_connection.exec('DELETE FROM title_register_data;')\nend",
"def clear_db()\n ScraperWiki.sqliteexecute('DELETE FROM event')\nend",
"def clear_db()\n ScraperWiki.sqliteexecute('DELETE FROM event')\nend",
"def flush_database\n\t\t\tp \"Flushing Database\"\n\t\t\tAdmin.destroy_all\n\t\t\tCountry.destroy_all\n\t\t\tDoorkeeper::Application.destroy_all\n\t\tend",
"def delete_all\n my_trans = Transaction.find_all_by_user_id(current_user.id)\n my_trans.each do |trans|\n trans.destroy\n end\n\n redirect_to transactions_url\n end",
"def destroy\n prepare_collection_query\n\n @query.where(\"#{@grid.model.arel_table.name}.id in (?)\", params[:ids]).each(&:destroy)\n render :json => { status: \"OK\" }\n end",
"def delete_all\n Nvmkv.kv_delete_all(@kv_id)\n end",
"def clear!\n @items.clear\n save\n end",
"def purge\n @db.execute( \"DELETE FROM #{TABLE_NAME};\" )\n end",
"def clear_db\n clear_urls + clear_docs\n end",
"def clean!\n FAKEABLE.map(&:constantize).map(&:destroy_all)\n end",
"def destroy\n DB.execute <<SQL\nDELETE FROM #{self.class.table}\nWHERE id = #{@hash['id']}\nSQL\n end",
"def purge\n\n DataMapper.repository(@dm_repository) {\n\n DmExpression.all.each { |de| de.destroy }\n #\n # TODO : find simpler way to do that\n }\n end",
"def destroy_data\n # ActiveRecord::Base.connection.execute(\"DELETE FROM watchables\")\n end",
"def destroy\n DATABASE.destroy(self)\n end",
"def delete_existing\n Answer.delete_all\n Question.delete_all\n Knock.delete_all\n Door.delete_all\n Canvasser.delete_all\nend",
"def clear_all_tags()\n puts \"Deleting Tags...\"\n Tag.delete_all()\n puts \"Finished deleting all tags.\"\nend",
"def delete_all\n target.clear\n end",
"def destroy_all(conditions=nil)\n if conditions\n where(conditions).destroy_all\n else\n to_a.each {|object| object.destroy}\n @records\n end\n end",
"def destroy\n @question = Question.find(:all)\n @question.each do |q|\n q.destroy\n end\n end",
"def clean_all_tags\n self.tags.destroy_all\n self.countries.destroy_all\n self.requirements.destroy_all\n self.places.destroy_all\n end",
"def destroy_all\n posts = current_user.posts\n\n posts.each do |post|\n post.destroy\n end\n\n redirect_to posts_url, :notice => \"Destroyed all Posts.\"\n end",
"def destroy\n [METADATA_TABLE_NAME, RUN_HISTORY_TABLE_NAME,\n DISABLED_MONITOR_TABLE_NAME, MONITOR_INFO_TABLE_NAME].each do |table|\n @db.execute(\"DROP TABLE IF EXISTS #{table}\")\n end\n\n create()\n end",
"def deleteAll\n Record.destroy_all()\n redirect_to(records_path)\n end",
"def destroy_dependents\n self.clouds.each do |cloud| cloud.destroy end\n self.groups.each do |group| group.destroy end\n self.roles.each do |role| role.destroy end\n self.recipes.each do |recipe| recipe.destroy end\n self.questions.each do |question| question.destroy end\n end",
"def purge_items\n purge(@nodename)\n end",
"def destroy\n @list_id = @item.list.id\n @item.destroy\n @items = List.find(@list_id).items.order(\"id ASC\")\n end",
"def drop_db\n Mongoid.purge!\n end",
"def delete_tables\n delete_characters\n delete_kiosks\n delete_traps\n delete_buttons\n end"
] | [
"0.8058331",
"0.80073225",
"0.79958665",
"0.79379594",
"0.7917818",
"0.78249156",
"0.7765221",
"0.76456314",
"0.7447312",
"0.7352165",
"0.73212653",
"0.7313179",
"0.73008543",
"0.7280139",
"0.72565275",
"0.7247529",
"0.7247529",
"0.72168756",
"0.72168756",
"0.71895045",
"0.7158145",
"0.71380997",
"0.71193737",
"0.7112563",
"0.7106619",
"0.71028036",
"0.71002275",
"0.7098995",
"0.70714974",
"0.70197016",
"0.70133525",
"0.7002383",
"0.69957316",
"0.69908035",
"0.6981673",
"0.6927169",
"0.68771183",
"0.6869556",
"0.685182",
"0.685182",
"0.6838796",
"0.6834483",
"0.6827901",
"0.68264145",
"0.6817242",
"0.6816109",
"0.68139476",
"0.68094426",
"0.68042344",
"0.6776766",
"0.6772386",
"0.6750554",
"0.6737653",
"0.67371154",
"0.6732866",
"0.672738",
"0.6727188",
"0.6724601",
"0.6720783",
"0.672026",
"0.6691867",
"0.6690541",
"0.6690465",
"0.6688976",
"0.6686701",
"0.66846913",
"0.66832346",
"0.6681992",
"0.66499716",
"0.6630837",
"0.66300505",
"0.6627371",
"0.66200435",
"0.6618958",
"0.6618958",
"0.66116494",
"0.66047",
"0.66018647",
"0.65752727",
"0.65724957",
"0.65712553",
"0.65693355",
"0.6562507",
"0.65599227",
"0.6559751",
"0.65506166",
"0.6548531",
"0.6546746",
"0.65425885",
"0.65227145",
"0.65173703",
"0.6514456",
"0.65024114",
"0.6498226",
"0.64871633",
"0.6485454",
"0.6477423",
"0.6476242",
"0.6474513",
"0.64734644",
"0.6472885"
] | 0.0 | -1 |
Helper function to clean Sidekiq queues | def clean_sidekiq
Sidekiq::Worker.clear_all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redis_queues_cleanup!\n Gitlab::Redis::Queues.with(&:flushall)\n end",
"def redis_queues_cleanup!\n Gitlab::Redis::Queues.with(&:flushdb)\n end",
"def clean\n clean_queued\n clean_running\n end",
"def clean!\n clean_queue!\n clean_activity!\n end",
"def clear_queues_cache\n channel.queues.clear\n end",
"def clear\n jobs.each do |job|\n SidekiqUniqueJobs::Unlockable.unlock(job)\n end\n\n Sidekiq::Queues[queue].clear\n jobs.clear\n end",
"def purge_queues\n [incoming_queue_url, outgoing_queue_url].each do |queue_url|\n while true\n messages = client.receive_message(queue_url: queue_url, max_number_of_messages: 10).messages\n break unless messages.first\n messages.each do |message|\n client.delete_message(queue_url: queue_url, receipt_handle: message.receipt_handle)\n end\n end\n end\n end",
"def reset workers\n workers.each{|worker| @queues[worker].clear if @queues[worker]}\n end",
"def clear_queues\n RosettaQueue::Destinations.queue_names.each do |name| \n queue = name.gsub('/queue/','')\n open(\"http://127.0.0.1:8161/admin/deleteDestination.action?JMSDestination=#{queue}&JMSDestinationType=queue\")\n end\n end",
"def destroy\n @redis.pipelined do\n @redis.del @redis_name\n @redis.srem(:queues, @name)\n end\n @destroyed = true\n end",
"def setup\n Sidekiq::Worker.clear_all\n end",
"def purge\n @queue.purge\n end",
"def purge\n @queue.purge\n end",
"def purge\n @queue.purge\n end",
"def clean_queue!\n # Go through the song queue from start to end\n queued_songs.each_with_index do |song, index|\n if song['playAt'] + song['duration'] > Time.now.to_i\n # This song is still ok to have, trim of all the ones to the left\n $redis.ltrim(queue_key, index, -1)\n return\n end\n end\n\n # Okay, every song has played already, nuke it\n $redis.del(queue_key)\n end",
"def clear\n LOCK.synchronize do\n @queue.each do |_, jobs|\n jobs.each do |job|\n job.close\n @registry.delete(job.id)\n end\n end\n\n @queue.clear\n end\n end",
"def shutdown\n workers.size.times{ trim(true) }\n workers.first.join && trim(true) until workers.empty?\n mutex.synchronize{ queue.clear }\n end",
"def handle_queue_clear(args)\n @queue = [[]]\n end",
"def purge_interrupt_queue; end",
"def purge_interrupt_queue; end",
"def destroy!\n sqs.delete_queue(queue_url: address)\n end",
"def daemon_clean_up\n TaskQueue.where(id: $daemon[:heartbeat_task_queue_id]).destroy_all\n File.delete($daemon[:pid_file])\nend",
"def clear\n @queue.clear\n end",
"def clear\n LOCK.synchronize do\n @queue.each { |_, jes| jes.each(&:close) }\n @queue.clear\n end\n end",
"def cleanup\n GoodJob.cleanup_preserved_jobs\n end",
"def purge\n t = Time.now\n expired = []\n @queue.each do |identity,worker|\n expired << identity if t > worker.expiry\n end\n expired.each do |identity|\n @queue.delete identity\n end\n end",
"def flush_jobs\n queued_jobs&.each(&:call)&.clear\n end",
"def clear\n queue.clear\n end",
"def destroy!\n children = @zk.children(full_queue_path)\n locks = []\n children.each do |path|\n lock = @zk.locker(\"#{full_queue_path}/#{path}\")\n lock.lock!\n locks << lock\n end\n children.each do |path|\n @zk.delete(\"#{full_queue_path}/#{path}\")\n end\n @zk.delete(full_queue_path)\n locks.each do |lock|\n lock.unlock!\n end\n end",
"def purge_queue\n Varnisher.log.info 'Purging resources...'\n\n Parallel.map(@urls) do |url|\n Varnisher.log.debug \"Purging #{url}...\"\n\n Varnisher.purge(url.to_s)\n end\n\n Varnisher.log.info 'Done.'\n end",
"def clear_queue(queue_name)\n if queue_name.kind_of?(Class)\n queue_name = queue_name.instance_variable_get(\"@queue\")\n end\n if queue_name == :delayed\n Resque.reset_delayed_queue\n else\n Resque.redis.del(\"queue:#{queue_name}\")\n Resque.redis.del(\"resque:queue:#{queue_name}\")\n end\n end",
"def reset_delayed_queue\n redis.del :delayed_queue\n end",
"def destroy_all\n queue = params[:queue] || 'failed'\n Resque::Failure.clear(queue)\n redirect_to failures_path(redirect_params)\n end",
"def flush_redis_queues (array_of_connection_pools)\n\t#array_of_connection_pools.each { |redis| \n # Sidekiq.redis = redis\n #Sidekiq.redis {|c| c.flushdb rescue nil}\n #}\nend",
"def cleanup_callback_queue\n ObjectSpace.undefine_finalizer(@queue_id) if @queue_id\n return unless @callback_queue && callback_queue.alive?\n\n begin\n callback_queue.shutdown\n rescue MessageQueueDeadError\n end\n end",
"def delete_from_delayed_queue\n queue = Sidekiq::Queue.new('mailers')\n queue.each do |job|\n assignmentId = job.args.first\n job.delete if @assignment.id == assignmentId\n end\n\n queue = Sidekiq::ScheduledSet.new\n queue.each do |job|\n assignmentId = job.args.first\n job.delete if @assignment.id == assignmentId\n end\n end",
"def unlock_queueing_for_queue(queue)\n Resque.data_store.everything_in_queue(queue).uniq.each do |string|\n item = Resque.decode(string)\n\n unlock_queueing(queue, item).tap { RecoveringQueue.remove(queue, item) }\n end\n end",
"def clear_all\n super\n SidekiqUniqueJobs::Digests.new.del(pattern: \"*\", count: 1_000)\n end",
"def flush_deletes\n @queued_for_delete.each do |path|\n client.delete_object(path) if client.object_exists?(path)\n end\n @queue_for_delete = []\n end",
"def cleanup()\n @threads.each do |name, thread| \n @threads.delete name if thread.state == :dead\n end\n end",
"def clear_queue(queue_name)\r\n execute :delete, \"#{queue_name}/messages\", {}, :x_ms_version => '2009-09-19'\r\n end",
"def clear_queue\n case @remove\n when 'one'\n puts \"Clearing e-mails #{@search_direction} #{@email}\"\n puts ''\n `exiqgrep -i #{@direction} #{@email} | xargs -P10 -i exim -Mrm '{}' >/dev/null`\n when 'all'\n if @valid_domain\n puts \"Removing all e-mails #{@search_direction} #{@domain}\"\n `exiqgrep -i #{@direction} #{@domain} | xargs -P10 -i exim -Mrm '{}' >/dev/null`\n else\n puts \"#{@domain} is not a valid local domain. Removing e-mails #{@search_direction} #{@email} instead\"\n `exiqgrep -i #{@direction} #{@email} | xargs -P10 -i exim -Mrm '{}' >/dev/null`\n end\n else\n puts \"Didn't remove any emails from the mailque\"\n end\n end",
"def destroy_all\n proxy_target.each { |queue| queue.destroy }\n true\n end",
"def redis_cleanup\n keys = redis.keys\n redis.del(keys) unless keys.empty?\nend",
"def clear\n synchronize do\n @queue.clear\n end\n end",
"def clear\n synchronize do\n @queue.clear\n end\n end",
"def clearQueue\n @itemList.clear()\n end",
"def clear\n synchronize do\n @queue.clear\n end\n end",
"def deq\n @queued = false\n nil\n end",
"def cleanup\n $redis.del key('chat')\n $redis.del key('messages')\n end",
"def purge\n @channel.queue_purge(@name)\n end",
"def purge(*queues)\n queues = determine_queue_names(queues)\n publisher.purge(queues)\n end",
"def close\n @shutdown_mutex.lock\n @queues.each_pair do |name,queue|\n queue.close\n @queues.delete(name)\n end\n end",
"def clear_queue_values\n @queue_values = {}\n end",
"def clear\n @que.clear\n end",
"def clear\n @que.clear\n end",
"def clear_queue\n @postponed_queries = []\n\n self\n end",
"def destroy\n profile = calc_profile\n cmd = \"jms-queue #{profile} remove --queue-address=#{@resource[:name]}\"\n bring_down 'JMS Queue', cmd\n end",
"def cleanup\n return if @max_age == 0\n timeout = Time.now - @max_age\n conditions = ['last_send_attempt > 0 and created_on < ?', timeout]\n mail = ActionMailer::Base.email_class.destroy_all conditions\n\n log \"expired #{mail.length} emails from the queue\"\n end",
"def cleanup\n if @_rmq_data\n @_rmq_data.cleanup\n @_rmq_data = nil\n end\n end",
"def clear_compaction_queues(server_name, queue_name = nil)\n names = %w[long short]\n queues = java.util.HashSet.new\n if queue_name.nil?\n queues.add('long')\n queues.add('short')\n elsif queue_name.is_a?(String)\n queues.add(queue_name)\n unless names.include?(queue_name)\n raise(ArgumentError, \"Unknown queue name #{queue_name}\")\n end\n elsif queue_name.is_a?(Array)\n queue_name.each do |s|\n queues.add(s)\n unless names.include?(s)\n raise(ArgumentError, \"Unknown queue name #{s}\")\n end\n end\n else\n raise(ArgumentError, \"Unknown queue name #{queue_name}\")\n end\n @admin.clearCompactionQueues(ServerName.valueOf(server_name), queues)\n end",
"def cleanup!\n LOGGER.warn \"Received cleanup request, killing all jobs and deployments...\"\n DEPLOYMENTS.each{|deployment| deployment.delete}\n JOBS.each{|job| job.delete}\nend",
"def done!\n @meta[Cworked_at] = nil\n put_meta\n\n # remove from both queues\n rcache.lrem(queue.working_cache_key, 0, trx_id)\n rcache.lrem(queue.retries_cache_key, 0, trx_id)\n end",
"def clear\n @gate.synchronize do\n @queue = []\n @has_faulted = true\n end\n end",
"def reset!\n @queue = []\n @consumers = []\n end",
"def reset\n Sidekiq.redis do |conn|\n conn.keys(namespace_key(\"*\")).each do |key|\n conn.del(key)\n end\n end\n end",
"def purge_queue(name, options = {})\n subject.queue_purge(name, options)\n end",
"def destroy\n if is_runasdomain\n profile = \"--profile=#{@resource[:profile]}\"\n else\n profile = ''\n end\n cmd = \"jms-queue #{profile} remove --queue-address=#{@resource[:name]}\"\n bringDown \"JMS Queue\", cmd\n end",
"def flush\n @queue.clear\n end",
"def clear\n @que.clear\n end",
"def purge_expired_workers\n @services.purge_expired_workers\n end",
"def flush; queue.close end",
"def destroy\n Sidekiq.redis do |conn|\n # delete from set\n conn.srem self.class.jobs_key, redis_key\n\n # delete runned timestamps\n # conn.del job_enqueued_key\n\n # delete jid_history\n conn.del jid_history_key\n\n # delete main job\n conn.del redis_key\n end\n\n logger.info { \"CRON JOB: deleted job with name: #{@name}\" }\n end",
"def execution_queue_finalizer(execution_id)\n\t\tproc do\n\t\t\t@execution_queues.synchronize(:EX) do\n\t\t\t\t@execution_queues.delete(execution_id)\n\t\t\tend\n\t\tend\n\tend",
"def remove!\n @queue_for_removal.each do |path|\n FileUtils.rm(path) if File.exist?(path)\n end\n @removed = @queue_for_removal.dup\n @queue_for_removal.clear\n end",
"def clean\n puts \"== removing all data from redis ==\"\n submission_keys = redis.lrange(SUBMISSIONS_KEY, 0, -1)\n redis.del(submission_keys) unless submission_keys.empty?\n redis.del(SUBMISSIONS_KEY)\n end",
"def clear\n @que.clear\n self\n end",
"def cleanup\n @cleanup_tracker.reset\n\n future = Concurrent::Future.new(args: [self, @performer], executor: executor) do |_thr_scheduler, thr_performer|\n Rails.application.executor.wrap do\n thr_performer.cleanup\n end\n end\n\n observer = lambda do |_time, _output, thread_error|\n GoodJob._on_thread_error(thread_error) if thread_error\n create_task\n end\n future.add_observer(observer, :call)\n future.execute\n end",
"def create_queues\n queue\n exchange\n end",
"def clear\n @queue.clear\n true\n end",
"def clean_up!\n puts Item.where(thread_id: self.uid).count\n Item.where(thread_id: self.uid).destroy_all\n @forum_items = []\n self.items = []\n self.items_md5 = nil\n save\n end",
"def queues\n\t\t\t@queues ||= {}\n\t\tend",
"def refill_all_queues!\n # Dla POST musi byc jakies 'body' requestu, bo serwery czesto rzucaja wyjatkami (WEBrick w szczegolnosci).\n post '/queues/refill_all', :body => ' '\n true\n end",
"def clean!\n @pool_mutex.synchronize { _clean }\n end",
"def flush_spaces\n Server.redis { |c| c.del(\"#{QPush::Base::KEY}:namespaces\") }\n end",
"def clear_workers!\n Shuttle::Redis.del worker_set_key\n if loading?\n self.loading = false\n save!\n end\n end",
"def redis_shared_state_cleanup!\n Gitlab::Redis::SharedState.with(&:flushall)\n end",
"def clear\n kill\n workers.dup.each do |w|\n if w != self_slave\n remove_slave(w)\n end\n end\n end",
"def remove_from_queue\n Resque.remove_delayed(SchedulerJob, :id => self.id)\n end",
"def clean\n # Each the tasks\n @tasks.each do |task|\n # Clean all of them\n task.clean\n end\n end",
"def cleanup\n if running?\n logger.info \"Cleaning up agent, queue size: #{@queue.size}, thread running: #{@thread.alive?}\"\n @allow_reconnect = false\n queue_metric('exit')\n begin\n with_timeout(EXIT_FLUSH_TIMEOUT) { @thread.join }\n rescue Timeout::Error\n if @queue.size > 0\n logger.error \"Timed out working agent thread on exit, dropping #{@queue.size} metrics\"\n else\n logger.error \"Timed out PirateMetrics Agent, exiting\"\n end\n end\n end\n @thread = nil\n end",
"def destroy_all\n params[:jobs_queue_ids].each do |jobs_queue_id|\n jobs_queue = JobsQueue.find(jobs_queue_id)\n jobs_queue.destroy if current_user.groups.default.first.jobs_queues.include?(jobs_queue) and jobs_queue.jobs.size.zero?\n end unless params[:jobs_queue_ids].blank?\n \n respond_to do |format|\n format.html { redirect_to(jobs_queues_url(:show => params[:show], :sort => params[:sort], :search => params[:search])) }\n format.xml { head :ok }\n end\n end",
"def purge\n Lock.transaction do\n deleted.all.each do |lock|\n msg = lock.message\n lock.destroy\n msg.destroy\n end\n end\n end",
"def unsubscribe(queue_names, &block)\n unless failed?\n @queues.reject! do |q|\n if queue_names.include?(q.name)\n begin\n logger.info(\"[stop] Unsubscribing queue #{q.name} on broker #{@alias}\")\n q.unsubscribe { block.call if block }\n rescue StandardError => e\n logger.exception(\"Failed unsubscribing queue #{q.name} on broker #{@alias}\", e, :trace)\n @exception_stats.track(\"unsubscribe\", e)\n block.call if block\n end\n true\n else\n false\n end\n end\n end\n true\n end",
"def clear_intention_queue\n state.delete \"queued_actions\"\n nil\n end",
"def dequeue\n self.job.destroy if self.job.present?\n self.job_id = nil\n end",
"def delete_worker\n\n rmq = Thread.current[:rmq_exchange]\n t = Thread.new(self) do |name|\n\n Thread.current[:name] = name\n Thread.current[:rmq_exchange] = rmq\n deleter = Delete.new(@broker_id, @platform, @server, @entity,\n {\n destination: @dst_class.new(@pg_connection, @broker_id, @platform, @server, @entity),\n cache: @cache\n })\n\n begin\n deleter.launch\n rescue Exception => msg\n Helper.error(msg, deleter)\n raise msg\n end\n end\n\n # Abort main thread in case child exceptions\n t.abort_on_exception = true if $config[:env][:stop_on_thread_ex]\n t\n\n end",
"def empty_queue(client_id)\n return unless @server.has_connection?(client_id)\n @server.debug 'Delivering messages to ?', client_id\n @server.deliver(\n client_id,\n @messages.remove(client_id).map(&MultiJson.method(:load))\n )\n end",
"def teardown\r\n @scheduler_service.deleteJobs( @test_jobs ) if !@test_jobs.nil? \r\n end",
"def get_queues\n @gem_queue = get_queue 'gem'\n @md5_queue = get_queue 'md5'\n @sha512_queue = get_queue 'sha512'\n end"
] | [
"0.8264004",
"0.8174867",
"0.75170165",
"0.74931175",
"0.734488",
"0.7253696",
"0.7235889",
"0.7138078",
"0.7127352",
"0.711059",
"0.71033424",
"0.703653",
"0.703653",
"0.703653",
"0.6979667",
"0.69509596",
"0.6854539",
"0.6843133",
"0.6829785",
"0.6829785",
"0.6743291",
"0.67392045",
"0.6705007",
"0.6640436",
"0.6639131",
"0.6606049",
"0.6582179",
"0.65639174",
"0.65637696",
"0.65103346",
"0.6506725",
"0.65067106",
"0.64472145",
"0.6436553",
"0.64307714",
"0.6423823",
"0.64102376",
"0.6406626",
"0.63979286",
"0.6362904",
"0.6359894",
"0.63377726",
"0.63180256",
"0.6306729",
"0.63056463",
"0.63056463",
"0.6294183",
"0.6283128",
"0.62719905",
"0.6263312",
"0.6230061",
"0.6205823",
"0.620511",
"0.6193915",
"0.61858076",
"0.61858076",
"0.61779064",
"0.6171217",
"0.6136596",
"0.61350906",
"0.61247694",
"0.6104532",
"0.61005616",
"0.6100248",
"0.6099841",
"0.6095308",
"0.6065891",
"0.60496485",
"0.602161",
"0.60184854",
"0.60159916",
"0.60074604",
"0.59977984",
"0.5981597",
"0.59813607",
"0.59612197",
"0.59599984",
"0.5952747",
"0.5950664",
"0.59368074",
"0.59111464",
"0.58990335",
"0.5880211",
"0.5879171",
"0.5869475",
"0.5864456",
"0.5858996",
"0.5850439",
"0.58427763",
"0.58426225",
"0.58156544",
"0.57810295",
"0.57781905",
"0.57674176",
"0.57605326",
"0.5753031",
"0.57518494",
"0.57465696",
"0.5738319",
"0.5734268"
] | 0.80950344 | 2 |
above should make gender and archetype enumerable datatypes | def change_character_names(story)
self.archetype === "hero" ? story.content.gsub!("HERO", self.name) : false
self.archetype === "shadow" ? story.content.gsub!("SHADOW", self.name) : false
self.archetype === "friend" ? story.content.gsub!("FRIEND", self.name) : false
self.archetype === "lover" ? story.content.gsub!("LOVER", self.name) : false
self.archetype === "mentor" ? story.content.gsub!("MENTOR", self.name) : false
self.archetype === "trickster" ? story.content.gsub!("TRICKSTER", self.name) : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gender_types\n @gender_types.each\n end",
"def people_gender\r\n\t\t[[\"Unknown\", \"Unknown\"],[\"Male\", \"Male\"], [\"Female\", \"Female\"]]\r\n\tend",
"def gender_list\n [['Man', 'male'], ['Woman', 'female']]\n end",
"def gender; end",
"def types(types); end",
"def itemtype\n format = self[:format_main_ssim] || []\n genre = self[:genre_ssim] || []\n case\n when genre.include?('Thesis/Dissertation')\n 'http://schema.org/Thesis'\n when genre.include?('Video games')\n 'http://schema.org/VideoGame'\n when format.include?('Equipment')\n 'http://schema.org/Thing'\n when format.include?('Book')\n 'http://schema.org/Book'\n when format.include?('Dataset')\n 'http://schema.org/Dataset'\n when format.include?('Image')\n 'http://schema.org/ImageObject'\n when format.include?('Journal/Periodical')\n 'http://schema.org/Periodical'\n when format.include?('Map')\n 'http://schema.org/Map'\n when format.include?('Music recording')\n 'http://schema.org/MusicRecording'\n when format.include?('Newspaper')\n 'http://bib.schema.org/Newspaper'\n when format.include?('Software/Multimedia')\n 'http://schema.org/SoftwareApplication'\n when format.include?('Sound recording')\n 'http://schema.org/AudioObject'\n when format.include?('Video')\n 'http://schema.org/VideoObject'\n else\n 'http://schema.org/CreativeWork'\n end\n end",
"def genders\n ['male','female','A being beyong comprehension']\n end",
"def get_genders \n @genders = [['Male', 'male'], ['Female', 'female']]\n end",
"def types\n [\n { value: 'bus', name: 'Bus' },\n { value: 'coach', name: 'Coach' },\n { value: 'hgv', name: 'Heavy goods vehicle' },\n { value: 'van', name: 'Van' },\n { value: 'minibus', name: 'Minibus' },\n { value: 'private_car', name: 'Car' },\n { value: 'motorcycle', name: 'Motorcycle' }\n ]\n end",
"def data_types\n @title = 'Data Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_data_type, :puppet_data_type_alias)\n erb(:objects)\nend",
"def test_types\n # rec = SourceRecord.new\n source = make_dummy_source(\"http://www.newstuff.org/createtypes\", N::FOAFX.Person, N::FOAFX.Foe)\n assert_not_nil(source)\n assert_property(source.types, N::FOAFX.Person, N::FOAFX.Foe, source.rdf_selftype)\n end",
"def calculate_type\n case @age\n when 0..12 then \"Child\"\n when 13..19 then \"Teenager\"\n else \"Adult\"\n end\n end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def gender_of_object object\n return nil if object.nil?\n return nil if object.gender.nil?\n return :male if MALE_VALUES.include? object.gender.downcase\n return :female if FEMALE_VALUES.include? object.gender.downcase\n end",
"def gender\n GENDERS[gender_id]\n end",
"def type\n %w[taxi PHV].sample\n end",
"def genderList()\n\t\tEmpList2014()\n\t\tputs \" \"\n\t\tputs \"Checking the Gender for the persons in the year 2014\\n\"\n\t\tindex = 0;\n\t\tcount = 0;\n\t\twhile count < $EmpList2014.count\n\t\t\tindex = ($EmpList2014[count].to_i)-1\n\t\t\tcase @gender[index]\n\t\t\twhen \"M\"\n\t\t\t\t$MaleList.push(index)\n\t\t\twhen \"F\"\n\t\t\t\t$FemaleList.push(index)\n\t\t\tend\n\t\t\tcount = count+1\n\t\tend\n\tend",
"def get_all_typographies\n @typographies.values.compact.insert(0, @typography)\n end",
"def show_gender\n Gender[gender.to_i]\n end",
"def personal_relationship_type\n @personal_relationship_type = Array.new\n self.people_as_source.each do |relation|\n if AmazonSetting.find(relation.relationship_type_id).name == \"Father\" or AmazonSetting.find(relation.relationship_type_id).name ==\"Mother\"\n @personal_relationship_type << AmazonSetting.find(relation.relationship_type_id)\n end\n end\n return @personal_relationship_type\n end",
"def possible_types\n @data.flat_map { |iso2, data| data[:possible] }.uniq\n end",
"def gender_description\n case gender_id\n when 1\n 'Male'\n when 2\n 'Female'\n when 3\n 'It''s complicated'\n end\n end",
"def genre; end",
"def genre; end",
"def gender_string\n case object.gender\n when Settings.gender.male.id\n Settings.gender.male.name\n when Settings.gender.female.id\n Settings.gender.female.name\n end\n end",
"def gender\n @gender\n end",
"def types\n @title = 'Resource Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_type)\n erb(:objects)\nend",
"def gender\n attributes = attributes_before_type_cast\n if attributes[\"gender\"]\n read_attribute(:gender).to_sym\n else\n nil\n end\n end",
"def openOrSenior(data)\n membership_type = []\n\n data.each do |member|\n age = member[0]\n handicap = member[1]\n\n if age >= 55 && handicap > 7\n membership_type << \"Senior\"\n else\n membership_type << \"Open\"\n end\n end\n membership_type\nend",
"def work_type_name(work)\n case work.person.gender\n when \"female\" then work.type.name_feminine\n when \"male\" then work.type.name_masculine\n end\n end",
"def load_notetags_bubs_gender_requirements\n @gender_requirements = []\n @ignore_gender_requirements = false\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when Bubs::Regexp::BaseItem::GENDER_REQUIREMENTS\n case $1.upcase\n when \"IGNORE\"\n next unless self.is_a?(RPG::Actor) || \n self.is_a?(RPG::Class) || \n self.is_a?(RPG::Enemy)\n @ignore_gender_requirements = true\n \n when \"GENDERLESS\", \"NONE\"\n next if self.is_a?(RPG::Actor) || self.is_a?(RPG::Enemy)\n @gender_requirements.push(0) unless @gender_requirements.include?(0)\n \n when \"MALE\", \"M\"\n next if self.is_a?(RPG::Actor) || self.is_a?(RPG::Enemy)\n @gender_requirements.push(1) unless @gender_requirements.include?(1)\n \n when \"FEMALE\", \"F\"\n next if self.is_a?(RPG::Actor) || self.is_a?(RPG::Enemy)\n @gender_requirements.push(2) unless @gender_requirements.include?(2)\n\n end # case \n end # case\n } # self.note.split\n \n end",
"def initialize(gender, ethnicity)\n @gender = gender\n @ethnicity = ethnicity\n @age = rand(0..140)\n @reindeer_ranking = [\"Rudolph\", \"Dasher\", \"Dancer\", \"Prancer\", \"Vixen\", \"Comet\", \"Cupid\", \"Donner\", \"Blitzen\"]\n end",
"def immediate_family\n \n # collect the family in a hash\n family = Hash.new\n \n # get all spouses and map their label\n spice.each do |relative| \n if (relative.gender == Gender::MALE)\n family[relative] = \"Husband\"\n elsif (relative.gender == Gender::FEMALE)\n family[relative] = \"Wife\"\n else\n family[relative] = \"Spouse\"\n end\n end\n \n children.each do |relative| \n if (relative.gender == Gender::MALE)\n family[relative] = \"Son\"\n elsif (relative.gender == Gender::FEMALE)\n family[relative] = \"Daughter\"\n else\n family[relative] = \"Child\"\n end\n end\n \n parents.each do |relative| \n if (relative.gender == Gender::MALE)\n family[relative] = \"Father\"\n elsif (relative.gender == Gender::FEMALE)\n family[relative] = \"Mother\"\n else\n family[relative] = \"Parent\"\n end\n end\n \n siblings.each do |relative|\n if (relative.gender == Gender::MALE)\n family[relative] = \"Brother\"\n elsif (relative.gender == Gender::FEMALE)\n family[relative] = \"Sister\"\n else\n family[relative] = \"Sibling\"\n end\n end\n \n family\n \n end",
"def category_types\n @category_types.each\n end",
"def build_associations\n #\n # assumption: the associations will build in the order of appearance, subject to ruby behavior\n [\"senior\", \"subscriber\", \"caregiver1\", \"caregiver2\", \"caregiver3\"].each { |type| build_user_type(type) }\n end",
"def type\n :american\n end",
"def enter_types(test_data)\n test_types = test_data[Org::ORG_RECORD_TYPES.name]\n test_types = [{ Org::ORG_RECORD_TYPE.name => ''}] unless test_types\n prep_fieldsets_for_test_data([fieldset(Org::ORG_RECORD_TYPES.name)], test_types)\n\n test_types.each_with_index do |test_type, index|\n wait_for_options_and_select(org_record_type_input(index), org_record_type_options(index), test_type[Org::ORG_RECORD_TYPE.name])\n end\n end",
"def type() end",
"def org_types\n organizations.map(&:organization_type)\n end",
"def description_of(superhero)\n case superhero\n when \"batman\"\n ['']\n when \"paul\"\n ['gender: male', 'height: 145']\n when \"dawn\"\n ['gender: female', 'height: 170']\n when \"brian\"\n ['gender: male', 'height: 180']\n else\n ['species: Trachemys scripta elegans', 'height: 6']\n end\nend",
"def biography_types\n return ['BI'] if record['008'] && %w[a b c].include?(record['008'].value[34])\n return ['BI'] if (%w[a b c ] & self['006[17]']).size > 0\n\n return ['BI'] if @xv6XX.match? /(?:biography|diaries)/i\n\n # Nope\n return []\n end",
"def genre\n case result_item.format\n when \"Book\"\n \"book\"\n when :book_item\n \"bookitem\"\n when :conference_paper\n \"proceeding\"\n when :conference_proceedings\n \"conference\"\n when :report\n \"report\"\n when :serial\n \"journal\"\n when \"Article\"\n \"article\"\n else\n nil\n end \n end",
"def get_type(dinosaur_objects)\n Array(dinosaur_objects).map do |d|\n CARNIVORES.include?(d.species) ? 'carnivore' : 'herbivore'\n end\n end",
"def variety; end",
"def variety; end",
"def makeOneAdaEnum( deffile, bodyfile, var, typedecs, enumName = nil )\n if enumName.nil? then\n enumName = capitalise( basicCensor( var.name )) + \"_Type\" \n else\n deffile.write( \" -- #{enumName} uses variable #{var.name}\\n --\\n\" )\n end\n deffile.write( \" type #{enumName} is (\\n \" );\n entries = []\n var.enumsInSortOrder().each{\n |enum|\n enumItem = censor( enum.label )\n entries << enumItem\n }\n deffile.write( entries.join( \",\\n \" ) )\n deffile.write( \" );\\n\" );\n deffile.write( \" \n function To_String( i : #{enumName} ) return String;\n function Convert_#{enumName}( i : Integer ) return #{enumName};\n function Value_Of( i : #{enumName} ) return Integer;\\n\" )\n if( typedecs.length() > 0 )then\n deffile.write( \"\n package #{enumName}_Package is new T_Utils( \n T => #{enumName},\n Rate_Type => Rate, \n Amount_Type => Amount, \n Counter_Type =>Counter_Type );\\n\" );\n \n deffile.write( \" subtype #{enumName}_Set is #{enumName}_Package.Set;\\n\" ) if typedecs.include?( 'set' )\n deffile.write( \" subtype #{enumName}_List is #{enumName}_Package.List; \" ) if typedecs.include?( 'list' )\n if typedecs.include?( 'amount' )then\n deffile.write( \" subtype Abs_#{enumName}_Amount_Array is #{enumName}_Package.Abs_Amount_Array;\\n\" )\n deffile.write( \" subtype #{enumName}_Amount_Array is #{enumName}_Package.Amount_Array;\\n\" );\n end\n if typedecs.include?( 'boolean' )then\n deffile.write( \" subtype Abs_#{enumName}_Boolean_Array is #{enumName}_Package.Abs_Boolean_Array;\\n\" )\n deffile.write( \" subtype #{enumName}_Boolean_Array is #{enumName}_Package.Boolean_Array;\\n\" );\n end\n end\n deffile.write( \"\\n\" );\n bodyfile.write( \"\n function To_String( i : #{enumName} ) return String is\n begin\n case i is\\n\" ); \n var.enumsInSortOrder().each{\n |enum|\n enumItem = censor( enum.label )\n bodyfile.write( \" when #{enumItem} => return \\\"#{enum.label}\\\";\\n\" );\n }\n bodyfile.write( \" end case; \n return \\\"?\\\";\n end To_String;\n \n function Convert_#{enumName}( i : Integer ) return #{enumName} is\n begin\n case i is\\n\" );\n var.enumsInSortOrder().each{\n |enum|\n enumItem = censor( enum.label )\n bodyfile.write \" when #{enum.value} => return #{enumItem};\\n\"\n }\n bodyfile.write( \n\" when others => null;\n end case;\n end Convert_#{enumName};\n \n function Value_Of( i : #{enumName} ) return Integer is\\\n begin\n case i is \\n\" );\n var.enumsInSortOrder().each{\n |enum|\n enumItem = censor( enum.label )\n bodyfile.write \" when #{enumItem} => return #{enum.value};\\n\"\n }\n bodyfile.write( \" end case;\\n\" );\n bodyfile.write( \" end Value_Of;\\n\" ); \nend",
"def enumeration_types\n @enumeration_types ||= Search::ENUMERATION_TYPES\n end",
"def get_gender\n return @gender\n end",
"def gender\n case\n when male && female then :unisex\n when male then :male\n when female then :female\n end\n end",
"def custom_types_by_name\n interim_model_builder.custom_intent_types \n .map { |_name, intent| format_for_alexa(intent.custom_types_for) }\n .flatten\n .uniq { |key, _val| key }\n end",
"def defined_types\n @title = 'Defined Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_defined_type)\n erb(:objects)\nend",
"def nonregular_type; end",
"def gender_mapping(gender)\n return 'male' if gender == 'Boy'\n 'female'\n end",
"def apply_types\n return unless _types\n\n _types.each do |rdf_type|\n unless resource.type.include? RDF::Vocabulary.find_term(rdf_type)\n resource << RDF::Statement.new(rdf_subject, RDF.type, RDF::Vocabulary.find_term(rdf_type))\n end\n end\n end",
"def by_type\n return @by_type if @by_type\n\n @by_type = {}\n self.all.each do |set|\n next unless set[:types].count > 0\n\n set[:types].each do |t|\n @by_type[t] ||= []\n @by_type[t] << set\n end\n end\n\n @by_type\n end",
"def mechanics\n Mechanic.all.select{|mechanic|mechanic.specialty == self.classification}\n end",
"def types\n @data.keys & TYPES\n end",
"def dog_type_attributes\n '\n id\n name\n age\n breed\n weight\n birthdate\n activityLevel\n shortDesc\n longDesc\n distance\n '\nend",
"def initialize(gender, ethnicity)\r\n\t\t\t@gender = gender\r\n\t\t\t@ethnicity = ethnicity\r\n\t\t\t@reindeer_ranking = [\"Rudolph\", \"Dasher\", \"Dancer\", \"Prancer\", \"Vixen\", \"Comet\", \"Cupid\", \"Donner\", \"Blitzen\"]\r\n\t\t\t@age = rand(141)\r\n\t\tend",
"def genres\n to_array search_by_itemprop 'genre'\n end",
"def set_genders(gender_types = GenderType.individual_only)\n @gender_types = gender_types\n end",
"def car_type; end",
"def questionnaire_types\n questionnaire_type_list = Array.new\n self.questionnaires.each do |questionnaire|\n if !self.questionnaires.include?(questionnaire.type)\n questionnaire_type_list << questionnaire.type\n end\n end\n questionnaire_type_list\n end",
"def types\n @types ||= profile_types.pluck(:title).join(' / ').html_safe\n end",
"def available_types\n # TODO pull this from DB or config\n [\n :kiosk,\n :ride,\n :store,\n :restaurant\n ]\n end",
"def u_types\n u_types = ['Manager', 'QA', 'Developer']\n end",
"def datatypes\n value.document.fetch(\"#{value.key}_type\", [])\n end",
"def object_type=(object_type)\n validator = EnumAttributeValidator.new('String', [\"aaa.AuditRecord\", \"aaa.RetentionConfig\", \"aaa.RetentionPolicy\", \"access.Policy\", \"adapter.ConfigPolicy\", \"adapter.ExtEthInterface\", \"adapter.HostEthInterface\", \"adapter.HostFcInterface\", \"adapter.HostIscsiInterface\", \"adapter.Unit\", \"adapter.UnitExpander\", \"appliance.AppStatus\", \"appliance.AutoRmaPolicy\", \"appliance.Backup\", \"appliance.BackupPolicy\", \"appliance.CertificateSetting\", \"appliance.DataExportPolicy\", \"appliance.DeviceCertificate\", \"appliance.DeviceClaim\", \"appliance.DeviceUpgradePolicy\", \"appliance.DiagSetting\", \"appliance.ExternalSyslogSetting\", \"appliance.FileGateway\", \"appliance.FileSystemStatus\", \"appliance.GroupStatus\", \"appliance.ImageBundle\", \"appliance.NodeInfo\", \"appliance.NodeStatus\", \"appliance.ReleaseNote\", \"appliance.RemoteFileImport\", \"appliance.Restore\", \"appliance.SetupInfo\", \"appliance.SystemInfo\", \"appliance.SystemStatus\", \"appliance.Upgrade\", \"appliance.UpgradePolicy\", \"asset.ClusterMember\", \"asset.Deployment\", \"asset.DeploymentDevice\", \"asset.DeviceClaim\", \"asset.DeviceConfiguration\", \"asset.DeviceConnectorManager\", \"asset.DeviceContractInformation\", \"asset.DeviceRegistration\", \"asset.Subscription\", \"asset.SubscriptionAccount\", \"asset.SubscriptionDeviceContractInformation\", \"asset.Target\", \"bios.BootDevice\", \"bios.BootMode\", \"bios.Policy\", \"bios.SystemBootOrder\", \"bios.TokenSettings\", \"bios.Unit\", \"bios.VfSelectMemoryRasConfiguration\", \"boot.CddDevice\", \"boot.DeviceBootMode\", \"boot.DeviceBootSecurity\", \"boot.HddDevice\", \"boot.IscsiDevice\", \"boot.NvmeDevice\", \"boot.PchStorageDevice\", \"boot.PrecisionPolicy\", \"boot.PxeDevice\", \"boot.SanDevice\", \"boot.SdDevice\", \"boot.UefiShellDevice\", \"boot.UsbDevice\", \"boot.VmediaDevice\", \"bulk.Export\", \"bulk.ExportedItem\", \"bulk.MoCloner\", \"bulk.MoMerger\", \"bulk.Request\", \"bulk.SubRequestObj\", \"capability.AdapterUnitDescriptor\", \"capability.Catalog\", \"capability.ChassisDescriptor\", \"capability.ChassisManufacturingDef\", \"capability.CimcFirmwareDescriptor\", \"capability.EquipmentPhysicalDef\", \"capability.EquipmentSlotArray\", \"capability.FanModuleDescriptor\", \"capability.FanModuleManufacturingDef\", \"capability.IoCardCapabilityDef\", \"capability.IoCardDescriptor\", \"capability.IoCardManufacturingDef\", \"capability.PortGroupAggregationDef\", \"capability.PsuDescriptor\", \"capability.PsuManufacturingDef\", \"capability.ServerSchemaDescriptor\", \"capability.SiocModuleCapabilityDef\", \"capability.SiocModuleDescriptor\", \"capability.SiocModuleManufacturingDef\", \"capability.SwitchCapability\", \"capability.SwitchDescriptor\", \"capability.SwitchManufacturingDef\", \"certificatemanagement.Policy\", \"chassis.ConfigChangeDetail\", \"chassis.ConfigImport\", \"chassis.ConfigResult\", \"chassis.ConfigResultEntry\", \"chassis.IomProfile\", \"chassis.Profile\", \"cloud.AwsBillingUnit\", \"cloud.AwsKeyPair\", \"cloud.AwsNetworkInterface\", \"cloud.AwsOrganizationalUnit\", \"cloud.AwsSecurityGroup\", \"cloud.AwsSubnet\", \"cloud.AwsVirtualMachine\", \"cloud.AwsVolume\", \"cloud.AwsVpc\", \"cloud.CollectInventory\", \"cloud.Regions\", \"cloud.SkuContainerType\", \"cloud.SkuDatabaseType\", \"cloud.SkuInstanceType\", \"cloud.SkuNetworkType\", \"cloud.SkuRegionRateCards\", \"cloud.SkuVolumeType\", \"cloud.TfcAgentpool\", \"cloud.TfcOrganization\", \"cloud.TfcWorkspace\", \"comm.HttpProxyPolicy\", \"compute.BiosPostPolicy\", \"compute.Blade\", \"compute.BladeIdentity\", \"compute.Board\", \"compute.Mapping\", \"compute.PhysicalSummary\", \"compute.RackUnit\", \"compute.RackUnitIdentity\", \"compute.ServerPowerPolicy\", \"compute.ServerSetting\", \"compute.Vmedia\", \"cond.Alarm\", \"cond.AlarmAggregation\", \"cond.HclStatus\", \"cond.HclStatusDetail\", \"cond.HclStatusJob\", \"connectorpack.ConnectorPackUpgrade\", \"connectorpack.UpgradeImpact\", \"convergedinfra.HealthCheckDefinition\", \"convergedinfra.HealthCheckExecution\", \"convergedinfra.Pod\", \"crd.CustomResource\", \"deviceconnector.Policy\", \"equipment.Chassis\", \"equipment.ChassisIdentity\", \"equipment.ChassisOperation\", \"equipment.DeviceSummary\", \"equipment.ExpanderModule\", \"equipment.Fan\", \"equipment.FanControl\", \"equipment.FanModule\", \"equipment.Fex\", \"equipment.FexIdentity\", \"equipment.FexOperation\", \"equipment.Fru\", \"equipment.IdentitySummary\", \"equipment.IoCard\", \"equipment.IoCardOperation\", \"equipment.IoExpander\", \"equipment.LocatorLed\", \"equipment.Psu\", \"equipment.PsuControl\", \"equipment.RackEnclosure\", \"equipment.RackEnclosureSlot\", \"equipment.SharedIoModule\", \"equipment.SwitchCard\", \"equipment.SystemIoController\", \"equipment.Tpm\", \"equipment.Transceiver\", \"ether.HostPort\", \"ether.NetworkPort\", \"ether.PhysicalPort\", \"ether.PortChannel\", \"externalsite.Authorization\", \"fabric.AppliancePcRole\", \"fabric.ApplianceRole\", \"fabric.ConfigChangeDetail\", \"fabric.ConfigResult\", \"fabric.ConfigResultEntry\", \"fabric.ElementIdentity\", \"fabric.EstimateImpact\", \"fabric.EthNetworkControlPolicy\", \"fabric.EthNetworkGroupPolicy\", \"fabric.EthNetworkPolicy\", \"fabric.FcNetworkPolicy\", \"fabric.FcUplinkPcRole\", \"fabric.FcUplinkRole\", \"fabric.FcoeUplinkPcRole\", \"fabric.FcoeUplinkRole\", \"fabric.FlowControlPolicy\", \"fabric.LinkAggregationPolicy\", \"fabric.LinkControlPolicy\", \"fabric.MulticastPolicy\", \"fabric.PcMember\", \"fabric.PcOperation\", \"fabric.PortMode\", \"fabric.PortOperation\", \"fabric.PortPolicy\", \"fabric.ServerRole\", \"fabric.SwitchClusterProfile\", \"fabric.SwitchControlPolicy\", \"fabric.SwitchProfile\", \"fabric.SystemQosPolicy\", \"fabric.UplinkPcRole\", \"fabric.UplinkRole\", \"fabric.Vlan\", \"fabric.Vsan\", \"fault.Instance\", \"fc.PhysicalPort\", \"fc.PortChannel\", \"fcpool.FcBlock\", \"fcpool.Lease\", \"fcpool.Pool\", \"fcpool.PoolMember\", \"fcpool.Universe\", \"feedback.FeedbackPost\", \"firmware.BiosDescriptor\", \"firmware.BoardControllerDescriptor\", \"firmware.ChassisUpgrade\", \"firmware.CimcDescriptor\", \"firmware.DimmDescriptor\", \"firmware.Distributable\", \"firmware.DistributableMeta\", \"firmware.DriveDescriptor\", \"firmware.DriverDistributable\", \"firmware.Eula\", \"firmware.FirmwareSummary\", \"firmware.GpuDescriptor\", \"firmware.HbaDescriptor\", \"firmware.IomDescriptor\", \"firmware.MswitchDescriptor\", \"firmware.NxosDescriptor\", \"firmware.PcieDescriptor\", \"firmware.PsuDescriptor\", \"firmware.RunningFirmware\", \"firmware.SasExpanderDescriptor\", \"firmware.ServerConfigurationUtilityDistributable\", \"firmware.StorageControllerDescriptor\", \"firmware.SwitchUpgrade\", \"firmware.UnsupportedVersionUpgrade\", \"firmware.Upgrade\", \"firmware.UpgradeImpact\", \"firmware.UpgradeImpactStatus\", \"firmware.UpgradeStatus\", \"forecast.Catalog\", \"forecast.Definition\", \"forecast.Instance\", \"graphics.Card\", \"graphics.Controller\", \"hcl.CompatibilityStatus\", \"hcl.DriverImage\", \"hcl.ExemptedCatalog\", \"hcl.HyperflexSoftwareCompatibilityInfo\", \"hcl.OperatingSystem\", \"hcl.OperatingSystemVendor\", \"hcl.SupportedDriverName\", \"hyperflex.Alarm\", \"hyperflex.AppCatalog\", \"hyperflex.AutoSupportPolicy\", \"hyperflex.BackupCluster\", \"hyperflex.CapabilityInfo\", \"hyperflex.CiscoHypervisorManager\", \"hyperflex.Cluster\", \"hyperflex.ClusterBackupPolicy\", \"hyperflex.ClusterBackupPolicyDeployment\", \"hyperflex.ClusterBackupPolicyInventory\", \"hyperflex.ClusterHealthCheckExecutionSnapshot\", \"hyperflex.ClusterNetworkPolicy\", \"hyperflex.ClusterProfile\", \"hyperflex.ClusterReplicationNetworkPolicy\", \"hyperflex.ClusterReplicationNetworkPolicyDeployment\", \"hyperflex.ClusterStoragePolicy\", \"hyperflex.ConfigResult\", \"hyperflex.ConfigResultEntry\", \"hyperflex.DataProtectionPeer\", \"hyperflex.DatastoreStatistic\", \"hyperflex.DevicePackageDownloadState\", \"hyperflex.Drive\", \"hyperflex.ExtFcStoragePolicy\", \"hyperflex.ExtIscsiStoragePolicy\", \"hyperflex.FeatureLimitExternal\", \"hyperflex.FeatureLimitInternal\", \"hyperflex.Health\", \"hyperflex.HealthCheckDefinition\", \"hyperflex.HealthCheckExecution\", \"hyperflex.HealthCheckExecutionSnapshot\", \"hyperflex.HealthCheckPackageChecksum\", \"hyperflex.HxapCluster\", \"hyperflex.HxapDatacenter\", \"hyperflex.HxapDvUplink\", \"hyperflex.HxapDvswitch\", \"hyperflex.HxapHost\", \"hyperflex.HxapHostInterface\", \"hyperflex.HxapHostVswitch\", \"hyperflex.HxapNetwork\", \"hyperflex.HxapVirtualDisk\", \"hyperflex.HxapVirtualMachine\", \"hyperflex.HxapVirtualMachineNetworkInterface\", \"hyperflex.HxdpVersion\", \"hyperflex.License\", \"hyperflex.LocalCredentialPolicy\", \"hyperflex.Node\", \"hyperflex.NodeConfigPolicy\", \"hyperflex.NodeProfile\", \"hyperflex.ProtectedCluster\", \"hyperflex.ProxySettingPolicy\", \"hyperflex.ServerFirmwareVersion\", \"hyperflex.ServerFirmwareVersionEntry\", \"hyperflex.ServerModel\", \"hyperflex.ServiceAuthToken\", \"hyperflex.SoftwareDistributionComponent\", \"hyperflex.SoftwareDistributionEntry\", \"hyperflex.SoftwareDistributionVersion\", \"hyperflex.SoftwareVersionPolicy\", \"hyperflex.StorageContainer\", \"hyperflex.SysConfigPolicy\", \"hyperflex.UcsmConfigPolicy\", \"hyperflex.VcenterConfigPolicy\", \"hyperflex.VmBackupInfo\", \"hyperflex.VmImportOperation\", \"hyperflex.VmRestoreOperation\", \"hyperflex.VmSnapshotInfo\", \"hyperflex.Volume\", \"hyperflex.WitnessConfiguration\", \"iaas.ConnectorPack\", \"iaas.DeviceStatus\", \"iaas.DiagnosticMessages\", \"iaas.LicenseInfo\", \"iaas.MostRunTasks\", \"iaas.ServiceRequest\", \"iaas.UcsdInfo\", \"iaas.UcsdManagedInfra\", \"iaas.UcsdMessages\", \"iam.Account\", \"iam.AccountExperience\", \"iam.ApiKey\", \"iam.AppRegistration\", \"iam.BannerMessage\", \"iam.Certificate\", \"iam.CertificateRequest\", \"iam.DomainGroup\", \"iam.EndPointPrivilege\", \"iam.EndPointRole\", \"iam.EndPointUser\", \"iam.EndPointUserPolicy\", \"iam.EndPointUserRole\", \"iam.Idp\", \"iam.IdpReference\", \"iam.IpAccessManagement\", \"iam.IpAddress\", \"iam.LdapGroup\", \"iam.LdapPolicy\", \"iam.LdapProvider\", \"iam.LocalUserPassword\", \"iam.LocalUserPasswordPolicy\", \"iam.OAuthToken\", \"iam.Permission\", \"iam.PrivateKeySpec\", \"iam.Privilege\", \"iam.PrivilegeSet\", \"iam.Qualifier\", \"iam.ResourceLimits\", \"iam.ResourcePermission\", \"iam.ResourceRoles\", \"iam.Role\", \"iam.SecurityHolder\", \"iam.ServiceProvider\", \"iam.Session\", \"iam.SessionLimits\", \"iam.System\", \"iam.TrustPoint\", \"iam.User\", \"iam.UserGroup\", \"iam.UserPreference\", \"inventory.DeviceInfo\", \"inventory.DnMoBinding\", \"inventory.GenericInventory\", \"inventory.GenericInventoryHolder\", \"inventory.Request\", \"ipmioverlan.Policy\", \"ippool.BlockLease\", \"ippool.IpLease\", \"ippool.Pool\", \"ippool.PoolMember\", \"ippool.ShadowBlock\", \"ippool.ShadowPool\", \"ippool.Universe\", \"iqnpool.Block\", \"iqnpool.Lease\", \"iqnpool.Pool\", \"iqnpool.PoolMember\", \"iqnpool.Universe\", \"iwotenant.TenantStatus\", \"kubernetes.AciCniApic\", \"kubernetes.AciCniProfile\", \"kubernetes.AciCniTenantClusterAllocation\", \"kubernetes.AddonDefinition\", \"kubernetes.AddonPolicy\", \"kubernetes.AddonRepository\", \"kubernetes.BaremetalNodeProfile\", \"kubernetes.Catalog\", \"kubernetes.Cluster\", \"kubernetes.ClusterAddonProfile\", \"kubernetes.ClusterProfile\", \"kubernetes.ConfigResult\", \"kubernetes.ConfigResultEntry\", \"kubernetes.ContainerRuntimePolicy\", \"kubernetes.DaemonSet\", \"kubernetes.Deployment\", \"kubernetes.Ingress\", \"kubernetes.NetworkPolicy\", \"kubernetes.Node\", \"kubernetes.NodeGroupProfile\", \"kubernetes.Pod\", \"kubernetes.Service\", \"kubernetes.StatefulSet\", \"kubernetes.SysConfigPolicy\", \"kubernetes.TrustedRegistriesPolicy\", \"kubernetes.Version\", \"kubernetes.VersionPolicy\", \"kubernetes.VirtualMachineInfraConfigPolicy\", \"kubernetes.VirtualMachineInfrastructureProvider\", \"kubernetes.VirtualMachineInstanceType\", \"kubernetes.VirtualMachineNodeProfile\", \"kvm.Policy\", \"kvm.Session\", \"kvm.Tunnel\", \"license.AccountLicenseData\", \"license.CustomerOp\", \"license.IwoCustomerOp\", \"license.IwoLicenseCount\", \"license.LicenseInfo\", \"license.LicenseReservationOp\", \"license.SmartlicenseToken\", \"ls.ServiceProfile\", \"macpool.IdBlock\", \"macpool.Lease\", \"macpool.Pool\", \"macpool.PoolMember\", \"macpool.Universe\", \"management.Controller\", \"management.Entity\", \"management.Interface\", \"memory.Array\", \"memory.PersistentMemoryConfigResult\", \"memory.PersistentMemoryConfiguration\", \"memory.PersistentMemoryNamespace\", \"memory.PersistentMemoryNamespaceConfigResult\", \"memory.PersistentMemoryPolicy\", \"memory.PersistentMemoryRegion\", \"memory.PersistentMemoryUnit\", \"memory.Unit\", \"meta.Definition\", \"network.Element\", \"network.ElementSummary\", \"network.FcZoneInfo\", \"network.VlanPortInfo\", \"networkconfig.Policy\", \"niaapi.ApicCcoPost\", \"niaapi.ApicFieldNotice\", \"niaapi.ApicHweol\", \"niaapi.ApicLatestMaintainedRelease\", \"niaapi.ApicReleaseRecommend\", \"niaapi.ApicSweol\", \"niaapi.DcnmCcoPost\", \"niaapi.DcnmFieldNotice\", \"niaapi.DcnmHweol\", \"niaapi.DcnmLatestMaintainedRelease\", \"niaapi.DcnmReleaseRecommend\", \"niaapi.DcnmSweol\", \"niaapi.FileDownloader\", \"niaapi.NiaMetadata\", \"niaapi.NibFileDownloader\", \"niaapi.NibMetadata\", \"niaapi.VersionRegex\", \"niatelemetry.AaaLdapProviderDetails\", \"niatelemetry.AaaRadiusProviderDetails\", \"niatelemetry.AaaTacacsProviderDetails\", \"niatelemetry.ApicAppPluginDetails\", \"niatelemetry.ApicCoreFileDetails\", \"niatelemetry.ApicDbgexpRsExportDest\", \"niatelemetry.ApicDbgexpRsTsScheduler\", \"niatelemetry.ApicFanDetails\", \"niatelemetry.ApicFexDetails\", \"niatelemetry.ApicFlashDetails\", \"niatelemetry.ApicNtpAuth\", \"niatelemetry.ApicPsuDetails\", \"niatelemetry.ApicRealmDetails\", \"niatelemetry.ApicSnmpClientGrpDetails\", \"niatelemetry.ApicSnmpCommunityAccessDetails\", \"niatelemetry.ApicSnmpCommunityDetails\", \"niatelemetry.ApicSnmpTrapDetails\", \"niatelemetry.ApicSnmpTrapFwdServerDetails\", \"niatelemetry.ApicSnmpVersionThreeDetails\", \"niatelemetry.ApicSysLogGrp\", \"niatelemetry.ApicSysLogSrc\", \"niatelemetry.ApicTransceiverDetails\", \"niatelemetry.ApicUiPageCounts\", \"niatelemetry.AppDetails\", \"niatelemetry.CommonPolicies\", \"niatelemetry.DcnmFanDetails\", \"niatelemetry.DcnmFexDetails\", \"niatelemetry.DcnmModuleDetails\", \"niatelemetry.DcnmPsuDetails\", \"niatelemetry.DcnmTransceiverDetails\", \"niatelemetry.Epg\", \"niatelemetry.FabricModuleDetails\", \"niatelemetry.FabricPodProfile\", \"niatelemetry.FabricPodSs\", \"niatelemetry.Fault\", \"niatelemetry.HttpsAclContractDetails\", \"niatelemetry.HttpsAclContractFilterMap\", \"niatelemetry.HttpsAclEpgContractMap\", \"niatelemetry.HttpsAclEpgDetails\", \"niatelemetry.HttpsAclFilterDetails\", \"niatelemetry.Lc\", \"niatelemetry.MsoContractDetails\", \"niatelemetry.MsoEpgDetails\", \"niatelemetry.MsoSchemaDetails\", \"niatelemetry.MsoSiteDetails\", \"niatelemetry.MsoTenantDetails\", \"niatelemetry.NexusDashboardControllerDetails\", \"niatelemetry.NexusDashboardDetails\", \"niatelemetry.NexusDashboardMemoryDetails\", \"niatelemetry.NexusDashboards\", \"niatelemetry.NiaFeatureUsage\", \"niatelemetry.NiaInventory\", \"niatelemetry.NiaInventoryDcnm\", \"niatelemetry.NiaInventoryFabric\", \"niatelemetry.NiaLicenseState\", \"niatelemetry.PasswordStrengthCheck\", \"niatelemetry.PodCommPolicies\", \"niatelemetry.PodSnmpPolicies\", \"niatelemetry.PodTimeServerPolicies\", \"niatelemetry.SiteInventory\", \"niatelemetry.SnmpSrc\", \"niatelemetry.SshVersionTwo\", \"niatelemetry.SupervisorModuleDetails\", \"niatelemetry.SyslogRemoteDest\", \"niatelemetry.SyslogSysMsg\", \"niatelemetry.SyslogSysMsgFacFilter\", \"niatelemetry.SystemControllerDetails\", \"niatelemetry.Tenant\", \"notification.AccountSubscription\", \"ntp.Policy\", \"oprs.Deployment\", \"oprs.SyncTargetListMessage\", \"organization.Organization\", \"os.BulkInstallInfo\", \"os.Catalog\", \"os.ConfigurationFile\", \"os.Distribution\", \"os.Install\", \"os.OsSupport\", \"os.SupportedVersion\", \"os.TemplateFile\", \"os.ValidInstallTarget\", \"pci.CoprocessorCard\", \"pci.Device\", \"pci.Link\", \"pci.Switch\", \"port.Group\", \"port.MacBinding\", \"port.SubGroup\", \"power.ControlState\", \"power.Policy\", \"processor.Unit\", \"rack.UnitPersonality\", \"recommendation.CapacityRunway\", \"recommendation.PhysicalItem\", \"recovery.BackupConfigPolicy\", \"recovery.BackupProfile\", \"recovery.ConfigResult\", \"recovery.ConfigResultEntry\", \"recovery.OnDemandBackup\", \"recovery.Restore\", \"recovery.ScheduleConfigPolicy\", \"resource.Group\", \"resource.GroupMember\", \"resource.LicenseResourceCount\", \"resource.Membership\", \"resource.MembershipHolder\", \"resource.Reservation\", \"resourcepool.Lease\", \"resourcepool.LeaseResource\", \"resourcepool.Pool\", \"resourcepool.PoolMember\", \"resourcepool.Universe\", \"rproxy.ReverseProxy\", \"sdcard.Policy\", \"sdwan.Profile\", \"sdwan.RouterNode\", \"sdwan.RouterPolicy\", \"sdwan.VmanageAccountPolicy\", \"search.SearchItem\", \"search.TagItem\", \"security.Unit\", \"server.ConfigChangeDetail\", \"server.ConfigImport\", \"server.ConfigResult\", \"server.ConfigResultEntry\", \"server.Profile\", \"server.ProfileTemplate\", \"smtp.Policy\", \"snmp.Policy\", \"software.ApplianceDistributable\", \"software.DownloadHistory\", \"software.HclMeta\", \"software.HyperflexBundleDistributable\", \"software.HyperflexDistributable\", \"software.ReleaseMeta\", \"software.SolutionDistributable\", \"software.UcsdBundleDistributable\", \"software.UcsdDistributable\", \"softwarerepository.Authorization\", \"softwarerepository.CachedImage\", \"softwarerepository.Catalog\", \"softwarerepository.CategoryMapper\", \"softwarerepository.CategoryMapperModel\", \"softwarerepository.CategorySupportConstraint\", \"softwarerepository.DownloadSpec\", \"softwarerepository.OperatingSystemFile\", \"softwarerepository.Release\", \"sol.Policy\", \"ssh.Policy\", \"storage.Controller\", \"storage.DiskGroup\", \"storage.DiskSlot\", \"storage.DriveGroup\", \"storage.Enclosure\", \"storage.EnclosureDisk\", \"storage.EnclosureDiskSlotEp\", \"storage.FlexFlashController\", \"storage.FlexFlashControllerProps\", \"storage.FlexFlashPhysicalDrive\", \"storage.FlexFlashVirtualDrive\", \"storage.FlexUtilController\", \"storage.FlexUtilPhysicalDrive\", \"storage.FlexUtilVirtualDrive\", \"storage.HitachiArray\", \"storage.HitachiController\", \"storage.HitachiDisk\", \"storage.HitachiHost\", \"storage.HitachiHostLun\", \"storage.HitachiParityGroup\", \"storage.HitachiPool\", \"storage.HitachiPort\", \"storage.HitachiVolume\", \"storage.HyperFlexStorageContainer\", \"storage.HyperFlexVolume\", \"storage.Item\", \"storage.NetAppAggregate\", \"storage.NetAppBaseDisk\", \"storage.NetAppCluster\", \"storage.NetAppEthernetPort\", \"storage.NetAppExportPolicy\", \"storage.NetAppFcInterface\", \"storage.NetAppFcPort\", \"storage.NetAppInitiatorGroup\", \"storage.NetAppIpInterface\", \"storage.NetAppLicense\", \"storage.NetAppLun\", \"storage.NetAppLunMap\", \"storage.NetAppNode\", \"storage.NetAppNtpServer\", \"storage.NetAppSensor\", \"storage.NetAppStorageVm\", \"storage.NetAppVolume\", \"storage.NetAppVolumeSnapshot\", \"storage.PhysicalDisk\", \"storage.PhysicalDiskExtension\", \"storage.PhysicalDiskUsage\", \"storage.PureArray\", \"storage.PureController\", \"storage.PureDisk\", \"storage.PureHost\", \"storage.PureHostGroup\", \"storage.PureHostLun\", \"storage.PurePort\", \"storage.PureProtectionGroup\", \"storage.PureProtectionGroupSnapshot\", \"storage.PureReplicationSchedule\", \"storage.PureSnapshotSchedule\", \"storage.PureVolume\", \"storage.PureVolumeSnapshot\", \"storage.SasExpander\", \"storage.SasPort\", \"storage.Span\", \"storage.StoragePolicy\", \"storage.VdMemberEp\", \"storage.VirtualDrive\", \"storage.VirtualDriveContainer\", \"storage.VirtualDriveExtension\", \"storage.VirtualDriveIdentity\", \"syslog.Policy\", \"tam.AdvisoryCount\", \"tam.AdvisoryDefinition\", \"tam.AdvisoryInfo\", \"tam.AdvisoryInstance\", \"tam.SecurityAdvisory\", \"task.HitachiScopedInventory\", \"task.HxapScopedInventory\", \"task.NetAppScopedInventory\", \"task.PublicCloudScopedInventory\", \"task.PureScopedInventory\", \"task.ServerScopedInventory\", \"techsupportmanagement.CollectionControlPolicy\", \"techsupportmanagement.Download\", \"techsupportmanagement.TechSupportBundle\", \"techsupportmanagement.TechSupportStatus\", \"terminal.AuditLog\", \"terraform.Executor\", \"thermal.Policy\", \"top.System\", \"ucsd.BackupInfo\", \"uuidpool.Block\", \"uuidpool.Pool\", \"uuidpool.PoolMember\", \"uuidpool.Universe\", \"uuidpool.UuidLease\", \"virtualization.Host\", \"virtualization.VirtualDisk\", \"virtualization.VirtualMachine\", \"virtualization.VirtualNetwork\", \"virtualization.VmwareCluster\", \"virtualization.VmwareDatacenter\", \"virtualization.VmwareDatastore\", \"virtualization.VmwareDatastoreCluster\", \"virtualization.VmwareDistributedNetwork\", \"virtualization.VmwareDistributedSwitch\", \"virtualization.VmwareFolder\", \"virtualization.VmwareHost\", \"virtualization.VmwareKernelNetwork\", \"virtualization.VmwareNetwork\", \"virtualization.VmwarePhysicalNetworkInterface\", \"virtualization.VmwareUplinkPort\", \"virtualization.VmwareVcenter\", \"virtualization.VmwareVirtualDisk\", \"virtualization.VmwareVirtualMachine\", \"virtualization.VmwareVirtualMachineSnapshot\", \"virtualization.VmwareVirtualNetworkInterface\", \"virtualization.VmwareVirtualSwitch\", \"vmedia.Policy\", \"vmrc.Console\", \"vnc.Console\", \"vnic.EthAdapterPolicy\", \"vnic.EthIf\", \"vnic.EthNetworkPolicy\", \"vnic.EthQosPolicy\", \"vnic.FcAdapterPolicy\", \"vnic.FcIf\", \"vnic.FcNetworkPolicy\", \"vnic.FcQosPolicy\", \"vnic.IscsiAdapterPolicy\", \"vnic.IscsiBootPolicy\", \"vnic.IscsiStaticTargetPolicy\", \"vnic.LanConnectivityPolicy\", \"vnic.LcpStatus\", \"vnic.SanConnectivityPolicy\", \"vnic.ScpStatus\", \"vrf.Vrf\", \"workflow.BatchApiExecutor\", \"workflow.BuildTaskMeta\", \"workflow.BuildTaskMetaOwner\", \"workflow.Catalog\", \"workflow.CustomDataTypeDefinition\", \"workflow.ErrorResponseHandler\", \"workflow.PendingDynamicWorkflowInfo\", \"workflow.RollbackWorkflow\", \"workflow.SolutionActionDefinition\", \"workflow.SolutionActionInstance\", \"workflow.SolutionDefinition\", \"workflow.SolutionInstance\", \"workflow.SolutionOutput\", \"workflow.TaskDebugLog\", \"workflow.TaskDefinition\", \"workflow.TaskInfo\", \"workflow.TaskMetadata\", \"workflow.TaskNotification\", \"workflow.TemplateEvaluation\", \"workflow.TemplateFunctionMeta\", \"workflow.WorkflowDefinition\", \"workflow.WorkflowInfo\", \"workflow.WorkflowMeta\", \"workflow.WorkflowMetadata\", \"workflow.WorkflowNotification\"])\n unless validator.valid?(object_type)\n fail ArgumentError, \"invalid value for \\\"object_type\\\", must be one of #{validator.allowable_values}.\"\n end\n @object_type = object_type\n end",
"def allowed_types\n [ Entities::Domain, \n Entities::Host, \n Entities::Organization, \n Entities::SearchString, \n Entities::Person]\nend",
"def personalities\r\n villagers.map{ |villager| villager.personality}\r\n end",
"def gender\n self.dig_for_string(\"agentSummary\", \"gender\")\n end",
"def attribute_types\n {\n title: :string,\n body: :string,\n decidim_category_id: :category,\n decidim_scope_id: :scope,\n address: :string,\n latitude: :string,\n longitude: :string,\n state: :string\n }\n end",
"def build_entity_dependencies\n @vocabulary.all_object_type.inject([{},{}]) { |a, o|\n if o.is_a?(ActiveFacts::Metamodel::EntityType)\n precursor = a[0]\n follower = a[1]\n blocked = false\n pi = o.preferred_identifier\n if pi\n pi.role_sequence.all_role_ref.each{|rr|\n role = rr.role\n player = role.object_type\n # REVISIT: If we decide to emit value types on demand, need to remove this:\n next unless player.is_a?(ActiveFacts::Metamodel::EntityType)\n # player is a precursor of o\n (precursor[o] ||= []) << player if (player != o)\n (follower[player] ||= []) << o if (player != o)\n }\n end\n if o.fact_type\n o.fact_type.all_role.each do |role|\n next unless role.object_type.is_a?(ActiveFacts::Metamodel::EntityType)\n (precursor[o] ||= []) << role.object_type\n (follower[role.object_type] ||= []) << o\n end\n end\n\n # Supertypes are precursors too:\n subtyping = o.all_type_inheritance_as_supertype\n next a if subtyping.size == 0\n subtyping.each{|ti|\n # debug ti.class.roles.verbalise; trace \"all_type_inheritance_as_supertype\"; exit\n s = ti.subtype\n (precursor[s] ||= []) << o\n (follower[o] ||= []) << s\n }\n # REVISIT: Need to use this to order ValueTypes after their supertypes\n # else\n # o.all_value_type_as_supertype.each { |s|\n # (precursor[s] ||= []) << o\n # (follower[o] ||= []) << s\n # }\n end\n a\n }\n end",
"def all(*types); end",
"def gender=(v)\n @gender = alma_string v\n end",
"def food_types(category_name)\n case category_name\n when \"Fruit\"\n Faker::Food.fruit\n when \"Spice\"\n Faker::Food.herb_or_spice\n when \"Ingredient\"\n Faker::Food.ingredient\n when \"Meat\"\n Faker::Food.meat\n when \"Vegetable\"\n Faker::Food.vegetable\n else\n Faker::Product.product\n end\nend",
"def genres\n document[\"genre\"].collect {|gender| gender[\"$\"]} rescue nil\n end",
"def type(type); end",
"def allowed_types\n [ Entities::SearchString, \n Entities::Organization, \n Entities::Domain, \n Entities::Host,\n Entities::Person, \n Entities::Username, \n Entities::Account]\nend",
"def generate_types\n pal.generate_types(cache: true)\n end",
"def explain_types; end",
"def subtype; end",
"def compile_all\n compile\n\n vtypes = {}\n\n @verbs.values.each do |vs|\n vs.each do |v|\n v.verbs.each do |vv|\n if vtypes[vv].nil?\n vtypes[vv] = v.type\n else\n if vtypes[vv] != v.type\n puts \"*** Verb #{vv} has multiple types (#{vtypes[vv]} and #{v.type})\"\n end\n end\n end\n end\n end\n vtypes.each do |pair|\n @parser.add_verb(pair.last, pair.first)\n end\n\n @adverbs.keys.each do |a|\n @parser.add_adverb(a)\n end\n\n if !@pending_qualities.empty?\n # now we need a dependency graph so we can order traits properly\n @pending_qualities.sorted_keys.each do |name|\n info = @pending_qualities[name]\n info[:name] = name\n regularize_traits info\n\n item = Quality.new(info)\n\n if !reported_errors? item\n @mixins[name] = item\n end\n\n @pending_qualities.delete name\n end\n end\n\n if !@pending_archetypes.empty?\n # now we need a dependency graph so we can order archetypes properly\n @pending_archetypes.sorted_keys.each do |name|\n info = @pending_archetypes[name]\n if !info.nil?\n if info[:archetype]\n archetype_name = find_archetype_name name, info[:archetype]\n if !@archetypes[archetype_name]\n puts \"Archetype #{info[:archetype]} not defined, but required by #{name}\"\n info[:archetype] = nil\n else\n info[:archetype] = @archetypes[archetype_name]\n end\n end\n\n info[:name] = name\n regularize_traits info\n\n item = Archetype.new(info)\n if !reported_errors? item\n @archetypes[name] = item\n end\n @pending_archetypes.delete name\n end\n end\n if !@pending_archetypes.empty?\n puts \"Some archetypes were not defined: #{@pending_archetypes.keys.sort.join(\", \")}\"\n end\n @pending_archetypes = nil\n end\n\n @pending.each do |p|\n self.send(p.first, *p.last)\n end\n\n self\n end",
"def nature; end",
"def mixed_types\n types = []\n types << 'MV' if (bib_format == 'MX') || (record.leader[8] == 'a')\n types << 'MW' if %w[d f p t].include?(record.leader[6])\n return types\n end",
"def get_gender_type_code\n gender_type ? gender_type.i18n_alternate : '?'\n end",
"def gender\n\n if self.providers.size == 0\n return self.gender_custom\n end\n\n if self.gender_custom != \"none\"\n return self.gender_custom\n end\n\n return nil if self.providers.size == 0\n genders = self.providers.map(&:gender).compact\n return genders.first if !genders.empty?\n nil \n end",
"def test_gender_with_valid_examples\n person = @valid_person\n Person::VALID_GENDERS.each do |valid_gender|\n person.gender = valid_gender\n assert person.valid?, \"#{valid_gender} should pass validation but doesn't.\"\n end\n end",
"def to_gender\n self\n end",
"def intent_schema\n intents_by_name = []\n utterance_model.sample_values.map { |intent| add_intents_by_name(intents_by_name, intent) } \n { intents: intents_by_name, types: custom_types_by_name }\n end",
"def users_types= value ; @users_types = value end",
"def members_commonest_data2\n data = [['Ethnicity', 'Male', 'Female']]\n members.group(\"meta_info->>'ethnicity'\").pluck(\"meta_info->>'ethnicity'\").delete_empty.each do |v|\n data << [v.to_s.titleize, members.where(\"meta_info->>'ethnicity' = ?\", v.to_s).male.count, members.where(\"meta_info->>'ethnicity' = ?\", v.to_s).female.count]\n end\n data\n end",
"def get_category_and_gender_short\n \"#{get_category_type_name} #{gender_type.i18n_short}\"\n end",
"def give_personality_info\n case self.character_type\n when 'estp'\n TemperamentInfo.artisan_info\n TemperamentInfo.estp_info\n when 'istp'\n TemperamentInfo.artisan_info\n TemperamentInfo.istp_info\n when 'esfp'\n TemperamentInfo.artisan_info\n TemperamentInfo.esfp_info\n when 'isfp'\n TemperamentInfo.artisan_info\n TemperamentInfo.isfp_info\n when 'estj'\n TemperamentInfo.guardian_info\n TemperamentInfo.estj_info\n when 'istj'\n TemperamentInfo.guardian_info\n TemperamentInfo.istj_info\n when 'esfp'\n TemperamentInfo.guardian_info\n TemperamentInfo.esfp_info\n when 'isfj'\n TemperamentInfo.guardian_info\n TemperamentInfo.isfj_info\n when 'enfj'\n TemperamentInfo.idealist_info\n TemperamentInfo.enfj_info\n when 'infj'\n TemperamentInfo.idealist_info\n TemperamentInfo.infj_info\n when 'enfp'\n TemperamentInfo.idealist_info\n TemperamentInfo.enfp_info\n when 'infp'\n TemperamentInfo.idealist_info\n TemperamentInfo.infp_info\n when 'entj'\n TemperamentInfo.rational_info\n TemperamentInfo.entj_info\n when 'intj'\n TemperamentInfo.rational_info\n TemperamentInfo.intj_info\n when 'entp'\n TemperamentInfo.rational_info\n TemperamentInfo.entp_info\n when 'intp'\n TemperamentInfo.rational_info\n TemperamentInfo.intp_info\n end\n end",
"def gender\n self[:gender] || \"\"\n end",
"def precursors\n case body = embodied_as\n when ActiveFacts::Metamodel::ValueType\n [ body.supertype, body.unit ] +\n body.all_value_type_parameter.map{|f| f.facet_value_type } +\n body.all_value_type_parameter_restriction.map{|vr| vr.value.unit}\n when ActiveFacts::Metamodel::EntityType\n if body.fact_type\n body.fact_type.all_role.map{|r| r.object_type}\n else\n []\n end +\n # You can't define the preferred_identifier fact types until you define the entity type,\n # but the objects which play the identifying roles must be defined:\n body.preferred_identifier.role_sequence.all_role_ref.map {|rr| rr.role.object_type } +\n # You can't define the objectified fact type until you define the entity type:\n # [ body.fact_type ] # If it's an objectification\n body.all_type_inheritance_as_subtype.map{|ti| ti.supertype} # If it's a subtype\n when FactType\n body.all_role.map(&:object_type)\n when Role # We don't consider roles as they cannot be separately defined\n []\n when ActiveFacts::Metamodel::PresenceConstraint\n body.role_sequence.all_role_ref.map do |rr|\n rr.role.fact_type\n end\n when ActiveFacts::Metamodel::ValueConstraint\n [ body.role_as_role_value_constraint ? body.role_as_role_value_constraint.fact_type : nil, body.value_type ] +\n body.all_allowed_range.map do |ar|\n [ ar.value_range.minimum_bound, ar.value_range.maximum_bound ].compact.map{|b| b.value.unit}\n end\n when ActiveFacts::Metamodel::SubsetConstraint\n body.subset_role_sequence.all_role_ref.map{|rr| rr.role.fact_type } +\n body.superset_role_sequence.all_role_ref.map{|rr| rr.role.fact_type }\n when ActiveFacts::Metamodel::SetComparisonConstraint\n body.all_set_comparison_roles.map{|scr| scr.role_sequence.all_role_ref.map{|rr| rr.role.fact_type } }\n when ActiveFacts::Metamodel::RingConstraint\n [ body.role.fact_type, body.other_role.fact_type ]\n when Instance\n [ body.population, body.object_type, body.value ? body.value.unit : nil ]\n when Fact\n [ body.population, body.fact_type ]\n when Query\n body.all_variable.map do |v|\n [ v.object_type,\n v.value ? v.value.unit : nil,\n v.step ? v.step.fact_type : nil\n ] +\n v.all_play.map{|p| p.role.fact_type }\n end\n when ContextNote\n []\n when Unit\n body.all_derivation_as_derived_unit.map{|d| d.base_unit }\n when Population\n []\n else\n raise \"ROGUE CONCEPT OF NO TYPE\"\n end.flatten.compact.uniq.map{|c| c.concept }\n end",
"def male_age_cal(people)\n total_age = 0\n people.each do |name, details|\n case details[\"gender\"]\n when \"male\"\n total_age +=details[\"age\"]\n end\n end\n p total_age\nend"
] | [
"0.73003936",
"0.60861206",
"0.6063521",
"0.59471333",
"0.58952653",
"0.58357424",
"0.57617164",
"0.57260627",
"0.5669109",
"0.5577488",
"0.5567861",
"0.553259",
"0.55118877",
"0.55118877",
"0.55118877",
"0.55118877",
"0.55118877",
"0.550571",
"0.5487728",
"0.54458797",
"0.54380864",
"0.5426129",
"0.54208803",
"0.5404894",
"0.5404787",
"0.53969735",
"0.53849053",
"0.53849053",
"0.5369657",
"0.53586173",
"0.5357168",
"0.53531665",
"0.5347728",
"0.5318707",
"0.53159744",
"0.53110665",
"0.5310107",
"0.53095984",
"0.5295786",
"0.52940065",
"0.52920556",
"0.52784914",
"0.5270859",
"0.52630144",
"0.5246117",
"0.5245392",
"0.52428395",
"0.5237899",
"0.5237899",
"0.5235669",
"0.5225849",
"0.52198774",
"0.52092546",
"0.51976717",
"0.518824",
"0.518693",
"0.51770765",
"0.5175431",
"0.5172474",
"0.5168696",
"0.5167656",
"0.51673836",
"0.5154423",
"0.51528925",
"0.5150553",
"0.515002",
"0.51490355",
"0.514462",
"0.5140582",
"0.51313984",
"0.51289266",
"0.5128624",
"0.5125602",
"0.5124572",
"0.5116131",
"0.5108791",
"0.51038873",
"0.50983894",
"0.5096615",
"0.50954795",
"0.5095131",
"0.5089359",
"0.5084019",
"0.50827074",
"0.5079813",
"0.5067368",
"0.50650316",
"0.5063945",
"0.5060405",
"0.50562346",
"0.50558454",
"0.50527966",
"0.50527817",
"0.5042173",
"0.5036928",
"0.50357133",
"0.50320745",
"0.5026849",
"0.5025111",
"0.5024712",
"0.5023268"
] | 0.0 | -1 |
we use this method so we can stub it out for testing | def client_class
Stomp::Client
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def stub_implementation; end",
"def spec; end",
"def spec; end",
"def private_method\n end",
"def implementation; end",
"def implementation; end",
"def __mock_reset; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def before_setup; end",
"def weber; end",
"def internal; end",
"def verify_stubbed_calls; end",
"def refutal()\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 wrapper; end",
"def __dummy_test__\n end",
"def stubbed?\n raise NotImplementedError\n end",
"def strategy; end",
"def around_hooks; end",
"def handle; end",
"def call\n # implement in subclasses\n end",
"def custom; end",
"def custom; end",
"def before_run; end",
"def driver; end",
"def stubs; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def mock_browser_at_creation mock_browser = nil\n puts \"MOCKING BROWSER\"\n if mock_browser.nil?\n allow_any_instance_of(AdminModule::Pages).to receive(:browser).and_return(HardBrowserMock.new)\n else\n allow_any_instance_of(AdminModule::Pages).to receive(:browser).and_return(mock_browser)\n end\nend",
"def awaken!\n\t\traise 'Not implemented'\n\tend",
"def initialize stub_method\n @stub_method = stub_method\n end",
"def self_test; end",
"def self_test; end",
"def patch; end",
"def patch; end",
"def stubbed_params=(_arg0); end",
"def sandbox?; end",
"def sandbox?; end",
"def hunter_stub\n\tend",
"def prepare_data\n # This method is just a stub.\n end",
"def called_from; end",
"def called_from; end",
"def overrides; end",
"def isolated; end",
"def isolated; end",
"def setup\n # override this if needed\n end",
"def before; end",
"def _prepare_context; end",
"def internal?; 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 call\n raise NotImplementedError\n end",
"def call\n raise NotImplementedError\n end",
"def before() nil ; end",
"def testing\n # ...\n end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def sandbox; end",
"def sandbox; end",
"def verify\n # nothing to do here, so just return\n end",
"def get_context(*params); raise('Stub or mock required.') end",
"def before() ; end",
"def setup\n\n end",
"def setup\n\n end",
"def setup\n\n end",
"def proxy\n super\n end",
"def add_stack_mocks(obj)\n allow(obj).to receive(:read_template).and_return(MOCK_TEMPALTE)\nend"
] | [
"0.7089703",
"0.63627577",
"0.6327509",
"0.6327509",
"0.63085747",
"0.6137466",
"0.6137466",
"0.6106157",
"0.6036883",
"0.6036883",
"0.6036883",
"0.6036883",
"0.5945212",
"0.59359396",
"0.58578104",
"0.5856634",
"0.58088255",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.58086836",
"0.5802936",
"0.5788087",
"0.57733315",
"0.5771564",
"0.57641345",
"0.57507306",
"0.5747649",
"0.57458204",
"0.57458204",
"0.5728671",
"0.57278717",
"0.57278436",
"0.57075953",
"0.57075953",
"0.57075953",
"0.5655815",
"0.56454647",
"0.5643877",
"0.56037575",
"0.56037575",
"0.5594084",
"0.5594084",
"0.5592335",
"0.55917156",
"0.55917156",
"0.55772257",
"0.55649805",
"0.55071455",
"0.55071455",
"0.54979855",
"0.5478713",
"0.5478713",
"0.5477495",
"0.5466857",
"0.54655206",
"0.5461911",
"0.5455127",
"0.5455127",
"0.5455127",
"0.5455127",
"0.5455127",
"0.5455127",
"0.5455127",
"0.54545796",
"0.54545796",
"0.544875",
"0.5448657",
"0.5446028",
"0.5446028",
"0.5446028",
"0.5446028",
"0.5446028",
"0.5446028",
"0.5446028",
"0.5446028",
"0.54403484",
"0.54403484",
"0.543573",
"0.5434139",
"0.54311186",
"0.54267466",
"0.54267466",
"0.54267466",
"0.54196835",
"0.5413192"
] | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def tag_params
params.require(:tag).permit(:show)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"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 filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n 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 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 [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params\n true\n 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 additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def user_params\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def user_params\r\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"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 params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"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 get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def parameters\n nil\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end",
"def special_device_list_params\n params.require(:special_device_list).permit(:name)\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 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"
] | [
"0.71230334",
"0.70530915",
"0.69479465",
"0.6902122",
"0.67367256",
"0.67172784",
"0.6689043",
"0.66784793",
"0.6660117",
"0.6555213",
"0.6528485",
"0.6458438",
"0.6452378",
"0.6451654",
"0.64478326",
"0.6433326",
"0.6413599",
"0.6413599",
"0.63907677",
"0.63787645",
"0.63787645",
"0.6375229",
"0.63608277",
"0.635366",
"0.6283652",
"0.62798274",
"0.6245606",
"0.62283605",
"0.6224614",
"0.6223649",
"0.62118477",
"0.6207179",
"0.61780804",
"0.6173056",
"0.61674094",
"0.615996",
"0.6145132",
"0.613597",
"0.612235",
"0.6108622",
"0.6098955",
"0.60767287",
"0.6055062",
"0.60391796",
"0.60363555",
"0.6030472",
"0.6018476",
"0.60174584",
"0.60163116",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60159874",
"0.60052663",
"0.6003681",
"0.6001089",
"0.5996807",
"0.5994288",
"0.59942675",
"0.5984987",
"0.59827954",
"0.59777087",
"0.5975369",
"0.59706473",
"0.5966046",
"0.5965166",
"0.5965166",
"0.59577847",
"0.5952617",
"0.59503365",
"0.59480196",
"0.5943258",
"0.5931462",
"0.59299",
"0.5927073",
"0.5924737",
"0.5919184",
"0.5918459",
"0.591457",
"0.59142643",
"0.59062785",
"0.59054136",
"0.59047925",
"0.5902357",
"0.5900476",
"0.5898475",
"0.5898218",
"0.5895328"
] | 0.0 | -1 |
Saves the currently playing background music for later playback. | def bgm_memorize
@memorized_bgm = @playing_bgm
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_playing\n self.play_start = DateTime.now\n self.paused = false\n self.seconds_offset = 0.0\n return ARUtils.save_cmdline(self)\n end",
"def background_save\n Process.detach( fork { save } )\n end",
"def play_music\n $game_system.bgm_memorize2\n Audio.bgm_stop\n Audio.bgm_play(Evolve::EVOLVE_MUSIC)\n end",
"def save_song_info(song)\n return unless song\n @current_song = song unless @current_song\n begin\n File.open(FILES[:song], \"w+\") { |f| f.write(song.to_yaml) }\n rescue Exception => e\n retry if fix_dir?\n Logger.log \"unable to save current song.\"\n Logger.log e\n end\n if @current_song && @current_song[\"id\"] != song[\"id\"]\n @current_song = song\n Logger.log \"#{song[\"dj\"]} is now playing: #{song[\"title\"]} by #{song[\"author\"]}\"\n end\n end",
"def on_save_success\r\n Sound.play_save\r\n return_scene\r\n end",
"def save_to(file_path)\n sound = RubyAudio::Sound.new(\n file_path,\n 'w',\n RubyAudio::SoundInfo.new(channels: 1,\n samplerate: @sound.samplerate,\n format: RubyAudio::FORMAT_WAV | RubyAudio::FORMAT_PCM_16))\n buf = RubyAudio::Buffer.new('int', @buffer.size)\n @buffer.each do |v|\n buf[i] = v\n end\n sound.write(buf)\n sound.close\n end",
"def save_stop\n self.play_start = nil\n self.paused = false\n self.seconds_offset = 0.0\n ARUtils.save_cmdline(self)\n end",
"def save\n files = MyBiaDJ::Table(:files)\n record = files.create(:path => relative_path, :name => name)\n tracks.each do |track|\n track.save(record) if track.mp3?\n end\n end",
"def play_title_music\n $data_system.title_bgm.play\n RPG::BGS.stop\n RPG::ME.stop\n end",
"def play_title_music\n $data_system.title_bgm.play\n RPG::BGS.stop\n RPG::ME.stop\n end",
"def music=(flag)\n\n # Save the flag\n @music = flag\n\n # If we've turned music on, resume any music that's paused\n if @music\n resume\n # Otherwise, pause which will stop anything that's currently playing\n else\n pause\n end\n\n end",
"def save(snd)\n snd_name = file_name(snd)\n set_sound_property(:current_file_time, file_write_date(snd_name), snd)\n @sound_funcs.each do |prop|\n set_sound_property(prop, snd_func(prop, snd), snd)\n end\n props = (sound_properties(snd) or [])\n if reject = sound_property(:save_state_ignore, snd)\n props.reject! do |k, v| reject.member?(k) end\n end\n res = format(\"let(find_sound(%s)) do |snd_s|\\n\", snd_name.inspect)\n res += format(\" set_sound_properties(%s, snd_s)\\n\", props.inspect)\n channels(snd).times do |chn|\n @channel_funcs.each do |prop|\n if prop == :transform_type\n set_channel_property(prop, transform2integer(snd_func(prop, snd, chn)), snd, chn)\n else\n set_channel_property(prop, snd_func(prop, snd, chn), snd, chn)\n end\n end\n props = (channel_properties(snd, chn) or [])\n if reject = channel_property(:save_state_ignore, snd, chn)\n props.reject! do |k, v| reject.member?(k) end\n end\n res += format(\" if channels(snd_s) > %d\\n\", chn)\n res += format(\" set_channel_properties(%s, snd_s, %d)\\n\", props.inspect, chn)\n res += \" end\\n\"\n end\n res += \"end\\n\"\n res += marks2string(snd)\n with_db do |db|\n db[snd_name] = res\n end\n end",
"def save_pause(paused, song_play_time = 0.0)\n self.play_start = DateTime.now\n self.paused = paused\n self.seconds_offset = song_play_time\n ARUtils.save_cmdline(self)\n end",
"def play_title_music\r\n\r\n$data_system.title_bgm.play\r\n\r\nRPG::BGS.stop\r\n\r\nRPG::ME.stop\r\n\r\nend",
"def main_audio\r\n super\r\n # Play title BGM\r\n $game_system.bgm_play($data_system.title_bgm)\r\n # Stop playing ME and BGS\r\n Audio.me_stop\r\n Audio.bgs_stop\r\n end",
"def snd_save_mpc\n\t@play_state = `mpc | sed -n 2p`.chomp.sub(/^\\s*\\[(.*)\\].*$/, '\\1')\n\t`mpc toggle` if @play_state == \"playing\"\n\n\t@volume = `mpc | grep volume`.chomp.sub(/^.*volume:\\s*([0-9]*).*$/, '\\1').to_i\n\t`mpc volume #{$setvolume}` if $setvolume\n\n\tp [:snd_save_mpc, @play_state, @volume]\nend",
"def bgm_restore\n bgm_play(@memorized_bgm)\n end",
"def save_file\r\n @saved = true\r\n saving\r\n Dir.mkdir(\"saves\") unless Dir.exists? \"saves\"\r\n File.open(\"my_save.yaml\", \"w\") {|f| f.puts YAML::dump(self) }\r\n end",
"def determine_savefile\n if @saving\n if FileTest.exist?(make_filename(@last_slot_index))\n Sound.play_decision\n @confirm_window.show()\n @window_slotlist.active=false\n else\n Sound.play_save\n do_save()\n end\n else\n if FileTest.exist?(make_filename(@last_slot_index))\n Sound.play_load\n do_load()\n else\n Sound.play_buzzer\n end\n end\n end",
"def background(soundName) #unverified\r\n\t\texec(\"background\", soundName)\r\n\tend",
"def to_local_sound!\n local_sound = becomes( LocalSound )\n local_sound.subtype = self.class.name\n local_sound.file = StringIO.new( download.body )\n if filename = download.headers[\"content-disposition\"][/\\\"(.+)\\\"/, 1]\n local_sound.file_file_name = filename\n end\n local_sound.save!\n Sound.where( id: id ).update_all( type: \"LocalSound\" )\n Sound.where( id: id ).first\n end",
"def update\n\n # Can't do anything if the music isn't turned on, with a track queued\n return unless @active_track && @track_queued && @music && @audio\n\n # Also, if music is already playing we don't have to do anything.\n # This shouldn't be possible, but worth guarding against anyway\n return if @music_playing\n\n # So, start the music playing\n $gtk.args.outputs.sounds << @active_track\n\n # And set the flags right\n @track_queued = false\n @music_playing = true\n\n end",
"def save\n # Nothing in base class. This should be used to persist settings in\n # subclasses that use files.\n end",
"def autosave; end",
"def save_game\n Dir.mkdir(\"../saves\") unless Dir.exists?(\"../saves\")\n @@save_count += 1\n binding.pry\n log_saves\n savefile = \"../saves/save_#{@@save_count}.yml\"\n File.open(savefile, 'w') do | file |\n file.write(self.to_yaml)\n end\n end",
"def save \n# # - this method will add Song instances to the @@all array\n @@all << self \n end",
"def bgsave\n timeout_retry(3, 3){\n write \"BGSAVE\\r\\n\"\n status_code_reply\n }\n end",
"def save(filename)\n speech = bytes_wav\n res = IO.popen(lame_command(filename, command_options), 'r+') do |process|\n process.write(speech)\n process.close_write\n process.read\n end\n res.to_s\n end",
"def save # :nodoc:\n if @file\n File.open(SAVE_FILE, 'w') do |f|\n Marshal.dump(file, f)\n end\n else\n forget\n end\n end",
"def save # :nodoc:\n if @file\n File.open(SAVE_FILE, 'w') do |f|\n Marshal.dump(file, f)\n end\n else\n forget\n end\n end",
"def play!\n Song.update_all(:now_playing => false)\n self.now_playing = true\n self.last_played_at = Time.now\n votes.update_all(:active => false)\n save\n end",
"def save_game\n store = YAML.dump(self)\n File.open('lib/saved_game.yml', 'w') do |file|\n file.puts(store)\n end\n puts 'your game has been saved!'\n end",
"def save_audio(url, sid)\n\t# Name the file with the RecordingSid from Twilio\n\twavfile = \"/tmp/#{sid}.wav\"\n\tFile.open(wavfile, \"wb\") do |file|\n\t\tfile.write open(url).read\n\tend\n\treturn wavfile\nend",
"def current\n now_playing = Play::Player.now_playing\n now_playing = now_playing.to_hash if now_playing\n\n songs = Play::Queue.songs\n\n Yajl.dump({\n :now_playing => now_playing,\n :songs => songs.map {|song| song.to_hash }\n })\n end",
"def pause_music\n #pause itunes - yanked from https://github.com/sunny/anyplayer/blob/master/lib/anyplayer/players/itunes_mac.rb\n %x(osascript -e 'tell app \"iTunes\" to pause').rstrip\n #pause Spotify\n %x(osascript -e 'tell app \"Spotify\" to pause').rstrip\nend",
"def remember_all_sound_properties(database = ENV['HOME'] + \"/.snd-properties\", tmp_snd_p = false)\n rsp = Remember_sound_properties.new(database)\n unless $after_open_hook.member?(\"save-property-hook\")\n $after_open_hook.add_hook!(\"save-property-hook\") do |snd|\n rsp.load(snd)\n end\n $close_hook.add_hook!(\"save-property-hook\") do |snd|\n if tmp_snd_p or (not file_name(snd) =~ /(.+\\d+_\\d+\\.snd$)|(.*\\.rev.*$)/)\n rsp.save(snd)\n end\n end\n end\n set_property(:remember_properties, :object, rsp)\n rsp\n end",
"def save\n file_path = self.class.file_path(@save_id)\n File.open(file_path, 'w') { |file| \n bytes = file.write @items.inspect\n if bytes > 0\n puts \"saved to #{file_path}\"\n else\n puts \"save to #{file_path} failed\"\n end\n }\n end",
"def save\n\n playerset('')\n $savefile = File.new(\"../Resources/Saves/save.txt\", \"w\")\n $savefile.puts(@@hand, @@ehand)\n cputs(\"saved\", \"green\")\n\nend",
"def save_game\n\t\t# If current game was previously saved, delete the old version of current game...\n\t\tif @running_saved_game != nil\n\t\t\tover_write_data\n\t\tend\n\t\t# And add new version of current game to saved data\n\t\tFile.open(@path, 'a+') do |f|\n\t\t\t\tf.puts \"#{@word.join},#{@guess},#{@wrong_letters},#{@turn}\"\n\t\tend\n\tend",
"def save_state\n\t\[email protected] do \n\t\t\t@store[:tracks] = @track_list\n\t\t\t@store[:artists] = @artist_list\n\t\t\t@store[:last_played] = @last_played\n\t\tend\n\tend",
"def save\n self.queue.each do |style, file|\n path = self.path(style)\n self.storage.save(file, path) if file and path\n end\n self.purge.each do |path|\n self.storage.destroy(path)\n end\n @purge = []\n @queue = {}\n end",
"def write_to_file(filename)\n Audio.write_to_file(@audio, filename)\n end",
"def pause\n `#{@sound}.pause()`\n end",
"def main_audio\r\n super\r\n # Stop BGM and BGS\r\n $game_system.bgm_play(nil)\r\n $game_system.bgs_play(nil)\r\n # Play game over ME\r\n $game_system.me_play($data_system.gameover_me)\r\n end",
"def flush_sound\n to_delete = []\n @sound_cache.each_key do |filename|\n to_delete << filename if (@sound_count[filename] -= 1) <= 0\n end\n to_delete.reverse_each do |filename|\n log_info \"Audio::Cache : #{filename} released.\"\n @sound_count.delete(filename)\n @sound_cache.delete(filename)\n end\n end",
"def save_player\n session[:current_player] = @current_player\n end",
"def play_song(id)\n @pause_play = \"pause\" # Resets pause button\n @song_settings.stop rescue nil # Makes sure no other song is playing\n begin\n path = @data_array[@selected_album].songs[id.to_i].location\n wave = WaveInfo.new(path) # Uses wave info gem to grab info from wav\n @song_length = wave.duration # Broadcasts song duration\n @tick = Gosu.milliseconds # Resets ticker so that @count_up starts at 0\n @currently_playing = id # Broadcasts currently playing song\n @playing_album_name = @data_array[@selected_album].title.upcase\n @playing_song_name = @data_array[@selected_album].songs[id].name.upcase\n @playing_thumbnail = @data_array[@selected_album].cover\n song = Gosu::Sample.new(path) # Sample plays wav file from path\n @song_settings = song.play(100,1,false)\n @show_playbar = true\n rescue\n @show_player = false\n stop_song()\n puts \"SONG WAS NOT FOUND\".red\n end\nend",
"def play_songs\n MusicImporter.new(path).play_song\n end",
"def save\n if @data && @data.length > 0\n File.write( session_path, @data.to_yaml )\n @request.response.set_cookie( 'session_id',\n :value => session_id, :path => '/',\n :expires => Time.now + Waves.config.session[:duration] )\n end\n end",
"def autosave\n Setting[:autosave] ? history.save : history.clear\n end",
"def commandnewgame_audio\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Stop BGM\r\n Audio.bgm_stop\r\n end",
"def update_savefile_selection\n if Input.trigger?(Input::C)\n determine_savefile()\n elsif Input.trigger?(Input::B)\n Sound.play_cancel\n quit_command()\n end\n end",
"def save_artwork_to_file(file_path)\n @ole.SaveArtworkToFile(file_path)\n end",
"def save\n flush_deletes unless @options[:keep_old_files]\n process = only_process\n @queued_for_write.except!(:original) if process.any? && !process.include?(:original)\n flush_writes\n @dirty = false\n true\n end",
"def create_music(varname, filename)\n @music.add_music(varname, filename)\n end",
"def persistent_to_quicksave\n p_file = File.open(File.join([self.path, 'persistent.sfs']), 'r'){|f| f.readlines}\n File.open(File.join([self.path, 'quicksave.sfs']), 'w'){|f| f.write(p_file.join)}\n end",
"def save_to(path)\n (File.open(path, 'w') << to_s).close\n path\n end",
"def save_to(path)\n (File.open(path, 'w') << to_s).close\n path\n end",
"def force_save\n GamePlay::Save.save\n end",
"def save_settings\n File.open(@path, \"w\") do |file|\n file.write @settings.to_yaml\n end\n end",
"def save(path)\n File.open(path,\"w\"){|out| out.puts Marshal.dump(self) }\n end",
"def play\n @playing = true\n Audio.play_wav(@audio)\n @playing = false\n end",
"def log_saves \n s_log = File.open(\"../saves/log.yml\", \"w\")\n s_log.puts @@save_count\n s_log.close\n end",
"def writeAudioOnly\n tf = Tempfile.new( @basename )\n \n File.open( @filename ) { |f|\n f.seek(@audioStartX)\n tf.write( audio ) # reads the audio from file if nil\n }\n tf.close\n path = tf.path\n \n tf.open\n tf.close(true)\n end",
"def play\n Audio::Out.add @cpg\n @is_playing = true\n #Audio::Out.add @actuator\n end",
"def save\n \tdata = self\n \t\n \tFile.open('store.yml','w') do |f|\n \t\tf.write(data.to_yaml)\n \tend\n \tputs data\n \tputs \"Saved!\"\n \tputs \"\"\n end",
"def background_music(song1, song2)\n puts \"The song, #{song1}, makes me want to work continuously.\"\n puts \"The song, #{song2}, makes me sleepy.\"\n puts \"I wsih every song made me feel like I could conqueor the world!\"\nend",
"def save!\n ScriptoriaCore::Ruote.engine.storage_participant.do_update(_workitem)\n end",
"def save(upload)\n uploadFile = upload['datafile']\n originalName = uploadFile.original_filename\n self.fileType = File.extname(originalName)\n\n create_or_update()\n\n # write the file\n File.open(self.filePath, \"wb\") { |f| f.write(uploadFile.read) }\n \n # write ID3 metadata to database, to avoid the expense of fetching\n # from the file every time - quite costly as more files are displayed at a time\n begin\n musicFile = TagLib::File.new(self.filePath())\n self.id3Title = musicFile.title\n self.id3Artist = musicFile.artist\n self.id3Length = musicFile.length\n rescue TagLib::BadFile => exc\n logger.error(\"Failed to id track: \\n #{exc}\")\n end\n\n if(self.fileType == '.mp3')\n convertToOGG();\n end\n create_or_update()\n\n end",
"def save\n return if saved?\n self.saved = true\n original_path = interpolate_path(:original)\n stream.write_to(original_path)\n end",
"def im_done(playlist)\n #Stop the playlist\n Process.kill @music_pid\n #Grab and play the next playist, if there is one\n @current_playlist = @queue.shift and play @current_playlist \n end",
"def save_game\n\t\tsaves = []\n\t\tsaves << @board\n\t\tsaves << @current_player\n\t\tsave_yaml = YAML.dump(saves)\n\n\t\tFile.open('saved_game.yaml', 'w') do |file|\n\t\t\tfile.puts save_yaml\n\t\tend\n\t\tputs \"Your game has been saved.\"\n\t\tputs \"Closing the game...\"\n\t\texit\n\tend",
"def set_music\n @music = Music.random_select\n end",
"def set_playing\n puts \"set_playing, sess[play]: #{session[:playing]}, current_user:#{current_user}\"\n\n if !signed_in?\n session[:playing] = false\n puts \"playing(#{playing}) but not yet signed in... setting to false.\"\n return\n end\n\n if !session[:playing]\n puts \"current_user.id=#{current_user.id}, diff_lvl_id=#{current_user.difficulty_level_id}\"\n client_entered(current_user.id, current_user.difficulty_level_id)\n session[:playing] = true\n end\n end",
"def save\n dump = Marshal.dump(self)\n file = File.new(FILENAME, 'w')\n file = Zlib::GzipWriter.new(file)\n file.write(dump)\n file.close\n puts \"Bot state saved.\"\n end",
"def audio\n \t@playlist = Playlist.last\n send_glued_audio('list', :playlist => @playlist)\n end",
"def persist!\n ::File.write(self.path, Marshal.dump(self))\n rescue => e\n puts e.message\n exit\n end",
"def save! target=\"./Albums\"\n dirname = File.join target, @name\n FileUtils.mkdir_p dirname\n\n self.photos{|p| p.save! dirname}\n end",
"def save\n if any?\n FileUtils.mkdir_p basedir if !Dir.exist? basedir\n backup if @backup\n\n # I do this the long way because I want an immediate sync.\n f = open(@file, 'w')\n f.write YAML::dump self\n f.sync\n f.close\n\n set_mode if @mode\n end\n true\n end",
"def save\n puts \"Would you like to save your progress? (y/n)\"\n puts \"\"\n response = gets.strip.downcase\n puts \"\"\n if response == \"y\"\n File.open(\"saves.yaml\", \"w\") do |file|\n file.puts YAML::dump(@computer)\n end\n puts \"Your game has been saved!\"\n puts \"\"\n else\n puts \"Lets just keep playing then!\"\n puts \"\"\n end\n end",
"def save!; File.write @path, @data end",
"def persist(ups, root_path)\n return if ups.nil?\n\n # try to guess where we are if someone is dumb\n if root_path.nil?\n Dir.chdir '..'\n root_path = Dir.pwd\n end\n\n # raise InvalidFileType, 'Requires mp3 file!' unless ups && ups.audio?\n\n file = ups.tempfile\n dir = file_dir(root_path)\n path = file_path(dir, ups.filename)\n\n FileUtils.mkdir_p dir unless File.directory? dir\n\n written = File.open(path, 'wb') { |f| f.write file.read }\n\n if written > 0\n {\n file_name: ups.filename,\n file_type: ups.filetype,\n file_cat: ups.filecat,\n file_ext: ups.fileext,\n file_path: path,\n file_path_orig: path\n }\n else\n raise FileNotWritten, 'Something horrible happened!'\n end\n end",
"def save_to(path); end",
"def save\n File.write(yfile, to_yaml)\n end",
"def save(game)\n\t\tprint \"Name the save: \"\n\t\tsave_name = gets.chomp.downcase\n\t\tDir.mkdir \"saves\" unless Dir.exists? \"saves\"\n\t\tfile_path = File.join(\"saves\", \"#{save_name}\")\n\t\tFile.open(file_path, \"w\") { |f|\n\t\t\tf.write(YAML.dump(game))\n\t\t}\n\t\tputs \"The game has been saved!\"\n\tend",
"def save\n File.open(SaveLocation, 'w') do |file|\n file.puts @value.join(\"\")\n file.puts @progress.join(\"\")\n file.puts @bad_guesses.join(\"\")\n end\n end",
"def beep\n play_song([Note::G, Note::WHOLE])\n end",
"def save\r\n props = {}\r\n instance_variables.each{|v|\r\n # props[v.to_s[1..-1]] = instance_variable_get(\"#{v}\")\r\n p = v.to_s[1..-1]\r\n props[p] = self.send(p)\r\n }\r\n File.write(STORAGE, YAML.dump(props))\r\n end",
"def to_local_sound\n local_sound = LocalSound.new( attributes.reject{ |k,v| %w(id type).include?( k ) } )\n local_sound.subtype = self.class.name\n local_sound.file = StringIO.new( download.body )\n if filename = download.headers[\"content-disposition\"][/\\\"(.+)\\\"/, 1]\n local_sound.file_file_name = filename\n end\n local_sound\n end",
"def make_save_contents\n\t\t\tcontents = local_make_save_contents\n\t\t\tcontents[:self_vars] = $game_selfVars\n\t\t\tcontents\n\t\tend",
"def do_add(pathname)\n fail CvlcClientError, \"No such file or directory '#{pathname}'\" unless File.exist? \"#{@music_root}/#{pathname}\"\n string = url_encode(pathname.sub(%r{/+$}, ''))\n do_command(\"requests/status.json?command=in_play&input=file://#{@music_root}/#{string}&option=novideo\")\n return currently_playing\n end",
"def write()\n open(CurrentFilename, 'w'){|fp|\n Marshal.dump(@current_setting, fp)\n }\n end",
"def __autosaving__\n Threaded.begin_autosave(self)\n yield\n ensure\n Threaded.exit_autosave(self)\n end",
"def save! path\n File.open(path, 'w') do |file|\n file.write(to_s)\n end\n end",
"def open_save\n @in_save = true\n call_scene(Save) do |scene|\n @running = false if scene.saved\n Graphics.transition\n end\n @in_save = false\n end",
"def autoplayAsCue\n if @map.autoplay_bgm\n if PBDayNight.isNight? && FileTest.audio_exist?(\"Audio/BGM/\"+ @map.bgm.name+ \"n\")\n pbCueBGM(@map.bgm.name+\"n\",1.0,@map.bgm.volume,@map.bgm.pitch)\n else\n pbCueBGM(@map.bgm,1.0)\n end\n end\n if @map.autoplay_bgs\n pbBGSPlay(@map.bgs)\n end\n end",
"def autoplayAsCue\r\n if @map.autoplay_bgm\r\n if PBDayNight.isNight? && FileTest.audio_exist?(\"Audio/BGM/\"+ @map.bgm.name+ \"_n\")\r\n pbCueBGM(@map.bgm.name+\"_n\",1.0,@map.bgm.volume,@map.bgm.pitch)\r\n else\r\n pbCueBGM(@map.bgm,1.0)\r\n end\r\n end\r\n if @map.autoplay_bgs\r\n pbBGSPlay(@map.bgs)\r\n end\r\n end",
"def save\n file_name = ask_save_file\n save_file = File.open(file_name, 'w')\n save_file.puts(serialize)\n save_file.close\n puts \"Game has been saved to Save File #{file_name[-5]}!\"\n puts \"\\n\\n\"\n end",
"def save_status(file_path)\n begin\n Pathname.new(file_path).open('wb') do |f|\n @saved_at = Fluent::Engine.now\n @saved_duration = @saved_at - @last_checked\n Marshal.dump({\n :counts => @counts,\n :saved_at => @saved_at,\n :saved_duration => @saved_duration,\n :aggregate => @aggregate,\n :count_key => @count_key,\n :patterns => @patterns,\n }, f)\n end\n rescue => e\n log.warn \"out_datacounter: Can't write store_file #{e.class} #{e.message}\"\n end\n end",
"def off\n @music.off\n @playlist.clear\n @song.kill\n end"
] | [
"0.66972154",
"0.6277391",
"0.5995906",
"0.5946753",
"0.59252673",
"0.59206206",
"0.5874071",
"0.5843036",
"0.5802665",
"0.5802665",
"0.58012444",
"0.5746439",
"0.56745833",
"0.56510293",
"0.56244564",
"0.56088305",
"0.5541716",
"0.54460263",
"0.54431",
"0.5409847",
"0.53600496",
"0.5334231",
"0.53324926",
"0.5310335",
"0.52735937",
"0.5226628",
"0.52236366",
"0.5219542",
"0.5191928",
"0.5191928",
"0.5174011",
"0.5166395",
"0.51594496",
"0.513949",
"0.5130794",
"0.5130023",
"0.51136035",
"0.51052254",
"0.50786465",
"0.50592923",
"0.505431",
"0.5053059",
"0.50452",
"0.50420386",
"0.49953562",
"0.49929357",
"0.4985258",
"0.49707416",
"0.49595273",
"0.49466735",
"0.49405757",
"0.49375087",
"0.49363533",
"0.49340588",
"0.4909635",
"0.49092147",
"0.4904507",
"0.4904507",
"0.48935434",
"0.48849544",
"0.48826343",
"0.48780057",
"0.48759198",
"0.4871981",
"0.4865691",
"0.48652261",
"0.4864197",
"0.48625124",
"0.48579687",
"0.48483184",
"0.4846691",
"0.4842302",
"0.48375103",
"0.48356858",
"0.48310867",
"0.48201618",
"0.48082563",
"0.4791857",
"0.4786562",
"0.4783214",
"0.4779204",
"0.47790068",
"0.4776676",
"0.4772377",
"0.47701067",
"0.47687596",
"0.4759723",
"0.47572827",
"0.47514027",
"0.474975",
"0.47487748",
"0.47432002",
"0.47430038",
"0.4742933",
"0.47354406",
"0.47336903",
"0.47336182",
"0.47333208",
"0.47312018",
"0.47294685"
] | 0.4799007 | 77 |
Plays the currently memorized background music | def bgm_restore
bgm_play(@memorized_bgm)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play_music\n $game_system.bgm_memorize2\n Audio.bgm_stop\n Audio.bgm_play(Evolve::EVOLVE_MUSIC)\n end",
"def play_title_music\n $data_system.title_bgm.play\n RPG::BGS.stop\n RPG::ME.stop\n end",
"def play_title_music\n $data_system.title_bgm.play\n RPG::BGS.stop\n RPG::ME.stop\n end",
"def main_audio\r\n super\r\n # Play title BGM\r\n $game_system.bgm_play($data_system.title_bgm)\r\n # Stop playing ME and BGS\r\n Audio.me_stop\r\n Audio.bgs_stop\r\n end",
"def play_title_music\r\n\r\n$data_system.title_bgm.play\r\n\r\nRPG::BGS.stop\r\n\r\nRPG::ME.stop\r\n\r\nend",
"def main_audio\r\n super\r\n # Stop BGM and BGS\r\n $game_system.bgm_play(nil)\r\n $game_system.bgs_play(nil)\r\n # Play game over ME\r\n $game_system.me_play($data_system.gameover_me)\r\n end",
"def autoplayAsCue\n if @map.autoplay_bgm\n if PBDayNight.isNight? && FileTest.audio_exist?(\"Audio/BGM/\"+ @map.bgm.name+ \"n\")\n pbCueBGM(@map.bgm.name+\"n\",1.0,@map.bgm.volume,@map.bgm.pitch)\n else\n pbCueBGM(@map.bgm,1.0)\n end\n end\n if @map.autoplay_bgs\n pbBGSPlay(@map.bgs)\n end\n end",
"def autoplayAsCue\r\n if @map.autoplay_bgm\r\n if PBDayNight.isNight? && FileTest.audio_exist?(\"Audio/BGM/\"+ @map.bgm.name+ \"_n\")\r\n pbCueBGM(@map.bgm.name+\"_n\",1.0,@map.bgm.volume,@map.bgm.pitch)\r\n else\r\n pbCueBGM(@map.bgm,1.0)\r\n end\r\n end\r\n if @map.autoplay_bgs\r\n pbBGSPlay(@map.bgs)\r\n end\r\n end",
"def play\n Audio::Out.add @cpg\n @is_playing = true\n #Audio::Out.add @actuator\n end",
"def buz; Sound.play_buzzer; end",
"def autoplay\r\n if @map.autoplay_bgm\r\n if PBDayNight.isNight? && FileTest.audio_exist?(\"Audio/BGM/\"+ @map.bgm.name+ \"_n\")\r\n pbBGMPlay(@map.bgm.name+\"_n\",@map.bgm.volume,@map.bgm.pitch)\r\n else\r\n pbBGMPlay(@map.bgm)\r\n end\r\n end\r\n if @map.autoplay_bgs\r\n pbBGSPlay(@map.bgs)\r\n end\r\n end",
"def autoplay\n if @map.autoplay_bgm\n if PBDayNight.isNight? && FileTest.audio_exist?(\"Audio/BGM/\"+ @map.bgm.name+ \"n\")\n pbBGMPlay(@map.bgm.name+\"n\",@map.bgm.volume,@map.bgm.pitch)\n else\n pbBGMPlay(@map.bgm)\n end\n end\n if @map.autoplay_bgs\n pbBGSPlay(@map.bgs)\n end\n end",
"def run_player_loop_for(audio_file)\n @mp = JavaMusicPlayer.new(audio_file)\n @mp.play_loop\n end",
"def play\n @sound += 1\n @sound %= @overlap\n `#{@sounds[@sound]}.play()`\n end",
"def play\n @playing = true\n Audio.play_wav(@audio)\n @playing = false\n end",
"def play_song(id)\n @pause_play = \"pause\" # Resets pause button\n @song_settings.stop rescue nil # Makes sure no other song is playing\n begin\n path = @data_array[@selected_album].songs[id.to_i].location\n wave = WaveInfo.new(path) # Uses wave info gem to grab info from wav\n @song_length = wave.duration # Broadcasts song duration\n @tick = Gosu.milliseconds # Resets ticker so that @count_up starts at 0\n @currently_playing = id # Broadcasts currently playing song\n @playing_album_name = @data_array[@selected_album].title.upcase\n @playing_song_name = @data_array[@selected_album].songs[id].name.upcase\n @playing_thumbnail = @data_array[@selected_album].cover\n song = Gosu::Sample.new(path) # Sample plays wav file from path\n @song_settings = song.play(100,1,false)\n @show_playbar = true\n rescue\n @show_player = false\n stop_song()\n puts \"SONG WAS NOT FOUND\".red\n end\nend",
"def run\n @music.play(:repeats => -1)\n\thook_run()\n\thook_quit()\n\t# Handling input\n\tloop do\n\t @queue.each do |event|\n\t\thandle(event)\n end\n\t# Draw the image to screen\n\t@intro_screen.blit(@screen,[0,0])\n\[email protected]()\n end\n end",
"def start_music\n pid = fork { Play::Client.loop }\n Process.detach(pid)\nend",
"def update\n\n # Can't do anything if the music isn't turned on, with a track queued\n return unless @active_track && @track_queued && @music && @audio\n\n # Also, if music is already playing we don't have to do anything.\n # This shouldn't be possible, but worth guarding against anyway\n return if @music_playing\n\n # So, start the music playing\n $gtk.args.outputs.sounds << @active_track\n\n # And set the flags right\n @track_queued = false\n @music_playing = true\n\n end",
"def background(soundName) #unverified\r\n\t\texec(\"background\", soundName)\r\n\tend",
"def bgs_play(bgs, pos = 0)\n @playing_bgs = bgs\n if bgs != nil and bgs.name != \"\"\n Audio.bgs_play(\"Audio/BGS/\" + bgs.name, bgs.volume, bgs.pitch, pos)\n############################################################################\n else\n Audio.bgs_stop\n end\n Graphics.frame_reset\n end",
"def im_done(playlist)\n #Stop the playlist\n Process.kill @music_pid\n #Grab and play the next playist, if there is one\n @current_playlist = @queue.shift and play @current_playlist \n end",
"def play(playlist)\n playlist.run\n @music_pid = fork do\n exec \"mplayer\", \"-cache\", \"1024\", \"-really-quiet\", \"-noconsolecontrols\", \n \"-ao\", \"alsa:device=hw=#{@number}.0\", playlist.url \n end\n end",
"def play\n idx = rand(audio_file_count)\n audio_file = audio_file_from_list(idx)\n run_player_loop_for(audio_file)\n end",
"def play_sound(index)\n Audio.me_play(ME_TO_PLAY) if index == 0\n end",
"def on\n loop do\n while @count < @playlist.size\n self.play_music\n self.wait\n end\n if (@repeat) # If @repeat is true, resets playlist and loops through again\n @count = 0\n else\n break\n end\n end\n @count = 0\n end",
"def play_songs\n MusicImporter.new(path).play_song\n end",
"def run_player_for(audio_file)\n @mp = JavaMusicPlayer.new(audio_file)\n @mp.play\n end",
"def play_battle_end_me\n return if @played_bgm > 1\n @played_bgm += CP::VICTORY::USE_ME ? 1 : 2\n Audio.bgm_stop\n if CP::VICTORY::USE_MUSIC\n mus = CP::VICTORY::VICTORY_MUSIC\n vol = (CP::VICTORY::USE_ME && @played_bgm == 1) ? 0 : CP::VICTORY::MSX_VOL\n pit = CP::VICTORY::MSX_PIT\n RPG::BGM.new(mus, vol, pit).play unless mus.nil?\n else\n $game_system.battle_end_me.play\n replay_bgm_and_bgs unless $BTEST\n end\n end",
"def play\n \n end",
"def load_song\n location = File.expand_path(\"..\", Dir.pwd) + \"/res/five.mid\"\n\t#location = location.gsub('/', '\\\\')\n\t#puts location\n\t@btn_play.enable\n\t@btn_pause.enable\n\t@btn_stop.enable\n\t\n @mc.load(location)\n\t\n\t#play_song\n end",
"def play\n synchronize do\n @starved = false\n @source.play\n end\n end",
"def play\n end",
"def p\n $is_last_recording_playing = !$is_last_recording_playing\n if $is_last_recording_playing\n Thread.new do\n path = File.most_recently_edited(\"./recording/*.mp3\")\n Thread.new do\n unless path.blank?\n while $is_last_recording_playing\n Sounds::Base.play_file_with_mpg123 path \n end\n end\n end\n puts \"playing #{path}\"\n end\n else\n puts \"stopped playback\"\n end\n end",
"def background_music(song1, song2)\n puts \"The song, #{song1}, makes me want to work continuously.\"\n puts \"The song, #{song2}, makes me sleepy.\"\n puts \"I wsih every song made me feel like I could conqueor the world!\"\nend",
"def play_track(path)\r\n @song = Gosu::Song.new(path)\r\n @song.play(false)\r\n end",
"def audio\n \t@playlist = Playlist.last\n send_glued_audio('list', :playlist => @playlist)\n end",
"def play; end",
"def play!\n if @file\n fork do\n begin\n system \"play #{@file}\" # exec\n rescue\n \t puts \"error playing sound\"\n end\n end\n end\n end",
"def play \n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play_music\n pid = fork{ exec 'afplay', \"app/models/coffee_music.mp3\" }\nend",
"def play_sound \n system\"play #{@sound_file}\"\n end",
"def play\n must_be_ready!\n stop if running?\n \n info \"PLAY: #{opts[:path]}\"\n worker.startup!\n end",
"def music=(flag)\n\n # Save the flag\n @music = flag\n\n # If we've turned music on, resume any music that's paused\n if @music\n resume\n # Otherwise, pause which will stop anything that's currently playing\n else\n pause\n end\n\n end",
"def play\n\tend",
"def play\n self\n end",
"def play_music(sound_path, loops = 0)\n if File.exist?(sound_path)\n song = SDL2::Mixer::Music.load(sound_path)\n music = SDL2::Mixer::MusicChannel.play(song, loops)\n @sounds << music\n else\n log(\"Music file not found at '#{sound_path}'\")\n end\n end",
"def play(&blk)\n start_playing\n blk.call\n ensure\n stop_playing\n end",
"def bubble_sound\n pid = fork{exec 'afplay', \"lib/Large_bubble_sound.mp3\"}\n end",
"def load_bgm(filename)\n @bgm = Audio::Sound.new(File.join(MAIN_DIR, \"/Resources/bgm/#{filename}\"))\n end",
"def play\n @@plays += 1\n end",
"def play()\n @ole.Play()\n end",
"def play()\n @ole.Play()\n end",
"def play_all\n\t\[email protected] do | song |\n\t\t\tputs \"#{@name} are playing: #{song}\"\n\t\t\tputs \" \"\n\t\t\tmembers_play\n\t\t\tputs \" \"\n\t\t\tsleep(1)\n\t\tend\n\tend",
"def play_sound\n system 'afplay ./app/sounds/test_sound.mp3 &'\n end",
"def start_playbar\n if @pause_play == \"pause\"\n @count_up = (Gosu.milliseconds - @tick)\n seconds = @count_up / 1000\n @progress = seconds * WIDTH / @song_length # Fits relative progress to window width\n\n # Statements handle song repeating and or next\n # track functionality\n if seconds >= @song_length.to_i && @repeat_song\n play_song(@currently_playing)\n elsif seconds >= @song_length.to_i\n play_song(@currently_playing + 1)\n end\n else\n @tick = Gosu.milliseconds - @count_up # pauses counter at current time\n end\nend",
"def process_x\n if current_item_enabled?\n Sound.play_ok\n super\n else\n Sound.play_buzzer\n end\n end",
"def autoplay\n @map.bgm.play if @map.autoplay_bgm\n @map.bgs.play if @map.autoplay_bgs\n end",
"def process_ok\n Sound.play_ok\n super\n end",
"def commandnewgame_audio\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Stop BGM\r\n Audio.bgm_stop\r\n end",
"def play\n each do |playable|\n if playable.respond_to?(:play)\n playable.play\n end\n end\n end",
"def start_loop\n unless @playing || @queue.first.nil?\n @playing = true\n loop do\n LOGGER.debug \"Started music loop for server #{@id}\"\n if @queue.empty?\n respond('I have no songs, give me a fat beat with `add`!')\n break\n end\n song = @queue.first\n play_song(song) if song.ready || wait_for_song(song)\n end\n @playing = false\n end\n end",
"def pbBGMPlay(param,volume=nil,pitch=nil)\n return if !param\n param=pbResolveAudioFile(param,volume,pitch)\n if param.name && param.name!=\"\"\n if $game_system && $game_system.respond_to?(\"bgm_play\")\n $game_system.bgm_play(param)\n return\n elsif (RPG.const_defined?(:BGM) rescue false)\n b=RPG::BGM.new(param.name,param.volume,param.pitch)\n if b && b.respond_to?(\"play\")\n b.play; return\n end\n end\n Audio.bgm_play(canonicalize(\"Audio/BGM/\"+param.name),param.volume,param.pitch)\n end\nend",
"def update\n en_ee_ge_u\n if @sound.nil? && @page && [email protected]?\n @sound = RPG::BGS.new(@page.sound[0], volume(*@page.sound[1..2]), 100)\n @sound.play\n end\n if @sound\n @sound.volume = volume(@page.sound[1], @page.sound[2]) and @sound.play\n end\n end",
"def pbCueBGM(bgm,seconds,volume=nil,pitch=nil)\n return if !bgm\n bgm=pbResolveAudioFile(bgm,volume,pitch)\n playingBGM=$game_system.playing_bgm\n if !playingBGM || playingBGM.name!=bgm.name || playingBGM.pitch!=bgm.pitch\n pbBGMFade(seconds)\n if !$PokemonTemp.cueFrames\n $PokemonTemp.cueFrames=(seconds*Graphics.frame_rate)*3/5\n end\n $PokemonTemp.cueBGM=bgm\n elsif playingBGM\n pbBGMPlay(bgm)\n end\nend",
"def play\r\n return if self.finished?\r\n self.update\r\n end",
"def play(*args)\n sleep(duration)\n end",
"def pbFadeOutInWithMusic(zViewport)\n playingBGS=$game_system.getPlayingBGS\n playingBGM=$game_system.getPlayingBGM\n $game_system.bgm_pause(1.0)\n $game_system.bgs_pause(1.0)\n pos=$game_system.bgm_position\n pbFadeOutIn(zViewport) {\n yield\n $game_system.bgm_position=pos\n $game_system.bgm_resume(playingBGM)\n $game_system.bgs_resume(playingBGS)\n }\nend",
"def play\n puts 'Playing'\n end",
"def pbCueBGM(bgm,seconds,volume=nil,pitch=nil)\n return if !bgm\n bgm = pbResolveAudioFile(bgm,volume,pitch)\n playingBGM = $game_system.playing_bgm\n if !playingBGM || playingBGM.name!=bgm.name || playingBGM.pitch!=bgm.pitch\n pbBGMFade(seconds)\n if !$PokemonTemp.cueFrames\n $PokemonTemp.cueFrames = (seconds*Graphics.frame_rate)*3/5\n end\n $PokemonTemp.cueBGM=bgm\n elsif playingBGM\n pbBGMPlay(bgm)\n end\nend",
"def play\n\t\t\"playing #{title}\"\n\tend",
"def sound; end",
"def startPlayback\n end",
"def play\n\t\tgame_loop\n\tend",
"def set_music\n @music = Music.random_select\n end",
"def play(song)\n # artist = Artist.find_by(id: song.artist_id)\n puts \"Playing #{song}\"\n end",
"def pause\n `#{@sound}.pause()`\n end",
"def bgm_memorize\n @memorized_bgm = @playing_bgm\n end",
"def pbBGSPlay(param,volume=nil,pitch=nil)\n return if !param\n param=pbResolveAudioFile(param,volume,pitch)\n if param.name && param.name!=\"\"\n if $game_system && $game_system.respond_to?(\"bgs_play\")\n $game_system.bgs_play(param)\n return\n elsif (RPG.const_defined?(:BGS) rescue false)\n b=RPG::BGS.new(param.name,param.volume,param.pitch)\n if b && b.respond_to?(\"play\")\n b.play; return\n end\n end\n Audio.bgs_play(canonicalize(\"Audio/BGS/\"+param.name),param.volume,param.pitch)\n end\nend",
"def play()\n @files.shuffle.each do |file|\n play_file(file)\n end\n end",
"def beep\n play_song([Note::G, Note::WHOLE])\n end",
"def audio; end",
"def fadeMusic _obj, _args\n \"_obj fadeMusic _args;\" \n end",
"def play(media = nil)\n connection.write(media.nil? ? \"play\" : \"add #{media(media)}\")\n end",
"def play_melody(m)\n in_thread do\n set_volume! 5\n if defined? mybpm\n use_bpm mybpm()\n end\n if defined? mysynth\n use_synth mysynth()\n end\n \n (0..m[0].length-1).each do |i|\n if m.length > 2\n set_volume! m[2][i]\n end\n if m[0][i] != 0\n play m[0][i]\n end\n sleep m[1][i]\n end\n end\nend",
"def play(amplitude)\n play_tone(self, amplitude)\n end",
"def playSound _args\n \"playSound _args;\" \n end",
"def play(message)\n `which mpg123`\n if $?.to_i != 0\n print_err \"mpg123 executable not found in $PATH.\"\n exit 1\n end\n\n filename = self.mp3_path + SecureRandom.hex + \".mp3\"\n self.to_file(message, filename)\n\n # Fork off the mpg process and delete MP3 on successful exit\n # TODO: Pipe message over to external process so forked processes are synchronous\n # without blocking Weechat processes.\n pid = fork do\n `mpg123 -q #{filename} && rm #{filename}`\n end\n end",
"def play_album albums\n\tid = read_integer('Album ID: ')\n\tvalid, index = validate_id(id ,albums)\n\tif valid\n\t\talbum = albums[index]\n\t\tprint_track_list(album)\n\t\tplay_track(album)\n\telse\n\t\tsystem \"clear\" or system \"cls\"\n\tend\nend",
"def index_music\n pid = fork { Play::Library.import_songs }\n Process.detach(pid)\nend",
"def play(song)\n puts \"#{timestamp}: Playing #{song}\"\n sleep(120 + 60*rand)\nend",
"def play_sound(soundName)\r\n\t\texec(\"playback\", soundName)\r\n\tend",
"def play(filename, options = {})\n # Needs a key, and a filename. Use the filename as the key\n key = filename\n $window.Crafty.audio.add(key, filename)\n loop = options[:loop] || false\n loop = (loop == true) ? -1 : 1\n $window.Crafty.audio.play(key, loop)\n end",
"def play(song)\n puts \"#{timestamp}: Playing #{song}\"\n sleep (120 + 60 * rand)\nend",
"def play\n unless @av_player.nil?\n @av_player.currentTime = 0.0\n @av_player.play\n end\n end",
"def play_sound(type)\r\n @log.debug(\"Play sound #{type}, os: #{$g_os_type}\")\r\n sound = get_sound_source(type)\r\n \r\n #p @sound_enabled\r\n @linux_sound_stoppped[type] = false\r\n if sound and @sound_enabled == true\r\n Thread.new{\r\n if $g_os_type == :win32_system\r\n Sound.play(sound, @duration_win[type] )\r\n end\r\n if $g_os_type == :linux\r\n while !@linux_sound_stoppped[type]\r\n system(\"aplay -q \" + sound)\r\n break if @duration_linux[type] != :loop\r\n end\r\n end \r\n }\r\n end\r\n end"
] | [
"0.78281635",
"0.7397036",
"0.7397036",
"0.73778623",
"0.727749",
"0.6968716",
"0.6810284",
"0.6802015",
"0.67626494",
"0.6719018",
"0.6715851",
"0.6691686",
"0.66604024",
"0.66188926",
"0.6609012",
"0.65743744",
"0.65608823",
"0.65470344",
"0.6535608",
"0.65214914",
"0.6510684",
"0.6503291",
"0.65031856",
"0.64612234",
"0.64597064",
"0.645634",
"0.6440445",
"0.64295",
"0.6428711",
"0.63993627",
"0.6382951",
"0.6372827",
"0.63563055",
"0.63349974",
"0.633328",
"0.63311416",
"0.62945545",
"0.62936336",
"0.627458",
"0.6273629",
"0.6261016",
"0.6261016",
"0.6261016",
"0.6261016",
"0.6250024",
"0.62173635",
"0.62085766",
"0.6206602",
"0.6202342",
"0.61802316",
"0.6179026",
"0.6173216",
"0.6159918",
"0.615773",
"0.6156865",
"0.6123203",
"0.6123203",
"0.61214757",
"0.61213225",
"0.6109652",
"0.61092633",
"0.60910094",
"0.6090897",
"0.60887337",
"0.6073585",
"0.6048911",
"0.60346687",
"0.60152316",
"0.6013949",
"0.599994",
"0.59936655",
"0.59844923",
"0.596828",
"0.59681004",
"0.59533525",
"0.59331715",
"0.5924699",
"0.5922083",
"0.58903164",
"0.5887472",
"0.58775645",
"0.5858689",
"0.5852776",
"0.5852616",
"0.58417577",
"0.58231795",
"0.5810987",
"0.5776455",
"0.5769702",
"0.57412076",
"0.5737255",
"0.57197475",
"0.5711118",
"0.57034624",
"0.5697041",
"0.56963885",
"0.5671458",
"0.5668409",
"0.5666717",
"0.5663225"
] | 0.5884255 | 80 |
Returns an RPG::AudioFile object for the currently playing background music | def getPlayingBGM
return (@playing_bgm) ? @playing_bgm.clone : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_audio\n return @audio\n end",
"def play_music\n $game_system.bgm_memorize2\n Audio.bgm_stop\n Audio.bgm_play(Evolve::EVOLVE_MUSIC)\n end",
"def audio\n @audio ||= (\n id = @params[:audio_track]\n ::Audio.find(id) if id\n )\n end",
"def audio\n first_stream_of :audio\n end",
"def load_audio audio_settings\n return Audio.new audio_settings\n end",
"def audio\n @audio ||= URI.parse(\"#{AUDIO_SERVICE_URL}/#{@language.slug}/#{URI::encode(@text)}.mp3\")\n end",
"def background(audio, digits='')\n result = nil\n if audio.class == Array then\n audio.each do |file|\n begin\n result = stream_file(file, digits)\n rescue AGITimeoutError, AGICommandError, AGIHangupError, AGIChannelError\n raise\n end\n return result unless result.success?\n return result if result.data\n end\n return result\n elsif audio.class == String then\n begin\n result = stream_file(audio, digits)\n rescue AGITimeoutError, AGICommandError, AGIHangupError, AGIChannelError\n raise\n end\n end\n end",
"def play_title_music\n $data_system.title_bgm.play\n RPG::BGS.stop\n RPG::ME.stop\n end",
"def play_title_music\n $data_system.title_bgm.play\n RPG::BGS.stop\n RPG::ME.stop\n end",
"def audio_stream\n @audio_stream ||= streams.find do |stream|\n stream.codec_context.codec_type == :AUDIO\n end\n end",
"def main_audio\r\n super\r\n # Play title BGM\r\n $game_system.bgm_play($data_system.title_bgm)\r\n # Stop playing ME and BGS\r\n Audio.me_stop\r\n Audio.bgs_stop\r\n end",
"def audio\n \t@playlist = Playlist.last\n send_glued_audio('list', :playlist => @playlist)\n end",
"def play_title_music\r\n\r\n$data_system.title_bgm.play\r\n\r\nRPG::BGS.stop\r\n\r\nRPG::ME.stop\r\n\r\nend",
"def bubble_sound\n pid = fork{exec 'afplay', \"lib/Large_bubble_sound.mp3\"}\n end",
"def sound(id, global = false, ext = '.wav')\n a = global ? @global_sounds : @sounds\n return a[id] if a[id]\n s = @prefix + @sound_dir + id.to_s.split(@separator).join('/') + ext\n sound = Gosu::Sample.new s\n a[id] = sound\n end",
"def full_path\n if path[0] == '/'\n path\n else\n File.join(Play.music_path,path)\n end\n end",
"def play_sound(sound_file)\n begin\n file_or_stream = java.io.File.new(sound_file)\n audio_stream = AudioSystem.get_audio_input_stream(file_or_stream)\n clip = AudioSystem.clip\n clip.open(audio_stream)\n clip.start\n rescue => e\n puts e.full_message\n end\n end",
"def load_bgm(filename)\n @bgm = Audio::Sound.new(File.join(MAIN_DIR, \"/Resources/bgm/#{filename}\"))\n end",
"def play_music\n pid = fork{ exec 'afplay', \"app/models/coffee_music.mp3\" }\nend",
"def play_songs\n MusicImporter.new(path).play_song\n end",
"def to_local_sound\n local_sound = LocalSound.new( attributes.reject{ |k,v| %w(id type).include?( k ) } )\n local_sound.subtype = self.class.name\n local_sound.file = StringIO.new( download.body )\n if filename = download.headers[\"content-disposition\"][/\\\"(.+)\\\"/, 1]\n local_sound.file_file_name = filename\n end\n local_sound\n end",
"def decide_song\n if Song.count.eql? 0\n random_song = @files.sample\n song = Song.create(title: random_song, file: \"/music/#{random_song}.mp3\")\n SongBroadcastJob.perform_later(song)\n end\n Song.first\n end",
"def search_sound(file)\n Dir.glob(File.join(@default_dir_images, file) + '.{mp3,wma,wav}').first\n end",
"def play_song(id)\n @pause_play = \"pause\" # Resets pause button\n @song_settings.stop rescue nil # Makes sure no other song is playing\n begin\n path = @data_array[@selected_album].songs[id.to_i].location\n wave = WaveInfo.new(path) # Uses wave info gem to grab info from wav\n @song_length = wave.duration # Broadcasts song duration\n @tick = Gosu.milliseconds # Resets ticker so that @count_up starts at 0\n @currently_playing = id # Broadcasts currently playing song\n @playing_album_name = @data_array[@selected_album].title.upcase\n @playing_song_name = @data_array[@selected_album].songs[id].name.upcase\n @playing_thumbnail = @data_array[@selected_album].cover\n song = Gosu::Sample.new(path) # Sample plays wav file from path\n @song_settings = song.play(100,1,false)\n @show_playbar = true\n rescue\n @show_player = false\n stop_song()\n puts \"SONG WAS NOT FOUND\".red\n end\nend",
"def p\n $is_last_recording_playing = !$is_last_recording_playing\n if $is_last_recording_playing\n Thread.new do\n path = File.most_recently_edited(\"./recording/*.mp3\")\n Thread.new do\n unless path.blank?\n while $is_last_recording_playing\n Sounds::Base.play_file_with_mpg123 path \n end\n end\n end\n puts \"playing #{path}\"\n end\n else\n puts \"stopped playback\"\n end\n end",
"def audio; end",
"def play_sound\n system 'afplay ./app/sounds/test_sound.mp3 &'\n end",
"def main_audio\r\n super\r\n # Stop BGM and BGS\r\n $game_system.bgm_play(nil)\r\n $game_system.bgs_play(nil)\r\n # Play game over ME\r\n $game_system.me_play($data_system.gameover_me)\r\n end",
"def local_song_file\n @song_file ||= SongFile.new(local_data.to_file(:original).path)\n end",
"def audios\n unless @audios\n @audios = {:es => [], :eu => [], :en => [], :all => []}\n\n return @audios if self.multimedia_path.blank?\n\n # Lista de todos los audios en <dir>/*.mp3\n list_of_audios = Dir.glob(full_multimedia_path + \"*.mp3\")\n list_of_audios = list_of_audios.collect {|a| Pathname.new(a).relative_path_from(Pathname.new(class_multimedia_path)).to_s}\n\n Document::LANGUAGES.each do |l|\n # Meto en cada idioma solo los que acaban en \"_<idioma>.mp3\"\n @audios[l.to_sym] = list_of_audios.select {|a| a.match(\"_#{l}.mp3\")}\n list_of_audios = list_of_audios - @audios[l.to_sym]\n end\n\n Document::LANGUAGES.each do |l|\n @audios[l.to_sym] = @audios[l.to_sym] + list_of_audios\n end\n @audios[:all] = @audios.values.flatten.uniq\n end\n return @audios\n end",
"def run_player_for(audio_file)\n @mp = JavaMusicPlayer.new(audio_file)\n @mp.play\n end",
"def music_volume\n return @music_volume\n end",
"def create_sound_sound(filename, flags = nil)\n Yuki::ElapsedTime.start(:audio_load_sound)\n if (file_data = @sound_cache[filename])\n @sound_count[filename] += 1\n else\n file_data = File.binread(filename)\n Yuki::ElapsedTime.show(:audio_load_sound, 'Loading sound from disk took')\n end\n gm_filename = filename.include?('.mid') && File.exist?('gm.dls') ? 'gm.dls' : nil\n sound_info = FMOD::SoundExInfo.new(file_data.bytesize, nil, nil, nil, nil, nil, gm_filename)\n sound = FMOD::System.createSound(file_data, create_sound_get_flags(flags), sound_info)\n sound.instance_variable_set(:@extinfo, sound_info)\n Yuki::ElapsedTime.show(:audio_load_sound, 'Creating sound object took')\n return sound\n rescue Errno::ENOENT\n log_error(\"Failed to load sound : #{filename}\")\n return nil\n end",
"def to_local_sound!\n local_sound = becomes( LocalSound )\n local_sound.subtype = self.class.name\n local_sound.file = StringIO.new( download.body )\n if filename = download.headers[\"content-disposition\"][/\\\"(.+)\\\"/, 1]\n local_sound.file_file_name = filename\n end\n local_sound.save!\n Sound.where( id: id ).update_all( type: \"LocalSound\" )\n Sound.where( id: id ).first\n end",
"def read_track music_file\n\tname = music_file.gets()\n\tlocation = music_file.gets()\n\ttrack = Track.new(name, location)\n\treturn track\nend",
"def song\n fetch('cowboy_bebop.song')\n end",
"def format\n @format ||= \n AudioFormat.new(encoding, rate, size, channels, 1, rate, false)\n end",
"def read_track music_file\n\t# fill in the missing code\nend",
"def background(soundName) #unverified\r\n\t\texec(\"background\", soundName)\r\n\tend",
"def play_music(sound_path, loops = 0)\n if File.exist?(sound_path)\n song = SDL2::Mixer::Music.load(sound_path)\n music = SDL2::Mixer::MusicChannel.play(song, loops)\n @sounds << music\n else\n log(\"Music file not found at '#{sound_path}'\")\n end\n end",
"def play_sound \n system\"play #{@sound_file}\"\n end",
"def audio\n @streams.select { |stream| stream.is_a? AudioStream }\n end",
"def extract_audio_details\n path = audio.queued_for_write[:original].path\n open_opts = { :encoding => 'utf-8' }\n Mp3Info.open(path, open_opts) do |mp3|\n\t self.title = mp3.tag.title \n\t self.album = mp3.tag.album\n\t self.artist = mp3.tag.artist\n\t self.track = mp3.tag.tracknum\n end\nend",
"def path_to_audio(source, options = T.unsafe(nil)); end",
"def play!\n if @file\n fork do\n begin\n system \"play #{@file}\" # exec\n rescue\n \t puts \"error playing sound\"\n end\n end\n end\n end",
"def wav\n @wav ||= @info_file.sub(/txt$/, 'wav')\n end",
"def current\n now_playing = Play::Player.now_playing\n now_playing = now_playing.to_hash if now_playing\n\n songs = Play::Queue.songs\n\n Yajl.dump({\n :now_playing => now_playing,\n :songs => songs.map {|song| song.to_hash }\n })\n end",
"def sound; end",
"def getMP3\n return @MP3Files || []\n end",
"def play_file(file)\n system(\"ogg123 #{file}\")\n end",
"def play_select_active_sound\n if FileTest.exist?('Audio/SE/SelectActive.mp3') or \n FileTest.exist?('Audio/SE/SelectActive.wav') or FileTest.exist?('Audio/SE/SelectActive.ogg')\n Audio.se_play('Audio/SE/SelectActive', 100, 100)\n end\n end",
"def to_wav\n @audio\n end",
"def random_song\n @mode = :dj\n \n wd = Dir.pwd\n Dir.chdir music_folder\n songs = Dir.glob(\"**/*.{mp3,ogg}\")\n path = songs[rand(songs.size)]\n Dir.chdir wd\n \n if path.blank?\n nil\n else\n [0, path, quick_title(path)]\n end\n end",
"def sound\n LanguageSound.where(language_id: id)\n end",
"def pbResolveAudioSE(file)\n return nil if !file\n if RTP.exists?(\"Audio/SE/\"+file,[\"\",\".wav\",\".mp3\",\".ogg\"])\n return RTP.getPath(\"Audio/SE/\"+file,[\"\",\".wav\",\".mp3\",\".ogg\"])\n end\n return nil\nend",
"def pbResolveAudioSE(file)\n return nil if !file\n if RTP.exists?(\"Audio/SE/\"+file,[\"\",\".wav\",\".mp3\",\".ogg\"])\n return RTP.getPath(\"Audio/SE/\"+file,[\"\",\".wav\",\".mp3\",\".ogg\"])\n end\n return nil\nend",
"def pbResolveAudioSE(file)\n return nil if !file\n if RTP.exists?(\"Audio/SE/\"+file,[\"\",\".wav\",\".mp3\",\".ogg\"])\n return RTP.getPath(\"Audio/SE/\"+file,[\"\",\".wav\",\".mp3\",\".ogg\"])\n end\n return nil\nend",
"def song(id, global = false, ext = '.ogg')\n a = global ? @global_songs : @songs\n return a[id] if a[id]\n s = @prefix + @song_dir + id.to_s.split(@separator).join('/') + ext\n song = Gosu::Song.new s\n a[id] = song\n end",
"def make\n App.out.make_audio_file\nend",
"def pbGetWildBattleBGM(_wildParty) # wildParty is an array of Pokémon objects\r\n if $PokemonGlobal.nextBattleBGM\r\n return $PokemonGlobal.nextBattleBGM.clone\r\n end\r\n ret = nil\r\n if !ret\r\n # Check map metadata\r\n map_metadata = GameData::MapMetadata.try_get($game_map.map_id)\r\n music = (map_metadata) ? map_metadata.wild_battle_BGM : nil\r\n ret = pbStringToAudioFile(music) if music && music != \"\"\r\n end\r\n if !ret\r\n # Check global metadata\r\n music = GameData::Metadata.get.wild_battle_BGM\r\n ret = pbStringToAudioFile(music) if music && music!=\"\"\r\n end\r\n ret = pbStringToAudioFile(\"Battle wild\") if !ret\r\n return ret\r\nend",
"def run_player_loop_for(audio_file)\n @mp = JavaMusicPlayer.new(audio_file)\n @mp.play_loop\n end",
"def get_audio_input_stream(file) # works on filename, file, inputstream, or url\n file = java.io.File.new(file) if file.is_a?(String)\n #puts \" #{file}: audio file format:\\t #{Snd.AudioSystem.getAudioFileFormat(file)}\"\n stream = Snd.AudioSystem.getAudioInputStream(file)\n puts \" #{file}: format:\\t #{stream.format}\"\n if stream.format.encoding.to_s.match(/PCM/)\n return stream\n else\n target_format = Snd.AudioFormat.new(Snd.AudioFormat::Encoding::PCM_SIGNED,\n stream.format.sample_rate, 16,\n stream.format.channels, stream.format.channels * 2,\n stream.format.sample_rate, false)\n #puts \" conversion: target format:\\t #{target_format}\"\n decoded_stream = Snd.AudioSystem.getAudioInputStream(target_format, stream)\n fail \"pas un PropertiesContainer javazoom\" unless decoded_stream.is_a? Java.javazoom.spi.PropertiesContainer\n return decoded_stream\n # TODO: stream.close et decoded_stream.close\n # (mais ne pas fermer stream avant de lire decoded_stream sinon ogg marche plus)\n end\n end",
"def pbGetWildBattleBGM(wildParty) # wildParty is an array of Pokémon objects\n if $PokemonGlobal.nextBattleBGM\n return $PokemonGlobal.nextBattleBGM.clone\n end\n ret = nil\n if !ret\n # Check map-specific metadata\n music = pbGetMetadata($game_map.map_id,MetadataMapWildBattleBGM)\n ret = pbStringToAudioFile(music) if music && music!=\"\"\n end\n if !ret\n # Check global metadata\n music = pbGetMetadata(0,MetadataWildBattleBGM)\n ret = pbStringToAudioFile(music) if music && music!=\"\"\n end\n ret = pbStringToAudioFile(\"Battle wild\") if !ret\n return ret\nend",
"def get_audio_file(tv, link_index)\n while true\n iter = tv.model.get_iter(@track_ref.to_s)\n if iter.nil?\n reset_player_data_state\n return nil\n end\n\n tv.set_cursor(iter.path, nil, false)\n if iter[link_index].get_audio_file(TasksWindow::Task.new(:download, :track, iter[link_index], self), @mc.tasks) == Audio::Status::NOT_FOUND\n @track_ref += 1\n else\n break\n end\n end\n\n while iter[link_index].audio_status == Audio::Status::ON_SERVER\n Gtk.main_iteration while Gtk.events_pending?\n sleep(0.1)\n end\n\n return TrackRefs.new(self, @track_ref, iter[link_index])\n end",
"def audio_files\n @audio_files ||= path.join(\"data\").each_child.select { |file| [\".wav\", \".mp3\"].include? file.extname }.map { |file| IngestableAudioFile.new(path: file) }\n end",
"def read_track(music_file)\n\ttrack_name= music_file.gets\n\ttrack_location= music_file.gets\n\ttrack = Track.new(track_name, track_location)\n\treturn track\n end",
"def audio(filename, opts = {})\n n = input(filename, opts)\n @audios << n\n n\n end",
"def getAudioUri\n return @data.scan(/https:\\/\\/.*?\\.mp3/)[0]\nend",
"def audio_info(source)\n # based on how harvester gets file hash.\n generated_file_hash = \"SHA256::#{generate_hash(source).hexdigest}\"\n\n # integrity\n integrity_check = @audio.integrity_check(source)\n\n # get file info using ffmpeg\n info = @audio.info(source)\n\n {\n file: source,\n extension: File.extname(source).delete('.'),\n errors: integrity_check[:errors],\n file_hash: generated_file_hash,\n media_type: info[:media_type],\n sample_rate_hertz: info[:sample_rate].to_i,\n duration_seconds: info[:duration_seconds].to_f.round(3),\n bit_rate_bps: info[:bit_rate_bps],\n data_length_bytes: info[:data_length_bytes],\n channels: info[:channels]\n }\n end",
"def audio_path(source, options = T.unsafe(nil)); end",
"def pbGetWildBattleBGM(species)\n if $PokemonGlobal.nextBattleBGM\n return $PokemonGlobal.nextBattleBGM.clone\n end\n ret = nil\n if !ret && $game_map\n # Check map-specific metadata\n music = pbGetMetadata($game_map.map_id,MetadataMapWildBattleBGM)\n if music && music!=\"\"\n ret = pbStringToAudioFile(music)\n end\n end\n if !ret\n # Check global metadata\n music = pbGetMetadata(0,MetadataWildBattleBGM)\n if music && music!=\"\"\n ret = pbStringToAudioFile(music)\n end\n end\n ret = pbStringToAudioFile(\"Battle wild\") if !ret\n return ret\nend",
"def call\n PollyService.update if @@polly.nil?\n mp3_file = Rails.root.join(\"#{@@audio_dir}/polly-#{@voice_id}-#{@entry.id}-#{@entry.updated_at}.mp3\")\n # don't request a new file from polly if the same file already exists\n return mp3_file if File.exist?(mp3_file)\n\n params = {\n response_target: mp3_file,\n output_format: 'mp3',\n text: @text,\n text_type: @type,\n voice_id: @voice_id\n }\n Rails.logger.debug \"Polly: #{params}\"\n begin\n @@polly&.synthesize_speech(params)\n rescue\n FileUtils.rm_f(mp3_file)\n return Rails.root.join(\"#{@@audio_dir}/buzzer.wav\")\n end\n mp3_file\n end",
"def play\n @playing = true\n Audio.play_wav(@audio)\n @playing = false\n end",
"def play\n idx = rand(audio_file_count)\n audio_file = audio_file_from_list(idx)\n run_player_loop_for(audio_file)\n end",
"def read_track music_file\n\tname = music_file.gets\n\tlocation = music_file.gets\n\ttrack = Track.new(name, location)\n\ttrack\nend",
"def audio_path\n #TODO change path after Yura send information\n \"/audio/success.wav\"\n end",
"def get_audio_content\n begin\n audio_sql = \"SELECT * FROM mediacontent WHERE HighQFilePath IS NOT NULL\";\n audio_sql += \" AND (ContentTypeID = 2) AND (HighQFilePath LIKE '%mp3')\";\n audio_sql += \" AND HighQFilePath != ''\"\n audio_content_data = Immutable.dbh.execute(audio_sql);\n return audio_content_data;\n rescue DBI::DatabaseError => e\n Immutable.log.error \"Error code: #{e.err}\"\n Immutable.log.error \"Error message: #{e.errstr}\"\n Immutable.log.error \"Error SQLSTATE: #{e.state}\"\n abort('An error occurred while getting audio content data from DB, Check migration log for more details');\n end\n end",
"def pbBGMPlay(param,volume=nil,pitch=nil)\n return if !param\n param=pbResolveAudioFile(param,volume,pitch)\n if param.name && param.name!=\"\"\n if $game_system && $game_system.respond_to?(\"bgm_play\")\n $game_system.bgm_play(param)\n return\n elsif (RPG.const_defined?(:BGM) rescue false)\n b=RPG::BGM.new(param.name,param.volume,param.pitch)\n if b && b.respond_to?(\"play\")\n b.play; return\n end\n end\n Audio.bgm_play(canonicalize(\"Audio/BGM/\"+param.name),param.volume,param.pitch)\n end\nend",
"def get_sound_source(type)\r\n sound = nil\r\n case type\r\n when :play_fitbell\r\n sound = File.join(get_resource_path, \"sound/fitebell.wav\")\r\n when :play_ba\r\n sound = File.join(get_resource_path, \"sound/ba.wav\")\r\n when :play_click4\r\n sound = File.join(get_resource_path, \"sound/click_4bit.wav\")\r\n when :play_mescola\r\n sound = File.join(get_resource_path, \"sound/dealtwocards.wav\")\r\n else\r\n @log.debug(\"Sound not recognized #{type}\")\r\n end #end case\r\n return sound\r\n end",
"def play(filename, options = {})\n # Needs a key, and a filename. Use the filename as the key\n key = filename\n $window.Crafty.audio.add(key, filename)\n loop = options[:loop] || false\n loop = (loop == true) ? -1 : 1\n $window.Crafty.audio.play(key, loop)\n end",
"def pbBGSPlay(param,volume=nil,pitch=nil)\n return if !param\n param=pbResolveAudioFile(param,volume,pitch)\n if param.name && param.name!=\"\"\n if $game_system && $game_system.respond_to?(\"bgs_play\")\n $game_system.bgs_play(param)\n return\n elsif (RPG.const_defined?(:BGS) rescue false)\n b=RPG::BGS.new(param.name,param.volume,param.pitch)\n if b && b.respond_to?(\"play\")\n b.play; return\n end\n end\n Audio.bgs_play(canonicalize(\"Audio/BGS/\"+param.name),param.volume,param.pitch)\n end\nend",
"def audio_tracks\n tracks.select { |t| t.audio? }\n end",
"def audio_tracks\n tracks.select { |t| t.audio? }\n end",
"def buz; Sound.play_buzzer; end",
"def handle_music(music)\n return false if $config['music_file']['process'] != true\n log(\"handle_music -> do something with the music file #{music.file}\")\n ap $config['music_file']['storage'] if $opt[\"debug\"]\nend",
"def set_plsbgmusic_mediafile\n @plsbgmusic_mediafile = PlsbgmusicMediafile.find(params[:id])\n end",
"def extract_audio(infile)\n\n infile = Path[infile]\n \n p infile\n \n unless infile.exists?\n STDERR.puts \"Couldn't find #{infile}\"\n return\n end\n\n #unless VALID_EXTS.include? infile.ext\n # STDERR.puts \"Unrecognized video format: #{infile.ext}\"\n # return\n #end\n \n if infile =~ %r{^/dev/fd/}\n outfile = Path.pwd/\"#{infile.filename}.mp3\" \n else \n outfile = infile.with(:ext=>\"mp3\")\n end\n\n if outfile.exists?\n puts \"Error: #{outfile} exists!\"\n return\n end \n \n puts\n puts \"Input: #{infile}\"\n puts \"Output: #{outfile}\"\n puts\n \n # -lameopts q=5\n cmd = %w[mencoder -of rawaudio -oac mp3lame -ovc copy -o] + [outfile.to_s, infile.to_s]\n system(*cmd)\n \nend",
"def create_music(varname, filename)\n @music.add_music(varname, filename)\n end",
"def queue_music(dir)\n return unless dir.directory? and contains_any?(dir, :flac, :mp3)\n \n puts dir\n artist = get_artist(artist(dir))\n destination = get_music_destination\n dest = \"#{ destination }/#{ artist }\"\n# full_dest = \"/Volumes/Samba/clamps/Music/#{ dest }\"\n# genre = GENRES[artist] || genre(full_dest) || prompt(\"Genre\", genre_names)\n# GENRES[artist] = genre\n \n tags = {}\n# tags = { :genre => genre, :artist => artist }\n remote_dest = \"#{ REMOTE_MUSIC_PATH }#{ dest }/#{ Pathname.new(dir).basename }\"\n \n QUEUE << [ dir, remote_dest, tags ]\n puts ''\nend",
"def search_audio_file(file_name)\n # Trace.debug(\"Search audio for track #{@rtrack.to_s.brown}\")\n extensions = Cfg.size_over_quality ? FILE_EXTS_BY_SIZE : FILE_EXTS_BY_QUALITY\n\n extensions.each do |ext|\n if File.exists?(file_name+ext)\n set_audio_state(Status::OK, file_name+ext)\n return audio.status\n end\n end\n\n # Remove the root dir & genre dir to get the appropriate sub dir\n file = track_dir(file_name)\n Dir[Cfg.music_dir+'*'].each do |entry|\n next unless File.directory?(entry)\n extensions.each do |ext|\n if File.exists?(entry+file+ext)\n set_audio_state(Status::MISPLACED, entry+file+ext)\n return audio.status\n end\n end\n end\n\n set_audio_state(Status::NOT_FOUND, nil)\n return audio.status\n end",
"def to_mp3\n temp = Tempfile.new(File.basename(filename, '.flv') + \".mp3\")\n \n begin\n transcoder = Transcoder.new(full_filename, temp.path)\n transcoder.flashToAudio\n save_transcoder_commands(transcoder)\n rescue RVideo::TranscoderError => e\n save_transcoder_commands(transcoder)\n raise AudioConversionException.new(\"Unable to convert recording to audio: #{e.message}\")\n end\n \n temp.path\n end",
"def sound\n raise NotImplementedError\n end",
"def start_music\n pid = fork { Play::Client.loop }\n Process.detach(pid)\nend",
"def parse_file(music_dir_path , path)\n begin\n\n begin\n # Get the relative path of the file\n relative_path = path.relative_path_from( music_dir_path ).to_s\n rescue\n puts \"File cannot be readed. Wrong file name?: #{path.to_s}\"\n return nil\n end\n\n # Do nothing if the song is already stored\n return nil if @songs[relative_path]\n\n absolute_path = path.to_s\n TagLib::MPEG::File.open( absolute_path ) do |file|\n # Create the song\n song = Song.new\n song.fill( relative_path , file , File.size(absolute_path) )\n\n # Get the artist and album\n song.artist = get_artist( file.tag.artist )\n if !song.artist\n puts \"*** #{relative_path}: Artist not found\"\n return nil\n end\n\n song.album = get_album( file.tag )\n if !song.album\n puts \"*** #{relative_path}: Album not found\"\n return nil\n end\n\n @songs[song.path] = song\n return song\n end\n rescue\n Log.log_last_exception(\"Error reading file #{path.to_s}\")\n return nil\n end\n end",
"def load_song\n location = File.expand_path(\"..\", Dir.pwd) + \"/res/five.mid\"\n\t#location = location.gsub('/', '\\\\')\n\t#puts location\n\t@btn_play.enable\n\t@btn_pause.enable\n\t@btn_stop.enable\n\t\n @mc.load(location)\n\t\n\t#play_song\n end",
"def update\n\n # Can't do anything if the music isn't turned on, with a track queued\n return unless @active_track && @track_queued && @music && @audio\n\n # Also, if music is already playing we don't have to do anything.\n # This shouldn't be possible, but worth guarding against anyway\n return if @music_playing\n\n # So, start the music playing\n $gtk.args.outputs.sounds << @active_track\n\n # And set the flags right\n @track_queued = false\n @music_playing = true\n\n end",
"def main_audio ; end",
"def play_file(file)\n\t\tsystem(\"afplay #{file}\") #switching ogg123 to afplay\n\tend",
"def pbCueBGM(bgm,seconds,volume=nil,pitch=nil)\n return if !bgm\n bgm=pbResolveAudioFile(bgm,volume,pitch)\n playingBGM=$game_system.playing_bgm\n if !playingBGM || playingBGM.name!=bgm.name || playingBGM.pitch!=bgm.pitch\n pbBGMFade(seconds)\n if !$PokemonTemp.cueFrames\n $PokemonTemp.cueFrames=(seconds*Graphics.frame_rate)*3/5\n end\n $PokemonTemp.cueBGM=bgm\n elsif playingBGM\n pbBGMPlay(bgm)\n end\nend",
"def path # getter method \n # - this method will get the path passed through the MusicImporter object\n @path\n end"
] | [
"0.6735958",
"0.6563371",
"0.64784473",
"0.6450973",
"0.6339454",
"0.6158966",
"0.6158435",
"0.6055315",
"0.6055315",
"0.60506207",
"0.5968849",
"0.5938833",
"0.59140754",
"0.5845334",
"0.5770656",
"0.5757217",
"0.57535946",
"0.57488805",
"0.572951",
"0.5716711",
"0.5699398",
"0.5694907",
"0.5687887",
"0.56684494",
"0.5662701",
"0.56553596",
"0.5651844",
"0.5645743",
"0.5626411",
"0.55973923",
"0.5589352",
"0.55787855",
"0.5578638",
"0.55716556",
"0.556323",
"0.55505407",
"0.5540672",
"0.5539867",
"0.55394226",
"0.5523206",
"0.5511567",
"0.5510795",
"0.5505221",
"0.5497184",
"0.5491249",
"0.5491148",
"0.5449293",
"0.5445712",
"0.5439582",
"0.5435716",
"0.5431907",
"0.5426441",
"0.541498",
"0.54088134",
"0.54022104",
"0.54022104",
"0.54022104",
"0.53963304",
"0.53961706",
"0.53940785",
"0.5393622",
"0.5393491",
"0.5393291",
"0.53867614",
"0.5381498",
"0.5381172",
"0.53775305",
"0.5368182",
"0.53664887",
"0.5362235",
"0.53566104",
"0.5346503",
"0.5336621",
"0.5330918",
"0.5327078",
"0.53267473",
"0.5322479",
"0.53048736",
"0.5291328",
"0.5288777",
"0.5287668",
"0.5286067",
"0.5286067",
"0.5283858",
"0.52827823",
"0.52770597",
"0.5275924",
"0.5274714",
"0.5263664",
"0.5261432",
"0.52588004",
"0.5256825",
"0.52428603",
"0.5237649",
"0.52300346",
"0.52280647",
"0.5223423",
"0.52207977",
"0.52172774",
"0.5214337"
] | 0.58619857 | 13 |
iterates over collection, passing each element to the block method returns the element, for which the block returned the largest value solution iterate through array, passing each value to the block, compare the return value to max_value if the return value is larger than max_value, then max_value is replaced by that element method returns the max_value variable | def max_by(array)
return nil if array.empty?
max_element = array.first
max_return = yield(array.first)
array[1..-1].each do |element|
block_return = yield(element)
if block_return > max_return
max_element = element
max_return = block_return
end
end
max_element
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max(&block)\n flag = true # 1st element?\n result = nil\n self.each{|*val|\n val = val.__svalue\n if flag\n # 1st element\n result = val\n flag = false\n else\n if block\n result = val if block.call(val, result) > 0\n else\n result = val if (val <=> result) > 0\n end\n end\n }\n result\n end",
"def max_by(array)\n max, element = nil\n array.each do |value|\n block_return = yield(value)\n if max.nil? || block_return > max\n max, element = block_return, value\n end\n end\n element\nend",
"def find_max_value(array)\n array.max { |item|\n return array.max\n }\n \nend",
"def max_by(array)\n largest_item = nil\n array.each do |elem|\n largest_item ||= elem\n largest_item = elem if yield(elem) > yield(largest_item)\n end\n largest_item\nend",
"def max_by(collection)\n return nil if collection.empty?\n max_index = 0\n max_val = yield(collection[0])\n collection.each_with_index do |elem, idx|\n current_val = yield(elem)\n if max_val < current_val\n max_index = idx\n max_val = current_val\n end\n end \n collection[max_index]\nend",
"def maximum(arr, &prc)\n return nil if arr.empty?\n current_ele = nil\n current_max = nil\n arr.each do |ele|\n value = prc.call(ele)\n if current_max == nil || value >= current_max\n current_max = value\n current_ele = ele\n end\n end\n current_ele\nend",
"def max list, &block\n list.max(&block)\nend",
"def find_max_value(array=[])\n some_array=0\n array.each do |value|\n some_array = value = array.max\n\n end\n\n\n some_array\n\n\nend",
"def max_by(arr)\n max = arr.first\n for el in arr\n max = el if yield(el) > yield(max)\n end\n max\nend",
"def max\n temp = @first\n maxValue = -999999\n while !temp.nil?\n if temp.value > maxValue\n maxValue = temp.value\n end\n temp = temp.next\n end\n maxValue\n end",
"def max\r\n temp = @first\r\n maxValue = -999999\r\n while !temp.nil?\r\n if temp.value > maxValue\r\n maxValue = temp.value\r\n end\r\n temp = temp.next\r\n end\r\n maxValue\r\n end",
"def max\n self.reduce('lambda{|memo, item| memo > item ? memo : item }')\n end",
"def max_by(arr)\n arr.max { |a, b| yield(a) <=> yield(b) }\nend",
"def find_max_value (array)\n array.max # Add your solution here\nend",
"def find_max(some_array)\n max = nil\n some_array.each do |val|\n \tif max.nil?\n max=val\n elsif val>max\n max=val\n end\n end\n max\nend",
"def max_value(our_array)\n\treference = -100000\n\tour_array.each do |number|\n\t\tif number > reference\n\t\t\treference = number\n\t\tend\n\tend\n\treference\nend",
"def largest_value\n values.max\n end",
"def maximum( arr, &prc )\n return nil if arr.length == 0\n\n test_case = arr.inject(0) {|x,ele| x = prc.call(ele) if prc.call(ele) > x }\n p test_case\n arr.reverse.each do |ele|\n if prc.call(ele) == test_case\n return ele\n end\n end\n\nend",
"def find_max(some_array)\n max = some_array[0]\n some_array.each do |number|\n if number > max\n max = number\n end\n end\n max\nend",
"def max_by(array)\n return nil if array.empty?\n result = []\n array.each { |num| result << yield(num) }\n array.fetch(result.index(result.max))\nend",
"def max\n temp = @first\n maxValue = -999999\n while !temp.nil?\n if temp.value > maxValue\n maxValue = temp.value\n end\n temp = temp.next\n end\n return maxValue\n end",
"def max_by(ar)\n return nil if ar.empty?\n\n store_max = ->(max, ev_max) do\n \n partial_max = ->(max, ev_max, current) do\n ev_current = yield(current)\n if ev_current > ev_max\n max = current\n ev_max = ev_current\n end\n [max, -> { partial_max.curry[max][ev_max] }]\n end\n \n [max, -> { partial_max.curry[max][ev_max] }]\n end\n\n get_max = store_max.(ar[0], yield(ar[0]))\n ar[1..-1].each do |el|\n # execute the anonymous lambda stored in the array returned by\n # store_max and partial_max, this call will return partial_max curried\n get_max = get_max[1].call\n # execute partial_max curried, passing in last argument,\n # this will force the execution of the curried lambda\n get_max = get_max[el]\n # We could have written this in one line:\n # get_max = get_max[1].()[el]\n end\n get_max.first\nend",
"def max_by(arr)\n return nil if arr.empty?\n\n highest = yield(arr[0])\n highest_idx = nil\n \n arr.each_with_index do |el, idx| \n if yield(el) >= highest\n highest = yield(el)\n highest_idx = idx\n end\n end\n arr[highest_idx]\nend",
"def find_max_value(array)\n \n (find_max_value(scale)).to eq(5)\n (find_max_value(scale_2)).to eq(6)\n (find_max_value(hill)).to eq(5)\n (find_max_value(valley)).to eq(5)\n (find_max_value(zig_zag)).to eq(1000)\n end",
"def max\r\n temp = @first\r\n maxValue = -99999\r\n while !temp.nil?\r\n if temp.value > maxValue\r\n maxValue = temp.value\r\n end\r\n temp = temp.next\r\n end\r\n return maxValue\r\n end",
"def basic_5 (array_iterate)\n array_iterate.max\nend",
"def find_max_value(array)\n x = array[0]\narray.length.times {|index|\n if array[index] > x\n x = array[index]\n end\n\n}\nx\nend",
"def find_max_value(array)\n array.max \nend",
"def max_by(arr)\n return nil if arr.empty?\n memo = arr[0]\n 0.upto( arr.size - 1 ) do |idx|\n memo = yield(arr[idx]) > yield(memo) ? arr[idx] : memo\n end\n memo\nend",
"def max \n @list.reduce(0){ |memo,v| (v>memo ? v : memo) }\n end",
"def max\r\n temp = @first\r\n maxValue = -99999\r\n\r\n while !temp.nil?\r\n if temp.value > maxValue then\r\n maxValue = temp.value \r\n end \r\n temp = temp.next\r\n end \r\n maxValue\r\nend",
"def max\r\n temp = @first\r\n max_value = @first.value\r\n while !temp.nil?\r\n if temp.value > max_value\r\n max_value = temp.value\r\n end\r\n temp = temp.next\r\n end\r\n return max_value\r\n end",
"def max\r\n\ttemp = @first\r\n\tmaxValue = nil\r\n\tif !temp.nil? then\r\n\t\tmaxValue = temp.value\r\n\t\ttemp = temp.next\r\n\tend\r\n\twhile !temp.nil?\r\n\t\tif temp.value > maxValue then\r\n\t\t\tmaxValue = temp.value\r\n\t\tend\r\n\t\ttemp = temp.next\r\n\tend\r\n\treturn maxValue\r\n end",
"def find_max_value(array)\n return array.max\nend",
"def custon_max(arr)\n return nil if arr.empty?\n\n max = arr[0]\n arr.each do |value|\n max = value if value > max\n end\n max\nend",
"def max(items)\n#(was not sure if instructions meant the method.max. this is my solution only restricting the method: max)\n max = items.sort.last\nend",
"def max(values, count, block = nil)\n if block.present?\n values.max(count)\n else\n values.max(count, &block)\n end\n end",
"def max(array)\n result = array.first\n\n array.each do |num|\n if num > result\n result = num\n end\n end\n puts result\nend",
"def find_max_value(array)\nx = 0 \n array.length.times { |index|\n if array[index] > x \n x = array[index]\n end\n }\n x\n end",
"def new_max array_of_elements\n\ti = 0\n\tlargest = array_of_elements[0]\n\twhile i < array_of_elements.length do\n\t\tif array_of_elements[i] > largest\n\t\t\tlargest = array_of_elements[i]\n\t\tend\n\t\ti += 1\n\tend\n\tlargest\nend",
"def find_max(some_array)\n\tmaximum = some_array[0]\n\n\tsome_array.each do |number|\n\t\tif number > maximum\n\t\t\tmaximum = number\n\t\tend\n\tend\n\tmaximum\nend",
"def solution2(a)\n\n total_max, current_max = a[0], 0\n\n a.each do |int|\n current_max = [current_max + int, int].max\n total_max = [total_max, current_max].max\n end\n\n return max\n\nend",
"def max_in_array_loop(arr)\n max = arr[0]\n arr.each do |x|\n if x > max\n max = x\n end\n end\n max\nend",
"def extract_max # works according to VisualAlgo\n max = @values[0]\n tail = @values.pop()\n @values[0] = tail\n index = 0\n element = @values[index]\n while true do \n swapped = nil\n left = 2 * index + 1\n right = 2 * index + 2\n if left < @values.length \n if @values[left] > element\n swapped = left\n end\n end\n if right < @values.length\n if (!swapped && @values[right] > element) || (!!swapped && @values[right] > @values[left])\n swapped = right\n end\n end\n break if !swapped\n @values[index] = @values[swapped]\n @values[swapped] = element\n index = swapped\n end\n return max\n end",
"def max\n maximum = values.max\n select { |k, v| v == maximum }\n end",
"def max_by(arr)\n arr.sort_by { |elem| yield(elem) }.last\nend",
"def find_max()\r\n self.max\r\n end",
"def maximum(arr, &prc)\n\n return nil if arr.length == 0\n max = 0\n max_idx = nil\n arr.each_with_index do |ele, idx|\n if prc.call(ele) >= max\n max = prc.call(ele)\n max_idx = idx\n end\n end\n arr[max_idx]\nend",
"def max(numbers)\n current_max = numbers[0]\n numbers.each do |number|\n if number > current_max\n current_max = number\n end\n end\n current_max\nend",
"def max(numbers)\n current_max = numbers[0]\n numbers.each do |number|\n if number > current_max\n current_max = number\n end\n end\n current_max\nend",
"def max(numbers)\n current_max = numbers[0]\n numbers.each do |number|\n if number > current_max\n current_max = number\n end\n end\n current_max\nend",
"def item_max() @item_max end",
"def test_0230_max\n @@log.debug \"test_0230_max starts\" if @@log.debug?\n assert_respond_to(@list, :max, \"test_0230_max_respond\")\n # Basic max for a field (assumes all objects implement <=>)\n # See the test for .min for a surprising resultusing this coding\n # technique.\n assert_equal(\"Newman\", @list.max.last, \"test_0230_max_basic\")\n # Basic max for an object\n lastmax = @list.max {|a,b| a.last <=> b.last }\n assert_equal(@aen, lastmax, \"test_0230_max_block\")\n @@log.debug \"test_0230_max ends\" if @@log.debug?\n end",
"def part6(in_array)\n themax = in_array[2]\n in_array.each do |item|\n if item > themax\n themax = item\n end\n end\n themax\nend",
"def find_max_value(array)\n max_element = 0\n array.length.times { |index|\n if max_element < array[index]\n max_element = array[index]\n end\n }\n return max_element\nend",
"def find_max\n loc = find_max_locator and loc.value\n end",
"def max(arr)\n greatest = array[0]\n arr.each do |num|\n if num > greatest\n greatest = num\n end\n end\n greatest\nend",
"def max_index(*x, &block)\n x.index(max(*x, &block))\n end",
"def eqp_r_max(item)\n end",
"def find_max(array)\n max = 0\n array.each do |subarray|\n subarray.each_cons(4) do |chunk|\n product = quad_product(chunk)\n max = product if product > max\n end\n end\n max\n end",
"def get_max\n @max ||= calculate_max\n end",
"def max(arr)\n return nil if arr.empty?\n result = arr[0]\n arr[1...-1].each do |item|\n if item > result\n result = item\n end\n end\n return result\nend",
"def custom_max(array)\n array.max\nend",
"def find_max_value(array)\n sorted_array = array.sort\n sorted_array.last\nend",
"def max; end",
"def max; end",
"def largest(array)\nend",
"def find_max_value(array)\n array.sort!\n return array[-1]\nend",
"def find_max_value(array)\n i = 0 \n max = 0 \n \n while i < array.length do\n if max < array[i]\n max = array[i]\n end \n i += 1 \nend \n return max\nend",
"def max\n max = @storage[0]\n @size.times do |i|\n if @storage[i] > max\n max = @storage[i]\n end\n\n end\n return max\n end",
"def maxNumber(array)\n max = 0\n array.each do\n |n|\n max = n if (n > max)\n end\n puts \"Le nombre ayant la plus grande valeur est #{max}.\"\nend",
"def get_max(arr)\n arr.inject do |memo, x|\n if memo < x\n x\n else\n memo\n end\n end\nend",
"def largest_integer(list_of_nums) #define method largest_integer with argument list_of_nums\n max = list_of_nums[0] #set the max as the first position of the array\n list_of_nums.each do |num| #iterate over each number of the array\n \tif \n \t\tmax < num # if max is less than a given number\n \t\tnum = max # the number is equal to max\n \tend # close the if statement\nend # close the method definition\n return max #return the max number\nend",
"def max\n @v.compact.max\n rescue\n nil\n end",
"def max\n\t\tm = self.valor[0]\n\t\tfor i in (0...self.valor.size.to_i)\n\t\t\t\tif (self.valor[i]> m)\n\t\t\t\t\tm = self.valor[i]\n\t\t\t\tend\n\t\tend\n\t\treturn m\n\tend",
"def max\n if valid?\n max_value\n end\n end",
"def largest_integer(list_of_nums)\n # Pseudocode\n # return nil if array is empty\n # Otherwise, initialize current maximum as the first element of the array\n # FOR each element of the array\n # IF that element is larger than the current maximum\n # Set the current maximum to that element\n # Return the current maximum\n\n #initial solution\n # return nil if list_of_nums.length == 0\n\n # maximum = list_of_nums[0]\n\n # list_of_nums.each do |el|\n # maximum = el if el > maximum\n # end\n\n # return maximum\n\n #using built-in Ruby enumerables method\n return list_of_nums.max\n\nend",
"def find_max_value(array)\n x = 0\n array.length.times { |index| x = array[index] if array[index] > x }\n x\nend",
"def my_max(array)\n\t\n\tarray.max\n\nend",
"def max\n empty? ? -Float::INFINITY : @list.head.value[2]\n end",
"def max\n @max ||= begin\n maxes = []\n options[:max].times { |t| maxes << dup_for(max: nil, change: nil, series: nil, extend_cache_life: options[:max] - t, period: period.prev(t + 1)).compute }\n maxes.max\n end if options[:max]\n end",
"def find_greatest(numbers)\n saved_number = nil\n\n numbers.each do |num|\n saved_number ||= num # assign to first value\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n\n saved_number\nend",
"def get_max_score(list)\n max = list[0].value\n list.each do |l|\n max = l.value if l.value > max\n end\n return max\n end",
"def max list = @alt\n values = self[list]\n values.reduce(0){ |memo,v| (v>memo ? v : memo) }\n end",
"def max_element\n self.to_a.max\n end",
"def lis(array)\n helper = Array.new(array.length, 1)\n (1..array.length - 1).each do |array_index|\n (0..array_index).each do |inner_value|\n if array[inner_value] < array[array_index]\n helper[array_index] = [helper[inner_value] + 1, helper[array_index]].max\n end\n end\n end\n helper.max\nend",
"def find_greatest(numbers)\n saved_number = nil\n\n\n numbers.each do |num|\n saved_number ||= num\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n\n\nsaved_number\nend",
"def highest_value\n @values.inject { |highest, val| highest = (val < 21 && val > highest) ? val : highest }\n end",
"def maximize(range = 1..1_000_000)\n (range).lazy_map { |x| [yield(x), x] }.max[1]\nend",
"def max\n\t\tmax = @m[0][0]\n\t\tfor i in 0...@fi \n\t\t\tfor k in 0...@co\n\t\t\t\tif (@m[i][k] > max) then\n\t\t\t\t\tmax=@m[i][k] \n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tmax\n\tend",
"def max_value(cakes, capacity)\n return 0 if capacity == 0\n max = 0\n cakes.keys\n .select { |x| x <= capacity }\n .each { |x|\n max = [max, max_value(cakes, capacity - x) + cakes[x]].max \n }\n\n max\nend",
"def max_value\n max = 0\n\n @matrix.each do |row|\n row_max = row.max\n max = row_max if row_max > max\n end\n\n max\n end",
"def max \n if max_element.kind_of? Array\n max_element.first\n else\n max_element\n end\n end",
"def find_highest(array)\n highest = nil;\n for num in array do\n if highest\n if num > highest\n highest = num\n end\n else\n highest = num\n end\n end\n puts highest\nend",
"def find_greatest(numbers)\n saved_number = numbers[0]\n\n numbers.each do |num|\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n\n saved_number\nend",
"def max(array)\n\tn = 0\n\tarray.each do |x|\n\t\tif x > n\n\t\t\t n = x\n\t\tend\n\tend\n\t puts n\nend",
"def max\n return -1 if @count == 0\n return @array[0]\n end",
"def maximum\n return self[0]\n end",
"def maximum(arr)\n\t# for empty input\n\treturn nil if arr.nil? or arr.length == 0\n\tmax = arr[0]\n\tarr.each do |elem|\n\t\tmax = elem if elem > max\n\tend\n\tmax\nend",
"def find_max_number(any_array)\n\treference = any_array[1]\n\tany_array.each do |number|\n\t\tif number > reference\n\t\treference = number\n\t\tend\n\tend \n\treference\nend"
] | [
"0.7870319",
"0.7728349",
"0.75338215",
"0.75244635",
"0.7417176",
"0.736059",
"0.72589713",
"0.7148422",
"0.7146673",
"0.7130707",
"0.7103043",
"0.70864034",
"0.7072057",
"0.7059228",
"0.7057416",
"0.70474875",
"0.6995022",
"0.6993832",
"0.69818515",
"0.6975569",
"0.69658566",
"0.69395214",
"0.69393504",
"0.6939017",
"0.693118",
"0.69104654",
"0.68764436",
"0.6864948",
"0.6855119",
"0.6841935",
"0.6835575",
"0.68347114",
"0.6826916",
"0.6826306",
"0.6823197",
"0.68018764",
"0.6772233",
"0.6770698",
"0.67333245",
"0.67255205",
"0.6724098",
"0.6706331",
"0.6704266",
"0.66994",
"0.66683036",
"0.666262",
"0.66356945",
"0.6630189",
"0.66099024",
"0.66099024",
"0.66099024",
"0.66080475",
"0.66061944",
"0.6599332",
"0.65850294",
"0.65539354",
"0.65536475",
"0.6533359",
"0.6525469",
"0.651313",
"0.65058255",
"0.6502255",
"0.6476631",
"0.6468149",
"0.64667135",
"0.64667135",
"0.6462145",
"0.6458372",
"0.64576364",
"0.64491004",
"0.6436395",
"0.6430294",
"0.64255154",
"0.6425365",
"0.642496",
"0.64189726",
"0.64106196",
"0.6410415",
"0.6407186",
"0.6390872",
"0.6359065",
"0.63407296",
"0.63399655",
"0.633867",
"0.6322094",
"0.63203883",
"0.6314072",
"0.6310512",
"0.63023144",
"0.62914884",
"0.627976",
"0.6276135",
"0.62695163",
"0.6265718",
"0.62635964",
"0.62630755",
"0.62518924",
"0.62517476",
"0.62388074",
"0.6232957"
] | 0.7616087 | 2 |
say hi to everyone | def say_hi
if @names.nil?
puts "..."
elsif @names.respond_to?("each")
#@names is list. iterate.
@names.each do |name|
puts "Hello #{name}!"
end
else puts "Hello #{@names}!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sayHi\n\t\tputs(greet)\n\tend",
"def say_hi\n\t\tputs 'saying hi'\n\tend",
"def say_hi\n \tputs \"hello user\" #you must call the method by calling. out its name \"say_hi\"\n end",
"def greet\n self.say \"Hello, I am #{@config[:nick]}. I am the resident uber-bot. To learn more, type '.about'.\"\n end",
"def say_hi\n\t\tputs \"Hello!\"\n\tend",
"def say_hi\n puts \"hi\"\n end",
"def saymessage\n puts \"hi programers\"\n puts \"I am hungy\"\nend",
"def say_hi\n puts \"Hi!\"\n end",
"def greetings\n\tputs \"Greetings friend!\"\nend",
"def greeting_hello\n answer_with_message(\"Halo bos, ada yang bisa saya bantu ?\")\n end",
"def greet_user\n greetings = %w[\n bonjour hola hallo sveiki namaste shalom salaam szia halo ciao\n ]\n first_name = message.from.nil? ? '' : ', ' + message.from.first_name\n send_message \"#{greetings.sample.capitalize}#{first_name}!\\n Enter /help for options.\"\n end",
"def sayhi\n puts \"Hello user\"\nend",
"def say_hello\n\tputs \"Bonjour!\"\nend",
"def greet(m)\n return unless m.message =~ /\\b(hellos?|hi(ya)?|howdy|hey|greetings|yo|sup|hai|hola),? #{m.bot.nick}\\b/i\n greetings = ['Hello', 'Hi', 'Hola', 'Ni hao', 'Hey', 'Yo', 'Howdy']\n greeting = greetings[rand(greetings.size)]\n m.reply \"#{greeting}, #{m.user.nick}!\"\n end",
"def say_hi\n\t\tif @name.nil?\n\t\t\tputs \"...\"\n\t\telsif @names.respond_to(\"each\")\n\t\t\t# @names is a list of some kind, iterate!\n\t\t\[email protected] do |name|\n\t\t\t\tputs \"Hello #{name}!\"\n\t\t\tend\n\t\telse\n\t\t\tputs \"Hello #{@names}!\"\n\t\tend\n\tend",
"def say_hi\n \"Hi!\"\n end",
"def greet\n puts '------------------------'\n puts \"Greetings to you #{@name}\"\n end",
"def greet\n puts \"# Welcome to Mastermind!\"\n puts \"# Good luck!\"\n end",
"def sayHi\n \n\t\tif @names.nil?\n\t\t\tputs \"...\"\n\t\t \n\t\telsif @names.respond_to?(\"each\")\n\t\t\[email protected] do |name|\n\t\t\tputs \"Hi #{name}!\"\n\t\tend\n\t\t\n\t\telse\n\t\t\tputs \"Hi #{@names}\"\n\t\tend\n \n\tend",
"def hi\n \t\t\tputs \"Ich heiße #{@name} und mir geht es zu #{@health}% gut.\"\n \t\tend",
"def say_hello (name)\n\t\t\t\tputs \"Ich bin #{name}\"\n\t\t\tend",
"def say_hello (name)\n\t\t\t\tputs \"Ich bin #{name}\"\n\t\t\tend",
"def say_hi\n\t\tif @names.nil?\n\t\t\tputs \"...\"\n\t\telsif @names.respond_to?(\"each\")\n\t\t\[email protected] do |name|\n\t\t\t\tputs \"Hello #{name}!\"\n\t\t\tend\n\t\telse\n\t\t\tputs \"Hello #{@names}\"\n\t\tend\n\tend",
"def sayHi\n\t\tputs \"hello, my name is #{@name}\"\n\tend",
"def sayMessage\r\n puts \"Hey Programmers!\"\r\n puts \"What's for lunch?\"\r\nend",
"def say_hello\n\t'hello'\nend",
"def say_hi\n\t\tif names.nil?\n\t\t\tputs \"...\"\n\t\telsif @names.respond_to?(\"each\")\n\t\t\[email protected] do |name|\n\t\t\t\tputs \"Hello #{name}!\"\n\t\t\tend\t\n\t\telse\n\t\t\tputs \"Hello #{@names}!\"\n\t\tend\n\tend",
"def say_hi\n if @names.nil?\n puts \"...\"\n # If the @names object responds to each, it is something that you can iterate over, so iterate over it and greet each person in turn.\n #Finally, if @names is anything else, just let it get turned into a string automatically and do the default greeting.\n elsif @names.respond_to?(\"each\")\n #each is a method that accepts a block of code then runs that block of code for every element in a list, and the bit between do and end is just such a block.\n #A block is like ananonymous function or lambda. The variable between pipe characters is the parameter for this block.\n @names.each do |name|\n puts \"Hi #{name}\"\n end\n else\n puts \" Hi #{@names}\"\n end\n end",
"def speak\n puts \"I'm a person\"\n end",
"def say_hi\n puts \"hi\"\nend",
"def check_for_greet(cmd, nick)\n if cmd =~ /\\b(Hi|Hello|Hey|Hay|Hola|Sup|Whats up|Yo)\\b/i\n self.say \"#{@greetings[rand(@greetings.length)]}, #{nick}\"\n end\n end",
"def say_hi\n puts \"hi\"\nend",
"def say_hello (name, health=0)\n\t\t\t\t\"Ich bin #{name} mit einem Wert von #{health}\"\n\t\t\tend",
"def say_hello\t\t\t\t\t\n puts \"Dire Bonjour peut sauver des meres !\" \t\t#Petite référence à VALD\nend",
"def magic_welcome(event)\n # TODO: Ditch this call to report - move to report lib if necessary\n report \"#{event.from} welcome message: #{event.message}\"\n if (event.message =~ /(\\S+)!\\S+$/)\n @me = $1\n elsif (event.message =~ /(\\S+)$/)\n @me = $1\n end\n\n @registered = true\n mode @me, 'i'\n end",
"def speak\n puts \"ho, ho, ho! happy hollandaise!\"\n end",
"def say_hello\n puts \"Hello, what's your name?\"\n print \"User: \".blue\n name = gets.chomp\n bot_response(\"Hello #{name}\")\nend",
"def say_hello (name)\n\t\t\t\t\"Ich bin #{name}\"\n\t\t\tend",
"def say(message)\n output.puts message\n end",
"def say_hello_to(name)\n puts \"Hello, #{name}. It's good to see you.\"\n puts \" \"\n end",
"def say_hello\n\t\"Ich bin #{@name} mit einem Wert von #{@health}.\"\n\tend",
"def say_hi\n puts \"Hello\"\nend",
"def greet\n separator\n puts \"Welcome to #{pastel.bright_cyan('Groupie')}.\"\n puts \"Keep up with your favorite bands, never miss a show!\"\n puts \"Type #{pastel.bright_cyan('concerts')} to get started.\"\n separator\n end",
"def greet\n separator\n puts \"Welcome to #{pastel.bright_cyan('Groupie')}.\"\n puts \"Keep up with your favorite bands, never miss a show!\"\n puts \"Type #{pastel.bright_cyan('concerts')} to get started.\"\n separator\n end",
"def say_hello_personal(name)\n\tputs \"Hello \" + name\nend",
"def welcome\n puts message_list[:welcome]\n # help\n end",
"def say_name\n puts \"Bellossom!\"\n end",
"def say_hi()\n\t\"Hello\"\nend",
"def say_hello (name)\n\tputs \"Ich bin #{name}.\"\nend",
"def shout\n 'Yay!'\n end",
"def say\n send_text \"You just said: #{params}\"\n end",
"def say_name\n puts \"Bonsly!\"\n end",
"def say_hi\n if @names.nil?\n puts \"...\"\n else \n if @names.respond_to?(\"each\")\n @names.each do |name|\n puts \"Hello #{name.capitalize}!\"\n end\n else\n puts \"Hi #{@names}!\"\n end\n end\n end",
"def greet\n 'Ahoy Mateys!'\n end",
"def speak\n\t\tputs \"Meow. My name is #{@name.capitalize}.\"\n\t\tputs \"I am #{@age} years old and I live in #{@location}\"\n\t\tputs \"I am a #{@colour.downcase} #{@breed.downcase}.\"\n\tend",
"def say_greeting\n system 'say \"Good Luck\"'\n end",
"def welcome_user\n puts \"Welcome to #{pastel.bright_cyan('Groupie')}.\"\n puts \"Keep up with your favorite bands, never miss a show!\"\n puts \"Type #{pastel.bright_cyan('exit')} at any time to quit the app.\"\n puts \"Type #{pastel.bright_cyan('concerts')} to get started.\"\n end",
"def say_that_thing_you_say\n \"#{self.name} always says: #{self.catchphrase}\"\n end",
"def talk\n puts \"Hello!\"\n end",
"def greeting(m, message)\n if message =~ /help/\n m.reply help_message(m.user.nick)\n else\n m.reply \"#{m.user.nick}: Thanks for asking! I did not recognize your question. Try asking me for help.\"\n end\n end",
"def say_hi\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"each\")\n @names.each do |name|\n puts \"hello #{name}\"\n end\n else\n puts \"HELLO #{@names}\"\n end\n end",
"def personalChat\n puts \"This is a Personal Chat\"\n # puts message\n end",
"def greet\n\t\tputs \"Hi, my name is #{@name}\"\n\tend",
"def do_say(message)\n send \"You say '#{message}'\"\n other_players.each { |p| p.send \"#{name} says '#{message}'\" }\n end",
"def say_hello (name)\n\tputs \"Ich bin #{name}\"\nend",
"def greeter\nend",
"def say_hello\n puts \"Wilkomen Welt!\"\nend",
"def sayByeBye(user)\r\n puts \"Bye Bye #{user}\"\r\nend",
"def say text\n @output.say text\n end",
"def greets(name)\n puts \"hello #{name}, my name is #{@greeter_name}\"\n end",
"def say\n puts \"Hi\"\nend",
"def say\n puts \"Hi\"\nend",
"def speak\n puts \"WOOF WOOF\"\n end",
"def say_hello(name, num)\n\t\tputs \"Greetings, #{name}.\"\n\t\tputs \"you are number #{num}.\"\n\tend",
"def speak\n \"#{name} says Assalaam alaykum\"\n end",
"def hey(message)\n case message\n when shout then \"Woah, chill out!\"\n when question then \"Sure.\"\n when silence then \"Fine. Be that way!\"\n else \"Whatever.\"\n end\n end",
"def say(msg)\n print msg + \"\\r\\n\"\n end",
"def welcome_message\n puts \"Welcome to Everything but the Kitchen Sink!\"\n end",
"def say_hi \n expression = \"I am a genius\"\n puts expression\n end",
"def say(message)\n puts green(message) if self.verbose \n end",
"def greeting(name)\n\t\tputs \" Hi there #{name}, how are you doing today?\"\n\tend",
"def say_hello\n puts \"HELLOOOOO!\"\nend",
"def greet(folks); \"Hi, #{folks}!\"; end",
"def say_hello\n 'hello'\n end",
"def personal_chat(message) \n puts \"This is a Personal Chat\" \n puts message \n end",
"def say_hi\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"each\")\n @names.each do |name|\n puts \"Hello #{name}\"\n end\n else\n puts \"Hello #{@names}\"\n end\n end",
"def say_hi\n if @names.nil?\n return '...'\n elsif @names.class == Array\n # @names is a list of some kind, iterate!\n @names.each do |name|\n puts \"Hello #{name}!\"\n end\n else\n return \"Hello #{@names}!\"\n end\n return '...' if @names.nil?\n return @names.map { |name| \"Hello #{name}!\" } if @names.class == Array\n \"Hello #{@names}!\"\n end",
"def say_hi\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"each\")\n # @names is a list of some kind, iterate!\n @names.each do |name|\n puts \"Hello #{name}!\"\n end\n else\n puts \"Hello #{@names}!\"\n end\n end",
"def say_hi\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"each\")\n # @names is a list of some kind, iterate!\n @names.each do |name|\n puts \"Hello #{name}!\"\n end\n else\n puts \"Hello #{@names}!\"\n end\n end",
"def say_hi\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"each\")\n # @names is a list of some kind, iterate!\n @names.each do |name|\n puts \"Hello #{name}!\"\n end\n else\n puts \"Hello #{@names}!\"\n end\n end",
"def say_hi\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"each\")\n # @names is a list of some kind, iterate!\n @names.each do |name|\n puts \"Hello #{name}!\"\n end\n else\n puts \"Hello #{@names}!\"\n end\n end",
"def tweet_greeting\n log \"greeting\"\n post \"Starting meitan-bot. Hello! #{Time.now.strftime('%X')}\"\n end",
"def hello(name)\n output = []\n output << \"from #{options[:from]}\" if options[:from]\n output << \"Hello #{name}\"\n output = output.join(\"\\n\")\n puts options[:yell] ? output.upcase : output\n puts \"> done saying hello\" if options[:verbose]\n end",
"def say_hello(name)\n\t\"Ich bin #{name}.\"\nend",
"def say_hi\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"each\")\n # @names appears to be an list (Array) of some kind, so lets iterate!\n @names.each do |name| # we specify that each item should be referenced by 'name'\n puts \"Hello #{name}!\"\n end\n else\n puts \"Hello #{@names}!\"\n end\n end",
"def welcome_the_user()\n puts \"Hi there!\"\nend",
"def say_name\n puts \"Marill!\"\n end",
"def speak\n puts 'bark bark bark'\n end",
"def say_that_thing_you_say\n \"#{self.name} always says: #{self.catchphrase}\"\n end",
"def welcome(nick_name, name)\n puts \"Hello, my friends call me #{nick_name}, but I prefer #{name}.\"\nend",
"def on_hello(content, client)\n OutputLogger.logger.info \"Bot is online!!!\"\n end"
] | [
"0.7880603",
"0.7646402",
"0.75421375",
"0.7364657",
"0.7333217",
"0.73037755",
"0.72600377",
"0.7242886",
"0.7207713",
"0.7162793",
"0.71617854",
"0.7118497",
"0.7084572",
"0.70705736",
"0.70638174",
"0.70421696",
"0.70306635",
"0.70202744",
"0.7011164",
"0.6994244",
"0.690503",
"0.690503",
"0.6904669",
"0.6862394",
"0.6853572",
"0.6851126",
"0.6846743",
"0.6845176",
"0.6836863",
"0.6828644",
"0.6824468",
"0.68162906",
"0.6815418",
"0.67984426",
"0.67829376",
"0.6771003",
"0.6767758",
"0.67528355",
"0.6743891",
"0.67375475",
"0.67353046",
"0.67217004",
"0.6714995",
"0.6714995",
"0.67107904",
"0.670988",
"0.6702913",
"0.6699673",
"0.6699418",
"0.66939783",
"0.6663852",
"0.6661553",
"0.666059",
"0.66573536",
"0.6650559",
"0.66424334",
"0.66166073",
"0.66130805",
"0.66090167",
"0.6593337",
"0.6586419",
"0.6582989",
"0.65795255",
"0.6575595",
"0.65746236",
"0.6574143",
"0.6573579",
"0.6573315",
"0.65708935",
"0.6570803",
"0.657061",
"0.657061",
"0.65665466",
"0.6565965",
"0.65636384",
"0.6560336",
"0.65562063",
"0.6555426",
"0.65543884",
"0.65539175",
"0.6549622",
"0.65454775",
"0.6541222",
"0.6527012",
"0.6525197",
"0.6521121",
"0.65176827",
"0.65173334",
"0.65173334",
"0.65173334",
"0.65173334",
"0.65096796",
"0.65081596",
"0.6501896",
"0.6497764",
"0.64949995",
"0.6492449",
"0.6481959",
"0.6481851",
"0.647846",
"0.6471631"
] | 0.0 | -1 |
Say goodbye to everyone | def say_bye
if @names.nil?
puts "..."
elsif @names.respond_to?("join")
puts "Goodbye #{@names.join(", ")}. Come back soon!"
else
puts "Goodbye #{@names}. Come back soon!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def say_goodbye\n\t\tgoodbye = \"Thanks for playing the Virtual Crazy\" +\n\t\t\t\t\"8-Ball game!\\n\\n\"\n\tend",
"def say_bye\n\t\tif @names.nil?\n\t\t\tputs \"...\"\n\t\telsif @names.respond_to?(\"join\")\n\t\t\t\tputs \"Goodbye #{@names.join(\", \")}. Come back soon!\"\n\n\t\telse\n\t\t\tputs \"Good bye #{@names}. Come back soon!\"\n\t\tend \n\tend",
"def say_goodbye\r\n\t\tgoodbye = \"Thanks for playing the Virtual Crazy 8-Ball game! \\n\\n\" +\r\n\t\t\"Student: T. J. Flesher \\n\\nhttp://www.bellevue.edu/\"\t\t\r\n\t\tputs goodbye\r\n\tend",
"def goodbye\n puts Rainbow(\"Thanks for visiting. Goodbye...\").indianred.bright.underline\n end",
"def say_bye\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"join\")\n puts \"Goodbye #{names.join(\", \")}\"\n else\n puts \"Goodbye #{names}\"\n end\n end",
"def goodbye \n puts \"Don't leave hungry!\"\n end",
"def say_bye\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"join\")#반응하지않는다면 names는 문자열\n puts \"Goodbye #{@names.join(\", \")}. Come back soon!\"\n else\n puts \"Goodbye #{@names}. Come back soon!\"\n end\n end",
"def say_bye\n\t\[email protected]?\n\t\t\tputs \"...\"\t\n\t\telsif @names.respond_to?(\"join\")\n\t\t\t#join the list elements with commas\n\t\t\tputs \"Goodbye #{@names.join(\", \")}. Come back soon!\"\n\n\t\telse\n\t\t\tputs \"Goodbye #{names}, come back soon\"\n\t\t\t\n\t\tend\n\tend",
"def say_bye\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"join\")\n puts \"Goodbye #{@names.join(\", \")}. Come back soon!\"\n else\n puts \"Goodbye #{@names}. Come back soon!\"\n end\n end",
"def say_bye\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"join\")\n # Join the list of items with commas\n puts \"Goodbye #{@names.join(\", \")}. Come back soon!\"\n else\n puts \"Goodbye #{@names}. Come back soon!\"\n end\n end",
"def say_goodbye\r\n goodbye = \"Thanks for playing the Virtual Crazy 8-Ball game!\\n\\n\" +\r\n \"By Corey Hicks\\n\" +\r\n \"https://www.bruin.bellevue.edu\"\r\n puts goodbye\r\n end",
"def say_bye\n\t\tif @names.nil?\n\t\t\tputs \"...\"\n\t\telsif @names.respond_to?(\"join\")\t\n\t\t\t#join the list elements with commas\n\t\t\tputs \"Goodbye #{@names.join(\",\")}. come back son!\"\n\t\telse\n\t\t\tputs \"Goodbye #{@names}. come back soon\"\n\t\tend\n\tend",
"def goodbye\n puts \"\", \"Thank you! Goodbye :)\"\n end",
"def say_bye\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"join\")\n p \"Goodbye #{@names.join(\", \")}. Come back soon!\"\n else\n p \"Goodbye #{@names}. Come back soon!\"\n end\n end",
"def say_bye\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"join\")\n puts \"Goodbye #{@names.join(', ')}. Come back soon!\"\n else\n puts \"GoodBye #{@names}. Come back soon!\"\n end\n end",
"def say_bye\n return '...' if @names.nil?\n if @names.class == Array\n # Join the list elements with commas\n return \"Goodbye #{@names.join(\", \")}. Come back soon!\"\n end\n # return \"Goodbye #{@names.join(\", \")}. Come back soon!\" if @names.class == Array\n \"Goodbye #{@names}. Come back soon!\"\n>>>>>>> 2cd44c7 (Changes after Cesar verification)\n end",
"def goodbye \n\t\tsystem(\"clear\")\n puts \"#######################\"\n puts \"# #\"\n puts \"# Thank you for #\"\n puts \"# #\"\n puts \"# visiting the #\"\n puts \"# #\"\n puts \"# Bank of Hamish #\"\n puts \"# #\"\n puts \"# GOODBYE! #\"\n puts \"# #\"\n puts \"# #\"\n\t\tputs \"#######################\"\n\tend",
"def goodbye\n puts GOODBYE\n end",
"def goodbye\n puts \"Goodbye, thankyou for banking with AAB\".yellow\n end",
"def say_bye\n if names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"join\")\n puts \" Goodbye #{@names.join(\" , \")}. Come back again!\"\n else\n puts \"Goodbye #{@names}. Come back again!\"\n end\n end",
"def say_bye\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"join\")\n # join the list elements\n puts \"Goodbye #{@names.join(\", \")}. Come back soon!\"\n else\n puts \"Goodbye #{@names}. Come back soon!\"\n end\n end",
"def farewell_message\n puts \"Program Exiting...\".red\n puts \"Goodbye #{@username}!\".blue\n end",
"def goodbye \nputs \"see you tomorrow for more Makeup :)\"\nend",
"def goodbye\n return \"Thanks for playing! See you soon!\".yellow\n system exit\n end",
"def ends_with_goodbye\n /WRITE ME/\n end",
"def say_bye\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"join\")\n # Join the list elements with commas\n puts \"Goodbye #{@names.join(\", \")}. Come back soon!\"\n else\n puts \"Goodbye #{@names}. Come back soon!\"\n end\n end",
"def goodbye(drink)\n puts \"Here is your #{drink}, see you next time\"\n end",
"def goodbye\n puts \"Safe travels!\"\n end",
"def goodbye\n end",
"def say_bye\n # If @names is empty, it will print ...\n if @names.nil?\n puts \"...\"\n # If @names responds to join, which is only useable on a list such as an array, it will put all of the names into one string\n elsif @names.respond_to?(\"join\")\n # Joins the list elements with commas\n puts \"Goodbye #{@names.join(\", \")}. Come back soon!\"\n # Runs if there is a single element stored in @names\n else\n puts \"Goodbye #{@names}. Come back soon!\"\n end\n end",
"def goodbye\n puts \"Come back when you get hungry!!!\"\nend",
"def goodbye\n\t\tputs \"\\nThanks for playing #{self.player_name}!\\n\"\n\t\tputs \"You finished with #{player_record[\"Wins\"]} wins and #{player_record[\"Losses\"]} losses\"\n\tend",
"def good_bye\n puts \"Gracias por visitarnos. Regresa pronto\" \n end",
"def goodbye(name)\n say = \"Bye \" + name + \". \"\n return say\nend",
"def say_bye\n if m_names.nil?\n puts \"...\"\n elsif m_names.respond_to?(\"join\")\n # Join the list elements with commas\n puts \"Goodbye #{m_names.join(\", \")}. Come back soon!\"\n else\n puts \"Goodbye #{m_names}. Come back soon!\"\n end\n end",
"def bye\n puts \"bye\"\n end",
"def goodbye\n puts \"Thanks for using the Card Seeker. Come back soon.\"\n end",
"def speak2\n puts \"Goodbye world\"\n end",
"def someone_did_quit(stem, person, msg)\n end",
"def exit\n \"Goodbye! Thanks for playing!\"\n end",
"def say_bye \n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"join\")\n #Join the list elements with commas \n puts \"Goodbye #{@names.join(\", \")}. Come back soon!\"\n else \n puts \"Goodbye #{@names}. Come back soon!\"\n end \n end",
"def goodbye(name)\n\tstr = \"Bye \" + name + \".\"\n return str\nend",
"def goodbye\n puts \"Thank you for using the Covid 19 CLI Tracker. Please Wash Your Hands.\"\n end",
"def greeting_hello\n answer_with_message(\"Halo bos, ada yang bisa saya bantu ?\")\n end",
"def bye_message\n message = \"Panacea's work is done, enjoy!\"\n say \"\\n\\n\\e[34m#{message}\\e[0m\"\n end",
"def sayGoodbye\t\n\t\treturn super << \" and also from MyOtherClass\"\n\tend",
"def say_bye\n puts \"Bye \" + define_names\n end",
"def say_goodbye \n puts \"Thanks for running the program! This function was passed into a block using the yield keyword.\"\nend",
"def sayGoodbye\n super\n return << \"and MyOtherClass\"\n end",
"def say_bye_and_exit\n puts\n puts \"\\033[1m\\033[34mHave a nice day!\\033[0m\"\n puts\n exit 0\nend",
"def sayHi\n\t\tputs(greet)\n\tend",
"def die(reason)\n puts \"#{reason}, you did a good job though!\"\n exit(0)\nend",
"def hey(message)\n case message\n when shout then \"Woah, chill out!\"\n when question then \"Sure.\"\n when silence then \"Fine. Be that way!\"\n else \"Whatever.\"\n end\n end",
"def sayGoodbye\n super << ' and also from MyOtherClass'\n end",
"def goodbye(name)\n return = \"Bye \" + name + \".\"\nend",
"def die(msg=\"unknown problem occurred\")\n abort [\n \"\",\n \"🐒\",\n \" ⌇\",\n \" 💩 DERP!! Um, whut: #{msg}\",\n \"\",\n \"\",\n ].join(\"\\n\")\n end",
"def saymessage\n puts \"hi programers\"\n puts \"I am hungy\"\nend",
"def seeYa()\n abort(\"\\nQuiting now. Bye!\") \nend",
"def display_exiting!(text)\n # create goodbye message\n # display welformatted conclusion message\n system \"clear\"\n msg = colorize(\" #{text.upcase} \", $font_colors[:cyan])\n puts \"\\n#{msg.center(77)}\\n\\n\"\n end",
"def greet\n self.say \"Hello, I am #{@config[:nick]}. I am the resident uber-bot. To learn more, type '.about'.\"\n end",
"def exit_now\n\t\tputs \"Goodbye!\"\n\tend",
"def greetings\n\tputs \"Greetings friend!\"\nend",
"def exit_jukebox\nputs \"Goodbye\"\nend",
"def exit_game\n puts \"Goodbye!\"\nend",
"def greet\n puts '------------------------'\n puts \"Greetings to you #{@name}\"\n end",
"def quit(reason = \"You told me to\")\n @t.puts \"QUIT :#{reason}\"\n exit\n end",
"def say_hello_to(name)\n puts \"Hello, #{name}. It's good to see you.\"\n puts \" \"\n end",
"def say_name\n puts \"Bellossom!\"\n end",
"def exit_game\n print clear_screen, \"\\n\"\n print \"\\\"What business is it of yours where I'm from, friendo?\\\"\", \"\\n\"\n print '-- Anton Chigurh : No Country for Old Men', \"\\n\\n\"\n throw :exit\n end",
"def say_hello\t\t\t\t\t\n puts \"Dire Bonjour peut sauver des meres !\" \t\t#Petite référence à VALD\nend",
"def deaf\n\tputs \"Grandma: HELLO SONNY!\"\n\t\n\tloop do\n\t\ttriggered = false\n\t\tif talking() == false\n\t\t\tputs \"*Grandma doesn't want to say goodbye*\"\n\t\t\tif talking() == false\n\t\t\t\tputs \"*Grandma doesn't want to say goodbye*\"\n\t\t\t\tif talking() == false\n\t\t\t\t\ttriggered = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tbreak if triggered == true\n\tend\nend",
"def saygoodbye(name=\"John\", surname=\"Doe\")\n puts (\"Good Bye \" + name + \" \" + surname)\nend",
"def sayMessage\r\n puts \"Hey Programmers!\"\r\n puts \"What's for lunch?\"\r\nend",
"def hey(message)\n case message\n when nil, empty?\n \"Fine. Be that way!\"\n when yelling?\n \"Woah, chill out!\"\n when question?\n \"Sure.\"\n else\n \"Whatever.\"\n end\n end",
"def greet(m)\n return unless m.message =~ /\\b(hellos?|hi(ya)?|howdy|hey|greetings|yo|sup|hai|hola),? #{m.bot.nick}\\b/i\n greetings = ['Hello', 'Hi', 'Hola', 'Ni hao', 'Hey', 'Yo', 'Howdy']\n greeting = greetings[rand(greetings.size)]\n m.reply \"#{greeting}, #{m.user.nick}!\"\n end",
"def doNothing\n\n system(%Q{say -v \"karen\" \"You do nothing and watch as 5 innocent men die\"})\n system(%Q{say -v \"karen\" \"Choosing to do nothing is still a chose\"})\n system(%Q{say -v \"karen\" \"You are responsible for these mens deaths\"})\n system(%Q{say -v \"karen\" \"and the blood is on your hands \"})\n\n end",
"def almost_die\n puts 'Eva almost die!'\n end",
"def goodbye\n puts_blanks\n puts \"Have a great day!\".colorize( :blue )\n puts \"See you soon!\".colorize( :blue )\n blank\n # @market.clear_data\n end",
"def bye; end",
"def leave(name)\n\t\tputs \"Thanks for playing #{name}, Come back soon!\"\n\t\tsleep(3)\n\t\tprint CLEAR\n\t\texit\n\tend",
"def noSecret()\r\n puts \"I won’t tell you our secret\"\r\n end",
"def greeting\n system 'clear'\n puts WELCOME_MESSAGE\n end",
"def exit_message \n\t\t\t\talert_menu \"Thanks for playing!\", false\n\t\t\tend",
"def quit\n send_command(:quit)\n read_response # \"Bye!\"\n disconnect\n end",
"def exit_with(msg)\n say msg\n exit\nend",
"def exit_message\n linebreak\n @players.each{ |p|\n result = p.wallet - 1000\n outcome = result >= 0 ? \"richer\" : \"poorer\"\n puts \"#{p.name}, you walked away $#{result.abs} #{outcome}.\"\n puts \"Final take: $#{p.wallet}\"\n linebreak\n }\n\n puts \"Thank you for playing Blackjack at the Ruby Casino!\"\n puts \"You may want to consider hiring me for a summer internship at Rapleaf.\"\n puts \"Copyright 2009 Alex Burkhart.\"\n end",
"def bye\n if @names.nil?\n puts \"Bye World, come back soon!\"\n elsif @names.respond_to?(\"join\")\n puts \"Bye #{@names.join(\", \")}, come back soon!\"\n else\n puts \"Bye #{names}, come back soon!\"\n end\n end",
"def bark\n say('ouah ouah')\n nil\n end",
"def leave\n puts ' ____________________________________________________________ '\n puts '| |'\n puts '| Sorry to see you leave... |'\n puts '| Thank you for using Buda-Bot. See you soon! |'\n puts '|____________________________________________________________|'\nend",
"def say_hi\n\t\tputs \"Hello!\"\n\tend",
"def hi\n \t\t\tputs \"Ich heiße #{@name} und mir geht es zu #{@health}% gut.\"\n \t\tend",
"def goodbye\r\n\t\traise NoMethodError\r\n\tend",
"def exit_game(humanName)\n puts \"Thank you for playing, #{humanName.capitalize}!\"\n exit\nend",
"def say_hello (name, health=0)\n\t\t\t\t\"Ich bin #{name} mit einem Wert von #{health}\"\n\t\t\tend",
"def quit(message=\"\")\n sendmsg \"QUIT :#{message}\"\n end",
"def say_hi\n\t\tif @name.nil?\n\t\t\tputs \"...\"\n\t\telsif @names.respond_to(\"each\")\n\t\t\t# @names is a list of some kind, iterate!\n\t\t\[email protected] do |name|\n\t\t\t\tputs \"Hello #{name}!\"\n\t\t\tend\n\t\telse\n\t\t\tputs \"Hello #{@names}!\"\n\t\tend\n\tend",
"def warning(msg, ask_continue: true)\n tell(colorize(\"☞ \", :magenta) + colorize(msg, :yellow))\n exit(-1) if ask_continue && !quiz(\"continue\")\n end",
"def quit(message=\"ByeAreSee\")\n @quit = true\n self.send_raw_line(\"QUIT :\"+message.to_s)\n @socket.close\n end",
"def say_hello\n\tputs \"Bonjour!\"\nend",
"def say_greeting\n system 'say \"Good Luck\"'\n end"
] | [
"0.79500306",
"0.78127456",
"0.775759",
"0.77029324",
"0.76021844",
"0.7593056",
"0.7562311",
"0.7558499",
"0.75549096",
"0.75413096",
"0.7504892",
"0.75041276",
"0.745264",
"0.74478894",
"0.7432688",
"0.7405693",
"0.7387379",
"0.7376698",
"0.7368708",
"0.7315142",
"0.7278047",
"0.72743225",
"0.7265999",
"0.7256428",
"0.7235088",
"0.7234969",
"0.71674573",
"0.7156428",
"0.7121536",
"0.71131647",
"0.70117295",
"0.6985539",
"0.69816",
"0.6960881",
"0.6882157",
"0.6856446",
"0.67984366",
"0.6793453",
"0.6791578",
"0.67725074",
"0.6694181",
"0.6686722",
"0.6663334",
"0.6639871",
"0.66137874",
"0.6578101",
"0.6560537",
"0.6477513",
"0.64774245",
"0.64503586",
"0.64267427",
"0.6411443",
"0.6400721",
"0.63912004",
"0.6364189",
"0.6363932",
"0.6345487",
"0.63427335",
"0.63410634",
"0.6328999",
"0.6326236",
"0.63224566",
"0.6311531",
"0.6261849",
"0.6257146",
"0.6248259",
"0.6240405",
"0.62369096",
"0.6235955",
"0.62286574",
"0.620663",
"0.61906546",
"0.61744195",
"0.6160371",
"0.61533934",
"0.6151295",
"0.61485577",
"0.614043",
"0.6128932",
"0.610987",
"0.61083287",
"0.60841244",
"0.6079333",
"0.607507",
"0.60669416",
"0.60631317",
"0.6058326",
"0.6047253",
"0.6046168",
"0.6030499",
"0.60177",
"0.6010658",
"0.6007204",
"0.6003861",
"0.6002364",
"0.59826773",
"0.59809357",
"0.597951",
"0.5978191",
"0.5972748"
] | 0.72323585 | 26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.